I always use something like \overfullrule=1mm when I am writing Latex documents. I do read all warnings regarding overfull \hboxes, but I still prefer the visual output that very clearly shows exactly which boxes are overfull.

Can I somehow have something similar for underfull \hboxes? Some kind of simple visual highlighting that shows exactly where in the final document I have those problematic lines of text?

I am using pdflatex in case it matters.

  • I think various editors have options to present to you a parsed list of the over/underfull messages from the log and a click then puts you in the right part of the source. At least I seem to recall auctex was able to do so. That is not visual, but already better than reading the log manually. Oct 13 '10 at 19:40
  • When I get to the point in a paper where I'm fixing typographical errors, I use pdflatex file|egrep '(Over|Under)full' to find the locations I need to focus on.
    – TH.
    Oct 13 '10 at 19:47

It's not possible in the general case, but you can visualise when underfull boxes occur by taking apart a paragraph and measuring the badness of the individual lines of the paragraph. An example is shown here: https://gist.github.com/0f42f19422d446490e0e (update: I just edited the file a little to give better results).

It requires that you put markup around your paragraphs, unfortunately, but it's fun to play with. Perhaps the new everyhook package might be helpful to apply these sort of command to every text paragraph in a document, but I suspect that would require major surgery of LaTeX's section heading system.

  • Ingenious routine. Just tried it with narrower text and various \hyphenpenalty values. Oct 16 '10 at 19:51

I believe the answer is no. It would be pretty handy though.

Usually, lines that are underfull are pretty clear since the words are spaced out too much. Underfull vboxes are almost always really obvious because there will be space between paragraphs or at the bottom of the page.

  • I agree, the answer is no. Oct 13 '10 at 19:41
  • 1
    OK, thanks for the answers. I'll wait a while before accepting this answer, though, just in case someone comes up with a clever trick. Oct 14 '10 at 9:25
  • 1
    @Jukka Suomela: Good choice!
    – TH.
    Oct 16 '10 at 19:27

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.