summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/getitems/getitems.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/getitems/getitems.sty')
-rw-r--r--Master/texmf-dist/tex/latex/getitems/getitems.sty114
1 files changed, 114 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/getitems/getitems.sty b/Master/texmf-dist/tex/latex/getitems/getitems.sty
new file mode 100644
index 00000000000..ecec8062098
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/getitems/getitems.sty
@@ -0,0 +1,114 @@
+%%
+%% This is file `getitems.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% getitems.dtx (with options: `package')
+%%
+%% This is a generated file.
+%%
+%% Copyright (C) 2016 by Anders Hendrickson <anders.hendrickson@snc.edu>
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{getitems}
+ [2016/01/11 v1.0 gather items from a list]
+\RequirePackage{environ}
+\RequirePackage{trimspaces}
+\let\xa=\expandafter
+\def\gathereditem#1{\csname getitems@item@#1\endcsname}
+\newcounter{numgathereditems}
+\long\def\gatheritems#1{%
+ \setcounter{getitems@begindepth}{0}%
+ \setcounter{numgathereditems}{0}%
+ \xa\long\xa\gdef\csname getitems@item@0\endcsname{}%
+ \gatheritems@int\getitems@relax#1\item\getitems@terminalitem\getitems@endgatheritems
+ \xa\let\xa\gatheredheader\xa=\csname getitems@item@0\endcsname
+}
+\def\@getitems@terminalitem{\getitems@terminalitem}%
+\def\@dummy@relax{\getitems@relax}%
+\long\def\gatheritems@int#1\item#2\getitems@endgatheritems{%
+ \getitems@trackbegindepth{#1}%
+ \ifnum\c@getitems@begindepth=0\relax
+ \def\getitems@test@i{#1}%
+ \ifx\getitems@test@i\@dummy@relax
+ \relax
+ \else
+ \xa\xa\xa\g@addto@macro
+ \xa\xa\csname getitems@item@\the\c@numgathereditems\endcsname
+ \xa{\getitems@stripfirsttokenfrom#1\getitems@endstrip}%
+ \fi
+ \def\getitems@test@ii{#2}%
+ \ifx\getitems@test@ii\@getitems@terminalitem
+ \let\getitems@next=\relax
+ \else
+ \stepcounter{numgathereditems}%
+ \xa\gdef\csname getitems@item@\the\c@numgathereditems\endcsname{}%
+ \def\getitems@next{\gatheritems@int\getitems@relax#2\getitems@endgatheritems}%
+ \fi
+ \else
+ \xa\xa\xa\g@addto@macro
+ \xa\xa\csname getitems@item@\the\c@numgathereditems\endcsname
+ \xa{\getitems@stripfirsttokenfrom#1\getitems@endstrip}%
+ \xa\g@addto@macro\csname getitems@item@\the\c@numgathereditems\endcsname{\item}%
+ \def\getitems@next{\gatheritems@int\getitems@relax#2\getitems@endgatheritems}%
+ \fi
+ \getitems@next
+}
+\long\def\getitems@stripfirsttokenfrom#1#2\getitems@endstrip{#2}
+\newcounter{getitems@begindepth}
+\long\def\getitems@trackbegindepth#1{%
+ \getitems@trackbegindepth@int#1\getitems@terminalbegindepth\getitems@endtrackbegindepth
+}
+\def\@getitems@begin{\begin}%
+\def\@getitems@end{\end}%
+\def\@getitems@terminalbegindepth{\getitems@terminalbegindepth}%
+\long\def\getitems@trackbegindepth@int#1#2\getitems@endtrackbegindepth{%
+ \def\getitems@test@i{#1}%
+ \ifx\getitems@test@i\@getitems@begin
+ \advance\c@getitems@begindepth by 1\relax
+ \else
+ \ifx\getitems@test@i\@getitems@end
+ \advance\c@getitems@begindepth by -1\relax
+ \fi
+ \fi
+ \def\getitems@test@ii{#2}%
+ \trim@spaces@in\getitems@test@ii
+ \ifx\getitems@test@ii\@getitems@terminalbegindepth
+ \let\getitems@trackbegindepth@next=\relax
+ \else
+ \def\getitems@trackbegindepth@next{%
+ \getitems@trackbegindepth@int#2\getitems@endtrackbegindepth}%
+ \fi
+ \getitems@trackbegindepth@next
+}
+\newif\ifgatherbeginningofloop
+\newcounter{currentitemnumber}
+\def\loopthroughitemswithcommand#1{%
+ \setcounter{currentitemnumber}{1}%
+ \gatherbeginningoflooptrue
+ \loopthroughitemswithcommand@int{#1}%
+}
+
+\def\loopthroughitemswithcommand@int#1{%
+ \ifnum\c@currentitemnumber>\c@numgathereditems\relax
+ \let\getitems@loop@next=\relax%
+ \else
+ \xa\xa\xa#1\xa\xa\xa{\csname getitems@item@\the\c@currentitemnumber\endcsname}%
+ \def\getitems@loop@next{\loopthroughitemswithcommand@int{#1}}%
+ \stepcounter{currentitemnumber}%
+ \fi
+ \gatherbeginningofloopfalse
+ \getitems@loop@next
+}
+\endinput
+%%
+%% End of file `getitems.sty'.