[tex-eplain] indexing appendices

Oleg Katsitadze olegkat at gmail.com
Sun Mar 2 04:40:08 CET 2008

On Sat, Mar 01, 2008 at 04:22:15PM -0600, Karl Berry wrote:
> BTW, I would not assume that makeindex could not be configured to get
> around this, unless you have actually checked.

This is very interesting.  I also suspected that, but I couldn't find
anything in the manual page.  So now I took a look at the code and
discovered that makeindex has a notion of a "composite page number".
Parts of a complex page number must be separated by a "page
compositor", which by default is "-".  So, makeindex can correctly
scan and process page numbers of the form "A-1", "B-32-i",
"1-IV-42-f", etc., (up to ten levels) but it can't do what Helmut
wanted (a "no compositor" case like "A1", but see below).

Page compositor can also be changed through the .mst file with
page_compositor setting (I've checked), but for some reason
makeindex's man page doesn't mention composite page numbers at all,
let alone the ability to change the compositor char.  I wonder why is
that.  Karl, if I patch the man page, can makeindex be repackaged?  Or
maybe it can just be patched in TeX-Live?  It's not GPL, but similar.
The only catch is that the license requires that "all modified
versions [...] be reported back to the author".  Can we find the

At any rate, below is a modified sample for Helmut which works with
makeindex, if he's willing to accept the page compositor character.
If not, it might be possible to sacrifice some char, making it a
compositor character for makeindex and an active character in TeX
which outputs nothing (the latter only needs to be done while reading
the index, so this can easily be "&", which I doubt will occur in
index entries).


\input eplain

\newif\ifprefixpagenumbers \prefixpagenumberstrue

\def\part#1 #2 \par{%
  {\bf #2}\par

    \partprefix \ifx\empty\partprefix\else-\fi \plainfolio
% Avoid "undefined macro" errors if \partprefix gets used
% before it gets defined.

% Do not prefix part letter inside the footer.

\part {} Main Part

Text of Main Part.\sidx{foo}

\part A Appendix~A

Text of Appendix~A.\sidx{bar}

\part B Appendix~B

Text of Appendix~B.\sidx{term}\sidx{bar}\sidx{foo}

\part C Appendix~C

Text of Appendix~C.\sidx{another term}\sidx{bar}

\part D Appendix~D

Text of Appendix~D.\sidx{yet another term}\sidx{foo}

\part {} Index



More information about the tex-eplain mailing list