summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/storecmd/storecmd-example.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/storecmd/storecmd-example.tex')
-rw-r--r--macros/latex/contrib/storecmd/storecmd-example.tex31
1 files changed, 31 insertions, 0 deletions
diff --git a/macros/latex/contrib/storecmd/storecmd-example.tex b/macros/latex/contrib/storecmd/storecmd-example.tex
new file mode 100644
index 0000000000..d7f0afc968
--- /dev/null
+++ b/macros/latex/contrib/storecmd/storecmd-example.tex
@@ -0,0 +1,31 @@
+\documentclass{article}
+% Container commands are also accepted as package options,
+% but in this case 'catoptions' must be loaded before
+% \usepackage{storecmd}.
+% Eg,
+% \usepackage{catoptions}
+% \usepackage[storecmd=\mycommands]{storecmd}
+%
+% Uncomment the next line to test what happens when
+% an existing command is being refilled:
+% \def\mycommands{}
+
+\usepackage[
+ storerenew=false,storecmd=mycommands,storefile=mycommands,
+]{storecmd}
+
+\defsavecmd\cmda#1#2{xxx#1#2}
+\globalcmd\defsavecmd\cmdb#1#2{xxx#1#2}
+\globalcmd\newsavecmd*\cmdc[2]{xxx#1#2}
+\globalcmd\newsavecmd\cmdd[2][yy]{xxx#1#2}
+\protectedcmd\globalcmd\renewsavecmd*\cmda[2][zz]{\def\y##1{##1xxx}}
+\protectedcmd\newsavecmd\cmde[2](1\@nil 2\@mil){xxx#1#2}
+\newsavecmd\cmdf[9][yy](3\@nil 9\@mil){xxx#1#2#3...#9}
+
+% Try \show\mycommands or see file 'mycommands.tex'.
+
+\begin{document}
+
+Blackberry lily.
+
+\end{document}