48

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?

4
  • 7
    I think this may be too broad a question, since many packages influence what is written out to the .log file. Moreover, some errors are cryptic in themselves, pointing to one thing that actually was not a problem in the first place. I think a good place to start is going through the TeX Book from Chapter 6 Running TeX (p 22). There are some example of TeX output (which end up in the .log file) and how to interpret it. Perhaps redraft your question with a specific part of the log file in mind, in order to solicit more accurate responses.
    – Werner
    Commented Oct 21, 2011 at 4:58
  • See also Appendix C Error Messages of A Guide to LaTeX, 4ed.
    – Leo Liu
    Commented Oct 21, 2011 at 7:07
  • 4
    I really, really appreciate your "don't do it for me, help me to learn how to do it"-take on the problem. However, in this case the actual problem example would be helpful to start the process.
    – Daniel
    Commented Oct 21, 2011 at 7:14
  • Texmaker (and I guess many other LaTeX-editors as well) will help you to understand the log file with an integrated Messages/Log viewer. You can just click on each message and Texmaker will jump to the line in the .tex file where it thinks the error/warning came from.
    – matth
    Commented Nov 16, 2011 at 10:02

2 Answers 2

46

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

    \documentclass{article}
    \begin{document}
    Thisisaverylonglinethatdoesnotbreakproperlyattheendofthelineandcausesanoverfulhbox
    \end{document}
    

    that produces

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

    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.
    

    or

    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.

3
  • Thanks! This definitely covers many of the cryptic notes I was seeing.
    – HTG
    Commented Oct 22, 2011 at 16:08
  • 7
    Just a small addition: If you use \documentclass[draft]{article} your overfull boxes will be marked in black in your output, making it easier to find them.
    – matth
    Commented Nov 16, 2011 at 9:59
  • Glad I found this as it addresses the particular situation I was trying to resolve. Commented Dec 31, 2021 at 17:39
8

For errors and warnings see The LaTeX Companion, 2nd Edition, Appendix B: Tracing and Resolving Problems

3

You must log in to answer this question.

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