[Tex/LaTex] Understanding the Log file


I'm getting some cryptic (for me) errors and warnings when I compile. On the advice of darn near every internet resource I could find, I dug into the .log file. The trouble is, I don't know how to interpret what I see.

I don't want to take up people's time so, where can I find a Reading LaTex .log Files for Beginners document?

Best Answer

Here are some elements of a .log file:

  • The .log file starts out by giving some information about the compiler that you are running. For example, running latex or pdflatex the output is

    This is pdfTeX, Version 3.1415926-2.3-1.40.12 (Web2C 2011)

    while running xelatex would output

    This is XeTeX, Version 3.1415926-2.3-0.9997.5 (Web2C 2011)
  • Every file (including the document class .cls and style .sty files) that is loaded starts with an opening "(" and the file name. When the file has finished loading, a closing ")". All messages that happen during that file are written between those parenthesis. Sometimes this includes the file version or a short description of the file, as written by the package author).

    (./test.tex (./hello.tex This is a message from hello.tex) [1] )
  • The page numbers are written in [ ] square brackets.

  • LaTeX issues "bad box" warnings whenever you have something contained within a box (the general TeX layout structure) that does not fit within it. Here's a small working example


    that produces

    Overfull \hbox (46.52866pt too wide) in paragraph at lines 3--4
    []\OT1/cmr/m/n/10 Thisisaverylonglinethatdoesnotbreakproperlyattheendofthelinea

    in your .log file. This means that the contents of the box (in this case a box of width \linewidth) was exceeded by 46.52866pt at lines 3-4 in your code. An actual output code segment is also visible, with the fonts loaded to typeset that "bad" part of your document (OT1/cmr/m/n/10). These "bad boxes" are tallied and given at the very end of your compile (although this does not form part of the actual .log file):

    LaTeX-Result: 0 Error(s), 0 Warning(s), 1 Bad Box(es), 1 Page(s)
  • You may sometimes get warnings such as

    LaTeX Warning: Reference myref on page 1 undefined on input line 6.

    This means that you have used \ref or one of its relatives without having the appropriate \label. In this case, you will also get

    LaTeX Warning: There were undefined references.

    at the end of your log file.

  • Similarly, if you define the same \label in multiple places, then you will get

    LaTeX Warning: Label `mypage' multiply defined.

    which will lead to

    LaTeX Warning: There were multiply-defined labels.

    at the end of your log file.

  • Sometimes fonts cannot be found. Either a font shape (for example slanted) or some requested font size is not available. Then you'll get a message like:

    LaTeX Font Warning: Font shape `OT1/cmr/m/bx' undefined
    (Font)              using `OT1/cmr/m/n' instead on input line 3.


    LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size <5.42497> not available
    (Font)              size <5> substituted on input line 72.

Many of the aforementioned information is obtained by an issue of \typeout{<stuff>} which outputs <stuff> to the terminal window (and subsequently makes its way into the .log file). Warnings and errors, also included in the .log file, arise from an issue of \<cmd>Warning or \<cmd>Error where <cmd> either refers to Class or Package.

To some extent it is possible to have control over the information output to the .log file by using the silence package. It provides a means to filter or activate warnings, errors or other messages from packages.