summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/williams/toklist.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/williams/toklist.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/williams/toklist.sty')
-rw-r--r--macros/latex/contrib/williams/toklist.sty44
1 files changed, 44 insertions, 0 deletions
diff --git a/macros/latex/contrib/williams/toklist.sty b/macros/latex/contrib/williams/toklist.sty
new file mode 100644
index 0000000000..18da421939
--- /dev/null
+++ b/macros/latex/contrib/williams/toklist.sty
@@ -0,0 +1,44 @@
+%% Copyright 1994 Peter Williams
+%
+% 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.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Peter Williams.
+%
+% This work consists of the files antree.sty and toklist.sty.
+%
+%% Copyright notice and licence statement added on behalf of
+%% Peter Williams by Clea F. Rees 2009/01/30.
+%
+% Impliment token list macros from pages 378-379 of "The TeXbook" by D.E. Knuth
+% ISBN 0-201-13448-9
+
+\newtoks\TOKL@ta
+\newtoks\TOKL@tb
+\long\def\TOKL@prepend#1\to#2{\TOKL@ta={\\{#1}}\TOKL@tb=\expandafter{#2}%
+ \edef#2{\the\TOKL@ta\the\TOKL@tb}}
+\long\def\TOKL@prependv#1\to#2{\TOKL@ta={\\}\TOKL@tb=\expandafter{#2}%
+ \edef#2{\the\TOKL@ta{#1}\the\TOKL@tb}}
+\long\def\TOKL@append#1\to#2{\TOKL@ta={\\{#1}}\TOKL@tb=\expandafter{#2}%
+ \edef#2{\the\TOKL@tb\the\TOKL@ta}}
+\long\def\TOKL@appendv#1\to#2{\TOKL@ta={\\}\TOKL@tb=\expandafter{#2}%
+ \edef#2{\the\TOKL@tb\the\TOKL@ta{#1}}}
+\def\TOK@concat#1=#2&#3{\TOK@ta=\expandafter{#2}\TOK@tb=\expandafter{#3}%
+ \edef#1{\the\TOKL@ta\the\TOKL@tb}}
+
+\def\TOKL@lop#1\to#2{\expandafter\TOKL@lopoff#1\TOKL@lopoff#1#2}
+\long\def\TOKL@lopoff\\#1#2\TOKL@lopoff#3#4{\def#4{#1}\def#3{#2}}
+
+\def\TOK@card#1\to#2{#2=0 \long\def\\##1{\advance#2 by 1 }#1}
+
+\def\TOK@select#1\of#2\to#3{\def#3{\outofrange}%
+ \long\def\\##1{\advance#1-1 \ifnum#1=0 \def#3{##1}\fi}#2}
+
+\def\TOK@empty#1{\ifx#1\empty true\else false\fi}