diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /obsolete/macros/latex/contrib/getargs/getargs.sty |
Initial commit
Diffstat (limited to 'obsolete/macros/latex/contrib/getargs/getargs.sty')
-rw-r--r-- | obsolete/macros/latex/contrib/getargs/getargs.sty | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/obsolete/macros/latex/contrib/getargs/getargs.sty b/obsolete/macros/latex/contrib/getargs/getargs.sty new file mode 100644 index 0000000000..be28d6257b --- /dev/null +++ b/obsolete/macros/latex/contrib/getargs/getargs.sty @@ -0,0 +1,56 @@ +\def\getargsversionnumber{v1.01} +\ProvidesPackage{getargs} +[2016/05/20 \getargsversionnumber\ + Macro to parse an argument list, using user-specified parsing character] +% CREATED BY Steven B. Segletes <steven.b.segletes.civ@mail.mil> +% THIS PACKAGE IS RELEASED IN ACCORDANCE WITH THE LaTeX PUBLIC PROJECT LICENSE +% LPPL v1.3c (http://ctan.org/license/lppl1.3) OR ITS SUCCESSORS + +% V1.00-Initial release +\newcounter{getarg@ctr} +\let\getargs\relax +\newcommand\getargs{} + +\newcommand\setparsechar[1]{% + \def\getargparsechar{#1}% + \renewcommand{\getargs}[1]{% + \setcounter{getarg@ctr}{0}% + \parse@args##1#1\relax\relax% + }% + \def\parse@args##1#1##2\relax{% + \stepcounter{getarg@ctr}% + \expandafter\gdef\csname\getarg@root\romannumeral\value{getarg@ctr}\endcsname{##1}% + \ifx\relax##2\relax% + \expandafter\xdef\csname n\getarg@root\endcsname{\thegetarg@ctr}\else% + \parse@args##2\relax\fi% + }% +} + +\newcommand\setparserootname[1][arg]{\def\getarg@root{#1}} + +\let\showargs\relax +\newcommand\showargs[1][t]{% + \fboxrule=.7pt\relax\fboxsep=\dimexpr-.5pt-\fboxrule\relax% + \csname n\getarg@root\endcsname{} \textbackslash\getarg@root\ldots{} items % + \if x#1(expanded)\else (tokens)\fi% + : \showargs@help{#1}{1}{\csname n\getarg@root\endcsname}\unskip\fbox{\strut}.% +} + +\newcommand\showargs@help[3]{% + \setcounter{getarg@ctr}{#2}% + \if x#1% + \fbox{\strut}\csname\getarg@root\romannumeral\value{getarg@ctr}\endcsname% + \hskip0pt\relax% + \else + \fbox{\strut}% + \expandafter\detokenize\expandafter\expandafter\expandafter{% + \csname\getarg@root\romannumeral\value{getarg@ctr}\endcsname}\hskip0pt\relax% + \fi + \ifnum\value{getarg@ctr}<#3\relax\stepcounter{getarg@ctr}% + \showargs@help{#1}{\thegetarg@ctr}{#3}% + \fi% +} + +\setparserootname +\setparsechar{,} +\endinput |