When a tex file is compiled, everytime an error is detected, compilation stops and user action (usually hitting return key) is expected through console by user. I would like to ask, how is it possible to avoid this. I would like it not to stop on detected errors and finish with compilation of the tex file. Thanks in advance.
[Tex/LaTex] How to ignore latex error while compiling
compilingerrorstex-core
Best Answer
What I would advise you is to use this;
Specifying
-interaction nonstopmode
is equivalent to using\nonstopmode
in your document.The
-halt-on-error
option instructs the program to return a non-zero error code when an error is found. This is useful when you are e.g. calling latex from a script or from themake
utility. Usingmake
or an equivalent program like e.g.scons
is highly recommended for larger documents that have an index or use citations. Because in those cases you will not only have to call LaTeX but also the programs to generate an index and bibliography.The
-file-line-error
option is makes it easier to locate errors in your source files, especially when you use\include
to e.g. split up a long document into parts (like splitting a book into chapters and putting each chapter in a separate TeX file.Here is a Makefile fragment that I use for big LaTeX documents;
The first line specifies that the commands have to be carried out when either the tex source document (the
TEXSRC
variable), the bibliography database (lbref.bib
) or the revision control status (.git/index
) has changed. The first two commands add the revision number to the document and add a list of changes. After that it callspdflatex
a couple of times interspersed with calls tomakeindex
andbibtex
. Several calls to LaTeX are generally necessary to resolve and stabilize all references when usingmakeindex
.Edit: I've switched to using
latexmk
because it will automatically take care of resolving cross-references, bibliographies and such.So I've modified my Makefile:
I've switched to
xelatex
for its simpler font handling. All the output files are now put in a subfirectory as to not clutter the main directory and for easier cleaning. Only the resulting PDF file is moved to the main directory after it has been created.