[tex-eplain] Stop hyphenation in TOC

Oleg Katsitadze olegkat at gmail.com
Sun Jan 15 11:51:13 CET 2006


On Sat, Jan 14, 2006 at 11:06:18AM -0600, Karl Berry wrote:
> Another idea that comes to mind is that the end of the group with the
> \pretolerance setting is reached before the \par

I think I have it.  It _should_ be a problem with groups.

John's \tocchapterentry definition never ends a paragraph,
so if no other macro (like \tocsectionentry) ever breaks the
resulting long paragraph, and \readtocfile is embedded in a
group, \pretolerance will get reset by the time TeX starts
hyphenating the long paragraph:

  {\readtocfile}% paragraph does not end within the group

To solve this, just put \par after \readtocfile:

  {\readtocfile\par}

or maybe redefine \tocchapterentry so it ends a paragraph
for each chapter entry.  By the way, this might also save
you a TeX memory overflow if the TOC gets really long
(although this might never happen with modern TeX
installations).

The reason it works with \lefthyphenmin=5 is because TeX
records every change of \language in a paragraph to allow
several languages in a single paragraph, and I would think
TeX also records the changes in \lefthyphenmin and
\righthyphenmin as well (by means of whatsit's, see The
TeXbook, p. 455).  So these take effect even if the
paragraph does not end in the same group in which
\lefthyphenmin was set.

Hope this makes sense (and helps),
Oleg



More information about the tex-eplain mailing list