As indicated in the post

What is the command to highlight bad boxes in pdf?

To visually detect the bad boxes in pdf, the rule


can be used. Is this rule also helpful in highlighting bad boxes that intrude into the left margin as well?

Thanks in advance.

  • This typically doesn't happen, as content is set from the left margin. What do you have that might protrude into the left margin naturally? – Werner Nov 17 '16 at 1:18
  • @Werner: There is a bad box caused by an \begin{array} ... \end{array} environment. so I used {-0.3em} to fix that. But it seems to be intruding into the left margin, hard to tell. – Jenna Adler Nov 17 '16 at 1:22
  • I don't understand why you don't try adding it to your preamble and seeing if it works. Wouldn't that be much quicker than asking a question here and waiting for an answer? – cfr Nov 17 '16 at 3:23
  • 2
    if you specify an explicit negative space then the box isn't bad it has been forced into the margin by the author, why should tex warn about that? – David Carlisle Nov 17 '16 at 8:02
  • @cfr I have already done that, and visually it seems clear that it is intruding the left margin, however, no warnings are issued. – Jenna Adler Nov 18 '16 at 18:40

Intrusion into the left margin is not registered as a bad box as far as I can tell in left-to-right typesetting because, as Werner pointed out it isn't really possible to intrude into the left margin other than intentionally in this case. When you intrude deliberately by setting a negative space, it is assumed that you know what you want and therefore the intrusion is not bad.

For example, consider the following MWE


\hspace*{-25mm}ABC \hrule


This certainly protrudes into the left margin


but LaTeX does not consider it a bad box:

grep ful <filename>.log 

returns nothing.

It is the same principle as you see if you put something which is too large for the space into a box and tell TeX that the box has a width of 0pt. TeX will not complain that the contents is too big for the space or not really 0pt. It will assume that is how big you want it to think the box is. This trick can be used to put an oversized image on a page without triggering a bad box warning. But it means that you must manually check that the content fits (e.g. does not spill off the paper) because you will not get a warning about the width of the box in this case regardless. After all, you told TeX explicitly to assume it fitted in zero width. Unlike Word, if you tell TeX that P or to do Q it will assume P or do Q. It will not assume that you really wanted to do S or that you actually meant that R.

  • the request to place something into the left margin is explicit. therefore, it can't be considered "bad" by latex. – barbara beeton Nov 17 '16 at 17:14
  • @barbarabeeton Yes, I agree. But isn't that what the OP is doing also? – cfr Nov 17 '16 at 22:47
  • yes, that's what the op is asking about, and according to the rules, it's impossible. – barbara beeton Nov 18 '16 at 15:17
  • Nothing special about the left margin here, intrusion into the right margin is not a bad box either if achieved by using a negative space. add a second paragraph \hspace*{\fill}ABC\hspace*{-25mm} to your test document.... – David Carlisle Nov 18 '16 at 18:54
  • @DavidCarlisle I didn't mean there was anything special. Just that, given how the OP has caused the intrusion into the left margin, TeX is not going to think it is bad and so won't consider it a bad box. Not because it is the left margin but because the intrusion into it is explicitly requested. The left margin is special, I guess, in the sense that it is hard to think how you'd intrude into it without intending to do so. (Not sure about this, though. And obviously RTL would turn that on its head.) – cfr Nov 18 '16 at 22: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.