I'm processing a large document, using Latexmk in a Bash environment. It would be very helpful if error and warning messages were somehow highlighted or coloured, in order to facilitate spotting them. Specially when dealing with Biber and Biblatex, catching the warnings on time is important, as they won't normally stop the compilation process when something comes out.

Until recently, I was using the LateX bundle in TextMate, which helped showing only the most important messages (errors, warnings, inputs, includes, etc.) See here:

TextMate compiling

But I became deceptioned by that bundle and now I am compiling everything directly in the shell (Bash in Linux or Os X), as it gives me better control.

(Of course I could open the .log file, and configure the editor to search for/highlight these items, but I was thinking of "in the fly" highlighting/colouring.)

Is it possible to colour-code the stdout of latexmk (or in general of the *Tex bins)?

  • I use a few different scripts to help with my compiling; the answer I gave here focuses on a vim implementation, but it can easily port to other editors
    – cmhughes
    Commented Nov 26, 2012 at 1:03

3 Answers 3


You can always pipe the output through something that does colour, one simple example produces

enter image description here

From running the command

  pdflatex tb67 2>&1 | grep --color=auto  "LaTeX Warning"

on a file with a ref{jjj} undefined reference which I inserted for demonstration purposes.

  • And is there another way of bashing the output so as to show all messages in the default colour, plus the errors/warnings in red only? The grep function is great, but is filters everything else out.
    – NVaughan
    Commented Nov 27, 2012 at 15:17
  • add -C1000 to get up to a 1000 lines of context (ie non-matching lines) around the coloured lines Commented Nov 27, 2012 at 15:36
  • Unfortunatedly it doesn't work well with latexmk. I don't know why, but I have to press return for each pass to proceed.
    – NVaughan
    Commented Nov 27, 2012 at 17:07
  • Is it picking up the exit status from grep rather then pdftex grep --help says Exit status is 0 if any line is selected, 1 otherwise; sorry never used latexmk (and i'm on cygwin not a real *x operating system so can't really test too well:-) Commented Nov 27, 2012 at 17:14

I use the following line in my make files:

pdflatex filename.tex 2>&1 | grep --color -E "Warning|Missing|$"

This should highlight "Warning"s and show all other lines as well, since "|$" part of pattern means "Or end of a line".


I do not have enough reputation to comment, so I can only leave an answer, although it is not an actual answer.

You may want to try texfot, which generates message like this:

/usr/texbin/texfot: invoking: pdflatex eddy
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013)
Overfull \hbox (156.0012pt too wide) in paragraph at lines 4--6
! Undefined control sequence.
l.8 \abcdefghi
! Emergency stop.
l.8 \abcdefghi
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on eddy.log.

as explained here.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .