texliveonfly
Compile LaTeX documents automatically installing missing packages
TLDR
Download missing packages while compiling
Use a specific compiler (defaults to pdflatex)
Use a custom TeX Live bin folder
SYNOPSIS
texliveonfly [options]
PARAMETERS
-d, --delay
Set the delay in seconds between checks for file modification. Default is typically a small value like 1 second.
-p, --pdf-viewer
Specify the PDF viewer to use (e.g., evince, xpdf, okular). If not specified, it attempts to use a default viewer or a viewer defined in environment variables.
-v, --view
Automatically display the compiled output (PDF) in the specified viewer.
-n, --no-view
Do not display the compiled output (PDF). Useful if you only want to compile silently.
-e, --engine
Specify the TeX engine to use (e.g., pdflatex, xelatex, lualatex). If not specified, it attempts to detect the engine from the file extension or defaults to pdflatex.
-c, --clean
Remove auxiliary files after compilation (e.g., .aux, .log, .dvi).
-b, --bibtex-command
Specifies the bibtex command to use (e.g. bibtex, biber). If not specified, the program searches for bibtex and biber commands
DESCRIPTION
The texliveonfly
command provides a convenient way to automatically compile LaTeX documents and view the resulting output (typically PDF). It monitors the LaTeX source file for changes and automatically recompiles the document whenever a modification is detected. This eliminates the need to manually run latex
, pdflatex
, or other TeX engines after each edit. It also automatically runs bibtex
or biber
if necessary. It simplifies the LaTeX development workflow and is particularly useful for complex documents that require multiple compilation passes to resolve cross-references, bibliographies, or indices.
The program can also display the generated PDF or DVI using viewers like Evince or xpdf, automatically refreshing the display after each successful compilation. It handles errors gracefully and provides feedback about the compilation process. It is a valuable tool for LaTeX users who want a seamless and efficient development experience.
CAVEATS
It relies on file modification timestamps for detecting changes, so it may not work reliably on network filesystems or in environments where file timestamps are not accurately maintained.
ERROR HANDLING
texliveonfly
typically displays error messages from the TeX engine in the terminal. Pay close attention to these messages to identify and correct errors in your LaTeX source.
CONFIGURATION
The program uses a default compilation order and will automatically call bibtex or biber for bibliography generation based on the detected presence of bibliography commands in the tex file. Environment variables may affect behavior, but direct configuration files are not supported.
ENGINE DETECTION
The program will use pdflatex as a default engine. Engine can also be guessed based on the file extensions. For example, if you compile a file with .tex suffix it will run a pdflatex.