summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--context/data/type-buy.dat5
-rw-r--r--scripts/context/ruby/base/tex.rb11
-rw-r--r--scripts/context/ruby/texexec.rb5
-rw-r--r--tex/context/base/cont-new.tex4
-rw-r--r--tex/context/base/context.tex3
-rw-r--r--tex/context/base/core-mis.tex6
-rw-r--r--tex/context/base/core-rul.tex23
-rw-r--r--tex/context/base/lang-mis.tex2
-rw-r--r--tex/context/base/m-pictex.tex84
-rw-r--r--tex/context/base/m-units.tex10
-rw-r--r--tex/context/base/math-tex.tex73
-rw-r--r--tex/context/base/regi-iso-8859-1.tex157
-rw-r--r--tex/context/base/regi-iso-8859-15.tex157
-rw-r--r--tex/context/base/regi-iso-8859-2.tex155
-rw-r--r--tex/context/base/regi-iso-8859-7.tex155
-rw-r--r--tex/context/base/regi-syn.tex46
-rw-r--r--tex/context/base/syst-cat.tex48
-rw-r--r--tex/context/base/thrd-pic.tex3694
-rw-r--r--tex/context/base/thrd-tab.tex16
-rw-r--r--tex/context/base/type-buy.tex30
-rw-r--r--tex/context/base/unic-exp.tex2
-rw-r--r--tex/context/base/unic-ini.tex29
-rw-r--r--tex/context/base/xtag-ext.tex14
-rw-r--r--tex/context/base/xtag-ini.tex14
24 files changed, 4010 insertions, 733 deletions
diff --git a/context/data/type-buy.dat b/context/data/type-buy.dat
index 76d4d69ab..a65d2e806 100644
--- a/context/data/type-buy.dat
+++ b/context/data/type-buy.dat
@@ -89,6 +89,11 @@
--en=? --ve=linotype --co=univers --re
--en=? --ve=linotype --co=univers --so=linotype/univers --ma --in
+# linotype linoletter
+
+--en=? --ve=linotype --co=linoletter --re
+--en=? --ve=linotype --co=linoletter --so=linotype/linoletter --ma --in
+
# adobe utopia
#
# --en=? --ve=adobe --co=utopia --re
diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb
index 25e7ba5d7..ddf1706dc 100644
--- a/scripts/context/ruby/base/tex.rb
+++ b/scripts/context/ruby/base/tex.rb
@@ -595,6 +595,17 @@ class TEX
report('updating file database')
Kpse.update
end
+ if getvariable('luatex') then
+ begin
+ luatools = `texmfstart luatools --format=texmfscripts luatools.lua`.chomp.strip
+ unless luatools.empty? then
+ runcommand(["luatex","--luaonly=#{luatools}","--generate","--verbose"])
+ end
+ rescue
+ report("run 'luatex --luaonly=....../luatools.lua --generate' manually")
+ exit
+ end
+ end
# goody
if getvariable('texformats') == 'standard' then
setvariable('texformats',[getvariable('interface')]) unless getvariable('interface').empty?
diff --git a/scripts/context/ruby/texexec.rb b/scripts/context/ruby/texexec.rb
index ea4c48d93..389a7a6ed 100644
--- a/scripts/context/ruby/texexec.rb
+++ b/scripts/context/ruby/texexec.rb
@@ -441,8 +441,9 @@ job.setvariable('result',result)
report("copying file: #{filename}")
f << "\\getfiguredimensions\n"
f << " [#{filename}]\n"
- f << " [page=1"
- f << ",\n size=trimbox" if trim
+ f << " [scale=#{scale},\n"
+ f << " page=1,\n"
+ f << " size=trimbox\n" if trim
f << "]\n"
f << "\\definepapersize\n"
f << " [copy]\n"
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 2b2110fe0..cea0a2a9f 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -13,7 +13,7 @@
% it's about time to clean up this file ...
-\newcontextversion{2006.11.29 09:55}
+\newcontextversion{2006.12.07 16:27}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
@@ -26,6 +26,8 @@
% \font\f=dummyfont \rpcode\f0=500 \hbox{..}\char0
% todo: mp-new
% caption: grid=top|bottom in xml defs
+
+\let\then\relax % \ifnum1>2\then -)
\def\dividedsize#1#2#3% size gap n
{\dimexpr
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index dd6a50af8..732f3e15a 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -42,7 +42,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2006.11.29 09:55}
+\edef\contextversion{2006.12.07 16:27}
%D For those who want to use this:
@@ -182,6 +182,7 @@
\loadmkivfile{char-ini.tex}
\loadmkivfile{char-def.tex}
+\loadmkivfile{char-utf.tex}
%D We also use some third party macros. These are loaded by
%D saying:
diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex
index e47c69be1..2547e9afa 100644
--- a/tex/context/base/core-mis.tex
+++ b/tex/context/base/core-mis.tex
@@ -1166,11 +1166,13 @@
#2%
\fi
\ifhmode % else funny pagebeaks
- \penalty\!!tenthousand\hskip\zeropoint % == \prewordbreak
+ \penalty\!!tenthousand
+ \hskip\zeropoint % == \prewordbreak
\fi
\strut % new, needed below
\delimitedtextparameter#1% unhbox\scratchbox
- \penalty\!!tenthousand\hskip\delimitedtextsignal % +- \prewordbreak
+ % \penalty\!!tenthousand % else overfull boxes
+ \hskip\delimitedtextsignal % +- \prewordbreak
\fi
\endgroup}
diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex
index 1ac7edc28..696f3f01c 100644
--- a/tex/context/base/core-rul.tex
+++ b/tex/context/base/core-rul.tex
@@ -2983,16 +2983,17 @@
\begingroup
\setupfillinrules[#1]%
\noindent
- \doifelse\@@ilwidth\v!fit
- {\let\@@ildistance\!!zeropoint
- \hbox}
- {\doifelse\@@ilwidth\v!broad
- {\hbox}
- {\hbox to \@@ilwidth}}
- \bgroup
- \doattributes\??il\c!style\c!color{\strut#2\hfill\@@ilseparator}%
- \hskip\@@ildistance
- \egroup
+ \doifsomething{#2}
+ {\doifelse\@@ilwidth\v!fit
+ {\let\@@ildistance\!!zeropoint
+ \hbox}
+ {\doifelse\@@ilwidth\v!broad
+ {\hbox}
+ {\hbox to \@@ilwidth}}%
+ \bgroup
+ \doattributes\??il\c!style\c!color{\strut#2\hfill\@@ilseparator}%
+ \hskip\@@ildistance
+ \egroup}%
%\hangindent=\wd0\relax % tzt hang=yes,n
%\parindent=\hangindent
%\box0\relax
@@ -3062,7 +3063,7 @@
\parfillskip\zeropoint
\def\par % very dangerous
{\let\par\endgraf % -)
- \unskip\hfill
+ \ifhmode\unskip\hfill\fi
\scratchdimen\dimexpr\@@ivwidth-\@@ivdistance\relax
\ifdim\scratchdimen>\@@ivmargin\else\expandafter\rlap\fi
{\kern\@@ivdistance
diff --git a/tex/context/base/lang-mis.tex b/tex/context/base/lang-mis.tex
index 5feb6c542..de926b417 100644
--- a/tex/context/base/lang-mis.tex
+++ b/tex/context/base/lang-mis.tex
@@ -224,7 +224,7 @@
\setvalue {\@tmd@text@\detokenize{#1}}{#2}%
\setvalue {\@tmd@both@\detokenize{#1}}{\discretionarycommand#1}%
\scratchcounter\expandafter`\detokenize{#1}%
- \@EA\letcatcodecommand\@EA\ctxcatcodes\@EA\scratchcounter\csname\@tmd@both@\detokenize{#1}\endcsname}
+ \@EA\uedcatcodecommand\@EA\ctxcatcodes\@EA\scratchcounter\csname\@tmd@both@\detokenize{#1}\endcsname}
\def\handlemathmodediscretionary#1{\executeifdefined{\@tmd@math@\detokenize{#1}}\donothing}
\def\handletextmodediscretionary#1{\executeifdefined{\@tmd@text@\detokenize{#1}}\donothing}
diff --git a/tex/context/base/m-pictex.tex b/tex/context/base/m-pictex.tex
index 98c5ddbcd..90bb7b339 100644
--- a/tex/context/base/m-pictex.tex
+++ b/tex/context/base/m-pictex.tex
@@ -8,45 +8,45 @@
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
%D This module is one big hack. This hack is not needed when
-%D using \ETEX, so there we simply load \PICTEX\ and quit.
+%D using \ETEX, so there we simply load \PICTEX\ and quit.
%D Not every package defines \type{\fiverm}, \PICTEX's pixel,
-%D so let's take care of that omision here. The actual loading
-%D of \PICTEX\ depends on the package. For \LATEX\ users we
+%D so let's take care of that omision here. The actual loading
+%D of \PICTEX\ depends on the package. For \LATEX\ users we
%D take care of loading the auxiliary ones too.
-\def\loadpictex%
- {\ifx\grid\undefined \else \let\normalgrid\grid \fi
- \ifx\axis\undefined \else \let\normalaxis\axis \fi
+\def\loadpictex
+ {\ifx\grid\undefined \else \let\normalgrid\grid \fi
+ \ifx\axis\undefined \else \let\normalaxis\axis \fi
\ifx\undefined\fiverm
\font\fiverm=cmr5
\fi
\ifx\beginpicture\undefined
\ifx\newenvironment\undefined
- \input pictex.tex \relax
+ \readfile{thrd-pic.tex}{}{}
\else
\input prepictex.tex \relax
\input pictex.tex \relax
\input postpictex.tex \relax
\fi
\fi
- \ifx\normalgrid\undefined \else
- \let\pictexgrid\grid
+ \ifx\normalgrid\undefined \else
+ \let\pictexgrid\grid
\let\grid\normalgrid
- \fi
- \ifx\normalaxis\undefined \else
- \let\pictexaxis\axis
+ \fi
+ \ifx\normalaxis\undefined \else
+ \let\pictexaxis\axis
\let\axis\normalaxis
- \fi}
+ \fi}
+
+\ifx\eTeXversion\undefined \else \loadpictex \expandafter \endinput \fi
-\ifx\eTeXversion\undefined \else \loadpictex \expandafter \endinput \fi
-
-%D When not in \ETEX\ and not in \CONTEXT, we load a few
-%D auxiliary macros.
+%D When not in \ETEX\ and not in \CONTEXT, we load a few
+%D auxiliary macros.
\ifx \undefined \writestatus \input supp-mis.tex \relax \fi
@@ -58,10 +58,10 @@
%D allocated. Packages that use \PICTEX\ can therefore run out
%D of \DIMENSIONS\ quite fast. This module was written as a
%D reaction to persistent problems with loading \PPCHTEX\ in
-%D \LATEX\ and \PICTEX\ deserves a solution. I therefore
-%D dedicate this module to Tobias Burnus and Dirk Kuypers, who
+%D \LATEX\ and \PICTEX\ deserves a solution. I therefore
+%D dedicate this module to Tobias Burnus and Dirk Kuypers, who
%D use \PPCHTEX\ in a \LATEX\ environment and suggested a lot
-%D of extensions to the repertoire of \PPCHTEX\ commands.
+%D of extensions to the repertoire of \PPCHTEX\ commands.
%D
%D This module presents a solution that is quite effective: all
%D \DIMENSIONS\ are drawn from the pool of \DIMENSIONS\ and
@@ -76,9 +76,9 @@
%D
%D In such cases the \DIMENSION\ equals the fixed part of the
%D \SKIP\ or in other words: this assignment strips off the
-%D glue. Because \PICTEX\ uses no glue components, I thought
-%D I could interchange both register types without problems,
-%D but alas, this didn't hold for all \DIMENSIONS.
+%D glue. Because \PICTEX\ uses no glue components, I thought
+%D I could interchange both register types without problems,
+%D but alas, this didn't hold for all \DIMENSIONS.
%D In \PLAIN\ \TEX\ the allocation macros are defined with (as)
%D \type{\outer}. This means that they cannot appear inside
@@ -100,8 +100,8 @@
%D and 17 \SKIPS. After loading \PICTEX, 71 \DIMENSIONS\ and
%D and 71 \SKIPS\ are allocated. Indeed, \PICTEX\ needs 110
%D \DIMENSIONS !
-%D
-%D \starttyping
+%D
+%D \starttyping
%D \def\newdimen
%D {\ifnum\count11>\count12
%D \let\next\temporarynewskip
@@ -110,7 +110,7 @@
%D \fi
%D \next}
%D \stoptyping
-%D
+%D
%D When I was testing a new version of \PPCHTEX\ in \PLAIN\
%D \TEX\ I had to find out that this exchange of registers
%D sometimes leads to unwanted results. It took me some hours
@@ -134,7 +134,7 @@
%D \starttyping
%D \ifdim\DimenOne<\DimenTwo\relax right \else wrong \fi
%D \stoptyping
-%D
+%D
%D Some close reading of the \PICTEX\ source however learned me
%D that this problem could be solved best by just honoring the
%D allocation of \DIMENSIONS\ when the name of the macro
@@ -143,7 +143,7 @@
%D \DIMENSIONS\ with this sequence in their names with
%D \type{\dimen}. Again I was too optimistic, so now we do it
%D this way (the comments are from \PICTEX, which like \TABLE,
-%D is an example of a well documented package):
+%D is an example of a well documented package):
\temporarynewdimen\!dimenA %.AW.X.DVEUL..OYQRST
\temporarynewdimen\!dimenB %....X.DVEU...O.QRS.
@@ -162,10 +162,10 @@
\temporarynewdimen\!ypos %..........L.P..Q.ST
\temporarynewdimen\!zpt %.AWBX.DVEULGP.YQ.ST
-%D Tobias tested this module in all kind of \LATEX\ dialects
-%D so we were able to find out that we also needed to declare:
+%D Tobias tested this module in all kind of \LATEX\ dialects
+%D so we were able to find out that we also needed to declare:
-\temporarynewdimen\linethickness
+\temporarynewdimen\linethickness
%D After all, the new definition of \type{\newdimen} became:
@@ -198,12 +198,12 @@
% \fi\fi}%
% \expandafter\next\string##2##1@@\next}%
% \expandafter\next\expandafter{\string\dimen}#1}
-%
+%
% This macro is as unreadable, inefficient and as compact as
-% can be, but uses no extra hash entries, which sometimes are
-% scarce too. A more readable alternative, that also takes
-% explicit \SKIPS\ into account, is included in the source.
-%
+% can be, but uses no extra hash entries, which sometimes are
+% scarce too. A more readable alternative, that also takes
+% explicit \SKIPS\ into account, is included in the source.
+%
% \def\doifregisterpreferenceelse#1#2#3#4%
% {\def\dodoifregisterpreferenceelse##1#1##2##3\war{\if##2@}%
% \expandafter\dodoifregisterpreferenceelse\string#2#1@@\war
@@ -211,7 +211,7 @@
% \else
% #3%
% \fi}
-%
+%
% \def\newdimen#1%
% {\bgroup
% \escapechar=-1
@@ -230,14 +230,14 @@
%D Curious readers can still find the previous solution in
%D the source. The next macro is used instead of
-%D \type{\input}. This macro also reports some statistics.
+%D \type{\input}. This macro also reports some statistics.
\def\dimeninput#1 %
{\message{[before: d=\the\count11,s=\the\count12]}%
\input #1 \relax
\message{[after: d=\the\count11,s=\the\count12]}}%
-%D Now we can load \PICTEX:
+%D Now we can load \PICTEX:
\loadpictex
@@ -247,6 +247,6 @@
\let\newdimen=\normalnewdimen
\let\newskip =\normalnewskip
-%D and just hope for the best.
+%D and just hope for the best.
\protect \endinput
diff --git a/tex/context/base/m-units.tex b/tex/context/base/m-units.tex
index 50b1a4899..f268bdd6e 100644
--- a/tex/context/base/m-units.tex
+++ b/tex/context/base/m-units.tex
@@ -45,7 +45,7 @@
\stopmessages
\startmessages italian library: units
- title: unità
+ title: unita
1: usare \string\Degrees\space\string\Celsius\space invece di \string\Celsius !
\stopmessages
@@ -60,8 +60,8 @@
\stopmessages
\startmessages french library: units
- title: unités
- 1: utilisez \string\Degrees\space\string\Celsius\space à la place de \string\Celsius !
+ title: unitas
+ 1: utilisez \string\Degrees\space\string\Celsius\space A la place de \string\Celsius !
\stopmessages
\unprotect
@@ -823,6 +823,4 @@
% \def\Micro{\dimensionprefix{\iftextdimensions\mathematics\mu \else\mu \fi}}
% \def\Times{\dimensionnopfix{\iftextdimensions\mathematics\cdot\else\cdot\fi}}
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/math-tex.tex b/tex/context/base/math-tex.tex
index fc3cd7ae6..6cd834ab4 100644
--- a/tex/context/base/math-tex.tex
+++ b/tex/context/base/math-tex.tex
@@ -551,4 +551,77 @@
\definemathpunctuation . mathperiod textperiod
\definemathpunctuation , mathcomma textcomma
+%D The following colon related definitions are provided by Aditya
+%D Mahajan who derived them from \type {mathtools.sty} and \type
+%D {colonequals.sty}.
+
+%D \macros
+%D {centercolon, colonminus, minuscolon, colonequals, equalscolon,
+%D colonapprox, approxcolon, colonsim, simcolon, coloncolon,
+%D coloncolonminus, minuscoloncolon, coloncolonequals,
+%D equalscoloncolon, coloncolonapprox, approxcoloncolon,
+%D colonsim, simcoloncolon}
+%D
+%D In $a := b$ the colon is not vertically centered with the equal
+%D to. Also the distance between colon and equal to is a bit large.
+%D So, we define a vertically centered colon \tex {centercolon} and
+%D a few macros for colon and double colon relation symbols.
+%D
+%D \startlines
+%D \formula {A \centercolon B}
+%D \formula {A \colonminus B}
+%D \formula {A \minuscolon B}
+%D \formula {A \colonequals B}
+%D \formula {A \equalscolon B}
+%D \formula {A \colonapprox B}
+%D \formula {A \approxcolon B}
+%D \formula {A \colonsim B}
+%D \formula {A \simcolon B}
+%D \formula {A \coloncolon B}
+%D \formula {A \coloncolonminus B}
+%D \formula {A \minuscoloncolon B}
+%D \formula {A \coloncolonequals B}
+%D \formula {A \equalscoloncolon B}
+%D \formula {A \coloncolonapprox B}
+%D \formula {A \approxcoloncolon B}
+%D \formula {A \colonsim B}
+%D \formula {A \simcoloncolon B}
+%D \stoplines
+
+%D The next macros take care of the space between the colon and the
+%D relation symbol.
+
+\definemathcommand [colonsep] {\mkern-1.2mu}
+\definemathcommand [doublecolonsep] {\mkern-0.9mu}
+
+%D The next macro vertically centeres its contents.
+
+\def\@center@math#1%
+ {\vcenter{\hbox{$\m@th#1$}}}
+
+\def\@center@colon
+ {\mathpalette\@center@math{\colon}}
+
+%D Now we define all the colon relations.
+
+\definemathcommand [centercolon] [rel] {\@center@colon}
+\definemathcommand [colonminus] [rel] {\centercolon\colonsep\mathrel{-}}
+\definemathcommand [minuscolon] [rel] {\mathrel{-}\colonsep\centercolon}
+\definemathcommand [colonequals] [rel] {\centercolon\colonsep=}
+\definemathcommand [equalscolon] [rel] {=\centercolon\colonsep}
+\definemathcommand [colonapprox] [rel] {\centercolon\colonsep\approx}
+\definemathcommand [approxcolon] [rel] {\approx\centercolon\colonsep}
+\definemathcommand [colonsim] [rel] {\centercolon\colonsep\sim}
+\definemathcommand [simcolon] [rel] {\sim\centercolon\colonsep}
+
+\definemathcommand [coloncolon] [rel] {\centercolon\doublecolonsep\centercolon}
+\definemathcommand [coloncolonminus] [rel] {\coloncolon\colonsep\mathrel{-}}
+\definemathcommand [minuscoloncolon] [rel] {\mathrel{-}\colonsep\coloncolon}
+\definemathcommand [coloncolonequals] [rel] {\coloncolon\colonsep=}
+\definemathcommand [equalscoloncolon] [rel] {=\coloncolon\colonsep}
+\definemathcommand [coloncolonapprox] [rel] {\coloncolon\colonsep\approx}
+\definemathcommand [approxcoloncolon] [rel] {\approx\coloncolon\colonsep}
+\definemathcommand [colonsim] [rel] {\coloncolon\colonsep\sim}
+\definemathcommand [simcoloncolon] [rel] {\sim\coloncolon\colonsep}
+
\protect \endinput
diff --git a/tex/context/base/regi-iso-8859-1.tex b/tex/context/base/regi-iso-8859-1.tex
deleted file mode 100644
index 27481686b..000000000
--- a/tex/context/base/regi-iso-8859-1.tex
+++ /dev/null
@@ -1,157 +0,0 @@
-%D \module
-%D [ file=regi-iso-8859-1,
-%D version=2006.04.10,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=iso-8859-1 (West European),
-%D author=script-generated,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D Support for iso-8859-1/Latin1 input encoding (regime) for West European languages,
-%D see also cp1252 and iso-8859-15 (includes Euro).
-%D
-%D (Contributors to the original file: Daniel Flipo, Hans Hagen & Denis Roegel.)
-%D
-%D Usage:
-%D \type{\enableregime[iso-8859-1]} or
-%D \type{\enableregime[latin1]} or
-%D \type{\enableregime[il1]}
-
-
-\startregime[iso-8859-1]
-
-\defineactivetoken 128 {\unknownchar} % 0080 <control>
-\defineactivetoken 129 {\unknownchar} % 0081 <control>
-\defineactivetoken 130 {\unknownchar} % 0082 <control>
-\defineactivetoken 131 {\unknownchar} % 0083 <control>
-\defineactivetoken 132 {\unknownchar} % 0084 <control>
-\defineactivetoken 133 {\unknownchar} % 0085 <control>
-\defineactivetoken 134 {\unknownchar} % 0086 <control>
-\defineactivetoken 135 {\unknownchar} % 0087 <control>
-\defineactivetoken 136 {\unknownchar} % 0088 <control>
-\defineactivetoken 137 {\unknownchar} % 0089 <control>
-\defineactivetoken 138 {\unknownchar} % 008A <control>
-\defineactivetoken 139 {\unknownchar} % 008B <control>
-\defineactivetoken 140 {\unknownchar} % 008C <control>
-\defineactivetoken 141 {\unknownchar} % 008D <control>
-\defineactivetoken 142 {\unknownchar} % 008E <control>
-\defineactivetoken 143 {\unknownchar} % 008F <control>
-\defineactivetoken 144 {\unknownchar} % 0090 <control>
-\defineactivetoken 145 {\unknownchar} % 0091 <control>
-\defineactivetoken 146 {\unknownchar} % 0092 <control>
-\defineactivetoken 147 {\unknownchar} % 0093 <control>
-\defineactivetoken 148 {\unknownchar} % 0094 <control>
-\defineactivetoken 149 {\unknownchar} % 0095 <control>
-\defineactivetoken 150 {\unknownchar} % 0096 <control>
-\defineactivetoken 151 {\unknownchar} % 0097 <control>
-\defineactivetoken 152 {\unknownchar} % 0098 <control>
-\defineactivetoken 153 {\unknownchar} % 0099 <control>
-\defineactivetoken 154 {\unknownchar} % 009A <control>
-\defineactivetoken 155 {\unknownchar} % 009B <control>
-\defineactivetoken 156 {\unknownchar} % 009C <control>
-\defineactivetoken 157 {\unknownchar} % 009D <control>
-\defineactivetoken 158 {\unknownchar} % 009E <control>
-\defineactivetoken 159 {\unknownchar} % 009F <control>
-\defineactivetoken 160 {\nonbreakablespace} % 00A0 NO-BREAK SPACE
-\defineactivetoken 161 {\exclamdown} % 00A1 INVERTED EXCLAMATION MARK
-\defineactivetoken 162 {\textcent} % 00A2 CENT SIGN
-\defineactivetoken 163 {\textsterling} % 00A3 POUND SIGN
-\defineactivetoken 164 {\textcurrency} % 00A4 CURRENCY SIGN
-\defineactivetoken 165 {\textyen} % 00A5 YEN SIGN
-\defineactivetoken 166 {\textbrokenbar} % 00A6 BROKEN BAR
-\defineactivetoken 167 {\sectionmark} % 00A7 SECTION SIGN
-\defineactivetoken 168 {\textdiaeresis} % 00A8 DIAERESIS
-\defineactivetoken 169 {\copyright} % 00A9 COPYRIGHT SIGN
-\defineactivetoken 170 {\ordfeminine} % 00AA FEMININE ORDINAL INDICATOR
-\defineactivetoken 171 {\leftguillemot} % 00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
-\defineactivetoken 172 {\textlognot} % 00AC NOT SIGN
-\defineactivetoken 173 {\softhyphen} % 00AD SOFT HYPHEN
-\defineactivetoken 174 {\registered} % 00AE REGISTERED SIGN
-\defineactivetoken 175 {\textmacron} % 00AF MACRON
-\defineactivetoken 176 {\textdegree} % 00B0 DEGREE SIGN
-\defineactivetoken 177 {\textpm} % 00B1 PLUS-MINUS SIGN
-\defineactivetoken 178 {\twosuperior} % 00B2 SUPERSCRIPT TWO
-\defineactivetoken 179 {\threesuperior} % 00B3 SUPERSCRIPT THREE
-\defineactivetoken 180 {\textacute} % 00B4 ACUTE ACCENT
-\defineactivetoken 181 {\textmu} % 00B5 MICRO SIGN
-\defineactivetoken 182 {\paragraphmark} % 00B6 PILCROW SIGN
-\defineactivetoken 183 {\periodcentered} % 00B7 MIDDLE DOT
-\defineactivetoken 184 {\textcedilla} % 00B8 CEDILLA
-\defineactivetoken 185 {\onesuperior} % 00B9 SUPERSCRIPT ONE
-\defineactivetoken 186 {\ordmasculine} % 00BA MASCULINE ORDINAL INDICATOR
-\defineactivetoken 187 {\rightguillemot} % 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
-\defineactivetoken 188 {\onequarter} % 00BC VULGAR FRACTION ONE QUARTER
-\defineactivetoken 189 {\onehalf} % 00BD VULGAR FRACTION ONE HALF
-\defineactivetoken 190 {\threequarter} % 00BE VULGAR FRACTION THREE QUARTERS
-\defineactivetoken 191 {\questiondown} % 00BF INVERTED QUESTION MARK
-\defineactivetoken 192 {\Agrave} % 00C0 LATIN CAPITAL LETTER A WITH GRAVE
-\defineactivetoken 193 {\Aacute} % 00C1 LATIN CAPITAL LETTER A WITH ACUTE
-\defineactivetoken 194 {\Acircumflex} % 00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
-\defineactivetoken 195 {\Atilde} % 00C3 LATIN CAPITAL LETTER A WITH TILDE
-\defineactivetoken 196 {\Adiaeresis} % 00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
-\defineactivetoken 197 {\Aring} % 00C5 LATIN CAPITAL LETTER A WITH RING ABOVE
-\defineactivetoken 198 {\AEligature} % 00C6 LATIN CAPITAL LETTER AE
-\defineactivetoken 199 {\Ccedilla} % 00C7 LATIN CAPITAL LETTER C WITH CEDILLA
-\defineactivetoken 200 {\Egrave} % 00C8 LATIN CAPITAL LETTER E WITH GRAVE
-\defineactivetoken 201 {\Eacute} % 00C9 LATIN CAPITAL LETTER E WITH ACUTE
-\defineactivetoken 202 {\Ecircumflex} % 00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX
-\defineactivetoken 203 {\Ediaeresis} % 00CB LATIN CAPITAL LETTER E WITH DIAERESIS
-\defineactivetoken 204 {\Igrave} % 00CC LATIN CAPITAL LETTER I WITH GRAVE
-\defineactivetoken 205 {\Iacute} % 00CD LATIN CAPITAL LETTER I WITH ACUTE
-\defineactivetoken 206 {\Icircumflex} % 00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX
-\defineactivetoken 207 {\Idiaeresis} % 00CF LATIN CAPITAL LETTER I WITH DIAERESIS
-\defineactivetoken 208 {\Eth} % 00D0 LATIN CAPITAL LETTER ETH
-\defineactivetoken 209 {\Ntilde} % 00D1 LATIN CAPITAL LETTER N WITH TILDE
-\defineactivetoken 210 {\Ograve} % 00D2 LATIN CAPITAL LETTER O WITH GRAVE
-\defineactivetoken 211 {\Oacute} % 00D3 LATIN CAPITAL LETTER O WITH ACUTE
-\defineactivetoken 212 {\Ocircumflex} % 00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
-\defineactivetoken 213 {\Otilde} % 00D5 LATIN CAPITAL LETTER O WITH TILDE
-\defineactivetoken 214 {\Odiaeresis} % 00D6 LATIN CAPITAL LETTER O WITH DIAERESIS
-\defineactivetoken 215 {\textmultiply} % 00D7 MULTIPLICATION SIGN
-\defineactivetoken 216 {\Ostroke} % 00D8 LATIN CAPITAL LETTER O WITH STROKE
-\defineactivetoken 217 {\Ugrave} % 00D9 LATIN CAPITAL LETTER U WITH GRAVE
-\defineactivetoken 218 {\Uacute} % 00DA LATIN CAPITAL LETTER U WITH ACUTE
-\defineactivetoken 219 {\Ucircumflex} % 00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX
-\defineactivetoken 220 {\Udiaeresis} % 00DC LATIN CAPITAL LETTER U WITH DIAERESIS
-\defineactivetoken 221 {\Yacute} % 00DD LATIN CAPITAL LETTER Y WITH ACUTE
-\defineactivetoken 222 {\Thorn} % 00DE LATIN CAPITAL LETTER THORN
-\defineactivetoken 223 {\ssharp} % 00DF LATIN SMALL LETTER SHARP S
-\defineactivetoken 224 {\agrave} % 00E0 LATIN SMALL LETTER A WITH GRAVE
-\defineactivetoken 225 {\aacute} % 00E1 LATIN SMALL LETTER A WITH ACUTE
-\defineactivetoken 226 {\acircumflex} % 00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX
-\defineactivetoken 227 {\atilde} % 00E3 LATIN SMALL LETTER A WITH TILDE
-\defineactivetoken 228 {\adiaeresis} % 00E4 LATIN SMALL LETTER A WITH DIAERESIS
-\defineactivetoken 229 {\aring} % 00E5 LATIN SMALL LETTER A WITH RING ABOVE
-\defineactivetoken 230 {\aeligature} % 00E6 LATIN SMALL LETTER AE
-\defineactivetoken 231 {\ccedilla} % 00E7 LATIN SMALL LETTER C WITH CEDILLA
-\defineactivetoken 232 {\egrave} % 00E8 LATIN SMALL LETTER E WITH GRAVE
-\defineactivetoken 233 {\eacute} % 00E9 LATIN SMALL LETTER E WITH ACUTE
-\defineactivetoken 234 {\ecircumflex} % 00EA LATIN SMALL LETTER E WITH CIRCUMFLEX
-\defineactivetoken 235 {\ediaeresis} % 00EB LATIN SMALL LETTER E WITH DIAERESIS
-\defineactivetoken 236 {\igrave} % 00EC LATIN SMALL LETTER I WITH GRAVE
-\defineactivetoken 237 {\iacute} % 00ED LATIN SMALL LETTER I WITH ACUTE
-\defineactivetoken 238 {\icircumflex} % 00EE LATIN SMALL LETTER I WITH CIRCUMFLEX
-\defineactivetoken 239 {\idiaeresis} % 00EF LATIN SMALL LETTER I WITH DIAERESIS
-\defineactivetoken 240 {\eth} % 00F0 LATIN SMALL LETTER ETH
-\defineactivetoken 241 {\ntilde} % 00F1 LATIN SMALL LETTER N WITH TILDE
-\defineactivetoken 242 {\ograve} % 00F2 LATIN SMALL LETTER O WITH GRAVE
-\defineactivetoken 243 {\oacute} % 00F3 LATIN SMALL LETTER O WITH ACUTE
-\defineactivetoken 244 {\ocircumflex} % 00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX
-\defineactivetoken 245 {\otilde} % 00F5 LATIN SMALL LETTER O WITH TILDE
-\defineactivetoken 246 {\odiaeresis} % 00F6 LATIN SMALL LETTER O WITH DIAERESIS
-\defineactivetoken 247 {\textdiv} % 00F7 DIVISION SIGN
-\defineactivetoken 248 {\ostroke} % 00F8 LATIN SMALL LETTER O WITH STROKE
-\defineactivetoken 249 {\ugrave} % 00F9 LATIN SMALL LETTER U WITH GRAVE
-\defineactivetoken 250 {\uacute} % 00FA LATIN SMALL LETTER U WITH ACUTE
-\defineactivetoken 251 {\ucircumflex} % 00FB LATIN SMALL LETTER U WITH CIRCUMFLEX
-\defineactivetoken 252 {\udiaeresis} % 00FC LATIN SMALL LETTER U WITH DIAERESIS
-\defineactivetoken 253 {\yacute} % 00FD LATIN SMALL LETTER Y WITH ACUTE
-\defineactivetoken 254 {\thorn} % 00FE LATIN SMALL LETTER THORN
-\defineactivetoken 255 {\ydiaeresis} % 00FF LATIN SMALL LETTER Y WITH DIAERESIS
-
-\stopregime
-
diff --git a/tex/context/base/regi-iso-8859-15.tex b/tex/context/base/regi-iso-8859-15.tex
deleted file mode 100644
index ad0c320da..000000000
--- a/tex/context/base/regi-iso-8859-15.tex
+++ /dev/null
@@ -1,157 +0,0 @@
-%D \module
-%D [ file=regi-iso-8859-15,
-%D version=2006.04.10,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=iso-8859-15 (West European),
-%D author=script-generated,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D Support for iso-8859-15/Latin9 input encoding (regime) for West European languages,
-%D almost the same as iso-8859-1 with rarely used symbols (currency symbol,
-%D fractions, accents) replaced by Euro and some additional letters,
-%D see also cp1252.
-%D
-%D Usage:
-%D \type{\enableregime[iso-8859-15]} or
-%D \type{\enableregime[latin9]} or
-%D \type{\enableregime[il9]}
-
-
-\startregime[iso-8859-15]
-
-\defineactivetoken 128 {\unknownchar} % 0080 <control>
-\defineactivetoken 129 {\unknownchar} % 0081 <control>
-\defineactivetoken 130 {\unknownchar} % 0082 <control>
-\defineactivetoken 131 {\unknownchar} % 0083 <control>
-\defineactivetoken 132 {\unknownchar} % 0084 <control>
-\defineactivetoken 133 {\unknownchar} % 0085 <control>
-\defineactivetoken 134 {\unknownchar} % 0086 <control>
-\defineactivetoken 135 {\unknownchar} % 0087 <control>
-\defineactivetoken 136 {\unknownchar} % 0088 <control>
-\defineactivetoken 137 {\unknownchar} % 0089 <control>
-\defineactivetoken 138 {\unknownchar} % 008A <control>
-\defineactivetoken 139 {\unknownchar} % 008B <control>
-\defineactivetoken 140 {\unknownchar} % 008C <control>
-\defineactivetoken 141 {\unknownchar} % 008D <control>
-\defineactivetoken 142 {\unknownchar} % 008E <control>
-\defineactivetoken 143 {\unknownchar} % 008F <control>
-\defineactivetoken 144 {\unknownchar} % 0090 <control>
-\defineactivetoken 145 {\unknownchar} % 0091 <control>
-\defineactivetoken 146 {\unknownchar} % 0092 <control>
-\defineactivetoken 147 {\unknownchar} % 0093 <control>
-\defineactivetoken 148 {\unknownchar} % 0094 <control>
-\defineactivetoken 149 {\unknownchar} % 0095 <control>
-\defineactivetoken 150 {\unknownchar} % 0096 <control>
-\defineactivetoken 151 {\unknownchar} % 0097 <control>
-\defineactivetoken 152 {\unknownchar} % 0098 <control>
-\defineactivetoken 153 {\unknownchar} % 0099 <control>
-\defineactivetoken 154 {\unknownchar} % 009A <control>
-\defineactivetoken 155 {\unknownchar} % 009B <control>
-\defineactivetoken 156 {\unknownchar} % 009C <control>
-\defineactivetoken 157 {\unknownchar} % 009D <control>
-\defineactivetoken 158 {\unknownchar} % 009E <control>
-\defineactivetoken 159 {\unknownchar} % 009F <control>
-\defineactivetoken 160 {\nonbreakablespace} % 00A0 NO-BREAK SPACE
-\defineactivetoken 161 {\exclamdown} % 00A1 INVERTED EXCLAMATION MARK
-\defineactivetoken 162 {\textcent} % 00A2 CENT SIGN
-\defineactivetoken 163 {\textsterling} % 00A3 POUND SIGN
-\defineactivetoken 164 {\texteuro} % 20AC EURO SIGN
-\defineactivetoken 165 {\textyen} % 00A5 YEN SIGN
-\defineactivetoken 166 {\Scaron} % 0160 LATIN CAPITAL LETTER S WITH CARON
-\defineactivetoken 167 {\sectionmark} % 00A7 SECTION SIGN
-\defineactivetoken 168 {\scaron} % 0161 LATIN SMALL LETTER S WITH CARON
-\defineactivetoken 169 {\copyright} % 00A9 COPYRIGHT SIGN
-\defineactivetoken 170 {\ordfeminine} % 00AA FEMININE ORDINAL INDICATOR
-\defineactivetoken 171 {\leftguillemot} % 00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
-\defineactivetoken 172 {\textlognot} % 00AC NOT SIGN
-\defineactivetoken 173 {\softhyphen} % 00AD SOFT HYPHEN
-\defineactivetoken 174 {\registered} % 00AE REGISTERED SIGN
-\defineactivetoken 175 {\textmacron} % 00AF MACRON
-\defineactivetoken 176 {\textdegree} % 00B0 DEGREE SIGN
-\defineactivetoken 177 {\textpm} % 00B1 PLUS-MINUS SIGN
-\defineactivetoken 178 {\twosuperior} % 00B2 SUPERSCRIPT TWO
-\defineactivetoken 179 {\threesuperior} % 00B3 SUPERSCRIPT THREE
-\defineactivetoken 180 {\Zcaron} % 017D LATIN CAPITAL LETTER Z WITH CARON
-\defineactivetoken 181 {\textmu} % 00B5 MICRO SIGN
-\defineactivetoken 182 {\paragraphmark} % 00B6 PILCROW SIGN
-\defineactivetoken 183 {\periodcentered} % 00B7 MIDDLE DOT
-\defineactivetoken 184 {\zcaron} % 017E LATIN SMALL LETTER Z WITH CARON
-\defineactivetoken 185 {\onesuperior} % 00B9 SUPERSCRIPT ONE
-\defineactivetoken 186 {\ordmasculine} % 00BA MASCULINE ORDINAL INDICATOR
-\defineactivetoken 187 {\rightguillemot} % 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
-\defineactivetoken 188 {\OEligature} % 0152 LATIN CAPITAL LIGATURE OE
-\defineactivetoken 189 {\oeligature} % 0153 LATIN SMALL LIGATURE OE
-\defineactivetoken 190 {\Ydiaeresis} % 0178 LATIN CAPITAL LETTER Y WITH DIAERESIS
-\defineactivetoken 191 {\questiondown} % 00BF INVERTED QUESTION MARK
-\defineactivetoken 192 {\Agrave} % 00C0 LATIN CAPITAL LETTER A WITH GRAVE
-\defineactivetoken 193 {\Aacute} % 00C1 LATIN CAPITAL LETTER A WITH ACUTE
-\defineactivetoken 194 {\Acircumflex} % 00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
-\defineactivetoken 195 {\Atilde} % 00C3 LATIN CAPITAL LETTER A WITH TILDE
-\defineactivetoken 196 {\Adiaeresis} % 00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
-\defineactivetoken 197 {\Aring} % 00C5 LATIN CAPITAL LETTER A WITH RING ABOVE
-\defineactivetoken 198 {\AEligature} % 00C6 LATIN CAPITAL LETTER AE
-\defineactivetoken 199 {\Ccedilla} % 00C7 LATIN CAPITAL LETTER C WITH CEDILLA
-\defineactivetoken 200 {\Egrave} % 00C8 LATIN CAPITAL LETTER E WITH GRAVE
-\defineactivetoken 201 {\Eacute} % 00C9 LATIN CAPITAL LETTER E WITH ACUTE
-\defineactivetoken 202 {\Ecircumflex} % 00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX
-\defineactivetoken 203 {\Ediaeresis} % 00CB LATIN CAPITAL LETTER E WITH DIAERESIS
-\defineactivetoken 204 {\Igrave} % 00CC LATIN CAPITAL LETTER I WITH GRAVE
-\defineactivetoken 205 {\Iacute} % 00CD LATIN CAPITAL LETTER I WITH ACUTE
-\defineactivetoken 206 {\Icircumflex} % 00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX
-\defineactivetoken 207 {\Idiaeresis} % 00CF LATIN CAPITAL LETTER I WITH DIAERESIS
-\defineactivetoken 208 {\Eth} % 00D0 LATIN CAPITAL LETTER ETH
-\defineactivetoken 209 {\Ntilde} % 00D1 LATIN CAPITAL LETTER N WITH TILDE
-\defineactivetoken 210 {\Ograve} % 00D2 LATIN CAPITAL LETTER O WITH GRAVE
-\defineactivetoken 211 {\Oacute} % 00D3 LATIN CAPITAL LETTER O WITH ACUTE
-\defineactivetoken 212 {\Ocircumflex} % 00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
-\defineactivetoken 213 {\Otilde} % 00D5 LATIN CAPITAL LETTER O WITH TILDE
-\defineactivetoken 214 {\Odiaeresis} % 00D6 LATIN CAPITAL LETTER O WITH DIAERESIS
-\defineactivetoken 215 {\textmultiply} % 00D7 MULTIPLICATION SIGN
-\defineactivetoken 216 {\Ostroke} % 00D8 LATIN CAPITAL LETTER O WITH STROKE
-\defineactivetoken 217 {\Ugrave} % 00D9 LATIN CAPITAL LETTER U WITH GRAVE
-\defineactivetoken 218 {\Uacute} % 00DA LATIN CAPITAL LETTER U WITH ACUTE
-\defineactivetoken 219 {\Ucircumflex} % 00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX
-\defineactivetoken 220 {\Udiaeresis} % 00DC LATIN CAPITAL LETTER U WITH DIAERESIS
-\defineactivetoken 221 {\Yacute} % 00DD LATIN CAPITAL LETTER Y WITH ACUTE
-\defineactivetoken 222 {\Thorn} % 00DE LATIN CAPITAL LETTER THORN
-\defineactivetoken 223 {\ssharp} % 00DF LATIN SMALL LETTER SHARP S
-\defineactivetoken 224 {\agrave} % 00E0 LATIN SMALL LETTER A WITH GRAVE
-\defineactivetoken 225 {\aacute} % 00E1 LATIN SMALL LETTER A WITH ACUTE
-\defineactivetoken 226 {\acircumflex} % 00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX
-\defineactivetoken 227 {\atilde} % 00E3 LATIN SMALL LETTER A WITH TILDE
-\defineactivetoken 228 {\adiaeresis} % 00E4 LATIN SMALL LETTER A WITH DIAERESIS
-\defineactivetoken 229 {\aring} % 00E5 LATIN SMALL LETTER A WITH RING ABOVE
-\defineactivetoken 230 {\aeligature} % 00E6 LATIN SMALL LETTER AE
-\defineactivetoken 231 {\ccedilla} % 00E7 LATIN SMALL LETTER C WITH CEDILLA
-\defineactivetoken 232 {\egrave} % 00E8 LATIN SMALL LETTER E WITH GRAVE
-\defineactivetoken 233 {\eacute} % 00E9 LATIN SMALL LETTER E WITH ACUTE
-\defineactivetoken 234 {\ecircumflex} % 00EA LATIN SMALL LETTER E WITH CIRCUMFLEX
-\defineactivetoken 235 {\ediaeresis} % 00EB LATIN SMALL LETTER E WITH DIAERESIS
-\defineactivetoken 236 {\igrave} % 00EC LATIN SMALL LETTER I WITH GRAVE
-\defineactivetoken 237 {\iacute} % 00ED LATIN SMALL LETTER I WITH ACUTE
-\defineactivetoken 238 {\icircumflex} % 00EE LATIN SMALL LETTER I WITH CIRCUMFLEX
-\defineactivetoken 239 {\idiaeresis} % 00EF LATIN SMALL LETTER I WITH DIAERESIS
-\defineactivetoken 240 {\eth} % 00F0 LATIN SMALL LETTER ETH
-\defineactivetoken 241 {\ntilde} % 00F1 LATIN SMALL LETTER N WITH TILDE
-\defineactivetoken 242 {\ograve} % 00F2 LATIN SMALL LETTER O WITH GRAVE
-\defineactivetoken 243 {\oacute} % 00F3 LATIN SMALL LETTER O WITH ACUTE
-\defineactivetoken 244 {\ocircumflex} % 00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX
-\defineactivetoken 245 {\otilde} % 00F5 LATIN SMALL LETTER O WITH TILDE
-\defineactivetoken 246 {\odiaeresis} % 00F6 LATIN SMALL LETTER O WITH DIAERESIS
-\defineactivetoken 247 {\textdiv} % 00F7 DIVISION SIGN
-\defineactivetoken 248 {\ostroke} % 00F8 LATIN SMALL LETTER O WITH STROKE
-\defineactivetoken 249 {\ugrave} % 00F9 LATIN SMALL LETTER U WITH GRAVE
-\defineactivetoken 250 {\uacute} % 00FA LATIN SMALL LETTER U WITH ACUTE
-\defineactivetoken 251 {\ucircumflex} % 00FB LATIN SMALL LETTER U WITH CIRCUMFLEX
-\defineactivetoken 252 {\udiaeresis} % 00FC LATIN SMALL LETTER U WITH DIAERESIS
-\defineactivetoken 253 {\yacute} % 00FD LATIN SMALL LETTER Y WITH ACUTE
-\defineactivetoken 254 {\thorn} % 00FE LATIN SMALL LETTER THORN
-\defineactivetoken 255 {\ydiaeresis} % 00FF LATIN SMALL LETTER Y WITH DIAERESIS
-
-\stopregime
-
diff --git a/tex/context/base/regi-iso-8859-2.tex b/tex/context/base/regi-iso-8859-2.tex
deleted file mode 100644
index cc14c4ec3..000000000
--- a/tex/context/base/regi-iso-8859-2.tex
+++ /dev/null
@@ -1,155 +0,0 @@
-%D \module
-%D [ file=regi-iso-8859-2,
-%D version=2006.04.10,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=iso-8859-2 (East European),
-%D author=script-generated,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D Support for iso-8859-2/Latin2 input encoding (regime) for Central European languages,
-%D see also cp1250.
-%D
-%D Usage:
-%D \type{\enableregime[iso-8859-2]} or
-%D \type{\enableregime[latin2]} or
-%D \type{\enableregime[il2]}
-
-
-\startregime[iso-8859-2]
-
-\defineactivetoken 128 {\unknownchar} % 0080 <control>
-\defineactivetoken 129 {\unknownchar} % 0081 <control>
-\defineactivetoken 130 {\unknownchar} % 0082 <control>
-\defineactivetoken 131 {\unknownchar} % 0083 <control>
-\defineactivetoken 132 {\unknownchar} % 0084 <control>
-\defineactivetoken 133 {\unknownchar} % 0085 <control>
-\defineactivetoken 134 {\unknownchar} % 0086 <control>
-\defineactivetoken 135 {\unknownchar} % 0087 <control>
-\defineactivetoken 136 {\unknownchar} % 0088 <control>
-\defineactivetoken 137 {\unknownchar} % 0089 <control>
-\defineactivetoken 138 {\unknownchar} % 008A <control>
-\defineactivetoken 139 {\unknownchar} % 008B <control>
-\defineactivetoken 140 {\unknownchar} % 008C <control>
-\defineactivetoken 141 {\unknownchar} % 008D <control>
-\defineactivetoken 142 {\unknownchar} % 008E <control>
-\defineactivetoken 143 {\unknownchar} % 008F <control>
-\defineactivetoken 144 {\unknownchar} % 0090 <control>
-\defineactivetoken 145 {\unknownchar} % 0091 <control>
-\defineactivetoken 146 {\unknownchar} % 0092 <control>
-\defineactivetoken 147 {\unknownchar} % 0093 <control>
-\defineactivetoken 148 {\unknownchar} % 0094 <control>
-\defineactivetoken 149 {\unknownchar} % 0095 <control>
-\defineactivetoken 150 {\unknownchar} % 0096 <control>
-\defineactivetoken 151 {\unknownchar} % 0097 <control>
-\defineactivetoken 152 {\unknownchar} % 0098 <control>
-\defineactivetoken 153 {\unknownchar} % 0099 <control>
-\defineactivetoken 154 {\unknownchar} % 009A <control>
-\defineactivetoken 155 {\unknownchar} % 009B <control>
-\defineactivetoken 156 {\unknownchar} % 009C <control>
-\defineactivetoken 157 {\unknownchar} % 009D <control>
-\defineactivetoken 158 {\unknownchar} % 009E <control>
-\defineactivetoken 159 {\unknownchar} % 009F <control>
-\defineactivetoken 160 {\nonbreakablespace} % 00A0 NO-BREAK SPACE
-\defineactivetoken 161 {\Aogonek} % 0104 LATIN CAPITAL LETTER A WITH OGONEK
-\defineactivetoken 162 {\textbreve} % 02D8 BREVE
-\defineactivetoken 163 {\Lstroke} % 0141 LATIN CAPITAL LETTER L WITH STROKE
-\defineactivetoken 164 {\textcurrency} % 00A4 CURRENCY SIGN
-\defineactivetoken 165 {\Lcaron} % 013D LATIN CAPITAL LETTER L WITH CARON
-\defineactivetoken 166 {\Sacute} % 015A LATIN CAPITAL LETTER S WITH ACUTE
-\defineactivetoken 167 {\sectionmark} % 00A7 SECTION SIGN
-\defineactivetoken 168 {\textdiaeresis} % 00A8 DIAERESIS
-\defineactivetoken 169 {\Scaron} % 0160 LATIN CAPITAL LETTER S WITH CARON
-\defineactivetoken 170 {\Scedilla} % 015E LATIN CAPITAL LETTER S WITH CEDILLA
-\defineactivetoken 171 {\Tcaron} % 0164 LATIN CAPITAL LETTER T WITH CARON
-\defineactivetoken 172 {\Zacute} % 0179 LATIN CAPITAL LETTER Z WITH ACUTE
-\defineactivetoken 173 {\softhyphen} % 00AD SOFT HYPHEN
-\defineactivetoken 174 {\Zcaron} % 017D LATIN CAPITAL LETTER Z WITH CARON
-\defineactivetoken 175 {\Zdotaccent} % 017B LATIN CAPITAL LETTER Z WITH DOT ABOVE
-\defineactivetoken 176 {\textdegree} % 00B0 DEGREE SIGN
-\defineactivetoken 177 {\aogonek} % 0105 LATIN SMALL LETTER A WITH OGONEK
-\defineactivetoken 178 {\textogonek} % 02DB OGONEK
-\defineactivetoken 179 {\lstroke} % 0142 LATIN SMALL LETTER L WITH STROKE
-\defineactivetoken 180 {\textacute} % 00B4 ACUTE ACCENT
-\defineactivetoken 181 {\lcaron} % 013E LATIN SMALL LETTER L WITH CARON
-\defineactivetoken 182 {\sacute} % 015B LATIN SMALL LETTER S WITH ACUTE
-\defineactivetoken 183 {\textcaron} % 02C7 CARON
-\defineactivetoken 184 {\textcedilla} % 00B8 CEDILLA
-\defineactivetoken 185 {\scaron} % 0161 LATIN SMALL LETTER S WITH CARON
-\defineactivetoken 186 {\scedilla} % 015F LATIN SMALL LETTER S WITH CEDILLA
-\defineactivetoken 187 {\tcaron} % 0165 LATIN SMALL LETTER T WITH CARON
-\defineactivetoken 188 {\zacute} % 017A LATIN SMALL LETTER Z WITH ACUTE
-\defineactivetoken 189 {\texthungarumlaut} % 02DD DOUBLE ACUTE ACCENT
-\defineactivetoken 190 {\zcaron} % 017E LATIN SMALL LETTER Z WITH CARON
-\defineactivetoken 191 {\zdotaccent} % 017C LATIN SMALL LETTER Z WITH DOT ABOVE
-\defineactivetoken 192 {\Racute} % 0154 LATIN CAPITAL LETTER R WITH ACUTE
-\defineactivetoken 193 {\Aacute} % 00C1 LATIN CAPITAL LETTER A WITH ACUTE
-\defineactivetoken 194 {\Acircumflex} % 00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
-\defineactivetoken 195 {\Abreve} % 0102 LATIN CAPITAL LETTER A WITH BREVE
-\defineactivetoken 196 {\Adiaeresis} % 00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
-\defineactivetoken 197 {\Lacute} % 0139 LATIN CAPITAL LETTER L WITH ACUTE
-\defineactivetoken 198 {\Cacute} % 0106 LATIN CAPITAL LETTER C WITH ACUTE
-\defineactivetoken 199 {\Ccedilla} % 00C7 LATIN CAPITAL LETTER C WITH CEDILLA
-\defineactivetoken 200 {\Ccaron} % 010C LATIN CAPITAL LETTER C WITH CARON
-\defineactivetoken 201 {\Eacute} % 00C9 LATIN CAPITAL LETTER E WITH ACUTE
-\defineactivetoken 202 {\Eogonek} % 0118 LATIN CAPITAL LETTER E WITH OGONEK
-\defineactivetoken 203 {\Ediaeresis} % 00CB LATIN CAPITAL LETTER E WITH DIAERESIS
-\defineactivetoken 204 {\Ecaron} % 011A LATIN CAPITAL LETTER E WITH CARON
-\defineactivetoken 205 {\Iacute} % 00CD LATIN CAPITAL LETTER I WITH ACUTE
-\defineactivetoken 206 {\Icircumflex} % 00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX
-\defineactivetoken 207 {\Dcaron} % 010E LATIN CAPITAL LETTER D WITH CARON
-\defineactivetoken 208 {\Dstroke} % 0110 LATIN CAPITAL LETTER D WITH STROKE
-\defineactivetoken 209 {\Nacute} % 0143 LATIN CAPITAL LETTER N WITH ACUTE
-\defineactivetoken 210 {\Ncaron} % 0147 LATIN CAPITAL LETTER N WITH CARON
-\defineactivetoken 211 {\Oacute} % 00D3 LATIN CAPITAL LETTER O WITH ACUTE
-\defineactivetoken 212 {\Ocircumflex} % 00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
-\defineactivetoken 213 {\Ohungarumlaut} % 0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
-\defineactivetoken 214 {\Odiaeresis} % 00D6 LATIN CAPITAL LETTER O WITH DIAERESIS
-\defineactivetoken 215 {\textmultiply} % 00D7 MULTIPLICATION SIGN
-\defineactivetoken 216 {\Rcaron} % 0158 LATIN CAPITAL LETTER R WITH CARON
-\defineactivetoken 217 {\Uring} % 016E LATIN CAPITAL LETTER U WITH RING ABOVE
-\defineactivetoken 218 {\Uacute} % 00DA LATIN CAPITAL LETTER U WITH ACUTE
-\defineactivetoken 219 {\Uhungarumlaut} % 0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
-\defineactivetoken 220 {\Udiaeresis} % 00DC LATIN CAPITAL LETTER U WITH DIAERESIS
-\defineactivetoken 221 {\Yacute} % 00DD LATIN CAPITAL LETTER Y WITH ACUTE
-\defineactivetoken 222 {\Tcedilla} % 0162 LATIN CAPITAL LETTER T WITH CEDILLA
-\defineactivetoken 223 {\ssharp} % 00DF LATIN SMALL LETTER SHARP S
-\defineactivetoken 224 {\racute} % 0155 LATIN SMALL LETTER R WITH ACUTE
-\defineactivetoken 225 {\aacute} % 00E1 LATIN SMALL LETTER A WITH ACUTE
-\defineactivetoken 226 {\acircumflex} % 00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX
-\defineactivetoken 227 {\abreve} % 0103 LATIN SMALL LETTER A WITH BREVE
-\defineactivetoken 228 {\adiaeresis} % 00E4 LATIN SMALL LETTER A WITH DIAERESIS
-\defineactivetoken 229 {\lacute} % 013A LATIN SMALL LETTER L WITH ACUTE
-\defineactivetoken 230 {\cacute} % 0107 LATIN SMALL LETTER C WITH ACUTE
-\defineactivetoken 231 {\ccedilla} % 00E7 LATIN SMALL LETTER C WITH CEDILLA
-\defineactivetoken 232 {\ccaron} % 010D LATIN SMALL LETTER C WITH CARON
-\defineactivetoken 233 {\eacute} % 00E9 LATIN SMALL LETTER E WITH ACUTE
-\defineactivetoken 234 {\eogonek} % 0119 LATIN SMALL LETTER E WITH OGONEK
-\defineactivetoken 235 {\ediaeresis} % 00EB LATIN SMALL LETTER E WITH DIAERESIS
-\defineactivetoken 236 {\ecaron} % 011B LATIN SMALL LETTER E WITH CARON
-\defineactivetoken 237 {\iacute} % 00ED LATIN SMALL LETTER I WITH ACUTE
-\defineactivetoken 238 {\icircumflex} % 00EE LATIN SMALL LETTER I WITH CIRCUMFLEX
-\defineactivetoken 239 {\dcaron} % 010F LATIN SMALL LETTER D WITH CARON
-\defineactivetoken 240 {\dstroke} % 0111 LATIN SMALL LETTER D WITH STROKE
-\defineactivetoken 241 {\nacute} % 0144 LATIN SMALL LETTER N WITH ACUTE
-\defineactivetoken 242 {\ncaron} % 0148 LATIN SMALL LETTER N WITH CARON
-\defineactivetoken 243 {\oacute} % 00F3 LATIN SMALL LETTER O WITH ACUTE
-\defineactivetoken 244 {\ocircumflex} % 00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX
-\defineactivetoken 245 {\ohungarumlaut} % 0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE
-\defineactivetoken 246 {\odiaeresis} % 00F6 LATIN SMALL LETTER O WITH DIAERESIS
-\defineactivetoken 247 {\textdiv} % 00F7 DIVISION SIGN
-\defineactivetoken 248 {\rcaron} % 0159 LATIN SMALL LETTER R WITH CARON
-\defineactivetoken 249 {\uring} % 016F LATIN SMALL LETTER U WITH RING ABOVE
-\defineactivetoken 250 {\uacute} % 00FA LATIN SMALL LETTER U WITH ACUTE
-\defineactivetoken 251 {\uhungarumlaut} % 0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE
-\defineactivetoken 252 {\udiaeresis} % 00FC LATIN SMALL LETTER U WITH DIAERESIS
-\defineactivetoken 253 {\yacute} % 00FD LATIN SMALL LETTER Y WITH ACUTE
-\defineactivetoken 254 {\tcedilla} % 0163 LATIN SMALL LETTER T WITH CEDILLA
-\defineactivetoken 255 {\textdotaccent} % 02D9 DOT ABOVE
-
-\stopregime
-
diff --git a/tex/context/base/regi-iso-8859-7.tex b/tex/context/base/regi-iso-8859-7.tex
deleted file mode 100644
index aa1e2e321..000000000
--- a/tex/context/base/regi-iso-8859-7.tex
+++ /dev/null
@@ -1,155 +0,0 @@
-%D \module
-%D [ file=regi-iso-8859-7,
-%D version=2006.04.10,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=iso-8859-7 (Greek),
-%D author=script-generated,
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D Support for iso-8859-7 input encoding (regime) for Greek,
-%D see also cp1253.
-%D
-%D (Contributor to the original file: Apostolos Syropoulos.)
-%D
-%D Usage:
-%D \type{\enableregime[iso-8859-7]} or
-%D \type{\enableregime[grk]}
-
-
-\startregime[iso-8859-7]
-
-\defineactivetoken 128 {\unknownchar} % 0080 <control>
-\defineactivetoken 129 {\unknownchar} % 0081 <control>
-\defineactivetoken 130 {\unknownchar} % 0082 <control>
-\defineactivetoken 131 {\unknownchar} % 0083 <control>
-\defineactivetoken 132 {\unknownchar} % 0084 <control>
-\defineactivetoken 133 {\unknownchar} % 0085 <control>
-\defineactivetoken 134 {\unknownchar} % 0086 <control>
-\defineactivetoken 135 {\unknownchar} % 0087 <control>
-\defineactivetoken 136 {\unknownchar} % 0088 <control>
-\defineactivetoken 137 {\unknownchar} % 0089 <control>
-\defineactivetoken 138 {\unknownchar} % 008A <control>
-\defineactivetoken 139 {\unknownchar} % 008B <control>
-\defineactivetoken 140 {\unknownchar} % 008C <control>
-\defineactivetoken 141 {\unknownchar} % 008D <control>
-\defineactivetoken 142 {\unknownchar} % 008E <control>
-\defineactivetoken 143 {\unknownchar} % 008F <control>
-\defineactivetoken 144 {\unknownchar} % 0090 <control>
-\defineactivetoken 145 {\unknownchar} % 0091 <control>
-\defineactivetoken 146 {\unknownchar} % 0092 <control>
-\defineactivetoken 147 {\unknownchar} % 0093 <control>
-\defineactivetoken 148 {\unknownchar} % 0094 <control>
-\defineactivetoken 149 {\unknownchar} % 0095 <control>
-\defineactivetoken 150 {\unknownchar} % 0096 <control>
-\defineactivetoken 151 {\unknownchar} % 0097 <control>
-\defineactivetoken 152 {\unknownchar} % 0098 <control>
-\defineactivetoken 153 {\unknownchar} % 0099 <control>
-\defineactivetoken 154 {\unknownchar} % 009A <control>
-\defineactivetoken 155 {\unknownchar} % 009B <control>
-\defineactivetoken 156 {\unknownchar} % 009C <control>
-\defineactivetoken 157 {\unknownchar} % 009D <control>
-\defineactivetoken 158 {\unknownchar} % 009E <control>
-\defineactivetoken 159 {\unknownchar} % 009F <control>
-\defineactivetoken 160 {\nonbreakablespace} % 00A0 NO-BREAK SPACE
-\defineactivetoken 161 {\quoteleft} % 2018 LEFT SINGLE QUOTATION MARK
-\defineactivetoken 162 {\quoteright} % 2019 RIGHT SINGLE QUOTATION MARK
-\defineactivetoken 163 {\textsterling} % 00A3 POUND SIGN
-\defineactivetoken 164 {\texteuro} % 20AC EURO SIGN
-\defineactivetoken 165 {\?} % 20AF DRACHMA SIGN
-\defineactivetoken 166 {\textbrokenbar} % 00A6 BROKEN BAR
-\defineactivetoken 167 {\sectionmark} % 00A7 SECTION SIGN
-\defineactivetoken 168 {\textdiaeresis} % 00A8 DIAERESIS
-\defineactivetoken 169 {\copyright} % 00A9 COPYRIGHT SIGN
-\defineactivetoken 170 {\?} % 037A GREEK YPOGEGRAMMENI
-\defineactivetoken 171 {\leftguillemot} % 00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
-\defineactivetoken 172 {\textlognot} % 00AC NOT SIGN
-\defineactivetoken 173 {\softhyphen} % 00AD SOFT HYPHEN
-\defineactivetoken 175 {\texthorizontalbar} % 2015 HORIZONTAL BAR
-\defineactivetoken 176 {\textdegree} % 00B0 DEGREE SIGN
-\defineactivetoken 177 {\textpm} % 00B1 PLUS-MINUS SIGN
-\defineactivetoken 178 {\twosuperior} % 00B2 SUPERSCRIPT TWO
-\defineactivetoken 179 {\threesuperior} % 00B3 SUPERSCRIPT THREE
-\defineactivetoken 180 {\greektonos} % 0384 GREEK TONOS
-\defineactivetoken 181 {\greekdialytikatonos} % 0385 GREEK DIALYTIKA TONOS
-\defineactivetoken 182 {\greekAlphatonos} % 0386 GREEK CAPITAL LETTER ALPHA WITH TONOS
-\defineactivetoken 183 {\periodcentered} % 00B7 MIDDLE DOT
-\defineactivetoken 184 {\greekEpsilontonos} % 0388 GREEK CAPITAL LETTER EPSILON WITH TONOS
-\defineactivetoken 185 {\greekEtatonos} % 0389 GREEK CAPITAL LETTER ETA WITH TONOS
-\defineactivetoken 186 {\greekIotatonos} % 038A GREEK CAPITAL LETTER IOTA WITH TONOS
-\defineactivetoken 187 {\rightguillemot} % 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
-\defineactivetoken 188 {\greekOmicrontonos} % 038C GREEK CAPITAL LETTER OMICRON WITH TONOS
-\defineactivetoken 189 {\onehalf} % 00BD VULGAR FRACTION ONE HALF
-\defineactivetoken 190 {\greekUpsilontonos} % 038E GREEK CAPITAL LETTER UPSILON WITH TONOS
-\defineactivetoken 191 {\greekOmegatonos} % 038F GREEK CAPITAL LETTER OMEGA WITH TONOS
-\defineactivetoken 192 {\greekiotadialytikatonos} % 0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
-\defineactivetoken 193 {\greekAlpha} % 0391 GREEK CAPITAL LETTER ALPHA
-\defineactivetoken 194 {\greekBeta} % 0392 GREEK CAPITAL LETTER BETA
-\defineactivetoken 195 {\greekGamma} % 0393 GREEK CAPITAL LETTER GAMMA
-\defineactivetoken 196 {\greekDelta} % 0394 GREEK CAPITAL LETTER DELTA
-\defineactivetoken 197 {\greekEpsilon} % 0395 GREEK CAPITAL LETTER EPSILON
-\defineactivetoken 198 {\greekZeta} % 0396 GREEK CAPITAL LETTER ZETA
-\defineactivetoken 199 {\greekEta} % 0397 GREEK CAPITAL LETTER ETA
-\defineactivetoken 200 {\greekTheta} % 0398 GREEK CAPITAL LETTER THETA
-\defineactivetoken 201 {\greekIota} % 0399 GREEK CAPITAL LETTER IOTA
-\defineactivetoken 202 {\greekKappa} % 039A GREEK CAPITAL LETTER KAPPA
-\defineactivetoken 203 {\greekLambda} % 039B GREEK CAPITAL LETTER LAMDA
-\defineactivetoken 204 {\greekMu} % 039C GREEK CAPITAL LETTER MU
-\defineactivetoken 205 {\greekNu} % 039D GREEK CAPITAL LETTER NU
-\defineactivetoken 206 {\greekXi} % 039E GREEK CAPITAL LETTER XI
-\defineactivetoken 207 {\greekOmicron} % 039F GREEK CAPITAL LETTER OMICRON
-\defineactivetoken 208 {\greekPi} % 03A0 GREEK CAPITAL LETTER PI
-\defineactivetoken 209 {\greekRho} % 03A1 GREEK CAPITAL LETTER RHO
-\defineactivetoken 210 {\unknownchar} % <undefined>
-\defineactivetoken 211 {\greekSigma} % 03A3 GREEK CAPITAL LETTER SIGMA
-\defineactivetoken 212 {\greekTau} % 03A4 GREEK CAPITAL LETTER TAU
-\defineactivetoken 213 {\greekUpsilon} % 03A5 GREEK CAPITAL LETTER UPSILON
-\defineactivetoken 214 {\greekPhi} % 03A6 GREEK CAPITAL LETTER PHI
-\defineactivetoken 215 {\greekChi} % 03A7 GREEK CAPITAL LETTER CHI
-\defineactivetoken 216 {\greekPsi} % 03A8 GREEK CAPITAL LETTER PSI
-\defineactivetoken 217 {\greekOmega} % 03A9 GREEK CAPITAL LETTER OMEGA
-\defineactivetoken 218 {\greekIotadialytika} % 03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
-\defineactivetoken 219 {\greekUpsilondialytika} % 03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
-\defineactivetoken 220 {\greekalphatonos} % 03AC GREEK SMALL LETTER ALPHA WITH TONOS
-\defineactivetoken 221 {\greekepsilontonos} % 03AD GREEK SMALL LETTER EPSILON WITH TONOS
-\defineactivetoken 222 {\greeketatonos} % 03AE GREEK SMALL LETTER ETA WITH TONOS
-\defineactivetoken 223 {\greekiotatonos} % 03AF GREEK SMALL LETTER IOTA WITH TONOS
-\defineactivetoken 224 {\greekupsilondialytikatonos} % 03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
-\defineactivetoken 225 {\greekalpha} % 03B1 GREEK SMALL LETTER ALPHA
-\defineactivetoken 226 {\greekbeta} % 03B2 GREEK SMALL LETTER BETA
-\defineactivetoken 227 {\greekgamma} % 03B3 GREEK SMALL LETTER GAMMA
-\defineactivetoken 228 {\greekdelta} % 03B4 GREEK SMALL LETTER DELTA
-\defineactivetoken 229 {\greekepsilon} % 03B5 GREEK SMALL LETTER EPSILON
-\defineactivetoken 230 {\greekzeta} % 03B6 GREEK SMALL LETTER ZETA
-\defineactivetoken 231 {\greeketa} % 03B7 GREEK SMALL LETTER ETA
-\defineactivetoken 232 {\greektheta} % 03B8 GREEK SMALL LETTER THETA
-\defineactivetoken 233 {\greekiota} % 03B9 GREEK SMALL LETTER IOTA
-\defineactivetoken 234 {\greekkappa} % 03BA GREEK SMALL LETTER KAPPA
-\defineactivetoken 235 {\greeklambda} % 03BB GREEK SMALL LETTER LAMDA
-\defineactivetoken 236 {\greekmu} % 03BC GREEK SMALL LETTER MU
-\defineactivetoken 237 {\greeknu} % 03BD GREEK SMALL LETTER NU
-\defineactivetoken 238 {\greekxi} % 03BE GREEK SMALL LETTER XI
-\defineactivetoken 239 {\greekomicron} % 03BF GREEK SMALL LETTER OMICRON
-\defineactivetoken 240 {\greekpi} % 03C0 GREEK SMALL LETTER PI
-\defineactivetoken 241 {\greekrho} % 03C1 GREEK SMALL LETTER RHO
-\defineactivetoken 242 {\greekfinalsigma} % 03C2 GREEK SMALL LETTER FINAL SIGMA
-\defineactivetoken 243 {\greeksigma} % 03C3 GREEK SMALL LETTER SIGMA
-\defineactivetoken 244 {\greektau} % 03C4 GREEK SMALL LETTER TAU
-\defineactivetoken 245 {\greekupsilon} % 03C5 GREEK SMALL LETTER UPSILON
-\defineactivetoken 246 {\greekphi} % 03C6 GREEK SMALL LETTER PHI
-\defineactivetoken 247 {\greekchi} % 03C7 GREEK SMALL LETTER CHI
-\defineactivetoken 248 {\greekpsi} % 03C8 GREEK SMALL LETTER PSI
-\defineactivetoken 249 {\greekomega} % 03C9 GREEK SMALL LETTER OMEGA
-\defineactivetoken 250 {\greekiotadialytika} % 03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA
-\defineactivetoken 251 {\greekupsilondiaeresis} % 03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA
-\defineactivetoken 252 {\greekomicrontonos} % 03CC GREEK SMALL LETTER OMICRON WITH TONOS
-\defineactivetoken 253 {\greekupsilontonos} % 03CD GREEK SMALL LETTER UPSILON WITH TONOS
-\defineactivetoken 254 {\greekomegatonos} % 03CE GREEK SMALL LETTER OMEGA WITH TONOS
-\defineactivetoken 255 {\unknownchar} % <undefined>
-
-\stopregime
-
diff --git a/tex/context/base/regi-syn.tex b/tex/context/base/regi-syn.tex
index 324ccf62b..e57446ad8 100644
--- a/tex/context/base/regi-syn.tex
+++ b/tex/context/base/regi-syn.tex
@@ -25,27 +25,27 @@
\defineregimesynonym [windows-1257] [cp1257]
%defineregimesynonym [windows-1258] [cp1258] % not supported yet (Vietnamese)
-\defineregimesynonym [il1] [iso-8859-1]
-\defineregimesynonym [il2] [iso-8859-2]
-\defineregimesynonym [il3] [iso-8859-3]
-\defineregimesynonym [il4] [iso-8859-4]
-\defineregimesynonym [il5] [iso-8859-9]
-\defineregimesynonym [il6] [iso-8859-10]
-\defineregimesynonym [il7] [iso-8859-13]
-%defineregimesynonym [il8] [iso-8859-14]
-\defineregimesynonym [il9] [iso-8859-15]
-\defineregimesynonym [il10] [iso-8859-16]
-
-\defineregimesynonym [latin1] [iso-8859-1]
-\defineregimesynonym [latin2] [iso-8859-2]
-\defineregimesynonym [latin3] [iso-8859-3]
-\defineregimesynonym [latin4] [iso-8859-4]
-\defineregimesynonym [latin5] [iso-8859-9]
-\defineregimesynonym [latin6] [iso-8859-10]
-\defineregimesynonym [latin7] [iso-8859-13]
-%defineregimesynonym [latin8] [iso-8859-14]
-\defineregimesynonym [latin9] [iso-8859-15]
-\defineregimesynonym [latin10] [iso-8859-16]
+\defineregimesynonym [il1] [8859-1]
+\defineregimesynonym [il2] [8859-2]
+\defineregimesynonym [il3] [8859-3]
+\defineregimesynonym [il4] [8859-4]
+\defineregimesynonym [il5] [8859-9]
+\defineregimesynonym [il6] [8859-10]
+\defineregimesynonym [il7] [8859-13]
+%defineregimesynonym [il8] [8859-14]
+\defineregimesynonym [il9] [8859-15]
+\defineregimesynonym [il10] [8859-16]
+
+\defineregimesynonym [latin1] [8859-1]
+\defineregimesynonym [latin2] [8859-2]
+\defineregimesynonym [latin3] [8859-3]
+\defineregimesynonym [latin4] [8859-4]
+\defineregimesynonym [latin5] [8859-9]
+\defineregimesynonym [latin6] [8859-10]
+\defineregimesynonym [latin7] [8859-13]
+%defineregimesynonym [latin8] [8859-14]
+\defineregimesynonym [latin9] [8859-15]
+\defineregimesynonym [latin10] [8859-16]
% kind of special
@@ -55,8 +55,8 @@
% for historical reasons / compatibility
\defineregimesynonym [windows] [cp1252]
-\defineregimesynonym [grk] [iso-8859-7]
-\defineregimesynonym [iso88595] [iso-8859-5]
+\defineregimesynonym [grk] [8859-7]
+\defineregimesynonym [iso88595] [8859-5]
\protect \endinput
diff --git a/tex/context/base/syst-cat.tex b/tex/context/base/syst-cat.tex
index 53bfc29b2..c4f6711ed 100644
--- a/tex/context/base/syst-cat.tex
+++ b/tex/context/base/syst-cat.tex
@@ -37,22 +37,62 @@
%D Once a catcode is assigned, the next assignments will happen faster.
+% (expandable) let
+
\def\letcatcodecommand {\afterassignment\letcatcodecommanda\cctcountera}
\def\letcatcodecommanda{\afterassignment\letcatcodecommandb\cctcounterb}
-\def\letcatcodecommandb % each time time
- {\ifcsname CCD:\number\cctcountera:\number\cctcounterb\endcsname
- \csname CCD:\number\cctcountera:\number\cctcounterb\expandafter\endcsname
+\def\letcatcodecommandb % each time
+ {\ifcsname CCL:\number\cctcountera:\number\cctcounterb\endcsname
+ \csname CCL:\number\cctcountera:\number\cctcounterb\expandafter\endcsname
\else
\expandafter\letcatcodecommandc
\fi}
\def\letcatcodecommandc % only first time
- {\expandafter\gdef\csname CCD:\number\cctcountera:\number\cctcounterb\expandafter\endcsname\expandafter
+ {\expandafter\gdef\csname CCL:\number\cctcountera:\number\cctcounterb\expandafter\endcsname\expandafter
{\expandafter\let\csname CCC:\number\cctcountera:\number\cctcounterb\endcsname}%
\reinstatecatcodecommanda
+ \csname CCL:\number\cctcountera:\number\cctcounterb\endcsname}
+
+% expandable def
+
+\def\defcatcodecommand {\afterassignment\defcatcodecommanda\cctcountera}
+\def\defcatcodecommanda{\afterassignment\defcatcodecommandb\cctcounterb}
+
+\def\defcatcodecommandb % each time
+ {\ifcsname CCD:\number\cctcountera:\number\cctcounterb\endcsname
+ \csname CCD:\number\cctcountera:\number\cctcounterb\expandafter\endcsname
+ \else
+ \expandafter\defcatcodecommandc
+ \fi}
+
+\def\defcatcodecommandc % only first time
+ {\expandafter\gdef\csname CCD:\number\cctcountera:\number\cctcounterb\expandafter\endcsname
+ \expandafter##\expandafter1\expandafter
+ {\expandafter\def\csname CCC:\number\cctcountera:\number\cctcounterb\endcsname{##1}}%
+ \reinstatecatcodecommanda
\csname CCD:\number\cctcountera:\number\cctcounterb\endcsname}
+% un expandable def (e.g. used for discretionaries)
+
+\def\uedcatcodecommand {\afterassignment\uedcatcodecommanda\cctcountera}
+\def\uedcatcodecommanda{\afterassignment\uedcatcodecommandb\cctcounterb}
+
+\def\uedcatcodecommandb % each time
+ {\ifcsname CCU:\number\cctcountera:\number\cctcounterb\endcsname
+ \csname CCU:\number\cctcountera:\number\cctcounterb\expandafter\endcsname
+ \else
+ \expandafter\uedcatcodecommandc
+ \fi}
+
+\def\uedcatcodecommandc % only first time
+ {\expandafter\gdef\csname CCU:\number\cctcountera:\number\cctcounterb\expandafter\endcsname
+ \expandafter##\expandafter1\expandafter
+ {\expandafter\unexpanded\expandafter\def\csname CCC:\number\cctcountera:\number\cctcounterb\endcsname{##1}}%
+ \reinstatecatcodecommanda
+ \csname CCU:\number\cctcountera:\number\cctcounterb\endcsname}
+
\def\reinstatecatcodecommand{\afterassignment\reinstatecatcodecommanda\cctcounterb}
\def\reinstatecatcodecommanda % can be used when a direct definition has been done
diff --git a/tex/context/base/thrd-pic.tex b/tex/context/base/thrd-pic.tex
new file mode 100644
index 000000000..3c6375cbd
--- /dev/null
+++ b/tex/context/base/thrd-pic.tex
@@ -0,0 +1,3694 @@
+% Since this file is not available in every distribution, we
+% have copied the original in this file. The manuals to
+% Wichura's PiCTeX and TaBlE packages are not available on
+% line and are distributed by respectively the TeX Users Group
+% and Personal TeX Inc.
+
+% We've patched this file for catcode ! because in luatex we use
+% catcode tables and using unprotect/protect is cleaner.
+
+% This is PiCTeX, Version 1.1 9/21/87
+
+% CAVEAT: The PiCTeX manual often has a more lucid explanation
+% of any given topic than you will find in the internal documentation
+% of the macros.
+
+% PiCTeX's commands can be classified into two groups: (1) public (or
+% external), and (2) private (or internal). The public macros are
+% discussed at length in the manual. The only discussion of the private
+% macros is the internal documentation. The private macros all have
+% names beginning with an exclamation point (!) of category code 11.
+% Since in normal usage "!" has category code 12, these macros can't
+% be accessed or modified by the general user.
+
+% The macros are organized into thematically related groups. For example,
+% the macros dealing with dots & dashes are all in the DASHPATTERN group.
+% The table below shows which macros are in which groups. The table
+% covers all public macros, and many (but not all) of PiCTeX's upper level
+% private macros. Following the table, the various groups are listed
+% in the order in which they appear in the table.
+
+% *********************** TABLE OF GROUPS OF MACROS **********************
+
+% HACKS: Utility macros
+% \PiC
+% \PiCTeX
+% \placevalueinpts
+% \!!loop
+% \!cfor
+% \!copylist
+% \!ecfor
+% \!etfor
+% \!getnext
+% \!getnextvalueof
+% \!ifempty
+% \!ifnextchar
+% \!leftappend
+% \!listaddon
+% \!loop
+% \!lop
+% \!mlap
+% \!not
+% \!removept
+% \!rightappend
+% \!tfor
+% \!vmlap
+% \!wlet
+
+% ALLOCATION: Allocates registers
+
+% AREAS: Deals with plot areas
+% \axis
+% \grid
+% \invisibleaxes
+% \normalgraphs
+% \plotheading
+% \setplotarea
+% \visibleaxes
+
+% ARROWS: Draws arrows
+% \arrow
+% \betweenarrows
+
+% BARS: Draws bars
+% \putbar
+% \setbars
+
+% BOXES: Draws rectangles
+% \frame
+% \putrectangle
+% \rectangle
+% \shaderectangleson
+% \shaderectanglesoff
+
+% CURVES: Upper level plot commands
+% \hshade
+% \plot
+% \sethistograms
+% \setlinear
+% \setquadratic
+% \vshade
+
+% DASHPATTERNS: Sets up dash patterns
+% \findlength
+% \setdashes
+% \setdashesnear
+% \setdashpattern
+% \setdots
+% \setdotsnear
+% \setsolid
+% \!dashingoff
+% \!dashingon
+
+% DIVISION: Does long division of dimension registers
+% \Divide
+% \!divide
+
+% ELLIPSES: Draws ellipses and circles
+% \circulararc
+% \ellipticalarc
+
+% RULES: Draws rules, i.e., horizontal & vertical lines
+% \putrule
+% \!putdashedhline
+% \!putdashedvline
+% \!puthline
+% \!putsolidhline
+% \!putsolidvline
+% \!putvline
+
+% LINEAR ARC: Draws straight lines -- solid and dashed
+% \inboundscheckoff
+% \inboundscheckon
+% \!advancedashing
+% \!drawlinearsegment
+% \!initinboundscheck
+% \!linearsolid
+% \!lineardashed
+% \!ljoin
+% \!plotifinbounds
+% \!start
+
+% LOGTEN: Log_10 function
+% \!logten
+
+% PICTURES: Basic setups for PiCtures; \put commands
+% \accountingoff
+% \accountingon
+% \beginpicture
+% \endpicture
+% \endpicturesave
+% \lines
+% \multiput
+% \put
+% \setcoordinatemode
+% \setcoordinatesystem
+% \setdimensionmode
+% \stack
+% \Lines
+% \Xdistance
+% \Ydistance
+% \!dimenput
+% \!ifcoordmode
+% \!ifdimenmode
+% \!setcoordmode
+% \!setdimenmode
+% \!setputobject
+
+% PLOTTING: Things to do with plotting
+% \dontsavelinesandcurves
+% \replot
+% \savelinesandcurves
+% \setplotsymbol
+% \writesavefile
+% \!plot
+
+% PYTHAGORAS: Euclidean distance function
+% \placehypotenuse
+% \!Pythag
+
+% QUADRATIC ARC: Draws a quadratic arc
+% \!qjoin
+
+% ROTATIONS: Handles rotations
+% \startrotation
+% \stoprotation
+% \!rotateaboutpivot
+% \!rotateonly
+
+% SHADING: Handles shading
+% \setshadegrid
+% \setshadesymbol
+% \!lshade
+% \!qshade
+% \!starthshade
+% \!startvshade
+
+% TICKS: Draws ticks on graphs
+% \gridlines
+% \loggedticks
+% \nogridlines
+% \ticksin
+% \ticksout
+% \unloggesticks
+
+% ***************** END OF TABLE OF GROUPS OF MACROS ********************
+
+
+% \catcode`!=11 % ***** THIS MUST NEVER BE OMITTED
+
+\unprotect
+
+% *******************************
+% *** HACKS (Utility macros) ***
+% *******************************
+
+% ** User commands
+% ** \PiC{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC}
+% ** \PiCTeX{\PiC\kern-.11em\TeX}
+% ** \placevalueinpts of <DIMENSION REGISTER> in {CONTROL SEQUENCE}
+
+% ** Internal commands
+% ** \!ifnextchar{CHARACTER}{TRUE ACTION}{FALSE ACTION}
+% ** \!tfor NAME := LIST \do {BODY}
+% ** \!etfor NAME:= LIST \do {BODY}
+% ** \!cfor NAME := LIST \do {BODY}
+% ** \!ecfor NAME:= LIST \do {BODY}
+% ** \!ifempty{MACRO}{TRUE ACTION}{FALSE ACTION}
+% ** \!getnext\\ITEMfrom\LIST
+% ** \!getnextvalueof\DIMEN\from\LIST
+% ** \!copylist\LISTMACRO_A\to\LISTMACRO_B
+% ** \!wlet\CONTROL_SEQUENCE_A=\CONTROL_SEQUENCE_B
+% ** \!listaddon ITEM LIST
+% ** \!rightappendITEM\withCS\to\LISTMACRO
+% ** \!leftappendITEM\withCS\to\LISTMACRO
+% ** \!lop\LISTMACRO\to\ITEM
+% ** \!loop ... repeat
+% ** \!!loop ... repeat
+% ** \!removept{DIMENSION REGISTER}{CONTROL SEQUENCE}
+% ** \!mlap{...}
+% ** \!vmlap{...}
+% ** \!not{TEK if-CONDITION}
+
+% ** First, here are the the PiCTeX logo, and the syllable PiC:
+\def\PiC{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC}
+\def\PiCTeX{\PiC\kern-.11em\TeX}
+
+% ** The following macro expands to parameter #2 or parameter #3 according to
+% ** whether the next non-blank character following the macro is or is not #1.
+% ** Blanks following the macro are gobbled.
+\def\!ifnextchar#1#2#3{%
+ \let\!testchar=#1%
+ \def\!first{#2}%
+ \def\!second{#3}%
+ \futurelet\!nextchar\!testnext}
+\def\!testnext{%
+ \ifx \!nextchar \!spacetoken
+ \let\!next=\!skipspacetestagain
+ \else
+ \ifx \!nextchar \!testchar
+ \let\!next=\!first
+ \else
+ \let\!next=\!second
+ \fi
+ \fi
+ \!next}
+\def\\{\!skipspacetestagain}
+ \expandafter\def\\ {\futurelet\!nextchar\!testnext}
+\def\\{\let\!spacetoken= } \\ % ** set \spacetoken to a space token
+
+
+% ** Borrow the "tfor" macro from Latex:
+% ** \!tfor NAME := LIST \do {BODY}
+% ** if, before expansion, LIST = T1 ... Tn, where each Ti is a token
+% ** or {...}, then executes BODY n times, with NAME = Ti on the
+% ** i-th iteration. Works for n=0.
+\def\!tfor#1:=#2\do#3{%
+ \edef\!fortemp{#2}%
+ \ifx\!fortemp\!empty
+ \else
+ \!tforloop#2\!nil\!nil\!!#1{#3}%
+ \fi}
+\def\!tforloop#1#2\!!#3#4{%
+ \def#3{#1}%
+ \ifx #3\!nnil
+ \let\!nextwhile=\!fornoop
+ \else
+ #4\relax
+ \let\!nextwhile=\!tforloop
+ \fi
+ \!nextwhile#2\!!#3{#4}}
+
+
+% ** \!etfor NAME:= LIST\do {BODY}
+% ** This is like \!cfor, but LIST is any balanced token list whose complete
+% ** expansion has the form T1 ... Tn
+\def\!etfor#1:=#2\do#3{%
+ \def\!!tfor{\!tfor#1:=}%
+ \edef\!!!tfor{#2}%
+ \expandafter\!!tfor\!!!tfor\do{#3}}
+
+
+% ** modify the Latex \tfor (token-for) loop to a \cfor (comma-for) loop.
+% ** \!cfor NAME := LIST \do {BODY}
+% ** if, before expansion, LIST = a1,a2,...an, then executes BODY n times,
+% ** with NAME = ai on the i-th iteration. Works for n=0.
+\def\!cfor#1:=#2\do#3{%
+ \edef\!fortemp{#2}%
+ \ifx\!fortemp\!empty
+ \else
+ \!cforloop#2,\!nil,\!nil\!!#1{#3}%
+ \fi}
+\def\!cforloop#1,#2\!!#3#4{%
+ \def#3{#1}%
+ \ifx #3\!nnil
+ \let\!nextwhile=\!fornoop
+ \else
+ #4\relax
+ \let\!nextwhile=\!cforloop
+ \fi
+ \!nextwhile#2\!!#3{#4}}
+
+
+% ** \!ecfor NAME:= LIST\do {BODY}
+% ** This is like \!cfor, but LIST is any balanced token list whose complete
+% ** expansion has the form a1,a2,...,an.
+\def\!ecfor#1:=#2\do#3{%
+ \def\!!cfor{\!cfor#1:=}%
+ \edef\!!!cfor{#2}%
+ \expandafter\!!cfor\!!!cfor\do{#3}}
+
+
+\def\!empty{}
+\def\!nnil{\!nil}
+\def\!fornoop#1\!!#2#3{}
+
+
+% ** \!ifempty{ARG}{TRUE ACTION}{FALSE ACTION}
+\def\!ifempty#1#2#3{%
+ \edef\!emptyarg{#1}%
+ \ifx\!emptyarg\!empty
+ #2%
+ \else
+ #3%
+ \fi}
+
+% ** \!getnext\\ITEMfrom\LIST
+% ** \LIST has the form \\{item1}\\{item2}\\{item3}...\\{itemk}
+% ** This routine sets \ITEM to item1, and cycles \LIST to
+% ** \\{item2}\\{item3}...\\{itemk}\\{item1}
+\def\!getnext#1\from#2{%
+ \expandafter\!gnext#2\!#1#2}%
+\def\!gnext\\#1#2\!#3#4{%
+ \def#3{#1}%
+ \def#4{#2\\{#1}}%
+ \ignorespaces}
+
+
+% ** \!getnextvalueof\DIMEN\from\LIST
+% ** Similar to !getnext.
+% ** \LIST has the form \\{dimen1}\\{dimen2}\\{dimen3} ...
+% ** \DIMEN is a dimension register
+% ** Works also for counts
+%
+\def\!getnextvalueof#1\from#2{%
+ \expandafter\!gnextv#2\!#1#2}%
+\def\!gnextv\\#1#2\!#3#4{%
+ #3=#1%
+ \def#4{#2\\{#1}}%
+ \ignorespaces}
+
+
+% ** \!copylist\LISTMACROA\to\LISTMACROB
+% ** makes the replacement text of LISTMACRO B identical to that of
+% ** list macro A.
+\def\!copylist#1\to#2{%
+ \expandafter\!!copylist#1\!#2}
+\def\!!copylist#1\!#2{%
+ \def#2{#1}\ignorespaces}
+
+
+% ** \!wlet\CSA=\CSB
+% ** lets control sequence \CSB = control sequence \CSA, and writes a
+% ** message to that effect in the log file using plain TEK's \wlog
+\def\!wlet#1=#2{%
+ \let#1=#2
+ \wlog{\string#1=\string#2}}
+
+% ** \!listaddon ITEM LIST
+% ** LIST <-- LIST \\ ITEM
+\def\!listaddon#1#2{%
+ \expandafter\!!listaddon#2\!{#1}#2}
+\def\!!listaddon#1\!#2#3{%
+ \def#3{#1\\#2}}
+
+% ** \!rightappendITEM\to\LISTMACRO
+% ** \LISTMACRO --> \LISTMACRO\\{ITEM}
+%\def\!rightappend#1\to#2{\expandafter\!!rightappend#2\!{#1}#2}
+%\def\!!rightappend#1\!#2#3{\def#3{#1\\{#2}}}
+
+
+% ** \!rightappendITEM\withCS\to\LISTMACRO
+% ** \LISTMACRO --> \LISTMACRO||CS||{ITEM}
+\def\!rightappend#1\withCS#2\to#3{\expandafter\!!rightappend#3\!#2{#1}#3}
+\def\!!rightappend#1\!#2#3#4{\def#4{#1#2{#3}}}
+
+
+% ** \!leftappendITEM\withCS\to\LISTMACRO
+% ** \LISTMACRO --> CS||{ITEM}||\LISTMACRO
+\def\!leftappend#1\withCS#2\to#3{\expandafter\!!leftappend#3\!#2{#1}#3}
+\def\!!leftappend#1\!#2#3#4{\def#4{#2{#3}#1}}
+
+
+% ** \!lop\LISTMACRO\to\ITEM
+% ** \\{item1}\\{item2}\\{item3} ... --> \\{item2}\\{item3} ...
+% ** item1 --> \ITEM
+\def\!lop#1\to#2{\expandafter\!!lop#1\!#1#2}
+\def\!!lop\\#1#2\!#3#4{\def#4{#1}\def#3{#2}}
+
+
+% ** \!placeNUMBER\of\LISTMACRO\in\ITEM
+% ** the NUMBERth item of \LISTMACRO --> replacement text of \ITEM
+%\def\!place#1\of#2\in#3{\def#3{\outofrange}%
+%{\count0=#1\def\\##1{\advance\count0-1 \ifnum\count0=0 \gdef#3{##1}\fi}#2}}
+
+
+% ** Following code converts a commalist to a list macro, with all items
+% ** fully expanded.
+%\!ecfor\item:=\commalist\do{\expandafter\!rightappend\item\to\list}
+
+
+% ** \!loop ... repeat
+% ** This is exactly like TEX's \loop ... repeat. It can be used in nesting
+% ** two loops, without puting the inner one inside a group.
+\def\!loop#1\repeat{\def\!body{#1}\!iterate}
+\def\!iterate{\!body\let\!next=\!iterate\else\let\!next=\relax\fi\!next}
+
+% ** \!!loop ... repeat
+% ** This is exactly like TEX's \loop ... repeat. It can be used in nesting
+% ** two loops, without puting the inner one inside a group.
+\def\!!loop#1\repeat{\def\!!body{#1}\!!iterate}
+\def\!!iterate{\!!body\let\!!next=\!!iterate\else\let\!!next=\relax\fi\!!next}
+% (\multiput uses \!!loop)
+
+% ** \!removept{DIMENREG}{\CS}
+% ** Defines the control sequence CS to be the value (in points) in the
+% ** dimension register DIMENREG (but without the "pt" TEK usually adds)
+% ** E.g., after \dimen0=12.3pt \!removept\dimen0\A, \A expands to 12.3
+\def\!removept#1#2{\edef#2{\expandafter\!!removePT\the#1}}
+{\catcode`p=12 \catcode`t=12 \gdef\!!removePT#1pt{#1}}
+
+% ** \pladevalueinpts of <DIMENSION REGISTER> in {CONTROL SEQUENCE}
+\def\placevalueinpts of <#1> in #2 {%
+ \!removept{#1}{#2}}
+
+% ** \!mlap{...} \!vmlap{...}
+% ** Center ... in a box of width 0.
+\def\!mlap#1{\hbox to 0pt{\hss#1\hss}}
+\def\!vmlap#1{\vbox to 0pt{\vss#1\vss}}
+
+% ** \!not{TEK if-CONDITION}
+% ** By a TEK if-CONDITION is meant something like
+% ** \ifnum\N<0, or \ifdim\A>\B
+% ** \!not produces an if-condition which is false if the original condition
+% ** is true, and true if the original condition is false.
+\def\!not#1{%
+ #1\relax
+ \!switchfalse
+ \else
+ \!switchtrue
+ \fi
+ \if!switch
+ \ignorespaces}
+
+
+% *******************
+% *** ALLOCATIONS ***
+% *******************
+
+% This section allocates all the registers PiCTeX uses. Following
+% each allocation is a string of the form ....N.D...L......... ;
+% the various letters show which sections of PiCTeX make explicit
+% reference to that register, according to the following code:
+
+% H Hacks
+% A Areas
+% W arroWs
+% B Bars
+% X boXes
+% C Curves
+% D Dashpattterns
+% V diVision
+% E Ellipses
+% U rUles
+% L Linear arc
+% G loGten
+% P Pictures
+% O plOtting
+% Y pYthagoras
+% Q Quadratic arc
+% R Rotations
+% S Shading
+% T Ticks
+
+% Turn off messages from TeX's allocation macros
+\let\!!!wlog=\wlog % "\wlog" is defined in plain TeX
+\def\wlog#1{}
+
+\newdimen\headingtoplotskip %.A.................
+\newdimen\linethickness %.A..X....U........T
+\newdimen\longticklength %.A................T
+\newdimen\plotsymbolspacing %......D...L....Q...
+\newdimen\shortticklength %.A................T
+\newdimen\stackleading %.A..........P......
+\newdimen\tickstovaluesleading %.A................T
+\newdimen\totalarclength %......D...L....Q...
+\newdimen\valuestolabelleading %.A.................
+
+\newbox\!boxA %.AW...............T
+\newbox\!boxB %..W................
+\newbox\!picbox %............P......
+\newbox\!plotsymbol %..........L..O.....
+\newbox\!putobject %............PO...S.
+\newbox\!shadesymbol %.................S.
+
+\newcount\!countA %.A....D..UL....Q.ST
+\newcount\!countB %......D..U.....Q.ST
+\newcount\!countC %...............Q..T
+\newcount\!countD %...................
+\newcount\!countE %.............O....T
+\newcount\!countF %.............O....T
+\newcount\!countG %..................T
+\newcount\!fiftypt %.........U.........
+\newcount\!intervalno %..........L....Q...
+\newcount\!npoints %..........L........
+\newcount\!nsegments %.........U.........
+\newcount\!ntemp %............P......
+\newcount\!parity %.................S.
+\newcount\!scalefactor %..................T
+\newcount\!tfs %.......V...........
+\newcount\!tickcase %..................T
+
+\newdimen\!Xleft %............P......
+\newdimen\!Xright %............P......
+\newdimen\!Xsave %.A................T
+\newdimen\!Ybot %............P......
+\newdimen\!Ysave %.A................T
+\newdimen\!Ytop %............P......
+\newdimen\!angle %........E..........
+\newdimen\!arclength %..W......UL....Q...
+\newdimen\!areabloc %.A........L........
+\newdimen\!arealloc %.A........L........
+\newdimen\!arearloc %.A........L........
+\newdimen\!areatloc %.A........L........
+\newdimen\!bshrinkage %.................S.
+\newdimen\!checkbot %..........L........
+\newdimen\!checkleft %..........L........
+\newdimen\!checkright %..........L........
+\newdimen\!checktop %..........L........
+\newdimen\!dimenA %.AW.X.DVEUL..OYQRST
+\newdimen\!dimenB %....X.DVEU...O.QRS.
+\newdimen\!dimenC %..W.X.DVEU......RS.
+\newdimen\!dimenD %..W.X.DVEU....Y.RS.
+\newdimen\!dimenE %..W........G..YQ.S.
+\newdimen\!dimenF %...........G..YQ.S.
+\newdimen\!dimenG %...........G..YQ.S.
+\newdimen\!dimenH %...........G..Y..S.
+\newdimen\!dimenI %...BX.........Y....
+\newdimen\!distacross %..........L....Q...
+\newdimen\!downlength %..........L........
+\newdimen\!dp %.A..X.......P....S.
+\newdimen\!dshade %.................S.
+\newdimen\!dxpos %..W......U..P....S.
+\newdimen\!dxprime %...............Q...
+\newdimen\!dypos %..WB.....U..P......
+\newdimen\!dyprime %...............Q...
+\newdimen\!ht %.A..X.......P....S.
+\newdimen\!leaderlength %......D..U.........
+\newdimen\!lshrinkage %.................S.
+\newdimen\!midarclength %...............Q...
+\newdimen\!offset %.A................T
+\newdimen\!plotheadingoffset %.A.................
+\newdimen\!plotsymbolxshift %..........L..O.....
+\newdimen\!plotsymbolyshift %..........L..O.....
+\newdimen\!plotxorigin %..........L..O.....
+\newdimen\!plotyorigin %..........L..O.....
+\newdimen\!rootten %...........G.......
+\newdimen\!rshrinkage %.................S.
+\newdimen\!shadesymbolxshift %.................S.
+\newdimen\!shadesymbolyshift %.................S.
+\newdimen\!tenAa %...........G.......
+\newdimen\!tenAc %...........G.......
+\newdimen\!tenAe %...........G.......
+\newdimen\!tshrinkage %.................S.
+\newdimen\!uplength %..........L........
+\newdimen\!wd %....X.......P....S.
+\newdimen\!wmax %...............Q...
+\newdimen\!wmin %...............Q...
+\newdimen\!xB %...............Q...
+\newdimen\!xC %...............Q...
+\newdimen\!xE %..W.....E.L....Q.S.
+\newdimen\!xM %..W.....E......Q.S.
+\newdimen\!xS %..W.....E.L....Q.S.
+\newdimen\!xaxislength %.A................T
+\newdimen\!xdiff %..........L........
+\newdimen\!xleft %............P......
+\newdimen\!xloc %..WB.....U.......S.
+\newdimen\!xorigin %.A........L.P....S.
+\newdimen\!xpivot %................R..
+\newdimen\!xpos %..........L.P..Q.ST
+\newdimen\!xprime %...............Q...
+\newdimen\!xright %............P......
+\newdimen\!xshade %.................S.
+\newdimen\!xshift %..W.........PO...S.
+\newdimen\!xtemp %............P......
+\newdimen\!xunit %.AWBX...EUL.P..QRS.
+\newdimen\!xxE %........E..........
+\newdimen\!xxM %........E..........
+\newdimen\!xxS %........E..........
+\newdimen\!xxloc %..WB....EU.........
+\newdimen\!yB %...............Q...
+\newdimen\!yC %...............Q...
+\newdimen\!yE %..W.....E.L....Q...
+\newdimen\!yM %..W.....E......Q...
+\newdimen\!yS %..W.....E.L....Q...
+\newdimen\!yaxislength %.A................T
+\newdimen\!ybot %............P......
+\newdimen\!ydiff %..........L........
+\newdimen\!yloc %..WB.....U.......S.
+\newdimen\!yorigin %.A........L.P....S.
+\newdimen\!ypivot %................R..
+\newdimen\!ypos %..........L.P..Q.ST
+\newdimen\!yprime %...............Q...
+\newdimen\!yshade %.................S.
+\newdimen\!yshift %..W.........PO...S.
+\newdimen\!ytemp %............P......
+\newdimen\!ytop %............P......
+\newdimen\!yunit %.AWBX...EUL.P..QRS.
+\newdimen\!yyE %........E..........
+\newdimen\!yyM %........E..........
+\newdimen\!yyS %........E..........
+\newdimen\!yyloc %..WB....EU.........
+\newdimen\!zpt %.AWBX.DVEULGP.YQ.ST
+
+\newif\if!axisvisible %.A.................
+\newif\if!gridlinestoo %..................T
+\newif\if!keepPO %...................
+\newif\if!placeaxislabel %.A.................
+\newif\if!switch %H..................
+\newif\if!xswitch %.A................T
+
+\newtoks\!axisLaBeL %.A.................
+\newtoks\!keywordtoks %.A.................
+
+\newwrite\!replotfile %.............O.....
+
+\newhelp\!keywordhelp{The keyword mentioned in the error message in unknown.
+Replace NEW KEYWORD in the indicated response by the keyword that
+should have been specified.} %.A.................
+
+% The following commands assign alternate names to some of the
+% above registers. "\!wlet" is defined in Hacks.
+\!wlet\!!origin=\!xM %.A................T
+\!wlet\!!unit=\!uplength %.A................T
+\!wlet\!Lresiduallength=\!dimenG %.........U.........
+\!wlet\!Rresiduallength=\!dimenF %.........U.........
+\!wlet\!axisLength=\!distacross %.A................T
+\!wlet\!axisend=\!ydiff %.A................T
+\!wlet\!axisstart=\!xdiff %.A................T
+\!wlet\!axisxlevel=\!arclength %.A................T
+\!wlet\!axisylevel=\!downlength %.A................T
+\!wlet\!beta=\!dimenE %...............Q...
+\!wlet\!gamma=\!dimenF %...............Q...
+\!wlet\!shadexorigin=\!plotxorigin %.................S.
+\!wlet\!shadeyorigin=\!plotyorigin %.................S.
+\!wlet\!ticklength=\!xS %..................T
+\!wlet\!ticklocation=\!xE %..................T
+\!wlet\!ticklocationincr=\!yE %..................T
+\!wlet\!tickwidth=\!yS %..................T
+\!wlet\!totalleaderlength=\!dimenE %.........U.........
+\!wlet\!xone=\!xprime %....X..............
+\!wlet\!xtwo=\!dxprime %....X..............
+\!wlet\!ySsave=\!yM %...................
+\!wlet\!ybB=\!yB %.................S.
+\!wlet\!ybC=\!yC %.................S.
+\!wlet\!ybE=\!yE %.................S.
+\!wlet\!ybM=\!yM %.................S.
+\!wlet\!ybS=\!yS %.................S.
+\!wlet\!ybpos=\!yyloc %.................S.
+\!wlet\!yone=\!yprime %....X..............
+\!wlet\!ytB=\!xB %.................S.
+\!wlet\!ytC=\!xC %.................S.
+\!wlet\!ytE=\!downlength %.................S.
+\!wlet\!ytM=\!arclength %.................S.
+\!wlet\!ytS=\!distacross %.................S.
+\!wlet\!ytpos=\!xxloc %.................S.
+\!wlet\!ytwo=\!dyprime %....X..............
+
+
+% Initial values for registers
+\!zpt=0pt % static
+\!xunit=1pt
+\!yunit=1pt
+\!arearloc=\!xunit
+\!areatloc=\!yunit
+\!dshade=5pt
+\!leaderlength=24in
+\!tfs=256 % static
+\!wmax=5.3pt % static
+\!wmin=2.7pt % static
+\!xaxislength=\!xunit
+\!xpivot=\!zpt
+\!yaxislength=\!yunit
+\!ypivot=\!zpt
+\plotsymbolspacing=.4pt
+ \!dimenA=50pt \!fiftypt=\!dimenA % static
+
+\!rootten=3.162278pt % static
+\!tenAa=8.690286pt % static (A5)
+\!tenAc=2.773839pt % static (A3)
+\!tenAe=2.543275pt % static (A1)
+
+% Initial values for control sequences
+\def\!cosrotationangle{1} %................R..
+\def\!sinrotationangle{0} %................R..
+\def\!xpivotcoord{0} %................R..
+\def\!xref{0} %............P......
+\def\!xshadesave{0} %.................S.
+\def\!ypivotcoord{0} %................R..
+\def\!yref{0} %............P......
+\def\!yshadesave{0} %.................S.
+\def\!zero{0} %..................T
+
+% Reset TeX to report allocations
+\let\wlog=\!!!wlog
+% *************************************
+% *** AREAS: Deals with plot areas ***
+% *************************************
+%
+% ** User commands
+% ** \setplotarea x from LEFT XCOORD to RIGTH XCOORD, y from BOTTOM YCOORD
+% ** to TOP YCOORD
+% ** \axis BOTTOM-LEFT-TOP-RIGHT [SHIFTEDTO xy=COORD] [VISIBLE-INVISIBLE]
+% ** [LABEL {label}] [TICKS] /
+% ** \visibleaxes
+% ** \invisibleaxes
+% ** \plotheading {HEADING}
+% ** \grid {# of columns} {# of rows}
+% ** \normalgraphs
+
+% ** \normalgraphs
+% ** Sets defaults for graph setup. See Subsection 3.4 of manual.
+\def\normalgraphs{%
+ \longticklength=.4\baselineskip
+ \shortticklength=.25\baselineskip
+ \tickstovaluesleading=.25\baselineskip
+ \valuestolabelleading=.8\baselineskip
+ \linethickness=.4pt
+ \stackleading=.17\baselineskip
+ \headingtoplotskip=1.5\baselineskip
+ \visibleaxes
+ \ticksout
+ \nogridlines
+ \unloggedticks}
+%
+% ** \setplotarea x from LEFT XCOORD to RIGTH XCOORD, y from BOTTOM YCOORD
+% ** to TOP YCOORD
+% ** Reserves space in PICBOX for a rectangular box with the indicated
+% ** coordinates. Must be specified before calls to \axis,
+% ** \grid, \plotheading.
+% ** See Subsection 3.1 of the manual.
+\def\setplotarea x from #1 to #2, y from #3 to #4 {%
+ \!arealloc=\!M{#1}\!xunit \advance \!arealloc -\!xorigin
+ \!areabloc=\!M{#3}\!yunit \advance \!areabloc -\!yorigin
+ \!arearloc=\!M{#2}\!xunit \advance \!arearloc -\!xorigin
+ \!areatloc=\!M{#4}\!yunit \advance \!areatloc -\!yorigin
+ \!initinboundscheck
+ \!xaxislength=\!arearloc \advance\!xaxislength -\!arealloc
+ \!yaxislength=\!areatloc \advance\!yaxislength -\!areabloc
+ \!plotheadingoffset=\!zpt
+ \!dimenput {{\setbox0=\hbox{}\wd0=\!xaxislength\ht0=\!yaxislength\box0}}
+ [bl] (\!arealloc,\!areabloc)}
+%
+% ** \visibleaxes, \invisibleaxes
+% ** Switches for setting visibility of subsequent axes.
+% ** See Subsection 3.2 of the manual.
+\def\visibleaxes{%
+ \def\!axisvisibility{\!axisvisibletrue}}
+\def\invisibleaxes{%
+ \def\!axisvisibility{\!axisvisiblefalse}}
+%
+% ** The next few macros enable the user to fix up an erroneous keyword
+% ** in the \axis command.
+% \newhelp is in ALLOCATIONS
+% \newhelp\!keywordhelp{The keyword mentioned in the error message in unknown.
+% Replace NEW KEYWORD in the indicated response by the keyword that
+% should have been specified.}
+
+\def\!fixkeyword#1{%
+ \errhelp=\!keywordhelp
+ \errmessage{Unrecognized keyword `#1': \the\!keywordtoks{NEW KEYWORD}'}}
+
+% \newtoks\!keywordtoks In ALLOCATIONS.
+\!keywordtoks={enter `i\fixkeyword}
+
+\def\fixkeyword#1{%
+ \!nextkeyword#1 }
+
+% ** \axis BOTTOM-LEFT-TOP-RIGHT [SHIFTEDTO xy=COORD] [VISIBLE-INVISIBLE]
+% ** [LABEL {label}] [TICKS] /
+% ** Exactly one of the keywords BOTTOM, LEFT, TOP, RIGHT must be
+% ** specified. Axis is drawn along the indicated edge of the current
+% ** plot area, shifted if the SHIFTEDTO option is used, visible or
+% ** invisible according the selected option, with an optional LABEL,
+% ** and optional TICKS (see ticks.tex for the options avialabel with
+% ** TICKS). The TICKS option must be the last one specified. The \axis
+% ** MUST be terminated with a / followed by a space.
+% ** See Subsection 3.2 of the manual for more information.
+
+% ** The various options of the \axis command are processed by the
+% ** \!nextkeyword macro defined below. For example,
+% ** `\!nextkeyword shiftedto ' expands to `\!axisshiftedto'.
+\def\axis {%
+ \def\!nextkeyword##1 {%
+ \expandafter\ifx\csname !axis##1\endcsname \relax
+ \def\!next{\!fixkeyword{##1}}%
+ \else
+ \def\!next{\csname !axis##1\endcsname}%
+ \fi
+ \!next}%
+ \!offset=\!zpt
+ \!axisvisibility
+ \!placeaxislabelfalse
+ \!nextkeyword}
+
+% ** This and the various macros that follow handle the keyword
+% ** specifications on the \axis command
+% ** See Subsection 3.2 of the manual.
+\def\!axisbottom{%
+ \!axisylevel=\!areabloc
+ \def\!tickxsign{0}%
+ \def\!tickysign{-}%
+ \def\!axissetup{\!axisxsetup}%
+ \def\!axislabeltbrl{t}%
+ \!nextkeyword}
+
+\def\!axistop{%
+ \!axisylevel=\!areatloc
+ \def\!tickxsign{0}%
+ \def\!tickysign{+}%
+ \def\!axissetup{\!axisxsetup}%
+ \def\!axislabeltbrl{b}%
+ \!nextkeyword}
+
+\def\!axisleft{%
+ \!axisxlevel=\!arealloc
+ \def\!tickxsign{-}%
+ \def\!tickysign{0}%
+ \def\!axissetup{\!axisysetup}%
+ \def\!axislabeltbrl{r}%
+ \!nextkeyword}
+
+\def\!axisright{%
+ \!axisxlevel=\!arearloc
+ \def\!tickxsign{+}%
+ \def\!tickysign{0}%
+ \def\!axissetup{\!axisysetup}%
+ \def\!axislabeltbrl{l}%
+ \!nextkeyword}
+
+\def\!axisshiftedto#1=#2 {%
+ \if 0\!tickxsign
+ \!axisylevel=\!M{#2}\!yunit
+ \advance\!axisylevel -\!yorigin
+ \else
+ \!axisxlevel=\!M{#2}\!xunit
+ \advance\!axisxlevel -\!xorigin
+ \fi
+ \!nextkeyword}
+
+\def\!axisvisible{%
+ \!axisvisibletrue
+ \!nextkeyword}
+
+\def\!axisinvisible{%
+ \!axisvisiblefalse
+ \!nextkeyword}
+
+\def\!axislabel#1 {%
+ \!axisLaBeL={#1}%
+ \!placeaxislabeltrue
+ \!nextkeyword}
+
+\expandafter\def\csname !axis/\endcsname{%
+ \!axissetup % This could done already by "ticks"; if so, now \relax
+ \if!placeaxislabel
+ \!placeaxislabel
+ \fi
+ \if +\!tickysign % ** (A "top" axis)
+ \!dimenA=\!axisylevel
+ \advance\!dimenA \!offset % ** dimA = top of the axis structure
+ \advance\!dimenA -\!areatloc % ** dimA = excess over the plot area
+ \ifdim \!dimenA>\!plotheadingoffset
+ \!plotheadingoffset=\!dimenA % ** Greatest excess over the plot area
+ \fi
+ \fi}
+
+% ** \grid {c} {r}
+% ** Partitions the plot area into c columns and r rows; see Subsection 3.3
+% ** of the manual.
+% ** (Other grid patterns can be drawn with the TICKS option of the \axis
+% ** command.
+\def\grid #1 #2 {%
+ \!countA=#1\advance\!countA 1
+ \axis bottom invisible ticks length <\!zpt> andacross quantity {\!countA} /
+ \!countA=#2\advance\!countA 1
+ \axis left invisible ticks length <\!zpt> andacross quantity {\!countA} / }
+
+% ** \plotheading{HEADING}
+% ** Places HEADING centered above the top of the plotarea (and above
+% ** any top axis ticks marks, tick labels, and axis label); see
+% ** Subsection 3.3 of the manual.
+\def\plotheading#1 {%
+ \advance\!plotheadingoffset \headingtoplotskip
+ \!dimenput {#1} [B] <.5\!xaxislength,\!plotheadingoffset>
+ (\!arealloc,\!areatloc)}
+
+% ** From here on, the routines are internal.
+\def\!axisxsetup{%
+ \!axisxlevel=\!arealloc
+ \!axisstart=\!arealloc
+ \!axisend=\!arearloc
+ \!axisLength=\!xaxislength
+ \!!origin=\!xorigin
+ \!!unit=\!xunit
+ \!xswitchtrue
+ \if!axisvisible
+ \!makeaxis
+ \fi}
+
+\def\!axisysetup{%
+ \!axisylevel=\!areabloc
+ \!axisstart=\!areabloc
+ \!axisend=\!areatloc
+ \!axisLength=\!yaxislength
+ \!!origin=\!yorigin
+ \!!unit=\!yunit
+ \!xswitchfalse
+ \if!axisvisible
+ \!makeaxis
+ \fi}
+
+\def\!makeaxis{%
+ \setbox\!boxA=\hbox{% (Make a pseudo-y[x] tick for an x[y]-axis)
+ \beginpicture
+ \!setdimenmode
+ \setcoordinatesystem point at {\!zpt} {\!zpt}
+ \putrule from {\!zpt} {\!zpt} to
+ {\!tickysign\!tickysign\!axisLength}
+ {\!tickxsign\!tickxsign\!axisLength}
+ \endpicturesave <\!Xsave,\!Ysave>}%
+ \wd\!boxA=\!zpt
+ \!placetick\!axisstart}
+
+\def\!placeaxislabel{%
+ \advance\!offset \valuestolabelleading
+ \if!xswitch
+ \!dimenput {\the\!axisLaBeL} [\!axislabeltbrl]
+ <.5\!axisLength,\!tickysign\!offset> (\!axisxlevel,\!axisylevel)
+ \advance\!offset \!dp % ** advance offset by the "tallness"
+ \advance\!offset \!ht % ** of the label
+ \else
+ \!dimenput {\the\!axisLaBeL} [\!axislabeltbrl]
+ <\!tickxsign\!offset,.5\!axisLength> (\!axisxlevel,\!axisylevel)
+ \fi
+ \!axisLaBeL={}}
+
+
+% *******************************
+% *** ARROWS (Draws arrows) ***
+% *******************************
+%
+% ** User commands
+% ** \arrow <ARROW HEAD LENGTH> [MID FRACTION, BASE FRACTION]
+% ** [<XSHIFT,YSHIFT>] from XFROM YFROM to XTO YTO
+% ** \betweenarrows {TEXT} [orientation & shift] from XFROM YFROM to XTO YTO
+
+% ** \arrow <ARROW HEAD LENGTH> [MID FRACTION, BASE FRACTION]
+% ** [<XSHIFT,YSHIFT>] from XFROM YFROM to XTO YTO
+% ** Draws an arrow from (XFROM,YFROM) to (XTO,YTO). The arrow head
+% ** is constructed two quadratic arcs, which extend back a distance
+% ** ARROW HEAD LENGTH (a dimension) on both sides of the arrow shaft.
+% ** All the way back the arcs are a distance BASE FRACTION*ARROW HEAD
+% ** LENGTH apart, while half-way back they are a distance MID FRACTION*
+% ** ARROW HEAD LENGTH apart. <XSHIFT,YSHIFT> is optional, and has
+% ** its usual interpreation. See Subsection 5.4 of the manual.
+
+\def\arrow <#1> [#2,#3]{%
+ \!ifnextchar<{\!arrow{#1}{#2}{#3}}{\!arrow{#1}{#2}{#3}<\!zpt,\!zpt> }}
+
+\def\!arrow#1#2#3<#4,#5> from #6 #7 to #8 #9 {%
+%
+% ** convert to dimensions
+ \!xloc=\!M{#8}\!xunit
+ \!yloc=\!M{#9}\!yunit
+ \!dxpos=\!xloc \!dimenA=\!M{#6}\!xunit \advance \!dxpos -\!dimenA
+ \!dypos=\!yloc \!dimenA=\!M{#7}\!yunit \advance \!dypos -\!dimenA
+ \let\!MAH=\!M% ** save current c/d mode
+ \!setdimenmode% ** go into dimension mode
+%
+ \!xshift=#4\relax \!yshift=#5\relax% ** pick up shift
+ \!reverserotateonly\!xshift\!yshift% ** back rotate shift
+ \advance\!xshift\!xloc \advance\!yshift\!yloc
+%
+% ** draw shaft of arrow
+ \!xS=-\!dxpos \advance\!xS\!xshift
+ \!yS=-\!dypos \advance\!yS\!yshift
+ \!start (\!xS,\!yS)
+ \!ljoin (\!xshift,\!yshift)
+%
+% ** find 32*cosine and 32*sine of angle of rotation
+ \!Pythag\!dxpos\!dypos\!arclength
+ \!divide\!dxpos\!arclength\!dxpos
+ \!dxpos=32\!dxpos \!removept\!dxpos\!!cos
+ \!divide\!dypos\!arclength\!dypos
+ \!dypos=32\!dypos \!removept\!dypos\!!sin
+%
+% ** construct arrowhead
+ \!halfhead{#1}{#2}{#3}% ** draw half of arrow head
+ \!halfhead{#1}{-#2}{-#3}% ** draw other half
+%
+ \let\!M=\!MAH% ** restore old c/d mode
+ \ignorespaces}
+%
+% ** draw half of arrow head
+ \def\!halfhead#1#2#3{%
+ \!dimenC=-#1%
+ \divide \!dimenC 2 % ** half way back
+ \!dimenD=#2\!dimenC% ** half the mid width
+ \!rotate(\!dimenC,\!dimenD)by(\!!cos,\!!sin)to(\!xM,\!yM)
+ \!dimenC=-#1% ** all the way back
+ \!dimenD=#3\!dimenC
+ \!dimenD=.5\!dimenD% ** half the full width
+ \!rotate(\!dimenC,\!dimenD)by(\!!cos,\!!sin)to(\!xE,\!yE)
+ \!start (\!xshift,\!yshift)
+ \advance\!xM\!xshift \advance\!yM\!yshift
+ \advance\!xE\!xshift \advance\!yE\!yshift
+ \!qjoin (\!xM,\!yM) (\!xE,\!yE)
+ \ignorespaces}
+
+
+% ** \betweenarrows {TEXT} [orientation & shift] from XFROM YFROM to XTO YTO
+% ** Makes things like <--- text --->, using arrow heads from TeX's fonts.
+% ** See Subsection 5.4 of the manual.
+\def\betweenarrows #1#2 from #3 #4 to #5 #6 {%
+ \!xloc=\!M{#3}\!xunit \!xxloc=\!M{#5}\!xunit%
+ \!yloc=\!M{#4}\!yunit \!yyloc=\!M{#6}\!yunit%
+ \!dxpos=\!xxloc \advance\!dxpos by -\!xloc
+ \!dypos=\!yyloc \advance\!dypos by -\!yloc
+ \advance\!xloc .5\!dxpos
+ \advance\!yloc .5\!dypos
+%
+ \let\!MBA=\!M% ** save current coord\dimen mode
+ \!setdimenmode% ** express locations in dimens
+ \ifdim\!dypos=\!zpt
+ \ifdim\!dxpos<\!zpt \!dxpos=-\!dxpos \fi
+ \put {\!lrarrows{\!dxpos}{#1}}#2{} at {\!xloc} {\!yloc}
+ \else
+ \ifdim\!dxpos=\!zpt
+ \ifdim\!dypos<\!zpt \!dypos=-\!zpt \fi
+ \put {\!udarrows{\!dypos}{#1}}#2{} at {\!xloc} {\!yloc}
+ \fi
+ \fi
+ \let\!M=\!MBA% ** restore previous c/d mode
+ \ignorespaces}
+
+% ** Subroutine for left-right between arrows
+\def\!lrarrows#1#2{% #1=width, #2=text
+ {\setbox\!boxA=\hbox{$\mkern-2mu\mathord-\mkern-2mu$}%
+ \setbox\!boxB=\hbox{$\leftarrow$}\!dimenE=\ht\!boxB
+ \setbox\!boxB=\hbox{}\ht\!boxB=2\!dimenE
+ \hbox to #1{$\mathord\leftarrow\mkern-6mu
+ \cleaders\copy\!boxA\hfil
+ \mkern-6mu\mathord-$%
+ \kern.4em $\vcenter{\box\!boxB}$$\vcenter{\hbox{#2}}$\kern.4em
+ $\mathord-\mkern-6mu
+ \cleaders\copy\!boxA\hfil
+ \mkern-6mu\mathord\rightarrow$}}}
+
+% ** Subroutine for up-down between arrows
+\def\!udarrows#1#2{% #1=width, #2=text
+ {\setbox\!boxB=\hbox{#2}%
+ \setbox\!boxA=\hbox to \wd\!boxB{\hss$\vert$\hss}%
+ \!dimenE=\ht\!boxA \advance\!dimenE \dp\!boxA \divide\!dimenE 2
+ \vbox to #1{\offinterlineskip
+ \vskip .05556\!dimenE
+ \hbox to \wd\!boxB{\hss$\mkern.4mu\uparrow$\hss}\vskip-\!dimenE
+ \cleaders\copy\!boxA\vfil
+ \vskip-\!dimenE\copy\!boxA
+ \vskip\!dimenE\copy\!boxB\vskip.4em
+ \copy\!boxA\vskip-\!dimenE
+ \cleaders\copy\!boxA\vfil
+ \vskip-\!dimenE \hbox to \wd\!boxB{\hss$\mkern.4mu\downarrow$\hss}
+ \vskip .05556\!dimenE}}}
+
+
+% ***************************
+% *** BARS (Draws bars) ***
+% ***************************
+%
+% ** User commands:
+% ** \putbar [<XSHIFT,YSHIFT>] breadth <BREADTH> from XSTART YSTART
+% ** to XEND YEND
+% ** \setbars [<XSHIFT,YSHIFT>] breadth <BREADTH> baseline at XY = COORD
+% ** [baselabels ([B_ORIENTATION_x,B_ORIENTATION_y] <B_XSHIFT,B_YSHIFT>)]
+% ** [endlabels ([E_ORIENTATION_x,E_ORIENTATION_y] <E_XSHIFT,E_YSHIFT>)]
+
+
+% ** \putbar [<XSHIFT,YSHIFT>] breadth <BREADTH> from XSTART YSTART
+% ** to XEND YEND
+% ** Either XSTART=XEND or YSTART=YEND. Draws a rectangle between
+% ** (XSTART,YSTART) & (XEND,YEND). The "depth" of the rectangle
+% ** is determined by those two plot positions; its other
+% ** dimension "breadth" is specified by the dimension BREADTH.
+% ** See Subsection 4.2 of the manual.
+\def\putbar#1breadth <#2> from #3 #4 to #5 #6 {%
+ \!xloc=\!M{#3}\!xunit \!xxloc=\!M{#5}\!xunit%
+ \!yloc=\!M{#4}\!yunit \!yyloc=\!M{#6}\!yunit%
+ \!dypos=\!yyloc \advance\!dypos by -\!yloc
+ \!dimenI=#2
+%
+ \ifdim \!dimenI=\!zpt % ** If 0 breadth
+ \putrule#1from {#3} {#4} to {#5} {#6} % ** Then draw line
+ \else % ** Else, put in a rectangle
+ \let\!MBar=\!M% ** save current c/d mode
+ \!setdimenmode % ** go into dimension mode
+ \divide\!dimenI 2
+ \ifdim \!dypos=\!zpt
+ \advance \!yloc -\!dimenI % ** Equal y coordinates
+ \advance \!yyloc \!dimenI
+ \else
+ \advance \!xloc -\!dimenI % ** Equal x coordinates
+ \advance \!xxloc \!dimenI
+ \fi
+ \putrectangle#1corners at {\!xloc} {\!yloc} and {\!xxloc} {\!yyloc}
+ \let\!M=\!MBar % ** restore c/d mode
+ \fi
+ \ignorespaces}
+
+
+% ** \setbars [<XSHIFT,YSHIFT>] breadth <BREADTH> baseline at XY = COORD
+% ** [baselabels ([B_ORIENTATION_x,B_ORIENTATION_y] <B_XSHIFT,B_YSHIFT>)]
+% ** [endlabels ([E_ORIENTATION_x,E_ORIENTATION_y] <E_XSHIFT,E_YSHIFT>)]
+% ** This command puts PiCTeX into the bar graph drawing mode described
+% ** in Subsection 4.4 of the manual.
+\def\setbars#1breadth <#2> baseline at #3 = #4 {%
+ \edef\!barshift{#1}%
+ \edef\!barbreadth{#2}%
+ \edef\!barorientation{#3}%
+ \edef\!barbaseline{#4}%
+ \def\!bardobaselabel{\!bardoendlabel}%
+ \def\!bardoendlabel{\!barfinish}%
+ \let\!drawcurve=\!barcurve
+ \!setbars}
+\def\!setbars{%
+ \futurelet\!nextchar\!!setbars}
+\def\!!setbars{%
+ \if b\!nextchar
+ \def\!!!setbars{\!setbarsbget}%
+ \else
+ \if e\!nextchar
+ \def\!!!setbars{\!setbarseget}%
+ \else
+ \def\!!!setbars{\relax}%
+ \fi
+ \fi
+ \!!!setbars}
+\def\!setbarsbget baselabels (#1) {%
+ \def\!barbaselabelorientation{#1}%
+ \def\!bardobaselabel{\!!bardobaselabel}%
+ \!setbars}
+\def\!setbarseget endlabels (#1) {%
+ \edef\!barendlabelorientation{#1}%
+ \def\!bardoendlabel{\!!bardoendlabel}%
+ \!setbars}
+
+% ** \!barcurve
+% ** Draws a bargraph with preset values of barshift, barbreadth,
+% ** barorientation (x or y) and barbaseline (coordinate)
+\def\!barcurve #1 #2 {%
+ \if y\!barorientation
+ \def\!basexarg{#1}%
+ \def\!baseyarg{\!barbaseline}%
+ \else
+ \def\!basexarg{\!barbaseline}%
+ \def\!baseyarg{#2}%
+ \fi
+ \expandafter\putbar\!barshift breadth <\!barbreadth> from {\!basexarg}
+ {\!baseyarg} to {#1} {#2}
+ \def\!endxarg{#1}%
+ \def\!endyarg{#2}%
+ \!bardobaselabel}
+
+\def\!!bardobaselabel "#1" {%
+ \put {#1}\!barbaselabelorientation{} at {\!basexarg} {\!baseyarg}
+ \!bardoendlabel}
+
+\def\!!bardoendlabel "#1" {%
+ \put {#1}\!barendlabelorientation{} at {\!endxarg} {\!endyarg}
+ \!barfinish}
+
+\def\!barfinish{%
+ \!ifnextchar/{\!finish}{\!barcurve}}
+
+
+% ********************************
+% *** BOXES (Draws rectangles) ***
+% ********************************
+%
+% ** User commands:
+% ** \putrectangle [<XSHIFT,YSHIFT>] corners at XCOORD1 YCOORD1
+% ** and XCOORD2 YCOORD2
+% ** \shaderectangleson
+% ** \shaderectanglesoff
+% ** \frame [<SEPARATION>] {TEXT}
+% ** \rectangle <WIDTH> <HEIGHT>
+%
+%
+% ** \putrectangle [<XSHIFT,YSHIFT>] corners at XCOORD1 YCOORD1
+% ** and XCOORD2 YCOORD2
+% ** Draws a rectangle with corners at (X1,Y1), (X2,Y1), (X1,Y2), (X2,Y2)
+% ** Lines have thickness \linethickness, and overlap at the corners.
+% ** The optional field <XSHIFT,YSHIFT> functions as with a \put command.
+% ** See Subsection 4.2 of the manual.
+\def\putrectangle{%
+ \!ifnextchar<{\!putrectangle}{\!putrectangle<\!zpt,\!zpt> }}
+\def\!putrectangle<#1,#2> corners at #3 #4 and #5 #6 {%
+%
+% ** get locations
+ \!xone=\!M{#3}\!xunit \!xtwo=\!M{#5}\!xunit%
+ \!yone=\!M{#4}\!yunit \!ytwo=\!M{#6}\!yunit%
+ \ifdim \!xtwo<\!xone
+ \!dimenI=\!xone \!xone=\!xtwo \!xtwo=\!dimenI
+ \fi
+ \ifdim \!ytwo<\!yone
+ \!dimenI=\!yone \!yone=\!ytwo \!ytwo=\!dimenI
+ \fi
+ \!dimenI=#1\relax \advance\!xone\!dimenI \advance\!xtwo\!dimenI
+ \!dimenI=#2\relax \advance\!yone\!dimenI \advance\!ytwo\!dimenI
+ \let\!MRect=\!M% ** save current coord/dimen mode
+ \!setdimenmode
+%
+% ** shade rectangle if appropriate
+ \!shaderectangle
+%
+% ** draw horizontal edges
+ \!dimenI=.5\linethickness
+ \advance \!xone -\!dimenI% ** adjust x-location to overlap corners
+ \advance \!xtwo \!dimenI% ** ditto
+ \putrule from {\!xone} {\!yone} to {\!xtwo} {\!yone}
+ \putrule from {\!xone} {\!ytwo} to {\!xtwo} {\!ytwo}
+%
+% ** draw vertical edges
+ \advance \!xone \!dimenI% ** restore original x-values
+ \advance \!xtwo -\!dimenI%
+ \advance \!yone -\!dimenI% ** adjust y-location to overlap corners
+ \advance \!ytwo \!dimenI% ** ditto
+ \putrule from {\!xone} {\!yone} to {\!xone} {\!ytwo}
+ \putrule from {\!xtwo} {\!yone} to {\!xtwo} {\!ytwo}
+%
+ \let\!M=\!MRect% ** restore coord/dimen mode
+ \ignorespaces}
+
+% ** \shaderectangleson
+% ** Subsequent rectangles will be shaded according to
+% ** the current shading pattern. Affects \putrectangle, \putbar,
+% ** \frame, \sethistograms, and \setbars. See Subsection 7.5 of the manual.
+\def\shaderectangleson{%
+ \def\!shaderectangle{\!!shaderectangle}%
+ \ignorespaces}
+% ** \shaderectanglesoff
+% ** Suppresses \shaderectangleson. The default.
+\def\shaderectanglesoff{%
+ \def\!shaderectangle{}%
+ \ignorespaces}
+
+\shaderectanglesoff
+
+% ** The following internal routine shades the current rectangle, when
+% ** \!shaderectangle = \!!shaderectangle .
+\def\!!shaderectangle{%
+ \!dimenA=\!xtwo \advance \!dimenA -\!xone
+ \!dimenB=\!ytwo \advance \!dimenB -\!yone
+ \ifdim \!dimenA<\!dimenB
+ \!startvshade (\!xone,\!yone,\!ytwo)
+ \!lshade (\!xtwo,\!yone,\!ytwo)
+ \else
+ \!starthshade (\!yone,\!xone,\!xtwo)
+ \!lshade (\!ytwo,\!xone,\!xtwo)
+ \fi
+ \ignorespaces}
+
+% ** \frame [<SEPARATION>] {TEXT}
+% ** Draws a frame of thickness linethickness about the box enclosing
+% ** TEXT; the frame is separated from the box by a distance of
+% ** SEPARATION. The result is an hbox with the same baseline as TEXT.
+% ** If <SEPARATION> is omitted, you get the effect of <0pt>.
+% ** See Subsection 4.2 of the manual.
+\def\frame{%
+ \!ifnextchar<{\!frame}{\!frame<\!zpt> }}
+\long\def\!frame<#1> #2{%
+ \beginpicture
+ \setcoordinatesystem units <1pt,1pt> point at 0 0
+ \put {#2} [Bl] at 0 0
+ \!dimenA=#1\relax
+ \!dimenB=\!wd \advance \!dimenB \!dimenA
+ \!dimenC=\!ht \advance \!dimenC \!dimenA
+ \!dimenD=\!dp \advance \!dimenD \!dimenA
+ \let\!MFr=\!M
+ \!setdimenmode
+ \putrectangle corners at {-\!dimenA} {-\!dimenD} and {\!dimenB} {\!dimenC}
+ \!setcoordmode
+ \let\!M=\!MFr
+ \endpicture
+ \ignorespaces}
+
+% ** \rectangle <WIDTH> <HEIGHT>
+% ** Constructs a rectangle of width WIDTH and heigth HEIGHT.
+% ** See Subsection 4.2 of the manual.
+\def\rectangle <#1> <#2> {%
+ \setbox0=\hbox{}\wd0=#1\ht0=#2\frame {\box0}}
+
+
+% *********************************************
+% *** CURVES (Upper level \plot commands) ***
+% *********************************************
+%
+% ** User commands
+% ** \plot DATA /
+% ** \plot "FILE NAME"
+% ** \setquadratic
+% ** \setlinear
+% ** \sethistograms
+% ** \vshade ...
+% ** \hshade ...
+
+% \plot: multi-purpose command. Draws histograms, bar graphs, piecewise-linear
+% or piecewise quadratic curves, depending on the setting of \!drawcurve.
+% See Subsections 4.3-4.5, 5.1, 5.2 of the manual.
+\def\plot{%
+ \!ifnextchar"{\!plotfromfile}{\!drawcurve}}
+\def\!plotfromfile"#1"{%
+ \expandafter\!drawcurve \input #1 /}
+
+% Command to set piecewise quadratic mode
+% See Subsections 5.1, 7.3, and 7.4 of the manual.
+\def\setquadratic{%
+ \let\!drawcurve=\!qcurve
+ \let\!!Shade=\!!qShade
+ \let\!!!Shade=\!!!qShade}
+
+% Command to set piecewise linear mode
+% See Subsections 5.1, 7.3, and 7.4 of the manual.
+\def\setlinear{%
+ \let\!drawcurve=\!lcurve
+ \let\!!Shade=\!!lShade
+ \let\!!!Shade=\!!!lShade}
+
+% Command to set histogram mode
+% See Subsection 4.3 of the manual.
+\def\sethistograms{%
+ \let\!drawcurve=\!hcurve}
+
+% Commands to cycle through list of coordinates in piecewise quadratic
+% interpolation mode
+\def\!qcurve #1 #2 {%
+ \!start (#1,#2)
+ \!Qjoin}
+\def\!Qjoin#1 #2 #3 #4 {%
+ \!qjoin (#1,#2) (#3,#4) % \!qjoin is defined in QUADRATIC
+ \!ifnextchar/{\!finish}{\!Qjoin}}
+
+% Commands to cycle through list of coordinates in piecewise linear
+% interpolation mode
+\def\!lcurve #1 #2 {%
+ \!start (#1,#2)
+ \!Ljoin}
+\def\!Ljoin#1 #2 {%
+ \!ljoin (#1,#2) % \!ljoin is defined in LINEAR
+ \!ifnextchar/{\!finish}{\!Ljoin}}
+
+\def\!finish/{\ignorespaces}
+
+% Command to cycle through list of coordinates in histogram mode
+\def\!hcurve #1 #2 {%
+ \edef\!hxS{#1}%
+ \edef\!hyS{#2}%
+ \!hjoin}
+\def\!hjoin#1 #2 {%
+ \putrectangle corners at {\!hxS} {\!hyS} and {#1} {#2}
+ \edef\!hxS{#1}%
+ \!ifnextchar/{\!finish}{\!hjoin}}
+
+
+% \vshade: See Subsection 7.3 of the manual.
+\def\vshade #1 #2 #3 {%
+ \!startvshade (#1,#2,#3)
+ \!Shadewhat}
+
+% \hshade: See Subsection 7.4 of the manual.
+\def\hshade #1 #2 #3 {%
+ \!starthshade (#1,#2,#3)
+ \!Shadewhat}
+
+% Commands to cycle through coordinates and optional "edge effect"
+% fields while shading.
+\def\!Shadewhat{%
+ \futurelet\!nextchar\!Shade}
+\def\!Shade{%
+ \if <\!nextchar
+ \def\!nextShade{\!!Shade}%
+ \else
+ \if /\!nextchar
+ \def\!nextShade{\!finish}%
+ \else
+ \def\!nextShade{\!!!Shade}%
+ \fi
+ \fi
+ \!nextShade}
+\def\!!lShade<#1> #2 #3 #4 {%
+ \!lshade <#1> (#2,#3,#4) % \!lshade is defined in SHADING
+ \!Shadewhat}
+\def\!!!lShade#1 #2 #3 {%
+ \!lshade (#1,#2,#3)
+ \!Shadewhat}
+\def\!!qShade<#1> #2 #3 #4 #5 #6 #7 {%
+ \!qshade <#1> (#2,#3,#4) (#5,#6,#7) % \!qshade is defined in SHADING
+ \!Shadewhat}
+\def\!!!qShade#1 #2 #3 #4 #5 #6 {%
+ \!qshade (#1,#2,#3) (#4,#5,#6)
+ \!Shadewhat}
+
+% ** Set default interpolation mode
+\setlinear
+
+
+% ********************************************
+% *** DASHPATTERNS (Sets up dash patterns) ***
+% ********************************************
+
+% ** User commands:
+% ** \setdashpattern <DIMEN1,DIMEN2,DIMEN3,...>
+% ** \setdots <INTRADOT_DISTANCE>
+% ** \setdotsnear <INTRADOT_DISTANCE> for <ARC LENGTH>
+% ** \setdashes <DASH/SKIP_DISTANCE>
+% ** \setdashesnear <DASH/SKIP_DISTANCE> for <ARC LENGTH>
+% ** \setsolid
+% ** \findlength {CURVE CMDS}
+
+% ** Internal commands:
+% ** \!dashingon
+% ** \!dashingoff
+
+% ** Dash patterns are specified by a balanced token list whose complete
+% ** expansion has the form: DIMEN1,DIMEN2,DIMEN3,DIMEN4,... ; this produces
+% ** an arc of length DIMEN1, a skip of length DIMEN2, an arc of length
+% ** DIMEN3, a skip of length DIMEN4, ... . Any number of DIMEN values may
+% ** be given. The pattern is repeated as many times (perhaps fractional)
+% ** as necessary to draw the curve.
+% ** A dash pattern remains in effect until it is overridden by a call to
+% ** \setdashpattern, or to \setdots, \setdotsnear ... , \setdashes,
+% ** \setdashesnear ... , or \setsolid.
+% ** Solid lines are the default.
+
+
+% ** \def\setdashpattern <DIMEN1,DIMEN2,DIMEN3,...>
+% ** The following routine converts a balanced list of tokens whose
+% ** complete expansion has the form DIMEN1,DIMEN2, ... , DIMENk into
+% ** three list macros that are used in drawing dashed rules and curves:
+% ** !Flist: \!Rule{DIMEN1}\!Skip{DIMEN2}\!Rule{DIMEN3}\!Skip{DIMEN4} ...
+% ** !Blist: ...\!Skip{DIMEN4}\!Rule{DIMEN3}\!Skip{DIMEN2}\!Rule{DIMEN1}
+% ** !UDlist: \\{DIMEN1}\\{DIMEN2}\\{DIMEN3}\\{DIMEN4} ...;
+% ** calculates \!leaderlength := DIMEN1 + ... + DIMENk; and
+% ** sets the curve drawing routines to dash mode.
+% ** Those lists are used by the curve drawing routines.
+% ** Dimenj ... may be given as an explicit dimension (e.g., 5pt), or
+% ** as an expression involving a dimension register (e.g., -2.5\dimen0).
+% ** See Subsection 6.2 of the manual
+\def\setdashpattern <#1>{%
+ \def\!Flist{}\def\!Blist{}\def\!UDlist{}%
+ \!countA=0
+ \!ecfor\!item:=#1\do{%
+ \!dimenA=\!item\relax
+ \expandafter\!rightappend\the\!dimenA\withCS{\\}\to\!UDlist%
+ \advance\!countA 1
+ \ifodd\!countA
+ \expandafter\!rightappend\the\!dimenA\withCS{\!Rule}\to\!Flist%
+ \expandafter\!leftappend\the\!dimenA\withCS{\!Rule}\to\!Blist%
+ \else
+ \expandafter\!rightappend\the\!dimenA\withCS{\!Skip}\to\!Flist%
+ \expandafter\!leftappend\the\!dimenA\withCS{\!Skip}\to\!Blist%
+ \fi}%
+ \!leaderlength=\!zpt
+ \def\!Rule##1{\advance\!leaderlength ##1}%
+ \def\!Skip##1{\advance\!leaderlength ##1}%
+ \!Flist%
+ \ifdim\!leaderlength>\!zpt
+ \else
+ \def\!Flist{\!Skip{24in}}\def\!Blist{\!Skip{24in}}\ignorespaces
+ \def\!UDlist{\\{\!zpt}\\{24in}}\ignorespaces
+ \!leaderlength=24in
+ \fi
+ \!dashingon}
+
+
+% ** \!dashingon -- puts the curve drawing routines into dash mode
+% ** \!dashingoff -- puts the curve drawing routines into solid mode
+% ** These are internal commands, invoked by \setdashpattern and \setsolid
+\def\!dashingon{%
+ \def\!advancedashing{\!!advancedashing}%
+ \def\!drawlinearsegment{\!lineardashed}%
+ \def\!puthline{\!putdashedhline}%
+ \def\!putvline{\!putdashedvline}%
+% \def\!putsline{\!putdashedsline}%
+ \ignorespaces}%
+\def\!dashingoff{%
+ \def\!advancedashing{\relax}%
+ \def\!drawlinearsegment{\!linearsolid}%
+ \def\!puthline{\!putsolidhline}%
+ \def\!putvline{\!putsolidvline}%
+% \def\!putsline{\!putsolidsline}%
+ \ignorespaces}
+
+
+% ** \setdots <LENGTH> -- sets up a dot/skip pattern where dot (actually
+% ** the current plotsymbol) is plunked down once for every LENGTH
+% ** traveled along the curve. LENGTH defaults to 5pt.
+% ** See Subsection 6.1 of the manual.
+\def\setdots{%
+ \!ifnextchar<{\!setdots}{\!setdots<5pt>}}
+\def\!setdots<#1>{%
+ \!dimenB=#1\advance\!dimenB -\plotsymbolspacing
+ \ifdim\!dimenB<\!zpt
+ \!dimenB=\!zpt
+ \fi
+\setdashpattern <\plotsymbolspacing,\!dimenB>}
+
+% ** \setdotsnear <LENGTH> for <ARC LENGTH>
+% ** sets up a dot pattern where the dots are approximately LENGTH apart,
+% ** the total length of the pattern is ARC LENGTH, and the pattern
+% ** begins and ends with a dot. See Subsection 6.3 of the manual.
+\def\setdotsnear <#1> for <#2>{%
+ \!dimenB=#2\relax \advance\!dimenB -.05pt
+ \!dimenC=#1\relax \!countA=\!dimenC
+ \!dimenD=\!dimenB \advance\!dimenD .5\!dimenC \!countB=\!dimenD
+ \divide \!countB \!countA
+ \ifnum 1>\!countB
+ \!countB=1
+ \fi
+ \divide\!dimenB \!countB
+ \setdots <\!dimenB>}
+
+% ** \setdashes <LENGTH> -- sets up a dash/skip pattern where the dash
+% ** and the skip are each of length LENGTH (the dash is formed by
+% ** plunking down the current plotsymbol over an arc of length LENGTH
+% ** and so may actually be longer than LENGTH. LENGTH defaults to 5pt.
+% ** See Subsection 6.1 of the manual.
+\def\setdashes{%
+ \!ifnextchar<{\!setdashes}{\!setdashes<5pt>}}
+\def\!setdashes<#1>{\setdashpattern <#1,#1>}
+
+% ** \setdashesnear ...
+% ** Like \setdotsnear; the pattern begins and ends with a dash.
+% ** See Subsection 6.3 of the manual.
+\def\setdashesnear <#1> for <#2>{%
+ \!dimenB=#2\relax
+ \!dimenC=#1\relax \!countA=\!dimenC
+ \!dimenD=\!dimenB \advance\!dimenD .5\!dimenC \!countB=\!dimenD
+ \divide \!countB \!countA
+ \ifodd \!countB
+ \else
+ \advance \!countB 1
+ \fi
+ \divide\!dimenB \!countB
+ \setdashes <\!dimenB>}
+
+% ** \setsolid -- puts the curve drawing routines in "solid line" mode,
+% ** the default mode. See Subsection 6.1 of the manual.
+\def\setsolid{%
+ \def\!Flist{\!Rule{24in}}\def\!Blist{\!Rule{24in}}%
+ \def\!UDlist{\\{24in}\\{\!zpt}}%
+ \!dashingoff}
+\setsolid
+
+% ** \findlength {CURVE CMDS}
+% ** PiCTeX executes the \start, \ljoin, and \qjoin cmds comprising
+% ** CURVE CMDS without plotting anything, but stashes the length
+% ** of the phantom curve away in \totalarclength.
+% ** See Subsection 6.3 of the manual.
+\def\findlength#1{%
+ \begingroup
+ \setdashpattern <0pt, \maxdimen>
+ \setplotsymbol ({})
+ \dontsavelinesandcurves
+ #1%
+ \endgroup
+ \ignorespaces}
+
+
+% *************************************************************
+% *** DIVISION (Does long division of dimension registers) ***
+% *************************************************************
+
+% ** User command:
+% ** \Divide {DIVIDEND} by {DIVISOR} forming {RESULT}
+
+% ** Internal command
+% ** \!divide{DIVIDEND}{DIVISOR}{RESULT}
+
+% ** \!divide DIVIDEND [by] DIVISOR [to get] ANSWER
+% ** Divides the dimension DIVIDEND by the dimension DIVISOR, placing the
+% ** quotient in the dimension register ANSWER. Values are understood to
+% ** be in points. E.g. 12.5pt/1.4pt=8.92857pt.
+% ** Quotient is accurate to 1/65536pt=2**[-16]pt
+% ** |DIVISOR| should be < 2048pt (about 28 inches).
+\def\!divide#1#2#3{%
+ \!dimenB=#1% ** dimB holds current remainder (r)
+ \!dimenC=#2% ** dimC holds divisor (d)
+ \!dimenD=\!dimenB% ** dimD holds quotient q=r/d for this
+ \divide \!dimenD \!dimenC% ** step, in units of scaled pts
+ \!dimenA=\!dimenD% ** dimA eventually holds answer (a)
+ \multiply\!dimenD \!dimenC% ** r <-- r - dq
+ \advance\!dimenB -\!dimenD% ** First step complete. Have integer part
+% ** of a, and corresponding remainder.
+ \!dimenD=\!dimenC% ** Temporarily use dimD to hold |d|
+ \ifdim\!dimenD<\!zpt \!dimenD=-\!dimenD
+ \fi
+ \ifdim\!dimenD<64pt% ** Branch on the magnitude of |d|
+ \!divstep[\!tfs]\!divstep[\!tfs]%
+ \else
+ \!!divide
+ \fi
+ #3=\!dimenA\ignorespaces}
+
+% ** The following code handles divisors d with
+% ** (1) .88in = 64pt <= d < 256pt = 3.54in
+% ** (2) 3.54in = 256pt <= d < 2048pt = 28.34in
+% ** Anything bigger than that may result in an overflow condition.
+% ** For our purposes, we should never even see case (2).
+\def\!!divide{%
+ \ifdim\!dimenD<256pt
+ \!divstep[64]\!divstep[32]\!divstep[32]%
+ \else
+ \!divstep[8]\!divstep[8]\!divstep[8]\!divstep[8]\!divstep[8]%
+ \!dimenA=2\!dimenA
+ \fi}
+
+
+% ** The following macro does the real long division work.
+\def\!divstep[#1]{% ** #1 = "B"
+ \!dimenB=#1\!dimenB% ** r <-- B*r
+ \!dimenD=\!dimenB% ** dimD holds quotient q=r/d for this
+ \divide \!dimenD by \!dimenC% ** step, in units of scaled pts
+ \!dimenA=#1\!dimenA% ** a <-- B*a + q
+ \advance\!dimenA by \!dimenD%
+ \multiply\!dimenD by \!dimenC% ** r <-- r - dq
+ \advance\!dimenB by -\!dimenD}
+
+% ** \Divide: See Subsection 9.3 of the manual.
+\def\Divide <#1> by <#2> forming <#3> {%
+ \!divide{#1}{#2}{#3}}
+
+
+% *********************************************
+% *** ELLIPSES (Draws ellipses and circles) ***
+% *********************************************
+
+% ** User commands
+% ** \ellipticalarc axes ratio A:B DEGREES degrees from XSTART YSTART
+% ** center at XCENTER YCENTER
+% ** \circulararc DEGREES degrees from XSTART YSTART
+% ** center at XCENTER YCENTER
+
+% ** Internal command
+% ** \!sinandcos{32*ANGLE in radians}{32*SIN}{32*COS}
+
+
+% ** \ellipticalarc axes ratio A:B DEGREES degrees from XSTART YSTART
+% ** center at XCENTER YCENTER
+% ** Draws a elliptical arc starting at the coordinate point (XSTART,YSTART).
+% ** The center of the ellipse of which the arc is a segment is at
+% ** (XCENTER,YCENTER).
+% ** The arc extends through an angle of DEGREES degrees (may be + or -).
+% ** A:B is the ratio of the length of the xaxis to the length of
+% ** the yaxis of the ellipse
+% ** Sqrt{[(XSTART-XCENTER)/A]**2 + [(YSTART-YCENTER)/B]**2}
+% ** must be < 512pt (about 7in).
+% ** Doesn't modify the dimensions (ht, dp, wd) of the PiCture under
+% ** construction.
+
+% ** \circulararc -- See Subsection 5.3 of the manual.
+\def\circulararc{%
+ \ellipticalarc axes ratio 1:1 }
+
+% ** \ellipticalarc -- See Subsection 5.3 of the manual.
+\def\ellipticalarc axes ratio #1:#2 #3 degrees from #4 #5 center at #6 #7 {%
+ \!angle=#3pt\relax% ** get angle
+ \ifdim\!angle>\!zpt
+ \def\!sign{}% ** counterclockwise
+ \else
+ \def\!sign{-}\!angle=-\!angle% ** clockwise
+ \fi
+ \!xxloc=\!M{#6}\!xunit% ** convert CENTER to dimension
+ \!yyloc=\!M{#7}\!yunit
+ \!xxS=\!M{#4}\!xunit% ** get STARTing point on rim of ellipse
+ \!yyS=\!M{#5}\!yunit
+ \advance\!xxS -\!xxloc% ** make center of ellipse (0,0)
+ \advance\!yyS -\!yyloc
+ \!divide\!xxS{#1pt}\!xxS % ** scale point on ellipse to point on
+ \!divide\!yyS{#2pt}\!yyS % corresponding circle
+%
+ \let\!MC=\!M% ** save current c/d mode
+ \!setdimenmode% ** go into dimension mode
+%
+ \!xS=#1\!xxS \advance\!xS\!xxloc
+ \!yS=#2\!yyS \advance\!yS\!yyloc
+ \!start (\!xS,\!yS)%
+ \!loop\ifdim\!angle>14.9999pt% ** draw in major portion of ellipse
+ \!rotate(\!xxS,\!yyS)by(\!cos,\!sign\!sin)to(\!xxM,\!yyM)
+ \!rotate(\!xxM,\!yyM)by(\!cos,\!sign\!sin)to(\!xxE,\!yyE)
+ \!xM=#1\!xxM \advance\!xM\!xxloc \!yM=#2\!yyM \advance\!yM\!yyloc
+ \!xE=#1\!xxE \advance\!xE\!xxloc \!yE=#2\!yyE \advance\!yE\!yyloc
+ \!qjoin (\!xM,\!yM) (\!xE,\!yE)
+ \!xxS=\!xxE \!yyS=\!yyE
+ \advance \!angle -15pt
+ \repeat
+ \ifdim\!angle>\!zpt% ** complete remaining arc, if any
+ \!angle=100.53096\!angle% ** convert angle to radians, divide
+ \divide \!angle 360 % ** by 2, and multiply by 32
+ \!sinandcos\!angle\!!sin\!!cos% ** get 32*sin & 32*cos
+ \!rotate(\!xxS,\!yyS)by(\!!cos,\!sign\!!sin)to(\!xxM,\!yyM)
+ \!rotate(\!xxM,\!yyM)by(\!!cos,\!sign\!!sin)to(\!xxE,\!yyE)
+ \!xM=#1\!xxM \advance\!xM\!xxloc \!yM=#2\!yyM \advance\!yM\!yyloc
+ \!xE=#1\!xxE \advance\!xE\!xxloc \!yE=#2\!yyE \advance\!yE\!yyloc
+ \!qjoin (\!xM,\!yM) (\!xE,\!yE)
+ \fi
+%
+ \let\!M=\!MC% ** restore c/d mode
+ \ignorespaces}% ** if appropriate
+
+
+% ** \!rotate(XREG,YREG)by(32cos,32sin)to(XXREG,YYREG)
+% ** rotates (XREG,YREG) by angle with specfied scaled cos & sin to
+% ** (XXREG,YYREG). Uses \!dimenA & \!dimenB as scratch registers.
+\def\!rotate(#1,#2)by(#3,#4)to(#5,#6){%
+ \!dimenA=#3#1\advance \!dimenA -#4#2% ** Rcos(x+t)=Rcosx*cost - Rsinx*sint
+ \!dimenB=#3#2\advance \!dimenB #4#1% ** Rsin(x+t)=Rsinx*cost + Rcosx*sint
+ \divide \!dimenA 32 \divide \!dimenB 32
+ #5=\!dimenA #6=\!dimenB
+ \ignorespaces}
+\def\!sin{4.17684}% ** 32*sin(pi/24) (pi/24=7.5deg)
+\def\!cos{31.72624}% ** 32*cos(pi/24)
+
+
+% ** \!sinandcos{32*ANGLE in radians}{\SINCS}{\COSCS}
+% ** Computes the 32*sine and 32*cosine of a small ANGLE expressed in
+% ** radians/32 and puts these values in the replacement texts of
+% ** \SINCS and \COSCS
+\def\!sinandcos#1#2#3{%
+ \!dimenD=#1% ** angle is expressed in radians/32: 1pt = 1/32rad
+ \!dimenA=\!dimenD% ** dimA will eventually contain 32sin(angle)in pts
+ \!dimenB=32pt% ** dimB will eventually contain 32cos(angle)in pts
+ \!removept\!dimenD\!value% ** get value of 32*angle, without "pt"
+ \!dimenC=\!dimenD% ** holds 32*angle**i/i! in pts
+ \!dimenC=\!value\!dimenC \divide\!dimenC by 64 % ** now 32*angle**2/2
+ \advance\!dimenB by -\!dimenC% ** 32-32*angle**2/2
+ \!dimenC=\!value\!dimenC \divide\!dimenC by 96 % ** now 32*angle**3/3!
+ \advance\!dimenA by -\!dimenC% ** now 32*(angle-angle**3/6)
+ \!dimenC=\!value\!dimenC \divide\!dimenC by 128 % ** now 32*angle**4/4!
+ \advance\!dimenB by \!dimenC%
+ \!removept\!dimenA#2% ** set 32*sin(angle)
+ \!removept\!dimenB#3% ** set 32*cos(angle)
+ \ignorespaces}
+
+
+% *****************************************************************
+% *** RULES (Draws rules, i.e., horizontal & vertical lines) ***
+% *****************************************************************
+
+% ** User command:
+% ** \putrule [<XDIMEN,YDIMEN>] from XCOORD1 YCOORD1
+% ** to XCOORD2 YCOORD2
+
+% ** Internal commands:
+% ** \!puthline [<XDIMEN,YDIMEN>] (h = horizontal)
+% ** Set by dashpat to either: \!putsolidhline or \!putdashedhline
+% ** \!putvline [<XDIMEN,YDIMEN>] (v = vertical)
+% ** Either: \!putsolidvline or \!putdashedvline
+
+
+% ** \putrule [<XDIMEN,YDIMEN>] from XCOORD1 YCOORD1
+% ** to XCOORD2 YCOORD2
+% ** Draws a rule -- dashed or solid depending on the current dash pattern --
+% ** from (X1,Y1) to (X2,Y2). Uses TEK's \hrule & \vrule & \leaders
+% ** constructions to handle horizontal & vertical lines efficiently both
+% ** in terms of execution time and space in the DVI file.
+% ** See Subsection 4.1 of the manual.
+\def\putrule#1from #2 #3 to #4 #5 {%
+ \!xloc=\!M{#2}\!xunit \!xxloc=\!M{#4}\!xunit%
+ \!yloc=\!M{#3}\!yunit \!yyloc=\!M{#5}\!yunit%
+ \!dxpos=\!xxloc \advance\!dxpos by -\!xloc
+ \!dypos=\!yyloc \advance\!dypos by -\!yloc
+%
+ \ifdim\!dypos=\!zpt
+ \def\!!Line{\!puthline{#1}}\ignorespaces
+ \else
+ \ifdim\!dxpos=\!zpt
+ \def\!!Line{\!putvline{#1}}\ignorespaces
+ \else
+ \def\!!Line{}
+ \fi
+ \fi
+ \let\!ML=\!M% ** save current coord\dimen mode
+ \!setdimenmode% ** express locations in dimens
+ \!!Line%
+ \let\!M=\!ML% ** restore previous c/d mode
+ \ignorespaces}
+
+
+% ** \!putsolidhline [<XDIMEN,YDIMEN>]
+% ** Place horizontal solid line
+\def\!putsolidhline#1{%
+ \ifdim\!dxpos>\!zpt
+ \put{\!hline\!dxpos}#1[l] at {\!xloc} {\!yloc}
+ \else
+ \put{\!hline{-\!dxpos}}#1[l] at {\!xxloc} {\!yyloc}
+ \fi
+ \ignorespaces}
+
+% ** \!putsolidvline [shifted <XDIMEN,YDIMEN>]
+% ** Place vertical solid line
+\def\!putsolidvline#1{%
+ \ifdim\!dypos>\!zpt
+ \put{\!vline\!dypos}#1[b] at {\!xloc} {\!yloc}
+ \else
+ \put{\!vline{-\!dypos}}#1[b] at {\!xxloc} {\!yyloc}
+ \fi
+ \ignorespaces}
+
+\def\!hline#1{\hbox to #1{\leaders \hrule height\linethickness\hfill}}
+\def\!vline#1{\vbox to #1{\leaders \vrule width\linethickness\vfill}}
+
+
+% ** \!putdashedhline [<XDIMEN,YDIMEN>]
+% ** Place dashed horizontal line
+\def\!putdashedhline#1{%
+ \ifdim\!dxpos>\!zpt
+ \!DLsetup\!Flist\!dxpos
+ \put{\hbox to \!totalleaderlength{\!hleaders}\!hpartialpattern\!Rtrunc}
+ #1[l] at {\!xloc} {\!yloc}
+ \else
+ \!DLsetup\!Blist{-\!dxpos}
+ \put{\!hpartialpattern\!Ltrunc\hbox to \!totalleaderlength{\!hleaders}}
+ #1[r] at {\!xloc} {\!yloc}
+ \fi
+ \ignorespaces}
+
+% ** \!putdashedhline [<XDIMEN,YDIMEN>]
+% ** Place dashed vertical line
+\def\!putdashedvline#1{%
+ \!dypos=-\!dypos% ** vertical leaders go from top to bottom
+ \ifdim\!dypos>\!zpt
+ \!DLsetup\!Flist\!dypos
+ \put{\vbox{\vbox to \!totalleaderlength{\!vleaders}
+ \!vpartialpattern\!Rtrunc}}#1[t] at {\!xloc} {\!yloc}
+ \else
+ \!DLsetup\!Blist{-\!dypos}
+ \put{\vbox{\!vpartialpattern\!Ltrunc
+ \vbox to \!totalleaderlength{\!vleaders}}}#1[b] at {\!xloc} {\!yloc}
+ \fi
+ \ignorespaces}
+
+
+% ** The rest of the macros in this section are subroutines used by
+% ** \!putdashedhline and \!putdashedvline.
+\def\!DLsetup#1#2{% ** Dashed-Line set up
+ \let\!RSlist=#1% ** set !Rule-Skip list
+ \!countB=#2% ** convert rule length to integer (number of sps)
+ \!countA=\!leaderlength% ** ditto, leaderlength
+ \divide\!countB by \!countA% ** number of complete leader units
+ \!totalleaderlength=\!countB\!leaderlength
+ \!Rresiduallength=#2%
+ \advance \!Rresiduallength by -\!totalleaderlength% \** excess length
+ \!Lresiduallength=\!leaderlength
+ \advance \!Lresiduallength by -\!Rresiduallength
+ \ignorespaces}
+
+\def\!hleaders{%
+ \def\!Rule##1{\vrule height\linethickness width##1}%
+ \def\!Skip##1{\hskip##1}%
+ \leaders\hbox{\!RSlist}\hfill}
+
+\def\!hpartialpattern#1{%
+ \!dimenA=\!zpt \!dimenB=\!zpt
+ \def\!Rule##1{#1{##1}\vrule height\linethickness width\!dimenD}%
+ \def\!Skip##1{#1{##1}\hskip\!dimenD}%
+ \!RSlist}
+
+\def\!vleaders{%
+ \def\!Rule##1{\hrule width\linethickness height##1}%
+ \def\!Skip##1{\vskip##1}%
+ \leaders\vbox{\!RSlist}\vfill}
+
+\def\!vpartialpattern#1{%
+ \!dimenA=\!zpt \!dimenB=\!zpt
+ \def\!Rule##1{#1{##1}\hrule width\linethickness height\!dimenD}%
+ \def\!Skip##1{#1{##1}\vskip\!dimenD}%
+ \!RSlist}
+
+\def\!Rtrunc#1{\!trunc{#1}>\!Rresiduallength}
+\def\!Ltrunc#1{\!trunc{#1}<\!Lresiduallength}
+
+\def\!trunc#1#2#3{%
+ \!dimenA=\!dimenB
+ \advance\!dimenB by #1%
+ \!dimenD=\!dimenB \ifdim\!dimenD#2#3\!dimenD=#3\fi
+ \!dimenC=\!dimenA \ifdim\!dimenC#2#3\!dimenC=#3\fi
+ \advance \!dimenD by -\!dimenC}
+
+
+% ****************************************************************
+% *** LINEAR ARC (Draws straight lines -- solid and dashed) ***
+% ****************************************************************
+
+% ** User commands
+% ** \inboundscheckoff
+% ** \inboundscheckon
+
+% ** Internal commands
+% ** \!start (XCOORD,YCOORD)
+% ** \!ljoin (XCOORD,YCOORD)
+% ** \!drawlinearsegment -- set by \dashpat to either
+% ** \!linearsolid or \!lineardashed
+% ** \!advancedashing -- set by \dashpat to either
+% ** \relax or \!!advancedashing
+% ** \!plotifinbounds -- set by \inboundscheck off/on to either
+% ** \!plot or \!!plotifinbounds
+% ** \!initinboundscheck -- set by \inboundscheck off/on to either
+% ** \relax or \!!initinboundscheck
+
+
+% \plotsymbolspacing ** distance between consecutive plot positions
+% \!xS ** starting x
+% \!yS ** starting y
+% \!xE ** ending x
+% \!yE ** ending y
+% \!xdiff ** x_end - x_start
+% \!ydiff ** y_end - y_start
+% \!distacross ** how far along curve next point to be plotted is
+% \!arclength ** approximate length of arc for current interval
+% \!downlength ** remaining length for "pen" to be down
+% \!uplength ** length for "pen" to be down
+% \!intervalno ** counts segments to curve
+% \totalarclength ** cumulative distance along curve
+% \!npoints ** approximately (arc length / plotsymbolspacing)
+
+% ** Calls -- \!Pythag, \!divide, \!plot
+
+
+% ** \!start (XCOORD,YCOORD)
+% ** Sets initial point for linearly (or quadratically) interpolated curve
+\def\!start (#1,#2){%
+ \!plotxorigin=\!xorigin \advance \!plotxorigin by \!plotsymbolxshift
+ \!plotyorigin=\!yorigin \advance \!plotyorigin by \!plotsymbolyshift
+ \!xS=\!M{#1}\!xunit \!yS=\!M{#2}\!yunit
+ \!rotateaboutpivot\!xS\!yS
+ \!copylist\!UDlist\to\!!UDlist% **\!UDlist has the form \\{dimen1}\\{dimen2}..
+% ** Routine will draw dashed line with pen
+% ** down for dimen1, up for dimen2, ...
+ \!getnextvalueof\!downlength\from\!!UDlist
+ \!distacross=\!zpt% ** 1st point goes at start of curve
+ \!intervalno=0 % ** initialize interval counter
+ \global\totalarclength=\!zpt% ** initialize distance traveled along curve
+ \ignorespaces}
+
+
+% ** \!ljoin (XCOORD,YCOORD)
+% ** Draws a straight line starting at the last point specified
+% ** by the most recent \!start, \!ljoin, or \!qjoin, and
+% ** ending at (XCOORD,YCOORD).
+\def\!ljoin (#1,#2){%
+ \advance\!intervalno by 1
+ \!xE=\!M{#1}\!xunit \!yE=\!M{#2}\!yunit
+ \!rotateaboutpivot\!xE\!yE
+ \!xdiff=\!xE \advance \!xdiff by -\!xS%** xdiff = xE - xS
+ \!ydiff=\!yE \advance \!ydiff by -\!yS%** ydiff = yE - yS
+ \!Pythag\!xdiff\!ydiff\!arclength% ** arclength = sqrt(xdiff**2+ydiff**2)
+ \global\advance \totalarclength by \!arclength%
+ \!drawlinearsegment% ** set by dashpat to \!linearsolid or \!lineardashed
+ \!xS=\!xE \!yS=\!yE% ** shift ending points to starting points
+ \ignorespaces}
+
+
+% ** The following routine is used to draw a "solid" line between (xS,yS)
+% ** and (xE,yE). Points are spaced nearly every \plotsymbolspacing length
+% ** along the line.
+\def\!linearsolid{%
+ \!npoints=\!arclength
+ \!countA=\plotsymbolspacing
+ \divide\!npoints by \!countA% ** now #pts =. arclength/plotsymbolspacing
+ \ifnum \!npoints<1
+ \!npoints=1
+ \fi
+ \divide\!xdiff by \!npoints
+ \divide\!ydiff by \!npoints
+ \!xpos=\!xS \!ypos=\!yS
+%
+ \loop\ifnum\!npoints>-1
+ \!plotifinbounds
+ \advance \!xpos by \!xdiff
+ \advance \!ypos by \!ydiff
+ \advance \!npoints by -1
+ \repeat
+ \ignorespaces}
+
+
+% ** The following routine is used to draw a dashed line between (xS,yS)
+% ** and (xE,yE). The dash pattern continues from the previous segment.
+\def\!lineardashed{%
+% **
+ \ifdim\!distacross>\!arclength
+ \advance \!distacross by -\!arclength %nothing to plot in this interval
+%
+ \else
+%
+ \loop\ifdim\!distacross<\!arclength
+% ** plot point, interpolating linearly in x and y
+ \!divide\!distacross\!arclength\!dimenA% ** dimA = across/arclength
+ \!removept\!dimenA\!t% ** \!t holds value in dimA, without the "pt"
+ \!xpos=\!t\!xdiff \advance \!xpos by \!xS
+ \!ypos=\!t\!ydiff \advance \!ypos by \!yS
+ \!plotifinbounds
+ \advance\!distacross by \plotsymbolspacing
+ \!advancedashing
+ \repeat
+%
+ \advance \!distacross by -\!arclength% ** prepare for next interval
+ \fi
+ \ignorespaces}
+
+
+\def\!!advancedashing{%
+ \advance\!downlength by -\plotsymbolspacing
+ \ifdim \!downlength>\!zpt
+ \else
+ \advance\!distacross by \!downlength
+ \!getnextvalueof\!uplength\from\!!UDlist
+ \advance\!distacross by \!uplength
+ \!getnextvalueof\!downlength\from\!!UDlist
+ \fi}
+
+
+% ** \inboundscheckoff & \inboundscheckon: See Subsection 5.5 of the manual.
+\def\inboundscheckoff{%
+ \def\!plotifinbounds{\!plot(\!xpos,\!ypos)}%
+ \def\!initinboundscheck{\relax}\ignorespaces}
+\def\inboundscheckon{%
+ \def\!plotifinbounds{\!!plotifinbounds}%
+ \def\!initinboundscheck{\!!initinboundscheck}%
+ \!initinboundscheck\ignorespaces}
+\inboundscheckoff
+
+% ** The following code plots the current point only if it falls in the
+% ** current plotarea. It doesn't matter if the coordinate system has
+% ** changed since the plotarea was set up. However, shifts of the plot
+% ** are ignored (how the plotsymbol stands relative to its plot position is
+% ** unknown anyway).
+\def\!!plotifinbounds{%
+ \ifdim \!xpos<\!checkleft
+ \else
+ \ifdim \!xpos>\!checkright
+ \else
+ \ifdim \!ypos<\!checkbot
+ \else
+ \ifdim \!ypos>\!checktop
+ \else
+ \!plot(\!xpos,\!ypos)
+ \fi
+ \fi
+ \fi
+ \fi}
+
+
+\def\!!initinboundscheck{%
+ \!checkleft=\!arealloc \advance\!checkleft by \!xorigin
+ \!checkright=\!arearloc \advance\!checkright by \!xorigin
+ \!checkbot=\!areabloc \advance\!checkbot by \!yorigin
+ \!checktop=\!areatloc \advance\!checktop by \!yorigin}
+
+
+% *********************************
+% *** LOGTEN (Log_10 function) ***
+% *********************************
+%
+% ** \!logten{X}
+% ** Calculates log_10 of X. X and LOG10(X) are in fixed point notation.
+% ** X must be positive; it may have an optional `+' sign; any number
+% ** of digits may be specified for X. The absolute error in LOG10(X) is
+% ** less than .0001 (probably < .00006). That's about as good as you
+% ** hope for, since TEX only operates to 5 figures after the decimal
+% ** point anyway.
+
+% \!rootten=3.162278pt **** These are values are set in ALLOCATIONS
+% \!tenAe=2.543275pt (=A5)
+% \!tenAc=2.773839pt (=A3)
+% \!tenAa=8.690286pt (=A1)
+
+\def\!logten#1#2{%
+ \expandafter\!!logten#1\!nil
+ \!removept\!dimenF#2%
+ \ignorespaces}
+
+\def\!!logten#1#2\!nil{%
+ \if -#1%
+ \!dimenF=\!zpt
+ \def\!next{\ignorespaces}%
+ \else
+ \if +#1%
+ \def\!next{\!!logten#2\!nil}%
+ \else
+ \if .#1%
+ \def\!next{\!!logten0.#2\!nil}%
+ \else
+ \def\!next{\!!!logten#1#2..\!nil}%
+ \fi
+ \fi
+ \fi
+ \!next}
+
+\def\!!!logten#1#2.#3.#4\!nil{%
+ \!dimenF=1pt % ** DimF holds log10 original argument
+ \if 0#1%
+ \!!logshift#3pt % ** Argument < 1
+ \else % ** Argument >= 1
+ \!logshift#2/% ** Shift decimal pt as many places
+ \!dimenE=#1.#2#3pt % ** as there are figures in #2
+ \fi % ** Now dimE holds revised X want log10 of
+ \ifdim \!dimenE<\!rootten% ** Transform X to XX between sqrt(10)
+ \multiply \!dimenE 10 % ** and 10*sqrt(10)
+ \advance \!dimenF -1pt
+ \fi
+ \!dimenG=\!dimenE% ** dimG <- (XX + 10)
+ \advance\!dimenG 10pt
+ \advance\!dimenE -10pt % ** dimE <- (XX - 10)
+ \multiply\!dimenE 10 % ** dimE = 10*(XX-10)
+ \!divide\!dimenE\!dimenG\!dimenE% ** Now dimE=10t==10*(XX-10)/(XX+10)
+ \!removept\!dimenE\!t% ** !t=10t, with "pt" removed
+ \!dimenG=\!t\!dimenE% ** dimG=100t**2
+ \!removept\!dimenG\!tt% ** !tt=100t**2, with "pt" removed
+ \!dimenH=\!tt\!tenAe% ** dimH=10*a5*(10t)**2 /100
+ \divide\!dimenH 100
+ \advance\!dimenH \!tenAc% ** ditto + 10*a3
+ \!dimenH=\!tt\!dimenH% ** ditto * (10t)**2 /100
+ \divide\!dimenH 100
+ \advance\!dimenH \!tenAa% ** ditto + 10*a1
+ \!dimenH=\!t\!dimenH% ** ditto * 10t / 100
+ \divide\!dimenH 100 % ** Now dimH = log10(XX) - 1
+ \advance\!dimenF \!dimenH}% ** dimF = log10(X)
+
+\def\!logshift#1{%
+ \if #1/%
+ \def\!next{\ignorespaces}%
+ \else
+ \advance\!dimenF 1pt
+ \def\!next{\!logshift}%
+ \fi
+ \!next}
+
+ \def\!!logshift#1{%
+ \advance\!dimenF -1pt
+ \if 0#1%
+ \def\!next{\!!logshift}%
+ \else
+ \if p#1%
+ \!dimenF=1pt
+ \def\!next{\!dimenE=1p}%
+ \else
+ \def\!next{\!dimenE=#1.}%
+ \fi
+ \fi
+ \!next}
+
+
+% ***********************************************************
+% *** PICTURES (Basic setups for PiCtures; \put commands) ***
+% ***********************************************************
+
+% ** User Commands:
+% ** \beginpicture
+% ** \endpicture
+% ** \endpicturesave <XREG,YREG>
+% ** \setcoordinatesystem units <XUNIT,YUNIT> point at XREF YREF
+% ** \put {OBJECT} [ORIENTATION] <XSHIFT,YSHIFT> at XCOORD YCOORD
+% ** \multiput {OJBECT} [ORIENTATION] <XSHIFT,YSHIFT>) at
+% ** XCOORD YCOORD
+% ** *NUMBER_OF_TIMES DXCOORD DYCOORD /
+% ** \accountingon
+% ** \accountingoff
+% ** \stack [ORIENTATION] <LEADING> {LIST OF ITEMS}
+% ** \lines [ORIENTATION] {LINES}
+% ** \Lines [ORIENTATION] {LINES}
+% ** \setdimensionmode
+% ** \setcoordinatemode
+% ** \Xdistance
+% ** \Ydistance
+
+% ** Internal commands:
+% ** \!setputobject{OBJECT}{[ORIENTATION]<XSHIFT,YSHIFT>}
+% ** \!dimenput{OBJECT}[ORIENTATION]<XSHIFT,YSHIFT>(XDIMEN,YDIMEN)
+% ** \!setdimenmode
+% ** \!setcoordmode
+% ** \!ifdimenmode
+% ** \!ifcoordmode
+
+
+% ** \beginpicture
+% ** \endpicture
+% ** \endpicturesave <XREG,YREG>
+% ** \beginpicture ... \endpicture creates an hbox. Objects are
+% ** placed in this box using the \put command and the like (see below).
+% ** The location of an object is specified in terms of coordinate system(s)
+% ** established by \setcoordinatesystem. Each coordinate system (there
+% ** might be just one) specifies the length of 1 horizontal unit, the length
+% ** of 1 vertical unit, and the coordinates of a "reference point". The
+% ** reference points of various coordinate systems will be in the same
+% ** physical location. The macros keep track of the size of the objects
+% ** and their locations. The resulting hbox is the smallest hbox which
+% ** encloses all the objects, and whose TEK reference point is the point
+% ** on the left edge of the box closest vertically to the PICTEX reference
+% ** point. Using \endpicturesave, you can (globally) save the distance TEK's
+% ** reference point is to the right (respectively, up from) PICTEX's
+% ** reference point in the dimension register \XREG (respectively \YREG).
+% ** You can then \put the picture OBJECT into a larger picture so that its
+% ** reference point is at (XCOORD,YCOORD) with the command
+% ** \put {picture OBJECT} [Bl] <\XREG, \YREG> at XCOORD YCOORD
+
+% ** \beginpicture : See Subsection 1.1 of the manual.
+\def\beginpicture{%
+ \setbox\!picbox=\hbox\bgroup%
+ \!xleft=\maxdimen
+ \!xright=-\maxdimen
+ \!ybot=\maxdimen
+ \!ytop=-\maxdimen}
+
+% ** \endpicture : See Subsection 1.1 of the manual.
+\def\endpicture{%
+ \ifdim\!xleft=\maxdimen% ** check if nothing was put in picbox
+ \!xleft=\!zpt \!xright=\!zpt \!ybot=\!zpt \!ytop=\!zpt
+ \fi
+ \global\!Xleft=\!xleft \global\!Xright=\!xright
+ \global\!Ybot=\!ybot \global\!Ytop=\!ytop
+ \egroup%
+ \ht\!picbox=\!Ytop \dp\!picbox=-\!Ybot
+ \ifdim\!Ybot>\!zpt
+ \else
+ \ifdim\!Ytop<\!zpt
+ \!Ybot=\!Ytop
+ \else
+ \!Ybot=\!zpt
+ \fi
+ \fi
+ \hbox{\kern-\!Xleft\lower\!Ybot\box\!picbox\kern\!Xright}}
+
+% ** \endpicturesave : See Subsection 8.4 of the manual.
+\def\endpicturesave <#1,#2>{%
+ \endpicture \global #1=\!Xleft \global #2=\!Ybot \ignorespaces}
+
+
+% ** \setcoordinatesystem units <XUNIT,YUNIT>
+% ** point at XREF YREF
+% ** Each of `units <XUNIT,YUNIT>' and `point at XREF YREF'
+% ** are optional.
+% ** Unit lengths must be given in dimensions (e.g., <10pt,1in>).
+% ** Default unit lengths are 1pt, 1pt, or previous unit lengths.
+% ** Reference point is specified in current units (e.g., 3 5 ).
+% ** Default reference point is 0 0 , or previous reference point.
+% ** Unit lengths and reference points obey TEX's scoping rules.
+% ** See Subsection 1.2 of the manual.
+\def\setcoordinatesystem{%
+ \!ifnextchar{u}{\!getlengths }
+ {\!getlengths units <\!xunit,\!yunit>}}
+\def\!getlengths units <#1,#2>{%
+ \!xunit=#1\relax
+ \!yunit=#2\relax
+ \!ifcoordmode
+ \let\!SCnext=\!SCccheckforRP
+ \else
+ \let\!SCnext=\!SCdcheckforRP
+ \fi
+ \!SCnext}
+\def\!SCccheckforRP{%
+ \!ifnextchar{p}{\!cgetreference }
+ {\!cgetreference point at {\!xref} {\!yref} }}
+\def\!cgetreference point at #1 #2 {%
+ \edef\!xref{#1}\edef\!yref{#2}%
+ \!xorigin=\!xref\!xunit \!yorigin=\!yref\!yunit
+ \!initinboundscheck % ** See linear.tex
+ \ignorespaces}
+\def\!SCdcheckforRP{%
+ \!ifnextchar{p}{\!dgetreference}%
+ {\ignorespaces}}
+\def\!dgetreference point at #1 #2 {%
+ \!xorigin=#1\relax \!yorigin=#2\relax
+ \ignorespaces}
+
+
+% ** \put {OBJECT} [XY] <XDIMEN,YDIMEN> at (XCOORD,YCOORD)
+% ** `[XY]' and `<XDIMEN,YDIMEN>' are optional.
+% ** First OBJECT is placed in an hbox (the "objectbox") and then a
+% ** "reference point" is assigned to the objectbox as follows:
+% ** [1] first, the reference point is taken to be the center of the box;
+% ** [2] next, centering is overridden by the specifications
+% ** X=l -- reference point along the left edge of the objectbox
+% ** X=r -- reference point along the right edge of the objectbox
+% ** Y=b -- reference point along the bottom edge of the objectbox
+% ** Y=B -- reference point along the Baseline of the objectbox
+% ** Y=t -- reference point along the top edge of the objectbox;
+% ** [3] finally the reference point is shifted left by XDIMEN, down
+% ** by YDIMEN (both default to 0pt).
+% ** The objectbox is placed within PICBOX with its reference point at
+% ** (XCOORD,YCOORD).
+% ** If OBJECT is a saved box, say box0, you have to write
+% ** \put{\box0}... or \put{\copy0}...
+% ** The objectbox is void after the put.
+% ** See Subsection 2.1 of the manual.
+\long\def\put#1#2 at #3 #4 {%
+ \!setputobject{#1}{#2}%
+ \!xpos=\!M{#3}\!xunit \!ypos=\!M{#4}\!yunit
+ \!rotateaboutpivot\!xpos\!ypos%
+ \advance\!xpos -\!xorigin \advance\!xpos -\!xshift
+ \advance\!ypos -\!yorigin \advance\!ypos -\!yshift
+ \kern\!xpos\raise\!ypos\box\!putobject\kern-\!xpos%
+ \!doaccounting\ignorespaces}
+
+% ** \multiput etc. Like \put. The objectbox is not voided until the
+% ** termininating /, and is placed repeatedly with:
+% ** XCOORD YCOORD -- the objectbox is put down with its reference point
+% ** at (XCOORD,YCOORD);
+% ** *N DXCOORD DYCOORD -- each of N times the current
+% ** (xcoord,ycoord) is incremented by (DXCOORD,DYCOORD), and the
+% ** objectbox is put down with its reference point at (xcoord,ycoord)
+% ** (This specification has to follow an XCOORD YCOORD pair)
+% ** See Subsection 2.2 of the manual.
+\long\def\multiput #1#2 at {%
+ \!setputobject{#1}{#2}%
+ \!ifnextchar"{\!putfromfile}{\!multiput}}
+\def\!putfromfile"#1"{%
+ \expandafter\!multiput \input #1 /}
+\def\!multiput{%
+ \futurelet\!nextchar\!!multiput}
+\def\!!multiput{%
+ \if *\!nextchar
+ \def\!nextput{\!alsoby}%
+ \else
+ \if /\!nextchar
+ \def\!nextput{\!finishmultiput}%
+ \else
+ \def\!nextput{\!alsoat}%
+ \fi
+ \fi
+ \!nextput}
+\def\!finishmultiput/{%
+ \setbox\!putobject=\hbox{}%
+ \ignorespaces}
+
+% ** \!alsoat XCOORD YCOORD
+% ** The objectbox is put down with reference point at XCOORD,YCOORD
+\def\!alsoat#1 #2 {%
+ \!xpos=\!M{#1}\!xunit \!ypos=\!M{#2}\!yunit
+ \!rotateaboutpivot\!xpos\!ypos%
+ \advance\!xpos -\!xorigin \advance\!xpos -\!xshift
+ \advance\!ypos -\!yorigin \advance\!ypos -\!yshift
+ \kern\!xpos\raise\!ypos\copy\!putobject\kern-\!xpos%
+ \!doaccounting
+ \!multiput}
+
+% ** \!alsoby*N DXCOORD DYCOORD
+% ** N times, the current (XCOORD,YCOORD) is advanced by (DXCOORD,DYCOORD),
+% ** and the current (shifted, oriented) OBJECT is put down.
+\def\!alsoby*#1 #2 #3 {%
+ \!dxpos=\!M{#2}\!xunit \!dypos=\!M{#3}\!yunit
+ \!rotateonly\!dxpos\!dypos
+ \!ntemp=#1%
+ \!!loop\ifnum\!ntemp>0
+ \advance\!xpos by \!dxpos \advance\!ypos by \!dypos
+ \kern\!xpos\raise\!ypos\copy\!putobject\kern-\!xpos%
+ \advance\!ntemp by -1
+ \repeat
+ \!doaccounting
+ \!multiput}
+
+% ** \accountingoff : Suspends PiCTeX's accounting of the aggregate
+% ** size of the picture box.
+% ** \accounting on : Reinstates accounting.
+% ** See Subsection 8.2 of the manual.
+\def\accountingon{\def\!doaccounting{\!!doaccounting}\ignorespaces}
+\def\accountingoff{\def\!doaccounting{}\ignorespaces}
+\accountingon
+\def\!!doaccounting{%
+ \!xtemp=\!xpos
+ \!ytemp=\!ypos
+ \ifdim\!xtemp<\!xleft
+ \!xleft=\!xtemp
+ \fi
+ \advance\!xtemp by \!wd
+ \ifdim\!xright<\!xtemp
+ \!xright=\!xtemp
+ \fi
+ \advance\!ytemp by -\!dp
+ \ifdim\!ytemp<\!ybot
+ \!ybot=\!ytemp
+ \fi
+ \advance\!ytemp by \!dp
+ \advance\!ytemp by \!ht
+ \ifdim\!ytemp>\!ytop
+ \!ytop=\!ytemp
+ \fi}
+
+\long\def\!setputobject#1#2{%
+ \setbox\!putobject=\hbox{#1}%
+ \!ht=\ht\!putobject \!dp=\dp\!putobject \!wd=\wd\!putobject
+ \wd\!putobject=\!zpt
+ \!xshift=.5\!wd \!yshift=.5\!ht \advance\!yshift by -.5\!dp
+ \edef\!putorientation{#2}%
+ \expandafter\!SPOreadA\!putorientation[]\!nil%
+ \expandafter\!SPOreadB\!putorientation<\!zpt,\!zpt>\!nil\ignorespaces}
+
+\def\!SPOreadA#1[#2]#3\!nil{\!etfor\!orientation:=#2\do\!SPOreviseshift}
+
+\def\!SPOreadB#1<#2,#3>#4\!nil{\advance\!xshift by -#2\advance\!yshift by -#3}
+
+\def\!SPOreviseshift{%
+ \if l\!orientation
+ \!xshift=\!zpt
+ \else
+ \if r\!orientation
+ \!xshift=\!wd
+ \else
+ \if b\!orientation
+ \!yshift=-\!dp
+ \else
+ \if B\!orientation
+ \!yshift=\!zpt
+ \else
+ \if t\!orientation
+ \!yshift=\!ht
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi}
+
+
+% ** \!dimenput{OBJECT} <XDIMEN,YDIMEN> [XY] (XLOC,YLOC)
+% ** This is an internal put routine, similar to \put, except that
+% ** XLOC=distance right from reference point, YLOC=distance up from
+% ** reference point. XLOC and YLOC are dimensions, so this routine
+% ** is completely independent of the current coordinate system.
+% ** This routine does NOT do ROTATIONS.
+\long\def\!dimenput#1#2(#3,#4){%
+ \!setputobject{#1}{#2}%
+ \!xpos=#3\advance\!xpos by -\!xshift
+ \!ypos=#4\advance\!ypos by -\!yshift
+ \kern\!xpos\raise\!ypos\box\!putobject\kern-\!xpos%
+ \!doaccounting\ignorespaces}
+
+
+% ** The following macros permit the picture drawing routines to be used
+% ** either in the default "coordinate mode", or in "dimension mode".
+% ** In coordinate mode \!M(1.5,\!xunit) expands to 1.5\!xunit
+% ** In dimension mode \!M(1.5pt,\!xunit) expands to 1.5pt
+% ** Dimension mode is useful in coding macros.
+% ** Any special purpose picture macro that sets dimension mode should
+% ** reset coordinate mode before completion.
+% ** See Subsection 9.2 of the manual.
+\def\!setdimenmode{%
+ \let\!M=\!M!!\ignorespaces}
+\def\!setcoordmode{%
+ \let\!M=\!M!\ignorespaces}
+\def\!ifcoordmode{%
+ \ifx \!M \!M!}
+\def\!ifdimenmode{%
+ \ifx \!M \!M!!}
+\def\!M!#1#2{#1#2}
+\def\!M!!#1#2{#1}
+\!setcoordmode
+\let\setdimensionmode=\!setdimenmode
+\let\setcoordinatemode=\!setcoordmode
+
+% ** \Xdistance{XCOORD}, \Ydistance{YCOORD} are the horizontal and
+% ** vertical distances from the origin (0,0) to the point
+% ** (XCOORD,YCOORD) in the current coordinate system.
+% ** See Subsection 9.2 of the manual.
+\def\Xdistance#1{%
+ \!M{#1}\!xunit
+ \ignorespaces}
+\def\Ydistance#1{%
+ \!M{#1}\!yunit
+ \ignorespaces}
+
+% ** The following macros -- \stack, \line, and \Lines -- are useful for
+% ** annotating PiCtures. They can be used outside the \beginpicture ...
+% ** \endpicture environment.
+
+% ** \stack [POSITIONING] <LEADING> {VALUESLIST}
+% ** Builds a vertical stack of the values in VALUESLIST. Values in
+% ** VALUESLIST are separated by commas. In the resulting stack, values are
+% ** centered by default, and positioned flush left (right) if
+% ** POSITIONING = l (r). Values are separated vertically by LEADING,
+% ** which defaults to \stackleading.
+% ** See Subsection 2.3 of the manual.
+\def\stack{%
+ \!ifnextchar[{\!stack}{\!stack[c]}}
+\def\!stack[#1]{%
+ \let\!lglue=\hfill \let\!rglue=\hfill
+ \expandafter\let\csname !#1glue\endcsname=\relax
+ \!ifnextchar<{\!!stack}{\!!stack<\stackleading>}}
+\def\!!stack<#1>#2{%
+ \vbox{\def\!valueslist{}\!ecfor\!value:=#2\do{%
+ \expandafter\!rightappend\!value\withCS{\\}\to\!valueslist}%
+ \!lop\!valueslist\to\!value
+ \let\\=\cr\lineskiplimit=\maxdimen\lineskip=#1%
+ \baselineskip=-1000pt\halign{\!lglue##\!rglue\cr \!value\!valueslist\cr}}%
+ \ignorespaces}
+
+% ** \lines [POSITIONING] {LINES}
+% ** Builds a vertical array of the lines in LINES. Each line in LINES
+% ** is terminated by a \cr. In the resulting array, lines are
+% ** centered by default, and positioned flush left (right) if
+% ** POSITIONING = l (r). The lines in the array are subject to TeX's
+% ** usual spacing rules: in particular the baselines are ordinarily an equal
+% ** distance apart. The baseline of the array is the baseline of the
+% ** the bottom line.
+% ** See Subsection 2.3 of the manual.
+\def\lines{%
+ \!ifnextchar[{\!lines}{\!lines[c]}}
+\def\!lines[#1]#2{%
+ \let\!lglue=\hfill \let\!rglue=\hfill
+ \expandafter\let\csname !#1glue\endcsname=\relax
+ \vbox{\halign{\!lglue##\!rglue\cr #2\crcr}}%
+ \ignorespaces}
+
+% ** \Lines [POSITIONING] {LINES}
+% ** Like \lines, but the baseline of the array is the baseline of the
+% ** top line. See Subsection 2.3 of the manual.
+\def\Lines{%
+ \!ifnextchar[{\!Lines}{\!Lines[c]}}
+\def\!Lines[#1]#2{%
+ \let\!lglue=\hfill \let\!rglue=\hfill
+ \expandafter\let\csname !#1glue\endcsname=\relax
+ \vtop{\halign{\!lglue##\!rglue\cr #2\crcr}}%
+ \ignorespaces}
+
+
+% *********************************************
+% *** PLOTTING (Things to do with plotting) ***
+% *********************************************
+
+% ** User commands
+% ** \setplotsymbol ({PLOTSYMBOL} [ORIENTATION] <XSHIFT,YSHIFT>)
+% ** \savelinesandcurves on "FILE_NAME"
+% ** \dontsavelinesandcurves
+% ** \writesavefile {MESSAGE}
+% ** \replot {FILE_NAME}
+
+% ** Internal command
+% ** \!plot(XDIMEN,YDIMEN)
+
+% ** \setplotsymbol ({PLOTSYMBOL} [ ] < , >)
+% ** Save PLOTSYMBOL away in an hbox for use with curve plotting routines
+% ** See Subsection 5.2 of the manual.
+\def\setplotsymbol(#1#2){%
+ \!setputobject{#1}{#2}
+ \setbox\!plotsymbol=\box\!putobject%
+ \!plotsymbolxshift=\!xshift
+ \!plotsymbolyshift=\!yshift
+ \ignorespaces}
+
+\setplotsymbol({\fiverm .})% ** initialize plotsymbol
+
+
+% ** \!plot is either \!!plot (when no lines and curves are being saved) or
+% ** \!!!plot (when lines and curves are being saved)
+
+% ** \!!plot(XDIMEN,YDIMEN)
+% ** Places the current plotsymbol a horizontal distance=XDIMEN-xorigin
+% ** and a vertical distance=YDIMEN-yorigin from the current
+% ** reference point.
+\def\!!plot(#1,#2){%
+ \!dimenA=-\!plotxorigin \advance \!dimenA by #1% ** over
+ \!dimenB=-\!plotyorigin \advance \!dimenB by #2% ** up
+ \kern\!dimenA\raise\!dimenB\copy\!plotsymbol\kern-\!dimenA%
+ \ignorespaces}
+
+% ** \!!!plot(XDIMEN,YDIMEN)
+% ** Like \!!plot, but also saves the plot location in units of
+% ** scaled point, on file `replotfile'
+\def\!!!plot(#1,#2){%
+ \!dimenA=-\!plotxorigin \advance \!dimenA by #1% ** over
+ \!dimenB=-\!plotyorigin \advance \!dimenB by #2% ** up
+ \kern\!dimenA\raise\!dimenB\copy\!plotsymbol\kern-\!dimenA%
+ \!countE=\!dimenA
+ \!countF=\!dimenB
+ \immediate\write\!replotfile{\the\!countE,\the\!countF.}%
+ \ignorespaces}
+
+
+% ** \savelinesandcurves on "FILE_NAME"
+% ** Switch to save locations used for plotting lines and curves
+% ** (No advantage in saving locations for solid lines; however
+% ** replotting curve locations speeds things up by a factor of about 4.
+% ** \dontsavelinesandcurves
+% ** Terminates \savelinesandcurves. The default.
+% ** See Subsection 5.6 of the manual.
+\def\savelinesandcurves on "#1" {%
+ \immediate\closeout\!replotfile
+ \immediate\openout\!replotfile=#1%
+ \let\!plot=\!!!plot}
+
+\def\dontsavelinesandcurves {%
+ \let\!plot=\!!plot}
+\dontsavelinesandcurves
+
+% ** \writesavefile {MESSAGE}
+% ** The message is preceded by a "%", so that it won't interfere
+% ** with replotting.
+% ** See Subsection 5.6 of the manual.
+{\catcode`\%=11\xdef\!Commentsignal{%}}
+\def\writesavefile#1 {%
+ \immediate\write\!replotfile{\!Commentsignal #1}%
+ \ignorespaces}
+
+% ** \replot "FILE_NAME"
+% ** Replots the locations saved earlier under \savelinesandcurves
+% ** on "FILE_NAME"
+% ** See Subsection 5.6 of the manual.
+\def\replot"#1" {%
+ \expandafter\!replot\input #1 /}
+\def\!replot#1,#2. {%
+ \!dimenA=#1sp
+ \kern\!dimenA\raise#2sp\copy\!plotsymbol\kern-\!dimenA
+ \futurelet\!nextchar\!!replot}
+\def\!!replot{%
+ \if /\!nextchar
+ \def\!next{\!finish}%
+ \else
+ \def\!next{\!replot}%
+ \fi
+ \!next}
+% **************************************************
+% *** PYTHAGORAS (Euclidean distance function) ***
+% **************************************************
+
+% ** User command:
+% ** \placehypotenuse for <dimension1> and <dimension2> in <register>
+
+% ** Internal command:
+% ** \!Pythag{X}{Y}{Z}
+% ** Input X,Y are dimensions, or dimension registers.
+% ** Output Z == sqrt(X**2+Y**2) must be a dimension register.
+% ** Assumes that |X|+|Y| < 2048pt (about 28in).
+
+% ** Without loss of generality, suppose x>0, y>0. Put s = x+y,
+% ** z = sqrt(x**2+y**2). Then z = s*f, where f = sqrt(t**2 + (1-t)**2)
+% ** = sqrt((1+tau**2)/2), where t = x/s and tau = 2(t-1/2) .
+
+% ** Uses the \!divide macro (which uses registers \!dimenA--\!dimenD.
+% ** Uses the \!removept macro (e.g., 123.45pt --> 123.45)
+% ** Uses registers \!dimenE--\!dimenI.
+\def\!Pythag#1#2#3{%
+ \!dimenE=#1\relax
+ \ifdim\!dimenE<\!zpt
+ \!dimenE=-\!dimenE
+ \fi% ** dimE = |x|
+ \!dimenF=#2\relax
+ \ifdim\!dimenF<\!zpt
+ \!dimenF=-\!dimenF
+ \fi% ** dimF = |y|
+ \advance \!dimenF by \!dimenE% ** dimF = s = |x|+|y|
+ \ifdim\!dimenF=\!zpt
+ \!dimenG=\!zpt% ** dimG = z = sqrt(x**2+y**2)
+ \else
+ \!divide{8\!dimenE}\!dimenF\!dimenE% ** now dimE = 8t = (8|x|)/s
+ \advance\!dimenE by -4pt% ** 8tau = (8t-4)*2
+ \!dimenE=2\!dimenE% ** (tau = 2*t - 1)
+ \!removept\!dimenE\!!t% ** 8tau, without "pt"
+ \!dimenE=\!!t\!dimenE% ** (8tau)**2, in pts
+ \advance\!dimenE by 64pt% ** u = [64 + (8tau)**2]/2
+ \divide \!dimenE by 2% ** [u = (8f)**2]
+ \!dimenH=7pt% ** initial guess g at sqrt(u)
+ \!!Pythag\!!Pythag\!!Pythag% ** 3 iterations give sqrt(u)
+ \!removept\!dimenH\!!t% ** 8f=sqrt(u), without "pt"
+ \!dimenG=\!!t\!dimenF% ** z = (8f)*s/8
+ \divide\!dimenG by 8
+ \fi
+ #3=\!dimenG
+ \ignorespaces}
+
+\def\!!Pythag{% ** Newton-Raphson for sqrt
+ \!divide\!dimenE\!dimenH\!dimenI% ** v = u/g
+ \advance\!dimenH by \!dimenI% ** g <-- (g + u/g)/2
+ \divide\!dimenH by 2}
+
+% ** \placehypotenuse for <XI> and <ETA> in <ZETA>
+% ** See Subsection 9.3 of the manual.
+\def\placehypotenuse for <#1> and <#2> in <#3> {%
+ \!Pythag{#1}{#2}{#3}}
+
+
+% **********************************************
+% *** QUADRATIC ARC (Draws a quadratic arc) ***
+% **********************************************
+
+% ** Internal command
+% ** \!qjoin (XCOORD1,YCOORD1) (XCOORD2,YCOORD2)
+
+% ** \!qjoin (XCOORD1,YCOORD1) (XCOORD2,YCOORD2)
+% ** Draws an arc starting at the (last) point specified by the most recent
+% ** \!qjoin, or \!ljoin, or \!start and passing through (X_1,Y_1), (X_2,Y_2).
+% ** Uses quadratic interpolation in both x and y:
+% ** x(t), 0 <= t <= 1, interpolates x_0, x_1, x_2 at t=0, .5, 1
+% ** y(t), 0 <= t <= 1, interpolates y_0, y_1, y_2 at t=0, .5, 1
+
+\def\!qjoin (#1,#2) (#3,#4){%
+ \advance\!intervalno by 1
+ \!ifcoordmode
+ \edef\!xmidpt{#1}\edef\!ymidpt{#2}%
+ \else
+ \!dimenA=#1\relax \edef\!xmidpt{\the\!dimenA}%
+ \!dimenA=#2\relax \edef\!xmidpt{\the\!dimenA}%
+ \fi
+ \!xM=\!M{#1}\!xunit \!yM=\!M{#2}\!yunit \!rotateaboutpivot\!xM\!yM
+ \!xE=\!M{#3}\!xunit \!yE=\!M{#4}\!yunit \!rotateaboutpivot\!xE\!yE
+%
+% ** Find coefficients for x(t)=a_x + b_x*t + c_x*t**2
+ \!dimenA=\!xM \advance \!dimenA by -\!xS% ** dimA = I = xM - xS
+ \!dimenB=\!xE \advance \!dimenB by -\!xM% ** dimB = II = xE-xM
+ \!xB=3\!dimenA \advance \!xB by -\!dimenB% ** b=3I-II
+ \!xC=2\!dimenB \advance \!xC by -2\!dimenA% ** c=2(II-I)
+%
+% ** Find coefficients for y(t)=y_x + b_y*t + c_y*t**2
+ \!dimenA=\!yM \advance \!dimenA by -\!yS%
+ \!dimenB=\!yE \advance \!dimenB by -\!yM%
+ \!yB=3\!dimenA \advance \!yB by -\!dimenB%
+ \!yC=2\!dimenB \advance \!yC by -2\!dimenA%
+%
+% ** Use Simpson's rule to calculate arc length over [0,1/2]:
+% ** arc length = 1/2[1/6 f(0) + 4/6 f(1/4) + 1/6 f(1/2)]
+% ** with f(t) = sqrt(x'(t)**2 + y'(t)**2).
+ \!xprime=\!xB \!yprime=\!yB% ** x'(t) = b + 2ct
+ \!dxprime=.5\!xC \!dyprime=.5\!yC% ** dt=1/4 ==> dx'(t) = c/2
+ \!getf \!midarclength=\!dimenA
+ \!getf \advance \!midarclength by 4\!dimenA
+ \!getf \advance \!midarclength by \!dimenA
+ \divide \!midarclength by 12
+%
+% ** Get arc length over [0,1].
+ \!arclength=\!dimenA
+ \!getf \advance \!arclength by 4\!dimenA
+ \!getf \advance \!arclength by \!dimenA
+ \divide \!arclength by 12% ** Now have arc length over [1/2,1]
+ \advance \!arclength by \!midarclength
+ \global\advance \totalarclength by \!arclength
+%
+%
+% ** Check to see if there's anything to plot in this interval
+ \ifdim\!distacross>\!arclength
+ \advance \!distacross by -\!arclength% ** nothing
+%
+ \else
+ \!initinverseinterp% ** initialize for inverse interpolation on arc length
+ \loop\ifdim\!distacross<\!arclength% ** loop over points on arc
+ \!inverseinterp% ** find t such that arc length[0,t] = distacross,
+% ** using inverse quadratic interpolation
+% ** now evaluate x(t)=(c*t + b)*t + a
+ \!xpos=\!t\!xC \advance\!xpos by \!xB
+ \!xpos=\!t\!xpos \advance \!xpos by \!xS
+% ** evaluate y(t)
+ \!ypos=\!t\!yC \advance\!ypos by \!yB
+ \!ypos=\!t\!ypos \advance \!ypos by \!yS
+ \!plotifinbounds% ** plot point if in bounds
+ \advance\!distacross \plotsymbolspacing%** advance arc length for next pt
+ \!advancedashing% ** see "linear"
+ \repeat
+%
+ \advance \!distacross by -\!arclength% ** prepare for next interval
+ \fi
+%
+ \!xS=\!xE% ** shift ending points to starting points
+ \!yS=\!yE
+ \ignorespaces}
+
+
+% ** \!getf -- Calculates sqrt(x'(t)**2 + y'(t)**2) and advances
+% ** x'(t) and y'(t)
+\def\!getf{\!Pythag\!xprime\!yprime\!dimenA%
+ \advance\!xprime by \!dxprime
+ \advance\!yprime by \!dyprime}
+
+
+% ** \!initinverseinterp -- initializes for inverse quadratic interpolation
+% ** of arc length provided 1/3 < midarclength/arclength < 2/3; otherwise
+% ** initializes for inverse linear interpolation.
+\def\!initinverseinterp{%
+ \ifdim\!arclength>\!zpt
+ \!divide{8\!midarclength}\!arclength\!dimenE% ** dimE=8w=8r/s, where r
+% ** = midarclength, s=arclength
+% ** Test for w out of range: w<1/3 or w>2/3
+ \ifdim\!dimenE<\!wmin \!setinverselinear
+ \else
+ \ifdim\!dimenE>\!wmax \!setinverselinear
+ \else% ** w in range: initialize
+ \def\!inverseinterp{\!inversequad}\ignorespaces
+%
+% ** Calculate the coefficients \!beta and \!gamma of the quadratic
+% ** t = \!beta*v + \!gamma*v**2
+% ** taking the values t=0, 1/2, 1 at v=0, w==r/s, 1 respectively:
+% ** \!beta = (1/2 - w**2)/[w(1-w)]
+% ** \!gamma = 1 - beta.
+%
+ \!removept\!dimenE\!Ew% ** 8w, without "pt"
+ \!dimenF=-\!Ew\!dimenE% ** -(8w)**2
+ \advance\!dimenF by 32pt% ** 32 - (8w)**2
+ \!dimenG=8pt
+ \advance\!dimenG by -\!dimenE% ** 8 - 8w
+ \!dimenG=\!Ew\!dimenG% ** (8w)*(8-8w)
+ \!divide\!dimenF\!dimenG\!beta% ** beta = (32-(8w)**2)/(8w(8-8w))
+% ** = (1/2 - w**2)/(w(1-w))
+ \!gamma=1pt
+ \advance \!gamma by -\!beta% ** gamma = 1-beta
+ \fi% ** end of the \ifdim\!dimenE>\!wmax
+ \fi% ** end of the \ifdim\!dimenE<\!wmin
+ \fi% ** end of the \ifdim\!arclength>\!zpt
+ \ignorespaces}
+
+
+% ** For 0 <= t <= 1, let AL(t) = arclength[0,t]/arclength[0,1]; note
+% ** AL(0)=0, AL(1/2)=midarclength/arclength, AL(1)=1. This routine
+% ** calculates an approximation to AL^{-1}(distance across/arclength),
+% ** using the assumption that AL^{-1} is quadratic. Specifically,
+% ** it finds t such that
+% ** AL^{-1}(v) =. t = v*(\!beta + \!gamma*v)
+% ** where \!beta and \!gamma are set by \!initinv, and where
+% ** v=distance across/arclength
+\def\!inversequad{%
+ \!divide\!distacross\!arclength\!dimenG% ** dimG = v = distacross/arclength
+ \!removept\!dimenG\!v% ** v, without "pt"
+ \!dimenG=\!v\!gamma% ** gamma*v
+ \advance\!dimenG by \!beta% ** beta + gamma*v
+ \!dimenG=\!v\!dimenG% ** t = v*(beta + gamma*v)
+ \!removept\!dimenG\!t}% ** t, without "pt"
+
+
+% ** When w <= 1/3 or w >= 2/3, the following routine writes (using
+% ** plain TEK's \wlog command) a warning message on the user's log file,
+% ** and initializes for inverse linear interpolation on arc length.
+\def\!setinverselinear{%
+ \def\!inverseinterp{\!inverselinear}%
+ \divide\!dimenE by 8 \!removept\!dimenE\!t
+ \!countC=\!intervalno \multiply \!countC 2
+ \!countB=\!countC \advance \!countB -1
+ \!countA=\!countB \advance \!countA -1
+ \wlog{\the\!countB th point (\!xmidpt,\!ymidpt) being plotted
+ doesn't lie in the}%
+ \wlog{ middle third of the arc between the \the\!countA th
+ and \the\!countC th points:}%
+ \wlog{ [arc length \the\!countA\space to \the\!countB]/[arc length
+ \the \!countA\space to \the\!countC]=\!t.}%
+ \ignorespaces}
+
+% ** Inverse linear interpolation
+\def\!inverselinear{%
+ \!divide\!distacross\!arclength\!dimenG
+ \!removept\!dimenG\!t}
+
+
+% **************************************
+% ** ROTATIONS (Handles rotations) ***
+% **************************************
+
+% ** User commands
+% ** \startrotation [by COS_OF_ANGLE SIN_OF_ANGLE] [about XPIVOT YPIVOT]
+% ** \stoprotation
+
+% ** \startrotation [by COS_OF_ANGLE SIN_OF_ANGLE] [about XPIVOT YPIVOT]
+% ** Future (XCOORD,YCOORD)'s will be rotated about (XPIVOT,YPIVOT)
+% ** by the angle with the give COS and SIN. Both fields are optional.
+% ** [COS,SIN] defaults to previous value, or (1,0).
+% ** (XPIVOT,YPIVOT) defaults to previous value, or (0,0)
+% ** You can't change the coordinate system in the scope of a rotation.
+% ** See Subsection 9.1 of the manual.
+\def\startrotation{%
+ \let\!rotateaboutpivot=\!!rotateaboutpivot
+ \let\!rotateonly=\!!rotateonly
+ \!ifnextchar{b}{\!getsincos }%
+ {\!getsincos by {\!cosrotationangle} {\!sinrotationangle} }}
+\def\!getsincos by #1 #2 {%
+ \edef\!cosrotationangle{#1}%
+ \edef\!sinrotationangle{#2}%
+ \!ifcoordmode
+ \let\!ROnext=\!ccheckforpivot
+ \else
+ \let\!ROnext=\!dcheckforpivot
+ \fi
+ \!ROnext}
+\def\!ccheckforpivot{%
+ \!ifnextchar{a}{\!cgetpivot}%
+ {\!cgetpivot about {\!xpivotcoord} {\!ypivotcoord} }}
+\def\!cgetpivot about #1 #2 {%
+ \edef\!xpivotcoord{#1}%
+ \edef\!ypivotcoord{#2}%
+ \!xpivot=#1\!xunit \!ypivot=#2\!yunit
+ \ignorespaces}
+\def\!dcheckforpivot{%
+ \!ifnextchar{a}{\!dgetpivot}{\ignorespaces}}
+\def\!dgetpivot about #1 #2 {%
+ \!xpivot=#1\relax \!ypivot=#2\relax
+ \ignorespaces}
+
+
+% ** Following terminates rotation.
+% ** See Subsection 9.1 of the manual.
+\def\stoprotation{%
+ \let\!rotateaboutpivot=\!!!rotateaboutpivot
+ \let\!rotateonly=\!!!rotateonly
+ \ignorespaces}
+
+% ** !!rotateaboutpivot{XREG}{YREG}
+% ** XREG <-- xpvt + cos(angle)*(XREG-xpvt) - sin(angle)*(YREG-ypvt)
+% ** YREG <-- ypvt + cos(angle)*(YREG-ypvt) + sin(angle)*(XREG-xpvt)
+% ** XREG,YREG are dimension registers. Can't be \!dimenA to \!dimenD
+\def\!!rotateaboutpivot#1#2{%
+ \!dimenA=#1\relax \advance\!dimenA -\!xpivot
+ \!dimenB=#2\relax \advance\!dimenB -\!ypivot
+ \!dimenC=\!cosrotationangle\!dimenA
+ \advance \!dimenC -\!sinrotationangle\!dimenB
+ \!dimenD=\!cosrotationangle\!dimenB
+ \advance \!dimenD \!sinrotationangle\!dimenA
+ \advance\!dimenC \!xpivot \advance\!dimenD \!ypivot
+ #1=\!dimenC #2=\!dimenD
+ \ignorespaces}
+
+% ** \!!rotateonly{XREG}{YREG}
+% ** Like \!!rotateaboutpivot, but with a pivot of (0,0)
+\def\!!rotateonly#1#2{%
+ \!dimenA=#1\relax \!dimenB=#2\relax
+ \!dimenC=\!cosrotationangle\!dimenA
+ \advance \!dimenC -\!rotsign\!sinrotationangle\!dimenB
+ \!dimenD=\!cosrotationangle\!dimenB
+ \advance \!dimenD \!rotsign\!sinrotationangle\!dimenA
+ #1=\!dimenC #2=\!dimenD
+ \ignorespaces}
+\def\!rotsign{}
+\def\!!!rotateaboutpivot#1#2{\relax}
+\def\!!!rotateonly#1#2{\relax}
+\stoprotation
+
+\def\!reverserotateonly#1#2{%
+ \def\!rotsign{-}%
+ \!rotateonly{#1}{#2}%
+ \def\!rotsign{}%
+ \ignorespaces}
+
+
+% **********************************
+% *** SHADING (Handles shading) ***
+% **********************************
+
+% ** User commands
+% ** \setshadegrid [span <SPAN>] [point at XSHADE YSHADE]
+% ** \setshadesymbol [<LS, RS, BS, TS>] ({SHADESYMBOL}
+% ** <XDIMEN,YDIMEN> [ORIENTATION])
+
+% ** Internal commands:
+% ** \!startvshade (xS,ybS,ytS)
+% ** \!starthshade (yS,xlS,xrS)
+% ** \!lshade [<LS,RS,BS,TS>]
+% ** ** when shading vertically:
+% ** [the region from (xS,ybS,ytS) to] (xE,ybE,ytE)
+% ** ** when shading horizontally:
+% ** [the region from (yS,xlS,xrS) to] (yE,xlE,xrE)
+% ** \!qshade [<LS,RS,BS,TS>]
+% ** ** when shading vertically:
+% ** [the region from (xS,ybS,ytS) to] (xM,ybM,ytM) (xE,ybE,ytE)
+% ** ** when shading horizontally:
+% ** [the region from (yS,xlS,xrS) to] (yM,xlM,xrM) (yE,xlE,xrE)
+% ** \!lattice{ANCHOR}{SPAN}{LOCATION}{INDEX}{LATTICE LOCATION}
+% ** \!override{NOMINAL DIMEN}{REPLACEMENT DIMEN}{DIMEN}
+
+
+% ** The shading routine can operate either in a "vertical mode" or a
+% ** "horizontal mode". In vertical mode, the region to be shaded is specified
+% ** in the form
+% ** {(x,y): xl <= x <= xr & yb(x) <= y <= yt(x)}
+% ** where yb and yt are functions of x. In horizontal mode, the region
+% ** is specified in the form
+% ** {(x,y): yb <= y <= yt & xl(y) <= x <= xr(y)}.
+% ** The functions yb and yt may be either both linear or both quadratic;
+% ** similarly for xl and xr. A region with say, piecewise quadratic bottom
+% ** and top boundaries, can be shaded by consecutive (vertical) \!qshades,
+% ** proceeding from left to right. Similarly, a region with piecewise
+% ** quadratic left and right boundaries can be shaded by consecutive
+% ** (horizontal) \!qshades, proceeding from bottom to top. More complex
+% ** regions can be shaded by partitioning them into appropriate subregions,
+% ** and shading those.
+
+% ** Shading is accomplished by placing a user-selected shading symbol at
+% ** those points of a regular grid which fall within the region to be
+% ** shaded. This region can be "shrunk" so that a largish shading symbol
+% ** will not extend outside it. Shrinking is accomplished by specifying
+% ** shrinkages for the left, right, bottom, and top boundaries, in a manner
+% ** discussed further below.
+
+% ** \shades and \!joins MUST NOT be intermingled. Finish drawing a curve
+% ** before starting to shade a region, and finish shading a region before
+% ** starting to draw a curve.
+
+
+% ** \setshadegrid [span <SPAN>] [point at XSHADE YSHADE]
+% ** The shading symbol is placed down on the points of a grid centered
+% ** at the coordinate point (XSHADE,YSHADE). The grid points are of the
+% ** form (j*SPAN,k*SPAN), with j+k even. SPAN is specified
+% ** as a dimension.
+% ** (XSHADE,YSHADE) defaults to previous (XSHADE,YSHADE) (or (0,0) if none)
+% ** SPAN defaults to previous span (or 5pt if none)
+% ** See Subsection 7.2 of the manual.
+\def\setshadegrid{%
+ \!ifnextchar{s}{\!getspan }
+ {\!getspan span <\!dshade>}}
+\def\!getspan span <#1>{%
+ \!dshade=#1\relax
+ \!ifcoordmode
+ \let\!GRnext=\!GRccheckforAP
+ \else
+ \let\!GRnext=\!GRdcheckforAP
+ \fi
+ \!GRnext}
+\def\!GRccheckforAP{%
+ \!ifnextchar{p}{\!cgetanchor }
+ {\!cgetanchor point at {\!xshadesave} {\!yshadesave} }}
+\def\!cgetanchor point at #1 #2 {%
+ \edef\!xshadesave{#1}\edef\!yshadesave{#2}%
+ \!xshade=\!xshadesave\!xunit \!yshade=\!yshadesave\!yunit
+ \ignorespaces}
+\def\!GRdcheckforAP{%
+ \!ifnextchar{p}{\!dgetanchor}%
+ {\ignorespaces}}
+\def\!dgetanchor point at #1 #2 {%
+ \!xshade=#1\relax \!yshade=#2\relax
+ \ignorespaces}
+
+% ** \setshadesymbol [<LS, RS, BS, TS>] ({SHADESYMBOL}
+% ** <XDIMEN,YDIMEN> [ORIENTATION])
+% ** Saves SHADESYMBOL away in an hbox for use with shading routines.
+% ** A shade symbol will not be plotted if its plot position comes within
+% ** distance LS of the left boundary, RS of the right boundary, TS of the
+% ** top boundary, BS of the bottom boundary. These parameters have
+% ** default values that should work in most cases (see below).
+% ** To override a default value, specify the replacement value
+% ** in the appropriate subfield of the shrinkages field.
+% ** 0pt may be coded as "z" (without the quotes). To accept a
+% ** default value, leave the field empty. Thus
+% ** [,z,,5pt] sets LS=default, RS=0pt, BS=default, TS=5pt .
+% ** Skipping the shrinkages field accepts all the defaults.
+% ** See Subsection 7.1 of the manual.
+\def\setshadesymbol{%
+ \!ifnextchar<{\!setshadesymbol}{\!setshadesymbol<,,,> }}
+
+\def\!setshadesymbol <#1,#2,#3,#4> (#5#6){%
+% ** set the shadesymbol
+ \!setputobject{#5}{#6}%
+ \setbox\!shadesymbol=\box\!putobject%
+ \!shadesymbolxshift=\!xshift \!shadesymbolyshift=\!yshift
+%
+% ** set the shrinkages
+ \!dimenA=\!xshift \advance\!dimenA \!smidge% ** default LS = xshift - smidge
+ \!override\!dimenA{#1}\!lshrinkage%
+ \!dimenA=\!wd \advance \!dimenA -\!xshift% ** default RS = width - xshift
+ \advance\!dimenA \!smidge% - smidge
+ \!override\!dimenA{#2}\!rshrinkage
+ \!dimenA=\!dp \advance \!dimenA \!yshift% ** default BS = depth + yshift
+ \advance\!dimenA \!smidge% - smidge
+ \!override\!dimenA{#3}\!bshrinkage
+ \!dimenA=\!ht \advance \!dimenA -\!yshift% ** default TS = height - yshift
+ \advance\!dimenA \!smidge% - smidge
+ \!override\!dimenA{#4}\!tshrinkage
+ \ignorespaces}
+\def\!smidge{-.2pt}%
+
+% ** \!override{NOMINAL DIMEN}{REPLACEMENT DIMEN}{DIMEN}
+% ** Overrides the NOMINAL DIMEN by the REPLACEMENT DIMEN to produce DIMEN,
+% ** according to the following rules:
+% ** REPLACEMENT DIMEN empty: DIMEN <-- NOMINAL DIMEN
+% ** REPLACEMENT DIMEN z: DIMEN <-- 0pt
+% ** otherwise: DIMEN <-- REPLACEMENT DIMEN
+% ** DIMEN must be a dimension register
+\def\!override#1#2#3{%
+ \edef\!!override{#2}%
+ \ifx \!!override\empty
+ #3=#1\relax
+ \else
+ \if z\!!override
+ #3=\!zpt
+ \else
+ \ifx \!!override\!blankz
+ #3=\!zpt
+ \else
+ #3=#2\relax
+ \fi
+ \fi
+ \fi
+ \ignorespaces}
+\def\!blankz{ z}
+
+\setshadesymbol ({\fiverm .})% ** initialize plotsymbol
+% ** \fivesy ^^B is a small cross
+
+
+% ** \!startvshade [at] (xS,ybS,ytS)
+% ** Initiates vertical shading mode
+\def\!startvshade#1(#2,#3,#4){%
+ \let\!!xunit=\!xunit%
+ \let\!!yunit=\!yunit%
+ \let\!!xshade=\!xshade%
+ \let\!!yshade=\!yshade%
+ \def\!getshrinkages{\!vgetshrinkages}%
+ \let\!setshadelocation=\!vsetshadelocation%
+ \!xS=\!M{#2}\!!xunit
+ \!ybS=\!M{#3}\!!yunit
+ \!ytS=\!M{#4}\!!yunit
+ \!shadexorigin=\!xorigin \advance \!shadexorigin \!shadesymbolxshift
+ \!shadeyorigin=\!yorigin \advance \!shadeyorigin \!shadesymbolyshift
+ \ignorespaces}
+
+% ** \!starthshade [at] (yS,xlS,xrS)
+% ** Initiates horizontal shading mode
+\def\!starthshade#1(#2,#3,#4){%
+ \let\!!xunit=\!yunit%
+ \let\!!yunit=\!xunit%
+ \let\!!xshade=\!yshade%
+ \let\!!yshade=\!xshade%
+ \def\!getshrinkages{\!hgetshrinkages}%
+ \let\!setshadelocation=\!hsetshadelocation%
+ \!xS=\!M{#2}\!!xunit
+ \!ybS=\!M{#3}\!!yunit
+ \!ytS=\!M{#4}\!!yunit
+ \!shadexorigin=\!xorigin \advance \!shadexorigin \!shadesymbolxshift
+ \!shadeyorigin=\!yorigin \advance \!shadeyorigin \!shadesymbolyshift
+ \ignorespaces}
+
+
+% ** \!lattice{ANCHOR}{SPAN}{LOCATION}{INDEX}{LATTICE LOCATION}
+% ** Consider the lattice with points ANCHOR + j*SPAN. This routine determines
+% ** the index k of the smallest lattice point >= LOCATION, and sets
+% ** LATTICE LOCATION = ANCHOR + k*SPAN.
+% ** INDEX is assumed to be a count register, LATTICE LOCATION a dimen reg.
+\def\!lattice#1#2#3#4#5{%
+ \!dimenA=#1% ** dimA = ANCHOR
+ \!dimenB=#2% ** dimB = SPAN (assumed > 0pt)
+ \!countB=\!dimenB% ** ctB = SPAN, as a count
+%
+% ** Determine index of smallest lattice point >= LOCATION
+ \!dimenC=#3% ** dimC = LOCATION
+ \advance\!dimenC -\!dimenA% ** now dimC = LOCATION-ANCHOR
+ \!countA=\!dimenC% ** ctA = above, as a count
+ \divide\!countA \!countB% ** now ctA = desired index, if dimC <= 0
+ \ifdim\!dimenC>\!zpt
+ \!dimenD=\!countA\!dimenB% ** (tentative k)*span
+ \ifdim\!dimenD<\!dimenC% ** if this is false, ctA = desired index
+ \advance\!countA 1 % ** if true, have to add 1
+ \fi
+ \fi
+%
+ \!dimenC=\!countA\!dimenB% ** lattice location = anchor + ctA*span
+ \advance\!dimenC \!dimenA
+ #4=\!countA% ** the desired index
+ #5=\!dimenC% ** corresponding lattice location
+ \ignorespaces}
+
+
+% ** \!qshade [with shrinkages] [[LS,RS,BS,TS]]
+% ***** during vertical shading:
+% ** [the region from (xS,ybS,ytS) to] (xM,ybM,ytM) [and] (xE,ybE,ytE)
+% ** Shades the region {(x,y): xS <= x <= xE, yb(x) <= y <= yt(x)}, where
+% ** yb is the quadratic thru (xS,ybS) & (xM,ybM) & (xE,ybE)
+% ** yt is the quadratic thru (xS,ytS) & (xM,ybM) & (xE,ytE)
+% ** xS,ybS,ytS are either given by \!startvshade or carried over
+% ** as the ending values of the immediately preceding \!qshade.
+% ** For the interpretation of LS, RS, BS, & TS, see \setshadesymbol. The
+% ** values set there can be overridden, for the course of this \!qshade
+% ** only, in the same manner as overrides are specified for
+% ** \setshadesymbol.
+% ***** during horizontal shading:
+% ** [the region from (yS,xlS,xrS) to] (yM,xlM,xrM) [and] (yE,xlE,xrE)
+\def\!qshade#1(#2,#3,#4)#5(#6,#7,#8){%
+ \!xM=\!M{#2}\!!xunit
+ \!ybM=\!M{#3}\!!yunit
+ \!ytM=\!M{#4}\!!yunit
+ \!xE=\!M{#6}\!!xunit
+ \!ybE=\!M{#7}\!!yunit
+ \!ytE=\!M{#8}\!!yunit
+ \!getcoeffs\!xS\!ybS\!xM\!ybM\!xE\!ybE\!ybB\!ybC%**Get coefficients B & C for
+ \!getcoeffs\!xS\!ytS\!xM\!ytM\!xE\!ytE\!ytB\!ytC%**y=y0 + B(x-X0) + C(x-X0)**2
+ \def\!getylimits{\!qgetylimits}%
+ \!shade{#1}\ignorespaces}
+
+% ** \!lshade ... (xE,ybE,ytE)
+% ** This is like \!qshade, but the top and bottom boundaries are linear,
+% ** rather than quadratic.
+\def\!lshade#1(#2,#3,#4){%
+ \!xE=\!M{#2}\!!xunit
+ \!ybE=\!M{#3}\!!yunit
+ \!ytE=\!M{#4}\!!yunit
+ \!dimenE=\!xE \advance \!dimenE -\!xS% ** xE-xS
+ \!dimenC=\!ytE \advance \!dimenC -\!ytS% ** ytE-ytS
+ \!divide\!dimenC\!dimenE\!ytB% ** ytB = (ytE-ytS)/(xE-xS)
+ \!dimenC=\!ybE \advance \!dimenC -\!ybS% ** ybE-ybS
+ \!divide\!dimenC\!dimenE\!ybB% ** ybB = (ybE-ybS)/(xE-xS)
+ \def\!getylimits{\!lgetylimits}%
+ \!shade{#1}\ignorespaces}
+
+% ** \!getcoeffs{X0}{Y0}{X1}{Y1}{X2}{Y2}{B}{C}
+% ** Finds B and C such that the quadratic y = Y0 + B(x-X0) + C(x-X0)**2
+% ** passes through (X1,Y1) and (X2,Y2): when X0=0=Y0, the formulas are:
+% ** B = S1 - X1*C, C = (S2-S1)/X2
+% ** with
+% ** S1 = Y1/X1, S2 = (Y2-Y1)/(X2-X1).
+\def\!getcoeffs#1#2#3#4#5#6#7#8{%
+ \!dimenC=#4\advance \!dimenC -#2% ** dimC=Y1-Y0
+ \!dimenE=#3\advance \!dimenE -#1% ** dimE=X1-X0
+ \!divide\!dimenC\!dimenE\!dimenF% ** dimF=S1
+ \!dimenC=#6\advance \!dimenC -#4% ** dimC=Y2-Y1
+ \!dimenH=#5\advance \!dimenH -#3% ** dimH=X2-X1
+ \!divide\!dimenC\!dimenH\!dimenG% ** dimG=S2
+ \advance\!dimenG -\!dimenF% ** dimG=S2-S1
+ \advance \!dimenH \!dimenE% ** dimH=X2-X0
+ \!divide\!dimenG\!dimenH#8% ** C=(S2-S1)/(X2-X0)
+ \!removept#8\!t% ** C, without "pt"
+ #7=-\!t\!dimenE% ** -C*(X1-X0)
+ \advance #7\!dimenF% ** B=S1-C*(X1-X0)
+ \ignorespaces}
+
+
+\def\!shade#1{%
+% ** Get LS,RS,BS,TS for this panel
+ \!getshrinkages#1<,,,>\!nil% % ** now effective LS=dimE, RS=dimF,
+% ** BS=dimG, TS=dimH
+ \advance \!dimenE \!xS% ** now dimE=xS+LS
+ \!lattice\!!xshade\!dshade\!dimenE% ** set parity=index of left-mst x-lattice
+ \!parity\!xpos% ** point >= xS+LS, xpos=its location
+ \!dimenF=-\!dimenF% ** set dimF=xE-RS
+ \advance\!dimenF \!xE
+%
+ \!loop\!not{\ifdim\!xpos>\!dimenF}% ** loop over x-lattice points <= xE-RS
+ \!shadecolumn%
+ \advance\!xpos \!dshade% ** move over to next column
+ \advance\!parity 1% ** increase index of x-point
+ \repeat
+%
+ \!xS=\!xE% ** shift ending values to starting values
+ \!ybS=\!ybE
+ \!ytS=\!ytE
+ \ignorespaces}
+
+
+\def\!vgetshrinkages#1<#2,#3,#4,#5>#6\!nil{%
+ \!override\!lshrinkage{#2}\!dimenE
+ \!override\!rshrinkage{#3}\!dimenF
+ \!override\!bshrinkage{#4}\!dimenG
+ \!override\!tshrinkage{#5}\!dimenH
+ \ignorespaces}
+\def\!hgetshrinkages#1<#2,#3,#4,#5>#6\!nil{%
+ \!override\!lshrinkage{#2}\!dimenG
+ \!override\!rshrinkage{#3}\!dimenH
+ \!override\!bshrinkage{#4}\!dimenE
+ \!override\!tshrinkage{#5}\!dimenF
+ \ignorespaces}
+
+
+\def\!shadecolumn{%
+ \!dxpos=\!xpos
+ \advance\!dxpos -\!xS% ** dx = x - xS
+ \!removept\!dxpos\!dx% ** ditto, without "pt"
+ \!getylimits% ** get top and bottom y-values
+ \advance\!ytpos -\!dimenH% ** less TS
+ \advance\!ybpos \!dimenG% ** plus BS
+ \!yloc=\!!yshade% ** get anchor point for this column
+ \ifodd\!parity
+ \advance\!yloc \!dshade
+ \fi
+ \!lattice\!yloc{2\!dshade}\!ybpos%
+ \!countA\!ypos% ** ypos=smallest y point for this column
+ \!dimenA=-\!shadexorigin \advance \!dimenA \!xpos% ** over
+ \loop\!not{\ifdim\!ypos>\!ytpos}% ** loop over ypos <= yt(t)
+ \!setshadelocation% ** vmode: xloc=xpos, yloc=ypos
+% ** hmode: xloc=ypos, yloc=xpos
+ \!rotateaboutpivot\!xloc\!yloc%
+ \!dimenA=-\!shadexorigin \advance \!dimenA \!xloc% ** over
+ \!dimenB=-\!shadeyorigin \advance \!dimenB \!yloc% ** up
+ \kern\!dimenA \raise\!dimenB\copy\!shadesymbol \kern-\!dimenA
+ \advance\!ypos 2\!dshade
+ \repeat
+ \ignorespaces}
+
+\def\!qgetylimits{%
+ \!dimenA=\!dx\!ytC
+ \advance\!dimenA \!ytB% ** yt(t)=ytS + dx*(Bt + dx*Ct)
+ \!ytpos=\!dx\!dimenA
+ \advance\!ytpos \!ytS
+ \!dimenA=\!dx\!ybC
+ \advance\!dimenA \!ybB% ** yb(t)=ybS + dx*(Bb + dx*Cb)
+ \!ybpos=\!dx\!dimenA
+ \advance\!ybpos \!ybS}
+
+\def\!lgetylimits{%
+ \!ytpos=\!dx\!ytB% ** yt(t)=ytS + dx*Bt
+ \advance\!ytpos \!ytS
+ \!ybpos=\!dx\!ybB% ** yb(t)=ybS + dx*Bb
+ \advance\!ybpos \!ybS}
+
+\def\!vsetshadelocation{% ** vmode: xloc=xpos, yloc=ypos
+ \!xloc=\!xpos
+ \!yloc=\!ypos}
+\def\!hsetshadelocation{% ** hmode: xloc=ypos, yloc=xpos
+ \!xloc=\!ypos
+ \!yloc=\!xpos}
+
+
+% **************************************
+% *** TICKS (Draws ticks on graphs) ***
+% **************************************
+
+% ** User commands
+% ** \ticksout
+% ** \ticksin
+% ** \gridlines
+% ** \nogridlines
+% ** \loggedticks
+% ** \unloggesticks
+% ** See Subsection 3.4 of the manual
+
+% ** The following is an option of the \axis command
+% ** ticks
+% ** [in] [out]
+% ** [long] [short] [length <LENGTH>]
+% ** [width <WIDTH>]
+% ** [andacross] [butnotacross]
+% ** [logged] [unlogged]
+% ** [unlabeled] [numbered] [withvalues VALUE1 VALUE2 ... VALUEk / ]
+% ** [quantity Q] [at LOC1 LOC2 ... LOCk / ] [from LOC1 to LOC2 by
+% ** LOC_INCREMENT]
+% ** See Subsection 3.2 of the manual for the rules.
+
+% ** The various options of the tick field are processed by the
+% ** \!nextkeyword command defined below.
+% ** For example, `\!nextkeyword short ' expands to `\!ticksshort',
+% ** while `\!nextkeyword withvalues' expands to `\!tickswithvalues'.
+
+\def\!axisticks {%
+ \def\!nextkeyword##1 {%
+ \expandafter\ifx\csname !ticks##1\endcsname \relax
+ \def\!next{\!fixkeyword{##1}}%
+ \else
+ \def\!next{\csname !ticks##1\endcsname}%
+ \fi
+ \!next}%
+ \!axissetup
+ \def\!axissetup{\relax}%
+ \edef\!ticksinoutsign{\!ticksinoutSign}%
+ \!ticklength=\longticklength
+ \!tickwidth=\linethickness
+ \!gridlinestatus
+ \!setticktransform
+ \!maketick
+ \!tickcase=0
+ \def\!LTlist{}%
+ \!nextkeyword}
+
+\def\ticksout{%
+ \def\!ticksinoutSign{+}}
+\def\ticksin{%
+ \def\!ticksinoutSign{-}}
+\ticksout
+
+\def\gridlines{%
+ \def\!gridlinestatus{\!gridlinestootrue}}
+\def\nogridlines{%
+ \def\!gridlinestatus{\!gridlinestoofalse}}
+\nogridlines
+
+\def\loggedticks{%
+ \def\!setticktransform{\let\!ticktransform=\!logten}}
+\def\unloggedticks{%
+ \def\!setticktransform{\let\!ticktransform=\!donothing}}
+\def\!donothing#1#2{\def#2{#1}}
+\unloggedticks
+
+% ** \!ticks/ : terminates read of tick options
+\expandafter\def\csname !ticks/\endcsname{%
+ \!not {\ifx \!LTlist\empty}
+ \!placetickvalues
+ \fi
+ \def\!tickvalueslist{}%
+ \def\!LTlist{}%
+ \expandafter\csname !axis/\endcsname}
+
+\def\!maketick{%
+ \setbox\!boxA=\hbox{%
+ \beginpicture
+ \!setdimenmode
+ \setcoordinatesystem point at {\!zpt} {\!zpt}
+ \linethickness=\!tickwidth
+ \ifdim\!ticklength>\!zpt
+ \putrule from {\!zpt} {\!zpt} to
+ {\!ticksinoutsign\!tickxsign\!ticklength}
+ {\!ticksinoutsign\!tickysign\!ticklength}
+ \fi
+ \if!gridlinestoo
+ \putrule from {\!zpt} {\!zpt} to
+ {-\!tickxsign\!xaxislength} {-\!tickysign\!yaxislength}
+ \fi
+ \endpicturesave <\!Xsave,\!Ysave>}%
+ \wd\!boxA=\!zpt}
+
+\def\!ticksin{%
+ \def\!ticksinoutsign{-}%
+ \!maketick
+ \!nextkeyword}
+
+\def\!ticksout{%
+ \def\!ticksinoutsign{+}%
+ \!maketick
+ \!nextkeyword}
+
+\def\!tickslength<#1> {%
+ \!ticklength=#1\relax
+ \!maketick
+ \!nextkeyword}
+
+\def\!tickslong{%
+ \!tickslength<\longticklength> }
+
+\def\!ticksshort{%
+ \!tickslength<\shortticklength> }
+
+\def\!tickswidth<#1> {%
+ \!tickwidth=#1\relax
+ \!maketick
+ \!nextkeyword}
+
+\def\!ticksandacross{%
+ \!gridlinestootrue
+ \!maketick
+ \!nextkeyword}
+
+\def\!ticksbutnotacross{%
+ \!gridlinestoofalse
+ \!maketick
+ \!nextkeyword}
+
+\def\!tickslogged{%
+ \let\!ticktransform=\!logten
+ \!nextkeyword}
+
+\def\!ticksunlogged{%
+ \let\!ticktransform=\!donothing
+ \!nextkeyword}
+
+\def\!ticksunlabeled{%
+ \!tickcase=0
+ \!nextkeyword}
+
+\def\!ticksnumbered{%
+ \!tickcase=1
+ \!nextkeyword}
+
+\def\!tickswithvalues#1/ {%
+ \edef\!tickvalueslist{#1! /}%
+ \!tickcase=2
+ \!nextkeyword}
+
+\def\!ticksquantity#1 {%
+ \ifnum #1>1
+ \!updatetickoffset
+ \!countA=#1\relax
+ \advance \!countA -1
+ \!ticklocationincr=\!axisLength
+ \divide \!ticklocationincr \!countA
+ \!ticklocation=\!axisstart
+ \loop \!not{\ifdim \!ticklocation>\!axisend}
+ \!placetick\!ticklocation
+ \ifcase\!tickcase
+ \relax % Case 0: no labels
+ \or
+ \relax % Case 1: numbered -- not available here
+ \or
+ \expandafter\!gettickvaluefrom\!tickvalueslist
+ \edef\!tickfield{{\the\!ticklocation}{\!value}}%
+ \expandafter\!listaddon\expandafter{\!tickfield}\!LTlist%
+ \fi
+ \advance \!ticklocation \!ticklocationincr
+ \repeat
+ \fi
+ \!nextkeyword}
+
+\def\!ticksat#1 {%
+ \!updatetickoffset
+ \edef\!Loc{#1}%
+ \if /\!Loc
+ \def\next{\!nextkeyword}%
+ \else
+ \!ticksincommon
+ \def\next{\!ticksat}%
+ \fi
+ \next}
+
+\def\!ticksfrom#1 to #2 by #3 {%
+ \!updatetickoffset
+ \edef\!arg{#3}%
+ \expandafter\!separate\!arg\!nil
+ \!scalefactor=1
+ \expandafter\!countfigures\!arg/
+ \edef\!arg{#1}%
+ \!scaleup\!arg by\!scalefactor to\!countE
+ \edef\!arg{#2}%
+ \!scaleup\!arg by\!scalefactor to\!countF
+ \edef\!arg{#3}%
+ \!scaleup\!arg by\!scalefactor to\!countG
+ \loop \!not{\ifnum\!countE>\!countF}
+ \ifnum\!scalefactor=1
+ \edef\!Loc{\the\!countE}%
+ \else
+ \!scaledown\!countE by\!scalefactor to\!Loc
+ \fi
+ \!ticksincommon
+ \advance \!countE \!countG
+ \repeat
+ \!nextkeyword}
+
+\def\!updatetickoffset{%
+ \!dimenA=\!ticksinoutsign\!ticklength
+ \ifdim \!dimenA>\!offset
+ \!offset=\!dimenA
+ \fi}
+
+\def\!placetick#1{%
+ \if!xswitch
+ \!xpos=#1\relax
+ \!ypos=\!axisylevel
+ \else
+ \!xpos=\!axisxlevel
+ \!ypos=#1\relax
+ \fi
+ \advance\!xpos \!Xsave
+ \advance\!ypos \!Ysave
+ \kern\!xpos\raise\!ypos\copy\!boxA\kern-\!xpos
+ \ignorespaces}
+
+\def\!gettickvaluefrom#1 #2 /{%
+ \edef\!value{#1}%
+ \edef\!tickvalueslist{#2 /}%
+ \ifx \!tickvalueslist\!endtickvaluelist
+ \!tickcase=0
+ \fi}
+\def\!endtickvaluelist{! /}
+
+\def\!ticksincommon{%
+ \!ticktransform\!Loc\!t
+ \!ticklocation=\!t\!!unit
+ \advance\!ticklocation -\!!origin
+ \!placetick\!ticklocation
+ \ifcase\!tickcase
+ \relax % Case 0: no labels
+ \or % Case 1: numbered
+ \ifdim\!ticklocation<-\!!origin
+ \edef\!Loc{$\!Loc$}%
+ \fi
+ \edef\!tickfield{{\the\!ticklocation}{\!Loc}}%
+ \expandafter\!listaddon\expandafter{\!tickfield}\!LTlist%
+ \or % Case 2: labeled
+ \expandafter\!gettickvaluefrom\!tickvalueslist
+ \edef\!tickfield{{\the\!ticklocation}{\!value}}%
+ \expandafter\!listaddon\expandafter{\!tickfield}\!LTlist%
+ \fi}
+
+\def\!separate#1\!nil{%
+ \!ifnextchar{-}{\!!separate}{\!!!separate}#1\!nil}
+\def\!!separate-#1\!nil{%
+ \def\!sign{-}%
+ \!!!!separate#1..\!nil}
+\def\!!!separate#1\!nil{%
+ \def\!sign{+}%
+ \!!!!separate#1..\!nil}
+\def\!!!!separate#1.#2.#3\!nil{%
+ \def\!arg{#1}%
+ \ifx\!arg\!empty
+ \!countA=0
+ \else
+ \!countA=\!arg
+ \fi
+ \def\!arg{#2}%
+ \ifx\!arg\!empty
+ \!countB=0
+ \else
+ \!countB=\!arg
+ \fi}
+
+\def\!countfigures#1{%
+ \if #1/%
+ \def\!next{\ignorespaces}%
+ \else
+ \multiply\!scalefactor 10
+ \def\!next{\!countfigures}%
+ \fi
+ \!next}
+
+\def\!scaleup#1by#2to#3{%
+ \expandafter\!separate#1\!nil
+ \multiply\!countA #2\relax
+ \advance\!countA \!countB
+ \if -\!sign
+ \!countA=-\!countA
+ \fi
+ #3=\!countA
+ \ignorespaces}
+
+\def\!scaledown#1by#2to#3{%
+ \!countA=#1\relax% ** get original #
+ \ifnum \!countA<0 % ** take abs value,
+ \def\!sign{-}% ** remember sign
+ \!countA=-\!countA
+ \else
+ \def\!sign{}%
+ \fi
+ \!countB=\!countA% ** copy |#|
+ \divide\!countB #2\relax% ** integer part (|#|/sf)
+ \!countC=\!countB% ** get sf * (|#|/sf)
+ \multiply\!countC #2\relax
+ \advance \!countA -\!countC% ** ctA is now remainder
+ \edef#3{\!sign\the\!countB.}% ** +- integerpart.
+ \!countC=\!countA % ** Tack on proper number
+ \ifnum\!countC=0 % ** of zeros after .
+ \!countC=1
+ \fi
+ \multiply\!countC 10
+ \!loop \ifnum #2>\!countC
+ \edef#3{#3\!zero}%
+ \multiply\!countC 10
+ \repeat
+ \edef#3{#3\the\!countA}% ** Add on rest of remainder
+ \ignorespaces}
+
+\def\!placetickvalues{%
+ \advance\!offset \tickstovaluesleading
+ \if!xswitch
+ \setbox\!boxA=\hbox{%
+ \def\\##1##2{%
+ \!dimenput {##2} [B] (##1,\!axisylevel)}%
+ \beginpicture
+ \!LTlist
+ \endpicturesave <\!Xsave,\!Ysave>}%
+ \!dimenA=\!axisylevel
+ \advance\!dimenA -\!Ysave
+ \advance\!dimenA \!tickysign\!offset
+ \if -\!tickysign
+ \advance\!dimenA -\ht\!boxA
+ \else
+ \advance\!dimenA \dp\!boxA
+ \fi
+ \advance\!offset \ht\!boxA
+ \advance\!offset \dp\!boxA
+ \!dimenput {\box\!boxA} [Bl] <\!Xsave,\!Ysave> (\!zpt,\!dimenA)
+ \else
+ \setbox\!boxA=\hbox{%
+ \def\\##1##2{%
+ \!dimenput {##2} [r] (\!axisxlevel,##1)}%
+ \beginpicture
+ \!LTlist
+ \endpicturesave <\!Xsave,\!Ysave>}%
+ \!dimenA=\!axisxlevel
+ \advance\!dimenA -\!Xsave
+ \advance\!dimenA \!tickxsign\!offset
+ \if -\!tickxsign
+ \advance\!dimenA -\wd\!boxA
+ \fi
+ \advance\!offset \wd\!boxA
+ \!dimenput {\box\!boxA} [Bl] <\!Xsave,\!Ysave> (\!dimenA,\!zpt)
+ \fi}
+
+
+\normalgraphs
+
+% \catcode`!=12 % ***** THIS MUST NEVER BE OMITTED
+
+\protect \endinput
diff --git a/tex/context/base/thrd-tab.tex b/tex/context/base/thrd-tab.tex
index a2123efef..7189d6a19 100644
--- a/tex/context/base/thrd-tab.tex
+++ b/tex/context/base/thrd-tab.tex
@@ -6,6 +6,9 @@
% and/or extended in core-tab.tex. The extensions concern
% splitting over pages, color and consistent spacing.
+% We've patched this file for catcode ! because in luatex we use
+% catcode tables and using unprotect/protect is cleaner.
+
% TABLE 1.0
% Copyright Michael J. Wichura August 1988
@@ -108,8 +111,10 @@
% ~ t
%
-\catcode `\!=11
-\catcode `\@=11
+\unprotect
+
+% \catcode `\!=11
+% \catcode `\@=11
\newif\ifh@ % normally in plain tex
\newif\ifv@ % normally in plain tex
@@ -1959,7 +1964,8 @@
% Restore meaning of \\, and reset category codes
% *********************************************************************
\let\\=\!tacr
-\catcode`\!=12
-\catcode`\@=12
-\endinput
+% \catcode`\!=12
+% \catcode`\@=12
+
+\protect \endinput
diff --git a/tex/context/base/type-buy.tex b/tex/context/base/type-buy.tex
index 7598371f6..533f727d7 100644
--- a/tex/context/base/type-buy.tex
+++ b/tex/context/base/type-buy.tex
@@ -885,6 +885,36 @@
\definefontsynonym [SansSlanted] [SyntaxLT-Italic]
\definefontsynonym [SansBold] [SyntaxLT-Black]
\definefontsynonym [SansBoldItalic] [SyntaxLT-Black]
+ \definefontsynonym [SansBoldSlanted][SyntaxLT-Black]
+
+\stoptypescript
+
+% linotype linoletter
+
+\starttypescript [serif] [linoletter] [ec,texnansi]
+
+ \loadmapfile[\typescriptthree-linotype-linoletter.map]
+
+ \definefontsynonym[LinoLetterLT-Roman] [texnansi-lte51129] [encoding=\typescriptthree]
+ \definefontsynonym[LinoLetterLT-Italic] [texnansi-lte51130] [encoding=\typescriptthree]
+ \definefontsynonym[LinoLetterLT-Bold] [texnansi-lte51133] [encoding=\typescriptthree]
+ \definefontsynonym[LinoLetterLT-BoldItalic] [texnansi-lte51134] [encoding=\typescriptthree]
+
+ \definefontsynonym[LinoLetterLT-BlackItalic] [texnansi-lte51136] [encoding=\typescriptthree]
+ \definefontsynonym[LinoLetter-MediumSC] [texnansi-llmsc] [encoding=\typescriptthree]
+
+\stoptypescript
+
+\starttypescript [serif] [linoletter] [name]
+
+ \loadmapfile[\typescriptthree-linotype-linoletter.map]
+
+ \definefontsynonym [Serif] [LinoLetterLT-Roman]
+ \definefontsynonym [SerifItalic] [LinoLetterLT-Italic]
+ \definefontsynonym [SerifSlanted] [LinoLetterLT-Italic]
+ \definefontsynonym [SerifBold] [LinoLetterLT-Bold]
+ \definefontsynonym [SerifBoldItalic] [LinoLetterLT-BoldItalic]
+ \definefontsynonym [SerifBoldSlanted][LinoLetterLT-BoldItalic]
\stoptypescript
diff --git a/tex/context/base/unic-exp.tex b/tex/context/base/unic-exp.tex
index 6ed2ef38d..7d7f9f0c5 100644
--- a/tex/context/base/unic-exp.tex
+++ b/tex/context/base/unic-exp.tex
@@ -77,6 +77,6 @@
%D Let's use it:
-\expandunivector[0,1,2,3,4,5,30,31,32,33]
+\expandunivector[0,1,2,3,4,5,30,31,32,33,34,37,39]
\protect \endinput
diff --git a/tex/context/base/unic-ini.tex b/tex/context/base/unic-ini.tex
index 68632338e..ec85c3c9e 100644
--- a/tex/context/base/unic-ini.tex
+++ b/tex/context/base/unic-ini.tex
@@ -735,7 +735,34 @@
\endTEX
\def\uchartoutf#1#2%
- {\expandafter\numbertoutf\expandafter{\the\numexpr#1*256+#2\relax}}
+ {\expandafter\numbertoutf\expandafter{\the\numexpr#1*\utf@h+#2\relax}}
+
+%D Here is a mapping trick. By mapping the tex specific characters to
+%D private ones, we can prevent problems with utility files.
+
+\defineunicodecommand{240} {\doprivateunicodechar}
+
+\def\doprivateunicodechar#1#2{\char#2\relax}
+
+\def\registerprivateunicodechar#1 {\letvalue{puc::\number#1}\relax}
+
+\registerprivateunicodechar `\%
+\registerprivateunicodechar `\$
+\registerprivateunicodechar `\{
+\registerprivateunicodechar `\}
+\registerprivateunicodechar `\~
+\registerprivateunicodechar `\_
+\registerprivateunicodechar `\^
+\registerprivateunicodechar `\#
+
+\def\numbertoutp#1{\numbertoutf{\the\numexpr#1\ifcsname puc::\number#1\endcsname+"F000\fi\relax}}
+
+%D In the \XML\ expander we will do:
+%D
+%D \starttyping
+%D \def\getXMLhexcharacter##1{\numbertoutp{"##1}}%
+%D \def\getXMLdeccharacter##1{\numbertoutp {##1}}%
+%D \stoptyping
%D Goodies:
diff --git a/tex/context/base/xtag-ext.tex b/tex/context/base/xtag-ext.tex
index 26dd70f29..4de239082 100644
--- a/tex/context/base/xtag-ext.tex
+++ b/tex/context/base/xtag-ext.tex
@@ -358,8 +358,8 @@
\long\gdef\expandxmlargument#1\to
{\begingroup
\let\uppercase\firstofoneargument
- \def\getXMLhexcharacter##1{\numbertoutf{"##1}}%
- \def\getXMLdeccharacter##1{\numbertoutf{##1}}%
+ \def\getXMLhexcharacter##1{\numbertoutp{"##1}}% maps to private if needed
+ \def\getXMLdeccharacter##1{\numbertoutp {##1}}% maps to private if needed
\def\getXMLentity##1{<e>##1</e>}%
\def<{\noexpand<}%
\ifcase\xmlexpandmode
@@ -377,6 +377,16 @@
\egroup
+% test.xml: <test>test % test</test>
+%
+% \starttext
+% \enableregime[utf] \chardef\XMLtokensreduction=0
+% \setuphead[chapter][expansion=xml]
+% \defineXMLargument[test]{\chapter}
+% \placelist[chapter][criterium=text]
+% \processXMLfilegrouped{test.xml}
+% \stoptext
+
\chardef\xmlexpandmode\plusone
\installexpander {xml} {\chardef\xmlexpandmode\plusone\expandxmlargument}
diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex
index d7e01afd7..b6845a90c 100644
--- a/tex/context/base/xtag-ini.tex
+++ b/tex/context/base/xtag-ini.tex
@@ -386,12 +386,12 @@
% \def\disableXML
% {\setnormalcatcodes\processingXMLfalse}
-\letcatcodecommand\xmlcatcodesn `\& \doXMLentity
-\letcatcodecommand\xmlcatcodesn `\< \doXMLelement
-\letcatcodecommand\xmlcatcodese `\& \doXMLentity
-\letcatcodecommand\xmlcatcodese `\< \doXMLelement
-\letcatcodecommand\xmlcatcodesr `\& \doXMLentity
-\letcatcodecommand\xmlcatcodesr `\< \doXMLelement
+\defcatcodecommand\xmlcatcodese `\& \doXMLentity
+\defcatcodecommand\xmlcatcodese `\< \doXMLelement
+\defcatcodecommand\xmlcatcodesr `\& \doXMLentity
+\defcatcodecommand\xmlcatcodesr `\< \doXMLelement
+\defcatcodecommand\xmlcatcodesn `\& \doXMLentity
+\defcatcodecommand\xmlcatcodesn `\< \doXMLelement
\letcatcodecommand\xmlcatcodesr `\# \letterhash
\letcatcodecommand\xmlcatcodesr `\$ \letterdollar
@@ -403,7 +403,7 @@
\letcatcodecommand\xmlcatcodesr `\} \letterrightbrace
\letcatcodecommand\xmlcatcodesr `\| \letterbar
-\bgroup \catcode`\&=13
+\bgroup \catcode`\&=13 \let&\relax
\xdef\entityhash {&\string#035;}
\xdef\entitydollar {&\string#036;}