I have some large reports that are automatically generated and compiled using XeLaTeX. Just wondering if anyone knows of a way to track the rendering progress as these reports can take over a minute to render (many TikZ figures and 2-300 pages). I'm using XeLaTeX on Ubuntu.

  • 1
    With a way to track the rendering progress do you mean how to measure the compilation time? Commented Aug 21, 2013 at 8:57
  • I would like to know how many lines have been compiled out of the total, not just how long the whole thing took at the end. (which is trivial using 'time' or similar)
    – Slicedpan
    Commented Aug 21, 2013 at 8:59
  • 1
    You can look for [<page number] in the log output. However, this has many problems as errors and warnings intervene so it becomes [<page number> warnings....]. However, it is a start to look into. Just remark that any packages that prints out [<int> will be caught by your interpreter. For example: grep -e "\[[0-9]\+" <filename>.log will give you an idea. You can then post process this by whatever scripts you prefer. Remark, this is only based on pages shipped out to the pdf.
    – nickpapior
    Commented Aug 21, 2013 at 9:13
  • Is there a way of redirecting log output? Can you also write LaTeX commands to write to the log (or standard output) (btw stick that comment in an answer and i'll accept it)
    – Slicedpan
    Commented Aug 21, 2013 at 9:14
  • 1
    another idea would be to add to the shipout command and post something general and easy to search. See for instance the everyshi package which can be used.
    – nickpapior
    Commented Aug 21, 2013 at 9:44

1 Answer 1


Generally the log of a compilation tracks the pages that has currently been shipped out to the pdf/dvi, etc.

Thus by keeping track of which page is currently shipped out one can figure out where in the compilation one is, if one knows approximately the number of pages of the document.

The general output in the log file is this:

[<page number>]

But LaTeX also prints out numerous warnings and other information in the log file, hence it will more likely be something like this:

[7pdfTeX warning (ext4): destination with the sa...

So in this case you need to search through the log file and catch the page numbers. Granted that any information written to the log with the format [<int> will then also be caught.

A first idea is to do this (if we are dealing with bash under linux):

function mytex {
    local args=""
    while [ $# -gt 1 ]; do
    args="$args $1" ; shift
    # You have to have the extension ".tex"
    local fn="${1%.tex}"

    # You can either directly pipe, or read from log
    pdflatex $args $fn.tex | grep -e "\[[0-9]\+" | \
    sed -e "s/\[/\n/gi" | sed -e "/^[0-9]\+/{s/\([0-9]\+\).*/\1/gi ; p } ; d"

    # Or, however this poses some other problems when re-reading
    # a constantly updating file.
    #  pdflatex $args $fn.tex > /dev/null &
    #  grep -e "\[[0-9]\+" $fn.log ...


mytex $@

The grep finds and only sends the lines with [<int> further for processing.
The first sed ensures that integers following [ will be the first character on a new line.
The last sed only prints out integers that start on a new line as well as removing any characters.

The above three sequences will be better to put in a scripting language as it is not constantly updating to the std-out. And this is due to all the pipes which are nested. So having a single pipe would be better.
Also within the script you can ensure that the page print is consecutive thus removing potential messages from packages etc. This might be enough to get a decent output.
You should be able to play with this.

Using everyshi

If using everyshi you can automatically printout information at each ship-out.


\EveryShipout{\message{^^JHELLO \thepage^^J}}

will be alot easier to track, then you only need:

pdflatex $args $fn.tex | sed -e "/^HELLO [0-9]\+/{s/HELLO \([0-9]\+\).*/\1/gi ; p } ; d"

which is a stricter requirement.

  • Thanks for the suggestion, I'm actually using ruby to initiate the process, so I can capture the output using that. Since I automatically generate the source, I can put in \textout{} commands periodically which makes things a bit easier.
    – Slicedpan
    Commented Aug 21, 2013 at 9:46

You must log in to answer this question.

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