diff options
author | Karl Berry <karl@freefriends.org> | 2016-06-12 16:14:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-06-12 16:14:46 +0000 |
commit | d5e9bf23cf171fa8b3dd00240390287e15c26b80 (patch) | |
tree | 511eeef9ee1a2496bfb0e2533d025b2cbac799f3 /Master/texmf-dist/tex/latex | |
parent | 417c2c0a5d5d82e53235d9aa529a30c06acee3cb (diff) |
getargs (21may16)
git-svn-id: svn://tug.org/texlive/trunk@41415 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/getargs/getargs.sty | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/getargs/getargs.sty b/Master/texmf-dist/tex/latex/getargs/getargs.sty new file mode 100644 index 00000000000..be28d6257b2 --- /dev/null +++ b/Master/texmf-dist/tex/latex/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 |