Aller au contenu

\overfullrule[=] dimension

Where:

  • [=]” means that the equals sign is optional.
  • dimension is an amount specified in units that TEX can understand—e.g., pt, bp, mm etc.

When TEX detects that an hbox is overfull—such as a line in a typeset paragraph or some text in an \hbox{..}—it will write that information to the log file. In addition, TEX engines also provide the \overfullrule command which can be used to instruct TEX to add a short rule to the end of the offending box, acting as a visual warning to the user.

Usage example

Because the “=” sign is optional you can write \overfullrule=10pt or \overfullrule 10pt.

Note that LATEXsets \overfullrule to 0pt, Plain TEX sets it to 5pt.

An example

We’ll use an \hbox{} that will be overfull: \hbox to 10pt{This box will be overfull} and set \overfullrule to a non-zero value, say 10mm:

\overfullrule=10mm\hbox to 10pt{This box will be overfull}\par

The following graphic shows the output:

As you can see, a 10mm-long rule has been added to the end of the overfull \hbox. Now set \overfullrule=0mm to prevent an overfull box rule being displayed:

\overfullrule=0mm\hbox to 10pt{This box will be overfull}

The following graphic shows the output:

The resulting \hbox is still overfull but this time it is displayed without an overfull rule to highlight that fact.

Another example: lines in a paragraph

When TEX breaks a pararaph into lines of typeset text, each line in the paragraph is stored in an \hbox. TEX can be told to display overfull lines by setting \overfullrule to a non-zero value. The following example shows overfull rules being displayed at the end of overfull lines in a paragraph.

To create a paragraph, we’ll put some text in a narrow \vbox, set \overfullrule=10pt, and draw the box with a border. Note that because we used the \verb command we first need to save the \vbox in a box register (100) and then use the LATEX command (macro) \fbox to draw a tight border around it, making it easier to see the overfull lines.

\overfullrule=10pt
\setlength{\fboxsep}{0pt}% To ensure a tight border with no gap
\setbox100=\vbox{\hsize=30mm Inside this vbox we’ll set the
linewidth to 30mm using \verb|\hsize=30mm|.
We are typesetting some text inside a \verb|\vbox|
because it will cause \TeX{} to perform linebreaking
and build the paragraph as a stack of horizontal boxes.
For some lines \TeX{} might be unable to find a good
linebreak which can result in lines too wide to fit
within a width of 30mm. Because \verb|\overfullrule| is
non-zero (10pt), those overfull lines are
indicated by an overfull rule of width 10pt. Note that to \TeX{},
this box is still considered to be 30mm wide even though
some lines do not fit and an \verb|\overfullrule|
of width 10pt is added on to the end of some lines.}
\fbox{\copy100}

The following graphic shows the output:

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX