[tex-eplain] \tocentry with `depth' argument,

Oleg Katsitadze olegkat at gmail.com
Wed May 3 20:46:07 CEST 2006


On Tue, May 02, 2006 at 05:44:13PM -0400, Dorai Sitaram wrote:
> Is there a reason why the arguments of
[...]
> are in the order that they are?

Not that I know of :).

> #1 = title
> #2 = number
> #3 = page
> 
> I would have thought #1 and #2 are better in each other's places.  That
> way, if a user were to allow for catcode changes in the title, they can
> write an expansion for the \toc...entry much more easily, instead of having
> to do the whole save-to-a-file-and-read-it-in-again routine.

This sounds reasonable, but I'm not brave enough to change
the order of the arguments (unless Karl gives the green
light :).  Can't you swap title and number arguments in a
call to \writetocentry?  Of course, you loose the nice
one-token expansion for the number which \writecontentsentry
does for you, but you still can do the expansion yourself
(using tricks with \the\toks and \edef).  And to avoid
expansion of the first token of the title (which now comes
in place of the number), just save the title in a token
register and pass \the\toks for the title?

I know this sounds like one ugly hack, but it should work.

Thanks for the ideas,
Oleg


More information about the tex-eplain mailing list