[tex-eplain] indexing appendices

Oleg Katsitadze olegkat at gmail.com
Sat Mar 1 18:32:41 CET 2008


On Tue, Feb 26, 2008 at 04:08:57PM +0100, Helmut Jarausch wrote:
> Page numbering for the main part as well as for each appendix starts at
> page 1.  I'd like to create an index which shows the plain page numbers
> for the main part (only) and page numbers prefixed by a letter for the
> corresponding appendix, something like
> 
> loop   7, A2
> condition  A2, D5
> 
> Is this possible with Eplain?

Well, as far as Eplain is concerned, the code below seems to work,
with one restriction that appendixes have to start on a new page
(which is quite reasonable to expect in most cases).

Another thing is getting the index out of the .idx file -- MakeIndex
chokes on page numbers prefixed with C and D, because it takes them
for roman numerals.  I've heard xindy (http://xindy.sourceforge.net)
is much more flexible, and can probably be convinced to do the right
thing.

HTH,
Oleg


\input eplain

\newif\ifprefixpagenumbers \prefixpagenumberstrue

\def\part#1 #2 \par{%
  \vfil\eject
  \gdef\partprefix{#1}%
  \pageno=1
  {\bf #2}\par
  \nobreak\smallskip
}

\let\plainfolio\folio
\def\folio{%
  \ifprefixpagenumbers
    \partprefix\plainfolio
  \else
    \plainfolio
  \fi
}
% Avoid "undefined macro" errors if \partprefix gets used
% before it gets defined.
\let\partprefix\empty

% Do not prefix part letter inside the footer.
\footline={\hss\tenrm\prefixpagenumbersfalse\folio\hss}


\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

\readindexfile{i}

\end


More information about the tex-eplain mailing list