5

When I run

\documentclass{article}
\begin{document}
Aaaaaa aaaaa aajcaaaaaa $a:A_{aa}\to a_a$a$\ge$ aaaaaaaaaaaaaaaaaaaaaa 
$a_a\dots\to$
\end{document}

the build output contains the following line:

LaTeX-Result: 1 Error(s), 0 Warning(s), 1 Bad Box(es), 1 Page(s)

When I click on Next Error, it points in the build output to the line starting with ! in the following paragraph:

Overfull \hbox (1.65294pt too wide) in paragraph at lines 3--4
[]\OT1/cmr/m/n/10 Aaaaaa aaaaa aa-j-caaaaaa $\OML/cmm/m/it/10 a \OT1/cmr/m/n/10 : \OML/cmm/m/it/10 A[] \OMS/cmsy/m/n/10 
! \OML/cmm/m/it/10 a[]$\OT1/cmr/m/n/10 a$\OMS/cmsy/m/n/10 $ \OT1/cmr/m/n/10 aaaaaaaaaaaaaaaaaaaaaa $\OML/cmm/m/it/10 a[
] [] \OMS/cmsy/m/n/10 !$ 
 []

Looking up this error, I see that something similar shows up with fonts, but the error code is slightly different.

My guess is that it's something to do with the $\to$ at the end being overflowed, but that's not all because I can move some of the letters around without changing how big of a bad box it is to remove the error.

Can someone tell me what the cause of this error is?

UPDATE: According to the one of the comments, it may depend on what program is being used. I got this error on both TeXnicCenter, and this error code also appears on latexbase.com but it is not reported as an error.

9
  • 2
    With TeXlive2017 here on Linux I only got Overfull \hbox (1.65294pt too wide) in paragraph.
    – Sigur
    Commented Feb 15, 2018 at 1:54
  • TeXnic is simply an editor. Are you using MikTeX? Maybe you have to update some fonts.
    – Sigur
    Commented Feb 15, 2018 at 2:03
  • No problem with online editor. Only an overfull warning.
    – Sigur
    Commented Feb 15, 2018 at 2:06
  • @Sigur I am using MikTeX, although the copy of TeXnicCenter I am using is quite recent (downloaded less than a month ago) (I also tested it with a copy of TeXnicCenter that is a few years old, and the error is present). Maybe this is just a TeXnicCenter bug Commented Feb 15, 2018 at 2:09
  • 3
    I think this is similar to the answer to “Unintelligible error after typing a single letter”: it's a warning not an error, but at the default line wrap width, as the line starts with a !, many dumb programs may think it's an error. (Nevertheless you may want to heed the warning: to fix the overfull box you can rewrite the text, increase \tolerance or \emergencystretch, change to ragged-right, etc.) Commented Feb 15, 2018 at 3:41

1 Answer 1

13

Short answer: This is a warning, but your editor (TeXnicCenter) has confused it for an error. Longer answer follows.


(A previous question “Unintelligible error after typing a single letter” covers this, but I felt it was worth going into more detail, so taking another shot.)

Table of contents

  1. Why the output is treated as an error (and how to fix that)
  2. How to make this output go away (fixing the warning)
  3. What the output means

1. Why the output is treated as an error

There are three things that are conspiring here to confuse your editor:

  • TeX prints error messages on a new line, starting with !␣ (a ! followed by a space; just using to denote a space because otherwise it's not visible here). (Incidentally, this is not actually documented in The TeXbook—I think Knuth didn't want to specify details of user interaction and expected them to change with the TeX implementation—but see the examples in Chapter 6 and 27, and also Part 6 “Reporting Errors” §73 in TeX: The Program.)

  • When TeX is forced to typeset an overfull box, it prints out a diagnostic showing the box that was overfull. (Similarly with tight boxes, etc.) This diagnostic can contain things like !, depending on the characters that occur inside the box and the fonts used.

  • TeX wraps output lines by default, to width max_print_line. In this case, it appears that your TeX environment has been set up to wrap error output lines at exactly 120 characters, as a result of which one of the lines (coincidentally) starts with a !. You can change this line-wrapping as described in the other answer, or by simply invoking TeX with a larger value of max_print_line in the shell environment, like max_print_line=1000 pdflatex ...).

As a combination of these factors, we have an overfull box diagnostic printed, wrapped to 120 characters, and mistakenly interpreted by your editor as an error.

If you increase the line-wrapping width (e.g. max_print_line=10000), you'll avoid this confusion, and get output like this instead, with the overfull box displayed entirely on one line (and no line starting with a !):

Overfull \hbox (1.65294pt too wide) in paragraph at lines 3--5
[]\OT1/cmr/m/n/10 Aaaaaa aaaaa aa-j-caaaaaa $\OML/cmm/m/it/10 a \OT1/cmr/m/n/10 : \OML/cmm/m/it/10 A[] \OMS/cmsy/m/n/10 ! \OML/cmm/m/it/10 a[]$\OT1/cmr/m/n/10 a$\OMS/cmsy/m/n/10 ^^U$ \OT1/cmr/m/n/10 aaaaaaaaaaaaaaaaaaaaaa $\OML/cmm/m/it/10 a[] [] \OMS/cmsy/m/n/10 !$ 

2. How to make the output go away

The output (warning) is about an overfull box, which means a line sticking out a bit more than it should. How much more? We can see it visually by adding a paragraph of text near it:

line

Can you tell that the arrow sticks out more than the lines of text above? Maybe with this:

with lines

For dealing with overfull boxes, your options (in increasing order of effort required and decreasing order of aesthetics) are to ignore it, allow more stretch, allow more breaks, or rewrite the text.

In this case, as you can see, it's not overfull by a lot (the warning message says 1.65 pt). So if you don't find it visually jarring, the best thing may be to just ignore it. (You can make the warning no longer appear, by increasing \hfuzz to say 1.66pt or anything greater.)

Else the best approach here (as there's math and introducing breaks inside math may be bad) may be to rewrite the text. Or if you don't want to bother, you can just set \sloppy (see this answer for what exactly \sloppy does) or increase \emergencystretch, to get a line break at the cost of a little more stretching than TeX is comfortable with by default:

with stretch

(To avoid affecting other paragraphs in the document, you can restrict the changes of \sloppy and/or \emergencystretch to just this paragraph, by using { … } grouping, e.g. LaTeX provides a sloppypar environment that does exactly this.)


3. What the output means

The remaining question is why the overfull box diagnostic looks the way it does: What does this output mean?

It is basically a list of everything that TeX put on that line, including glue, and characters from different fonts. On a line containing many different fonts, a lot of the output can end up being about the fonts.

You can use the package fonttable and

\xfonttable{OT1}{cmr}{m}{n}
\xfonttable{OML}{cmm}{m}{it}
\xfonttable{OMS}{cmsy}{m}{n}

to understand in more detail the fonts that occured in the line of output. This is the OT1/cmr/m/n font:

OT1

and this is OML/cmm/m/it:

OML

and this is OMS/cmsy/m/n:

OMS

So in the Overfull \hbox log line, when it prints what was the overfull hbox that was typeset,

offending box

as

[]\OT1/cmr/m/n/10 Aaaaaa aaaaa aa-j-caaaaaa $\OML/cmm/m/it/10 a \OT1/cmr/m/n/10 : \OML/cmm/m/it/10 A[] \OMS/cmsy/m/n/10 ! \OML/cmm/m/it/10 a[]$\OT1/cmr/m/n/10 a$\OMS/cmsy/m/n/10 ^^U$ \OT1/cmr/m/n/10 aaaaaaaaaaaaaaaaaaaaaa $\OML/cmm/m/it/10 a[] [] \OMS/cmsy/m/n/10 !$ 

we can split it by parts as:

  • [] — this is the parindent glue
  • \OT1/cmr/m/n/10 Aaaaaa aaaaa aa-j-caaaaaa $ — this simply means “Aaaaaa aaaaa aajcaaaaaa” in the font OT1/cmr/m/n/10 (see above), with discretionary breaks (potential hyphenation points) as indicated in aaaaa aa-j-caaaaaa, followed by the start of math mode.
  • \OML/cmm/m/it/10 a
  • \OT1/cmr/m/n/10 : — note that even though we're in math mode, the : comes from the OT1 cmr font, because it's supposed to be upright etc.
  • \OML/cmm/m/it/10 A[] — the subscript aa is its own box (I think), and is simply shown here as []
  • \OMS/cmsy/m/n/10 ! — note that ! (character 33) in OMS/cmsy/m/n is the character. In non-Unicode TeX engines (basically pdfTeX as opposed to XeTeX or LuaTeX) fonts can have at most 256 glyphs, so characters like have to be mapped to some position in 0–255.
  • \OML/cmm/m/it/10 a[]$ — again the subscript a is denoted by just []
  • \OT1/cmr/m/n/10 a$
  • \OMS/cmsy/m/n/10 ^^U$ — here, ^^U denotes the character 21 (because U is ASCII 85, and in TeX ^^ means to add or subtract 64), and character 21 in that font is
  • \OT1/cmr/m/n/10 aaaaaaaaaaaaaaaaaaaaaa $
  • \OML/cmm/m/it/10 a[] []
  • \OMS/cmsy/m/n/10 !$ — again, ! here means

(Clearly the output of how these overfull boxes are shown, although good for the time TeX was developed (~1980) and useful to someone who's read the manual carefully, could be made better today, e.g. having options to colour the output, convert characters to Unicode, or suppress/toggle font info, but unfortunately not much work has been done on such improvements to TeX. Using LuaTeX and post_linebreak_filter, I was able to get a bit more structured output for the line: here. That's too verbose for typical uses, but an interactive system could have expand/display, showing the actual glyphs from the fonts instead of confusing stuff like !, etc.)

0

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