diff options
author | Karl Berry <karl@freefriends.org> | 2011-10-19 22:27:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-10-19 22:27:52 +0000 |
commit | 19492a456e1fc5b19603e0d9b96cf10fb5195b52 (patch) | |
tree | 831b4f16fc9b665151505e846658e47d536d68cc /Master/texmf-dist/doc/latex | |
parent | 35f1ce3dcdb68333a18ffee104162b49936c4c26 (diff) |
storecmd (19oct11)
git-svn-id: svn://tug.org/texlive/trunk@24331 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex')
-rw-r--r-- | Master/texmf-dist/doc/latex/storecmd/README | 39 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/storecmd/storecmd-example.tex | 6 |
2 files changed, 40 insertions, 5 deletions
diff --git a/Master/texmf-dist/doc/latex/storecmd/README b/Master/texmf-dist/doc/latex/storecmd/README index e380405f9d8..d872f0bdb3f 100644 --- a/Master/texmf-dist/doc/latex/storecmd/README +++ b/Master/texmf-dist/doc/latex/storecmd/README @@ -8,9 +8,13 @@ SUMMARY This package provides macros for command definition that save the name of the command being defined in a file or a macro container. +While using 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. + It was written in response to a post on comp.text.tex for a macro that will define commands and also save the commands being defined -in a file or a container macro for spelling exceptions. Three +in a file or a container macro, eg, for spelling exceptions. Three macros are provided for this purpose: \defsavecmd<cmd><param>{<defn>} @@ -25,9 +29,36 @@ both \newsavecmd and \renewsavecmd will not do so. The commands \defsavecmd, \newsavecmd and \renewsavecmd may be prefixed by \globalcmd and/or \protectedcmd to yield global or robust -definitions, respectively. +definitions, respectively. For example, + +\defsavecmd\cmda#1#2{xxx#1#2} +\globalcmd\defsavecmd\cmdb#1#2{xxx#1#2} +\globalcmd\newsavecmd\cmdc[2]{xxx#1#2} +\protectedcmd\globalcmd\renewsavecmd*\cmda[2][zz]{\def\y##1{##1xxx}} + +The parameters of \defsavecmd can readily be delimited as in the case +of \def. The parameters of \newsavecmd and \renewsavecmd can be +delimited as follows: + +\newsavecmd<cmd><param>(<delimiters>){<defn>} +\renewsavecmd<cmd><param>(<delimiters>){<defn>} + +The <delimiters>, given in parenthesis, have the syntax: + +1<\delim1> 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, + +\protectedcmd\newsavecmd\cmda[2](1\@nil 2\@mil){xxx#1#2} +\newsavecmd\cmdb[9][yy](3\@nil 9\@mil){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 '[]'. + -The package options are: +The package options are neversave - Never save/store the new commands in the container file or command. The new commands will still be defined. @@ -73,6 +104,8 @@ EXAMPLE FILE \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}} +\newsavecmd\cmde[2](1\@nil 2\@mil){xxx#1#2} +\newsavecmd\cmdf[9][yy](2\@nil 3\@mil){xxx#1#2#3...#9} % Try \show\mycommands or see file 'mycommands.tex'. diff --git a/Master/texmf-dist/doc/latex/storecmd/storecmd-example.tex b/Master/texmf-dist/doc/latex/storecmd/storecmd-example.tex index c1325c8d9f6..d7f0afc9688 100644 --- a/Master/texmf-dist/doc/latex/storecmd/storecmd-example.tex +++ b/Master/texmf-dist/doc/latex/storecmd/storecmd-example.tex @@ -11,14 +11,16 @@ % \def\mycommands{} \usepackage[ - storerenew=false,storecmd=mycommands,storefile=mycommands + 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*\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'. |