When TeX breaks a paragraph into lines, it makes three passes. In the first pass, TeX tries to break the paragraph without hyphenation, during which it makes sure that no line has a badness (from glue setting) exceeding \pretolerance
. If the first pass fails (i.e., no sequence of break points is found), then TeX tries the second pass with hyphenation enabled, but this time it makes sure that no line has badness exceeding \tolerance
.
The plain TeX format sets \pretolerance=100
and \tolerance=200
, which are inherited by LaTeX. But why a much larger \tolerance
than \pretolerance
?
Under this setting, TeX will allow “very loose” lines where glues are stretched to about 126% of their total stretchability (because the cubic root of 200/100 is 1.2599…) when hyphenation is enabled (in the second pass), while TeX only allows glues to stretch to 100% of the total stretchability in the first pass.
This doesn’t make sense: Hyphenation is supposed to help breaking the paragraph better. When hyphenation is enabled, there are much more feasible break points for TeX to choose from. So why allow the possibility of “looser” lines, when the more sensible setting seems to be keeping the same \tolerance=100
? (i.e., keeping the same limit on badness of each line, but shouldn’t be a problem because now TeX has more break points to choose from)
The following code (LaTeX-friendly) illustrates my question and it partly addresses @UlrikeFischer’s comment.
% There are Unicode characters in the following source.
% Use XeLaTeX or LuaLaTeX to compile.
\documentclass{article}
\begin{document}
\noindent
\vtop{\hsize=250pt \parindent=20pt
\tracingparagraphs=1
When \TeX\ breaks a paragraph into lines, it makes three passes.
In the first pass, \TeX\ tries to break the paragraph without
hyphenation, during which it makes sure that no line has a
badness (from glue setting) exceeding \verb|\pretolerance|.
If the first pass fails (i.e., no sequence of break points is
found), then \TeX\ tries the second pass with hyphenation enabled,
but this time it makes sure that no line has badness exceeding
\verb|\tolerance|.
The plain \TeX\ format sets \verb|\pretolerance=100| and
\verb|\tolerance=200|, which are inherited by \LaTeX. But
why a much larger \verb|\tolerance| than \verb|\pretolerance|?
Under this setting, \TeX\ will allow “very loose” lines where
glues are stretched to about 126\% of their total stretchability
(because the cubic root of 200/100 is 1.2599…) \emph{when
hyphenation is enabled} (in the second pass), while \TeX\ only
allows glues to stretch to 100\%\strut\vadjust{\setbox0\hbox{%
% The baseline of the top-most line in the following margin note
% coincides with the bottom edge of the \strut in the main text.
% Raising \dp\strutbox makes two baselines agree. We then add an
% offset ``-(math-axis ht of 8pt CM)+(math-axis ht of 10pt CM)'',
% so the margin note will share the same axis with the main text
% (i.e., the bars of arrows will be at the same place).
\raise\dimexpr\dp\strutbox-2pt+2.5pt\relax
\vtop{\hsize=90pt \footnotesize\noindent
$\leftarrow$ This line is very loose. The badness is $b=124$
(stretching to $\approx$107.4\%). The paragraph itself has been
hyphenated.}}\ht0=0pt \dp0=0pt \moveright255pt \box0 }
of the total stretchability in the first pass.
This doesn’t make sense: Hyphenation is supposed to \emph{help}
breaking the paragraph \emph{better}. When hyphenation is
enabled, there are much more feasible break points for \TeX\ to
choose from. So why allow the possibility of “looser” lines,
when the more sensible setting seems to be keeping the same
\verb|\tolerance=100|? (i.e., keeping the same limit on badness
of each line, but shouldn’t be a problem because now \TeX\ has
more break points to choose from)
}
\end{document}
50
, which is extra demerits of2500
. And if this hyphen happens to be in the second-last line, additional\finalhyphendemerits
of5000
are added, totaling to7500
. But not breaking at hyphen can make a line too loose (e.g., fromb=60
if breaking at hyphen tob=120
if not, then the demerits would increase by(130)^2-(70)^2=12000
). Of course, TeX will find the best way to minimize total demerits. But under\tolerance=200
, TeX would rather produce very loose lines than notify the author with overfull boxes.\dots
instead of...
to get an ellipse. What value does\hfuzz
have that the line with the closing parenthesis can stick so far out? (Plain \TeX
uses 0.1pt.) If you want to be informed about lines with a badness higher than 100 set\hbadness=100
. As the paragraph cannot be typeset with a\tolerance=100
what do you expect that\TeX
shall do exactly?…
(U+2026), not...
(<U+002E U+002E U+002E>), which is a perfectly valid input for Unicode-aware engines. (2) The point of the third paragraph is to illustrate that overfull hbox is unavoidable with\tolerance=200
, i.e., this paragraph is impossible to break, and the tracing shows that the second-last line is too loose. But if\tolerance
were set to100
, then no such loose lines will appear, although this paragraph will gain an extra overfull line.