[tex-eplain] Help on a macro definition needed

Oleg Katsitadze olegkat at gmail.com
Fri Feb 29 05:33:07 CET 2008


On Thu, Feb 28, 2008 at 11:17:43AM +0100, Helmut Jarausch wrote:
> \catcode`\@=\active
> \newtoks\myreffirstarg
> \def @#1|{\myreffirstarg={#1}\myrefoneortwo}
> \def \myrefoneortwo{%
>        \expandafter\expandafter\sidx[pagemarkup=myrefPrefix]\expandafter{\the\myreffirstarg}
> }

Nope, this won't work.  Your second \expandafter will expand the token
`[', which is unexpandable so will remain as it is.  And your third
\expandafter, I'd guess, is passed as an argument to \sidx.  Try this:

  \catcode`\@=\active
  \newtoks\myreffirstarg
  \def @#1|{\myreffirstarg={#1}\myrefoneortwo}
  \def \myrefoneortwo{%
    \edef\temp{\noexpand\sidx[pagemarkup=myrefPrefix]{\the\myreffirstarg}}%
    \temp
  }

HTH,
Oleg


More information about the tex-eplain mailing list