summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/eplain/base/test/optional.tex
blob: f7cc917000e02e0acfdacf6588525f7268a453ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
% 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