How to use the command "texliveonfly" (with examples)
Texliveonfly is a command-line tool that downloads missing TeX Live packages while compiling .tex
files. It is particularly useful for LaTeX users who want to compile their documents without having to manually search for and install missing packages. With Texliveonfly, all necessary packages are automatically downloaded and installed during the compilation process.
Use case 1: Download missing packages while compiling
Code:
texliveonfly source.tex
Motivation: The motivation behind this use case is to simplify the compilation process of LaTeX documents by automatically downloading any missing packages. This can save time and prevent errors that may occur when trying to compile a document with missing packages.
Explanation:
By running the command texliveonfly source.tex
, Texliveonfly will search for any missing packages in the LaTeX document source.tex
. If it encounters any missing packages, it downloads and installs them automatically, ensuring that all required packages are available for successful compilation of the document.
Example output:
If source.tex
requires a package that is not installed, Texliveonfly will display a message indicating which package is missing and start the download and installation process. Once the package is successfully installed, the compilation process will continue as usual.
Use case 2: Use a specific compiler
Code:
texliveonfly --compiler=compiler source.tex
Motivation: Sometimes, LaTeX users may prefer to use a specific compiler for their documents. This could be due to compatibility issues, performance considerations, or personal preference. Texliveonfly allows users to specify their preferred compiler, ensuring that the document is compiled using the desired compiler.
Explanation:
The --compiler
flag followed by the name of the desired compiler allows users to specify a specific compiler to be used during the compilation process. By default, Texliveonfly uses pdflatex
. However, with this use case, users can specify a different compiler that is available on their system.
Example output:
If you run the command texliveonfly --compiler=xelatex source.tex
, Texliveonfly will compile the document source.tex
using the XeLaTeX compiler, assuming it is installed on your system. The output of the compilation process will be displayed, showing any errors, warnings, or successful compilation.
Use case 3: Use a custom TeX Live bin
folder
Code:
texliveonfly --texlive_bin=path/to/texlive_bin source.tex
Motivation:
In some cases, LaTeX users may have a customized TeX Live installation with a different bin
folder location. Texliveonfly allows users to specify the path to their custom bin
folder, ensuring that the correct TeX Live distribution is used during the compilation process.
Explanation:
The --texlive_bin
flag followed by the path to the custom TeX Live bin
folder allows users to specify the location of their customized TeX Live installation. This ensures that the correct TeX Live distribution is used during the compilation process, even if it is not the default installation.
Example output:
If you execute the command texliveonfly --texlive_bin=/usr/local/texlive/2021/bin source.tex
, Texliveonfly will use the TeX Live distribution located at /usr/local/texlive/2021/bin
to compile the document source.tex
. The output of the compilation process will be displayed, showing any errors, warnings, or successful compilation.
Conclusion:
Texliveonfly is a powerful command-line tool for LaTeX users that simplifies the compilation process of LaTeX documents. It automatically downloads and installs missing packages, allows users to specify their preferred compiler, and supports custom TeX Live installations. By using Texliveonfly, users can save time, avoid errors, and ensure a smooth compilation process for their LaTeX documents.