[tex-eplain] sidx & optional arguments

Laszlo Hosszu l.l.hosszu at shef.ac.uk
Mon Jul 26 17:57:40 CEST 2010

Hi all.

I am fairly new to eplain, but I was wondering whether a workaround has been
found for sidx expanding optional arguments within a macro (originally raised by
Russell Lyons). I feel that this would be a really useful feature. 

I have tried the following, which have been suggested, neither of which work. (I
am using eplain 3.4 with teTeX 3.0)


This is a test of \residx[Galapagos]{Darwin}. 

{\centerline{\bf INDEX}}



Entry in idx file (\@optionalarg macro is not expanded):

\indexentry{Darwin!\@optionalarg }{1}

and also


This is a test of \finresidx{Darwin}. 

{\centerline{\bf INDEX}}




Which results in following error. 

! Undefined control sequence.
\finresidx ...\toks 0={#1}\toks 2=\expandafter {\@
                                                  optionalarg}\edef \temp {\...
l.12 This is a test of \finresidx{Darwin}

Ultimately I would like something along the lines of the following....

\def\hmsidxital#1{{\it #1}, HMS}
    {\sidxmarked\hmsidxital{#1} {\it #1}} 	% No Optional Arg
    {\sidxmarked\hmsidxital{#1} [\@optionalarg] {\it #1}}


Darwin joined the \beagle. The \beagle[galapagos] mapped the Galapagos in 1835. 

The macro would do the formatting and indexing simultaneously. But would the
optional argument be recognised if the macro is within another as above?

Many thanks 


More information about the tex-eplain mailing list