Skip to content

Instantly share code, notes, and snippets.

@barbarbar338
Created January 1, 2024 15:47
Show Gist options
  • Save barbarbar338/0225d6348a1429a579752bccddd4e745 to your computer and use it in GitHub Desktop.
Save barbarbar338/0225d6348a1429a579752bccddd4e745 to your computer and use it in GitHub Desktop.
Compile LaTeX files on Android

Compile LaTeX files on Android

  • Install Termux from F-Droid. This part is important, not from Google Play Store. GPlay restricts some functionality of Termux.
  • Upgrade dependencies: pkg update && pkg upgrade
  • To access device storage, run this command. It's needed to access created LaTeX and PDF files: termux-setup-storage
  • cd into local storage: cd ~/storage/shared
  • Create LaTeX project folder. We'll save our files here and access them from this folder from our device: mkdir LaTeX
  • Install TeX Live installer: pkg install texlive-installer
  • Install TeX Live. Important note, do not change any option here: termux-install-tl
  • Create bash config file with these configurations: nvim ~/.bashrc
export TEXMFROOT="$PREFIX/share/texlive"
export TEXMFOS="$TEXMFROOT"
export TEXMFDIST="$TEXMFROOT/texmf-dist"
export TEXMFLOCAL="$TEXMFROOT/texmf-local"
export TEXMFVAR="$HOME/.local/texlive2022/texmf-var"
export TEXMFCONFIG="$HOME/.local/texlive2022/texmf-config"
export TEXMFHOME="$HOME/.local/texmf"
  • Reload config: . ~/.bashrc
  • Fix missing binaries: texlinks
  • cd into home directory: cd ~
  • Create symlink for LaTeX folder: ln -s /data/data/com.termux/files/home/storage/shared/LaTeX LaTeX
  • cd into LaTeX folder: cd LaTeX
  • Start creating files!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment