## 1 Introduction

This package provides macros for command definition that save the name of the command being defined in a file or a macro container. For ease of reference, we refer to macros for command definition as'master macros,' and the macro that stores the defined commands as the 'container macro.' The file that stores the defined commands is the 'container file.' In this package there are two categories of master macros for command definition: one category has a syntax similar to that of TeX's \def while the other category has the syntax of LaTeX's \newcommand. Only one master macro is available in the first category. Naturally, commands defined by the master macro of the first category can have their parameters delimited in the usual way. When the user uses one of the master macros for command definition from the second category (i. e., one of those that have a syntax similar to that of \newcommand), some or all of the parameters of the defined command can be delimited, as desired by the command author. Normally, parameters of commands defined by LaTeX's \newcommand can't be delimited.

The package can also be used as a debugging tool, or at least as a command location tool: namely, to store the names of defined commands and the sources in which they are defined. This can be realized by using the showsource package option. However, this will track only the commands defined by the master macros of this package. It is safe to assign \newcommand and \renewcommand to \newavecmd and \renewavecmd, respectively. But, for rather obvious reasons, it is not advisable


the \param) and \default) are as in \newcommand. Both \defsavecmd and \renewsavecmd will overwrite an existing command, but \newsaveecmd will not do so.

The commands \defsaveecmd, \newsaveecmd and \renewsavecmd may be prefixed by \stglobal and/or \stcprotected to yield global or robust definitions, respectively. For example,

\defsaveecmd\cmdda#1#2{xxx#1#2}

\stcglobal\defsaveecmd\cmddb#1#2{xxx#1#2}

\stcglobal\newsaveecmd\cmd{2}(xxx#1#2}

\stcprotected\stcglobal\renewsavecmd*\cmd{2}[zz]{\def\y#1{##1xxx}}

### Delimited parameters

The parameters of \defsavecmd can readily be delimited as in the case of TeX's \def. The parameters of \newsaveecmd and \renewsavecmd can be delimited as follows:

\newsaveecmd(cmd)[(param)][(default)]({delimiters}){\defn}

\renewsavecmd(cmd)[(param)][(default)]({delimiters}){\defn}

The \delimiters), given here in parenthesis, have the syntax

\defsaveecmd\cmd{2}(1\#2{delim2}...9{delim9}

where \delim1) is the delimiter for the first parameter, etc. Only the parameters with delimiters are to be specified in \delimiters). For example,

\newsaveecmd\cmd{2}(1\#2{\#1}{xxx#1#2}

\newsaveecmd\cmd{bd}[9][yy](3\#nil4\#nil6\#nil){xxx#1#2#3...#9}

When the first argument is optional, then it can't have a delimiter, since the delimiter for that parameter is already '[]'.

## 5 Examples

The following example is available in the accompanying storecmd-example.tex file:

\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 container

% command is being refilled:% \def\mycommands{}
23\usepackage[
24storerenew=true,storecmd=mycommands,storefile=mycommands
25]{storecmd}
26\defsavecmdcmda#1#2{xxx#1#2}
27\stglobal\defsavecmdcmdb#1#2{xxx#1#2}
28\stglobal\newsavecmdcmdc[2](xxx#1#2)
29\stglobal\newsavecmdcmd[2][yy]{xxx#1#2}
30\stcorrected\stglobal\renewavesuccmd*\cmda[2][zz]{def}y#1{##1xxx}}
31\stcorrected\newavesuccmdcmd[2](1@nil2)@nil}{xxx#1#2}
32\newsavecmd\cmdf[9][yy](3\@nil9\@nil){xxx#1#2#3...#9}
33% Try \showmycommands or see file'mycommands.tex'.
34\begin{document}
35Blackberry lily.
36\end{document}

## 6 Version history

The star sign (*) on the right-hand side of the following lists means the subject features in the package but is not reflected anywhere in this user guide.

**Version 0.0.2 [2011/10/22]**

User guide completed.

**Version 0.0.1 [2011/10/17]**

First public release.

