[Tex/LaTex] Compiler-style output for latex errors

build-systemcompilingerrorslatexmkpdftex

I am a programmer who is used to using command line tools to compile source code. One of the must-have features of these compilers is the ability to tell programmers where their errors are so they can find and fix them. Latex technically does this, but the output and log files can be hundreds of lines long, which makes it tedious and time consuming to find the one line that tells you where your error is. Is there any way to make latexmk output only compiler-style error messages to the console?

The command I use to build my tex project:

latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" -use-make file.tex

Best Answer

I don't think there is a built-in solution. But if I understand your question correctly, you could use something like this:

latexmk -pdf -pdflatex="pdflatex -file-line-error -interaction=nonstopmode" file.tex | grep "^.*:[0-9]*: .*$"

Or the even less verbose variant that just prints the message lines:

latexmk -pdf -pdflatex="pdflatex -file-line-error -interaction=nonstopmode" file.tex 2>&1 | grep "^.*:[0-9]*: .*$"
Related Question