Using pdftex (with examples)
1: Compile a PDF document
pdftex source.tex
Motivation: Compiling a PDF document is the most basic usage of pdftex. This command will take the source file source.tex
and generate a PDF document.
Explanation: The pdftex
command is followed by the name of the tex file (source.tex
in this case) to specify the source file to be compiled.
Example Output: This command will compile source.tex
and generate a PDF document named source.pdf
.
2: Compile a PDF document, specifying an output directory
pdftex -output-directory=path/to/directory source.tex
Motivation: Sometimes, it is desirable to specify a specific output directory for the generated PDF document. This can be useful for organizing the generated files.
Explanation: The pdftex
command is followed by the -output-directory
flag, which is then followed by the desired output directory path (path/to/directory
in this case). Finally, the source file source.tex
is specified.
Example Output: This command will compile source.tex
and generate a PDF document named source.pdf
in the specified output directory path/to/directory
.
3: Compile a PDF document, exiting on each error
pdftex -halt-on-error source.tex
Motivation: By default, pdftex continues compilation even if errors are encountered. However, there are scenarios where it is preferable to halt compilation upon encountering any error.
Explanation: The pdftex
command is followed by the -halt-on-error
flag. This flag instructs pdftex to stop compilation as soon as an error is detected in the source file.
Example Output: If an error is encountered in source.tex
, pdftex will stop compilation and display an error message indicating the cause of the error.