[texhax] Indexing macros on TeXbook

Rodolfo Medina rodolfo.medina at gmail.com
Mon Aug 1 23:08:21 CEST 2016


"Daniel H. Luecking" <luecking at uark.edu> writes:

> 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.

Thanks.  But page numbers seem to work perfectly.


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


That code above is copied from TeXbook p.262.  I can try to add glue in the
definition of \endindex.


> 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.

I wrote what I'm exactly hoping to achieve: add vertical glue, say some
\medskip, before a new alphabetical letter begins: i.e., after all the words
beginnig with `a', and before those beginning with `b', I want vertical space.

Thanks, Regards,

Rodolfo



More information about the texhax mailing list