46

I often see warnings in the compilation-log of my tex-files. I searched in the internet and did not find a good answer to this question. And in my opinion there must be a reason why tex warns me about something.

So, why should I pay attention to warnings? And when there are warnings, of which of them should I pay more or less attention?

I hope this question is not to unspecific, but it teases me since some weeks.

  • 7
    Related Understanding the Log file and Linked questions at right column. In short: Why:Because TeX is talking to you,When: At final stage of large document typsetting. – texenthusiast Apr 18 '13 at 17:08
  • 1
    @Dave Some users address over/underful boxes in their answers and comments. Did you have these in mind when talking about "warnings"? Or only the log output that is explicitly labeled Warning:? – Foo Bar Apr 18 '13 at 17:19
  • 2
    @texenthusiast: +1 for "TeX is talking to you." I remember older TeX executables giving messages like "Proceeding with fingers crossed...". – Matthew Leingang Apr 18 '13 at 17:29
  • @FooBar I did not really meant Underfull Boxes. But the importance of those is interisting also. – Dave Apr 18 '13 at 17:46
  • 3
    Appendix B.2 of the LaTeX Companion (2nd Edition) has a comprehensive list of all LaTeX (non-package specific) warnings and informational messages (about 70 items in the list). – Gonzalo Medina Apr 18 '13 at 19:05
34

The LaTeX system has 3 levels of messages and TeX itself has another 2.

  • LaTeX Error ... stops the processing because something is seriously broken. Sometimes it is possible to continue but in most cases it is best to correct the error directly and reprocess the document
  • LaTeX Warning ... is only displayed on the terminal and in the transcript file and processing continues. Something is wrong with the document and it needs some level of attention. The issue may be temporary, the best example is "Rerun to get cross-references right" or it may be something that you decide to ignore because it visually doesn't matter (e.g., "Float too large by 3pt"), but it should preferably be a conscious decision. A few of the LaTeX warnings are related to obsolete syntax. In all cases (in theory at least) the warnings are things that you can and should ignore until you are nearly finished with document writing. Otherwise you may end up fixing things that go away by themselves due to rewriting your text.
  • LaTeX Info ... this is an informational message (sometimes helpful in debugging) that is only written to the transcript file. Those you can normally ignore.

Instead of "LaTeX Error/Warning/Info" it may say "Package..." or "Class..." if the message is generated out of a package or class file.

As LaTeX is a system with a huge amount of packages built by different developers the above classification may not always be 100% obeyed, as different people may have different opinions on what is a warning (that can wait for resolving) and what is an error that needs immediate attention, but on the whole (and for the kernel and core packages) this classification is valid.

In addition TeX also generates error and warning messages with more or less the same ideas as above. The main difference is that the format of the error/warning messages are slightly different, i.e., no prefix like "LaTeX Warning:". It is a bit unfortunate that the TeX program has no method to trap these and present them as "LaTeX..." but most of them are generated when you have no control over the processing, so that's why both flavors exist.

So in summary:

  • address errors immediately
  • resolve warnings only when you are really finished writing your document, and then make a conscious decision if you will ignore the warning (such as "Overfull hbox 0.3pt" or fix it, because you will feel offended by the typographical glitch even if it is small). Several if not most of the warnings you better fix at this point, because they effectively mean there is still something typographically or semantically wrong with your document.

For the LaTeX Companion, 2nd ed I wrote an appendix that explains all Error and Warning messages of the LaTeX kernel and its major packages. I ended up with about 60 pages explaining what the likely causes are and how to fix them. For those who can read French there is an online version of this appendix in French available.

| improve this answer | |
  • 2
    Nice answer! Also, nice to have an online version of the appendix. – Gonzalo Medina Apr 18 '13 at 23:29
  • Thank you :-) But I always thought about buying some books about TeX. So this one is now on the top of the List ;-) – Dave Apr 19 '13 at 9:14
  • @Dave well, you could consider reading the book it has a few other goodies as well I'd say (biased of course) – Frank Mittelbach Apr 19 '13 at 10:19
20

The way I understand it, a warning is issued, when the output file (PDF) is usable, but some constraints could not be enforced, i.e. it doesn't conform to the actual code.

A few (common) examples:

  • Overfull/underful box: obviously the document can eventually be opened, but it will not be compliant with the code, e.g. it will conflict with the badness settings specified before compilation. (That is why by setting these limits such warnings go away.) In extreme cases the text you enter goes really off the page (e.g. too long equations).

  • Duplicate labels: Usually not much happens with the output, if the warning is not issued, can go absolutely unnoticed, in other cases cross-referencing will probably go haywire.

So IMHO warnings should be treated as errors. Sometimes you can shrug it off, but it shows that you no longer have WYMIWYG at the output, but something else. The severity is really random, meaning it can be quite serious, so deal with it!

| improve this answer | |
  • 1
    Float(s) lost is an error not a warning, i.e., it stops the processing; it may have been 20 years ago in LaTeX 2.09 :-) – Frank Mittelbach Apr 18 '13 at 17:52
  • Ooops... Corrected that! :) – Count Zero Apr 18 '13 at 17:55
17

Personally, I treat warnings as "errors that don't stop the document from compiling". With this in mind you should consider all warnings.

Warnings normally mean that something is semantically wrong (but not syntactically wrong, what would be a real error) or that something is outdated or at a "wrong" place.

Conclusion: Consider all warnings and resolve them if you want your document to look good!

PS: If you are also talking about underful or overful boxes (which are not explicitly labeled as "Warnings" by LaTeX), you will find a lot of questions and answers regarding them on this website. These kind of messages have to be noticed and read one by one but sometimes it's not needed to actually resolve them because sometimes they don't affect the visible output.

| improve this answer | |
  • I think it's more than just looks... See my answer. Anyway, I agree, warnings should be taken seriously. – Count Zero Apr 18 '13 at 17:09
  • 5
    maybe better "resolve" rather than "solve". but some warnings are inherently unresolvable. for example, a text that is quoted, so that you can't rewrite it, may have a line that is slightly loose, and gives a warning about an underfull hbox with a value less than 1000. since tex tries to adjust the spacing in adjacent lines so that it's relatively even, this may not look too bad; you can try sloppypar but the result may look worse than the original. in such a case, it's enough to understand why the warning was issued, and consciously ignore it. – barbara beeton Apr 18 '13 at 17:13
  • @barbarabeeton I don't considered over/underful boxes as warnings because Latex does not explicitly label them with Warning: in the log file. – Foo Bar Apr 18 '13 at 17:17
  • 1
    Another example in the line of what barbara said are the warnings produced by the parskip= option of the KOMA classes. If the last line of text of the paragraph doesn't meet the requirements specified by the selected option, warnings will be issued. Only thing to prevent them would be to rewrite the sentence(s). Anyway, as she said, what matters in these cases is to understand what caused the warning. – Gonzalo Medina Apr 18 '13 at 18:04
  • @FooBar IITC the overfull/underfull messages are messages from TeX, not from LaTeX, which is why there is no “LaTeX Warning …” – cgnieder Apr 18 '13 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.