I find the output of XeLaTeX excessively verbose. I am really just interested in errors (not warnings), and the offending line number. I also would like xelatex to halt (exit) on error. Is there a magic incantation that can produce this?
4 Answers
If you want to get rid of ALL warnings you can load the silence package
\usepackage{silence}
and then issue the command
\WarningsOff*
Have a look at its documentation for selective warnings filtering and errors filtering, if you need it.
Just remember that warnings are what they are supposed to be: they warn you about something wrong in your document.
For your latter request, if you want xelatex to halt on errors (and exit) add --halt-on-error to the command line, otherwise, if you want a prompt where to decide what to do, add --interaction=errorstopmode to the command line.
- 124,410
With TeX Live a Perl script called texfot (by Karl Berry) is available.
Running
texfot --ignore '(Warning|Overfull|Underfull)' pdflatex test
on the file test.tex that follows
\documentclass{article}
\begin{document}
\hbox to 0pt{aaa} % Overfull \hbox
\hbox to 100pt{x} % Underfull \hbox
{\fontsize{125}{0}\selectfont a} % font warning
\foo % undefined control sequence
\end{document}
the output on the console is
/Library/TeX/texbin/texfot: invoking: pdflatex test
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex)
! Undefined control sequence.
l.11 \foo
! Emergency stop.
l.11 \foo
! ==> Fatal error occurred, no output PDF file produced!
You can customize the regexp string to your will if you find something else should be ignored.
The .log file is still produced entirely:
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex 2016.12.23) 6 JAN 2017 23:58
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**test
(./test.tex
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
) (./warnerr.aux)
\openout1 = `warnerr.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
Overfull \hbox (15.00005pt too wide) detected at line 5
\OT1/cmr/m/n/10 aaa
[]
Underfull \hbox (badness 10000) detected at line 7
\OT1/cmr/m/n/10 x
[]
LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size <125> not available
(Font) size <24.88> substituted on input line 9.
! Undefined control sequence.
l.11 \foo
% undefined control sequence
?
! Emergency stop.
l.11 \foo
% undefined control sequence
End of file on the terminal!
Here is how much of TeX's memory you used:
200 strings out of 493013
2160 string characters out of 6133342
53632 words of memory out of 5000000
3833 multiletter control sequences out of 15000+600000
3939 words of font info for 15 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
23i,0n,17p,111b,64s stack positions out of 5000i,500n,10000p,200000b,80000s
! ==> Fatal error occurred, no output PDF file produced!
- 1,121,712
After trying a whole day I ended up dong my own python script with pyparsing:
#!/usr/local/bin/python
# file: xelatex-clean.py
def spoil(l):
if type(l) == list:
if len(l) == 0:
return ''
elif len(l) == 1:
return spoil(l[0])
return l
def pprint(nested, max_level, level = 0, indent = ' '):
for i,c in enumerate(nested):
nested[i] = spoil(c)
for c in nested:
if type(c) != list:
print (indent*level + c.replace('\n','\n' + indent*level))
elif level < max_level:
pprint (c, max_level, level + 1)
if __name__ == '__main__':
import sys
from pyparsing import nestedExpr, OneOrMore, Word, printables
if len(sys.argv) != 2:
print ("Usage: xelatex document.tex | xelatex-clean.py <nesting-level>")
xelatex_output = sys.stdin.read()
l = nestedExpr('(',')',content=OneOrMore(Word(printables+' \n',excludeChars='()'))).parseString('(%s)'%xelatex_output).asList()[0]
pprint(l,int(sys.argv[1]))
The spoil function removes empty or inline parentheses that otherwise would fill the output with empty spaces. I didn't spend much time to see if I could use the standard pprint function instead of my own. Hope it helps.
Usage:
<xelatex command> | xelatex-clean.py <nesting-level>
Example 1:
> xelatex document.tex | xelatex-clean.py 0
This is XeTeX, Version 3.1415926-2.5-0.9999.3
TeX Live 2013
restricted \write18 enabled.
entering extended mode
see the transcript file for additional information
Output written on document.pdf
2 pages
.
Transcript written on document.log.
[Finished in 2.4s]
Example 2:
> xelatex document.tex | xelatex-clean.py 1
This is XeTeX, Version 3.1415926-2.5-0.9999.3
TeX Live 2013
restricted \write18 enabled.
entering extended mode
./document.tex
LaTeX2e <2011/06/27>
Babel <3.9g> and hyphenation patterns for 78 languages loaded.
/usr/local/texlive/2013/texmf-dist/tex/latex/beamer/themes/font/beamerfontthem
eprofessionalfonts.sty
/usr/local/texlive/2013/texmf-dist/tex/latex/beamer/themes/font/beamerfontthem
eserif.sty
/usr/local/texlive/2013/texmf-dist/tex/generic/pgf/frontendlayer/tikz/librarie
s/tikzlibrarypositioning.code.tex
/usr/local/texlive/2013/texmf-dist/tex/latex/silence/silence.sty
./document.aux
/usr/local/texlive/2013/texmf-dist/tex/latex/tipa/t3cmr.fd
*geometry* driver: auto-detecting
*geometry* detected driver: xetex
ABD: EveryShipout initializing macros
./document.out
./document.out
/usr/local/texlive/2013/texmf-dist/tex/latex/beamer/translator/dicts/translato
r-basic-dictionary/translator-basic-dictionary-English.dict
/usr/local/texlive/2013/texmf-dist/tex/latex/beamer/translator/dicts/translato
r-bibliography-dictionary/translator-bibliography-dictionary-English.dict
/usr/local/texlive/2013/texmf-dist/tex/latex/beamer/translator/dicts/translato
r-environment-dictionary/translator-environment-dictionary-English.dict
/usr/local/texlive/2013/texmf-dist/tex/latex/beamer/translator/dicts/translato
r-months-dictionary/translator-months-dictionary-English.dict
/usr/local/texlive/2013/texmf-dist/tex/latex/beamer/translator/dicts/translato
r-numbers-dictionary/translator-numbers-dictionary-English.dict
/usr/local/texlive/2013/texmf-dist/tex/latex/beamer/translator/dicts/translato
r-theorem-dictionary/translator-theorem-dictionary-English.dict
./document.nav
/usr/local/texlive/2013/texmf-dist/tex/latex/euenc/eu1lmtt.fd
[1]
/usr/local/texlive/2013/texmf-dist/tex/latex/amsfonts/umsa.fd
/usr/local/texlive/2013/texmf-dist/tex/latex/amsfonts/umsb.fd
<use "../figs/figure1.pdf" >
<use "../figs/figure2.pdf" >
<use "../figs/figure3.pdf" >
<use "../figs/figure4.pdf" >
Overfull \hbox
1.99998pt too wide
in paragraph at lines 132--132
[]
Overfull \vbox
16.81339pt too high
detected at line 132
[2]
./document.aux
see the transcript file for additional information
Output written on document.pdf
2 pages
.
Transcript written on document.log.
(...)
-interaction=STRING set interaction mode (STRING=batchmode/nonstopmode/
scrollmode/errorstopmode)
Run xelatex with -interaction=batchmode -halt-on-error
- 211
-
2
-
I think it is
xelatex -interaction=batchmode -halt-on-error main.texthat suppresses the output in terminal. – zyy May 03 '20 at 20:23 -
That reduces the output, but doesn't eliminate it. I would really like it to not say anything unless something goes wrong, and in the case something does, complain about it on stderr, not stdout. – Mark Reed May 04 '23 at 20:41
silencepackage seems to have no effect: https://gist.github.com/mrichman/7876806 I really want to hide all that(/usr/local/texlive/2013/texmf-dist/texverbosity. – Mark Richman Dec 09 '13 at 17:55silenceis certainly not perfect and can miss something... 3. Without a MWE it is difficult to say what it misses... – karlkoeller Dec 09 '13 at 18:01rubbera try. I think it may do what I want. – Mark Richman Dec 09 '13 at 18:04