[Tex/LaTex] How to run TeX from the command line interface in Linux


Even though I can find this command hiding somewhere on the internet, I though it might be useful to have it up here for the LaTeX community in general.

How does one run TeX from the command line interface (Terminal) in Linux?
Are there any required parameters?
What if the command is part of a bigger script, how does the script know when the TeX processing is done to continue with any subsequent actions needed?
Is there a clear manual for this somewhere?

A starting point might be:

pdflatex [options] filename.tex
latex [options] filename.tex
xelatex [options] filename.tex

Best Answer

You're right: latex filename.tex and the other above command are means to run a flavor of TeX from the command line.

They don't really require parameters, but you could also have a look at the configuration of GUI software like Texmaker, or type in the command line latex --help to show the complete list of available options. For example, the option -interaction=nonstopmode makes latex not stopping on every error...

These programs run in a single shot: they will not take action. For that, in Linux, you could write a Makefile that will arrange the required compilation steps, as shown here or here.

For the manual, you could try man latex, but I don't think that it is a good answer or question. The above commands run Latex/Pdflatex/... the same ways that a GUI editor will do.

Related Question