[tex-eplain] Bug in index proofing macros

geolsoft at mail.ru geolsoft at mail.ru
Fri Aug 27 23:31:46 CEST 2004


Dear tex-eplain team,

There seems to be a bug in index proofing macros.

Consider the following input file:


--------------------start of testidx.tex--------------------
\input eplain
\hsize=2.7in

A variable, such as $\Delta x$ above, that approaches zero
as a limit is called an {\it\sidx{Infinitesimal}infinitesimal}.

\bye
--------------------end of testidx.tex--------------------


When run on this file, TeX hyphenated the word
`infinitesimal'.  However, as soon as I added a line:

  \indexproofingtrue

after the line with \hsize setting, `infinitesimal' was no
longer hyphenated, producing an overfull box.

The bug is located in the definiton of macro `\@idxwrite' in
xeplain.tex.  It contains a line:

  \ifindexproofing \insert\@indexproof{\indexproofterm{#1}}\fi

During the run with \indexproofingtrue, this conditional
inserted a vertical mode material resulting from \insert,
after interword glue and in front of the word
`infinitesimal' in my input file.  This prevented
hyphenation of the word (see The TeXbook, p.~454).  (Placing
\sidx after the word does not give this kind of problem, but
it seems more appropriate to stick \sidx in front of the
word.)

I managed to solve this problem by adding the following
definitions near the top of my input file:

  %
  % \allowhyphens
  %
  % This is from The TeXbook, p.~395.  It allows following (preceding) word to be
  % hyphenated
  %
  \newdimen\zzz
  \def\allowhyphens{\nobreak\hskip\zzz}%
  \hookaction{afterindexterm}{\allowhyphens}%

And this would seem to close the issue, if not for the fact
that paragraphs can actually be broken into lines (and even
lines into pages, in the worst case) differently depending
on the setting of \ifindexproofing, in case the \hookaction
is omitted/overlooked.  So it is possible to be proofreading
something other than the final copy, without even noticing
it.

Could it be a good idea to add the \allowhyphens permanently
to \@idxwrite after the \insert (see below patch for Eplain
Version 2.8.2)?  Can my approach have any adverse effects?

Many thanks.


Best regards,
Oleg Katsitadze


--- xeplain.tex.orig	2004-08-28 00:18:32.000000000 +0300
+++ xeplain.tex	2004-08-28 00:24:23.000000000 +0300
@@ -1764,6 +1764,14 @@
   \temp
 }%
 %
+% \allowhyphens
+%
+% This is from The TeXbook, p.~395.  It allows following (preceding) word to be
+% hyphenated
+%
+\newdimen\@zzz
+\def\allowhyphens{\nobreak\hskip\@zzz}%
+%
 %
 % \@idxwrite{TERM}{PAGENO} writes a general index entry for TERM on page
 % PAGENO to the index file `\@idxprefix indexfile'.  We open the stream
@@ -1793,7 +1801,7 @@
   \@wr
   % 
   % Marginalize the index term, if desired.
-  \ifindexproofing \insert\@indexproof{\indexproofterm{#1}}\fi
+  \ifindexproofing \insert\@indexproof{\indexproofterm{#1}}\allowhyphens\fi
   %
   % We just appended at least one non-discardable item (namely, the
   % whatsit from the \write) to the current list.  So in case glue comes



More information about the tex-eplain mailing list