summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/eplain/base/test/optional.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/eplain/base/test/optional.tex')
-rw-r--r--Master/texmf-dist/source/eplain/base/test/optional.tex30
1 files changed, 30 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/eplain/base/test/optional.tex b/Master/texmf-dist/source/eplain/base/test/optional.tex
new file mode 100644
index 00000000000..f7cc917000e
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/optional.tex
@@ -0,0 +1,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