summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/storecmd/storecmd-example.tex
blob: d7f0afc9688a8499f7f539d1d4211f05bc967caf (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
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}