Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Oct 26 '13 at 21:26

This question came from our site for professional and enthusiast programmers.

1  
Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Oct 27 '13 at 4:55

2 Answers 2

up vote 3 down vote accepted

What I would advise you is to use this;

latex -interaction nonstopmode -halt-on-error -file-line-error filename.tex

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 the make utility. Using make 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;

$(DOCPDF): $(SUBDIR) $(TEXSRC) lbref.bib .git/index
        sh tools/vc -m
        python tools/mkhistory.py hist.tex
        pdflatex --interaction nonstopmode -halt-on-error -file-line-error $*.tex # >/dev/null
        makeindex -c -s myindex.ist $*.idx #2>/dev/null
        bibtex $* #>/dev/null
        pdflatex --interaction nonstopmode -halt-on-error -file-line-error $*.tex #>/dev/null
        makeindex -c -s myindex.ist $*.idx #2>/dev/null
        pdflatex  --interaction nonstopmode -halt-on-error -file-line-error $*.tex #>/dev/null
        rm -f $*.lo* *.aux $*.ilg $*.ind $*.toc $*.bbl $*.blg $*.out *.asc

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 calls pdflatex a couple of times interspersed with calls to makeindex and bibtex. Several calls to LaTeX are generally necessary to resolve and stabilize all references when using makeindex.

share|improve this answer
    
Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Oct 27 '13 at 4:58
    
Ronald, thank you very much for the detailed answer. –  YiannaCo Oct 28 '13 at 7:14

Try

latex -interaction=nonstopmode foo.tex
share|improve this answer
    
Thanks a lot for they reply. –  YiannaCo Oct 28 '13 at 7:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.