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.

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?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
--halt-on-error worked as expected, but it did not indicate the line number where the error occurred. The silence package seems to have no effect: gist.github.com/mrichman/7876806 I really want to hide all that (/usr/local/texlive/2013/texmf-dist/tex verbosity. –  Mark Richman Dec 9 '13 at 17:55
    
@MarkRichman 1. I can't see any error in the log file. 2. silence is certainly not perfect and can miss something... 3. Without a MWE it is difficult to say what it misses... –  karlkoeller Dec 9 '13 at 18:01
    
Actually, I'm giving rubber a try. I think it may do what I want. –  Mark Richman Dec 9 '13 at 18:04

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.    
share|improve this answer
    
Welcome to TeX.SX! –  Claudio Fiandrino Mar 29 at 19:30

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.