A lot of the times I get warnings like "hbox overfull" when a specific part of my document is meant to be extra wide on purpose --> so I am purposefully violating the default width threshold. Or to put it another way I am interested in suppressing any warning that the author "willfully disregards".

In the above example, I purposefully violate some threshold... so IMO the generated warning should be suppressed. Anytime I purposefully break some suggestion I would like to suppress the warning. How do you suppress specific warnings generated by pdflatex?

So for example how would you suppress one specific "hbox overfull" or one specific "paragraph has no preceding subsection" warning?

(For the specific case of "hbox overfull" warning I saw that one solution is to change the default threshold for the entire document but I don't want to change the default threshold. I think the default threshold is good... I am only breaking the rule once... all the other times I want a warning to be generated so I can fix it.)

The reason I ask is because when I work I would like to have zero warnings. That way when a warning is generated it is the only warning and I can fix it right away asap... as opposed to having 5 warnings... and then when I get another warning I don't notice till later when I am already past the part that generated the warning.

  • You can change e.g. \hfuzz locally. But if I want to insert something large in a document I write the code so that I don't get warnings. Aug 13, 2012 at 14:53
  • hfuzz sounds like it might suppress the warning locally for the specific warning of "hbox overfull" but what about any other warning? Aug 13, 2012 at 15:01
  • For example in Java programming language when you do something that generates a warning and you want that code to stay that way on purpose --> you can use the @SuppressWarnings("stringDescription"). Aug 13, 2012 at 15:05
  • 2
    There is also the silence package for dealing with LaTeX warnings, but note that this will not allow you to supress warnings that are not generated through the LaTeX methods, e.g. it won't help with the overfull hboxes generated by TeX. Aug 21, 2012 at 12:46

2 Answers 2


Here is my solution (exemplified by my concrete problem with hyperref) inspired by cyberSingularity's comment. It looks like it can be adapted for many cases. (I know of texorpdfstring, this is not the point here.)

In the preamble (apparently silence must be included before hyperref) I have

\WarningFilter[pdftoc]{hyperref}{Token not allowed in a PDF string}

then in the document my infringing captions look like

\subsection{pdf toc cannot display $f_n$}

There are two ways in that case.

Locally say \hbadness=10000 which will set the threshold at which warnings start to be effectively infinite.

Or prevent the box from being overfull so if you go for example


The surrounding line is not overfull even though visually it contains a box twice as wide as the text measure, as the negative space gets you back within limits.

  • 2
    So you would put \hbadness=10000 and it applies for the rest of document? Wouldn't you have to reset it back to the default so it only suppresses warnings for one specific place of the document? Aug 13, 2012 at 15:06
  • 5
    I was using the "hbox overfull" only as an example to illustrate the kinds of warnings I wish to suppress. My question's intent was meant to cover warnings in general. Because of the questions generality maybe you could expand on the hbadness. Aug 13, 2012 at 15:13
  • 2
    By "locally" I meant set it within a group, so it would automatically reset. (Same as a local font change). For the more general question about other warnings the issues are the same, you always have a choice between turning off warnings or arranging that TeX does not feel the need to warn See the longer discussion here: tex.stackexchange.com/questions/50830/… Aug 13, 2012 at 15:50
  • Inside \marginnote, neither solution works for me. Setting \hfuzz to something large works, though.
    – Raphael
    Oct 9, 2013 at 14:08
  • 1
    @peter it suppresses overfull box warnings from the underlying tex engine, it has no effect on any warnings made by latex or latex packages. Mar 11, 2014 at 12:57

You must log in to answer this question.

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