[XeTeX] missing characters and msgs

Mike Maxwell maxwell at umiacs.umd.edu
Sun Aug 23 01:40:27 CEST 2009

I think I have a solution for this, but first the background...

Jonathan Kew wrote:
> On Sat, Aug 22, 2009 at 10:15 PM, hh<hh-brasil at bol.com.br> wrote:
 >> ...
>> Look up \hbadress!
> I think you meant to type \hbadness. :) This can be used to suppress
> *underfull* box messages up to a certain badness level. To ignore
> *overfull* boxes that are only slightly overfull, try \hfuzz. These
> are both TeX primitives, see The TeXbook for details.

Right, that will suppress those minor warnings on over/underfull boxes; 
but I really want to suppress all *warnings* (as well as the "chatter" 
from some of the individual packages), but retain any *error* msgs.  By 
"error" msg, I mean something that forces LaTeX to stop with a message 
like this:
    ! LaTeX Error: File `CASLGrammar.sty' not found.

    Type X to quit or <RETURN> to proceed,
    or enter new name. (Default extension: sty)

    Enter file name:

> For the ultimate "silent" run, you could use TeX's \batchmode, but
> that's probably too extreme for many situations... it will suppress
> all terminal output, including errors that would normally stop
> processing, and just continue blindly to the end.

Right, whereas I really want it to distinguish warnings and errors.

I also looked at \nonstopmode, but that appears to just stop LaTeX when 
there's an error, without suppressing the warning msgs.

And I looked at redirecting stdout to > /dev/null, but even when latex 
gives up, you don't see anything.  (Some errors still get output, 
apparently to /dev/stderr; e.g. kpathsea errors.)

I finally hit on this:
    xelatex foo.xetex | grep -P "^(\!)|(l\.)"
The grep regex (the -P means "use Perl regex", which is the only way I 
could figure to get the disjunction) means that error msgs like this
    ! Too many }'s.
    l.19510 }
come through in the output.  It apparently still stops waiting for my 
response; I can prevent that by using the -halt-on-error flag on the 
command line; or else by issuing a \nonstopmode, either by including 
that in the input file, or by doing
    xelatex '\nonstopmode \input foo.xetex' | grep -P "^((\!)|(l\.))"
The latter would be more useful for me, because I can run the same input 
file in nonstopmode the first two times (with bibtex invoked in 
between), and then run it in the plain vanilla mode on the third pass. 
But the -halt-on-error seems to do the same thing, and simpler.

I was also getting a lot of xdvipdfmx warnings the first two times 
through, but that was preventable by the -no-pdf parameter (since 
there's no sense in generating a pdf of the first two passes).

So my final command line is:
    xelatex -halt-on-error -no-pdf foo.xetex | grep -P "^((\!)|(l\.))"

All of this is invoked through a Perl script, so my next step is to make 
the script examine the exit status of xetex, and quit if it's non-zero.

 > (BTW, none of this is actually XeTeX-related; it's standard TeX and
 > LaTeX. As such, there are probably better places for the question,
 > such as comp.text.tex -- or I suspect a Google search for "latex
 > suppress overfull hbox message" would lead to some clues.)

I guess I'm misunderstanding the relationship between TeX/LaTeX and 
Xe(La)TeX.  I was assuming that different implementations of TeX might 
have different behaviors wrt some of these things, in particular the 
warnings/ errors, or the use of /dev/stdout vs. /dev/stderr.  But maybe 
that's standardized for all implementations?
    Mike Maxwell
    What good is a universe without somebody around to look at it?
    --Robert Dicke, Princeton physicist

More information about the XeTeX mailing list