[tex-eplain] optional arguments

Russell Lyons rdlyons at indiana.edu
Thu Aug 27 00:17:17 CEST 2009


Dear all,

I hope someone can help me with this. I am fairly new to eplain and find 
it hard to understand how to define macros that take optional arguments. I 
did see one person who said the optional part must appear before the 
mandatory part, but that did not solve the whole problem. Here is what I 
tried:

-------------

\let\nobibtex = t
\let\noarrow = t
\input eplain
\enablehyperlinks[idxexact]
\catcode`@=\letter
\def\residx{\@getoptionalarg\finresidx}
\def\finresidx#1{\ifx\@optionalarg\empty{\sidx{#1}}
             \else{\sidx{#1}[\@optionalarg]}\fi}

And a result later. \residx[sub]{result}

\vfill\eject

\readindexfile{i}

\bye

-------------

However, what is produced in the index is the entry "result" with the
subentry "optionalarg ". (Note it also has an extra space.)

What am I doing wrong?

Thanks,
Russ


More information about the tex-eplain mailing list