# [NTG-pdftex] why is TeX breaking the line? (updated)

Gerd Neugebauer gene at gerd-neugebauer.de
Wed Oct 18 21:48:14 CEST 2006

Heiko Oberdiek wrote:

> At least a smaller example (without different
> spacefactors -- \discretionary does not change the spacefactor):
>
> \tracingparagraphs=1
> \nopagenumbers
> \parindent=0pt
> \setbox0=\hbox{C}
> \hsize=\wd0
>
> C\par
>
> \discretionary{AA}{BB}{C}\par
>
> \bye

Hi,

I have made a variant of the example:

\parindent=0pt
\setbox0=\hbox{C}
\hsize=\wd0%\advance\hsize7.8pt

C\par

\discretionary{AA}{BBB}{C}\par

\bye

TeX reports an overfull box of 7.7778pt for the AAs. If I advance the
hsize by something less than this then the effect remains. If I advance
the hsize by more (as included in comments above) the effect disappears
and C is typeset.

I concluded that in the handling of discretionaries the comparison is
made against a width containing the width of pre_break instead of the
replacement text. This seems to be a bug in TeX.

I have traced it down to section 869. There the sum of the width of the
nodes of pre_break is added to act_width. If I replace the first loop
with a construction similar to the second loop the problem seems to
disappear.

I do not claim that I have completely understood what's going on. I just
wanted to share my insights.

Ciao
Gerd



More information about the ntg-pdftex mailing list