# [texhax] Index in (e)plain TeX

Heiko Oberdiek heiko.oberdiek at googlemail.com
Thu Apr 21 22:19:22 CEST 2011

On Thu, Apr 21, 2011 at 09:18:00AM -0600, D. R. Evans wrote:

> I've never had to create an index in plain TeX before, and there's
> obviously a simple trick that I'm missing...
>
> After reading the TeX FAQ, my understanding (which is presumably wrong,
> since it doesn't work) is that the workflow is supposed to be:
>
> 1. pdftex
> 2. makeindex
> 3. pdftex
>
> I have a couple of test \idx commands in the plain TeX file, and after step
> one the *idx file is created.

Not possible. \idx is not defined in "plain TeX".
Thus you are using something different, perhaps
"Expanded Plain TeX" (eplain). At least \idx and
\readindexfile{i} are available there.

> After step two the *ind file is created, and it looks OK (at least it has
> plausible stuff in it).
>
> But in step three, the \readindexfile{i} produces no output.
>
> Looking at the *ind file I see things that look like LaTex, not plain TeX

The eplain people are reusing LaTeX's syntax here, that saves the
user from specifying a specialized style file for makeindex.

> (i.e., \begin, \item and \end commands), but no errors are logged -- and no
> output either. Reading the eplain documentation leads me to believe that
> the LaTeX-like commands are what is expected. So I don't understand why no
> output is being produced by the \readindexfile{i} command.

Make a complete, but minimal example that shows the problem.
The following example works for me

%%% File: test.tex %%%
Hello \idx{World}
\sidx{Hello}
\par
\bye

eplain test
makeindex test
eplain test
%%% End of test.tex %%%

%%% File: test.ind %%%
\begin{theindex}

\item Hello, 1

\indexspace

\item World, 1

\end{theindex}
%%% End of test.ind %%%

Yours sincerely
Heiko Oberdiek