andreas.schaertl

Squelch Annoying LaTeX Output

tech

pdflatex has ridiculously verbose output. Compiling a simple Hello World kind of document is already too much for me.

Consider the following example.

$ cat hworld.tex
\documentclass[12pt]{article}
\begin{document}
Hello world!
\end{document}

$ pdflatex hworld.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.17
(TeX Live 2016/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./hworld.tex
LaTeX2e <2017/01/01> patch level 3
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))
No file hworld.aux.
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./hworld.aux) )
</usr/sh
are/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb>
Output written on hworld.pdf (1 page, 9887 bytes).
Transcript written on hworld.log.

In the specific case of pdflatex, you might try to use the --interaction=batchmode, but (1) this does not squelch all of the output, (2) not all programs have such an option and, most importantly, (3) while the output usually isn’t interesting, in case of an error it certainly is.

I wrote a script called trusting available on Github. It runs a command trusting that it will succeed, squelching stdout and stderr. If errors do occur, i.e. the command exists with a non-zero exit code, the full stdout and stderr output will be printed after that error has occurred.

Update: With this said, nice people informed me that a tool like trusting already existed before and it very well might already be installed on your machine. The tool is called chronic and works pretty much the same. chronic is part of the moreutils suite of tools. If you do not already have it installed, many distributions have a moreutils package you can install.