10

I can't figure out how to get rid of the "underfull" and "overfull" warnings using the silence package (I am able to use it to hide some other warnings, but not these). What should be the correct syntax? Currently, this is what I have in my prologue:

\usepackage{silence}
\WarningFilter{latex}{Underfull}
\WarningFilter{latex}{Overfull}
\WarningFilter{latex}{Text page}
\WarningFilter{pdfcolmk}{Nothing to fix}

But I still get warnings like the following:

Underfull \hbox (badness 4940) in paragraph at lines 150--170
Overfull \hbox (3.50006pt too wide) in paragraph at lines 196--197
Underfull \vbox (badness 3690) has occurred while \output is active []
Underfull \vbox (badness 10000) has occurred while \output is active []
Underfull \vbox (badness 3039) has occurred while \output is active []
Underfull \hbox (badness 5490) in paragraph at lines 222--2
Underfull \vbox (badness 3039) has occurred while \output is active []
Underfull \vbox (badness 10000) has occurred while \output is active []

thanks, Jorge.

cfr
  • 198,882
dontpanic
  • 809
  • 2
    Patient, you are ill. Nah, i don't care. You shoud never ignore warnings or errors. – Johannes_B Jun 04 '18 at 04:49
  • 4
    you can put \hbadness=10000 \vbadness=10000 but then of course only use the docuemnt for checking the log file for syntax errors, don't bother looking at the pdf as it's likely to be horrible those warnings mean that something is very wrong with the page breaking in that document. – David Carlisle Jun 04 '18 at 06:44
  • 3
    @DavidCarlisle Sometimes, though, you know that the output is OK and you can't get rid of the warning (or you don't know how to get rid of the warning). For you, getting rid of them is always easy, but that's often not true for mere mortals. I regularly compile documents in which I mentally ignore such warnings. If I knew how to get rid of them without changing the output, I would, but I don't, so I can't. – cfr Jun 05 '18 at 01:04
  • What I do is learn for that document that I should be getting, say, 3 bad boxes. If I get 4, I know to look. Otherwise, I assume it's OK. Converted documents are worst; Beamer is probably second; then the rest. – cfr Jun 05 '18 at 01:05
  • 1
    @cfr for the finite warnings, perhaps, but badness 10000 is infinitely bad, Tex just gave up at that point and dumped whatever it had to hand as a page with no attempt to adjust the space reasonably. Either the output is really bad, or it is Ok and you intended space there but the markup is wrong, either way I would never ignore such a warning. – David Carlisle Jun 05 '18 at 06:35
  • @cfr which is basically what I said at greater length here: https://tex.stackexchange.com/questions/50830/do-i-have-to-care-about-bad-boxes/50850#50850 – David Carlisle Jun 05 '18 at 06:37
  • @DavidCarlisle Yes, but that's because you know how to change the markup. Sometimes, I can't figure that out. I know the output is right; I can't figure out how to get the input right; so I have to ignore the warning. Even for infinite badness. (Actually, usually for infinite badness - mostly I can get rid of finite badness warnings more easily.) Also, with converted documents, it isn't always worth worry too much. They always look crap by design, so if the output more-or-less matches the original, it isn't always worth eliminating warnings. – cfr Jun 06 '18 at 02:06
  • @DavidCarlisle I don't usually want to change global settings. Rather, I have badness on a particular page, which I know looks right. I find that lying is often helpful. However, sometimes truth isn't the problem and ignore it is easier. – cfr Jun 06 '18 at 02:16

4 Answers4

8

The over/underfull box warnings are from TeX - not LaTeX. As silence's manual notes,

TeX’s messages are left untouched. (p. 1)

You can tell they aren't LaTeX warnings because LaTeX tells you when it is the source of the warning.

LaTeX Warning: Float too large for page by 1056.17519pt on input line 28.

[The effect of putting 10 paragraphs of Kant's first critique (in translation) into a float.]

In contrast, TeX warnings don't say this.

Overfull \hbox (0.79013pt too wide) in paragraph at lines 25--25
cfr
  • 198,882
  • Oh, I see! So these warnings cannot be "silenced" in any other way (other package, method, etc.)? – dontpanic Jun 04 '18 at 02:53
  • 2
    @dontpanic I'm sure they could be silenced. The question would be what you'd have to do to silence them. I don't know whether that would be doable or whether it would mean rewriting parts of TeX's output routine, say, which would not really be doable for most of us. But they can't be silenced with the slience package. I've added an explanation for how you can tell it is not a LaTeX warning. – cfr Jun 04 '18 at 03:09
  • 3
    @dontpanic Think very carefully about whether you really want to silence these warnings, especially for overfull boxes. These are the same warnings you get when, say, only 0.005% of the included PNG fits on your paper or when that crucial URL spills into empty space off the right edge. Generally, those you don't need can be eliminated and that's a better approach. (Though I find this is never 100% doable in Beamer, I admit.) – cfr Jun 04 '18 at 03:12
  • 7
    The reason I want to silence them so badly is because I'd like to focus in fixing any other warnings that appear as I create/edit my document: being able to have zero warnings under normal conditions makes it easy to notice when things break, and where/why. Once I've finished this 1st stage, I'd like to remove the silencing to solve other lesser warnings like underfull/overfull. But I guess I'll need to live with these for the time being! – dontpanic Jun 04 '18 at 03:21
  • 1
    @dontpanic Fair enough. Sorry that I don't know how you can do that. You could try asking a new question i.e. given that silence can't do this, how can it be done? Link this question for background. – cfr Jun 05 '18 at 01:01
2

The silence package can't do it as others have said. But if what you want to do is focus on other warnings first, the easiest way is to look at the .log file:

grep -v Underfull my-document.log

The .log file is created by TeX when run and contains a copy of all the output that it had printed to the terminal. In fact you can run latex my-document.tex >/dev/null to suppress output to the terminal and just look at the .log file. This may be useful for example if TeX'ing several documents in parallel using make -j (I have a setup that does this when producing several different formats of a large document on a multi-core machine, and if one of the latex processes stops on error while others keep going, it's very difficult to figure out the terminal output, so I just rely on .log files).

1

Had the same issue as OP, I do not want to be bothered with underfull/overfull warnings during drafting. What worked for me is to put the following in the preamble:

\hfuzz=1000pt
\tolerance=20000
\hbadness=19999

Source and explanation: https://www.tug.org/TUGboat/tb14-2/tb39taylor-para.pdf

Bart
  • 397
1

You can use the Linebreaker package with LuaLaTeX to fix the overfull and underfull boxes. It tries to re-typeset the bad paragraphs until they are gone. The interword spaces in these paragraphs can be a bit larger. Still, they will stay normal in other paragraphs, as opposed to when you use \sloppy or global increases of \tollerance and other parameters.

The following example shows default line-breaking on the left and paragraph typeset with Linebreaker on the right.

enter image description here

michal.h21
  • 50,697