[texhax] Indexing macros on TeXbook

Daniel H. Luecking luecking at uark.edu
Mon Aug 1 22:29:51 CEST 2016

Rodolfo Medina wrote:

> \immediate\write\index{\noexpand\beginindex first entry,
>                                            \the\pageno.\endindex}
> \immediate\write\index{\noexpand\beginindex second entry,
>                                            \the\pageno.\endindex}

Index entries require the page number of the actual occurrence of the indexing command. This is not known until the page is shipped out. That is, indexing commands require a delayed \write, not an \immediate\write.

Another problem I see is that \endindex should probably include some stretchable glue. For example \hfil\break instead of just \break.

There may be other problems, but this example doesn't reveal them, and I don't really know what exactly you are hoping to achieve.

Good luck,

Daniel H. Luecking, Graduate Coordinator
Dept. of Mathematical Sciences
University of Arkansas
Fayetteville, AR, USA

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20160801/23b14451/attachment-0001.html>

More information about the texhax mailing list