% This file is public domain. % % Test optional arguments. \ifx\undefined\eplain \input eplain \fi \catcode`@ = \letter \def\foo{\@getoptionalarg\finfoo} \def\finfoo#1{% \edef\firstarg{\@optionalarg} \edef\mandatoryarg{#1}% \@getoptionalarg\finfinfoo } \def\finfinfoo{% The first optional argument is `\firstarg', the mandatory argument is `\mandatoryarg', and the second optional argument is `\@optionalarg'. \par } \loggingall \foo[a {\cite[p.10]{xyz}} b]{mand2} \foo{mand} \foo[opt1]{mand} \foo{mand}[opt2] \foo[opt1]{mand}[opt2] \foo[opt1]{mand} [opt2 on a separate line] \bye