Don't make me manually abort a LaTeX compile when there's an error

喜欢而已 提交于 2019-12-02 14:00:39

With MikTeX, pdflatex has this command-line option:

  -interaction=MODE               Set the interaction mode; MODE must be one
                                  of: batchmode, nonstopmode, scrollmode,
                                  errorstopmode.

Edit suggested by @9999years:

Those values are equivalent to a set of LaTeX \commands that provide the same functionality.

From TeX usage tips:

The modes make TeX behave in the following way:

  • errorstopmode stops on all errors, whether they are about errors in the source code or non-existent files.

  • scrollmode doesn't stop on errors in the source but requests input when a more serious error like like a missing file occurs.

  • In the somewhat misnamed nonstopmode, TeX does not request input after serious errors but stops altogether.

  • batchmode prevents all output in addition to that (intended for use in automated scripts). In all cases, all errors are written to the log file (yourtexfile.log).

You can also put \nonstopmode or \batchmode at the very beginning of your tex file; then it'll work with any TeX version, not just pdflatex. For more info on these and related commands see the very good reference on (raw) TeX commands by David Bausum. Especially the command from the debugging family could be of interest here.

Another possible hack is simply to use:

yes x | latexmk source.tex

You could always create an alias for 'yes x | latexmk' if you're going to use this option lots. The main advantage of this that I can see above the other suggestions is that it is very quick for when you occasionally want latexmk to behave like this.

Mehmet

There is also a \batchmode command may do the work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!