Gitlab was updated! v14.5.1

Verified Commit 15d7a78e authored by Simão Afonso @ Powertools Tech's avatar Simão Afonso @ Powertools Tech
Browse files

Initial Commit

parents
# VirtuaLaTeX
Like `venv` and `pip`, for LaTeX.
## Usage
Create a virtual LaTeX environment on the folder `$FOLDER`. Defaults to the
current location.
```
$ virtualatex $FOLDER
```
The virtual environment is (explicitly) compatible with the `venv`, so you can
create a virtual LaTeX environment before of after creating a Python `venv`.
Add `$FOLDER/bin` to your `PATH` (or just activate the `venv`) to have `tlmgr`
available and configured correctly.
Here is the [documentation](https://www.tug.org/texlive/doc/tlmgr.html). The
important command is:
- `tlmgr install $PACKAGE`: Install a CTAN package
If you have a list of LaTeX dependencies on a text file (one per line), use:
```
<$FILE xargs -- tlmgr install
```
## Pedantry
This technically installs the most bare-bones TeXlive schema, with three essential packages:
- latex-bin
- luatex
- xetex
Many thanks to [TinyTex](https://yihui.org/tinytex/), the inspiration for this project.
If you need a list of packages needed to compile basic files, check TinyTex:
- https://github.com/yihui/tinytex/blob/master/tools/pkgs-custom.txt
- https://github.com/yihui/tinytex/blob/master/tools/pkgs-yihui.txt
#!/bin/bash
set -e
# TODO: This is the latest version
# See "" for archived versions
TexLive_Repo=${CTAN_REPO:-http://mirror.ctan.org/systems/texlive/tlnet}
TexLive_File="install-tl-unx.tar.gz"
TexLive_URL="$TexLive_Repo/$TexLive_File"
# TODO: Integrate this
TinyTex_Profile="https://raw.githubusercontent.com/yihui/tinytex/master/tools/tinytex.profile"
setup_tinytex() { # Install Location
il="$(readlink -e "$1")"
tmp="$(mktemp -d)" # Temporary Location
pushd "$tmp"
# TexLive
wget -nc "$TexLive_URL"{,.sha512,.sha512.asc}
sha512sum -c "$TexLive_File.sha512" # Verify hash
gpg --verify "$TexLive_File.sha512.asc" || true # TODO: Verify GPG
# TinyTex
wget -nc "$TinyTex_Profile"
echo "tlpdbopt_sys_bin $il_bin" >> tinytex.profile
# Extract files
tar xf "$TexLive_File"
# Verify TexLive version
texlive_version="$(find . -name 'install-tl-*' -type d | head -1 | sed 's@./install-tl-@@')"
echo "=> TexLive Version: $texlive_version"
il_bin="$il/bin"
il_texlive="$il/lib/tinytex-$texlive_version"
platform="$(uname -m)-linux"
echo "=> Install Location: $il"
echo "- Binaries: $il_bin"
echo "- TexLive: $il_texlive"
echo "=> Platform (Script): $platform"
# Do it!
if [ -d "$il_texlive" ]; then
echo "=> Re-Installing TexLive"
rm -rf "$il_texlive"
fi
echo "=> Installing TexLive @ '$il_texlive'"
mkdir -p "$il_texlive"
(
cd "$il_texlive" &&
TEXLIVE_INSTALL_ENV_NOCHECK=true TEXLIVE_INSTALL_NO_WELCOME=true "$tmp/install-tl-$texlive_version/install-tl" -no-gui -profile="$tmp/tinytex.profile" -repository "$TexLive_Repo"
)
# Setup it!
binaries="$(readlink -e "$il_texlive/bin/$platform")"
tlmgr="$binaries/tlmgr"
echo "=> Platform (tlmgr):"
"$tlmgr" print-platform-info
echo "=> Setup Repository"
"$tlmgr" option repository "$TexLive_Repo"
echo "=> Installing packages"
"$tlmgr" install latex-bin luatex xetex
# Option: Install GPG
# "$tlmgr" --repository "https://texlive.info/tlgpg/" install tlgpg
echo "=> Add symlinks to '$il_bin'"
"$tlmgr" path add
# Remove detritus
popd
rm -rf "$tmp"
}
install_location="${1:-"$PWD"}"
test -d "$install_location"
setup_tinytex "$install_location"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment