Tx · LaTeX & TikZ

How to Install a Minimal TeX Live Setup for CI

Published By the 9to5Science editorial team

At a glance

  1. 1. Choose a scheme

    Start with the basic scheme; it installs core TeX and LaTeX components without the full package collection.

  2. 2. Skip extras

    Disable documentation and source-file installation to reduce the download and disk footprint.

  3. 3. Add dependencies

    Install only the TeX Live packages your document or build tools actually require.

  4. 4. Check the build

    Compile a small test document in the same environment and verify that all required packages are present.

For a small TeX Live installation in continuous integration, begin with the basic scheme and omit documentation and source files. Add project dependencies afterward with tlmgr. This keeps the installation much smaller than the full TeX Live distribution while still giving you a working base for TeX and LaTeX.

There is no single minimal installation that can compile every LaTeX document: the packages required depend on the document. Treat the basic scheme as a starting point, then install and record your project’s extra dependencies.

Install the basic scheme

Download and unpack the TeX Live network installer, then run it with the basic scheme selected. On a Linux CI runner, the commands look like this:

curl -L https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz \
  -o install-tl.tar.gz
tar -xzf install-tl.tar.gz
cd install-tl-*
perl ./install-tl \
  --no-interaction \
  --scheme=basic \
  --no-doc-install \
  --no-src-install

The installer’s default destination is typically under /usr/local/texlive; the exact versioned directory depends on the release. Make sure the installed TeX Live bin directory is on PATH. For example, a typical 64-bit Linux installation might use:

export PATH="/usr/local/texlive/2025/bin/x86_64-linux:$PATH"

Adjust the year and platform directory to match the installation. If the job runs without permission to write to the default location, configure an installation directory the job can write to, or run the installer with the necessary permissions.

Add only what the project uses

Use tlmgr install to add packages and tools. For example, install latexmk if the build uses it, and collection-latexrecommended if the document needs packages from LaTeX’s recommended collection:

tlmgr install latexmk collection-latexrecommended

You do not need to install that entire collection if your document uses only the base LaTeX features. Instead, install individual packages where practical. For example, a document that loads amsmath can request that package directly:

tlmgr install amsmath

Package names are TeX Live package names, which usually match the package name used in \usepackage{...}, but not always. If the package name is unclear, consult TeX Live’s package database or search with tlmgr search.

A minimal check for the core installation is:

pdflatex --version
printf '\\documentclass{article}\n\\begin{document}CI test.\\end{document}\n' > test.tex
pdflatex -halt-on-error test.tex

For a real project, compile the project itself in CI. That catches missing fonts, bibliography tools, image converters, and packages that a tiny test document will not exercise.

Make CI builds repeatable

A small installation is not automatically a reproducible installation. If the installer or package repository advances, a later CI run can receive newer TeX Live packages. For more predictable builds, use a fixed TeX Live release or a container image you control, and keep the dependency list alongside your project configuration. Avoid relying on packages that happen to be present on a runner.

One practical approach is to keep a script in the repository that installs the same named packages each time, then run it before compiling. Cache the TeX Live installation only when the cache key includes the release and relevant dependency configuration; otherwise, stale or mismatched package files can make failures hard to diagnose.

Common mistakes

  • Expecting the basic scheme to include every LaTeX package. It is deliberately limited. Install each project dependency explicitly.
  • Installing a package but not using the right PATH. A runner may still invoke a different TeX installation, or fail to find pdflatex and tlmgr entirely.
  • Disabling documentation and sources when they are needed. These options save space, but they also remove local documentation and source files; omit them if your workflow depends on those files.
  • Assuming a successful installation means the document will compile. The build also depends on the document’s packages and any external tools it invokes. Test the actual CI build command.
  • Mixing TeX Live releases. Keep the installer, package repository, and cached installation aligned to avoid package-version conflicts.

When to choose a larger scheme

If many documents use a broad range of packages, repeatedly installing individual dependencies may be inconvenient. scheme-small or scheme-medium installs more packages up front, trading a larger download for fewer missing-package failures. For a controlled CI project with a known dependency list, scheme-basic plus explicit tlmgr install commands is usually the leaner starting point.

References

  1. TeX Live Guide
  2. TeX Live install-tl documentation
  3. TeX Live tlmgr documentation

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.