[tex-eplain] optional arguments

Oleg Katsitadze olegkat at gmail.com
Mon Feb 25 06:27:07 CET 2008


On Sun, Feb 24, 2008 at 05:48:38PM +0000, Adam Fenn wrote:
> How can I modify this example from the eplain manual so that the optional argument
> follows the first argument i.e \cmd{One}[Two] rather than \cmd[Two]{One}?

  \makeatletter
  \def\cmd#1{\def\cmd at arg{#1}\@getoptionalarg\finishcmd}
  \def\finishcmd{%
    \ifx\@optionalarg\empty
      % No optional argument present.
      \cmd at arg{}
    \else
      % One was present.
      {\@optionalarg} {\it\cmd at arg}
    \fi
  }
  \resetatcatcode
  \end

Cheers,
Oleg


More information about the tex-eplain mailing list