summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/williams
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
Initial commit
Diffstat (limited to 'macros/latex/contrib/williams')
-rw-r--r--macros/latex/contrib/williams/README22
-rw-r--r--macros/latex/contrib/williams/antree.sty191
-rw-r--r--macros/latex/contrib/williams/toklist.sty44
3 files changed, 257 insertions, 0 deletions
diff --git a/macros/latex/contrib/williams/README b/macros/latex/contrib/williams/README
new file mode 100644
index 0000000000..0b29ac333c
--- /dev/null
+++ b/macros/latex/contrib/williams/README
@@ -0,0 +1,22 @@
+williams is 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.
+
+williams consists of the files antree.sty and toklist.sty.
+
+antree.sty is a package for the creation of annotated mode trees
+
+toklist.sty implements token list macros from pages 378-379 of "The TeXbook"
+by D.E. Knuth ISBN 0-201-13448-9
+
+README added by Clea F. Rees 2009/01/30 based on information in the files.
diff --git a/macros/latex/contrib/williams/antree.sty b/macros/latex/contrib/williams/antree.sty
new file mode 100644
index 0000000000..73544951e5
--- /dev/null
+++ b/macros/latex/contrib/williams/antree.sty
@@ -0,0 +1,191 @@
+% antree.sty -- annotated node trees
+% Copyright 1994 -- Peter Williams (pwil3058@bigpond.net.au)
+%
+% 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.
+%
+% Licence notice added and email updated on behalf of Peter Williams
+% by Clea F. Rees 2009/01/30.
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{antree}[1994/06/22]
+\RequirePackage{calc}
+\RequirePackage{ifthen}
+\RequirePackage{epic}
+\RequirePackage{eepic}
+\RequirePackage{toklist}
+
+\newlength{\ANhspace}
+\setlength{\ANhspace}{4pt}
+\newlength{\ANvspace}
+\setlength{\ANvspace}{30pt}
+\newlength{\ANesep}
+\setlength{\ANesep}{12pt}
+\newlength{\ANespace}
+\setlength{\ANespace}{1pt}
+\newlength{\AN@ehsp}
+\newlength{\AN@evsp}
+\newlength{\AN@a}
+\newlength{\AN@b}
+\newlength{\AN@c}
+\newlength{\AN@stw}
+\newlength{\AN@sth}
+\newsavebox{\leaf@content}
+\newsavebox{\link@content}
+\newsavebox{\link@label}
+\newsavebox{\node@content}
+\newboolean{AN@firstlink}
+
+\endlinechar=-1\relax
+
+{\catcode`\p=12 \catcode`\t=12
+\gdef\AN@rmd#1pt{#1}}
+
+\newenvironment{antree}[2][\null]{%
+\newcommand{\leaf}[2][\null]{%
+ \sbox{\leaf@content}{##2}
+ \settowidth{\AN@a}{\usebox{\leaf@content}}%
+ \settoheight{\AN@b}{\usebox{\leaf@content}}%
+ \settodepth{\AN@c}{\usebox{\leaf@content}}%
+ \addtolength{\AN@b}{\AN@c}%
+ \begin{picture}(\AN@Xpos,\AN@Ypos)%
+ \settodepth{\AN@c}{\usebox{\leaf@content}}%
+ \put(0,\AN@Zpos){\usebox{\leaf@content}}%
+ \put(\AN@Xpos,\AN@Ypos){##1}%
+ \end{picture}%}%}
+ \ignorespaces%
+}%
+%
+\newcommand{\link}[2][\null]{%
+ \TOKL@append##1\to\AN@indices%
+ \sbox{\link@content}{##2}
+ \settowidth{\AN@a}{\usebox{\link@content}}%
+ \addtolength{\AN@stw}{0.5\AN@a}%
+ \ifthenelse{\boolean{AN@firstlink}}%
+ {\setboolean{AN@firstlink}{false}}%
+ {\hspace*{\ANhspace}\addtolength{\AN@stw}{\ANhspace}}%
+ \TOKL@appendv\expandafter\AN@rmd\the\AN@stw\to\AN@xlist%
+ \addtolength{\AN@stw}{0.5\AN@a}%
+ \settoheight{\AN@b}{\usebox{\link@content}}
+ \settodepth{\AN@c}{\usebox{\link@content}}
+ \raisebox{0pt}{\vtop{\null\hbox{\usebox{\link@content}}}}
+ \ignorespaces%
+}%
+%
+\def\AN@Xpos{\expandafter\AN@rmd\the\AN@a}%
+\def\AN@Ypos{\expandafter\AN@rmd\the\AN@b}%
+\def\AN@Zpos{\expandafter\AN@rmd\the\AN@c}%
+%
+\newenvironment{node}[2][\null]{%
+ \leavevmode\hbox\bgroup%
+ \endlinechar=-1
+ \sbox{\node@content}{\leaf[##1]{##2}}
+ \def\AN@xlist{}%
+ \def\AN@indices{}%
+ \setlength{\unitlength}{\p@}%
+ \setlength{\AN@stw}{\z@}%
+ \setlength{\AN@sth}{\z@}%
+ \setboolean{AN@firstlink}{true}
+ \ignorespaces%
+}{\ignorespaces%
+ \setlength{\AN@sth}{\ANvspace}%
+ \settoheight{\AN@a}{\usebox{\node@content}}%
+ \addtolength{\AN@sth}{\AN@a}%
+ \settodepth{\AN@a}{\usebox{\node@content}}%
+ \addtolength{\AN@sth}{\AN@a}%
+ \hspace*{-\AN@stw}%
+ \setlength{\AN@a}{0.5\AN@stw}%
+ \edef\AN@nodex{\expandafter\AN@rmd\the\AN@a}%
+ \edef\AN@nodey{\expandafter\AN@rmd\the\ANvspace}%
+ \edef\AN@picx{\expandafter\AN@rmd\the\AN@stw}%
+ \edef\AN@picy{\expandafter\AN@rmd\the\AN@sth}%
+ \begin{picture}(\AN@picx,\AN@picy)%
+ \whiledo{\equal{\TOK@empty\AN@xlist}{false}}{%
+ \TOKL@lop\AN@xlist\to\AN@x
+ \TOKL@lop\AN@indices\to\AN@elabel
+ \settowidth{\AN@ehsp}{\AN@elabel}%
+ \setlength{\AN@ehsp}{0.5\AN@ehsp+\ANespace}%
+ \settoheight{\AN@evsp}{\AN@elabel}%
+ \setlength{\AN@evsp}{0.5\AN@evsp+\ANespace}%
+ \ifthenelse{\equal{\AN@elabel}{\null}}{%
+ \drawline(\AN@nodex,\AN@nodey)(\AN@x,0)%
+ }{%
+ \ifthenelse{\lengthtest{\ANesep<\AN@evsp}}{%
+ \setlength{\AN@b}{2\AN@evsp}%
+ \drawline(\AN@nodex,\AN@nodey)(\AN@x,\AN@Ypos)%
+ \put(\AN@x,\AN@evsp){\makebox(0,0){\AN@elabel}}%
+ }{%
+ \ifthenelse{\lengthtest{\AN@x\p@=\AN@nodex\p@}}{%
+ \setlength{\AN@b}{\ANesep-\AN@evsp}%
+ \drawline(\AN@x,\AN@Ypos)(\AN@x,0)%
+ \setlength{\AN@b}{\ANesep+\AN@evsp}%
+ \drawline(\AN@nodex,\AN@nodey)(\AN@x,\AN@Ypos)%
+ \setlength{\AN@a}{\AN@x\p@}%
+ }{%
+ \setlength{\AN@c}{100pt*\ratio{\AN@ehsp}{\AN@evsp}}%
+ \ifthenelse{\lengthtest{\AN@x\p@ > \AN@nodex\p@}}{%
+ \setlength{\AN@a}{100pt*\ratio{\AN@x\p@-\AN@nodex\p@}{\AN@nodey\p@}}%
+ \ifthenelse{\lengthtest{\AN@a < \AN@c}}{%
+ \setlength{\AN@b}{\ANesep-\AN@evsp}%
+ \setlength{\AN@a}{\AN@x\p@-\AN@b*\ratio{\AN@x\p@-\AN@nodex\p@}{\AN@nodey\p@}}%
+ \drawline(\AN@Xpos,\AN@Ypos)(\AN@x,0)%
+ \setlength{\AN@b}{\ANesep+\AN@evsp}%
+ \setlength{\AN@a}{\AN@x\p@-\AN@b*\ratio{\AN@x\p@-\AN@nodex\p@}{\AN@nodey\p@}}%
+ \drawline(\AN@Xpos,\AN@Ypos)(\AN@nodex,\AN@nodey)%
+ }{%
+ \setlength{\AN@a}{\ANesep*\ratio{\AN@x\p@-\AN@nodex\p@}{\AN@nodey\p@}-(\AN@ehsp)}%
+ \setlength{\AN@b}{\AN@a*\ratio{\AN@nodey\p@}{\AN@x\p@-\AN@nodex\p@}}%
+ \setlength{\AN@a}{\AN@x\p@-\AN@a}%
+ \drawline(\AN@Xpos,\AN@Ypos)(\AN@x,0)%
+ \setlength{\AN@a}{\ANesep*\ratio{\AN@x\p@-\AN@nodex\p@}{\AN@nodey\p@}+(\AN@ehsp)}%
+ \setlength{\AN@b}{\AN@a*\ratio{\AN@nodey\p@}{\AN@x\p@-\AN@nodex\p@}}%
+ \setlength{\AN@a}{\AN@x\p@-\AN@a}%
+ \drawline(\AN@Xpos,\AN@Ypos)(\AN@nodex,\AN@nodey)%
+ }%
+ \setlength{\AN@a}{\AN@x\p@-\ANesep*\ratio{\AN@x\p@-\AN@nodex\p@}{\AN@nodey\p@}}%
+ }{%
+ \setlength{\AN@a}{100pt*\ratio{\AN@nodex\p@-\AN@x\p@}{\AN@nodey\p@}}%
+ \ifthenelse{\lengthtest{\AN@a < \AN@c}}{%
+ \setlength{\AN@b}{\ANesep-\AN@evsp}%
+ \setlength{\AN@a}{\AN@x\p@+\AN@b*\ratio{\AN@nodex\p@-\AN@x\p@}{\AN@nodey\p@}}%
+ \drawline(\AN@Xpos,\AN@Ypos)(\AN@x,0)%
+ \setlength{\AN@b}{\ANesep+\AN@evsp}%
+ \setlength{\AN@a}{\AN@x\p@+\AN@b*\ratio{\AN@nodex\p@-\AN@x\p@}{\AN@nodey\p@}}%
+ \drawline(\AN@Xpos,\AN@Ypos)(\AN@nodex,\AN@nodey)%
+ }{%
+ \setlength{\AN@a}{\ANesep*\ratio{\AN@nodex\p@-\AN@x\p@}{\AN@nodey\p@}-(\AN@ehsp)}%
+ \setlength{\AN@b}{\AN@a*\ratio{\AN@nodey\p@}{\AN@nodex\p@-\AN@x\p@}}%
+ \setlength{\AN@a}{\AN@x\p@+\AN@a}%
+ \drawline(\AN@Xpos,\AN@Ypos)(\AN@x,0)%
+ \setlength{\AN@a}{\ANesep*\ratio{\AN@nodex\p@-\AN@x\p@}{\AN@nodey\p@}+(\AN@ehsp)}%
+ \setlength{\AN@b}{\AN@a*\ratio{\AN@nodey\p@}{\AN@nodex\p@-\AN@x\p@}}%
+ \setlength{\AN@a}{\AN@x\p@+\AN@a}%
+ \drawline(\AN@Xpos,\AN@Ypos)(\AN@nodex,\AN@nodey)%
+ }%
+ \setlength{\AN@a}{\AN@x\p@+\ANesep*\ratio{\AN@nodex\p@-\AN@x\p@}{\AN@nodey\p@}}%
+ }%
+ }%
+ \put(\AN@Xpos,\expandafter\AN@rmd\the\ANesep){\makebox(0,0){\AN@elabel}}%
+ }%
+ }%
+ }%
+ \put(\AN@nodex,\AN@nodey){\makebox(0,0)[bc]{\usebox{\node@content}}}%
+ \end{picture}%
+ \egroup%
+}
+\begin{tabular}[t]{c}\begin{node}[#1]{#2}}
+{\end{node}\end{tabular}}
+
+\endlinechar=13\relax
+
+\endinput
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}