summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/eplain
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/eplain')
-rw-r--r--Master/texmf-dist/source/eplain/base/add-date28
-rw-r--r--Master/texmf-dist/source/eplain/base/add-version24
-rw-r--r--Master/texmf-dist/source/eplain/base/etex.tex5
-rw-r--r--Master/texmf-dist/source/eplain/base/fix-checksum20
-rw-r--r--Master/texmf-dist/source/eplain/base/merge84
-rw-r--r--Master/texmf-dist/source/eplain/base/packages.zipbin0 -> 11374 bytes
-rw-r--r--Master/texmf-dist/source/eplain/base/test/allref.tex15
-rw-r--r--Master/texmf-dist/source/eplain/base/test/boxes.tex11
-rw-r--r--Master/texmf-dist/source/eplain/base/test/boxit.tex24
-rw-r--r--Master/texmf-dist/source/eplain/base/test/catcode.tex8
-rw-r--r--Master/texmf-dist/source/eplain/base/test/center.tex12
-rw-r--r--Master/texmf-dist/source/eplain/base/test/cite.bib25
-rw-r--r--Master/texmf-dist/source/eplain/base/test/cite.tex35
-rw-r--r--Master/texmf-dist/source/eplain/base/test/citeall.tex12
-rw-r--r--Master/texmf-dist/source/eplain/base/test/citealph.tex26
-rw-r--r--Master/texmf-dist/source/eplain/base/test/citeapa.tex26
-rw-r--r--Master/texmf-dist/source/eplain/base/test/citebegin.tex20
-rw-r--r--Master/texmf-dist/source/eplain/base/test/citecust.tex38
-rw-r--r--Master/texmf-dist/source/eplain/base/test/citenote.tex13
-rw-r--r--Master/texmf-dist/source/eplain/base/test/citex.tex8
-rw-r--r--Master/texmf-dist/source/eplain/base/test/colfootn.tex18
-rw-r--r--Master/texmf-dist/source/eplain/base/test/colrule.tex33
-rw-r--r--Master/texmf-dist/source/eplain/base/test/column.tex228
-rw-r--r--Master/texmf-dist/source/eplain/base/test/column2.tex51
-rw-r--r--Master/texmf-dist/source/eplain/base/test/column3.tex23
-rw-r--r--Master/texmf-dist/source/eplain/base/test/commdiags.tex111
-rw-r--r--Master/texmf-dist/source/eplain/base/test/contents.tex30
-rw-r--r--Master/texmf-dist/source/eplain/base/test/displine.tex36
-rw-r--r--Master/texmf-dist/source/eplain/base/test/double.tex24
-rw-r--r--Master/texmf-dist/source/eplain/base/test/double2.tex163
-rw-r--r--Master/texmf-dist/source/eplain/base/test/dvipdfm.tex111
-rw-r--r--Master/texmf-dist/source/eplain/base/test/ecommdiag.tex15
-rw-r--r--Master/texmf-dist/source/eplain/base/test/emergncy.tex19
-rw-r--r--Master/texmf-dist/source/eplain/base/test/env.tex42
-rw-r--r--Master/texmf-dist/source/eplain/base/test/eqdef.tex15
-rw-r--r--Master/texmf-dist/source/eplain/base/test/eqref.tex141
-rw-r--r--Master/texmf-dist/source/eplain/base/test/example.eps389
-rw-r--r--Master/texmf-dist/source/eplain/base/test/filexist.tex22
-rw-r--r--Master/texmf-dist/source/eplain/base/test/flynn.tex7
-rw-r--r--Master/texmf-dist/source/eplain/base/test/footnote.tex88
-rw-r--r--Master/texmf-dist/source/eplain/base/test/frac.tex24
-rw-r--r--Master/texmf-dist/source/eplain/base/test/gcol.tex218
-rw-r--r--Master/texmf-dist/source/eplain/base/test/hlcite.tex55
-rw-r--r--Master/texmf-dist/source/eplain/base/test/hlfoot.tex47
-rw-r--r--Master/texmf-dist/source/eplain/base/test/hlidx.mst2
-rw-r--r--Master/texmf-dist/source/eplain/base/test/hlidx.tex138
-rw-r--r--Master/texmf-dist/source/eplain/base/test/hlink.tex144
-rw-r--r--Master/texmf-dist/source/eplain/base/test/ian.tex28
-rw-r--r--Master/texmf-dist/source/eplain/base/test/index.tex36
-rw-r--r--Master/texmf-dist/source/eplain/base/test/jan.tex15
-rw-r--r--Master/texmf-dist/source/eplain/base/test/justify.tex106
-rw-r--r--Master/texmf-dist/source/eplain/base/test/knuth.bib17
-rw-r--r--Master/texmf-dist/source/eplain/base/test/label.tex8
-rw-r--r--Master/texmf-dist/source/eplain/base/test/latexcite.tex9
-rw-r--r--Master/texmf-dist/source/eplain/base/test/liang.tex300
-rw-r--r--Master/texmf-dist/source/eplain/base/test/list.tex90
-rw-r--r--Master/texmf-dist/source/eplain/base/test/listing.tex10
-rw-r--r--Master/texmf-dist/source/eplain/base/test/logo.tex20
-rw-r--r--Master/texmf-dist/source/eplain/base/test/loop.tex20
-rw-r--r--Master/texmf-dist/source/eplain/base/test/loopnext.tex21
-rw-r--r--Master/texmf-dist/source/eplain/base/test/mag.tex14
-rw-r--r--Master/texmf-dist/source/eplain/base/test/makecol.tex17
-rw-r--r--Master/texmf-dist/source/eplain/base/test/margin.tex68
-rw-r--r--Master/texmf-dist/source/eplain/base/test/matrix.tex18
-rw-r--r--Master/texmf-dist/source/eplain/base/test/mdisplay.tex215
-rw-r--r--Master/texmf-dist/source/eplain/base/test/names.tex21
-rw-r--r--Master/texmf-dist/source/eplain/base/test/noarrow.tex8
-rw-r--r--Master/texmf-dist/source/eplain/base/test/nobib.tex10
-rw-r--r--Master/texmf-dist/source/eplain/base/test/nonouter.tex11
-rw-r--r--Master/texmf-dist/source/eplain/base/test/optional.tex30
-rw-r--r--Master/texmf-dist/source/eplain/base/test/outer.tex26
-rw-r--r--Master/texmf-dist/source/eplain/base/test/page.tex8
-rw-r--r--Master/texmf-dist/source/eplain/base/test/path.tex25
-rw-r--r--Master/texmf-dist/source/eplain/base/test/pcol.tex183
-rw-r--r--Master/texmf-dist/source/eplain/base/test/pdftex.tex112
-rw-r--r--Master/texmf-dist/source/eplain/base/test/psfont.map78
-rw-r--r--Master/texmf-dist/source/eplain/base/test/rex.tex277
-rw-r--r--Master/texmf-dist/source/eplain/base/test/rule.tex23
-rw-r--r--Master/texmf-dist/source/eplain/base/test/sidx.tex5
-rw-r--r--Master/texmf-dist/source/eplain/base/test/subdef.tex24
-rw-r--r--Master/texmf-dist/source/eplain/base/test/tenenb.tex48
-rw-r--r--Master/texmf-dist/source/eplain/base/test/tenenb2.tex23
-rw-r--r--Master/texmf-dist/source/eplain/base/test/test.tex14
-rw-r--r--Master/texmf-dist/source/eplain/base/test/time.tex10
-rw-r--r--Master/texmf-dist/source/eplain/base/test/truemarg.tex36
-rw-r--r--Master/texmf-dist/source/eplain/base/test/uscore.bib5
-rw-r--r--Master/texmf-dist/source/eplain/base/test/uscore.tex14
-rw-r--r--Master/texmf-dist/source/eplain/base/test/usepackage.tex146
-rw-r--r--Master/texmf-dist/source/eplain/base/test/verb2.tex61
-rw-r--r--Master/texmf-dist/source/eplain/base/test/verbatim.tex65
-rw-r--r--Master/texmf-dist/source/eplain/base/test/vlach.tex258
-rw-r--r--Master/texmf-dist/source/eplain/base/test/whitespc.tex51
-rw-r--r--Master/texmf-dist/source/eplain/base/test/xampl.tex13
-rw-r--r--Master/texmf-dist/source/eplain/base/test/xref.tex39
-rw-r--r--Master/texmf-dist/source/eplain/base/util/idxuniq37
-rw-r--r--Master/texmf-dist/source/eplain/base/util/trimsee106
-rw-r--r--Master/texmf-dist/source/eplain/base/xeplain.tex4783
97 files changed, 10190 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/eplain/base/add-date b/Master/texmf-dist/source/eplain/base/add-date
new file mode 100644
index 00000000000..8465939b5b8
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/add-date
@@ -0,0 +1,28 @@
+#!/bin/sh
+# This file is public domain.
+
+# Change placeholders to variations on the current date. Assumes
+# various % constructs are recognized.
+
+if test $# -lt 1
+then
+ echo "Usage: $0 [<file> <file> ...]"
+ exit 1
+fi
+
+temp=${TMPDIR-/tmp}/adddate$$
+
+for f in "$@"; do
+ sed -e s/REPLACE-WITH-MONTH-YEAR/"`date +'%B %Y'`"/ \
+ -e s/REPLACE-WITH-DAY-MONTH-YEAR/"`date +'%e %B %Y'`"/ \
+ -e s/REPLACE-WITH-DATE/"`date`"/ \
+ <$f >$temp
+ if cmp -s $f $temp; then
+ echo "$f: No REPLACE-WITH-<date>."
+ exit 1
+ fi
+ rm -f $f
+ mv $temp $f
+done
+
+rm -f $temp
diff --git a/Master/texmf-dist/source/eplain/base/add-version b/Master/texmf-dist/source/eplain/base/add-version
new file mode 100644
index 00000000000..1934c8957f6
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/add-version
@@ -0,0 +1,24 @@
+#!/bin/sh
+# This file is public domain.
+
+if test $# -lt 2; then
+ echo "Usage: $0 <version> [<file> <file> ...]"
+ exit 1
+fi
+
+temp=${TMPDIR-/tmp}/version$$
+
+version=$1
+shift
+
+for f in "$@"; do
+ sed "s/REPLACE-WITH-VERSION/$version/" <$f >$temp || exit 1
+ if cmp -s $f $temp; then
+ echo "$f: No REPLACE-WITH-VERSION."
+ exit 1
+ fi
+ rm -f $f
+ mv $temp $f
+done
+
+rm -f $temp
diff --git a/Master/texmf-dist/source/eplain/base/etex.tex b/Master/texmf-dist/source/eplain/base/etex.tex
new file mode 100644
index 00000000000..46fe32ee733
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/etex.tex
@@ -0,0 +1,5 @@
+% This file just makes a .fmt file, assuming plain is loaded.
+%
+\input eplain
+
+\dump
diff --git a/Master/texmf-dist/source/eplain/base/fix-checksum b/Master/texmf-dist/source/eplain/base/fix-checksum
new file mode 100644
index 00000000000..c2f830f10f3
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/fix-checksum
@@ -0,0 +1,20 @@
+#!/bin/sh
+# This file is public domain.
+
+# Fix a checksum line in the files given as arguments.
+
+tmpfile=/tmp/checksum$$
+
+for f in $*
+do
+ checksum=""
+ newchecksum=`wc < $f | sed "s/^ *//"`
+ while test "$checksum" != "$newchecksum"
+ do
+ sed -e "1,50s/checksum = .*,/checksum = \"$newchecksum\",/" $f > $tmpfile
+ checksum="$newchecksum"
+ newchecksum=`wc < $tmpfile | sed "s/^ *//"`
+ done
+ mv -f $tmpfile $f
+done
+
diff --git a/Master/texmf-dist/source/eplain/base/merge b/Master/texmf-dist/source/eplain/base/merge
new file mode 100644
index 00000000000..b300b936bca
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/merge
@@ -0,0 +1,84 @@
+#!/bin/sh
+# This file is public domain.
+
+# Merge the constituent files with xeplain.tex to produce eplain.tex.
+
+# Usually we are called from the Makefile, and the `version' variable is set.
+if test -z "$version"; then
+ echo "No version number, using xx!"
+ version=xx
+fi
+
+btxtmp=/tmp/mergebtx$$
+common1tmp=/tmp/mergec1$$
+common2tmp=/tmp/mergec2$$
+common3tmp=/tmp/mergec3$$
+eplaintmp=/tmp/mergepl$$
+arrow1tmp=/tmp/mergea1$$
+arrow2tmp=/tmp/mergea2$$
+pathtmp=/tmp/mergepa$$
+ifpdftmp=/tmp/mergeif$$
+
+rm -f eplain.tex
+
+# Use this regexp to strip comments with egrep.
+commentre='^ *%([^%]|$)'
+
+# Extract the relevant parts of btxmac.tex (without comments).
+egrep -v "$commentre" btxmac.tex \
+ | sed -n \
+ -e "1,/^%% \[\[\[start .*\]\]\]/w $common1tmp" \
+ -e "/^%% \[\[\[start .*\]\]\]/,/^%% \[\[\[end .*\]\]\]/w $btxtmp" \
+ -e "/^%% \[\[\[end .*\]\]\]/,\$w $common2tmp"
+
+# Get texnames.sty and path.sty. Remove the announcement, as well as
+# the comments.
+egrep -v "$commentre|immediate" texnames.sty > $common3tmp
+egrep -v "$commentre|immediate" path.sty > $pathtmp
+
+# Get arrow.tex.
+egrep -v "$commentre" arrow.tex \
+ | sed -n \
+ -e '1,/catcode.*\&.*4/w '"$arrow1tmp" \
+ -e '/catcode.*\&.*4/,$w '"$arrow2tmp"
+
+# Get ifpdf.sty
+egrep -v "$commentre"'|^ {0,6}\\immediate' ifpdf.sty > $ifpdftmp
+
+# Merge the above into xeplain, calling the result eplain. Also change the
+# `filename' in the comment.%%
+egrep -v "$commentre" xeplain.tex \
+ | sed -e 's/"xeplain.tex"/"eplain.tex"/' \
+ -e "/^%% \[\[\[here is the first.*\]\]\]/r $common1tmp" \
+ -e "/^ %% \[\[\[here are the BibTeX.*\]\]\]/r $btxtmp" \
+ -e "/^%% \[\[\[here is the second.*\]\]\]/r $common2tmp" \
+ -e "/^%% \[\[\[include texnames.*\]\]\]/r $common3tmp" \
+ -e "/^%% \[\[\[include path.*\]\]\]/r $pathtmp" \
+ -e "/^ %% \[\[\[include arrow1\]\]\]/r $arrow1tmp" \
+ -e "/^ %% \[\[\[include arrow2\]\]\]/r $arrow2tmp" \
+ -e "/^%% \[\[\[include ifpdf.*\]\]\]/r $ifpdftmp" \
+ > $eplaintmp
+
+# Remove our [[[...]]] markers and \endinput's.
+egrep -v '\[\[\[|^ *$|\\endinput' $eplaintmp > eplain.tex
+
+# Fix header fields.
+./add-date eplain.tex
+./add-version $version eplain.tex
+./fix-checksum eplain.tex
+
+# Old checksum computation:
+#checksum=`wc < $eplaintmp | sed -n "s/^ *//"`
+# Replace the checksum in the old file. We really should loop here,
+# since one iteration may not be enough. Only replace the first
+# checksum, since the second is for btxmac.
+#sed -e "1,50s/checksum = .*,/checksum = \"$checksum\",/" $eplaintmp \
+# > eplain.tex
+
+chmod a-w eplain.tex
+#ls -lt btxmac.tex path.sty texnames.sty xeplain.tex eplain.tex arrow.tex
+#wc eplain.tex
+#grep 'checksum.*=' eplain.tex
+
+rm -f $btxtmp $eplaintmp $common1tmp $common2tmp $common3tmp
+rm -f $arrow1tmp $arrow2tmp $pathtmp $ifpdftmp
diff --git a/Master/texmf-dist/source/eplain/base/packages.zip b/Master/texmf-dist/source/eplain/base/packages.zip
new file mode 100644
index 00000000000..6bbf89e4203
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/packages.zip
Binary files differ
diff --git a/Master/texmf-dist/source/eplain/base/test/allref.tex b/Master/texmf-dist/source/eplain/base/test/allref.tex
new file mode 100644
index 00000000000..8e4f51270b0
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/allref.tex
@@ -0,0 +1,15 @@
+% This file is public domain.
+%
+% Test all kinds of references.
+%
+\ifx\undefined\eplain \input eplain \fi
+
+\let\primitiveend = \end
+\let\end = \relax
+
+\input cite
+\input xref
+\primitiveend
+
+\input eqref
+
diff --git a/Master/texmf-dist/source/eplain/base/test/boxes.tex b/Master/texmf-dist/source/eplain/base/test/boxes.tex
new file mode 100644
index 00000000000..b58e1ffef34
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/boxes.tex
@@ -0,0 +1,11 @@
+% This file is public domain.
+%
+\input eplain
+
+A box: \blackbox
+
+A large rectangle:
+\ht0=2pc \dp0=2pc \wd0=3pc
+\makeblankbox{.8pt}{.8pt}
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/boxit.tex b/Master/texmf-dist/source/eplain/base/test/boxit.tex
new file mode 100644
index 00000000000..20da2e7c27d
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/boxit.tex
@@ -0,0 +1,24 @@
+% This file is public domain.
+%
+% Test \boxit.
+%
+\ifx\undefined\eplain \input eplain \fi
+
+\boxit{\hbox{the basics, boxed}}
+
+\boxitspace = 24pt
+\boxit{\hbox{should be spacier}}
+
+\boxitspace = 5pt
+
+\boxit{\vbox{Something that is more than one line long, no matter how verbose
+I have to do make it so, so that we can see if the line breaks are
+plausible.}}
+
+
+\boxit{\vbox{\hsize = 4in Another one that is more than one line long, just
+to see if resetting hsize inside the box will work.}}
+
+\boxit{\boxit{\hbox{double box}}}
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/catcode.tex b/Master/texmf-dist/source/eplain/base/test/catcode.tex
new file mode 100644
index 00000000000..af71f740ea9
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/catcode.tex
@@ -0,0 +1,8 @@
+% This file is public domain.
+%
+The catcode BEFORE loading eplain: \the\catcode`@ \showthe\catcode`@
+\input eplain
+
+The catcode AFTER loading eplain: \the\catcode`@ \showthe\catcode`@
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/center.tex b/Master/texmf-dist/source/eplain/base/test/center.tex
new file mode 100644
index 00000000000..628155050a6
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/center.tex
@@ -0,0 +1,12 @@
+% This file is public domain.
+%
+\input eplain
+
+\def\title{\begingroup \def\endcentermacro{\endtitle}\bf\center}
+\def\endtitle{\endcenter\endgroup}
+
+\loggingall
+\title hi
+\endtitle
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/cite.bib b/Master/texmf-dist/source/eplain/base/test/cite.bib
new file mode 100644
index 00000000000..7c082677b4f
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/cite.bib
@@ -0,0 +1,25 @@
+% This file is public domain.
+
+@book{chicago,
+ title = "Chicago",
+}
+
+@book{texbook,
+ title = "texbook"
+}
+
+@book{prime-number-theorem,
+ title = "prime number theorem",
+}
+
+@book{1234567890)(@!`['";:]|<>./?-=+_$^&,
+ title = "weird label"
+}
+
+@book{others,
+ author = "Jill and Susan and others"
+}
+
+@book{accented,
+ author = "{\'E}ric {\'E}ttelbaum"
+}
diff --git a/Master/texmf-dist/source/eplain/base/test/cite.tex b/Master/texmf-dist/source/eplain/base/test/cite.tex
new file mode 100644
index 00000000000..12b818995bb
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/cite.tex
@@ -0,0 +1,35 @@
+% This file is public domain.
+%
+% Test file for citations (plain bibliography style).
+%
+\ifx\eplain\undefined \input eplain \fi
+\loggingall
+
+Let's cite chicago: \cite{chicago}.
+
+Now let's have multiple citations: \cite{chicago,texbook}.
+
+Now let's have a non-alphabetic label: \cite{prime-number-theorem}.
+
+Here is an undefined citation: \cite{undefined}.
+
+Here is a citation with an optional note: \cite[note]{texbook}.
+
+Here is a citation with a weird label:
+\cite{1234567890)(@!`['";:]|<>./?-=+_$^&}.
+
+Now let's cite an `and others': \cite{others}.
+
+And an accented one: \cite{accented}.
+
+Let's get up to ten refs:
+\cite{article-minimal,article-full,article-crossref,whole-journal,%
+inbook-minimal,inbook-full}
+
+\bigskip
+\leftline{\bf References.}
+
+\bibliography{cite,xampl}
+\bibliographystyle{plain}
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/citeall.tex b/Master/texmf-dist/source/eplain/base/test/citeall.tex
new file mode 100644
index 00000000000..24929568abe
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/citeall.tex
@@ -0,0 +1,12 @@
+% This file is public domain.
+%
+\input btxmac
+
+Cite all the entries in the bib database files {\tt knuth.bib} and {\tt
+ep.bib}:
+
+\nocite{*}
+\bibliography{knuth,ep}
+\bibliographystyle{plain}
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/citealph.tex b/Master/texmf-dist/source/eplain/base/test/citealph.tex
new file mode 100644
index 00000000000..5b83d26d2b6
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/citealph.tex
@@ -0,0 +1,26 @@
+% This file is public domain.
+%
+% Test file for citations (alphabetic bibliography style).
+%
+\input eplain
+
+Let's cite chicago and van-leunen: \cite{chicago,van-leunen}.
+
+Now let's cite an `and others': \cite{others}.
+
+And an accented one: \cite{accented}.
+
+Here is a citation with an optional note: \cite[note]{texbook}.
+
+Here is a citation with a weird label:
+\cite{1234567890)(@!`['";:]|<>./?-=+}.
+
+Here is an undefined citation: \cite{undefined}.
+
+\bigskip
+\leftline{\bf References.}
+
+\bibliography{cite}
+\bibliographystyle{alpha}
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/citeapa.tex b/Master/texmf-dist/source/eplain/base/test/citeapa.tex
new file mode 100644
index 00000000000..3d59f70fa09
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/citeapa.tex
@@ -0,0 +1,26 @@
+% This file is public domain.
+%
+% Test file for citations (alphabetic bibliography style).
+%
+\input btxmac
+
+Let's cite chicago and van-leunen: \cite{chicago,van-leunen}.
+
+Now let's cite an `and others': \cite{others}.
+
+And an accented one: \cite{accented}.
+
+Here is a citation with an optional note: \cite[note]{texbook}.
+
+Here is a citation with a weird label:
+\cite{1234567890)(@!`['";:]|<>./?-=+}.
+
+Here is an undefined citation: \cite{undefined}.
+
+\bigskip
+\leftline{\bf References.}
+
+\bibliography{cite}
+\bibliographystyle{apalike}
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/citebegin.tex b/Master/texmf-dist/source/eplain/base/test/citebegin.tex
new file mode 100644
index 00000000000..75b5c8d6de6
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/citebegin.tex
@@ -0,0 +1,20 @@
+% This file is public domain.
+%
+\input eplain
+
+\let\primitiveend = \end
+\def\bye{\vfill\eject\primitiveend}
+
+\def\begin#1#2{%
+ \message{widest label is #2}
+}
+\def\end#1{}
+
+Two citations to Knuthian works: \cite{surreal,concrete-math}.
+
+\beginsection{References.}\par % Title for the bibliography.
+
+\bibliography{knuth} % Use knuth.bib to resolve the labels.
+\bibliographystyle{plain} % Number the references.
+
+\bye % End of the document.
diff --git a/Master/texmf-dist/source/eplain/base/test/citecust.tex b/Master/texmf-dist/source/eplain/base/test/citecust.tex
new file mode 100644
index 00000000000..2b3266407ba
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/citecust.tex
@@ -0,0 +1,38 @@
+% This file is public domain.
+%
+% File to test the various customizations btxmac.tex allows.
+%
+\input eplain
+
+% Have citations come out as superscripts, as in footnotes.
+%
+% Unfortunately, plain TeX doesn't define the \scriptfont for the \tt
+% family. Since we use \tt to print unresolved bib-references, we define
+% it ourselves, so we can use superscripts.
+\font\eighttt = cmtt8
+\scriptfont\ttfam = \eighttt
+\def\printcitestart{$^\bgroup}
+\def\printbetweencitations{,\space}
+\def\printcitefinish{\egroup$}
+\def\printcitenote#1{\hbox{\sevenrm\space (#1)}}
+
+% Do angle brackets instead of brackets. (We don't redefine \biblabelprint.)
+%
+\def\biblabelcontents#1{\bblrm $\langle$#1$\rangle$}
+
+% Use sans serif instead of roman, and slanted instead of italic.
+%
+\font\bblrm = cmss10
+\font\bblem = cmsl10
+
+% Put a rule before the bibliography.
+%
+\def\bblhook{\medskip\hrule\smallskip}
+
+Two citations to Knuthian works: \cite{surreal,concrete-math}.
+
+This one with a note: \cite[another one]{surreal}.
+
+\bibliography{knuth} % Use knuth.bib to resolve the labels.
+\bibliographystyle{plain} % Number the references.
+\end % End of the document.
diff --git a/Master/texmf-dist/source/eplain/base/test/citenote.tex b/Master/texmf-dist/source/eplain/base/test/citenote.tex
new file mode 100644
index 00000000000..429b5cd456f
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/citenote.tex
@@ -0,0 +1,13 @@
+% This file is public domain.
+%
+% Test file for citations (plain bibliography style).
+%
+\ifx\eplain\undefined \input eplain \fi
+\loggingall
+
+Here is a citation with an optional note, first: \cite[note]{texbook}.
+
+\bibliography{cite}
+\bibliographystyle{plain}
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/citex.tex b/Master/texmf-dist/source/eplain/base/test/citex.tex
new file mode 100644
index 00000000000..69e880490a7
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/citex.tex
@@ -0,0 +1,8 @@
+% This file is public domain.
+%
+\input eplain
+Two citations to Knuthian works: \cite{surreal,concrete-math}.
+\beginsection{References.}\par % Title for the bibliography.
+\bibliography{knuth} % Use knuth.bib to resolve the labels.
+\bibliographystyle{plain} % Number the references.
+\end % End of the document.
diff --git a/Master/texmf-dist/source/eplain/base/test/colfootn.tex b/Master/texmf-dist/source/eplain/base/test/colfootn.tex
new file mode 100644
index 00000000000..942f71f50b3
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/colfootn.tex
@@ -0,0 +1,18 @@
+% This file is public domain.
+%
+\input eplain
+
+\loggingall
+
+\vsize = 6\baselineskip
+\doublecolumns
+
+\leftline{1\footnote\dag{A footnote that is longer than the column
+width. Much much longer longer.}}
+\count255 = 2
+\loop
+ \leftline{\number\count255}
+ \advance\count255 by 1
+\ifnum\count255 < 14 \repeat
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/colrule.tex b/Master/texmf-dist/source/eplain/base/test/colrule.tex
new file mode 100644
index 00000000000..5213685e9a3
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/colrule.tex
@@ -0,0 +1,33 @@
+% This file is public domain.
+%
+\input eplain
+
+% ashley suggested the length of the footnote rule changes where the
+% second column starts.
+\vsize = 3in
+\footnoterulewidth = 6in
+\doublecolumns
+This is a footnote\footnote1{No, this is the footnote} in double column mode.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+And now we have lots of text to fill up the column.
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/column.tex b/Master/texmf-dist/source/eplain/base/test/column.tex
new file mode 100644
index 00000000000..be1d521fe08
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/column.tex
@@ -0,0 +1,228 @@
+% This file is public domain.
+%
+% Test double columns with headlines, single-column material, and a
+% \topinsert.
+\ifx\undefined\eplain \input eplain \fi
+%\catcode`@=11
+%\input gcol
+%\catcode`@=12
+
+\gutter = 1pc
+\hyphenation{pour-ed}
+
+\headline = {This is the headline \hfil}
+
+{\center
+ A test file for eplain
+ Karl\footnote\dag{Credit in a footnote. Longer than one column. %
+ Longer longer longer.}
+}
+
+\topinsert
+This should appear at the top of the page, since it's a topinsert. It's
+also longer than one column.
+\endinsert
+
+Here is a six-and-a-half-inch long rule.
+
+\hrule width 6.5in
+
+\doublecolumns
+
+Here the main document starts. It should be in double columns until
+further notice. It's all one paragraph. I am going to use Wuthering
+Heights, as usual. With that concluding word, the whole assembly,
+exalting their pilgrim's staves, rushed round me in a body; and I,
+having no weapon to raise in self-defence, commenced grappling with
+Joseph, my nearest and most ferocious assailant, for his. In the
+confluence of the multitude several clubs crossed; blows aimed at me
+fell on other sconces. Presently the whole chapel resounded with
+rappings and counter-rappings. Every man's hand was against his
+neighbour; and Branderham, unwilling to remain idle, pour\-ed forth his
+zeal in a shower of loud taps on the boards of the pulpit, which
+responded so smartly that at last, to my unspeakable relief, they woke
+me. And what was it that had suggested the tremendous tumult? What had
+played Jabes's part in the row? Merely the branch of a fir-tree that
+touched my lattice, as the blast wailed by, and rattled its dry cones
+against the panes! I listened doubtingly an instant, detected the
+disturber, then turned and dozed, and dreamt again---if possible, still
+more disagreeably than before. This time I remembered I was lying in
+the oak closet, and I heard distinctly the gusty wind and the driving of
+the snow. I heard also the fir-bough repeat its teasing sound, and
+ascribed it to the right cause. But it annoyed me so much that I
+resolved to silence it, if possible; and I thought I rose and
+endeavoured to unhasp the casement. The hook was soldered into the
+staple---a circumstance observed by me when awake, but forgotten. ``I
+must stop it, nevertheless!'' I muttered, knocking my knuckles through
+the glass, and stretching an arm out to seize the importunate branch;
+instead of which, my fingers closed on the fingers of a little, icecold
+hand!
+
+The intense horror of nightmare came over me. I tried to draw
+back my arm, but the hand clung to it, and a most melancholy voice
+sobbed, ``Let me in---let me in!'' ``Who are you?'' I asked, struggling,
+meanwhile, to disengage myself. ``Catherine Linton,'' it replied
+shiveringly. (Why did I think of Linton? I had read Earnshaw twenty
+times for Linton.) ``I'm come home. I'd lost my way on the moor.'' As
+it spoke, I discerned, obscurely, a child's face looking through the
+window. Terror made me cruel; and finding it useless to attempt shaking
+the creature off, I pulled its wrist on to the broken pane, and rubbed
+it to and fro till the blood ran down and soaked the bedclothes. Still
+it wailed, ``Let me in!'' and maintained its tenacious gripe, almost
+maddening me with fear. ``How can I?'' I said at length. ``Let me go,
+if you want me to let you in!''
+
+With that concluding word, the whole assembly,
+exalting their pilgrim's staves, rushed round me in a body; and I,
+having no weapon to raise in self-defence, commenced grappling with
+Joseph, my nearest and most ferocious assailant, for his. In the
+confluence of the multitude several clubs crossed; blows aimed at me
+fell on other sconces. Presently the whole chapel resounded with
+rappings and counter-rappings. Every man's hand was against his
+neighbour; and Branderham, unwilling to remain idle, pour\-ed forth his
+zeal in a shower of loud taps on the boards of the pulpit, which
+responded so smartly that at last, to my unspeakable relief, they woke
+me. And what was it that had suggested the tremendous tumult? What had
+played Jabes's part in the row? Merely the branch of a fir-tree that
+touched my lattice, as the blast wailed by, and rattled its dry cones
+against the panes! I listened doubtingly an instant, detected the
+disturber, then turned and dozed, and dreamt again---if possible, still
+more disagreeably than before. This time I remembered I was lying in
+the oak closet, and I heard distinctly the gusty wind and the driving of
+the snow. I heard also the fir-bough repeat its teasing sound, and
+ascribed it to the right cause. But it annoyed me so much that I
+resolved to silence it, if possible; and I thought I rose and
+endeavoured to unhasp the casement. The hook was soldered into the
+staple---a circumstance observed by me when awake, but forgotten. ``I
+must stop it, nevertheless!'' I muttered, knocking my knuckles through
+the glass, and stretching an arm out to seize the importunate branch;
+instead of which, my fingers closed on the fingers of a little, icecold
+hand!
+
+The intense horror of nightmare came over me. I tried to draw
+back my arm, but the hand clung to it, and a most melancholy voice
+sobbed, ``Let me in---let me in!'' ``Who are you?'' I asked, struggling,
+meanwhile, to disengage myself. ``Catherine Linton,'' it replied
+shiveringly. (Why did I think of Linton? I had read Earnshaw twenty
+times for Linton.) ``I'm come home. I'd lost my way on the moor.'' As
+it spoke, I discerned, obscurely, a child's face looking through the
+window. Terror made me cruel; and finding it useless to attempt shaking
+the creature off, I pulled its wrist on to the broken pane, and rubbed
+it to and fro till the blood ran down and soaked the bedclothes. Still
+it wailed, ``Let me in!'' and maintained its tenacious gripe, almost
+maddening me with fear. ``How can I?'' I said at length. ``Let me go,
+if you want me to let you in!''
+
+With that concluding word, the whole assembly,
+exalting their pilgrim's staves, rushed round me in a body; and I,
+having no weapon to raise in self-defence, commenced grappling with
+Joseph, my nearest and most ferocious assailant, for his. In the
+confluence of the multitude several clubs crossed; blows aimed at me
+fell on other sconces. Presently the whole chapel resounded with
+rappings and counter-rappings. Every man's hand was against his
+neighbour; and Branderham, unwilling to remain idle, re forth his
+zeal in a shower of loud taps on the boards of the pulpit, which
+responded so smartly that at last, to my unspeakable relief, they woke
+me. And what was it that had suggested the tremendous tumult? What had
+played Jabes's part in the row? Merely the branch of a fir-tree that
+touched my lattice, as the blast wailed by, and rattled its dry cones
+against the panes! I listened doubtingly an instant, detected the
+disturber, then turned and dozed, and dreamt again---if possible, still
+more disagreeably than before. This time I remembered I was lying in
+the oak closet, and I heard distinctly the gusty wind and the driving of
+the snow. I heard also the fir-bough repeat its teasing sound, and
+ascribed it to the right cause. But it annoyed me so much that I
+resolved to silence it, if possible; and I thought I rose and
+endeavoured to unhasp the casement. The hook was soldered into the
+staple---a circumstance observed by me when awake, but forgotten. ``I
+must stop it, nevertheless!'' I muttered, knocking my knuckles through
+the glass, and stretching an arm out to seize the importunate branch;
+instead of which, my fingers closed on the fingers of a little, icecold
+hand!
+
+The intense horror of nightmare came over me. I tried to draw
+back my arm, but the hand clung to it, and a most melancholy voice
+sobbed, ``Let me in---let me in!'' ``Who are you?'' I asked, struggling,
+meanwhile, to disengage myself. ``Catherine Linton,'' it replied
+shiveringly. (Why did I think of Linton? I had read Earnshaw twenty
+times for Linton.) ``I'm come home. I'd lost my way on the moor.'' As
+it spoke, I discerned, obscurely, a child's face looking through the
+window. Terror made me cruel; and finding it useless to attempt shaking
+the creature off, I pulled its wrist on to the broken pane, and rubbed
+it to and fro till the blood ran down and soaked the bedclothes. Still
+it wailed, ``Let me in!'' and maintained its tenacious gripe, almost
+maddening me with fear. ``How can I?'' I said at length. ``Let me go,
+if you want me to let you in!''
+
+With that concluding word, the whole assembly,
+exalting their pilgrim's staves, rushed round me in a body; and I,
+having no weapon to raise in self-defence, commenced grappling with
+Joseph, my nearest and most ferocious assailant, for his. In the
+confluence of the multitude several clubs crossed; blows aimed at me
+fell on other sconces. Presently the whole chapel resounded with
+rappings and counter-rappings. Every man's hand was against his
+neighbour; and Branderham, unwilling to remain idle, re forth his
+zeal in a shower of loud taps on the boards of the pulpit, which
+responded so smartly that at last, to my unspeakable relief, they woke
+me. And what was it that had suggested the tremendous tumult? What had
+played Jabes's part in the row? Merely the branch of a fir-tree that
+touched my lattice, as the blast wailed by, and rattled its dry cones
+against the panes! I listened doubtingly an instant, detected the
+disturber, then turned and dozed, and dreamt again---if possible, still
+more disagreeably than before. This time I remembered I was lying in
+the oak closet, and I heard distinctly the gusty wind and the driving of
+the snow. I heard also the fir-bough repeat its teasing sound, and
+ascribed it to the right cause. But it annoyed me so much that I
+resolved to silence it, if possible; and I thought I rose and
+endeavoured to unhasp the casement. The hook was soldered into the
+staple---a circumstance observed by me when awake, but forgotten. ``I
+must stop it, nevertheless!'' I muttered, knocking my knuckles through
+the glass, and stretching an arm out to seize the importunate branch;
+instead of which, my fingers closed on the fingers of a little, icecold
+hand!
+
+The intense horror of nightmare came over me. I tried to draw
+back my arm, but the hand clung to it, and a most melancholy voice
+sobbed, ``Let me in---let me in!'' ``Who are you?'' I asked, struggling,
+meanwhile, to disengage myself. ``Catherine Linton,'' it replied
+shiveringly. (Why did I think of Linton? I had read Earnshaw twenty
+times for Linton.) ``I'm come home. I'd lost my way on the moor.'' As
+it spoke, I discerned, obscurely, a child's face looking through the
+window. Terror made me cruel; and finding it useless to attempt shaking
+the creature off, I pulled its wrist on to the broken pane, and rubbed
+it to and fro till the blood ran down and soaked the bedclothes. Still
+it wailed, ``Let me in!'' and maintained its tenacious gripe, almost
+maddening me with fear. ``How can I?'' I said at length. ``Let me go,
+if you want me to let you in!''
+
+\singlecolumn
+Now we should be typesetting in a single column, i.e., normally. The
+fingers relaxed; I snatched mine through the hole, hurriedly piled the
+books up in a pyramid against it, and stopped my ears to exclude the
+lamentable prayer. I seemed to keep them closed above a quarter of an
+hour; yet the instant I listened again, there was the doleful cry
+moaning on! ``Begone!'' I shouted; ``I'll never let you in---not if you
+beg for twenty years.'' ``It is twenty years,'' mourned the
+voice---``twenty years. I've been a waif for twenty years!'' Thereat
+began a feeble scratching outside, and the pile of books moved as if
+thrust forward. I tried to jump up, but could not stir a limb, and so
+yelled aloud in a frenzy of fright. To my confusion, I discovered the
+yell was not ideal. Hasty footsteps approached my chamber door; somebody
+pushed it open with a vigorous hand, and a light glimmered through the
+squares at the top of the bed. I sat shuddering yet, and wiping the
+perspiration from my forehead. The intruder appeared to hesitate, and
+muttered to himself. At last he said in a half-whisper, plainly not
+expecting an answer, ``Is any one here?'' I considered it best to
+confess my presence, for I knew Heathcliff's accents, and feared he
+might search further if I kept quiet. With this intention I turned and
+opened the panels. I shall not soon forget the effect my action
+produced. Heathcliff stood near the entrance, in his shirt and
+trousers, with a candle dripping over his fingers, and his face as white
+as the wall behind him. The first creak of the oak startled him like an
+electric shock. The light leaped from his hold to a distance of some
+feet, and his agitation was so extreme that he could hardly pick it up.
+``It is only your guest, sir,'' I called out, desirous to spare him the
+humiliation of exposing his cowardice further. ``I had the misfortune
+to scream in my sleep, owing to a frightful nightmare. I'm sorry I
+disturbed you.''
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/column2.tex b/Master/texmf-dist/source/eplain/base/test/column2.tex
new file mode 100644
index 00000000000..90a736e4333
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/column2.tex
@@ -0,0 +1,51 @@
+% This file is public domain.
+%
+\input eplain
+
+\headline = {headline\hfil}
+\topinsert
+topinsert
+\endinsert
+
+\parskip = 0pt
+
+\centerline{Xiaogen Yang and Max L. Deinzer}
+\smallskip
+\centerline{Department of Agricultural Chemistry}
+\centerline{Oregon State University, Corvallis, Oregon 97331}
+
+\doublecolumns
+Humulene monoepoxides exist in hop essential oil and were suggested
+as one of the important contributors of hop flavor to fermented
+malt beverages [1-3]. However, it is more possible that the ``noble
+hop'' aroma compounds are produced from certain hop components
+during the brewing process, because the ``noble hop'' aroma is
+distinct from ``dry hop'' aroma. The aging of hops, during which the
+amount of oxidation products of humulene increases [4], is also
+necessary to develop the ``noble hop'' aroma. One approach to find
+out the flavor compounds and their origin is to examine the brewing
+products of the oxygenated sesquiterpenes. The reactions of the
+brewing process can be simplified to hydrolyzation and fermentation
+as the first step. We have been investigated the hydrolysis of
+humulene monoepoxides.
+\singlecolumn
+To simulate the hydrolyzation effect in the ``late hop'' brewing
+process, humulene monoepoxides were boiled in water at
+pH\thinspace 4 for 10 minutes. After boiling, a large amount of
+the epoxides remain unreacted. When the solution was kept at
+ambient temperature for several weeks, humulene epoxides were
+then almost completely hydrolyzed. To accelerate the hydrolysis
+process, humulene epoxides were suspended in a aqueous solution
+buffered at pH\thinspace 4 and boiled for three hours under
+reflux. All three humulene monoepoxides produced a complex
+mixture after the reaction (Figure 1). The hydrolysis products
+can be easily separated into two groups by extraction with
+pentane and dichloro\-me\-thane subsequently. The pentane
+extracts are less polar, more volatile and smell stron\-ger than
+the dichloro\-methane extracts. Sensory evaluation of the
+hydrolysis products of humulene epoxide II and III by sniffing
+gas chromatography effluent indicates that some of the compounds
+have the flavor notes which are close to the ``noble hop'' aroma
+character described as ``spicy, citrus, floral'' (Table 1).
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/column3.tex b/Master/texmf-dist/source/eplain/base/test/column3.tex
new file mode 100644
index 00000000000..01788bd3064
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/column3.tex
@@ -0,0 +1,23 @@
+% This file is public domain.
+%
+\ifx\undefined\eplain \input eplain \fi
+
+Here is a single-column line of text.
+%\vskip 6in
+%And another one.
+
+\doublecolumns
+\newcount \xxx
+\xxx=0
+\par
+\baselineskip = 2.5\baselineskip
+\loop
+ \hbox{Line \the\xxx.}
+ \ifnum \xxx < 3
+ \advance \xxx by 1
+\repeat
+
+\singlecolumn
+Another single-column line of text.
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/commdiags.tex b/Master/texmf-dist/source/eplain/base/test/commdiags.tex
new file mode 100644
index 00000000000..ae5ca6221d4
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/commdiags.tex
@@ -0,0 +1,111 @@
+% This file is public domain.
+%
+% Examples of commutative diagrams from Brockett, {\it Finite
+% Dimensional Linear Systems}.
+
+\input arrow
+
+\def\Real{\mathord{R}}
+\def\Rn{\Real^n}
+\def\A{{\bf A}}
+\def\B{{\bf B}}
+\def\C{{\bf C}}
+\def\F{{\bf F}}
+\def\G{{\bf G}}
+\def\H{{\bf H}}
+\def\I{{\bf I}}
+\def\K{{\bf K}}
+\def\L{{\bf L}}
+\def\M{{\bf M}}
+\def\N{{\bf N}}
+\def\P{{\bf P}}
+\def\Q{{\bf Q}}
+\def\R{{\bf R}}
+\def\S{{\bf S}}
+\def\W{{\bf W}}
+\def\bp{{\bf\Phi}}
+
+
+Page 29, Fig.~3
+$$\commdiag{\Rn&\mapright^{\bp(t_1,t_0)}&\Rn\cr
+&\arrow(3,-2)\lft{\bp(t,t_0)}&\mapdown\rt{\bp(t,t_1)}\cr &&\Rn\cr}$$
+
+Page 48, Fig.~1:
+$$\commdiag{\Rn&\mapright^{\bp(t,t_0)}&\Rn\cr
+\mapdown\lft{\P(t_0)}&&\mapup\rt{\P^{-1}(t)}\cr
+\Rn&\mapright^{e^{\R(t-t_0)}}&\Rn\cr}$$
+
+Page 69, Fig.~1:
+$$\commdiag{\Rn&\mapright^{\M_1}&\Real^m\cr
+\mapdown\lft\Q&&\mapup\rt\P\cr
+\Rn&\mapright^{\M_2}&\Real^m\cr}$$
+
+Page 69, Fig.~2:
+$$\commdiag{\Rn&\mapright^\A&\Rn\cr
+\mapdown\lft\P&&\mapup\rt{\P'}\cr
+\Rn&\mapright^\S&\Rn\cr}$$
+
+Page 71, Fig.~3:
+$$\commdiag{\Rn&\mapright^\A&\Rn\cr
+\mapdown\lft\P&&\mapup\rt{\P^{-1}}\cr
+\Rn&\mapright^\B&\Rn\cr}$$
+
+Page 92, Fig.~1:
+$$\harrowlength=40pt \varrowlength=24.7pt \sarrowlength=\harrowlength
+\commdiag{C^m&\mapright^{\B(\sigma)}&\Rn&\mapright^{\bp_\A(t_0,\sigma)}&
+\Rn&\mapright^{\int_{t_0}^t-d\sigma}&\Rn&\mapright^{\bp_\A(t,t_0)}&
+\Rn&\mapright^{\C(t)}&C^q\cr
+&\arrow(3,-2)\lft{\P(\sigma)\B(\sigma)}&\mapdown\rt{\P(\sigma)}&&
+\mapdown\rt{\P^{-1}(t_0)}&&\mapdown\rt{\P(t_0)}&&\mapdown\lft{\P^{-1}(t)}&
+\arrow(3,2)\rt{\C(t)\P^{-1}(t)}\cr
+&&\Rn&\mapright_{\bp_{\A_1}(t_0,\sigma)}&\Rn&\mapright_{\int_{t_0}^t-d\sigma}&
+\Rn&\mapright_{\bp_{\A_1}(t,t_0)}&\Rn}$$
+
+Page 96, Fig.~2:
+$$\harrowlength=32pt \varrowlength=\harrowlength \sarrowlength=\harrowlength
+\def\olap#1{\harrowlength=118pt\hbox to0pt{\hss$#1$\hss}}
+\commdiag{C^m&&&&&&&&&&C^q\cr \mapup\lft{\G(\sigma)}
+&\hmorphposn=2pt\arrow(1,-1)\rt{\int_{t_0}^{t_1}-\G(\sigma)\,d\sigma}
+&&&&&&&&\arrow(1,1)\lft{\H(\ )}&\mapdown\rt
+{\int_{t_0}^{t_1}-\H(\sigma)\,d\sigma}\cr
+\Rn&\mapleft_{\W(t_0,t_1)}&\Rn&&&\olap{\mapright^{\I}}&&&
+\Rn&\mapleft_{\M(t_0,t_1)}&\Rn\cr
+\mapdown\lft{\P'}&&\mapup\lft\P&\arrow(-1,1)\rt\P&&&&\arrow(-1,-1)\lft\Q&
+\mapdown\rt\Q&&\mapup\rt{\Q'}\cr
+\Rn&\mapright^{\S_1}&\Rn&\mapright^{\S_1}&\Rn&\harrowlength=20pt
+\mapright^{\Q\P}&\Rn&\mapright^{\S_2}&\Rn&\mapright^{\S_2}&\Rn\cr
+&&\mapdown\lft{\N_1}&&&&&&\mapup\rt{\N_2}\cr
+&&\Rn&&&\olap{\mapright^{\I}}&&&\Rn\cr}$$
+
+Page 114, Fig.~1:
+$$\sarrowlength=.42\harrowlength
+\commdiag{&\Real^m\cr &\arrow(-1,-1)\lft\B\quad \arrow(1,-1)\rt\G\cr
+\Rn&\mapright^\P&\Rn\cr \mapdown\lft{e^{\A t}}&&\mapdown\rt{e^{\F t}}\cr
+\Rn&\mapright^\P&\Rn\cr &\arrow(1,-1)\lft\C\quad \arrow(-1,-1)\rt\H\cr
+&\Real^q\cr}$$
+
+Page 127, Fig.~2:
+$$\commdiag{Y&\mapright^{L^*}&X\cr &\adjarrow(3,-2)\lft{LL^*}\rt{(LL^*)^{-1}}&
+\mapdown\rt{L}\cr &&Y\cr}$$
+
+Page 135, Fig.~2:
+$$\harrowlength=80pt \varrowlength=40pt \sarrowlength=50pt
+\def\olap#1{\harrowlength=214pt\hbox to0pt{\hss$#1$\hss}}
+\def\vlap#1{\varrowlength=93pt\setbox0=\hbox{$#1$}\ht0=0pt\dp0=0pt\box0}
+\commdiag{\Rn&&&\olap{\mapright^{\dot\K+\A'\K+\K\A+\L}}&&&\Rn\cr
+&\arrow(3,-1)\rt\K&&&&\arrow(-3,-1)\lft\K\cr \noalign{\vskip-3pt}
+&&\Rn&\mapright^{\B\B'}&\Rn\cr
+\vlap{\mapdown\lft\P}&&\mapup\lft{\P'}&&\mapdown\rt\P&&\vlap{\mapup\rt{\P'}}\cr
+&&\Rn&\mapleft^{\P\B\B'\P'}&\Rn\cr \noalign{\vskip-3pt}
+&\arrow(3,1)\lft{\K_1}&&&&\arrow(-3,1)\rt{\K_1}\cr
+\Rn&&&\olap{\mapright_{\dot\K_1+(\P\A\P^{-1}+\dot\P\P^{-1})\K_1
++\K_1(\P\A\P^{-1}+\dot\P\P^{-1})+\P'^{-1}\L\P^{-1}}}&&&\Rn\cr
+\noalign{\medskip}}$$
+
+Page 139, Fig.~2:
+$$\harrowlength=80pt \varrowlength=.618\harrowlength
+\sarrowlength=\harrowlength
+\commdiag{\Rn&\mapright^{\B'(\sigma)\bp'(t_0,\sigma)}&C^m\cr
+&\adjarrow(3,-2)\lft{\W(t_0,t_1)}\rt{\W^{-1}(t_0,t_1)}&
+\mapdown\rt{\int_{t_0}^{t_1}\bp(t_0,\sigma)\B(\sigma)\,d\sigma}\cr
+&&\Rn\cr}$$
diff --git a/Master/texmf-dist/source/eplain/base/test/contents.tex b/Master/texmf-dist/source/eplain/base/test/contents.tex
new file mode 100644
index 00000000000..6c3159da810
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/contents.tex
@@ -0,0 +1,30 @@
+% This file is public domain.
+%
+\input eplain
+
+\newcount\subsectionno
+
+\def\tocsubsectionentry#1#2#3{\leftline{Subsection #2.~#1\dotfill#3}}
+\let\tocentry = \tocsubsectionentry
+
+\readtocfile
+
+\subsectionno = 13
+
+\writetocentry{chapter}{beginning}
+\writetocentry{section}{subbeginning $\sin$}
+
+\advance\subsectionno by 1
+\writenumberedtocentry{subsection}{Subsection $\cos$ \#14}
+ {\the\subsectionno}
+
+\advance\subsectionno by 1
+\writenumberedtocentry{subsection}{Subsection \#15}{\the\subsectionno}
+
+% This doesn't expand \the\subsectionno -- only the first token gets
+% expanded. Its output line starts with \tocentry.
+\writenumberedtocentry{}{A toc entry}{1{\the\subsectionno}}
+
+%\loggingall
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/displine.tex b/Master/texmf-dist/source/eplain/base/test/displine.tex
new file mode 100644
index 00000000000..97730ede242
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/displine.tex
@@ -0,0 +1,36 @@
+% This file is public domain.
+%
+\ifx\undefined\eplain \input eplain \fi
+
+\loggingall
+
+\leftdisplays
+\parindent=31pt
+
+A displaylines with an eqdef: text mre more more more more more more
+more more more more more more more more more more text.
+$$\displaylines{x=1 \eqdef{eqdef-displ}\cr}$$
+
+{\leftskip = 14pt
+\noindent
+And a indented normal equation:
+$$y=2\eqdef{foo}
+$$
+An indented displaylines with an eqdef:
+$$\displaylines{x=1 \eqdef{eqdef-displ}\cr}
+$$
+
+Now the same two with hangindent nonzero.
+\hangindent=17pt
+And a indented normal equation:
+$$y=2\eqdef{foo}
+$$
+An indented displaylines with an eqdef:
+$$\displaylines{x=1 \eqdef{eqdef-displ}\cr}
+$$
+\par}
+
+Well?
+
+\bye
+
diff --git a/Master/texmf-dist/source/eplain/base/test/double.tex b/Master/texmf-dist/source/eplain/base/test/double.tex
new file mode 100644
index 00000000000..aca6d6bb3e4
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/double.tex
@@ -0,0 +1,24 @@
+% This file is public domain.
+%
+\ifx\undefined\eplain \input eplain \fi
+
+%\catcode`@ = 11
+%\input gcol
+%\catcode`@ = 12
+
+Here is a single-column line of text.
+%\vskip 6in
+%And another one.
+
+\doublecolumns
+\newcount \xxx
+\xxx=0
+\par
+\baselineskip = 2.5\baselineskip
+\loop
+ \hbox{Line \the\xxx.}
+ \ifnum \xxx < 3
+ \advance \xxx by 1
+\repeat
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/double2.tex b/Master/texmf-dist/source/eplain/base/test/double2.tex
new file mode 100644
index 00000000000..d1b794cad18
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/double2.tex
@@ -0,0 +1,163 @@
+% This file is public domain.
+%
+\input eplain
+
+\tolerance=2000
+
+\def\SP{\ }
+\def\throwaway#1{}
+\def\checkspace{\ifx \next\
+\let\result=\throwaway
+ \else \let\result=\ignorespaces \fi \result }
+\font\bigfont=cmr10 scaled \magstep5
+\def\bfl#1{\setbox0=\hbox {{\bigfont #1}\thinspace}
+ \noindent \hangindent \wd0 \hangafter -2
+ \llap {\vbox to \ht0{\kern\baselineskip \box0 \kern-\baselineskip}}%
+ \futurelet \next \checkspace}
+
+\parskip=10pt
+\hbadness = 1500
+\parindent=0pt
+
+\font\cmbig=cmr17
+\font\cmrbv=cmb10 scaled \magstep5
+\font\iti=cmbxti10 scaled \magstep2
+\font\erm=cmr8
+
+\doublecolumns
+
+%**************************************************************************
+% Generate a dummy first page for the twocol macro
+% The first page is to have the left column blank.
+
+\phantom{dummy first line} \vskip5truein
+ {\font\iti=cmti10 scaled \magstep1
+ \iti
+ \rightline{An abstract}
+ \rightline{goes}
+ \rightline{in here.}
+ }
+
+%karl \vfill
+%karl \eject
+
+%**************************************************************************
+
+\phantom{dummy first line} \vskip0.75truein
+
+\rightline{\cmrbv Title}
+\bigskip\bigskip
+\rightline{\iti Author}
+
+\bigskip\bigskip\bigskip
+%\rightline{\hrulefill}% width6.5truein}
+
+\nointerlineskip
+\moveleft 3.31truein
+\vbox{\hrule width6.5truein}
+\nointerlineskip
+
+\vskip0.75truein
+
+%**************************************************************************
+
+\bfl
+Xxxxxxx xxxxxx xxxxxx xxxxxxx xxxx xxx xxx\numberedfootnote{\erm Xxxxx xxxxx
+xxx xxxx Xxxxx xxxxx, Xxxxx xxxx Xxxxxx xxxxxx, xxxxxx xxxxx xx Xxxxxx Xxxxxx,
+Xxx., X.~X. Xxx~xxx, Xxxx Xxxxx, XX~xxxxx.} Xxxx Xxxxxxxxxx xxxxxxxx xxxx, Xxx
+xxxxx xxxxxx xx xxxxxxxx xx xxxxx xxxxxxx xxxxxxx xxxx xx xxxx xx xxxxxxx xx
+xxx xxxxx xx x xxx xxxxxxx xx xxxxx. Xx x/xxx xx x xxx xxxx xxxxxxx xxxxx
+xxxxxxx, Xxxxxx xxxxxxxxx xxxxx xxxxx x/xxx,xxx,xxx xx x xxxxxx. Xxxx xxxxx
+ xxxx xx xxxx xxxx Xxxxxx'x xxxxxxxx xx xxx xxxxxxx xxxxxxxx xxxxxx xx xxxxx
+ xx xxxx xxxxxxx xxx xxxxxx xxxx xx xxxxxxx xx xxxxxx x.xx xx x xxx, xxx x.xx
+xxx xxxxxx xxxxx xx~xxxxxxx. Xxxx xx x xxxxx xxxxxx xxx xxxxxxxxx xxxxxxxx xxx
+xxxxxxxx xxxx xxxxxxxx xxxxxxxxx xxx xxxxxx xxxxxx xxxx, xxx xxx xxxxxxxx
+xxxxxxxxx xx xxx xxxx xx xxxxxxxxxx xx x xxxx xxxxx xxxxxxxxxx.
+
+Xxxxx xxx xxxxxx xxx xxxxxx xx xxx xxxxx xx xxx xxx xxxxxxxxx (xxx XX-xxx
+xxxxx xxxxxx xxxxxxxx xx xxx Xxx Xxxxxxxxxx Xxxxxxxxxx), xx xxx xxxxxxx xxxx
+xx xxxxx xx xxxxxxxxxxx xx xxxxxxx x xxxxx xxxxxxx xxx xxxx xx xxxxx xxxx
+xxxxxx xx xxxx x xxxxxxxxxxx xxxxxx xxxx xxx xxxxxxx.
+
+Xxxxx x xxxxx xx xxx xxxx xx xxxxxxxxxx xxx xxxxxxxx xx xxx xxxxxxxxxx xxx
+xxxxxx xxxxxxxx xxx xxxx xxxxxx xxx xxxxx xxxx. Xxxx xxx xxxx xxxx xxxx xx
+xxxxx xxx xxxxxx'x xxxx xxxx xxxxxxxx, xxxx {xxx xxxxxxx} xx xxx xxxxxxx
+xxxxxxxxx, xxxxxxxx, xx x, xxx xxxxxxxx. Xxxxx xxxx xxxxxxxxx xxx xxxx (xxxx
+xxx Xxxx) xxx xxxxx xx Xxxxx~x.
+
+Xx xxxxxxxxxxx xx Xxxxx~x xxxxxxx xxxx xxx xxxxxxxx xx xxxxxxx xx xxxx xxxxxxx
+xxxxxxxx xxx xxx xx xxxxxxxxxx xx xxxxx xx xxxxxxxx. Xx xxxx, xx xxxxxxx xx
+xxxxxx xxx xxxxx xx xx xxxxx xxx xxx xxxxxxxxx xxx xxxxxxxx xxxxx xx Xxxxxx'x
+xxxxx xx Xxxxxx' xxxxxx xxxxxxx. Xxxx xxx xxxxxxxx xxxxx xxx xx xx xxxx, xxx
+xxxxxxxxx. Xxxxx~x xxxxxxxx xxx xxxxxxxxx xx xxxxxxx xx xxx xxxxxx xxxxxx xx
+xxxx xxxxxx xxxxxxxx xx xxxxxxxxx xx xxxxxxxxx.
+
+
+\singlecolumn
+\centerline{Table 1---Xxxxxxxxx Xxxx Xxxxxxxx xx Xxxxxxxx}
+\smallbreak
+\line \bgroup \hss
+ \vbox to 11\baselineskip{}
+\hss \egroup
+\doublecolumns
+
+
+Xxxx xxxxxx x xxxxxx xxxxxxx Xxxxxx'x xxxxxx xxxxxx xx xxx xxxxxx xxxxx xxxxxx
+xxx xxxx xxxxx xx Xxxxx~x, xxxx xxxx xxxxxx xx xxxxx xxxxxxx. Xx, xxx xxxxxxx,
+xx xxxxxxxxxx xxx xxxxxxxx xxxx xxxxxx xxxxxx, xx xxxxx xxxxx xx xxxxxxxxxxx,
+xxxxxxxxxx, xxx xxxxxxxxx, xxxxxxx xx xxx xxxxxxxx xx xxxx xxxxxx xxxx xxxxx
+xxxxxxx, xx xxxxx xxxxx xx xxx xxxxxxxx, xxxxx xxxxx, xxx xxxxxxxxx. Xxxx xxx
+xxxx xx xxxxxxxxx.
+
+\medskip\bigskip
+\centerline{Table 2---Xxxxxxx xx Xxxxxx'x Xxxxxx Xxxxxxx}
+\nobreak
+\centerline{(Xxxxxxx Xxxxxxxx)}
+\smallbreak
+\line \bgroup \hss
+ \vbox to 9\baselineskip{}
+\hss \egroup
+
+Xxxxxxxx xxx xxxx xxxx xxxxx xxxxx xx Xxxxx~x xxx xxx xxxx, xxxx xxx xxx xxxx
+xx xxx xxxxxxxx xxxxxxxx xxxxxxxxx xxxxx. Xx xxx x xxxxx xxxxxxx xx xxx xxxx
+xx xxxxxxx, xx xxx xxxxxxx xx xx x xxxxxx xxxxxx xx xxxxx xxxxxxx xx xxxxxx xx
+xxxx xxxxx xxxxxx x ``xxxxx xxxx'' xxxxxxxx. Xxxxx x xxxxx xx xxxx xxxxx xx
+xxx xxxx xx xxxxxxx xxx xxxxxxxx. Xxxx xxx xxxx xxxxxxxx xx xxxxx xxx xxxxxx'x
+xxxxxxxx xxxxxx xx xxxxx xxxxx, xxxxxxx xxx, xxx xxxxxx xxxx xxxx xxx xxxxx
+xxxxx xxxxxxxx xxx xxxxxxxx. Xxx xxxxxxx, xx xxx xxxxx xxxxx xxxxxx xxxx xxxx
+xxxxxx, xx xxx xxxx xxxxxx xxxxxxxx xxx xxx xxxxx. Xxx xxxxxxx xxx xxxxx xx
+Table~3.
+
+
+\font\eri=cmti8
+
+Xx xxxxxx xx xxxxxxxxxx xxxx xxxxx xxxxxx xxxx xxxxxxxx xxxx xxx xxx xxxxxxx
+xxxxx xx xxx xxxx xxxxx xxx xx xxx xx xxx xxx xxxxxxxxx xx xxxxxxx xxxx xx xxx
+xxx xxxxx xxxxx xxxxxx. Xxxxx~x xxxxxxx xxxx xxx xxxxx xxxxxxx, xx xx
+xxxxxxxxx xxxxxxxxx xx xxxxxxxx xx xxxx xxxx xxxxxxx xxxx xxx xxxx xxx xxxx
+xxxxxxxx xxxxxxxxxxx xxx xxx xxxxxx xx xx xxxxxxx. Xxxxxxxxx xxxxxxx xxxxx xxx
+xx xxxxxxxx xxxxxx xxxx xxx xxxx xxxxxxx xx x xxxxx xxxxxxxxx, xxx xxx
+xxxxxxxx xx xxx xxxxxxxxx? Xxx xxxx xxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xx
+XX-xxx, xxx xxxxxxxxx xx xxx {xxx Xxxxxx xxxxxx Xxxx
+xxx},\numberedfootnote{\erm Xxxx Xx xx xxx xxxx Xxxxxx Xxxxxxx xxxx xxxxx
+xxxx.} ``X xxxxxxx xxxxx xxxxxxxxx xxx Xxxxxx xxx xxx xxxx'x xxxxx xx xxxxxxxx
+xxxx xx xxxxxxxxx xxxxxx xxxxxx xxxx xxxxxx xxxx.'' Xxxx xxxxxx xxxxx xx x
+xxxxxxxx xxxx xxxxxxxx xxxxx xxxxxx xxx xxxxxxxx xxx xxx xxxxxxx xxx xx xxxx
+xxxxxxx xxx xxxxxx xxxxxx xxxxxxxx xxx xxxx xxxxxxxxxxx xxxx xxx xxx xxxxxxx
+xxx xxxxxx xxxxxx xx Xxxxxx xxxxx xx xxxx, xxx xxxxx xxx xxx xxxxxxxx xx x
+Xxxxxx xxxxxxx xxxx xxx xxxx? Xxx xxxxxx xxxxx xx xx xxxxxxxxx xxx xxxxxxx
+xxxx xxx xxxx xxxx xx Xxxxx~x xxx xxxxxx xxxx xxx xxxxxxx xxxx xxxxx xx
+xxxxxxx xx xxxxxx xxx xx xxxxx.
+
+\singlecolumn
+
+\medskip\bigbreak
+\midinsert
+\centerline{Table 3---Xxxxxxxxx Xxxx Xxxxxxxx xx Xxxxxxxx}
+\smallbreak
+\line \bgroup \hss
+ \vbox to11\baselineskip{}
+\hss \egroup
+\endinsert
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/dvipdfm.tex b/Master/texmf-dist/source/eplain/base/test/dvipdfm.tex
new file mode 100644
index 00000000000..0760afbe50b
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/dvipdfm.tex
@@ -0,0 +1,111 @@
+\input ../eplain
+%\enablehyperlinks[nolinks]
+%\enablehyperlinks[dvipdfm]
+\enablehyperlinks
+
+\beginpackages
+\usepackage[dvipsnames]{color}
+\endpackages
+
+% Execute #1 then print it verbatim and indented.
+\def\c{\cf\indent\relax}
+% Same as \c, but do not indent and at the end say \hlend.
+\def\f{\cf\noindent\hlend}
+%
+\def\cf#1#2#3{%
+ \def\temp{#3}%
+ \edef\cftemp{\sanitize\temp}%
+ #1#3\expandafter\verbatim\cftemp\endverbatim#2\par
+}
+%
+\newcount\destcount
+% Execute `#1{d\the\destcount}' then print it (`#1', `{d', and `}' are printed
+% verbatim; `\the\destcount' is expanded).
+\def\d{\dl\relax}
+% Same as \d, but at the end also say \hlend.
+\def\l{\dl\hlend}
+%
+\def\dl#1#2{%
+ \global\advance\destcount by1
+ \toks0={#2}%
+ \edef\temp{\the\toks0{d\the\destcount}}%
+ \edef\dltemp{\sanitize\temp}%
+ \noindent#2{d\the\destcount}\expandafter\verbatim\dltemp\endverbatim#1\par
+}
+
+
+
+\leftline{\bf Destinations}
+\medskip
+
+{\tt\global\parindent=4em}
+
+\d{\hldest{}{}}
+\c{\hldestopts{zoom=2345}}
+\d{\hldest{}{}}
+\medskip
+\c{\hldesttype{fitr}}
+\c{\hldestopts{left=36,bottom=420,right=360,top=720}}
+\d{\hldest{}{}}
+\c{\def\mydesttype{xyz}}
+\c{\def\myopts{left=72,top=648}}
+\d{\hldest{\mydesttype}{\myopts}}
+\medskip
+\c{\let\myopts\empty}
+\c{\hldestopts{raise=2\normalbaselineskip}}
+\d{\hldest{xyz}{\myopts,zoom=2500}}
+\c{\hldestopts{left=,bottom=,right=,top=}}
+\d{\hldest{xyz}{raise=\ht\strutbox,zoom=3000}}
+\medskip
+\makeatletter
+\c{\def\mydest{\special{pdf: dest (\@hllabel) [@thispage /FitBH @ypos]}}}
+\d{\hldest{raw}{cmd=mydest}}
+\resetatcatcode
+\medskip
+\d{\hldest{fit}{}}
+\d{\hldest{fith}{}}
+\d{\hldest{fitv}{}}
+\d{\hldest{fitb}{}}
+\d{\hldest{fitbh}{}}
+\d{\hldest{fitbv}{}}
+\vfil\eject
+
+
+
+\leftline{\bf Links}
+\medskip
+
+{\tt\global\parindent=4.5em}
+
+\destcount=0 % Reset destination count.
+\l{\hlstart{name}{}}
+\c{\hlopts{bstyle=U}}
+\l{\hlstart{name}{}}
+\l{\hlstart{}{bstyle=D,bdash=2 4,bcolor=1 0 0,hlight=I}}
+\l{\hlstart{}{bstyle=B,bwidth=3}}
+\c{\hlopts{bcolor=0 0 1}}
+\l{\hlstart{}{bstyle=I,bwidth=4}}
+\l{\hlstart{}{bstyle=U,bwidth=1}}
+\c{\hlopts{bstyle=S}}
+\l{\hlstart{}{hlight=I,bcolor=1 .2 .2,bwidth=2}}
+\l{\hlstart{}{hlight=N,bstyle=D,bwidth=3}}
+\l{\hlstart{}{hlight=O}}
+\l{\hlstart{}{hlight=P,bcolor=.3 .6 .7}}
+\l{\hlstart{}{bstyle=D,bdash=2 4 6}}
+\l{\hlstart{}{bwidth=0}}
+\l{\hlstart{}{bstyle=D,bdash=2 4 6 8}}
+\f{\hlstart{page}{pagefit=/FitH 600}{1}}
+\f{\hlstart{filename}{file=hlink.pdf,newwin=1}{eq1}}
+\f{\hlstart{filepage}{file=hlink.pdf,pagefit=/FitR 50 100 300 500}{1}}
+\f{\hlstart{filepage}{file=hlink.pdf,pagefit=/FitB}{2}}
+\f{\hlstart{url}{}{http://tug.org/eplain/}}
+\c{\def\c{\special{pdf:beginann<</Type/Annot/Subtype/Link/Dest[0/FitH @ypos]>>}}}
+\f{\hlstart{raw}{cmd=c}{}}
+
+
+
+\bye
+
+% Local variables:
+% compile-command: "(cd .. && make eplain.tex) && tex --interact=nonstopmode dvipdfm.tex && dvipdfm -p letter dvipdfm.dvi"
+% End:
diff --git a/Master/texmf-dist/source/eplain/base/test/ecommdiag.tex b/Master/texmf-dist/source/eplain/base/test/ecommdiag.tex
new file mode 100644
index 00000000000..562ad84ce00
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/ecommdiag.tex
@@ -0,0 +1,15 @@
+% This file is public domain.
+%
+\input ../eplain
+
+\fmtversion
+
+$$\commdiag{Y&\mapright^f&E\cr \mapdown&\arrow(3,2)\lft{f_t}&\mapdown\cr
+Y\times I&\mapright^{\bar f_t}&X}$$
+
+\end
+
+From DYMACEK@fs.sciences.WLU.EDU Fri Apr 15 09:21:12 1994
+To: kb@cs.umb.edu
+From: "Wayne M. Dymacek" <DYMACEK@fs.sciences.WLU.EDU>
+Date: Fri, 15 Apr 1994 9:19:15 EDT
diff --git a/Master/texmf-dist/source/eplain/base/test/emergncy.tex b/Master/texmf-dist/source/eplain/base/test/emergncy.tex
new file mode 100644
index 00000000000..de1eeaefe6f
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/emergncy.tex
@@ -0,0 +1,19 @@
+% This file is public domain.
+%
+%\ifx\undefined\eplain \input eplain \fi
+
+\hsize = 32pc
+\emergencystretch = 8pc
+%\tolerance = 10000
+
+\def\code#1{{\tt #1}}
+\def\\{{\tt \char92}}
+
+You can make a new numbered theorem-like environment with
+\code{\\definenumberedtheorem}. This macro takes one argument, the name
+of the environment. The first letter of the name will be capitalized
+when it is typeset. Analogously, you can use
+\code{\\defineunnumberedtheorem} to make a new unnumbered theorem-like
+environment. These commands can only be used before \code{\\body}.
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/env.tex b/Master/texmf-dist/source/eplain/base/test/env.tex
new file mode 100644
index 00000000000..3b4cf56be66
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/env.tex
@@ -0,0 +1,42 @@
+% This file is public domain.
+%
+\input eplain
+
+First, let's make sure they work.
+
+\loggingall
+
+\environment{outer}
+ \environment{inner}
+ This is in the first inner.
+ \endenvironment{inner}
+
+ This is between inners.
+
+ \environment{inner}
+ This is in the second inner.
+
+ \environment{even-more-inner}
+ This is even more inner.
+ \endenvironment{even-more-inner}
+ \endenvironment{inner}
+\endenvironment{outer}
+
+This is after the outer.
+
+Now let's make some mistakes.
+
+%\environment{start-1}
+%\endenvironment{end-2}
+
+\endenvironment{where-is-the-start?}
+
+\begingroup
+\endenvironment{begingroup-started}
+
+\environment{endgroup-ended}
+\endgroup
+
+\environment{noend}
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/eqdef.tex b/Master/texmf-dist/source/eplain/base/test/eqdef.tex
new file mode 100644
index 00000000000..8a72b874333
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/eqdef.tex
@@ -0,0 +1,15 @@
+% This file is public domain.
+%
+% Test empty eqdef's.
+\ifx\undefined\eplain \input eplain \fi
+
+\loggingall
+
+$$a = 1
+\eqdef{}
+$$
+
+$$b = 2
+\eqdef{}
+$$
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/eqref.tex b/Master/texmf-dist/source/eplain/base/test/eqref.tex
new file mode 100644
index 00000000000..8f0d4f8bb59
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/eqref.tex
@@ -0,0 +1,141 @@
+% This file is public domain.
+%
+% Test symbolic equation references.
+%
+\ifx\eplain\undefined \input eplain \fi
+
+\loggingall
+\leftdisplays
+
+An equation with a number in its name:
+$$ a+b=1\eqdef{line1}$$
+\line{did we mess up plain's line in equation \eqref{line1}?\hfil}
+
+\bye
+
+The first equation:
+$$x + y = 1 \eqdef{first}$$
+
+In equation \eqref{first}, we said that $x+y=1$.
+Now, in equation \eqref{second}, we say that $a+b=2$.
+
+$$a + b = 2 \eqdef{second}$$
+
+The next equation is unlabeled in the output, but we can still refer to
+it.
+$$c + d = 3 \eqdefn{*}$$
+
+And here's an equation whose text references another equation, namely,
+\eqref{first}:
+$$c=3\eqdef[\eqrefn{first}*]{first-star}$$
+And a reference to it: \eqref{first-star}.
+
+Here is the first of a group of equations: \eqdefn{group}
+$$a = 1\eqsubdef{group-1}$$
+and the invisible second, then the third of the group \eqsubdefn{group-invis}:
+$$b = 2\eqsubdef{group-2}$$
+We refer to the group as \eqref{group}, to the first as
+\eqref{group-1}, the third as \eqref{group-2}, and the invisible second
+as \eqref{group-invis}.
+
+Here's an equation labeled strangely:
+$$a=1\eqdef[\rm strange*]{foo}$$
+And let's refer to \eqref{foo}.
+
+Let's do subequations off that:
+$$b=2\eqsubdef{foo-1}$$
+And refer to it: \eqref{foo-1}.
+
+% We can't use \count255, since #1 might involve contortions which
+% trample it.
+\newcount\subrefcount
+\def\eqsubreftext#1#2{%
+ \subrefcount = #2
+ \advance\subrefcount by 96
+ #1\char\subrefcount
+}
+
+Let's try another group, with a different labelling scheme. Here is the
+first of this group2: \eqdefn{group2}
+$$a = 1\eqsubdef{group2-1}$$
+and the second of the group2 \eqsubdefn{group2-invis}:
+$$b = 2\eqsubdef{group2-2}$$
+We refer to the group2 as \eqref{group2}, to the first as
+\eqref{group2-1}, the third as \eqref{group2-2}, and the invisible second
+as \eqref{group2-invis}.
+
+Here is one done with displaylines:
+% The \hfill's and \llap make the equation numbers come out in the right
+% place if we are not doing \leftdisplays. (See the TeXbook, p.194.)
+%$$\displaylines{
+% \hfill x=1\hfill\llap{\eqdef{displayline-1}}\cr
+% \hfill y=2\hfill\llap{\eqdef{displayline-2}}\cr
+%}$$
+$$\displaylines{
+ x=1\eqdef{displayline-1}\cr
+ y=2\eqdef{displayline-2}\cr
+}$$
+
+Let's refer to each of the equations in the displaylines:
+\eqref{displayline-1}, \eqref{displayline-2}.
+
+And one with eqalignno:
+$$
+\eqalignno{
+ a+b&=c&\eqdef{eqalign-1}\cr
+ d+e&=f&\eqdef{eqalign-2}\cr
+}
+$$
+
+And one with leqalignno, and indented more:
+{\leftdisplayindent = 1in
+$$\leqalignno{
+ a+b &=c&\eqdef{leqalign-1}\cr
+ dt+eg&=f&\eqdef{leqalign-2}\cr
+}$$
+}
+
+And now let's refer to those: \eqref{eqalign-1}, \eqref{eqalign-2},
+\eqref{leqalign-1}, \eqref{leqalign-2}.
+
+
+
+\def\eqprint#1{[\rm A.#1]}
+
+From now on, all equation labels should be in brackets and preceded
+by `A.'. In \eqref{*}, we said that $c+d=3$. And in equation
+\eqref{undefined}, we say that $1+1=2$.
+
+\eqdefn{*x}
+\eqdefn{*y}
+
+We defined equation \eqref{*y}, although we didn't give an equation for
+it.
+This is a forward reference to equation \eqref{forward}.
+
+$$e + f = 4 \eqdef{forward}$$
+
+That equation above defines \eqref{forward}.
+
+
+\newcount\sectionnum \sectionnum = 1
+\def\eqconstruct#1{\the\sectionnum.#1}
+
+And now equation numbers should have a section number (which we start at
+one) preceding them.
+
+$$a+b=1 \eqdef{s-ab}$$
+
+That equation is \eqref{s-ab}. The one we'll define in the next section
+is \eqref{s-cd}.
+
+
+\advance\sectionnum by 1
+The equation in the previous section was \eqref{s-ab}. Let's define one
+in this section:
+
+$$c+d=3 \eqdef{s-cd}$$
+
+And refer to it: \eqref{s-cd}.
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/example.eps b/Master/texmf-dist/source/eplain/base/test/example.eps
new file mode 100644
index 00000000000..4074a32b458
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/example.eps
@@ -0,0 +1,389 @@
+%!PS-Adobe-2.0 EPSF-1.2
+%%Creator: MATLAB, The Mathworks, Inc.
+%%Title: example.eps
+%%CreationDate: 11/05/96 21:16:44
+%%DocumentNeededFonts: Helvetica
+%%DocumentProcessColors: Cyan Magenta Yellow Black
+%%Pages: 1
+%%BoundingBox: 97 197 502 604
+%%EndComments
+
+%%BeginProlog
+
+% MathWorks dictionary
+/MathWorks 150 dict begin
+
+% definition operators
+/bdef {bind def} bind def
+/ldef {load def} bind def
+/xdef {exch def} bdef
+/xstore {exch store} bdef
+
+% operator abbreviations
+/c /clip ldef
+/cc /concat ldef
+/cp /closepath ldef
+/gr /grestore ldef
+/gs /gsave ldef
+/mt /moveto ldef
+/np /newpath ldef
+/cm /currentmatrix ldef
+/sm /setmatrix ldef
+/rc {rectclip} bdef
+/rf {rectfill} bdef
+/rm /rmoveto ldef
+/rl /rlineto ldef
+/s /show ldef
+/sc {setcmykcolor} bdef
+/sr /setrgbcolor ldef
+/w /setlinewidth ldef
+/j /setlinejoin ldef
+/cap /setlinecap ldef
+
+% page state control
+/pgsv () def
+/bpage {/pgsv save def} bdef
+/epage {pgsv restore} bdef
+/bplot /gsave ldef
+/eplot {stroke grestore} bdef
+
+% orientation switch
+/portraitMode 0 def
+/landscapeMode 1 def
+
+% coordinate system mappings
+/dpi2point 0 def
+
+% font control
+/FontSize 0 def
+/FMS {
+ /FontSize xstore %save size off stack
+ findfont
+ [FontSize 0 0 FontSize neg 0 0]
+ makefont
+ setfont
+ }bdef
+
+/reencode {
+exch dup where
+{pop load} {pop StandardEncoding} ifelse
+exch
+dup 3 1 roll
+findfont dup length dict begin
+ { 1 index /FID ne {def}{pop pop} ifelse } forall
+ /Encoding exch def
+ currentdict
+end
+definefont pop
+} bdef
+
+/isroman {
+findfont /CharStrings get
+/Agrave known
+} bdef
+
+/FMSR {
+3 1 roll 1 index
+dup isroman
+{reencode} {pop pop} ifelse
+exch FMS
+} bdef
+
+/csm {
+ 1 dpi2point div -1 dpi2point div scale
+ neg translate
+ landscapeMode eq {90 rotate} if
+ } bdef
+
+% line types: solid, dotted, dashed, dotdash
+/SO { [] 0 setdash } bdef
+/DO { [.5 dpi2point mul 4 dpi2point mul] 0 setdash } bdef
+/DA { [6 dpi2point mul] 0 setdash } bdef
+/DD { [.5 dpi2point mul 4 dpi2point mul 6 dpi2point mul 4 dpi2point mul] 0 setdash } bdef
+
+% macros for lines and objects
+/L {
+ lineto
+ stroke
+ } bdef
+/MP {
+ 3 1 roll moveto
+ 1 sub {rlineto} repeat
+ } bdef
+/AP {
+ {rlineto} repeat
+ } bdef
+/PP {
+ closepath fill
+ } bdef
+/DP {
+ closepath stroke
+ } bdef
+/MR {
+ 4 -2 roll moveto
+ dup 0 exch rlineto
+ exch 0 rlineto
+ neg 0 exch rlineto
+ closepath
+ } bdef
+/FR {
+ MR stroke
+ } bdef
+/PR {
+ MR fill
+ } bdef
+/L1i {
+ { currentfile picstr readhexstring pop } image
+ } bdef
+
+/tMatrix matrix def
+/MakeOval {
+ newpath
+ tMatrix currentmatrix pop
+ translate scale
+ 0 0 1 0 360 arc
+ tMatrix setmatrix
+ } bdef
+/FO {
+ MakeOval
+ stroke
+ } bdef
+/PO {
+ MakeOval
+ fill
+ } bdef
+
+/PD {
+ 2 copy moveto lineto stroke
+ } bdef
+
+
+currentdict end def
+%%EndProlog
+
+%%BeginSetup
+MathWorks begin
+
+0 cap
+
+end
+%%EndSetup
+
+%%Page: 1 1
+%%BeginPageSetup
+%%PageBoundingBox: 97 197 502 604
+MathWorks begin
+bpage
+%%EndPageSetup
+
+%%BeginObject: graph1 1
+bplot
+
+/dpi2point 12 def
+portraitMode 0216 7344 csm
+
+ 956 91 4862 4883 MR c np
+76 dict begin %Colortable dictionary
+/c0 { 0 0 0 sr} bdef
+/c1 { 1 1 1 sr} bdef
+/c2 { 1 0 0 sr} bdef
+/c3 { 0 1 0 sr} bdef
+/c4 { 0 0 1 sr} bdef
+/c5 { 1 1 0 sr} bdef
+/c6 { 1 0 1 sr} bdef
+/c7 { 0 1 1 sr} bdef
+%%IncludeResource: font Helvetica
+/Helvetica /ISOLatin1Encoding 144 FMSR
+
+1 j
+c1
+ 0 0 6912 5185 PR
+6 w
+DO
+4 w
+c0
+1463 4613 mt 1463 388 L
+1463 388 mt 1463 388 L
+2308 4613 mt 2308 388 L
+2308 388 mt 2308 388 L
+3153 4613 mt 3153 388 L
+3153 388 mt 3153 388 L
+3999 4613 mt 3999 388 L
+3999 388 mt 3999 388 L
+4844 4613 mt 4844 388 L
+4844 388 mt 4844 388 L
+5689 4613 mt 5689 388 L
+5689 388 mt 5689 388 L
+1463 4613 mt 5689 4613 L
+5689 4613 mt 5689 4613 L
+1463 4191 mt 5689 4191 L
+5689 4191 mt 5689 4191 L
+1463 3768 mt 5689 3768 L
+5689 3768 mt 5689 3768 L
+1463 3346 mt 5689 3346 L
+5689 3346 mt 5689 3346 L
+1463 2923 mt 5689 2923 L
+5689 2923 mt 5689 2923 L
+1463 2501 mt 5689 2501 L
+5689 2501 mt 5689 2501 L
+1463 2078 mt 5689 2078 L
+5689 2078 mt 5689 2078 L
+1463 1655 mt 5689 1655 L
+5689 1655 mt 5689 1655 L
+1463 1233 mt 5689 1233 L
+5689 1233 mt 5689 1233 L
+1463 811 mt 5689 811 L
+5689 811 mt 5689 811 L
+1463 388 mt 5689 388 L
+5689 388 mt 5689 388 L
+1463 4613 mt 1463 388 L
+1463 388 mt 5689 388 L
+1463 4613 mt 1463 388 L
+1463 388 mt 5689 388 L
+1463 4613 mt 1463 388 L
+1463 388 mt 5689 388 L
+SO
+6 w
+1463 4613 mt 5689 4613 L
+1463 388 mt 5689 388 L
+5689 4613 mt 5689 388 L
+1463 4613 mt 1463 388 L
+5689 4613 mt 5689 4613 L
+1463 4613 mt 1463 4613 L
+1463 4613 mt 5689 4613 L
+1463 4613 mt 1463 388 L
+1463 4613 mt 1463 4613 L
+1463 4613 mt 1463 4571 L
+1463 388 mt 1463 430 L
+1423 4782 mt
+(0) s
+2308 4613 mt 2308 4571 L
+2308 388 mt 2308 430 L
+2268 4782 mt
+(2) s
+3153 4613 mt 3153 4571 L
+3153 388 mt 3153 430 L
+3113 4782 mt
+(4) s
+3999 4613 mt 3999 4571 L
+3999 388 mt 3999 430 L
+3959 4782 mt
+(6) s
+4844 4613 mt 4844 4571 L
+4844 388 mt 4844 430 L
+4804 4782 mt
+(8) s
+5689 4613 mt 5689 4571 L
+5689 388 mt 5689 430 L
+5609 4782 mt
+(10) s
+1463 4613 mt 1505 4613 L
+5689 4613 mt 5647 4613 L
+1264 4666 mt
+(-1) s
+1463 4191 mt 1505 4191 L
+5689 4191 mt 5647 4191 L
+1144 4244 mt
+(-0.8) s
+1463 3768 mt 1505 3768 L
+5689 3768 mt 5647 3768 L
+1144 3821 mt
+(-0.6) s
+1463 3346 mt 1505 3346 L
+5689 3346 mt 5647 3346 L
+1144 3399 mt
+(-0.4) s
+1463 2923 mt 1505 2923 L
+5689 2923 mt 5647 2923 L
+1144 2976 mt
+(-0.2) s
+1463 2501 mt 1505 2501 L
+5689 2501 mt 5647 2501 L
+1348 2554 mt
+(0) s
+1463 2078 mt 1505 2078 L
+5689 2078 mt 5647 2078 L
+1228 2131 mt
+(0.2) s
+1463 1655 mt 1505 1655 L
+5689 1655 mt 5647 1655 L
+1228 1708 mt
+(0.4) s
+1463 1233 mt 1505 1233 L
+5689 1233 mt 5647 1233 L
+1228 1286 mt
+(0.6) s
+1463 811 mt 1505 811 L
+5689 811 mt 5647 811 L
+1228 864 mt
+(0.8) s
+1463 388 mt 1505 388 L
+5689 388 mt 5647 388 L
+1348 441 mt
+(1) s
+1463 388 mt 5689 388 L
+1463 4613 mt 5689 4613 L
+1463 4613 mt 1463 388 L
+5689 4613 mt 5689 388 L
+1463 388 mt 1463 388 L
+5689 388 mt 5689 388 L
+gs 1463 388 4227 4226 MR c np
+42 183 43 192 42 200 42 206 42 210 43 211 42 210 42 208
+42 204 43 196 42 188 42 177 42 165 43 151 42 135 42 119
+42 100 43 82 42 61 42 42 42 20 43 -1 42 -22 42 -43
+42 -63 43 -83 42 -102 42 -120 43 -137 42 -152 42 -166 42 -178
+43 -188 42 -197 42 -204 42 -208 43 -211 42 -211 42 -209 42 -206
+43 -199 42 -192 42 -182 42 -170 43 -157 42 -142 42 -126 42 -108
+43 -89 42 -70 42 -50 43 -29 42 -8 42 13 42 34 43 55
+42 75 42 94 42 113 43 130 42 146 42 160 42 173 43 185
+42 193 42 202 42 206 43 210 42 211 42 211 42 207 43 202
+42 195 42 186 42 176 43 162 42 149 42 132 43 116 42 97
+42 79 42 58 43 37 42 17 42 -4 42 -26 43 -46 42 -67
+42 -86 42 -105 43 -123 42 -139 42 -155 42 -168 43 -180 42 -190
+42 -198 42 -205 43 -209 1505 2290 100 MP stroke
+42 -211 1463 2501 2 MP stroke
+42 -106 43 -87 42 -67 42 -48 42 -26 43 -5 42 15 42 37
+42 57 43 78 42 96 42 115 42 132 43 148 42 162 42 175
+42 185 43 195 42 202 42 207 42 210 43 211 42 211 42 206
+42 202 43 194 42 185 42 174 43 161 42 146 42 131 42 113
+43 95 42 76 42 56 42 35 43 14 42 -7 42 -28 42 -49
+43 -69 42 -89 42 -107 42 -125 43 -141 42 -157 42 -169 42 -182
+43 -191 42 -199 42 -205 43 -210 42 -211 42 -210 42 -209 43 -204
+42 -197 42 -189 42 -179 43 -166 42 -153 42 -137 42 -121 43 -103
+42 -84 42 -64 42 -44 43 -22 42 -2 42 19 42 40 43 61
+42 81 42 99 42 118 43 135 42 150 42 164 43 177 42 187
+42 197 42 203 43 207 42 211 42 211 42 210 43 206 42 200
+42 193 42 183 43 172 42 158 42 144 42 128 43 110 42 92
+42 73 42 52 43 31 1505 399 100 MP stroke
+42 11 1463 388 2 MP stroke
+
+gr
+3194 4942 mt
+(\\tex[t][t]{$t$}) s
+1090 3419 mt -90 rotate
+(\\tex[B][B]{$\\sin\(t\)$, $\\cos\(t\)$}) s
+90 rotate
+2314 273 mt
+(\\tex[B][B]{Plot of $\\sin\(t\)$ and $\\cos\(t\)$}) s
+2689 2048 mt
+(p1) s
+3956 3343 mt
+(p2) s
+5224 1495 mt
+(p2) s
+3486 2178 mt -78 rotate
+(p3) s
+78 rotate
+
+end
+
+eplot
+%%EndObject graph 1
+
+epage
+end
+
+showpage
+
+%%Trailer
+%%EOF
diff --git a/Master/texmf-dist/source/eplain/base/test/filexist.tex b/Master/texmf-dist/source/eplain/base/test/filexist.tex
new file mode 100644
index 00000000000..e80485577a5
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/filexist.tex
@@ -0,0 +1,22 @@
+% This file is public domain.
+%
+% Test \testfileexistence.
+%
+\ifx\undefined\eplain \input eplain\fi
+
+\testfileexistence{tex}
+\iffileexists \else
+ \message{\jobname.tex does not exist, but it should.}
+\fi
+
+\testfileexistence[README]{}
+\iffileexists \else
+ \message{README does not exist, but it should.}
+\fi
+
+\testfileexistence[foo]{bar}
+\iffileexists
+ \message{foo.bar exists, but it shouldn't.}
+\fi
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/flynn.tex b/Master/texmf-dist/source/eplain/base/test/flynn.tex
new file mode 100644
index 00000000000..d5efea792cd
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/flynn.tex
@@ -0,0 +1,7 @@
+% This file is public domain.
+%
+\input eplain
+\loggingall
+\xrdef{foo}
+\xrdef{bar}
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/footnote.tex b/Master/texmf-dist/source/eplain/base/test/footnote.tex
new file mode 100644
index 00000000000..de30cc89de4
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/footnote.tex
@@ -0,0 +1,88 @@
+% This file is public domain.
+%
+\input eplain
+
+This is some text\numberedfootnote{And this is the first footnote.} and
+now some more text\numberedfootnote{The second.} and
+finally\numberedfootnote{the third} some
+more.\numberedfootnote{The fourth.} And again.
+
+\footnotenumber = 0
+
+\leftskip = 1in
+Let's do another, this one should be numbered one
+again\numberedfootnote{OK, here it is, numbered one}. This paragraph
+ends up being indented by one inch. But this time the
+footnote\numberedfootnote{This one should be like the others.} shouldn't be
+indented.
+
+\footnotemarkseparation = .16666em
+
+\numberedlist
+\li This is the first item in a list, and it has a
+footnote\numberedfootnote{See? With a separation less than the others, too}.
+
+This is the second paragraph of the first item, and it has
+one\numberedfootnote{This is in the second paragraph.} too.
+\endnumberedlist
+
+\leftskip = 0pt
+Now let's redefine the footnote command.
+\let\footnote = \numberedfootnote
+
+\everyfootnote = {\it\leftskip=1in}%
+
+And do one\footnote{This is it, should be indented by one inch and in
+italics.} footnote with that, which should also end up indented.
+
+\font\small = cmr7
+\everyfootnote = {\small \baselineskip = 7pt }
+Another paragraph\footnote{With a footnote in a smaller font, but make
+it more than one line long so we can see if the baselineskip change
+worked or not. Because it's a small font, it has to go on for ages,
+simply ages.\par}.
+
+\vfill\eject
+
+% Test the \footnoterule parameters.
+%
+\footnoterulewidth = 6in
+\footnoteruleheight = 4pt
+\belowfootnoterulespace = 6pt
+
+New page\footnote{This footnote should have a 4pt rule above it which 6 inches
+wide and has 6 points of space below it.} to test the footnote rule
+parameters.
+
+\vfill\eject
+
+\everyfootnote = {\bf}
+\interfootnoteskip = 8pt
+\footnoteruleheight = 0pt
+\belowfootnoterulespace = 0pt
+\skip\footins = 12pt
+
+Some more\footnote{In bold, indented by the usual parindent, with no
+extra space between it and the rule; in fact, no rule.} footnotes so we can
+test\footnote{In bold, with 8pt extra space above it.}
+interfootnoteskip.
+
+The big blank space following this will force a long footnote to be
+broken across pages.
+
+\vglue 41pc plus 1filll
+
+This is the last line on the page\footnote{And this is the last
+footnote; it should be like the last one. We are making this
+footnote pretty long, so that it won't all fit on one page. I hope that
+\TeX\ will break it across pages, so we see if the new footnote
+formatting parameters still work in that case. Oh, boy, I can see we
+should make this footnote really long; much longer than I can make up
+garbage sentences like this for. Well, maybe not. I can be pretty
+verbose when I have to be. I suppose anyone can. Did you notice I'm
+inconsistent about leaving one space or two after sentence-ending
+periods? Punctuation, really.}, and it should have 12pt
+(which is the footins skip) between it and the rule\footnote{I lied;
+{\it this} is the last footnote}.
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/frac.tex b/Master/texmf-dist/source/eplain/base/test/frac.tex
new file mode 100644
index 00000000000..f4f4cd565ab
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/frac.tex
@@ -0,0 +1,24 @@
+% This file is public domain.
+%
+\input eplain
+
+\obeylines %
+This is \frac 1/2 cup.
+This is \frac 2/3 cup.
+This is \frac 3/4 cup.
+This is \frac 5/6 cup.
+This is \frac 6/7 cup.
+This is \frac 7/8 cup.
+This is \frac 8/9 cup.
+This is \frac 9/{10} cup.
+This is \frac 10/{11} cup.
+
+\end
+
+
+
+
+
+
+
+
diff --git a/Master/texmf-dist/source/eplain/base/test/gcol.tex b/Master/texmf-dist/source/eplain/base/test/gcol.tex
new file mode 100644
index 00000000000..e44455ce0e7
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/gcol.tex
@@ -0,0 +1,218 @@
+% This file is public domain.
+%
+%Date: Thu, 16 May 91 14:59 PDT
+%From: David Guichard <GUICHARD%WHITMAN.BITNET@CORNELLC.cit.cornell.edu>
+%Subject: Re: eplain
+%To: karl@cs
+%
+%Karl--
+%
+%Here are my multi-column macros and a rewrite of the double columns section
+%of eplain.texinfo. I included a \quadcolumns because this seems potentially
+%useful on landscape pages.
+%
+%I ran into a couple of problems/bugs/features of the original macros that I
+%think I've fixed.
+%
+%First, if I started double columns and then returned to single column before
+%the output routine was invoked, but there was too much text in the columns to
+%fit on the current page, then all of the text was put on the next page, leaving
+%lots of blank space on the first page. I think I've fixed this by changing how
+%\vsize is defined.
+%
+%Next, unless I'm doing something screwy, it looks to me like eplain goofs up on
+%footnotes and topinserts issued in multicolumn mode. I think I've got things
+%changed around so they work.
+%
+%I also discovered that the "\vskip\interfootnoteskip" in the vfootnote macro
+%will produce a parskip even if the interfootnoteskip is 0---was this
+%intentional? If not, perhaps you'd like to add \parskip=0pt to vfootnote.
+%(I have already added it to the modified vfootnote in the columns macro).
+
+\newskip\abovecolumnskip \abovecolumnskip = \bigskipamount
+\newskip\belowcolumnskip \belowcolumnskip = \bigskipamount
+\newdimen\gutter \gutter = 2pc
+\newdimen\c@lumnhsize
+\newtoks\previousoutput
+\newcount\number@fcolumns
+\newbox\@partialpage
+\newdimen\singlec@lumnhsize
+\newdimen\singlec@lumnvsize
+\newtoks\previousoutput
+\let\@ndcolumns=\relax
+%
+% We have a few synonymous ways to refer to multiple column modes.
+%
+\def\doublecolumns{\@columns2}
+\def\triplecolumns{\@columns3}
+\def\quadcolumns{\@columns4}
+\def\begincolumns#1{\ifcase#1\relax \or \singlecolumn \or \@columns2 \or%
+ \@columns3 \or \@columns4 \else \relax \fi}
+\def\singlecolumn{\@ndcolumns\vskip\belowcolumnskip\nointerlineskip}
+\let\endcolumns=\singlecolumn
+%
+\def\@columns#1{%
+ \@ndcolumns%
+ \begingroup
+%
+% We redefine the main footnote macro so footnotes will extend across
+% the whole page, not just the width of a column. Likewise for @ins,
+% the insertion macro.
+%
+ \def\vfootnote##1{\insert\footins\bgroup\hsize=\singlec@lumnhsize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\ht\strutbox % top baseline for broken footnotes
+ \advance\splittopskip by \interfootnoteskip
+ \splitmaxdepth\dp\strutbox
+ \floatingpenalty\@MM
+ \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
+ \everypar = {}%
+ \parskip0pt
+ \the\everyfootnote
+ \vskip\interfootnoteskip
+ \indent\llap{##1\kern\footnotemarkseparation}\footstrut\futurelet\next\fo@t}
+ %
+ \def\@ins{\par\begingroup\setbox\z@\vbox\bgroup\hsize=\singlec@lumnhsize}
+ \global\let\@ndcolumns=\@@endcolumns
+ \global\number@fcolumns=#1
+ \global\c@lumnhsize = \hsize % If \hsize changed, get the new value.
+ \par % Shouldn't start in horizontal mode.
+ \global\previousoutput = \expandafter{\the\output}%
+ \global\advance\c@lumnhsize by -#1\gutter
+ \global\divide\c@lumnhsize by #1
+ \global\output = {%
+ \global\setbox\@partialpage =
+ \vbox{\unvbox255\vskip\abovecolumnskip}%
+ }%
+ \pagegoal = \pagetotal
+ \eject % Now expand the \output just above.
+ \global\output = {\c@lumnoutput}%
+ \global\singlec@lumnhsize = \hsize
+ \global\singlec@lumnvsize = \vsize
+ \hsize = \c@lumnhsize
+%
+% Compute the proper vsize based on what's already on the page
+% and the number of columns. Also change the mag factor for insertions.
+%
+ \global\advance\vsize by -\ht\@partialpage
+ \global\advance\vsize by -\ht\footins
+ \ifvoid\footins\else \global\advance\vsize by -\skip\footins \fi
+ \global\advance\vsize by -\ht\topins
+ \ifvoid\topins\else \global\advance\vsize by -\skip\topins \fi
+ \global\vsize = #1\vsize
+ \multiply\count\footins by #1 \multiply\count\topins by #1
+}%
+%
+% When this is invoked box 255 should contain just the right amount of
+% material, whether triggered by an output routine or a change in the
+% number of columns. Because columns have to contain a whole number of
+% lines of type, we take a bit of care with balancing the heights of the
+% columns to prevent either losing material or having a very short last
+% column.
+%
+% Note: when a page ends due to \bye or \eject, box 255 will contain lotsa
+% white space, so the columns will not look balanced. To fix this use
+% \singlecolumn before ending the page.
+%
+\def\@columnsplit{%
+ \splittopskip = \topskip
+ \splitmaxdepth = \baselineskip
+ \dimen0 = \ht255
+ \divide\dimen0 by \number@fcolumns
+ \begingroup % the balancing act
+ \vbadness = 10000 \loop \setbox8=\copy255
+ \global\setbox1 = \vsplit8 to \dimen0 \global\wd1 = \hsize
+ \global\setbox3 = \vsplit8 to \dimen0 \global\wd3 = \hsize
+ \ifnum\number@fcolumns>2%
+ \global\setbox5 = \vsplit8 to \dimen0
+ \global\wd5 = \hsize \fi
+ \ifnum\number@fcolumns>3%
+ \global\setbox7 = \vsplit8 to \dimen0
+ \global\wd7 = \hsize \fi
+ \ifdim\ht8>0pt \advance\dimen0 by 1pt \repeat
+ \endgroup
+ \global\setbox255 = \vbox{%
+ \unvbox\@partialpage
+ \ifcase\number@fcolumns \relax\or\relax\or%
+ \hbox to \singlec@lumnhsize{\box1\hfil\box3}\or%
+ \hbox to\singlec@lumnhsize{\box1\hfil\box3\hfil\box5}\or%
+ \hbox to\singlec@lumnhsize{\box1\hfil\box3\hfil\box5\hfil\box7}\or%
+ \else\relax\fi%
+ }%
+}%
+\def\c@lumnoutput{%
+ \@columnsplit
+ \hsize = \singlec@lumnhsize % Local to the \output group.
+ \vsize = \singlec@lumnvsize
+ \the\previousoutput
+%
+% Now the correct vsize is the original vsize times the
+% number of columns.
+%
+ \global\vsize=\number@fcolumns\singlec@lumnvsize
+}%
+\def\@@endcolumns{%
+ \global\let\@ndcolumns=\relax%
+ \par % Shouldn't start in horizontal mode.
+ \global\output = {\global\setbox1 = \box255}%
+ \pagegoal = \pagetotal
+ \eject
+ \global\setbox255 = \box1
+ \@columnsplit
+ \global\vsize = \singlec@lumnvsize
+ \global\output = \expandafter{\the\previousoutput}%
+ \endgroup
+ \ifvoid\topins\else\topinsert\unvbox\topins\endinsert\fi
+ \unvbox255
+}%
+
+\endinput
+
+@node Multiple columns, Footnotes, Margins, User definitions
+@section Multiple columns
+
+@cindex double column output
+@cindex triple column output
+@cindex quadruple column output
+@cindex multiple column output
+ Eplain provides for double, triple and quadruple
+column output: you just say
+@code{\doublecolumns},
+@findex doublecolumns
+@code{\triplecolumns}
+@findex triplecolumns
+or @code{\quadcolumns}
+@findex quadcolumns
+and from that point on, the manuscript will be
+set in columns. If you want to go back to one column, say
+@code{\singlecolumn}.
+@findex singlecolumn
+
+ The columns macros insert the value of the glue parameter
+@code{\abovecolumnskip}
+@findex abovecolumnskip
+before the multi-column text, and the value of the glue parameter
+@code{\belowcolumnskip}
+@findex belowcolumnskip
+after it. The default value for both of these parameters is
+@code{\bigskipamount}, i.e., one linespace.
+
+ The columns are separated by the value of the dimen parameter
+@code{\gutter}.
+@findex gutter
+The default value for @code{\gutter} is two picas.
+
+ The macros take into account only the insertion classes
+@cindex insertion classes
+defined by plain @TeX{}, namely, footnotes and @code{\topinsert}s. If
+you have defined additional insertion classes, you will need to change
+the macros which implement multi-column mode. Furthermore, the insertions
+do not respect the column widths; if you want them to, you have to
+change the way your output routine works. (Eplain uses whatever the
+current output routine is; it is not tied to @code{\plainoutput}.)
+@findex plainoutput
+
+@xx: \columnfill
+@xx: \singlecolumn to balance columns
+@xx: footnote/topinsert width of whole page
+@xx: \vfootnote resets \parskip
diff --git a/Master/texmf-dist/source/eplain/base/test/hlcite.tex b/Master/texmf-dist/source/eplain/base/test/hlcite.tex
new file mode 100644
index 00000000000..ec27c4e8fbe
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/hlcite.tex
@@ -0,0 +1,55 @@
+\input ../eplain
+%\enablehyperlinks[nolinks]
+%\enablehyperlinks[pdftex]
+%\enablehyperlinks[dvipdfm]
+\enablehyperlinks
+
+\ifpdf
+ \pdfpagewidth=8.5in
+ \pdfpageheight=11in
+\fi
+
+\beginpackages
+ \usepackage{color}
+\endpackages
+
+\hldestopts[bib]{raise=\ht\strutbox}
+\hlopts![cite]{bstyle=U}
+
+
+% Bibliography in front of the text.
+
+%\beginsection{References.}\par % Title for the bibliography.
+%\bibliography{knuth,xampl} % Use knuth.bib (from Eplain) and xampl.bib
+ % (from BibTeX) for the labels.
+%\bibliographystyle{plain}
+%\vfil\eject
+
+
+Two citations to Knuthian works:
+ \cite[note]{surreal,concrete-math}.
+
+
+\vfil\eject
+Three citations:
+ \cite[note]{surreal,article-crossref,whole-journal}.
+
+One citation:
+ \cite{article-crossref}.
+
+
+% Bibliography after the text.
+
+\vfil\eject
+\beginsection{References.}\par % Title for the bibliography.
+\bibliography{knuth,xampl} % Use knuth.bib (from Eplain) and xampl.bib
+ % (from BibTeX) for the labels.
+\bibliographystyle{plain}
+
+
+\bye
+
+% Local variables:
+% compile-command: "rm -f hlcite.aux hlcite.bbl && tex --interact=nonstopmode hlcite && bibtex hlcite && tex --interact=nonstopmode hlcite && tex --interact=nonstopmode hlcite && dvipdfm -p letter hlcite"
+% compile-command: "rm -f hlcite.aux hlcite.bbl && pdftex --interact=nonstopmode hlcite && bibtex hlcite && pdftex --interact=nonstopmode hlcite && pdftex --interact=nonstopmode hlcite"
+% End:
diff --git a/Master/texmf-dist/source/eplain/base/test/hlfoot.tex b/Master/texmf-dist/source/eplain/base/test/hlfoot.tex
new file mode 100644
index 00000000000..01fae52386b
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/hlfoot.tex
@@ -0,0 +1,47 @@
+\input ../eplain
+%\enablehyperlinks[nolinks]
+%\enablehyperlinks[pdftex]
+%\enablehyperlinks[dvipdfm]
+\enablehyperlinks
+
+\ifpdf
+ \pdfpagewidth=8.5in
+ \pdfpageheight=11in
+\fi
+
+\beginpackages
+ \usepackage{color}
+\endpackages
+
+% Set \normalbaselineskip for the sake of \hldestfootraise
+\everyfootnote = {\sevenrm \normalbaselineskip=9pt \normalbaselines}
+
+\hlopts![foot]{bstyle=U}
+\hldesttype[foot]{fitbh}
+\hlopts![footback]{bstyle=D,bdash=1 4}
+\hldesttype[footback]{fith}
+
+
+This\numberedfootnote{Footnote to `This'.} is a
+sentence\footnote*{Footnote to `sentence'.} with
+footnotes\footnote{**}{Footnote to `footnotes'.}.
+
+\medskip
+Now we say
+\verbatim\let\footnote=\numberedfootnote|endverbatim
+\let\footnote=\numberedfootnote\ and look what we get:
+
+This\footnote{Another footnote to `This'.} is another
+sentence\footnote{Another footnote to `sentence'.} with
+footnotes\footnote{Another footnote to `footnotes'.}.
+
+\vfil\eject
+Second page.
+
+
+\bye
+
+% Local variables:
+% compile-command: "tex --interact=nonstopmode hlfoot.tex && dvipdfm -p letter hlfoot.dvi"
+% compile-command: "pdftex --interact=nonstopmode hlfoot.tex"
+% End:
diff --git a/Master/texmf-dist/source/eplain/base/test/hlidx.mst b/Master/texmf-dist/source/eplain/base/test/hlidx.mst
new file mode 100644
index 00000000000..1f0813b806b
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/hlidx.mst
@@ -0,0 +1,2 @@
+delim_n "; "
+delim_r "\\thinspace--\\allowbreak\\thinspace "
diff --git a/Master/texmf-dist/source/eplain/base/test/hlidx.tex b/Master/texmf-dist/source/eplain/base/test/hlidx.tex
new file mode 100644
index 00000000000..2d177a9c6d2
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/hlidx.tex
@@ -0,0 +1,138 @@
+\input ../eplain
+
+% If you uncomment the optional arg, index hyperlinks will point to exact
+% locations of terms, but MakeIndex will regard _all_ index entries as distinct.
+% This can be partially cured by piping hlidx.idx through `util/idxuniq' script
+% before feeding it to MakeIndex (see the first compile-command at the end of
+% this file).
+\enablehyperlinks%[idxexact]
+%\enablehyperlinks[nolinks]
+%\enablehyperlinks[pdftex]
+%\enablehyperlinks[dvipdfm]
+
+\ifpdf
+ \pdfpagewidth=8.5in
+ \pdfpageheight=11in
+\fi
+
+\beginpackages
+ \usepackage{color}
+\endpackages
+
+\headline={\hrulefill}
+
+% Try to redefine the delimiters.
+\setidxpagelistdelimiter{; }
+\setidxpagerangedelimiter{\thinspace--\allowbreak\thinspace}
+
+% Underline and italisize a page number / page range, taking care not to
+% underline `--' in page range like `1--3'.
+%
+% Note that this definition is not enough if you don't use hyperlinks in index
+% (i.e., if you pass `idxnone' to \enablehyperlinks). Then page lists
+% like `1, 2' are not broken up by \hlidxpage, and the entire list may
+% be passed, which will be be italicized and underlined without being
+% split up. You can see the effect by commenting out
+% \enablehyperlinks above. In that case, you will have to do a more
+% sophisticated parsing using both \idxparserange and \idxparselist
+% (like in \@hlidxgetpages).
+\def\ituline#1{%
+ {\it
+ \idxparserange{#1}%
+ \ifx\idxpagei\empty
+ \underbar{#1}%
+ \else
+ \underbar{\idxpagei}\idxpagerangedelimiter\underbar{\idxpageii}%
+ \fi}%
+}
+
+
+\count0=-1
+
+% i
+\topglue12pt
+% \indent is needed to place hyperlink destination at the beginning of the first
+% line of the paragraph instead of vertical mode above the paragraph.
+\indent
+\sidx[pagemarkup=ituline]{truth}[definition of]
+Definition of truth, page~i.
+
+Another
+\sidx[pagemarkup=ituline]{truth}[definition of]
+definition of truth on page~i.
+\vfil\eject
+
+% ii
+\topglue24pt
+\indent
+\sidx[pagemarkup=ituline]{truth}[definition of]
+Definition of truth, page~ii.
+\vfil\eject
+
+% iii
+No index entries, page~iii.
+\vfil\eject
+
+\count0=1
+
+% 1
+\topglue36pt
+\indent
+\sidx[pagemarkup=ituline]{truth}[definition of]
+Definition of truth, page~1.
+\vfil\eject
+
+% 2
+\topglue24pt
+Beginning of
+\sidx[begin,pagemarkup=ituline]{truth}[definition of]
+definition of truth, page~2.
+\vfil\eject
+
+% 3
+\indent
+\sidx[pagemarkup=ituline]{truth}[definition of]
+Definition of truth that comes whithin an explicit range, page~3.
+\vfil\eject
+
+% 4
+End of
+\sidx[end]{truth}[definition of]
+definition of truth, page~4.
+\vfil\eject
+
+% 5
+\indent\idxname{Adrien-Marie}{Legendre} (September~18, 1752~-- January~10, 1833)
+was a French mathematician.
+
+Legendre integrals
+\sidx{Legendre\idxnameseparator Adrien-Marie!functions!F(k, phi), E(k,
+phi)@$F(k,\varphi)$, $E(k,\varphi)$}
+$F(k,\varphi)$ and $E(k,\varphi)$ are called {\it complete\/} when
+$\varphi=\pi/2$, in which case they are denoted by
+\sidx[pagemarkup=ituline]{Legendre\idxnameseparator Adrien-Marie!functions!K(k),
+E(k)@${\bf K}(k)$, ${\bf E}(k)$}
+${\bf K}(k)$ and ${\bf E}(k)$.
+
+\indent
+\sidx{semantic theory of truth@\leavevmode\hldest{}{}{idx:TSTT}semantic theory of truth}
+Semantic theory of truth was developed by Polish logician Alfred Tarski in the
+1930s.
+
+
+\sidx[seealso]{truth}[definition of]{\hlstart{}{}{idx:TSTT}semantic theory of
+truth\hlend}
+
+
+{\baselineskip=36pt
+\noindent\bf Index\par}
+
+\hookaction{beginindex}{\singlecolumn}
+\readindexfile{i}
+
+\bye
+
+% Local variables:
+% compile-command: "(cd .. && make eplain.tex) && rm -f hlidx.aux hlidx.ind hlidx.idx && tex --interact=nonstopmode hlidx && cat hlidx.idx | ../util/idxuniq | makeindex -s hlidx.mst > hlidx.ind && tex --interact=nonstopmode hlidx && dvipdfm -p letter hlidx.dvi"
+% compile-command: "(cd .. && make eplain.tex) && rm -f hlidx.aux hlidx.ind hlidx.idx && pdftex --interact=nonstopmode hlidx && makeindex -s hlidx.mst hlidx && pdftex --interact=nonstopmode hlidx"
+% End:
diff --git a/Master/texmf-dist/source/eplain/base/test/hlink.tex b/Master/texmf-dist/source/eplain/base/test/hlink.tex
new file mode 100644
index 00000000000..939a552ad3c
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/hlink.tex
@@ -0,0 +1,144 @@
+\input ../eplain
+%\enablehyperlinks[nolinks]
+%\enablehyperlinks[pdftex]
+%\enablehyperlinks[dvipdfm]
+\enablehyperlinks
+
+\beginpackages
+\usepackage[dvipsnames]{color}
+\endpackages
+
+\ifpdf
+ \pdfpagewidth=8.5in
+ \pdfpageheight=11in
+\fi
+
+\def\sectionword{Section}%
+\newcount\sectioncount
+\def\beginsection#1\par{%
+ \par
+ \advance\sectioncount by1
+ {\normalbaselineskip=3pc \normalbaselines
+ \noindent\definexref{sec\the\sectioncount}{\the\sectioncount}{section}%
+ {\bf Section~\the\sectioncount} #1\par}
+}%
+
+\def\deriv#1/#2{{{d#1}\over d#2}}%
+\def\vec#1#2{#1_1,#1_2,\ldots,#1_{#2}}%
+\def\cdotfill{\cleaders\hbox to 1em{\hss$\cdot$\hss}\hfill}%
+
+% Set defaults for hyperlink options.
+\hlopts{bstyle=U}% underlined border
+\hlopts{bwidth=2}%
+% Make \xrdef destinations make pages fit in the screen.
+\hldesttype[xrdef]{fit}% fit page
+% Set hyperlink options for various kinds of hyperlinks.
+\hlopts![ref]{bstyle=D,bdash=3,hlight=I}% dash border, invert box hlight
+\hlopts[ref]{bcolor=1 0 0,bwidth=1}% add options to the current list
+\hlopts![eq]{bcolor=0 1 0,hlight=O}% invert border hlight
+\hlopts![xref]{bstyle=I,bcolor=0 0 1,hlight=P,bwidth=4}% inset border, inset hlight
+
+
+Ordered list:
+\numberedlist
+\li[li1] Item 1
+\li[li2] \xrdef{li2:pg}Item 2
+ \numberedlist
+ \li[li2.a] subitem 2.a
+ \li[li2.b] subitem 2.b
+ \endnumberedlist
+\li Item 3
+\endnumberedlist
+
+Reference to \ref{li1}. Reference to {\let\reftie.\refn[item~\refn{li2}]{li2.b}}.
+
+\vskip\abovelistskipamount
+Unordered list:
+\unorderedlist
+\li[uli1] Item 1
+\li Item 2
+ \unorderedlist
+ \li[uli2.a] subitem 2.a
+ \li subitem 2.b
+ \endunorderedlist
+\endunorderedlist
+
+Refereneces to \ref[\sevenrm\lbrack dvipdfm will not make the \blackbox\ part of
+the link\rbrack]{uli1} and~\refn{uli2.a}.
+
+
+\beginsection \xrdef{sec1:pg}
+
+Reference to \ref{sec1} and forward reference to \ref{sec2}.
+
+
+
+\beginsection
+
+References to \refs{sec1} and~\refn{sec2}.
+
+\indent\ref{sec3} will start on \xref{sec3:pg}.
+$$\|A\| = \sup_{x\ne0} { \|Ax\| \over \|x\| }. \eqdef{eq1}$$
+Reference to \eqref{eq1}.
+$$\|A\| \ge {\|Ax\| \over \|x\|}. \eqsubdef{}$$
+Reference to \eqref[subequation]{}.
+$$\|Ax\| \le \|A\| \cdot \|x\|. \eqsubdef{subeq1.2}$$
+Reference to \eqref[subequation]{subeq1.2}. One more reference to
+\eqref[subequation]{}.
+
+\vfil\eject
+
+
+
+Forward reference to \eqref[equation]{subeq2.1}.
+$$\openup\jot
+\eqalignno{\eqdefn{eq2}% fake definition for \eqsubdef's to work
+ \deriv x/t &= 3x-2y,&\eqsubdef{subeq2.1}\cr
+ \deriv y/t &= 2x-y.&\eqsubdef{subeq2.2}\cr
+}$$
+References to equations \eqref{eq2}, \eqref{subeq2.1} and~\eqref{subeq2.2}.
+
+$$\hldestopts[eq]{raise=4.5\normalbaselineskip}
+\openup\jot
+\left.\,\eqalign{
+ \deriv x_1/t &= f_1(t,\vec xn),\cr
+ \deriv x_2/t &= f_2(t,\vec xn),\cr
+ \omit\span\omit\strut\cdotfill\cr
+ \deriv x_n/t &= f_n(t,\vec xn).\cr
+}\,\right\}\eqdef{eq3}$$
+Another notation for the \eqref[system]{eq3}:
+$$\deriv x_i/t=f_i(t,\vec xn)\quad
+(i=1,2,\ldots,n).\eqdef[\hbox{$\eqrefn{eq3}^*$}]{}$$
+Reference to \eqref[system]{}.
+
+Subequations in \verbatim\displaylines|endverbatim:
+$$\openup\jot
+\displaylines{
+ \eqsubdefn{eq3*.1}
+ \hfill\deriv x_2/t=f_2(t,\vec xn),\hfill\llap{\eqsubdef{eq3*.2}}\cr
+ \hfill\deriv x_3/t=f_3(t,\vec xn).\hfill\llap{\eqsubdef{eq3*.3}}\cr
+}$$
+References to \eqref{eq3*.1}, \eqref{eq3*.2} and~\eqref{eq3*.3}.
+
+\hloff[eq,]
+One more reference to \eqref[system]{}.
+\hlon
+And one more reference to \eqref[system]{}.
+
+\beginsection \xrdef{sec3:pg}
+
+\definecolor{mycolor}{rgb}{0,0,1}
+\hlopts{colormodel=,color=mycolor}
+
+Reference to \ref[item]{li2} on {\hloff\xref{li2:pg}}.
+
+\indent\ref{sec1} started on {\def\xrefpageword{page~}\xref[title]{sec1:pg}}.
+
+
+
+\bye
+
+% Local variables:
+% compile-command: "(cd .. && make eplain.tex) && rm -f hlink.aux && tex --interact=nonstopmode hlink.tex && tex --interact=nonstopmode hlink.tex && dvipdfm -p letter hlink.dvi"
+% compile-command: "(cd .. && make eplain.tex) && rm -f hlink.aux && pdftex --interact=nonstopmode hlink.tex && pdftex --interact=nonstopmode hlink.tex"
+% End:
diff --git a/Master/texmf-dist/source/eplain/base/test/ian.tex b/Master/texmf-dist/source/eplain/base/test/ian.tex
new file mode 100644
index 00000000000..95c254c6546
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/ian.tex
@@ -0,0 +1,28 @@
+% This file is public domain.
+%
+\input eplain
+
+\vsize 10cm \hsize 7cm
+
+Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.
+
+\doublecolumns
+
+Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
+blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.
+
+\singlecolumn
+
+Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/index.tex b/Master/texmf-dist/source/eplain/base/test/index.tex
new file mode 100644
index 00000000000..0a039dec9c2
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/index.tex
@@ -0,0 +1,36 @@
+% This file is public domain.
+%
+\input eplain
+
+\indexproofingtrue
+\hsize = 5in
+
+\def\defn#1{{\sl #1\/}}
+\def\title#1{{\it #1\/}}
+
+\idx{term}
+\idxname{K. Elizabeth}{Tachikawa}
+\idxmarked\title{Strange Angels}
+\idxsubmarked{Anderson, Laurie}\defn{Strange Angels}
+\idx[begin]{range} starts.
+\sidx[begin]{home}
+
+\vfill\eject
+
+\sidx[pagemarkup=defn]{truth}
+\sidxname{Megan Anne}{Haney}
+
+\sidx[end]{home}
+\idx[end]{range} ends.
+
+\sidx[see]{beauty}[truthful]{Anderson, Laurie}
+\sidxmarked[seealso]\defn{Strange Angels}{\defn{Home of the Brave}}
+
+
+\leftline{\bf Index}
+
+\def\idxpreface{These words precede the index.}
+
+\readindexfile{i}
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/jan.tex b/Master/texmf-dist/source/eplain/base/test/jan.tex
new file mode 100644
index 00000000000..b94ab34556f
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/jan.tex
@@ -0,0 +1,15 @@
+% This file is public domain.
+%
+\input eplain
+
+This gives \eqdefn{aa}
+$$1+2,\eqsubdef{op}$$
+and
+$$1+3.\eqsubdef{pp}$$
+And \eqref{aa} and \eqref{op} and \eqref{pp}.
+\bye
+
+From: deleeuw@laplace.sscnet.ucla.edu (Jan Deleeuw)
+Subject: batch mode
+To: karl@cs.umb.edu
+Date: Mon, 7 Jun 1993 20:26:22 -0700 (PDT)
diff --git a/Master/texmf-dist/source/eplain/base/test/justify.tex b/Master/texmf-dist/source/eplain/base/test/justify.tex
new file mode 100644
index 00000000000..232a6915064
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/justify.tex
@@ -0,0 +1,106 @@
+% This file is public domain.
+%
+\input eplain
+
+{\center foo
+bar
+}
+
+% Changing \parfillskip is OK, since the macros reset it.
+%\parfillskip = .75\hsize plus .06\hsize minus .75\hsize
+\loggingall
+
+Pre-text. These should be flush left:
+{\flushleft
+Here are a few
+lines that we are
+\vadjust{\bigskip}going to take {\it literally}. (with vadjusted space now)
+And a couple more
+of them.}
+
+Now we're back to normal.
+Now we're back to normal.
+Now we're back to normal.
+Pre-text. These should be flush right:
+
+{\it \flushright
+Here are a few italic
+lines that we are
+\vadjust{\bigskip}going to take literally.
+And a couple more
+of {\bf them.}
+
+In fact, let's do two paragraphs,
+this is so much fun. No, let's make it three.
+
+ For Dan
+ ---{\bf k.b.}
+}
+
+Now we're back to normal.
+Now we're back to normal.
+Now we're back to normal.
+These should be centered.
+
+{\center
+Here are a few
+lines that we are
+\vadjust{\bigskip}going to take literally.
+And a couple more
+of them.}
+
+Some centered paragraphs:
+{\center
+ Here is the first paragraph.
+
+ Here is the second.
+
+ Here is the third.
+}
+
+Now we're back to normal.
+Now we're back to normal.
+Now we're back to normal.
+These should be flush left again (two groups):
+
+{\flushleft
+ Here is the first paragraph.
+
+ Here is the second.
+}
+
+\blanklineskipamount = -.8\baselineskip
+{\flushleft
+ Here is the first paragraph.
+
+ Here is the second.
+
+ Here is the third
+}
+
+We changed the amount of space between the paragraphs in the second
+group so it was less than a full blank line. Did you notice?
+
+\scrollmode
+
+{\message{Now comes a mysterious error.} \center on first line---what happens?
+centered
+}
+
+\def\title{\begingroup\center}
+\def\endtitle{\endgroup}
+
+\title
+this should be centered
+by virtue of a macro
+\endtitle
+
+Back to normal.
+
+{\center
+centered
+\message{Now there should be an error:}%
+\flushleft % error
+}
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/knuth.bib b/Master/texmf-dist/source/eplain/base/test/knuth.bib
new file mode 100644
index 00000000000..abdf6ddecfa
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/knuth.bib
@@ -0,0 +1,17 @@
+% This file is public domain.
+
+@book{surreal,
+ author = "Donald E. Knuth",
+ title = "Surreal Numbers",
+ year = 1974,
+ publisher = "Addison-Wesley",
+ address = "Reading, Massachusetts"
+}
+
+@book{concrete-math,
+ author = "Ronald L. Graham and Donald E. Knuth and Oren Patashnik",
+ title = "Concrete Mathematics",
+ year = 1989,
+ publisher = "Addison-Wesley",
+ address = "Reading, Massachusetts"
+}
diff --git a/Master/texmf-dist/source/eplain/base/test/label.tex b/Master/texmf-dist/source/eplain/base/test/label.tex
new file mode 100644
index 00000000000..348a7541711
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/label.tex
@@ -0,0 +1,8 @@
+% This file is public domain.
+%
+\ifx\undefined \eplain \input eplain \fi
+
+\xrdef{a1@$^ ~&_}
+\xref{a1@$^ ~&_}
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/latexcite.tex b/Master/texmf-dist/source/eplain/base/test/latexcite.tex
new file mode 100644
index 00000000000..5ad031aa1a6
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/latexcite.tex
@@ -0,0 +1,9 @@
+% This file is public domain.
+%
+\documentstyle{article}
+\begin{document}
+\cite{chicago,texbook,prime-number-theorem,1234567890)(@!`['";:]|<>./?-=+_$^&}
+\cite{others,accented}
+\bibliographystyle{plain}
+\bibliography{cite}
+\end{document}
diff --git a/Master/texmf-dist/source/eplain/base/test/liang.tex b/Master/texmf-dist/source/eplain/base/test/liang.tex
new file mode 100644
index 00000000000..975fa83d020
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/liang.tex
@@ -0,0 +1,300 @@
+% This file is public domain.
+%
+% Test double columns with headlines, single-column material, and a
+% \topinsert.
+\ifx\undefined\eplain \input eplain \fi
+%\catcode`@=11
+%\input gcol
+%\catcode`@=12
+\magnification=\magstep1
+\parskip=10pt
+\gutter = 1pc
+\hyphenation{pour-ed}
+
+\headline = {This is the headline \hfil}
+
+{\center
+ A test file for eplain
+ Karl\footnote\dag{Credit in a footnote.}
+}
+
+\topinsert
+This should appear at the top of the page, since it's a topinsert.
+\endinsert
+
+Here the main document starts. It should be in double columns until
+further notice. It's all one paragraph. I am going to use Wuthering
+Heights, as usual.
+
+With that concluding word, the whole assembly,
+exalting their pilgrim's staves, rushed round me in a body; and I,
+having no weapon to raise in self-defence, commenced grappling with
+Joseph, my nearest and most ferocious assailant, for his. In the
+confluence of the multitude several clubs crossed; blows aimed at me
+fell on other sconces. Presently the whole chapel resounded with
+rappings and counter-rappings.
+
+Every man's hand was against his
+neighbour; and Branderham, unwilling to remain idle, pour\-ed forth his
+zeal in a shower of loud taps on the boards of the pulpit, which
+responded so smartly that at last, to my unspeakable relief, they woke
+me. And what was it that had suggested the tremendous tumult? What had
+played Jabes's part in the row? Merely the branch of a fir-tree that
+touched my lattice, as the blast wailed by, and rattled its dry cones
+against the panes!
+
+
+\doublecolumns
+Here the main document starts. It should be in double columns until
+further notice. It's all one paragraph. I am going to use Wuthering
+Heights, as usual.
+
+With that concluding word, the whole assembly,
+exalting their pilgrim's staves, rushed round me in a body; and I,
+having no weapon to raise in self-defence, commenced grappling with
+Joseph, my nearest and most ferocious assailant, for his. In the
+confluence of the multitude several clubs crossed; blows aimed at me
+fell on other sconces.
+
+Presently the whole chapel resounded with
+rappings and counter-rappings. Every man's hand was against his
+neighbour; and Branderham, unwilling to remain idle, pour\-ed forth his
+zeal in a shower of loud taps on the boards of the pulpit, which
+responded so smartly that at last, to my unspeakable relief, they woke
+me. And what was it that had suggested the tremendous tumult?
+
+What had played Jabes's part in the row? Merely the branch of a fir-tree that
+touched my lattice, as the blast wailed by, and rattled its dry cones
+against the panes! Here the main document starts. It should be in double columns
+ until
+further notice. It's all one paragraph. I am going to use Wuthering
+Heights, as usual. With that concluding word, the whole assembly,
+exalting their pilgrim's staves, rushed round me in a body; and I,
+having no weapon to raise in self-defence, commenced grappling with
+Joseph, my nearest and most ferocious assailant, for his. In the
+confluence of the multitude several clubs crossed; blows aimed at me
+fell on other sconces. Presently the whole chapel resounded with
+rappings and counter-rappings. Every man's hand was against his
+neighbour; and Branderham, unwilling to remain idle, pour\-ed forth his
+zeal in a shower of loud taps on the boards of the pulpit, which
+responded so smartly that at last, to my unspeakable relief, they woke
+me. And what was it that had suggested the tremendous tumult?
+What had played Jabes's part in the row? Merely the branch of a fir-tree that
+touched my lattice, as the blast wailed by, and rattled its dry cones
+against the panes!
+
+\singlecolumn % an extra insert of singlecolumn
+I listened doubtingly an instant, detected the
+disturber, then turned and dozed, and dreamt again---if possible, still
+more disagreeably than before. This time I remembered I was lying in
+the oak closet, and I heard distinctly the gusty wind and the driving of
+the snow. I heard also the fir-bough repeat its teasing sound, and
+ascribed it to the right cause. But it annoyed me so much that I
+resolved to silence it, if possible; and I thought I rose and
+endeavoured to unhasp the casement. The hook was soldered into the
+staple---a circumstance observed by me when awake, but forgotten. ``I
+must stop it, nevertheless!'' I muttered, knocking my knuckles through
+the glass, and stretching an arm out to seize the importunate branch;
+instead of which, my fingers closed on the fingers of a little, icecold
+hand!
+
+\doublecolumns % an extra insert of doublecolumns
+The intense horror of nightmare came over me. I tried to draw
+back my arm, but the hand clung to it, and a most melancholy voice
+sobbed, ``Let me in---let me in!'' ``Who are you?'' I asked, struggling,
+meanwhile, to disengage myself. ``Catherine Linton,'' it replied
+shiveringly. (Why did I think of Linton? I had read Earnshaw twenty
+times for Linton.) ``I'm come home. I'd lost my way on the moor.'' As
+it spoke, I discerned, obscurely, a child's face looking through the
+window. Terror made me cruel; and finding it useless to attempt shaking
+the creature off, I pulled its wrist on to the broken pane, and rubbed
+it to and fro till the blood ran down and soaked the bedclothes. Still
+it wailed, ``Let me in!'' and maintained its tenacious gripe, almost
+maddening me with fear. ``How can I?'' I said at length. ``Let me go,
+if you want me to let you in!''
+
+With that concluding word, the whole assembly,
+exalting their pilgrim's staves, rushed round me in a body; and I,
+having no weapon to raise in self-defence, commenced grappling with
+Joseph, my nearest and most ferocious assailant, for his. In the
+confluence of the multitude several clubs crossed; blows aimed at me
+fell on other sconces. Presently the whole chapel resounded with
+rappings and counter-rappings. Every man's hand was against his
+neighbour; and Branderham, unwilling to remain idle, pour\-ed forth his
+zeal in a shower of loud taps on the boards of the pulpit, which
+responded so smartly that at last, to my unspeakable relief, they woke
+me. And what was it that had suggested the tremendous tumult? What had
+played Jabes's part in the row? Merely the branch of a fir-tree that
+touched my lattice, as the blast wailed by, and rattled its dry cones
+against the panes! I listened doubtingly an instant, detected the
+disturber, then turned and dozed, and dreamt again---if possible, still
+more disagreeably than before. This time I remembered I was lying in
+the oak closet, and I heard distinctly the gusty wind and the driving of
+the snow. I heard also the fir-bough repeat its teasing sound, and
+ascribed it to the right cause. But it annoyed me so much that I
+resolved to silence it, if possible; and I thought I rose and
+endeavoured to unhasp the casement. The hook was soldered into the
+staple---a circumstance observed by me when awake, but forgotten. ``I
+must stop it, nevertheless!'' I muttered, knocking my knuckles through
+the glass, and stretching an arm out to seize the importunate branch;
+instead of which, my fingers closed on the fingers of a little, icecold
+hand!
+
+The intense horror of nightmare came over me. I tried to draw
+back my arm, but the hand clung to it, and a most melancholy voice
+sobbed, ``Let me in---let me in!'' ``Who are you?'' I asked, struggling,
+meanwhile, to disengage myself. ``Catherine Linton,'' it replied
+shiveringly. (Why did I think of Linton? I had read Earnshaw twenty
+times for Linton.) ``I'm come home. I'd lost my way on the moor.'' As
+it spoke, I discerned, obscurely, a child's face looking through the
+window. Terror made me cruel; and finding it useless to attempt shaking
+the creature off, I pulled its wrist on to the broken pane, and rubbed
+it to and fro till the blood ran down and soaked the bedclothes. Still
+it wailed, ``Let me in!'' and maintained its tenacious gripe, almost
+maddening me with fear. ``How can I?'' I said at length. ``Let me go,
+if you want me to let you in!''
+
+With that concluding word, the whole assembly,
+exalting their pilgrim's staves, rushed round me in a body; and I,
+having no weapon to raise in self-defence, commenced grappling with
+Joseph, my nearest and most ferocious assailant, for his. In the
+confluence of the multitude several clubs crossed; blows aimed at me
+fell on other sconces. Presently the whole chapel resounded with
+rappings and counter-rappings. Every man's hand was against his
+neighbour; and Branderham, unwilling to remain idle, repoured forth his
+zeal in a shower of loud taps on the boards of the pulpit, which
+responded so smartly that at last, to my unspeakable relief, they woke
+me. And what was it that had suggested the tremendous tumult? What had
+played Jabes's part in the row? Merely the branch of a fir-tree that
+touched my lattice, as the blast wailed by, and rattled its dry cones
+against the panes! I listened doubtingly an instant, detected the
+disturber, then turned and dozed, and dreamt again---if possible, still
+more disagreeably than before. This time I remembered I was lying in
+the oak closet, and I heard distinctly the gusty wind and the driving of
+the snow. I heard also the fir-bough repeat its teasing sound, and
+ascribed it to the right cause. But it annoyed me so much that I
+resolved to silence it, if possible; and I thought I rose and
+endeavoured to unhasp the casement. The hook was soldered into the
+staple---a circumstance observed by me when awake, but forgotten. ``I
+must stop it, nevertheless!'' I muttered, knocking my knuckles through
+the glass, and stretching an arm out to seize the importunate branch;
+instead of which, my fingers closed on the fingers of a little, icecold
+hand!
+
+The intense horror of nightmare came over me. I tried to draw
+back my arm, but the hand clung to it, and a most melancholy voice
+sobbed, ``Let me in---let me in!'' ``Who are you?'' I asked, struggling,
+meanwhile, to disengage myself. ``Catherine Linton,'' it replied
+shiveringly. (Why did I think of Linton? I had read Earnshaw twenty
+times for Linton.) ``I'm come home. I'd lost my way on the moor.'' As
+it spoke, I discerned, obscurely, a child's face looking through the
+window. Terror made me cruel; and finding it useless to attempt shaking
+the creature off, I pulled its wrist on to the broken pane, and rubbed
+it to and fro till the blood ran down and soaked the bedclothes. Still
+it wailed, ``Let me in!'' and maintained its tenacious gripe, almost
+maddening me with fear. ``How can I?'' I said at length. ``Let me go,
+if you want me to let you in!''
+
+With that concluding word, the whole assembly,
+exalting their pilgrim's staves, rushed round me in a body; and I,
+having no weapon to raise in self-defence, commenced grappling with
+Joseph, my nearest and most ferocious assailant, for his. In the
+confluence of the multitude several clubs crossed; blows aimed at me
+fell on other sconces. Presently the whole chapel resounded with
+rappings and counter-rappings. Every man's hand was against his
+neighbour; and Branderham, unwilling to remain idle, repoured forth his
+zeal in a shower of loud taps on the boards of the pulpit, which
+responded so smartly that at last, to my unspeakable relief, they woke
+me. And what was it that had suggested the tremendous tumult? What had
+played Jabes's part in the row? Merely the branch of a fir-tree that
+touched my lattice, as the blast wailed by, and rattled its dry cones
+against the panes! I listened doubtingly an instant, detected the
+disturber, then turned and dozed, and dreamt again---if possible, still
+more disagreeably than before. This time I remembered I was lying in
+the oak closet, and I heard distinctly the gusty wind and the driving of
+the snow. I heard also the fir-bough repeat its teasing sound, and
+ascribed it to the right cause. But it annoyed me so much that I
+resolved to silence it, if possible; and I thought I rose and
+endeavoured to unhasp the casement. The hook was soldered into the
+staple---a circumstance observed by me when awake, but forgotten. ``I
+must stop it, nevertheless!'' I muttered, knocking my knuckles through
+the glass, and stretching an arm out to seize the importunate branch;
+instead of which, my fingers closed on the fingers of a little, icecold
+hand!
+
+The intense horror of nightmare came over me. I tried to draw
+back my arm, but the hand clung to it, and a most melancholy voice
+sobbed, ``Let me in---let me in!'' ``Who are you?'' I asked, struggling,
+meanwhile, to disengage myself. ``Catherine Linton,'' it replied
+shiveringly. (Why did I think of Linton? I had read Earnshaw twenty
+times for Linton.) ``I'm come home. I'd lost my way on the moor.'' As
+it spoke, I discerned, obscurely, a child's face looking through the
+window. Terror made me cruel; and finding it useless to attempt shaking
+the creature off, I pulled its wrist on to the broken pane, and rubbed
+it to and fro till the blood ran down and soaked the bedclothes. Still
+it wailed, ``Let me in!'' and maintained its tenacious gripe, almost
+maddening me with fear. ``How can I?'' I said at length. ``Let me go,
+if you want me to let you in!''
+
+\singlecolumn
+Now we should be typesetting in a single column, i.e., normally. The
+fingers relaxed; I snatched mine through the hole, hurriedly piled the
+books up in a pyramid against it, and stopped my ears to exclude the
+lamentable prayer. I seemed to keep them closed above a quarter of an
+hour; yet the instant I listened again, there was the doleful cry
+moaning on! ``Begone!'' I shouted; ``I'll never let you in---not if you
+beg for twenty years.'' ``It is twenty years,'' mourned the
+voice---``twenty years. I've been a waif for twenty years!'' Thereat
+began a feeble scratching outside, and the pile of books moved as if
+thrust forward. I tried to jump up, but could not stir a limb, and so
+yelled aloud in a frenzy of fright. To my confusion, I discovered the
+yell was not ideal. Hasty footsteps approached my chamber door; somebody
+pushed it open with a vigorous hand, and a light glimmered through the
+squares at the top of the bed. I sat shuddering yet, and wiping the
+perspiration from my forehead. The intruder appeared to hesitate, and
+muttered to himself. At last he said in a half-whisper, plainly not
+expecting an answer, ``Is any one here?'' I considered it best to
+confess my presence, for I knew Heathcliff's accents, and feared he
+might search further if I kept quiet. With this intention I turned and
+opened the panels. I shall not soon forget the effect my action
+produced. Heathcliff stood near the entrance, in his shirt and
+trousers, with a candle dripping over his fingers, and his face as white
+as the wall behind him. The first creak of the oak startled him like an
+electric shock. The light leaped from his hold to a distance of some
+feet, and his agitation was so extreme that he could hardly pick it up.
+``It is only your guest, sir,'' I called out, desirous to spare him the
+humiliation of exposing his cowardice further. ``I had the misfortune
+to scream in my sleep, owing to a frightful nightmare. I'm sorry I
+disturbed you.''
+\end
+From: Jun-Jih Liang <cip224@wpax01.physik.uni-wuerzburg.de>
+Subject: A vbox underfull while using eplain.tex
+To: karl@cs.umb.edu
+Date: Wed, 10 Nov 93 11:47:39 MEZ
+
+Dear Karl:
+
+ I'd like to appreciate your kindness to put the "eplain.tex" in the public
+domain so that I can switch \doublecolumns and \singlecolumn in an article.
+After a little change in the file "column.tex" which is located at the
+subdirectory "/eplain-2.3/test" I have got an unexpected output. There is a
+"verticle underfull (Underfull \vbox ...)" at the first page. What I've done at
+the file are:
+
+1) magnify the text font at 1 step (\magnification=\magstep1)
+2) add an extra "\singlecolumn" and "\doublecolumns" after the first
+ "doublecolumn".
+
+ Would you please tell me how can I get rid of the verticle underfull and
+get the normal single- and doublecolumns output at the same page? Thank you for
+your helpness in advance!
+
+ Sincerely,
+ Jun-Jih Liang
+
+P.S. In the following two mails I attach the file "column.tex" which has
+changed by me in the first and a Postcript formated "column.ps" which is
+transformed from "column.dvi" in the second.
+
+
+
diff --git a/Master/texmf-dist/source/eplain/base/test/list.tex b/Master/texmf-dist/source/eplain/base/test/list.tex
new file mode 100644
index 00000000000..68775b3d822
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/list.tex
@@ -0,0 +1,90 @@
+% This file is public domain.
+%
+% Test file for lists.
+%
+\ifx\undefined\eplain \input eplain \fi
+
+{\parindent = 0pt
+ \parskip = .5\baselineskip
+\unorderedlist
+ \li hello there
+
+ This item has two paragraphs since we want to see if it
+ works anywhere, and of course we want the paragraphs to be long.
+
+ \li We did this list with zero parindent and nonzero parskip.
+\endunorderedlist
+}
+
+\unorderedlist
+ \li hello there
+
+ This item has two paragraphs since we want to see if it
+ works anywhere, and of course we want the paragraphs to be long.
+
+ \li second item
+ \numberedlist
+ \li nested
+ \li and again.
+
+ This item has two paragraphs, also, since we want to see if it
+ works anywhere, and of course we want the paragraphs to be long.
+
+ \li and again
+ \numberedlist
+ \li I am going three-level with you.
+ \endnumberedlist
+ \unorderedlist
+ \li I'm not.
+
+ This item has two paragraphs, also, since we want to see if
+ it works anywhere, and of course we want the paragraphs to
+ be long.
+
+ In fact, maybe we better make it three paragraphs. What
+ will happen then? This should tell us.
+
+ \endunorderedlist
+ \endnumberedlist
+\endunorderedlist
+
+This is a paragraph between the lists. It should be indented. But we'll
+make it go on for more than one line, so we'll be able to see where the
+left margin is.
+
+\numberedlist
+ \li hello there
+
+ This item has two paragraphs. Isn't that annoying?
+ In fact, the second paragraph has more than one line, at least
+ I'm going to make it long enough so that that is true---I hope.
+
+ \li second item
+ \numberedlist
+ \li nested
+ \li and again
+ \li and again
+ \numberedlist
+ \li I am going three-level with you.
+ \endnumberedlist
+ \unorderedlist
+ \li I'm not.
+ \endunorderedlist
+ \endnumberedlist
+\endnumberedlist
+
+\listleftindent = 4pc
+\unorderedlist
+\li A shorter list, but with a bigger indent.
+\numberedlist \li A nested list.
+\endnumberedlist
+\li The second item.
+\endunorderedlist
+
+A list with an xref label:
+\numberedlist
+\li[listitem] This is the first.
+\endnumberedlist
+
+And now we can refer to that item: \xrefn{listitem}.
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/listing.tex b/Master/texmf-dist/source/eplain/base/test/listing.tex
new file mode 100644
index 00000000000..60ae74c9ef3
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/listing.tex
@@ -0,0 +1,10 @@
+% This file is public domain.
+%
+\input eplain
+
+\listing{verbatim.tex}
+
+\let\setuplistinghook = \linenumberedlisting
+\listing{verbatim.tex}
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/logo.tex b/Master/texmf-dist/source/eplain/base/test/logo.tex
new file mode 100644
index 00000000000..5b137a56c46
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/logo.tex
@@ -0,0 +1,20 @@
+% This file is public domain.
+%
+\input eplain
+
+\xspaceskip = 2em
+Sentence-ending \TeX. And sentence \TeX\ middle. Sentence.
+
+\LaTeX
+
+\AMSTeX
+
+\LAMSTeX
+
+\BibTeX
+
+\MF
+
+\SLITEX
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/loop.tex b/Master/texmf-dist/source/eplain/base/test/loop.tex
new file mode 100644
index 00000000000..7f6b7bd4e89
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/loop.tex
@@ -0,0 +1,20 @@
+% This file is public domain.
+%
+\input eplain
+
+\def\iterate{%
+ \let\next\relax
+ \body
+ \let\next\iterate
+ \fi
+ \next
+}
+
+\count255 = 5
+\loop
+ loop iteration \number\count255 %\par
+ \ifnum\count255<3 \else
+ \advance\count255 by -1
+\repeat
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/loopnext.tex b/Master/texmf-dist/source/eplain/base/test/loopnext.tex
new file mode 100644
index 00000000000..8d77b8622bf
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/loopnext.tex
@@ -0,0 +1,21 @@
+% This file is public domain.
+%
+% Date: Tue, 2 May 2000 17:27:38 -0400
+% From: "Peter Kabal" <kabal@ece.mcgill.ca>
+% To: <karl@cs.umb.edu>
+% Subject: eplain interaction with TeXdraw
+%
+% A TeXdraw user alerted me to the fact that the TeXdraw routines gave a
+% warning message when used together with eplain. It seems that eplain
+% defines \iterate
+% differently than plain tex. Using plain TeX, there is no problem, but using
+% eplain one there is.
+
+\input eplain
+
+\input texdraw
+\btexdraw
+ \lpatt(0.1 0.1)
+\etexdraw
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/mag.tex b/Master/texmf-dist/source/eplain/base/test/mag.tex
new file mode 100644
index 00000000000..8704c008996
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/mag.tex
@@ -0,0 +1,14 @@
+% This file is public domain.
+%
+% \magnification=1200
+\input eplain.tex
+\paperheight=11truein
+\paperwidth=8.5truein
+\leftmargin=2.5truecm
+\rightmargin=2.5truecm
+\topmargin=2.5truecm
+\bottommargin=2.5truecm
+
+This is a test
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/makecol.tex b/Master/texmf-dist/source/eplain/base/test/makecol.tex
new file mode 100644
index 00000000000..4c0379a703d
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/makecol.tex
@@ -0,0 +1,17 @@
+% This file is public domain.
+%
+\input eplain
+
+Should have two columns with 1--3 in the first, and 4--6 in the second.
+
+\loggingall
+
+\makecolumns 6/2:
+one
+two
+three
+four
+five
+six
+I should be after the table.
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/margin.tex b/Master/texmf-dist/source/eplain/base/test/margin.tex
new file mode 100644
index 00000000000..8275e543326
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/margin.tex
@@ -0,0 +1,68 @@
+% This file is public domain.
+%
+\input marg
+
+\headline = {headline with descender: p\hfil}
+\parindent = 0pt
+
+% Assigning to \topskip increases the space at the top of the page,
+% between the headline and the text.
+%
+%\topskip = .5in
+
+
+\topmargin = 3in \leftmargin = 3in
+\bottommargin = 3in \rightmargin = 3in
+
+This is the first line of text. The top of it should be 3in from the
+top of the paper.
+\vfill
+This is in the middle. The left margin should be three inches, and so
+should the right margin (on the whole page, not just here, of course).
+\vfill
+The last line's baseline should be 3in from the bottom.
+(This page tested assignments that increase the margins.)
+\eject
+
+
+\advancetopmargin by -1in \advanceleftmargin by -1in
+\advancebottommargin by -1in \advancerightmargin by -1in
+
+This is the first line of text. The top of it should be 2in from the
+top of the paper.
+\vfill
+This is in the middle. The left and right margins should be two inches
+each.
+\vfill
+The last line's baseline should be 2in from the bottom.
+(This page tested advances that decreased the margins.)
+\eject
+
+
+\topmargin = .5in \leftmargin = .5in
+\bottommargin = .5in \rightmargin = .5in
+
+This is the first line of text. The top of it should be .5in from the
+top of the paper.
+\vfill
+This is in the middle. The left and right margins should be .5in each,
+just as you might expect by now, if you've been reading.
+\vfill
+The last line's baseline should be .5in from the bottom.
+(This page tested assignments that decreased the margins.)
+\eject
+
+
+\advancetopmargin by 1in \advanceleftmargin by 1in
+\advancebottommargin by 1in \advancerightmargin by 1in
+
+This is the first line of text. The top of it should be 1.5in from the
+top of the paper.
+\vskip0pt plus1filll
+I bet you can guess what the left and right margins should be: yup,
+1.5in. Let's make this line a little longer, so it will actually hit
+the margin.
+\vskip0pt plus1filll
+The last line's baseline should be 1.5in from the bottom.
+(This page tested assignments that increased the margins.)
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/matrix.tex b/Master/texmf-dist/source/eplain/base/test/matrix.tex
new file mode 100644
index 00000000000..4c966c312b4
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/matrix.tex
@@ -0,0 +1,18 @@
+% This file is public domain.
+%
+\ifx\undefined\eplain \input eplain \fi
+
+This tests matrix inside eqalignno with leftdisplays.
+
+% $$\eqalignno{
+% \matrix{a \cr b\cr c} & = 1 & 1 \cr
+% }$$
+
+\loggingall
+
+\leftdisplays
+$$\eqalignno{
+ \matrix{a \cr b\cr c} & = 1 & 1 \cr
+}$$
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/mdisplay.tex b/Master/texmf-dist/source/eplain/base/test/mdisplay.tex
new file mode 100644
index 00000000000..96ed8543b9c
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/mdisplay.tex
@@ -0,0 +1,215 @@
+% This file is public domain.
+%
+% Test math displays.
+%
+\ifx\undefined\eplain \input eplain \fi
+
+%\loggingall
+
+A simple one, done with plain, for comparison (it should come out
+centered). Because of the way that \TeX's modes work, you should never
+leave a blank line (i.e., cause a par command) before a display. When
+\TeX\ sees a \$ in vertical mode, it switches to horizontal mode; but
+then when the display starts, it goes back to vertical mode, thus
+causing an extraneous blank line before the display. (Plain \TeX\ sets
+abovedisplayskip to about a baselineskip, so you are going to get one
+blank line from that (unless the line above the display is short, in
+which case aboveshortdisplayskip is used, which is 3pt or some such);
+but if a par intervenes between the end of the paragraph and the
+beginning of the display, you get a second one.)
+$$x = y + z$$
+
+After a centereddisplays:
+\centereddisplays
+$$d+e+f$$
+
+Now starting leftdisplays.
+\leftdisplays
+
+No equation number:
+$$A = B + C$$
+
+Do another leftdisplays.
+\leftdisplays
+$$a+n=m$$
+
+Equation number on right:
+$$D = E + F\eqno (r)$$
+
+Equation number on left:
+$$G = H + I\leqno (l)$$
+
+Using eqdef:
+$$J = K + L\eqdef{hello}$$
+
+Here is one done with displaylines:
+$$\displaylines{x=1\cr}$$
+
+Let's do those again, indented by one inch plus the paragraph indentation:
+{\leftdisplayindent = 1in
+ No equation number:
+ $$A = B + C$$
+
+ Equation number on right:
+ $$D = E + F\eqno (r)$$
+
+ Equation number on left:
+ $$G = H + I\leqno (l)$$
+
+ Using eqdef:
+ $$J = K + L\eqdef{hello}$$
+
+ Here is one done with displaylines:
+ $$\displaylines{x=1\cr}$$
+}
+
+\hrule
+\smallskip
+The rule above just makes it easier to see the margins.
+
+Another displaylines, this one should end up on the right.
+$$\displaylines{\hfill y=2\cr}$$
+
+A displaylines with an eqno:
+$$\displaylines{x=1 \eqno{d}\cr}$$
+
+A displaylines with an eqdef:
+$$\displaylines{x=1 \eqdef{eqdef-displ}\cr}$$
+
+{\leftskip = 14pt
+An indented displaylines with an eqdef:
+$$\displaylines{x=1 \eqdef{eqdef-displ}\cr}$$
+
+}
+
+Here is one with done with eqalign (the ='s should line up):
+$$\eqalign{
+ a+b&=c\cr
+ dq+er&=f\cr
+}$$
+
+An eqalign with a noalign inside:
+$$\eqalign{
+ a+b&=c\cr
+ g+h&=i\cr
+}$$
+
+And one with eqalignno:
+$$\eqalignno{
+ a+b&=c&(1)\cr
+ d+e&=f&(1*)\cr
+ g+h&=i&\eqdef{eqdef-2}\cr
+}$$
+
+An eqalignno with a noalign inside:
+$$\eqalignno{
+ a+b&=c&(1)\cr
+\noalign{and}
+ g+h&=i&\eqdef{eqdef-2}\cr
+}$$
+
+And one (indented more) with leqalignno:
+{\leftdisplayindent = 1in
+$$\leqalignno{
+ a+b&=c&(1)\cr
+ dt+eg&=f&(1*)\cr
+ g+h&=i&\eqdef{eqdef-3}\cr
+}$$
+}
+
+A cases, from p.175 of the TeXbook.
+$$
+ |x| = \cases{x, &if $x\ge0$;\cr
+ -x, &otherwise.\cr
+}$$
+
+A pmatrix, from p.176.
+$$\pmatrix{
+ x-\lambda&1&0\cr
+ 0&x-\lambda&1\cr
+ 0&0&x-\lambda\cr
+}$$
+
+
+The rule below just makes it easier to see the margins.
+\smallskip
+\hrule
+\bigskip
+
+Back to centered displays now.
+\centereddisplays
+
+No equation number:
+$$A = B + C$$
+
+Equation number on right:
+$$D = E + F\eqno (r)$$
+
+Equation number on left:
+$$G = H + I\leqno (l)$$
+
+Using eqdef:
+$$J = K + L\eqdef{hello}$$
+
+Here is one done with displaylines:
+$$\displaylines{x=1\cr}$$
+
+\hrule
+\smallskip
+The rule above just makes it easier to see the margins.
+
+Another displaylines, this one should end up on the right.
+$$\displaylines{\hfill y=2\cr}$$
+
+Here is one with done with eqalign (the ='s should line up):
+$$\eqalign{
+ a+b&=c\cr
+ dq+er&=f\cr
+}$$
+
+And one with eqalignno:
+$$\eqalignno{
+ a+b&=c&(1)\cr
+ d+e&=f&(1*)\cr
+ g+h&=i&\eqdef{eqdef-2}\cr
+}$$
+
+An eqalignno with a noalign inside:
+$$\eqalignno{
+ a+b&=c&(1)\cr
+\noalign{and}
+ g+h&=i&\eqdef{eqdef-2}\cr
+}$$
+
+And one (indented more) with leqalignno:
+{\leftdisplayindent = 1in
+$$\leqalignno{
+ a+b&=c&(1)\cr
+ dt+eg&=f&(1*)\cr
+ g+h&=i&\eqdef{eqdef-3}\cr
+}$$
+}
+
+The rule below just makes it easier to see the margins.
+\smallskip
+\hrule
+\bigskip
+
+
+A cases, from p.175 of the TeXbook.
+$$
+ |x| = \cases{x, &if $x\ge0$;\cr
+ -x, &otherwise.\cr
+}$$
+
+A pmatrix, from p.176.
+$$\pmatrix{
+ x-\lambda&1&0\cr
+ 0&x-\lambda&1\cr
+ 0&0&x-\lambda\cr
+}$$
+
+Now after a second centereddisplays:
+\centereddisplays
+$$a + b = c$$
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/names.tex b/Master/texmf-dist/source/eplain/base/test/names.tex
new file mode 100644
index 00000000000..b996738a63a
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/names.tex
@@ -0,0 +1,21 @@
+% This file is public domain.
+%
+\input texnames.sty
+
+\parskip = \baselineskip
+\nopagenumbers
+
+\def\test{%
+ \AMSTeX\par
+ \BibTeX\par
+ \LAMSTeX\par
+ \LaTeX\par
+ \MF\par
+ \SLiTeX\par
+}
+
+\rm \test
+\it \test
+\bf \test
+\sl \test
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/noarrow.tex b/Master/texmf-dist/source/eplain/base/test/noarrow.tex
new file mode 100644
index 00000000000..f0379f7f813
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/noarrow.tex
@@ -0,0 +1,8 @@
+% This file is public domain.
+%
+\let\noarrow = t
+\input eplain
+
+\show\commdiag
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/nobib.tex b/Master/texmf-dist/source/eplain/base/test/nobib.tex
new file mode 100644
index 00000000000..e2586ecd8c2
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/nobib.tex
@@ -0,0 +1,10 @@
+% This file is public domain.
+%
+\let\nobibtex = t
+\ifx\eplain\undefined\input eplain \fi
+
+\tokstostring{abc}
+\xrdef{label}
+\xref{label}
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/nonouter.tex b/Master/texmf-dist/source/eplain/base/test/nonouter.tex
new file mode 100644
index 00000000000..32aa5c9fee1
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/nonouter.tex
@@ -0,0 +1,11 @@
+% This file is public domain.
+%
+\outer\def\nonouterdef#1#2{\begingroup
+ \def\startdef{\def #1\bgroup}%
+% \expandafter\defstart \csname #2\endcsname\egroup
+ \def\outername{\csname #2\endcsname}%
+ \expandafter\startdef \outername \egroup
+\endgroup}
+
+\tracingall
+\nonouterdef\innernewwrite{newwrite}
diff --git a/Master/texmf-dist/source/eplain/base/test/optional.tex b/Master/texmf-dist/source/eplain/base/test/optional.tex
new file mode 100644
index 00000000000..f7cc917000e
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/optional.tex
@@ -0,0 +1,30 @@
+% This file is public domain.
+%
+% Test optional arguments.
+
+\ifx\undefined\eplain \input eplain \fi
+
+\catcode`@ = \letter
+\def\foo{\@getoptionalarg\finfoo}
+\def\finfoo#1{%
+ \edef\firstarg{\@optionalarg}
+ \edef\mandatoryarg{#1}%
+ \@getoptionalarg\finfinfoo
+}
+\def\finfinfoo{%
+ The first optional argument is `\firstarg', the mandatory argument
+ is `\mandatoryarg', and the second optional argument is `\@optionalarg'.
+ \par
+}
+
+\loggingall
+\foo[a {\cite[p.10]{xyz}} b]{mand2}
+
+\foo{mand}
+\foo[opt1]{mand}
+\foo{mand}[opt2]
+\foo[opt1]{mand}[opt2]
+\foo[opt1]{mand}
+ [opt2 on a separate line]
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/outer.tex b/Master/texmf-dist/source/eplain/base/test/outer.tex
new file mode 100644
index 00000000000..e424bebed12
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/outer.tex
@@ -0,0 +1,26 @@
+% This file is public domain.
+%
+% Test file to make sure all the inner allocation routines really are
+% inner.
+%
+\input eplain
+
+\def\foo{%
+ \innernewcount\a
+ \innernewdimen\b
+ \innernewskip\c
+ \innernewmuskip\d
+ \innernewbox\e
+ \innernewhelp\f{Help.}%
+ \innernewtoks\g
+ \innernewread\h
+ \innernewwrite\i
+ \innernewfam\j
+ \innernewlanguage\k
+ \innernewinsert\l
+ \innernewif\ifm
+}
+
+\foo
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/page.tex b/Master/texmf-dist/source/eplain/base/test/page.tex
new file mode 100644
index 00000000000..5112d5d9ed4
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/page.tex
@@ -0,0 +1,8 @@
+% This file is public domain.
+%
+\hrule
+top of page
+\vskip 0pt plus1filll
+bottom of page
+\hrule
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/path.tex b/Master/texmf-dist/source/eplain/base/test/path.tex
new file mode 100644
index 00000000000..8a891bd3623
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/path.tex
@@ -0,0 +1,25 @@
+% This file is public domain.
+%
+% Test the \path macro.
+
+\input eplain
+%\input path.sty
+
+This is a normal path: \path|karl@cs.umb.edu|. This is a somewhat
+longer path: \path|letters@kropotkin.gnu.ai.mit.edu|. This is a still
+longer path:
+\path|megan@agroecology.university-of-california-at-santa-cruz.edu|. I'm
+making this all one paragraph so the path macro will have a chance to
+show its stuff. This path has dollar signs and other strange characters
+(but no vertical bars) in it: \path|#$%^_<>|. Now I'm going to change
+the discretionaries to only be at !'s. \discretionaries|!| Now this path
+should break only at !'s: \path|-hello!..from!@@bang!land|. Now I'm
+going to change things so backslash is the delimiter.
+\specialpathdelimiterstrue
+\path\##hello!there!@.@again!...we!**still!_have!-bangs!\. That last
+was delimited by backslashes, now let's do one that isn't delimited by
+backslashes: \path@hi, there!this is fun!@. I'll go on for a little
+while not doing anything in particular, so \TeX\ will have a chance to
+break the paragraph nicely. That's all, folks!
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/pcol.tex b/Master/texmf-dist/source/eplain/base/test/pcol.tex
new file mode 100644
index 00000000000..52bfc2cc77d
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/pcol.tex
@@ -0,0 +1,183 @@
+% This file is public domain.
+%
+% These are the double-column macros from Paul Abrahams, Dec 1991
+% They add the following features:
+% \ifbalance (by default true, causes last page to be balanced)
+% \everycolumn (a token list, useful for marks)
+% \pageeject
+% \eject does a column eject
+
+\newtoks\mainoutput
+\newbox\partialpage
+\newdimen\fullvsize \newdimen \fullhsize
+\newbox\leftcolumn \newbox \rightcolumn
+\newbox\savefootins \newskip\footskip
+\newbox\savetopins \newskip\topinsskip
+\newif\ifbalance \balancetrue
+\newtoks\everycolumn
+
+
+\def\pageeject{\penalty -10005 }%
+
+\def\doublecolumns{%
+ \mainoutput = \output % Save the previous \output.
+ %
+ % This grabs any single-column material.
+ \output = {\global\setbox\partialpage = \vbox{\unvbox255}}%
+ \vskip\abovedoublecolumnskip
+ \par % \par updates \pagetotal
+ \pagegoal = \pagetotal
+ \break % Now expand the \output we assigned just above.
+ \output = {\doublecolumnoutput}%
+ %
+ % Set up \hsize and \vsize for double columns.
+ \fullvsize = \vsize
+ \fullhsize = \hsize
+ \advance\hsize by -\gutter
+ \divide \hsize by 2
+ \advance\vsize by -\ht\partialpage
+ %
+ % Take account of existing insertions.
+ \ifvoid\footins\else
+ \advance\vsize by -\ht\footins
+ \advance\vsize by -\skip\footins
+ \fi
+ \setbox\savefootins = \box\footins
+ \footskip = \skip\footins
+ %
+ \ifvoid\topins\else
+ \advance\vsize by -\ht\topins
+ \advance\vsize by -\skip\topins
+ \fi
+ \setbox\savetopins = \box\topins
+ \topinsskip = \skip\topins
+ %
+ % Start at the left, clear the existing columns.
+ \let\lr = L%
+ \setbox0 = \box\leftcolumn \setbox0 = \box\rightcolumn
+}%
+%
+% This routine actually does the outputting.
+\def\doublecolumnoutput{%
+ \ifbalance\else \ifnum \outputpenalty < -10000
+ \setbox255 = \vbox{\unvbox255 \vfil}%
+ \fi\fi
+ %
+ \the\everycolumn
+ \if \lr L%
+ \buildcolumn\leftcolumn
+ \global\let\lr = R%
+ \else
+ \buildcolumn\rightcolumn
+ \global\let\lr = L%
+ \fi
+ %
+ \ifnum \outputpenalty < -10000
+ \ifbalance
+ \ifdim \ht\leftcolumn > 8\baselineskip
+ \balancecolumns
+ \global \let \lr = L%
+ \fi\fi\fi
+ %
+ \if \lr L%
+ \setbox255 = \vbox{%
+ \unvbox\partialpage
+ \dimen0 = \ht\leftcolumn \dimen1 = \dp\leftcolumn
+ \joincolumns
+ \ifnum \outputpenalty = -10005 \vfil \fi
+ }%
+ % The restoration of the insertion boxes happens only once, since
+ % they are empty thereafter.
+ \setbox\footins = \box\savefootins
+ \setbox\topins = \box\savetopins
+ \vsize = \fullvsize % Because we've taken care of \partialoutput
+ \ifnum \outputpenalty = -10006
+ \unvbox255
+ \else
+ \the\mainoutput
+ \global\vsize = \fullvsize
+ \fi
+ \fi
+}%
+%
+%
+% \joincolumns joins \leftcolumn and \rightcolumn into a vbox that aligns
+% the tops of the two columns and has the depth of the deeper column.
+% It adds the resulting box to the main vertical list.
+%
+\def\joincolumns{%
+ \dimen0 = \dp\leftcolumn \dimen1 = \dp \rightcolumn
+ \setbox0 = \hbox to \fullhsize{%
+ \vtop to \ht\leftcolumn{\unvbox\leftcolumn}%
+ \hfil
+ \vtop to \ht\rightcolumn{\unvbox\rightcolumn}%
+ }%
+ \dimen2 = \boxmaxdepth % For restoring it later
+ \ifdim \dimen0 < \dimen1
+ \boxmaxdepth = \dimen1
+ \else
+ \boxmaxdepth = \dimen0
+ \fi
+ \setbox0 = \vbox{\box0}%
+ \boxmaxdepth = \dimen2
+ \box0 % Produce for the calling context
+}%
+
+\def\buildcolumn #1{%
+ \ifnum \outputpenalty < -9999
+ \global \setbox #1 = \vbox{\pagecontents}%
+ \else
+ \global \setbox #1 = \vbox to \vsize{\pagecontents}%
+ \fi
+}%
+%
+%
+% Go back to single-column typesetting. Unfortunately, we cannot start
+% a group in \doublecolumns and end it here, because some documents
+% might want double-column mode to continue to the end. So we have to
+% restore the things we've changed manually.
+%
+\def\singlecolumn{%
+ \penalty -10006
+ \output = \mainoutput
+ \hsize = \fullhsize
+ \vsize = \fullvsize
+ %
+ % Add \belowdoublecolumnskip if there's enough room, otherwise a \vfil
+ % to fill out the page.
+ \dimen0 = \pagetotal \advance \dimen0 by \belowdoublecolumnskip
+ \ifdim \dimen0 < \pagegoal
+ \vskip\belowdoublecolumnskip
+ \else
+ \vfil
+ \fi
+ \allowbreak
+}%
+%
+\def \balancecolumns{%
+ \setbox\leftcolumn = \vbox{\unvbox\leftcolumn \unskip}%
+ \setbox\rightcolumn = \vbox{\unvbox\rightcolumn \unskip}%
+ \setbox0 = \vbox{%
+ \dimen0 = \dp\leftcolumn
+ \unvbox \leftcolumn
+ \if \lr L
+ \kern -\dimen0
+ \vskip -\topskip
+ \vskip \baselineskip
+ \unvbox \rightcolumn
+ \fi
+ }%
+ \dimen0 = \ht0
+ \advance \dimen0 by \topskip \advance \dimen0 by -\baselineskip
+ \divide \dimen0 by 2 \splittopskip = \topskip
+ \count@ = \vbadness \vbadness = 10000
+ \loop
+ \setbox2 = \copy0
+ \setbox1 = \vsplit2 to \dimen0
+ \ifdim \ht2 > \dimen0
+ \advance \dimen0 by 1pt
+ \repeat
+ \vbadness = \count@
+ \setbox \leftcolumn = \vbox to \dimen0{\unvbox1}%
+ \setbox \rightcolumn = \vbox to \dimen0{\unvbox2}%
+}%
diff --git a/Master/texmf-dist/source/eplain/base/test/pdftex.tex b/Master/texmf-dist/source/eplain/base/test/pdftex.tex
new file mode 100644
index 00000000000..7aa765d2c89
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/pdftex.tex
@@ -0,0 +1,112 @@
+\input ../eplain
+%\enablehyperlinks[nolinks]
+%\enablehyperlinks[pdftex]
+\enablehyperlinks
+
+\beginpackages
+\usepackage[dvipsnames]{color}
+\endpackages
+
+% Execute #1 then print it verbatim and indented.
+\def\c{\cf\indent\relax}
+% Same as \c, but do not indent and at the end say \hlend.
+\def\f{\cf\noindent\hlend}
+%
+\def\cf#1#2#3{%
+ \def\temp{#3}%
+ \edef\cftemp{\sanitize\temp}%
+ #1#3\expandafter\verbatim\cftemp\endverbatim#2\par
+}
+%
+\newcount\destcount
+% Execute `#1{d\the\destcount}' then print it (`#1', `{d', and `}' are printed
+% verbatim; `\the\destcount' is expanded).
+\def\d{\dl\relax}
+% Same as \d, but at the end also say \hlend.
+\def\l{\dl\hlend}
+%
+\def\dl#1#2{%
+ \global\advance\destcount by1
+ \toks0={#2}%
+ \edef\temp{\the\toks0{d\the\destcount}}%
+ \edef\dltemp{\sanitize\temp}%
+ \noindent#2{d\the\destcount}\expandafter\verbatim\dltemp\endverbatim#1\par
+}
+
+\pdfpagewidth=8.5in
+\pdfpageheight=11in
+
+
+
+\leftline{\bf Destinations}
+\medskip
+
+{\tt\global\parindent=4em}
+
+\d{\hldest{}{}}
+\c{\hldestopts{zoom=2345}}
+\d{\hldest{}{}}
+\medskip
+\c{\hldesttype{fitr}}
+\c{\hldestopts{width=\hsize}}
+\d{\hldest{}{}}
+\c{\def\myopts{width=.5\hsize,depth=.25\hsize}}
+\d{\hldest{}{\myopts,height=.25\hsize}}
+\medskip
+\c{\let\myopts\empty}
+\c{\hldestopts{raise=2\normalbaselineskip}}
+\d{\hldest{xyz}{\myopts,zoom=2500}}
+\d{\hldest{xyz}{raise=\ht\strutbox,zoom=3000}}
+\medskip
+\makeatletter
+\c{\def\mydest{\pdfdest name{\@hllabel} xyz}}
+\d{\hldest{raw}{cmd=mydest}}
+\resetatcatcode
+\medskip
+\d{\hldest{fit}{}}
+\d{\hldest{fith}{}}
+\d{\hldest{fitv}{}}
+\d{\hldest{fitb}{}}
+\d{\hldest{fitbh}{}}
+\d{\hldest{fitbv}{}}
+\vfil\eject
+
+
+
+\leftline{\bf Links}
+\medskip
+
+{\tt\global\parindent=4.5em}
+
+\destcount=0 % Reset destination count.
+\l{\hlstart{name}{}}
+\c{\hlopts{bstyle=U}}
+\l{\hlstart{name}{}}
+\l{\hlstart{}{bstyle=D,bdash=2 4,bcolor=1 0 0,hlight=I}}
+\l{\hlstart{}{bstyle=B,bwidth=3}}
+\c{\hlopts{bcolor=0 0 1}}
+\l{\hlstart{}{bstyle=I,bwidth=4}}
+\l{\hlstart{}{bstyle=U,bwidth=1}}
+\c{\hlopts{bstyle=S}}
+\l{\hlstart{}{hlight=I,bcolor=1 .2 .2,bwidth=2}}
+\l{\hlstart{}{hlight=N,bstyle=D,bwidth=3}}
+\l{\hlstart{}{hlight=O}}
+\l{\hlstart{}{hlight=P,bcolor=.3 .6 .7}}
+\l{\hlstart{}{bstyle=D,bdash=2 4 6}}
+\l{\hlstart{}{bwidth=0}}
+\l{\hlstart{}{bstyle=D,bdash=2 4 6 8}}
+\f{\hlstart{page}{pagefit=/FitH 600}{1}}
+\f{\hlstart{filename}{file=hlink.pdf,newwin=1}{eq1}}
+\f{\hlstart{filepage}{file=hlink.pdf,pagefit=/FitR 50 100 300 500}{1}}
+\f{\hlstart{filepage}{file=hlink.pdf,pagefit=/FitB}{2}}
+\f{\hlstart{url}{}{http://tug.org/eplain/}}
+\c{\def\mycmd{\pdfstartlink goto page 1 {/Fit}}}
+\f{\hlstart{raw}{cmd=mycmd}{}}
+
+
+
+\bye
+
+% Local variables:
+% compile-command: "(cd .. && make eplain.tex) && pdftex --interact=nonstopmode pdftex.tex"
+% End:
diff --git a/Master/texmf-dist/source/eplain/base/test/psfont.map b/Master/texmf-dist/source/eplain/base/test/psfont.map
new file mode 100644
index 00000000000..6b25d458abb
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/psfont.map
@@ -0,0 +1,78 @@
+% This file is public domain.
+%
+% +--------------------------------------------------------------------+
+% | |
+% | Font mapping for Turing |
+% | ----------------------- |
+% | |
+% | Letter Font Letter Qualifier |
+% | ------ ------------ ------ ------------ |
+% | A Avant-Garde B Bold |
+% | B Bookman D Demi |
+% | C Courier I Italic |
+% | H Helvetica L Light |
+% | N New-Century M Medium |
+% | Schoolbook O Oblique |
+% | P Palatino R Roman |
+% | S Symbol S Small Caps |
+% | T Times |
+% | ZC Zapf Chancery |
+% | ZD Zapf Dingbats |
+% | |
+% +--------------------------------------------------------------------+
+
+ \def\SYSTEM{Turing}
+
+ \def\AB@#1pt{pagk at #1pt}
+ \def\ABO@#1pt{pagko at #1pt}
+ \def\AD@#1pt{pagd at #1pt}
+ \def\ADO@#1pt{pagdo at #1pt}
+
+ \def\BD@#1pt{pbkd at #1pt}
+ \def\BDI@#1pt{pbkdi at #1pt}
+ \def\BL@#1pt{pbkl at #1pt}
+ \def\BLI@#1pt{pbkli at #1pt}
+ \def\BO@#1pt{pbkro at #1pt}
+
+ \def\CB@#1pt{pcrb at #1pt}
+ \def\CBO@#1pt{pcrbo at #1pt}
+ \def\CM@#1pt{pccr at #1pt}
+ \def\CO@#1pt{pccro at #1pt}
+
+ \def\HB@#1pt{phvb at #1pt}
+ \def\HBO@#1pt{phvbo at #1pt}
+ \def\HM@#1pt{phvr at #1pt}
+ \def\HO@#1pt{phvro at #1pt}
+
+ \def\NB@#1pt{pncb at #1pt}
+ \def\NBI@#1pt{pncbi at #1pt}
+ \def\NI@#1pt{pncri at #1pt}
+ \def\NR@#1pt{pncr at #1pt}
+ \def\NO@#1pt{pncro at #1pt}
+
+ \def\PB@#1pt{pplb at #1pt}
+ \def\PBI@#1pt{pplbi at #1pt}
+ \def\PBO@#1pt{pplbo at #1pt}
+ \def\PI@#1pt{pplri at #1pt}
+ \def\PO@#1pt{pplro at #1pt}
+ \def\PR@#1pt{pplr at #1pt}
+
+ \def\TB@#1pt{ptmb at #1pt}
+ \def\TBI@#1pt{ptmbi at #1pt}
+ \def\TBO@#1pt{ptmbo at #1pt}
+ \def\TI@#1pt{ptmri at #1pt}
+ \def\TIU@#1pt{ptmru at #1pt}
+ \def\TO@#1pt{ptmro at #1pt}
+ \def\TR@#1pt{ptmr at #1pt}
+
+ \def\ZCMI@#1pt{pzcmi at #1pt}
+ \def\ZD@#1pt{pzdr at #1pt}
+
+ \def\S@#1pt{psyr at #1pt}
+ \def\SO@#1pt{psyro at #1pt}
+ \def\SX@#1pt{psyrx at #1pt}
+
+ \def\TRS@#1pt{ptmrc at #1pt}
+ \def\PRS@#1pt{pplrc at #1pt}
+ \def\NRS@#1pt{pncrc at #1pt}
+ \def\BS@#1pt{pblrc at #1pt}
diff --git a/Master/texmf-dist/source/eplain/base/test/rex.tex b/Master/texmf-dist/source/eplain/base/test/rex.tex
new file mode 100644
index 00000000000..7fc90ba9367
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/rex.tex
@@ -0,0 +1,277 @@
+% This file is public domain.
+%
+%Date: Fri, 08 May 92 12:28:17 PDT
+%From: Rex Shudde <0024P%NAVPGS.BITNET@CORNELLC.cit.cornell.edu>
+%Subject: Eplain document
+%To: karl berry <karl@cs.umb.edu>
+%
+%Karl,
+%
+%Attached is an emulation of my document. Re-iterating, (1) the title should be
+%on the first page with the abstract, and a horizontal rule should span the
+%entire first page, and (2) the second footnote is referenced in the second
+%column on third page.
+%
+%Undoubtedly I've violated some of the rules of either TeX or eplain, but I
+%don't know what.
+%
+%Again, many thanks.
+%
+%Rex
+%
+%Bitnet: 0024p@navpgs
+%Internet: 0024p@cc.nps.navy.mil
+%.............................................................................
+%\magnification=\magstep0
+\input eplain
+\input tables %This is Ferguson's INRSTeX Tables (a very old version).
+
+\hbadness = 100000 \vbadness = 10000 \hfuzz = \maxdimen
+\tolerance=2000
+
+\def\SP{\ }
+\def\throwaway#1{}
+\def\checkspace{\ifx \next\
+\let\result=\throwaway
+ \else \let\result=\ignorespaces \fi \result }
+\font\bigfont=cmr10 scaled \magstep5
+\def\bfl#1{\setbox0=\hbox {{\bigfont #1}\thinspace}
+ \noindent \hangindent \wd0 \hangafter -2
+ \llap {\vbox to \ht0{\kern\baselineskip \box0 \kern-\baselineskip}}%
+ \futurelet \next \checkspace}
+
+\parskip=10pt
+\parindent=0pt
+
+\font\cmbig=cmr17
+\font\cmrbv=cmb10 scaled \magstep5
+\font\iti=cmbxti10 scaled \magstep2
+\font\erm=cmr8
+
+\doublecolumns
+
+%**************************************************************************
+% Generate a dummy first page for the twocol macro
+% The first page is to have the left column blank.
+
+\phantom{dummy first line} \vskip5truein
+ {\font\iti=cmti10 scaled \magstep1
+ \iti
+ \rightline{An abstract}
+ \rightline{goes}
+ \rightline{in here.}
+ }
+
+\columnfill
+
+%**************************************************************************
+
+\phantom{dummy first line} \vskip0.75truein
+
+\rightline{\cmrbv Title}
+\bigskip\bigskip
+\rightline{\iti Author}
+
+\bigskip\bigskip\bigskip
+%\rightline{\hrulefill}% width6.5truein}
+
+\nointerlineskip
+\moveleft 3.31truein
+\vbox{\hrule width6.5truein}
+\nointerlineskip
+
+\vskip0.75truein
+
+%**************************************************************************
+
+\bfl
+Xxxxxxx xxxxxx xxxxxx xxxxxxx xxxx xxx xxx\numberedfootnote{\erm Xxxxx xxxxx
+xxx xxxx Xxxxx xxxxx, Xxxxx xxxx Xxxxxx xxxxxx, xxxxxx xxxxx xx Xxxxxx Xxxxxx,
+Xxx., X.~X. Xxx~xxx, Xxxx Xxxxx, XX~xxxxx.} Xxxx Xxxxxxxxxx xxxxxxxx xxxx, Xxx
+xxxxx xxxxxx xx xxxxxxxx xx xxxxx xxxxxxx xxxxxxx xxxx xx xxxx xx xxxxxxx xx
+xxx xxxxx xx x xxx xxxxxxx xx xxxxx. Xx x/xxx xx x xxx xxxx xxxxxxx xxxxx
+xxxxxxx, Xxxxxx xxxxxxxxx xxxxx xxxxx x/xxx,xxx,xxx xx x xxxxxx. Xxxx xxxxx
+ xxxx xx xxxx xxxx Xxxxxx'x xxxxxxxx xx xxx xxxxxxx xxxxxxxx xxxxxx xx xxxxx
+ xx xxxx xxxxxxx xxx xxxxxx xxxx xx xxxxxxx xx xxxxxx x.xx xx x xxx, xxx x.xx
+xxx xxxxxx xxxxx xx~xxxxxxx. Xxxx xx x xxxxx xxxxxx xxx xxxxxxxxx xxxxxxxx xxx
+xxxxxxxx xxxx xxxxxxxx xxxxxxxxx xxx xxxxxx xxxxxx xxxx, xxx xxx xxxxxxxx
+xxxxxxxxx xx xxx xxxx xx xxxxxxxxxx xx x xxxx xxxxx xxxxxxxxxx.
+
+Xxxxx xxx xxxxxx xxx xxxxxx xx xxx xxxxx xx xxx xxx xxxxxxxxx (xxx XX-xxx
+xxxxx xxxxxx xxxxxxxx xx xxx Xxx Xxxxxxxxxx Xxxxxxxxxx), xx xxx xxxxxxx xxxx
+xx xxxxx xx xxxxxxxxxxx xx xxxxxxx x xxxxx xxxxxxx xxx xxxx xx xxxxx xxxx
+xxxxxx xx xxxx x xxxxxxxxxxx xxxxxx xxxx xxx xxxxxxx.
+
+Xxxxx x xxxxx xx xxx xxxx xx xxxxxxxxxx xxx xxxxxxxx xx xxx xxxxxxxxxx xxx
+xxxxxx xxxxxxxx xxx xxxx xxxxxx xxx xxxxx xxxx. Xxxx xxx xxxx xxxx xxxx xx
+xxxxx xxx xxxxxx'x xxxx xxxx xxxxxxxx, xxxx {xxx xxxxxxx} xx xxx xxxxxxx
+xxxxxxxxx, xxxxxxxx, xx x, xxx xxxxxxxx. Xxxxx xxxx xxxxxxxxx xxx xxxx (xxxx
+xxx Xxxx) xxx xxxxx xx Xxxxx~x.
+
+Xx xxxxxxxxxxx xx Xxxxx~x xxxxxxx xxxx xxx xxxxxxxx xx xxxxxxx xx xxxx xxxxxxx
+xxxxxxxx xxx xxx xx xxxxxxxxxx xx xxxxx xx xxxxxxxx. Xx xxxx, xx xxxxxxx xx
+xxxxxx xxx xxxxx xx xx xxxxx xxx xxx xxxxxxxxx xxx xxxxxxxx xxxxx xx Xxxxxx'x
+xxxxx xx Xxxxxx' xxxxxx xxxxxxx. Xxxx xxx xxxxxxxx xxxxx xxx xx xx xxxx, xxx
+xxxxxxxxx. Xxxxx~x xxxxxxxx xxx xxxxxxxxx xx xxxxxxx xx xxx xxxxxx xxxxxx xx
+xxxx xxxxxx xxxxxxxx xx xxxxxxxxx xx xxxxxxxxx.
+
+
+\singlecolumn
+\centerline{Table 1---Xxxxxxxxx Xxxx Xxxxxxxx xx Xxxxxxxx}
+\smallbreak
+\line \bgroup \hss
+ \begintable
+ \begintableformat
+ & \center
+ \endtableformat
+ \-
+ \br{\::} : : \use{3} Xxxxxxxxxx Xxxxxxx:
+ : \use{3} Xxxxxx Xxxxxxn \er{:}
+ \br{\:} \zb{Xxxxxx} : \zb{Xxxx} : \use{3} \-
+ : \zb{Xxxx} : \use{3} \- \er{:}
+ \br{\::} : : -xxxxx " -xxxxx " -x :
+ : +xxxxx " +xxxxx " +x \er{:}
+ \-
+ \br{\::} xxxxxxx : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx
+ : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx \er{:}
+ \-
+ \br{\::} xxxxxxx : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx
+ : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx \er{:}
+ \-
+ \br{\::} xxxxxxx : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx
+ : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx \er{:}
+ \-
+ \br{\::} xxxxxxx : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx
+ : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx \er{:}
+ \-
+ \br{\::} xxxxxxx : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx
+ : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx \er{:}
+ \-
+ \br{\::} xxxxxxx : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx
+ : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx \er{:}
+ \-
+ \br{\::} xxxxxxx : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx
+ : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx \er{:}
+ \-
+ \br{\::} xxxxxxx : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx
+ : ~x-xx-xx : xxxxx " ~xxxxx " ~xxxxx \er{:}
+ \-
+ \endtable
+\hss \egroup
+\doublecolumns
+
+
+Xxxx xxxxxx x xxxxxx xxxxxxx Xxxxxx'x xxxxxx xxxxxx xx xxx xxxxxx xxxxx xxxxxx
+xxx xxxx xxxxx xx Xxxxx~x, xxxx xxxx xxxxxx xx xxxxx xxxxxxx. Xx, xxx xxxxxxx,
+xx xxxxxxxxxx xxx xxxxxxxx xxxx xxxxxx xxxxxx, xx xxxxx xxxxx xx xxxxxxxxxxx,
+xxxxxxxxxx, xxx xxxxxxxxx, xxxxxxx xx xxx xxxxxxxx xx xxxx xxxxxx xxxx xxxxx
+xxxxxxx, xx xxxxx xxxxx xx xxx xxxxxxxx, xxxxx xxxxx, xxx xxxxxxxxx. Xxxx xxx
+xxxx xx xxxxxxxxx.
+
+\medskip\bigskip
+\centerline{Table 2---Xxxxxxx xx Xxxxxx'x Xxxxxx Xxxxxxx}
+\nobreak
+\centerline{(Xxxxxxx Xxxxxxxx)}
+\smallbreak
+\line \bgroup \hss
+ \begintable
+ \begintableformat
+ & \center
+ \endtableformat
+ \-
+ \br{\::} Xxxx : xxxxxxxx " xxxxxxx " xxxxxx " xxx \er{:}
+ \-
+ \br{\::} xxxx : xxxxxxxx " xxxxxxx " xxxxxx " $x''$ \er{:}
+ \br{\::} xxxx : xxxxxxxx " xxxxxxx " xxxxxx " $x''$ \er{:}
+ \-
+ \br{\::} xxxx : xxxxxxxx " xxxxxxx " xxxxxx " $x''$ \er{:}
+ \br{\::} xxxx : xxxxxxxx " xxxxxxx " xxxxxx " $x''$ \er{:}
+ \-
+ \br{\::} xxxx : xxxxxxxx " xxxxxxx " xxxxxx " $x''$ \er{:}
+ \br{\::} xxxx : xxxxxxxx " xxxxxxx " xxxxxx " $x''$ \er{:}
+ \-
+ \br{\::} xxxx : xxxxxxxx " xxxxxxx " xxxxxx " $x''$ \er{:}
+ \br{\::} xxxx : xxxxxxxx " xxxxxxx " xxxxxx " $x''$ \er{:}
+ \-
+ \endtable
+\hss \egroup
+
+Xxxxxxxx xxx xxxx xxxx xxxxx xxxxx xx Xxxxx~x xxx xxx xxxx, xxxx xxx xxx xxxx
+xx xxx xxxxxxxx xxxxxxxx xxxxxxxxx xxxxx. Xx xxx x xxxxx xxxxxxx xx xxx xxxx
+xx xxxxxxx, xx xxx xxxxxxx xx xx x xxxxxx xxxxxx xx xxxxx xxxxxxx xx xxxxxx xx
+xxxx xxxxx xxxxxx x ``xxxxx xxxx'' xxxxxxxx. Xxxxx x xxxxx xx xxxx xxxxx xx
+xxx xxxx xx xxxxxxx xxx xxxxxxxx. Xxxx xxx xxxx xxxxxxxx xx xxxxx xxx xxxxxx'x
+xxxxxxxx xxxxxx xx xxxxx xxxxx, xxxxxxx xxx, xxx xxxxxx xxxx xxxx xxx xxxxx
+xxxxx xxxxxxxx xxx xxxxxxxx. Xxx xxxxxxx, xx xxx xxxxx xxxxx xxxxxx xxxx xxxx
+xxxxxx, xx xxx xxxx xxxxxx xxxxxxxx xxx xxx xxxxx. Xxx xxxxxxx xxx xxxxx xx
+Table~3.
+
+
+\font\eri=cmti8
+
+Xx xxxxxx xx xxxxxxxxxx xxxx xxxxx xxxxxx xxxx xxxxxxxx xxxx xxx xxx xxxxxxx
+xxxxx xx xxx xxxx xxxxx xxx xx xxx xx xxx xxx xxxxxxxxx xx xxxxxxx xxxx xx xxx
+xxx xxxxx xxxxx xxxxxx. Xxxxx~x xxxxxxx xxxx xxx xxxxx xxxxxxx, xx xx
+xxxxxxxxx xxxxxxxxx xx xxxxxxxx xx xxxx xxxx xxxxxxx xxxx xxx xxxx xxx xxxx
+xxxxxxxx xxxxxxxxxxx xxx xxx xxxxxx xx xx xxxxxxx. Xxxxxxxxx xxxxxxx xxxxx xxx
+xx xxxxxxxx xxxxxx xxxx xxx xxxx xxxxxxx xx x xxxxx xxxxxxxxx, xxx xxx
+xxxxxxxx xx xxx xxxxxxxxx? Xxx xxxx xxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xx
+XX-xxx, xxx xxxxxxxxx xx xxx {xxx Xxxxxx xxxxxx Xxxx
+xxx},\numberedfootnote{\erm Xxxx Xx xx xxx xxxx Xxxxxx Xxxxxxx xxxx xxxxx
+xxxx.} ``X xxxxxxx xxxxx xxxxxxxxx xxx Xxxxxx xxx xxx xxxx'x xxxxx xx xxxxxxxx
+xxxx xx xxxxxxxxx xxxxxx xxxxxx xxxx xxxxxx xxxx.'' Xxxx xxxxxx xxxxx xx x
+xxxxxxxx xxxx xxxxxxxx xxxxx xxxxxx xxx xxxxxxxx xxx xxx xxxxxxx xxx xx xxxx
+xxxxxxx xxx xxxxxx xxxxxx xxxxxxxx xxx xxxx xxxxxxxxxxx xxxx xxx xxx xxxxxxx
+xxx xxxxxx xxxxxx xx Xxxxxx xxxxx xx xxxx, xxx xxxxx xxx xxx xxxxxxxx xx x
+Xxxxxx xxxxxxx xxxx xxx xxxx? Xxx xxxxxx xxxxx xx xx xxxxxxxxx xxx xxxxxxx
+xxxx xxx xxxx xxxx xx Xxxxx~x xxx xxxxxx xxxx xxx xxxxxxx xxxx xxxxx xx
+xxxxxxx xx xxxxxx xxx xx xxxxx.
+
+\singlecolumn
+
+\medskip\bigbreak
+\midinsert
+\centerline{Table 3---Xxxxxxxxx Xxxx Xxxxxxxx xx Xxxxxxxx}
+\smallbreak
+\line \bgroup \hss
+ \begintable
+ \begintableformat
+ & \center
+ \endtableformat
+ \-
+ \br{\::} : : \use{3} Xxxxxxxxxx Xxxxxxx:
+ : \use{3} Xxxxxx Xxxxxxx \er{:}
+ \br{\:} \zb{Xxxxxx} : \zb{Xxxx} : \use{3} \-
+ : \zb{Xxxx} : \use{3} \- \er{:}
+ \br{\::} : : -xxxxxxx " -xxxxxxx " -xxxxxxx :
+ : +xxxxxxx " +xxxxxxx " +xxxxxxx \er{:}
+ \-
+ \br{\::} {xxx x} : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx
+ : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx \er{:}
+ \-
+ \br{\::} {xxx x} : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx
+ : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx \er{:}
+ \-
+ \br{\::} {xxx x} : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx
+ : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx \er{:}
+ \-
+ \br{\::} {xxx x} : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx
+ : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx \er{:}
+ \-
+ \br{\::} {xxx x} : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx
+ : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx \er{:}
+ \-
+ \br{\::} {xxx x} : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx
+ : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx \er{:}
+ \-
+ \br{\::} {xxx x} : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx
+ : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx \er{:}
+ \-
+ \br{\::} {xxx x} : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx
+ : ~x-xx-xx : xxxxxx " ~xxxxxx " ~xxxxxx \er{:}
+ \-
+ \endtable
+\hss \egroup
+\endinsert
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/rule.tex b/Master/texmf-dist/source/eplain/base/test/rule.tex
new file mode 100644
index 00000000000..7001ca9a368
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/rule.tex
@@ -0,0 +1,23 @@
+% This file is public domain.
+%
+\input eplain
+
+\hruledefaultheight = 4pt
+\hruledefaultdepth = 8pt
+
+\vruledefaultwidth = 36pt
+
+\vglue 1in
+
+\line{\leaders\ehrule\hfil gA}%
+
+\smallskip
+\ehrule
+\medskip
+
+\noindent \evrule \quad Greetings
+\smallskip
+\vbox to 3in{\leaders\evrule\vfil gB}
+
+\hbox to 40pt{\downbracefill} % uses \vrule
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/sidx.tex b/Master/texmf-dist/source/eplain/base/test/sidx.tex
new file mode 100644
index 00000000000..88041620f09
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/sidx.tex
@@ -0,0 +1,5 @@
+% This file is public domain.
+%
+\input eplain
+\sidx{help}
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/subdef.tex b/Master/texmf-dist/source/eplain/base/test/subdef.tex
new file mode 100644
index 00000000000..55d624b729a
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/subdef.tex
@@ -0,0 +1,24 @@
+% This file is public domain.
+%
+%Karl: on page 15 of the eplain manual (referring to subequation
+%formatting) you say
+% "Eplain's default definition just puts a period between them:"
+%However, when I run eplain (version 2.3 dated "Mon Mar 1 06:30:39 EST
+%1993") I get a colon ":" between the two. Below is a sample file.
+% Adam H. Lewenberg adam@math.uiuc.edu
+%%%%%%%%%%
+\input eplain %Version 2.3 "Mon Mar 1 06:30:39 EST 1993"
+
+$$5+5=10\eqdefn{ggg}$$
+$$4+5=10\eqsubdef{b-eq}$$
+
+\eqref{ggg} is correct and \eqrefn{b-eq} is incorrect.
+
+
+\end
+
+Date: Tue, 8 Jun 1993 09:46:11 -0500
+From: "Adam H. Lewenberg" <adam@symcom.math.uiuc.edu>
+To: karl@cs.umb.edu
+Subject: subeq referencing in eplain.tex (v. 2.3)
+Cc: adam@symcom.math.uiuc.edu
diff --git a/Master/texmf-dist/source/eplain/base/test/tenenb.tex b/Master/texmf-dist/source/eplain/base/test/tenenb.tex
new file mode 100644
index 00000000000..89cd534e55d
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/tenenb.tex
@@ -0,0 +1,48 @@
+% This file is public domain.
+%
+%Date: Sun, 7 Jan 2001 20:31:13 +0100
+%To: tex-eplain@tug.org
+%From: Gerald Tenenbaum <tenenb@arcturus.ciril.fr>
+%Subject: doublecolumns again
+%Cc:
+%Bcc:
+%X-Attachments:
+%
+%Hi,
+%
+%Here is a small file:
+%
+%*****************************
+\magnification1200
+\input eplain.tex
+\vsize30mm\hsize100mm
+
+This is an example of an apparent bug in {\tt $\backslash$doublecolumns}.
+This is an example of an apparent bug in {\tt
+$\backslash$doublecolumns}. This is
+an example of an apparent bug in {\tt $\backslash$doublecolumns}. This is an
+example of an apparent bug in {\tt $\backslash$doublecolumns}. This
+is an example
+of an apparent bug in {\tt $\backslash$doublecolumns}. This is an example of an
+apparent bug in {\tt $\backslash$doublecolumns}.
+\par
+\obeylines\doublecolumns
+item 1
+item 2
+item 3
+item 4
+item 5
+item 6
+ \singlecolumn
+\bye
+*************************************
+
+Has anyone an explanation for this bad behaviour and an idea for a fix?
+
+Best wishes,
+
+ Gérald
+
+
+
+
diff --git a/Master/texmf-dist/source/eplain/base/test/tenenb2.tex b/Master/texmf-dist/source/eplain/base/test/tenenb2.tex
new file mode 100644
index 00000000000..734299c3726
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/tenenb2.tex
@@ -0,0 +1,23 @@
+% This file is public domain.
+%
+% Gerald Tenenbaum, tenenb@arcturus.ciril.fr
+% 7 Jan 2001
+
+%\magnification 1200
+\input ../eplain
+\vsize 30mm
+\hsize 100mm
+
+This is an example of an apparent bug in double columns.
+This is an example of an apparent bug in double columns.
+This is an example of an apparent bug in double columns.
+This is an example of an apparent bug in double columns.
+This is an example of an apparent bug in double columns.
+This is an example of an apparent bug in double columns.
+This is an example of an apparent bug in double columns.
+
+\doublecolumns
+This is an example of an apparent bug in double columns.
+\singlecolumn
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/test.tex b/Master/texmf-dist/source/eplain/base/test/test.tex
new file mode 100644
index 00000000000..779d8adf662
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/test.tex
@@ -0,0 +1,14 @@
+% This file is public domain.
+%
+\input ../eplain
+\input asibook.gst
+
+\comment The title is actually irrelevant: we don't do the title page.
+\title{Wavelets and their applications}
+
+\comment The other front stuff happens in asibook.gst's \producepreliminary,
+\comment which is called by virtue of the \part here.
+
+\backthing{test.index}
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/time.tex b/Master/texmf-dist/source/eplain/base/test/time.tex
new file mode 100644
index 00000000000..90751506091
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/time.tex
@@ -0,0 +1,10 @@
+% This file is public domain.
+%
+\input eplain
+
+\timestring
+
+\time = 68
+\timestring
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/truemarg.tex b/Master/texmf-dist/source/eplain/base/test/truemarg.tex
new file mode 100644
index 00000000000..b057a86b94f
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/truemarg.tex
@@ -0,0 +1,36 @@
+% This file is public domain.
+%
+% Some code to test margin-setting macros in concert with
+% \magnification.
+
+\input ../eplain % margin altered version
+
+%\magnification=\magstep0
+%\magnification=\magstep1
+%\magnification=\magstep2
+\magnification=\magstep3
+
+
+\nopagenumbers
+
+\paperheight=11truein
+\paperwidth=8.5truein
+
+\topmargin=1truein
+\leftmargin=1truein
+\rightmargin=6truein
+\bottommargin=3truein
+
+\parindent=0pt
+
+\vbox to \vsize{
+\hrule depth4truept
+\vfill
+\centerline{Magnification = \the\mag}
+\vfill
+\hrule height4truept
+}
+
+
+\bye
+
diff --git a/Master/texmf-dist/source/eplain/base/test/uscore.bib b/Master/texmf-dist/source/eplain/base/test/uscore.bib
new file mode 100644
index 00000000000..82b7bcb07b1
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/uscore.bib
@@ -0,0 +1,5 @@
+% This file is public domain.
+
+@misc{bib_uscore,
+ title = "Underscore label"
+}
diff --git a/Master/texmf-dist/source/eplain/base/test/uscore.tex b/Master/texmf-dist/source/eplain/base/test/uscore.tex
new file mode 100644
index 00000000000..097230596e0
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/uscore.tex
@@ -0,0 +1,14 @@
+% This file is public domain.
+%
+\ifx\undefined\eplain \input eplain \fi
+
+Define a label with an underscore in it. \xrdef{u_score}
+Refer to it: \xref{u_score}.
+
+Make a citation, too: \cite{bib_uscore}.
+
+\bibliographystyle{plain}
+\bibliography{uscore}
+
+\bye
+
diff --git a/Master/texmf-dist/source/eplain/base/test/usepackage.tex b/Master/texmf-dist/source/eplain/base/test/usepackage.tex
new file mode 100644
index 00000000000..ab797823fe7
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/usepackage.tex
@@ -0,0 +1,146 @@
+% This file is public domain.
+%
+% Test \usepackage with packages: color, graphicx, autopict, psfrag, url.
+\input ../eplain
+
+\beginpackages
+ \usepackage[dvipsnames]{color}
+ %\usepackage[draft,hidescale]{graphicx,autopict}\let\ttfamily\relax
+ \usepackage{graphicx,autopict}
+ \usepackage{psfrag}
+ \usepackage[obeyspaces,spaces]{url}[2005/06/27]
+\endpackages
+
+%\enablehyperlinks
+
+\ifpdf
+ \pdfpagewidth=8.5in
+ \pdfpageheight=11in
+\fi
+
+% The following redefinition works around a bug in pdftex.def v0.03m
+% related to \pagecolor.
+\ifpdf
+\makeatletter
+\ifx\GPT@outputbox\undefined
+\def\set@page@color{%
+ \@ifundefined{GPT@outputbox}{%
+ % \newbox is outer in plain
+ \csname newbox\endcsname\GPT@outputbox
+ }{}%
+ \global\let\current@page@color\current@color
+ \@ifundefined{GPTorg@shipout}{%
+ \global\let\GPTorg@shipout\shipout
+ \gdef\shipout{%
+ \afterassignment\GPT@shipout
+ \global\setbox\GPT@outputbox=%
+ }%
+ \gdef\GPT@shipout{%
+ \ifvoid\GPT@outputbox\relax
+ \aftergroup\GPT@@shipout
+ \GPT@pageliteral
+ \else
+ \GPTorg@shipout\vbox{%
+ \GPT@pageliteral
+ \box\GPT@outputbox
+ }%
+ \fi
+ }%
+ \gdef\GPT@@shipout{%
+ \GPTorg@shipout\box\GPT@outputbox\relax
+ }%
+ \gdef\GPT@pageliteral{%
+ \pdfliteral direct{%
+ q % gsave
+ \current@page@color\space
+ n % newpath
+ 0 0 \strip@pt\pdfpagewidth\space
+ \strip@pt\pdfpageheight\space re % rectangle
+ % there is no need to convert to bp
+ f % fill
+ Q% grestore
+ }%
+ }%
+ }{}%
+}
+\fi
+\resetatcatcode
+\fi
+
+
+\pagecolor[rgb]{.3,.8,.95}
+
+\centerline{\bf URL, color, rotation and scaling tests:}
+\smallskip
+
+{\color[rgb]{1,0.2,0.3} RGB-colored text. }Non-colored text.\par
+{\color[cmyk]{.2,.7,.5,.1}CMYK-colored text. }Non-colored text.\par
+{\color[gray]{.4} GRAY-colored text. }Non-colored text.\par
+\definecolor{refcolor}{cmyk}{0.28,1,1,0.35}
+{\color{refcolor}Defined color. }Non-colored text.\par
+\colorbox{green}{Green-colored box.}\par
+\colorbox[rgb]{1,0,0}{Red-colored box.}\par
+%\fcolorbox doesn't work because plain TeX does not have LaTeX's \fbox
+What is this:
+\rotatebox[origin=c]{180}{\reflectbox{\color[rgb]{.5,.3,.3}%
+ \hloff[url]\url{http : // tug . org / eplain}}}\par
+Example of a line break inside a URL: \url{http://www.this.is.some/very.very.very.long.URL/which.goes.on/and.on/and.on.html}\par
+\textcolor{red}{Predefined color `{\tt red}'. }Non-colored text.\par
+\rotatebox{20}{\scalebox{2}[5]{\color[named]{DarkOrchid}Rotated,
+ scaled, and colored text.}}\par
+\resizebox{1in}{\height}{Some text $\sum$.}
+ \resizebox*{1in}{\height}{Some text $\sum$.}
+ \resizebox{1in}{!}{Some text $\sum$.}\par
+
+
+\bigskip
+\centerline{\bf \LaTeX's picture environment:}
+\smallskip
+
+\picture(50,50)
+ \color{red}
+ \thicklines
+ \put(0,0){\line(1,1){50}}
+ \color{blue}
+ \put(40,0){\circle{50}}
+ \put(0,0){\vector(1,0){50}}
+ \color{green}
+ \put(20,0){\circle*{12}}
+ \put(55,40){\oval(80,70)[t]}
+ \color{black}
+ \put(55,40){\oval(50,30)}
+ \bezier{0}(10,10)(40,90)(110,90)
+ %\qbezier does not work
+ %\qbezier[0](10,10)(40,90)(110,90)
+\endpicture
+
+\LaTeXbegin
+
+\begin{picture}(40,40)
+\put(0,0){\vector(1,1){40}}
+\multiput(0,5)(10,10){4}{a}
+\end{picture}
+
+\vfil\eject
+
+
+\pagecolor[named]{SkyBlue}
+
+\centerline{\bf PSfrag test (uses {\tt example.eps} from the PSfrag package):}
+\smallskip
+
+\centerline{\includegraphics[width=3.5in]{example.eps}
+\quad
+\psfragscanon
+\psfrag*{p1}[][l]{$\ast$}
+\psfrag{p2}[][l]{$\ast$}
+\psfrag{p3}{$\cos(t)$}
+\includegraphics[width=3.5in]{example.eps}}
+
+
+\bye
+
+% Local variables:
+% compile-command: "(cd .. && make eplain.tex) && pdftex --interact=nonstopmode usepackage.tex"
+% compile-command: "(cd .. && make eplain.tex) && tex --interact=nonstopmode usepackage.tex && dvips -t letter usepackage.dvi -o"
+% End:
diff --git a/Master/texmf-dist/source/eplain/base/test/verb2.tex b/Master/texmf-dist/source/eplain/base/test/verb2.tex
new file mode 100644
index 00000000000..b3c7c4ad54c
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/verb2.tex
@@ -0,0 +1,61 @@
+% This file is public domain.
+%
+% Date: Wed, 30 Mar 94 09:50:27 CST
+% From: dorai@cs.rice.edu (Dorai Sitaram)
+% To: karl@cs.umb.edu
+% Subject: eplain 2.4's \verbatim: problem & fix
+
+\input eplain
+
+Testing Eplain's \verbatim verbatim|endverbatim
+
+\def\junk{{\it Some obviously $a^2+b^2$ non-verbatim stuff}}
+
+\bigskip\bigskip
+
+First let's test if the default | works
+
+\verbatim
+verbatim starts
+Some special chars:
+ !@#$%^&*()_+
+Now test if doubling works:
+ This line ends with a single ||
+Now test if I can use || to get non-verbatim stuff:
+ \junk
+verbatim ends
+|endverbatim
+
+\bigskip\bigskip
+
+Now let's try the same with escape set to \#.
+\verbatimescapechar\#
+
+\verbatim
+verbatim starts
+Some special chars:
+ !@$%^&*()_+
+Now test if doubling works:
+ This line ends with a single ##
+Now test if I can use ## to get non-verbatim stuff:
+ #junk
+verbatim ends
+#endverbatim
+
+\bigskip\bigskip
+
+Now with @.
+\verbatimescapechar\@
+
+\verbatim
+verbatim starts
+Some special chars:
+ !#$%^&*()_+
+Now test if doubling works:
+ This line ends with a single @@
+Now test if I can use @@ to get non-verbatim stuff:
+ @junk
+verbatim ends
+@endverbatim
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/verbatim.tex b/Master/texmf-dist/source/eplain/base/test/verbatim.tex
new file mode 100644
index 00000000000..677d0f3b176
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/verbatim.tex
@@ -0,0 +1,65 @@
+% This file is public domain.
+%
+\input eplain
+
+Leading spaces:
+
+\verbatim
+---T--T----
+One
+
+ Two
+
+ Three
+
+ Four
+
+Five
+|endverbatim
+
+The same again with spaces on empty lines:
+
+\verbatim
+---T--T----
+One
+
+ Two
+
+ Three
+
+ Four
+
+Five
+|endverbatim
+
+Now for some tabs:
+
+\verbatim
+--------T-------T
+One
+
+ Two
+
+ Three
+
+ Four
+
+Five
+
+|endverbatim
+
+Here is how you can get vertical bars into verbatim:
+
+\verbatim
+||!@#$%^&*()_-+=\~`{}[]:'';'<>?,./
+|endverbatim
+
+And here's you can use it in a paragraph:
+\verbatim middle%%%%|endverbatim. And this is the example from the
+manual, quoted with a leading space: `\verbatim| ||\#%&!|endverbatim'.
+
+Now we change the escape character to @ and have a leading space:
+\verbatimescapechar @
+`\verbatim@ @@|my what big teeth you have!@endverbatim'.
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/vlach.tex b/Master/texmf-dist/source/eplain/base/test/vlach.tex
new file mode 100644
index 00000000000..1aa8262d1b6
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/vlach.tex
@@ -0,0 +1,258 @@
+% This file is public domain.
+%
+%Date: Sun, 29 Nov 92 18:21:53 EST
+%From: avlach@cleveland.next.nd.edu (alan vlach)
+%To: Karl Berry <karl@ra.cs.umb.edu>
+%Subject: Re: eplain
+%
+%My problem occurs when I try to call \singlecolumn too quickly after
+%I have called \doublecolumns, which is probably bad style anyway, but
+%here's a sample file (below) so you can see what's happening.
+%
+%Put \singlecolumn just one paragraph later and everything works OK.
+%
+%Thanks for looking at this.
+%
+%Sincerely,
+%Alan Vlach
+%alan.d.vlach.1@nd.edu
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\input eplain
+
+This is a dummy file just to show Karl Berry the problem I'm having.
+
+Here is a first paragraph of nonsense. Here is a first paragraph of
+nonsense. Here is a first paragraph of nonsense. Here is a first
+paragraph of nonsense. Here is a first paragraph of nonsense. Here is
+a first paragraph of nonsense. Here is a first paragraph of nonsense.
+Here is a first paragraph of nonsense. Here is a first paragraph of
+nonsense. Here is a first paragraph of nonsense. Here is a first
+paragraph of nonsense. Here is a first paragraph of nonsense. Here is
+a first paragraph of nonsense. Here is a first paragraph of nonsense.
+Here is a first paragraph of nonsense. Here is a first paragraph of
+nonsense.
+
+Here is another paragraph of nonsense. Here is another paragraph of
+nonsense. Here is another paragraph of nonsense. Here is another
+paragraph of nonsense. Here is another paragraph of nonsense. Here is
+another paragraph of nonsense. Here is another paragraph of nonsense.
+Here is another paragraph of nonsense. Here is another paragraph of
+nonsense. Here is another paragraph of nonsense. Here is another
+paragraph of nonsense. Here is another paragraph of nonsense. Here is
+another paragraph of nonsense. Here is another paragraph of nonsense.
+Here is another paragraph of nonsense. Here is another paragraph of
+nonsense. Here is another paragraph of nonsense. Here is another
+paragraph of nonsense. Here is another paragraph of nonsense. Here is
+another paragraph of nonsense. Here is another paragraph of nonsense.
+Here is another paragraph of nonsense. Here is another paragraph of
+nonsense. Here is another paragraph of nonsense. Here is another
+paragraph of nonsense. Here is another paragraph of nonsense. Here is
+another paragraph of nonsense. Here is another paragraph of nonsense.
+Here is another paragraph of nonsense. Here is another paragraph of
+nonsense. Here is another paragraph of nonsense. Here is another
+paragraph of nonsense.
+
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+
+\doublecolumns
+
+And here is where the double columns begin.
+And here is where the double columns begin.
+And here is where the double columns begin.
+And here is where the double columns begin.
+And here is where the double columns begin.
+And here is where the double columns begin.
+And here is where the double columns begin.
+And here is where the double columns begin.
+And here is where the double columns begin.
+And here is where the double columns begin.
+And here is where the double columns begin.
+And here is where the double columns begin.
+And here is where the double columns begin.
+And here is where the double columns begin.
+
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+
+\singlecolumn
+
+The single column resumes. The single column resumes.
+
+The single column resumes. The single column resumes.
+
+The single column resumes. The single column resumes.
+
+The single column resumes. The single column resumes.
+
+The single column resumes. The single column resumes.
+
+The single column resumes. The single column resumes.
+
+The single column resumes. The single column resumes.
+
+The single column resumes. The single column resumes.
+
+The single column resumes. The single column resumes.
+
+The single column resumes. The single column resumes.
+
+The single column resumes. The single column resumes.
+
+The single column resumes. The single column resumes.
+
+The single column resumes. The single column resumes.
+
+
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+Here is the $n^{\rm th}$ paragraph of nonsense.
+
+This is the final paragraph. This is the final paragraph.
+This is the final paragraph. This is the final paragraph.
+This is the final paragraph. This is the final paragraph.
+This is the final paragraph. This is the final paragraph.
+This is the final paragraph. This is the final paragraph.
+This is the final paragraph. This is the final paragraph.
+This is the final paragraph. This is the final paragraph.
+This is the final paragraph. This is the final paragraph.
+This is the final paragraph. This is the final paragraph.
+This is the final paragraph. This is the final paragraph.
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/whitespc.tex b/Master/texmf-dist/source/eplain/base/test/whitespc.tex
new file mode 100644
index 00000000000..eb3ca0d6b3b
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/whitespc.tex
@@ -0,0 +1,51 @@
+% This file is public domain.
+%
+\ifx\eplain\undefined \input eplain \fi
+
+\vbox{\obeywhitespace Does it work in vbox ?}
+
+This is some normal text, in a normal paragraph, that's been indented in
+the normal way. Isn't that nice? The lines after the first aren't
+indented, as usual.
+
+This line is the start of a paragraph; the obeyed material is next. And
+it continues on the same line.
+{\obeywhitespace This is the start of the obeyed stuff.
+ And this one by a couple spaces more than the indentation.
+Back to the normal indentation--- some extra space there, did you notice?
+That's it.
+}
+This is the end of the paragraph with the obeyed stuff, and it shouldn't
+be indented, but it should start at the beginning of the line, since it
+continues the paragraph.
+
+{\obeywhitespace This obeyed material starts a paragraph.
+That line should have the normal indentation (so should this one).
+And this line ends with the closing brace to the group.}
+And this line continues the paragraph.
+
+{\obeywhitespace
+Some more obeyed material (and a newline after the control sequence):
+
+That was a blank line above.
+}
+
+That time no normal stuff continued the paragraph. It shouldn't have
+made any difference.
+Some more normal text, with spaces treated normally again.
+
+Here is some {\obeywhitespace obeyed stuff} in the middle of a line.
+And this {\obeywhitespace more stuff} has multiple spaces before
+the `more', that should be ignored.
+
+{\blanklineskipamount = -.5\baselineskip
+\obeywhitespace The blank line after this line
+
+should be half as much as the blank lines above and below.
+}
+
+{\obeywhitespace And now we should be
+
+back to normal.}
+
+\bye
diff --git a/Master/texmf-dist/source/eplain/base/test/xampl.tex b/Master/texmf-dist/source/eplain/base/test/xampl.tex
new file mode 100644
index 00000000000..4b6eaab3f3e
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/xampl.tex
@@ -0,0 +1,13 @@
+% This file is public domain.
+%
+% Test xampl.bib.
+%
+%\ifx\undefined\eplain \input eplain \fi
+\input btxmac
+
+\bibliography{xampl}
+\bibliographystyle{apalike}
+
+\nocite{*}
+
+\end
diff --git a/Master/texmf-dist/source/eplain/base/test/xref.tex b/Master/texmf-dist/source/eplain/base/test/xref.tex
new file mode 100644
index 00000000000..70096bd29e9
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/test/xref.tex
@@ -0,0 +1,39 @@
+% This file is public domain.
+%
+% Test file for cross-references.
+%
+\ifx\undefined\eplain \input eplain \fi
+
+\catcode`\_ = 2
+
+defining ``foo bar'':
+\xrdef{foo bar}.
+
+and also a `sect' (make that word `Section') label `s' to be `3.1':
+\definexref{s}{3.1}{sect}.
+\def\sectword{Section}
+
+Let's also define two labels with a numbers, ``label1'' and ``label2'':
+\xrdef{label1}\xrdef{label2}
+
+\vfill\eject
+
+defining ``foo baz''.
+\xrdef{foo baz}
+\vfill\eject
+
+Define something with all the other characters, including unprintable
+ones: \xrdef{1234567890)(@!`['";:]|<>,./?À-=+}.
+
+
+using everything (these should be page 1 and page 2):
+\xref{foo bar} and \xref{foo baz}.
+
+And now the ones with numbers (page 1): \xref{label1} and \xref{label2}.
+
+And now the weird one (page 3): \xref{1234567890)(@!`['";:]|<>,./?À-=+}.
+
+ref, refn, and refs on s: \ref{s}, \refn{s}, \refs{s}.
+
+And an undefined one: \xref{undefined}.
+\end
diff --git a/Master/texmf-dist/source/eplain/base/util/idxuniq b/Master/texmf-dist/source/eplain/base/util/idxuniq
new file mode 100644
index 00000000000..6ee7d225f5c
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/util/idxuniq
@@ -0,0 +1,37 @@
+#!/usr/bin/awk -f
+
+# (This file is public domain.)
+
+# This script filters input lines (which are expected to be a list of
+# `\indexentry' lines for MakeIndex) eliminating matching lines. The comparison
+# is done without regard to hyperlink label names (in the form `IDX*', where `*'
+# stands for a non-negative integer).
+
+# This has to be done to avoid terms which differ only in hyperlink label names
+# embedded into them, because MakeIndex will treat these otherwise identical
+# terms as distinct, listing more than once a page number for equivalent terms
+# on the same page.
+
+# `stripped' array is indexed by `\indexentry' lines stripped off the hyperlink
+# label name. For each term, we use its stripped version as a key into the
+# `stripped' array to increment its element. This records the fact that we have
+# seen the term with such key. Also, we add the (full) `\indexentry' line to
+# the `terms' array, but only if we have not yet seen a term with such key.
+
+# The idea was borrowed from Edition 3 of `GAWK: Effective AWK Programming: A
+# User's Guide for GNU Awk', which contains the following credit:
+
+# histsort.awk --- compact a shell history file
+# Thanks to Byron Rakitzis for the general idea
+
+{
+ temp = $0
+ sub (/{IDX[[:digit:]]+}/, "", temp)
+ if (stripped[temp]++ == 0)
+ terms[++count] = $0
+}
+
+END {
+ for (i = 1; i <= count; i++)
+ print terms[i]
+}
diff --git a/Master/texmf-dist/source/eplain/base/util/trimsee b/Master/texmf-dist/source/eplain/base/util/trimsee
new file mode 100644
index 00000000000..8af5ebe6434
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/util/trimsee
@@ -0,0 +1,106 @@
+#!/bin/sh
+
+# (This file is public domain.)
+
+help ()
+{
+ cat <<EOF
+Usage: trimsee [-i IS] [-o OS] [-s SEE]
+ trimsee {-h|--help|-v|--version}
+Remove commas (or other page list separators) in front
+of see / see also commands in the output of MakeIndex.
+Input is read from stdin, output is directed to stdout.
+
+-i IS use IS as a regular expression matching separator
+ in front of see / see also commands in the input
+ (default: '$DEFAULT_IS')
+-o OS use OS as a separator to replace IS in front of
+ see / see also commands (default: '$DEFAULT_OS')
+-s SEE use SEE as a regular expression matching see /
+ see also commands (default: '$DEFAULT_SEE')
+-h, --help show this help message
+-v, --version show version
+EOF
+}
+
+check_missing_arg ()
+{
+ if (( $1 < 2 )); then
+ echo "Missing argument to option '$2'" 1>&2
+ exit 1
+ fi
+}
+
+VERSION='0.1'
+
+DEFAULT_SEE='\\indexsee'
+DEFAULT_IS=', \+'
+DEFAULT_OS=' '
+
+SEE=$DEFAULT_SEE
+IS=$DEFAULT_IS
+OS=$DEFAULT_OS
+
+while [ $# != 0 ]
+do
+ case "$1" in
+ -i)
+ check_missing_arg $# "$1"
+ IS=$2
+ shift
+ ;;
+ -o)
+ check_missing_arg $# "$1"
+ OS=$2
+ shift
+ ;;
+ -s)
+ check_missing_arg $# "$1"
+ SEE=$2
+ shift
+ ;;
+ -h | --help)
+ help
+ exit 0
+ ;;
+ -v | --version)
+ echo "trimsee version $VERSION"
+ exit 0
+ ;;
+ *)
+ echo "Unknown option '$1'" 1>&2
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+
+# The idea is to implement line output delayed by one line. When we
+# read next line, we check if it starts with a see/see also entry, and
+# if it does, we remove the comma at the end of the previous line
+# before printing it. We keep previous lines in the hold buffer.
+
+sed -n '
+
+# Remove all commas in front of see/see also inside each line.
+s/'"$IS$SEE/$OS$SEE"'/g
+
+# If this line does not start with see/see also, we will print the
+# previous line intact. NOTE: There are two characters inside the
+# brackets: a space and a tab.
+/^[ ]*'"$SEE"'/! { x; b PRINT; }
+
+# This line starts with see/see also, so remove comma at the end of
+# the previous line before we print it.
+x
+s/'"$IS"'$/'"$OS"'/
+
+# Print the previous line.
+:PRINT
+1! p
+
+# At the end of the input, print the last line.
+$ { x; p; }
+
+'
diff --git a/Master/texmf-dist/source/eplain/base/xeplain.tex b/Master/texmf-dist/source/eplain/base/xeplain.tex
new file mode 100644
index 00000000000..5464d27a82e
--- /dev/null
+++ b/Master/texmf-dist/source/eplain/base/xeplain.tex
@@ -0,0 +1,4783 @@
+% xeplain.tex: macros for nonformatting. Written 1989--94 by (mostly)
+% Karl Berry. Some additions/changes 1997--98 by Adam Lewenberg.
+% These macros are in the public domain.
+%
+% This is the ``extended plain'' TeX format that's described in
+% `eplain.texinfo', which you should have received with this file. We
+% assume plain has been loaded.
+%
+% N.B.: A version number is defined at the beginning and end of this file;
+% please change those numbers whenever the file is modified!
+% And it's best to rename the file if you're going to distribute a
+% modified version.
+%
+% Some macros were written and/or suggested by Paul Abrahams.
+% Other sources (e.g., The TeXbook) are cited at the appropriate places.
+%
+%% @texfile{
+%% author = "Karl Berry, Steven Smith, Oleg Katsitadze, and others",
+%% version = "REPLACE-WITH-VERSION",
+%% date = "REPLACE-WITH-DATE",
+%% filename = "xeplain.tex",
+%% email = "bug-eplain@tug.org",
+%% checksum = "REPLACE-WITH-CHECKSUM",
+%% codetable = "ASCII",
+%% supported = "yes",
+%% docstring = "This file defines macros that extend and expand on
+%% plain TeX. eplain.tex is xeplain.tex and the other
+%% source files with comments stripped; see the original
+%% files for author credits, etc. And please base diffs
+%% or other contributions on xeplain.tex, not the
+%% stripped-down eplain.tex.",
+%% }
+%
+%
+% Load eplain.tex only once (to avoid using up \new's).
+% \eplain is defined at the end of this file, so we can test \eplain to
+% detect whether eplain.tex has been loaded already or not.
+%
+% We use \expandafter because the merge script strips any lines
+% with an \endinput.
+%
+\ifx\eplain\undefined
+ \let\next\relax
+\else
+ \expandafter\let\expandafter\next\csname endinput\endcsname
+\fi
+\next
+% The ifpdf.sty file included below was written by Heiko Oberdiek.
+% See the complete source file (e.g., in this distribution) for
+% comments.
+%% [[[include ifpdf.sty]]]
+%
+%
+% Category codes, etc.
+%
+\def\makeactive#1{\catcode`#1 = \active \ignorespaces}%
+\chardef\letter = 11
+\chardef\other = 12
+% The following two macros were adopted from miniltx.tex of graphics.
+\def\makeatletter{%
+ \edef\resetatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}%
+ \catcode`\@11\relax
+}%
+\def\makeatother{%
+ \edef\resetatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}%
+ \catcode`\@12\relax
+}%
+%
+%
+% So we can have user-inaccessible control sequences.
+%
+\edef\leftdisplays{\the\catcode`@}%
+\catcode`@ = \letter
+\let\@eplainoldatcode = \leftdisplays
+%
+% Save miniscule amounts of memory and time by writing \toks@ii instead
+% of \toks2.
+\toksdef\toks@ii = 2
+%
+%
+% This macro is defined in The TeXbook, but it never made it
+% into plain TeX. \dospecials is defined there, though.
+%
+\def\uncatcodespecials{%
+ \def\do##1{\catcode`##1 = \other}%
+ \dospecials
+}%
+%
+%
+% Here is a way to do \let^^M = \cs, where the \let need not be global.
+{%
+ \makeactive\^^M %
+ \long\gdef\letreturn#1{\let^^M = #1}%
+}%
+%
+%
+% Swallow parameters, etc.
+%
+\let\@eattoken = \relax % Define this, so \eattoken can be used in \edef.
+\def\eattoken{\let\@eattoken = }%
+\def\gobble#1{}%
+\def\gobbletwo#1#2{}%
+\def\gobblethree#1#2#3{}%
+%
+% We can't just use \empty as the identity function, since then outer
+% braces which would supposedly delimit the argument would define a group.
+\def\identity#1{#1}%
+%
+% True if #1 is the empty string, i.e., called like `\ifempty{}'.
+% Use notes:
+% So far, \ifempty works in the following cases:
+% 1. \ifempty{}\message{empty}\else\message{not empty}\fi --> empty
+% 2. \ifempty\undefined\message{empty}\else\message{not empty}\fi --> not empty
+% But does NOT work in the case
+% 3. \def\empty{}
+% \ifempty\empty\message{empty}\else\message{not empty}\fi --> not empty
+% Question: When should \ifempty be true?
+\def\@emptymarkA{\@emptymarkB}
+% The above line suggested by Stanislav Brabec.
+\def\ifempty#1{\@@ifempty #1\@emptymarkA\@emptymarkB}%
+\def\@@ifempty#1#2\@emptymarkB{\ifx #1\@emptymarkA}%
+%
+% Turn a definition into the characters that compose it. See
+% ``Sanitizing control sequences under \write'', by Ron Whitney, TUGboat
+% 11(4), p.620.
+\def\@gobblemeaning#1:->{}%
+\def\sanitize{\expandafter\@gobblemeaning\meaning}%
+%
+%
+% From p.308 of the TeXbook. This cannot be used in places where TeX
+% might be skipping tokens, e.g., in conditionals.
+%
+\def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}%
+%
+%
+% \csname constructions come up an awful lot, so we save typing with the
+% following. (But the extra macro expansion does take time, so we don't
+% use these in frequently-executed code.)
+%
+\def\csn#1{\csname#1\endcsname}%
+\def\ece#1#2{\expandafter#1\csname#2\endcsname}%
+%
+%
+% \expandonce{TOKEN} abbreviates \expandafter\noexpand TOKEN.
+%
+\def\expandonce{\expandafter\noexpand}%
+%
+%
+% Don't show our register allocations in the log.
+%
+\let\@plainwlog = \wlog
+\let\wlog = \gobble
+%
+%
+% Make it convenient to put newlines in error messages.
+%
+\newlinechar = `^^J
+%
+%
+% Sometimes it is convenient to have everything in the transcript file
+% and nothing on the terminal. We don't just call \tracingall here,
+% since that produces some useless output on the terminal.
+%
+\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
+\def\loggingall{\tracingcommands\tw@\tracingstats\tw@
+ \tracingpages\@ne\tracingoutput\@ne\tracinglostchars\@ne
+ \tracingmacros\tw@\tracingparagraphs\@ne\tracingrestores\@ne
+ \showboxbreadth\maxdimen\showboxdepth\maxdimen
+}%
+% Show the complete contents of boxes.
+%
+\def\tracingboxes{\showboxbreadth = \maxdimen \showboxdepth = \maxdimen}%
+%
+% Don't trace anything, except restore \showbox... to plain's values.
+%
+\def\gtracingoff{\begingroup \globaldefs = 1 \tracingoff \endgroup}%
+\def\tracingoff{\tracingonline\z@\tracingcommands\z@\tracingstats\z@
+ \tracingpages\z@\tracingoutput\z@\tracinglostchars\z@
+ \tracingmacros\z@\tracingparagraphs\z@\tracingrestores\z@
+ \showboxbreadth5 \showboxdepth3
+}%
+%
+%
+% Definitions to produce actual `{' (et al.) characters in an output
+% file via \write. We omit the line break after the first }, since we
+% have no comment character at that point.
+%
+\begingroup
+ \catcode`\{ = 12 \catcode`\} = 12
+ \catcode`\[ = 1 \catcode`\] = 2
+ \gdef\lbracechar[{]%
+ \gdef\rbracechar[}]%
+ \catcode`\% = \other
+ \gdef\percentchar[%]\endgroup
+%
+%
+% Leave horizontal mode (if we're in it), then insert a penalty.
+% And conversely.
+%
+\def\vpenalty{\ifhmode\par\fi \penalty}%
+\def\hpenalty{\ifvmode\leavevmode\fi \penalty}%
+%
+%
+% Make \else usable in \loop. From Victor Eijkhout's TeX by Topic (page
+% 104). See also Alois Kabelschacht, TUGboat 8(2), page 184.
+%
+\def\iterate{%
+ \let\loop@next\relax
+ \body
+ \let\loop@next\iterate
+ \fi
+ \loop@next
+}%
+%
+%
+% Add #2 (which is expanded in an \edef) to the end of the definition of
+% #1 (which must be a previously-defined control sequence). This is a
+% way to construct simple lists.
+%
+\def\edefappend#1#2{%
+ \toks@ = \expandafter{#1}%
+ \edef#1{\the\toks@ #2}%
+}%
+%
+%
+% \allowhyphens, from TeXbook, p. 395. Allows following & preceding word
+% to be hyphenated.
+%
+\def\allowhyphens{\nobreak\hskip\z@skip}%
+%
+%
+%
+% Hooks.
+%
+% \hookaction{HOOK}{TOKENS} adds TOKENS to the list of actions for
+% HOOK. We avoid defining a \toks register for each hook, although
+% maybe that isn't so important.
+%
+% \hookappend and \hookprepend add TOKENS specificially to the end or
+% the beginning. When the argument is used, \toks@ will be the previous
+% value of the hook, and \toks@ii the new tokens.
+%
+\long\def\hookprepend{\@hookassign{\the\toks@ii \the\toks@}}%
+\long\def\hookappend{\@hookassign{\the\toks@ \the\toks@ii}}%
+\let\hookaction = \hookappend % either one should be ok
+%
+%
+% \@hookassign{LAST-DEF}{HOOK}{TOKENS} makes \toks@ the previous value
+% of HOOK, and \toks@ii TOKENS, and then assigns the new value using
+% LASTDEF. We store the hook in a control sequence \@HOOKhook.
+%
+\long\def\@hookassign#1#2#3{%
+ % Make \toks@ be the expansion (to one level) of \@HOOKhook, or empty.
+ \expandafter\ifx\csname @#2hook\endcsname \relax
+ % If \@HOOKhook was undefined, let it be empty.
+ \toks@ = {}%
+ \else
+ % Otherwise, expand it to one level. We can't just assign from
+ % \expandafter{\csname ...} since then the \toks register would
+ % contain the control sequence, not its definition.
+ \expandafter\let\expandafter\temp \csname @#2hook\endcsname
+ \toks@ = \expandafter{\temp}%
+ \fi
+ \toks2 = {#3}% Don't expand the argument all the way.
+ \ece\edef{@#2hook}{#1}%
+}%
+%
+%
+% \hookactiononce{HOOK}\CS adds `\global\let\CS=\relax' to the
+% definition of \CS, then adds to HOOK. Thus, \CS is expanded the next
+% time HOOK is called, but then it goes away. This only works if \CS is
+% expandable, though.
+%
+\long\def\hookactiononce#1#2{%
+ \edefappend#2{\global\let\noexpand#2\relax}
+ \hookaction{#1}#2%
+}%
+%
+%
+% \hookrun{HOOKNAME} runs whatever actions have been defined for HOOK.
+%
+\def\hookrun#1{%
+ \expandafter\ifx\csname @#1hook\endcsname \relax \else
+ % Isn't this fun? We want to get rid of the \fi before expanding
+ % the actions, so that they can read what's coming up next.
+ \def\temp{\csname @#1hook\endcsname}%
+ \expandafter\temp
+ \fi
+}%
+%
+%
+%
+% Properties a la Lisp.
+%
+% \setproperty{ATOM}{PROPNAME}{VALUE} defines the property PROPNAME on the
+% ``atom'' ATOM to have VALUE.
+%
+\def\setproperty#1#2#3{\ece\edef{#1@p#2}{#3}}%
+\def\setpropertyglobal#1#2#3{\ece\xdef{#1@p#2}{#3}}%
+%
+%
+% \getproperty{ATOM}{PROPNAME} expands to the value of the property
+% PROPNAME on ATOM, or to nothing (i.e., \empty), if the property isn't
+% present.
+%
+\def\getproperty#1#2{%
+ \expandafter\ifx\csname#1@p#2\endcsname\relax
+ % then \empty
+ \else \csname#1@p#2\endcsname
+ \fi
+}%
+%
+%
+%
+% Macros to support BibTeX are in a separate file, btxmac.tex.
+%
+% (They are maintained separately, too, by Oren Patashnik,
+% opbibtex@cs.stanford.edu.) btxmac.tex also defines other macros we
+% want to use and make available.
+%
+% But not all people want to read the BibTeX macros, because of either
+% space or time considerations. Therefore, we look for \nobibtex,
+% which, if defined, causes btxmac.tex not to be read. But we still
+% have to get \tokstostring et al. defined---so eplain.tex contains
+% those definitions, automatically edited in from btxmac.tex. All the
+% documentation has been removed, so you must read btxmac.tex if you
+% want the comments.
+%
+%
+% We want to give a slightly different message than btxmac if no .aux
+% file exists (unless the person using us has already define some
+% message, possibly empty.)
+%
+\ifx\@undefinedmessage\@undefined
+ \def\@undefinedmessage
+ {No .aux file; I won't warn you about undefined labels.}%
+\fi
+%
+%
+% We use a token register to define all the BibTeX definitions, to avoid
+% problems with the \if... constructions when they are conditionally
+% read.
+%
+%% [[[here is the first set of common definitions from btxmac]]]
+\toks0 = {%
+ %% [[[here are the BibTeX-specific definitions from btxmac]]]
+}%
+\ifx\nobibtex\@undefined \the\toks0 \fi
+%% [[[here is the second set of common definitions from btxmac]]]
+%
+% Here are the control sequences that btxmac.tex defines using an @,
+% because btxmac.tex wants to absolutely minimize the chance of
+% conflicts. But these control sequence implement documented features
+% of eplain, so we want to allow people to use them without the @.
+%
+\let\auxfile = \@auxfile
+\let\for = \@for
+\let\futurenonspacelet = \@futurenonspacelet
+\def\iffileexists{\if@fileexists}%
+\let\innerdef = \@innerdef
+\let\innernewcount = \@innernewcount
+\let\innernewdimen = \@innernewdimen
+\let\innernewif = \@innernewif
+\let\innernewwrite = \@innernewwrite
+\let\linenumber = \@linenumber
+\let\readauxfile = \@readauxfile
+\let\spacesub = \@spacesub
+\let\testfileexistence = \@testfileexistence
+\let\writeaux = \@writeaux
+%
+%
+% btxmac.tex defines \innerdef. Let's use it to make an abbreviation
+% for \innerdef\inner<name>{<name>}.
+%
+\def\innerinnerdef#1{\expandafter\innerdef\csname inner#1\endcsname{#1}}%
+%
+% Use that in turn to make non-outer versions of the rest of plain TeX's
+% allocation macros. (btxmac.tex already did a few of them.)
+%
+\innerinnerdef{newbox}%
+\innerinnerdef{newfam}%
+\innerinnerdef{newhelp}%
+\innerinnerdef{newinsert}%
+\innerinnerdef{newlanguage}%
+\innerinnerdef{newmuskip}%
+\innerinnerdef{newread}%
+\innerinnerdef{newskip}%
+\innerinnerdef{newtoks}%
+%
+%
+% Besides doing a \write to the aux file, we also need to do an
+% \immediate\write.
+%
+\def\immediatewriteaux#1{%
+ \ifx\noauxfile\@undefined
+ \immediate\write\@auxfile{#1}%
+ \fi
+}%
+%
+%
+% We want \biblabelprint to define hyperlink destination. For that,
+% we save the label for the current bibliography entry from within
+% \bblitemhook.
+\def\bblitemhook#1{\gdef\@hlbblitemlabel{#1}}%
+%
+\def\biblabelprint#1{%
+ \noindent
+ \hbox to \biblabelwidth{%
+ \hldest@impl{bib}{\@hlbblitemlabel}%
+ \biblabelprecontents
+ \biblabelcontents{#1}%
+ \biblabelpostcontents
+ }%
+ \kern\biblabelextraspace
+}%
+% We want each citation item to be hyperlink to bibliography entry.
+% To avoid unnecessary warnings about undefined destinations (e.g.,
+% from pdfTeX), produce the link only when .bbl file (which does the
+% \hldest's) is present.
+\def\eplainprintcitepreitem#1{\hlstart@impl{cite}{#1}}%
+\def\eplainprintcitepostitem{\hlend@impl{cite}}%
+%
+%
+\def\printcitepreitem#1{%
+ \testfileexistence[\bblfilebasename]{bbl}%
+ \iffileexists
+ \global\let\printcitepreitem\eplainprintcitepreitem
+ \global\let\printcitepostitem\eplainprintcitepostitem
+ \else
+ \global\let\printcitepreitem\gobble
+ \global\let\printcitepostitem\relax
+ \fi
+ \printcitepreitem{#1}%
+}%
+%
+%
+%
+% Macros that produce output.
+%
+% \obeywhitespace makes both end-of-lines and spaces in the input be
+% respected in the output. Even spaces at the beginning of lines turn
+% into blank space the size of the natural space of the current font.
+% The reason why plain TeX's \obeyspaces does not do this last is that
+% it produces actual space characters, i.e., glue, and glue is discarded
+% at a(n output) line break, and so if line breaks in the input are
+% line breaks in the output...
+%
+% Tabs are not affected; they will still produce glue (a single space).
+%
+\begingroup
+ \makeactive\^^M \makeactive\ % No spaces or ^^M's from here on.
+\gdef\obeywhitespace{%
+\makeactive\^^M\def^^M{\par\futurelet\next\@finishobeyedreturn}%
+\makeactive\ \let =\ %
+%
+% The group we use here is the one \obeywhitespace must be enclosed in.
+% If we don't do this, then if the obeyed stuff ends in a newline, the
+% indent produced by the definition of ^^M will make that line indented,
+% even if it isn't the end of the paragraph.
+\aftergroup\@removebox%
+\futurelet\next\@finishobeywhitespace%
+}%
+%
+% \@finishobeywhitespace eats any spaces and/or the end-of-line after
+% the \obeywhitespace command itself. The group here is the one that it
+% itself creates.
+%
+\gdef\@finishobeywhitespace{{%
+\ifx\next %
+\aftergroup\@obeywhitespaceloop%
+\else\ifx\next^^M%
+\aftergroup\gobble%
+\fi\fi}}%
+%
+% \@finishobeyedreturn is invoked at the end of every input line. We
+% check if the next thing is also a return, and, if so, insert extra
+% space. Then we start the next line.
+%
+\gdef\@finishobeyedreturn{%
+\ifx\next^^M\vskip\blanklineskipamount\fi%
+\indent%
+}%
+\endgroup
+%
+% The argument here is the space that we are supposed to eat after the
+% \obeywhitespace command.
+%
+\def\@obeywhitespaceloop#1{\futurelet\next\@finishobeywhitespace}%
+%
+%
+% This removes the last box, if it was a empty box of width \parindent.
+% We might have been called inside a \vbox, so we have to test if we are
+% in horizontal mode before using \lastbox.
+%
+\def\@removebox{%
+ \ifhmode
+ \setbox0 = \lastbox
+ \ifdim\wd0=\parindent
+ \setbox2 = \hbox{\unhbox0}%
+ \ifdim\wd2=0pt
+ % Don't put it back: it was an indentation box.
+ % This \ignorespaces ignores spaces after the group.
+ \ignorespaces
+ \else
+ \box2 % Put it back: it wasn't empty.
+ \fi
+ \else
+ \box0 % Put it back: it wasn't the right width.
+ \fi
+ \fi
+}%
+%
+% We allow for extra (possibly negative) space when we hit blank lines.
+%
+\newskip\blanklineskipamount
+\blanklineskipamount = 0pt
+%
+%
+% A good way to print fractions in text when you don't want
+% to use \over (which should be most of the time), and yet
+% just `1/2' doesn't look right. (From the TeXbook,
+% the answer to exercise 11.6, p.311.)
+%
+\def\frac#1/#2{\leavevmode
+ \kern.1em \raise .5ex \hbox{\the\scriptfont0 #1}%
+ \kern-.1em $/$%
+ \kern-.15em \lower .25ex \hbox{\the\scriptfont0 #2}%
+}%
+%
+%
+% The `e' just means `Eplain', as in `Eplain's hrule'. The advantage
+% to using these is that you can change the default thickness.
+%
+\newdimen\hruledefaultheight \hruledefaultheight = 0.4pt
+\newdimen\hruledefaultdepth \hruledefaultdepth = 0.0pt
+\newdimen\vruledefaultwidth \vruledefaultwidth = 0.4pt
+%
+\def\ehrule{\hrule height\hruledefaultheight depth\hruledefaultdepth}%
+\def\evrule{\vrule width\vruledefaultwidth}%
+%
+%
+% The texnames.sty and path.sty files included below were originally
+% written by Nelson Beebe and Philip Taylor, respectively. See the
+% complete source files (e.g., in this distribution) for comments.
+%% [[[include texnames.sty]]]
+%% [[[include path.sty]]]
+%
+%
+% A square box, suitable for being a marker in lists.
+%
+\def\blackbox{\vrule height .8ex width .6ex depth -.2ex \relax}% square bullet
+%
+%
+% From p.311 of the TeXbook.
+%
+% Make an unfilled rectangle with the dimensions of \box0. #1 is the
+% height of the rules, #2 the depth (i.e., the thicknesses).
+%
+\def\makeblankbox#1#2{%
+ \ifvoid0
+ \errhelp = \@makeblankboxhelp
+ \errmessage{Box 0 is void}%
+ \fi
+ \hbox{\lower\dp0
+ \vbox{\hidehrule{#1}{#2}%
+ \kern -#1% overlap rules
+ \hbox to \wd0{\hidevrule{#1}{#2}%
+ \raise\ht0\vbox to #1{}% vrule height
+ \lower\dp0\vtop to #1{}% vrule depth
+ \hfil\hidevrule{#2}{#1}%
+ }%
+ \kern-#1\hidehrule{#2}{#1}%
+ }%
+ }%
+}%
+%
+\newhelp\@makeblankboxhelp{Assigning to the dimensions of a void^^J%
+ box has no effect. Do `\string\setbox0=\string\null' before you^^J%
+ define its dimensions.}%
+%
+%
+% Produce an hrule with height #1 and depth #2, and insert kerning so it
+% doesn't change the current position.
+%
+\def\hidehrule#1#2{\kern-#1\hrule height#1 depth#2 \kern-#2}%
+%
+% Produce a vrule with width #1+#2, kerning so as not to change the
+% current position.
+%
+\def\hidevrule#1#2{%
+ \kern-#1%
+ \dimen@=#1\advance\dimen@ by #2%
+ \vrule width\dimen@
+ \kern-#2%
+}%
+%
+%
+% The \boxit macro from the TeXbook, trivially generalized to allow
+% something other than 3pt around the TeX box being boxed.
+%
+\newdimen\boxitspace \boxitspace = 3pt
+%
+\long\def\boxit#1{%
+ \vbox{%
+ \ehrule
+ \hbox{%
+ \evrule
+ \kern\boxitspace
+ \vbox{\kern\boxitspace \parindent = 0pt #1\kern\boxitspace}%
+ \kern\boxitspace
+ \evrule
+ }%
+ \ehrule
+ }%
+}%
+%
+%
+% Produce the written-out form of a number.
+%
+\def\numbername#1{\ifcase#1%
+ zero%
+ \or one%
+ \or two%
+ \or three%
+ \or four%
+ \or five%
+ \or six%
+ \or seven%
+ \or eight%
+ \or nine%
+ \or ten%
+ \or #1%
+ \fi
+}%
+%
+% The following arrow macros were written by Steven Smith. See arrow.tex.
+\let\@plainnewif = \newif
+\let\@plainnewdimen = \newdimen
+\let\newif = \innernewif
+\let\newdimen = \innernewdimen
+\edef\@eplainoldandcode{\the\catcode`& }%
+\catcode`& = 11
+\toks0 = {%
+ %% [[[include arrow1]]]
+}%
+\catcode`& = 4
+\toks2 = {%
+ %% [[[include arrow2]]]
+}%
+\let\newif = \@plainnewif
+\let\newdimen = \@plainnewdimen
+\ifx\noarrow\@undefined \the\toks0 \the\toks2 \fi
+\catcode`& = \@eplainoldandcode
+%
+%
+%
+% Environments.
+%
+% Define an ``environment'': arbitrary text, enclosed by \begingroup and
+% \endgroup. But you get to label the group, so that if you forget an
+% \environment or an \endenvironment, you will probably get an error
+% message about it.
+%
+% Since the environment names appear in \errmessage arguments, it's best
+% to keep them to `letter' and `other' characters. I suppose we could
+% call \tokstostring to allow more general labels.
+%
+% These macros improve slightly on the answer to exercise 5.7 in
+% The TeXbook, by making some checks on \begingroup and \endgroup, as
+% well as just making sure \environment and \endenvironment's match.
+%
+%
+\def\environment#1{%
+ \ifx\@groupname\@undefined\else
+ % This gets invoked if we have two \environments (and no matching
+ % \endenvironment to the first) with an \endgroup in between.
+ \errhelp = \@unnamedendgrouphelp
+ \errmessage{`\@groupname' was not closed by \string\endenvironment}%
+ \fi
+ % Use \edef in case we are passed a macro that contains the name,
+ % instead of the name.
+ \edef\@groupname{#1}%
+ \begingroup
+ \let\@groupname = \@undefined
+}%
+%
+\def\endenvironment#1{%
+ \endgroup
+ \edef\@thearg{#1}%
+ \ifx\@groupname\@thearg
+ \else
+ \ifx\@groupname\@undefined
+ % Unfortunately, one gets an `extra \endgroup' message before
+ % seeing this. But we have to restore \@groupname, so I see no
+ % alternative.
+ \errhelp = \@isolatedendenvironmenthelp
+ \errmessage{Isolated \string\endenvironment\space for `#1'}%
+ \else
+ \errhelp = \@mismatchedenvironmenthelp
+ \errmessage{Environment `#1' ended, but `\@groupname' started}%
+ \endgroup % Probably a typo in the names.
+ \fi
+ \fi
+ \let\@groupname = \@undefined
+}%
+%
+\newhelp\@unnamedendgrouphelp{Most likely, you just forgot an^^J%
+ \string\endenvironment. Maybe you should try inserting another^^J%
+ \string\endgroup to recover.}%
+%
+\newhelp\@isolatedendenvironmenthelp{You ended an environment X, but^^J%
+ no \string\environment{X} to start it is anywhere in sight.^^J%
+ You might also be at an \string\endenvironment\space that would match^^J%
+ a \string\begingroup, i.e., you forgot an \string\endgroup.}%
+%
+\newhelp\@mismatchedenvironmenthelp{You started an environment named X, but^^J%
+ you ended one named Y. Maybe you made a typo in one^^J%
+ or the other of the names?}%
+%
+%
+% The above sort of environment allows nesting. But environments
+% shouldn't always be allowed to nest (like the \flushright,
+% \flushleft, and \center ones defined below). Here are some macros to
+% help deal with that.
+%
+% \checkenv goes at the beginning of a macro that is
+% going to define the environment.
+%
+\newif\ifenvironment
+\def\checkenv{\ifenvironment \errhelp = \@interwovenenvhelp
+ \errmessage{Interwoven environments}%
+ \egroup \fi
+}%
+%
+\newhelp\@interwovenenvhelp{Perhaps you forgot to end the previous^^J%
+ environment? I'm finishing off the current group,^^J%
+ hoping that will fix it.}%
+%
+%
+%
+% Mathematics displays.
+%
+% By default, TeX centers displayed material. To get left-justified
+% displays, say \leftdisplays. To go back to centered displays, say
+% \centereddisplays.
+%
+% This is based on an approach developed by Donald Arseneau,
+% asnd@triumfrg.bitnet.
+%
+\newtoks\previouseverydisplay
+% Here we want to make ordinary math displays flush left,
+% indented by the dimen \leftdisplayindent, which defaults
+% to \parindent.
+%
+% How do you want the first column aligned?
+\let\@leftleftfill\relax % as it was
+%\let\@leftleftfill\hfill % makes more sense, but could be too ugly
+%
+% Surely it makes more sense to not sum \leftdisplayindent+\parindent
+\newdimen\leftdisplayindent \leftdisplayindent=\parindent
+\newif\if@leftdisplays
+%
+\def\leftdisplays{%
+ \if@leftdisplays\else
+ \previouseverydisplay = \everydisplay
+ \everydisplay = {\the\previouseverydisplay \leftdisplaysetup}%
+ \let\@save@maybedisableeqno = \@maybedisableeqno
+ \let\@saveeqno = \eqno
+ \let\@saveleqno = \leqno
+ \let\@saveeqalignno = \eqalignno
+ \let\@saveleqalignno = \leqalignno
+ \let\@maybedisableeqno = \relax
+ \def\eqno{\hfill\textstyle\enspace}%
+ \def\leqno{%
+ \hfill
+ \hbox to0pt\bgroup
+ \kern-\displaywidth
+ % was: \kern-\displayindent % really \displayindent?
+ \kern-\leftdisplayindent % I'll use just \leftdisplayindent
+ $\aftergroup\@leftleqnoend % inserted after ending $
+ }%
+ \@redefinealignmentdisplays
+ \@leftdisplaystrue
+ \fi
+}%
+\newbox\@lignbox
+\newdimen\disprevdepth
+
+% In order to use $$ for left-aligned equation we have to
+% put something like \leftline{$\displaystyle ...$} in the
+% display. Then \eqno works basically like \hfill.
+% In order to make $$<assignments>\eqalignno{...}$$ work as
+% expected, including page breaks, we have to get rid of the
+% horizontal box, and un-vbox the alignment. Sadly, \unvbox
+% does not perform baselineskip handing, so we need to get
+% the \prevdepth ourselves...in order to get the prevdepth,
+% the outermost display must be an alignment display.
+% Therefore, an ordinary $$ a=b $$ becomes:
+% $$\halign{#\cr\noalign{\disprevdepth = \prevdepth
+% \leftline{$\displaystyle a=b$}
+% }}$$
+%
+\def\centereddisplays{%
+ % If \leftdisplays hasn't been called, don't try to restore all the
+ % stuff it changes.
+ %
+ \if@leftdisplays
+ \everydisplay = \previouseverydisplay
+ \let\@maybedisableeqno = \@save@maybedisableeqno
+ \let\eqno = \@saveeqno
+ \let\leqno = \@saveleqno
+ \let\eqalignno = \@saveeqalignno
+ \let\leqalignno = \@saveleqalignno
+ \@leftdisplaysfalse
+ \fi
+}%
+%
+\def\leftdisplaysetup{%
+% surely not this *and* \leftdisplayindent? : \dimen@ = \parindent
+ \dimen@ = \leftdisplayindent
+ \advance\dimen@ by \leftskip
+ \advance\displayindent by \dimen@
+ \advance\displaywidth by -\dimen@
+% this outermost alignment doesn't align anything.
+ \halign\bgroup##\cr \noalign\bgroup
+ \disprevdepth = \prevdepth
+ \setbox\z@ = \hbox to\displaywidth\bgroup
+ % Why strut?? \strut
+ % Why this?? \advance\hsize by -\displayindent
+ $\displaystyle
+ \aftergroup\@lefteqend % inserted after ending $
+}
+%
+\def\@lefteqend{% gets inserted between the ending $$
+ \hfil\egroup% end box 0
+ \@putdisplay}
+% gets inserted between trailing $$.
+\def\@leftleqnoend{\hss \egroup $}% end the \hbox to 0pt for \leqno, restore $
+%
+\def\@putdisplay{%
+ \ifvoid\@lignbox % Ordinary display; use it.
+ \moveright\displayindent\box\z@
+ \else % alignment display; unwrap alignment
+ \prevdepth = \dp\@lignbox % affects the skip *below*
+ \unvbox\@lignbox
+ \fi
+ \egroup\egroup % end \noalign, end outer \halign
+ $% restore first $ of trailing $$
+}
+%
+\def\@redefinealignmentdisplays{%
+ \def\displaylines##1{
+ \global\setbox\@lignbox\vbox{%
+ \prevdepth = \disprevdepth
+ \displ@y
+ \tabskip\displayindent
+ \halign{\hbox to\displaywidth
+ {$\@lign\displaystyle####\hfil$\hfil}\crcr
+ ##1\crcr}}}%
+ \def\eqalignno##1{%
+ \def\eqno{&}%
+ \global\setbox\@lignbox\vbox{%
+ \prevdepth = \disprevdepth
+ \displ@y
+ \advance\displaywidth by \displayindent
+ \tabskip\displayindent
+ \halign to\displaywidth{%
+ \hfil $\@lign\displaystyle{####}$\@leftleftfill\tabskip\z@skip
+ &$\@lign\displaystyle{{}####}$\hfil\tabskip\centering
+ &\llap{$\@lign####$}\tabskip\z@skip\crcr
+ ##1\crcr}}}%
+ \def\leqalignno##1{%
+ \def\eqno{&}%
+ \global\setbox\@lignbox\vbox{%
+ \prevdepth = \disprevdepth
+ \displ@y
+ \advance\displaywidth by \displayindent
+ \tabskip\displayindent
+ \halign to\displaywidth{%
+ \hfil $\@lign\displaystyle{####}$\@leftleftfill\tabskip\z@skip
+ &$\@lign\displaystyle{{}####}$\hfil\tabskip\centering
+ &\kern-\displaywidth
+% \showthe\displayindent \showthe\leftdisplayindent
+ \rlap{\kern\displayindent \kern-\leftdisplayindent$\@lign####$}%
+ \tabskip\displaywidth\crcr
+ ##1\crcr}}}%
+}%
+%
+% \noalign is typically used to insert a few words (`and', for example)
+% between two aligned equations. So I don't think the \noaligned
+% material should be indented. Since \noalign takes <vertical mode
+% material>, we would end up with double indentation, anyway: one
+% because we're indenting the whole display, and one at the start of the
+% <v.m.m.>. (If you want to change any of this, you can put something in
+% \@everynoalign.) So, we use this definition for \noalign in a
+% left-justified \eqalignno:
+%
+\let\@primitivenoalign = \noalign
+\newtoks\@everynoalign
+\def\@lefteqalignonoalign#1{%
+ \@primitivenoalign{%
+ % Is it right to set \leftskip=0pt first, thus perhaps making this
+ % work in lists and so forth? We just compensate for the other ways
+ % the display is indented here.
+ \advance\leftskip by -\parindent
+ \advance\leftskip by -\leftdisplayindent
+ \parskip = 0pt
+ %
+ % We use \parindent=0pt instead of \noindent because the latter
+ % starts unrestricted horizontal mode, which means the alignment
+ % we're inside will wind up being as wide as the page. When the arg
+ % is just vertical material, this is wrong. For example, using
+ % \matrix inside \eqalignno fails if \noindent is used.
+ \parindent = 0pt
+ \the\@everynoalign
+ #1%
+ }%
+}%
+%
+%
+%
+% Time macros.
+%
+% TeX sets \time, \day, \month, and \year when it begins. (And does not
+% update them as it runs!)
+%
+%
+% \monthname produces the name of the month, abbreviated to three
+% letters. The primitive \month should never be zero.
+%
+\def\monthname{%
+ \ifcase\month
+ \or Jan\or Feb\or Mar\or Apr\or May\or Jun%
+ \or Jul\or Aug\or Sep\or Oct\or Nov\or Dec%
+ \fi
+}%
+%
+% \fullmonthname is like \monthname, except it doesn't abbreviate.
+%
+\def\fullmonthname{%
+ \ifcase\month
+ \or January\or February\or March\or April\or May\or June%
+ \or July\or August\or September\or October\or November\or December%
+ \fi
+}%
+%
+% \timestring produces the current time, in a format like `1:14 p.m.'.
+%
+\def\timestring{\begingroup
+ \count0 = \time
+ \divide\count0 by 60
+ \count2 = \count0 % The hour, from zero to 23.
+ %
+ \count4 = \time
+ \multiply\count0 by 60
+ \advance\count4 by -\count0 % The minute, from zero to 59.
+ % But we need the minutes with a leading zero, if necessary.
+ \ifnum\count4<10
+ \toks1 = {0}%
+ \else
+ \toks1 = {}%
+ \fi
+ %
+ % Convert the hour into `a.m.' or `p.m.', and make it mod 12.
+ \ifnum\count2<12
+ \toks0 = {a.m.}%
+ \else
+ \toks0 = {p.m.}%
+ \advance\count2 by -12
+ \fi
+ %
+ % If it's midnight, call it `12', not `0'.
+ \ifnum\count2=0
+ \count2 = 12
+ \fi
+ %
+ % Produce the output.
+ \number\count2:\the\toks1 \number\count4 \thinspace \the\toks0
+\endgroup}%
+%
+%
+% \timestamp produces a text string for the whole thing like
+% `23 Apr 1964 1:14 p.m.'.
+%
+\def\timestamp{\number\day\space\monthname\space\number\year\quad\timestring}%
+%
+%
+% \today produces the current date, as in `23 April 1964'.
+%
+\def\today{\the\day\ \fullmonthname\ \the\year}%
+%
+%
+%
+% (Typographical) lists.
+%
+% These macros can produce numbered or unnumbered lists.
+%
+% You can change the spacing by assigning new values to these registers.
+% They are used by both kinds of lists. \listleftindent is relative to
+% the current paragraph indentation, while \listrightindent is an
+% absolute value. I do this for two reasons: (1) it is more useful, if not
+% more ``logical'', to make list indentation depend on the paragraph
+% indentation; (2) footnotes do not work if \parindent is zero, and
+% having a footnote in a list item is perfectly reasonable.
+%
+% If you change \baselineskip and want \abovelistskip and \belowlistskip
+% to retain their meanings here, you will have to reassign to them. The
+% \baselineskip here is the value at the time eplain.tex is read, i.e.,
+% 12pt (most likely).
+%
+% If the items in your lists are very long, you might want to
+% make \interitemskipamount nonzero.
+%
+\newskip\abovelistskipamount \abovelistskipamount = .5\baselineskip
+ \newcount\abovelistpenalty \abovelistpenalty = 10000
+ \def\abovelistskip{\vpenalty\abovelistpenalty \vskip\abovelistskipamount}%
+\newskip\interitemskipamount \interitemskipamount = 0pt
+ \newcount\belowlistpenalty \belowlistpenalty = -50
+ \def\belowlistskip{\vpenalty\belowlistpenalty \vskip\belowlistskipamount}%
+\newskip\belowlistskipamount \belowlistskipamount = .5\baselineskip
+ \newcount\interitempenalty \interitempenalty = 0
+ \def\interitemskip{\vpenalty\interitempenalty \vskip\interitemskipamount}%
+\newdimen\listleftindent \listleftindent = 0pt
+\newdimen\listrightindent \listrightindent = 0pt
+\let\listmarkerspace = \enspace
+%
+% To do arbitrary things at the start of each list:
+\newtoks\everylist
+%
+% If you want no space between items for a particular list
+% (perhaps because the items in it are short), you can say,
+% e.g., \numberedlist\listcompact.
+%
+\def\listcompact{\interitemskipamount = 0pt \relax}%
+%
+% This is called to set up the parameters by both sorts of lists.
+% Because we set \rightskip, we finish off the current paragraph.
+%
+\newdimen\@listindent
+%
+\def\beginlist{%
+ % Insert the space above this list, before we change \leftskip
+ % (because the \vskip in here might be what ends the paragraph).
+ \abovelistskip
+ %
+ \@listindent = \parindent
+ \advance\@listindent by \listleftindent
+ %
+ % \leftskip shifts nested lists to the right on the page.
+ \advance\leftskip by \@listindent
+ \advance\rightskip by \listrightindent
+ %
+ % We always need \itemnumber, so we can know whether an item is the
+ % first one or not.
+ \itemnumber = 1
+ %
+ \the\everylist
+}%
+%
+% A list item, for both kinds of lists.
+%
+\def\li{\@getoptionalarg\@finli}%
+\def\@finli{%
+ % Save \@optionalarg in case \interitemskip garble it.
+ \let\@lioptarg\@optionalarg
+ % Write xref definition but do not define hyperlink destination
+ % (\printitem will do it).
+ \ifx\@lioptarg\empty \else
+ \begingroup
+ \@@hldestoff
+ \expandafter\writeitemxref\expandafter{\@lioptarg}%
+ \endgroup
+ \fi
+ \ifnum\itemnumber=1 \else \interitemskip \fi
+ % Add hyperlink destination in front of \marker before doing \printitem.
+ \begingroup
+ \ifx\@lioptarg\empty \else
+ \toks@ = \expandafter{\@lioptarg}%
+ \let\li@nohldest@marker\marker
+ \edef\marker{\noexpand\hldest@impl{li}{\the\toks@}\noexpand\li@nohldest@marker}%
+ \fi
+ \printitem
+ \endgroup
+ \advance\itemnumber by 1
+ \advance\itemletter by 1
+ \advance\itemromannumeral by 1
+ %
+ % Just in case somebody creeps in with an argument or something.
+ \ignorespaces
+}%
+%
+% \writeitemxref{LABEL} writes out a definition for LABEL to be \marker
+% for the aux file.
+%
+\def\writeitemxref#1{\definexref{#1}\marker{item}}%
+%
+% \printitem is used to print items by both sorts of lists. A \par gets
+% produced before every item -- even the first one. We also want to
+% make paragraphs after the first appear to be indented -- i.e., they
+% will have double indentation. It is usually bad exposition to have
+% lists with multiparagraph items, but sometimes it is unavoidable.
+%
+\def\printitem{%
+ \par
+ \nobreak
+ \vskip-\parskip
+ \noindent
+ \printmarker\marker
+}%
+%
+% Output the list marker.
+%
+\def\printmarker#1{\llap{\marker \enspace}}%
+%
+% Common ending.
+%
+\def\endlist{\belowlistskip}%
+%
+%
+% \numberedlist produces items which are numbered sequentially, starting
+% from one. You start items with \li (`list item'). End the list with
+% \endnumberedlist.
+%
+% A nested \numberedlist produces items labelled `(a)', `(b)', etc. A
+% doubly (and deeper) nested \numberedlist labels items with `*'.
+%
+% These registers keep track of where we are.
+%
+\newcount\numberedlistdepth
+\newcount\itemnumber
+\newcount\itemletter
+\newcount\itemromannumeral
+%
+\def\numberedmarker{%
+ \ifcase\numberedlistdepth
+ (impossible)%
+ \or \printitemnumber
+ \or \printitemletter
+ \or \printitemromannumeral
+ \else *%
+ \fi
+}%
+%
+% These produce the text of the labels. We use \the\itemletter so that
+% the value will expand.
+%
+\def\printitemnumber{\number\itemnumber}%
+\def\printitemletter{\char\the\itemletter}%
+\def\printitemromannumeral{\romannumeral\itemromannumeral}%
+\def\numberedprintmarker#1{\llap{#1) \listmarkerspace}}%
+%
+\def\numberedlist{\environment{@numbered-list}%
+ % This is set back to zero by getting to the end of the group.
+ \advance\numberedlistdepth by 1
+ \itemletter = `a
+ \itemromannumeral = 1
+ \beginlist
+ \let\marker = \numberedmarker
+ \let\printmarker = \numberedprintmarker
+}%
+%
+\def\endnumberedlist{%
+ \par
+ \endenvironment{@numbered-list}%
+ \endlist
+}%
+%
+% Allow synonyms for \numberedlist.
+\let\orderedlist = \numberedlist
+\let\endorderedlist = \endnumberedlist
+%
+%
+%
+% \unorderedlist produces items which are labelled with bullets. You
+% start an item with \li, just as with numbered lists. You end the list
+% with \endunorderedlist.
+%
+% A nested \unorderedlist produces items labelled with em-dashes. A
+% doubly (and deeper) nested \unorderedlist uses `*'.
+%
+\newcount\unorderedlistdepth
+%
+\def\unorderedmarker{%
+ \ifcase\unorderedlistdepth
+ (impossible)%
+ \or \blackbox
+ \or ---%
+ \else *%
+ \fi
+}%
+\def\unorderedprintmarker#1{\llap{#1\listmarkerspace}}%
+%
+\def\unorderedlist{\environment{@unordered-list}%
+ \advance\unorderedlistdepth by 1
+ \beginlist
+ \let\marker = \unorderedmarker
+ \let\printmarker = \unorderedprintmarker
+}%
+%
+\def\endunorderedlist{%
+ \par
+ \endenvironment{@unordered-list}%
+ \endlist
+}%
+%
+%
+%
+% Verbatim listing.
+%
+% ... well, almost verbatim. We assume the font \tt has all the
+% characters that will appear. Control characters, except for tabs and
+% form feeds (and returns) won't produce anything useful. Tabs produce
+% a fixed amount of space, and form feeds produce a page break.
+%
+% This is based on Knuth's ideas in Appendix D of the TeXbook, p. 380.
+% The argument should be a filename.
+%
+% if you need to do something more for your particular fonts and/or
+% environment before the file is input, give a definition to
+% \setuplistinghook. If you want line numbers on the output, you can
+% say \let\setuplistinghook = \linenumberedlisting.
+%
+\def\listing#1{%
+ \par \begingroup
+ \@setuplisting
+ \setuplistinghook
+ \input #1
+ \endgroup
+}%
+%
+\let\setuplistinghook = \relax
+%
+\def\linenumberedlisting{%
+ \ifx\lineno\undefined \innernewcount\lineno \fi
+ \lineno = 0
+ \everypar = {\advance\lineno by 1 \printlistinglineno}%
+}%
+\def\printlistinglineno{\llap{[\the\lineno]\quad}}%
+%
+%
+% \uncatcodespecials must come before \obeywhitespace, lest a space
+% character in the input produce character 32 from the \tt font.
+% Ensure ^^L is active and non-outer.
+%
+{%
+ \makeactive\^^L
+ \let^^L = \relax
+ \gdef\@setuplisting{%
+ \uncatcodespecials
+ \obeywhitespace
+ \makeactive\`
+ \makeactive\^^I
+ \makeactive\^^L
+ \def^^L{\vfill\break}%
+ \parskip = 0pt
+ \listingfont
+ }%
+}%
+\def\listingfont{\tt}%
+%
+% Give definitions to the characters we want to be special.
+%
+% Do ` separately, so can use ` in the \catcode commands elsewhere.
+%
+{%
+ \makeactive\`
+ \gdef`{\relax\lq}% Defeat ligatures.
+}%
+{%
+ \makeactive\^^I
+ \gdef^^I{\hskip8\fontdimen2\font \relax}%
+}%
+%
+%
+% \verbatim ... |endverbatim typesets the ... in typewriter. To produce a |
+% in the ..., use ||. This macro was contributed by beebe@math.utah.edu.
+% Generalized to characters other than | by dorai@cs.rice.edu.
+%
+\def\verbatimescapechar#1{%
+ \gdef\@makeverbatimescapechar{%
+ \@makeverbatimdoubleescape #1%
+ \catcode`#1 = 0
+ }%
+}%
+\def\@makeverbatimdoubleescape#1{%
+ \catcode`#1 = \other
+ \begingroup
+ \lccode`\* = `#1%
+ \lowercase{\endgroup \ece\def*{*}}%
+}%
+\verbatimescapechar\| % initially escapechar is |
+%
+\def\verbatim{\begingroup
+ \uncatcodespecials
+ \makeactive\` % make space character a single space, not stretchable
+ \@makeverbatimescapechar
+ \tt\obeywhitespace}
+\let\endverbatim = \endgroup
+%
+%
+%
+% Table of contents, list of figures, etc.
+%
+% Entries for the table of contents are recorded in \jobname.toc, which
+% we open for writing at the first \writetocentry. Actually, we use
+% \tocfilebasename for the root of the filename to read; \jobname is
+% the default.
+%
+\def\definecontentsfile#1{%
+ \ece\innernewwrite{#1file}%
+ \ece\innernewif{if@#1fileopened}%
+ \ece\let{#1filebasename} = \jobname
+ \ece\def{open#1file}{\opencontentsfile{#1}}%
+ \ece\def{write#1entry}{\writecontentsentry{#1}}%
+ \ece\def{writenumbered#1entry}{\writenumberedcontentsentry{#1}}%
+ \ece\innernewif{ifrewrite#1file} \csname rewrite#1filetrue\endcsname
+ \ece\def{read#1file}{\readcontentsfile{#1}}%
+}%
+%
+% We provide \opentocfile, \readtocfile, etc., by default.
+\definecontentsfile{toc}%
+%
+% And `toc' is just the argument to this macro.
+\def\opencontentsfile#1{%
+ \csname if@#1fileopened\endcsname \else
+ \ece{\immediate\openout}{#1file} = \csname #1filebasename\endcsname.#1
+ \ece\global{@#1fileopenedtrue}%
+ \fi
+}%
+%
+% \writetocentry#1#2 produces a line in the .toc file that
+% looks like:
+% \toc#1entry{#2}{page number}
+% e.g.,
+% \tocchapterentry{Introduction}{2}
+% would be written by
+% \writetocentry{chapter}{Introduction}
+% if the chapter started on page two.
+%
+% Thus, #1 is intended to be something like `chapter' or `section', #2
+% to be the text of the title.
+%
+% Of course, if you want, you can \write\tocfile yourself with whatever
+% you like. In that case, you must also call \opentocfile.
+%
+% By the way, it would be wrong to put a \percentchar at the end of the
+% output line. Then, when the .toc file is read, if each line is turned
+% into a \leftline, say, there would be no legal breakpoint between the
+% boxes, and one extremely long line would result.
+%
+% `toc' is the first argument to this; \writetocentry is defined by
+% \definecontentsfile.
+\def\writecontentsentry#1#2#3{\writenumberedcontentsentry{#1}{#2}{#3}{}}%
+%
+% Sometimes you want the control sequence to take another number (e.g.,
+% a chapter number) as a parameter. (Although you can pass anything you
+% want as the third parameter, naturally.) The third parameter is
+% expanded at the point of the \writenumberedtocentry, not when the
+% \write actually happens. This makes the usual case---the third
+% parameter being \the\someregister---work.
+%
+% For example:
+% \writenumberedtocentry{chapter}{The second chapter}{2}
+% would produce:
+% \tocchapterentry{The second chapter}{2}{14}
+%
+% if the second chapter started on page 14.
+%
+% `toc' is the first argument, as above.
+\def\writenumberedcontentsentry#1#2#3#4{%
+ \csname ifrewrite#1file\endcsname
+ \csname open#1file\endcsname
+ \toks0 = {\expandafter\noexpand \csname #1#2entry\endcsname}%
+ \def\temp{#3}%
+ %
+ % Usually #4 is just `\the\register', which we want to expand. But
+ % if it's not a number at all -- e.g., if it's an author's name, we
+ % don't want to expand control sequences for accents and the like.
+ % So we play some games here.
+ \toks2 = \expandafter{#4}%
+ \edef\cs{\the\toks2}%
+ \edef\@wr{%
+ \write\csname #1file\endcsname{%
+ \the\toks0 % the \toc...entry control sequence
+ {\sanitize\temp}% the text
+ \ifx\empty\cs\else {\sanitize\cs}\fi % A secondary number, or nothing:
+ {\noexpand\folio}% the page number
+ }%
+ }%
+ \@wr
+ \fi
+ \ignorespaces
+}%
+%
+% The entries are read in when the user invokes \readtocfile (which
+% should be before the first \writetocentry). We do not open the .toc
+% file to allow reading it in twice to make a short contents or some
+% such. This should not cause any problems because each of
+% \writecontentsentry and \writenumberedcontentsentry open the .toc
+% file for writing (i.e., empty it) before trying to write to it.
+\def\readcontentsfile#1{%
+ \edef\temp{%
+ \noexpand\testfileexistence[\csname #1filebasename\endcsname]{#1}%
+ }\temp
+ \if@fileexists
+ \input \csname #1filebasename\endcsname.#1\relax
+ \fi
+}%
+%
+% Here are some sample definitions of the \toc...entry macros. Perhaps
+% you or your book designer can come up with a better way of handling
+% contents than leaders. These definitions are just examples, not
+% something you might want to actually use to print a document.
+\def\tocchapterentry#1#2{\line{\bf #1 \dotfill\ #2}}%
+\def\tocsectionentry#1#2{\line{\quad\sl #1 \dotfill\ \rm #2}}%
+\def\tocsubsectionentry#1#2{\line{\qquad\rm #1 \dotfill\ #2}}%
+%
+%
+%
+% Cross-references.
+%
+% Definitions of references are recorded in \jobname.aux, called
+% \auxfile in the macros, which btxmac.tex has opened.
+%
+% When a label isn't defined, we only want to complain if
+% \xrefwarningtrue; btxmac uses \if@citewarning for this, so we have to
+% reuse that name. We can't just say \let\ifxrefwarning =
+% \if@citewarning, since then changes to the latter won't be reflected
+% in the former. On the other hand, we have to have a true \if...
+% command, so \if's and \fi's match properly. What a mess.
+%
+\let\ifxrefwarning = \iftrue
+\def\xrefwarningtrue{\@citewarningtrue \let\ifxrefwarning = \iftrue}%
+\def\xrefwarningfalse{\@citewarningfalse \let\ifxrefwarning = \iffalse}%
+%
+%
+% \xref{foo} produces ``p.\thinspace <page#>''. \xrefn{foo} produces
+% ``<page#>''. \xrdef{foo} produces nothing, but defines the label
+% `foo' to be on the current page.
+%
+% As usual, it takes two passes to get the cross-references right. I
+% would like to check for labels being defined twice, but I don't know
+% how to do that. If the cross-reference file has been read in, many
+% cross-references will be defined that I don't want to complain about.
+% It is only if two \xrdef commands are given to the same string that I
+% want to complain. I could define a new control sequence for each
+% cross-reference, and check that, but that seems like too high of a
+% price to pay.
+%
+%
+% \xrlabel{LABEL} expands to a cross-reference internal name. We append
+% an _ character to NAME, to help avoid conflicts. And we append an `x'
+% so that we don't redefine \_ on an empty label.
+%
+\begingroup
+ % Mike Spivak's MathTime macros for Times Roman fonts changes the
+ % catcode of _ to be active. Undo that. (From adam@symcom.math.uiuc.edu.)
+ \catcode`\_ = 8
+ \gdef\xrlabel#1{#1_x}%
+\endgroup
+%
+%
+% \xrdef{LABEL} defines LABEL to be the current page number. But we
+% don't define the label here, because the page number might be off: if
+% this is not the first time through, the label would already be
+% defined, and we would redefine it with the wrong information.
+%
+\def\xrdef#1{%
+ \begingroup
+ % Define hyperlink destination.
+ \hldest@impl{xrdef}{#1}%
+ % Define cross-reference but not hyperlink destination.
+ \begingroup
+ \@@hldestoff
+ \definexref{#1}{\noexpand\folio}{page}%
+ \endgroup
+ \endgroup
+}%
+%
+% \definexref{LABEL}{DEFINITION}{CLASS} defines a cross-reference named
+% LABEL of label class CLASS to be DEFINITION. (Or LABEL can be a
+% control sequence; it's expanded to get the label text.) To get a
+% possible page number right, we have to write the definition out to the
+% auxiliary file, instead of only defining it directly.
+%
+\def\definexref#1#2#3{%
+ % Define a hyperlink destination LABEL.
+ \hldest@impl{definexref}{#1}%
+ % Remember what we're given; it might be `\@optionalarg', which
+ % \readauxfile trashes. (No loss of generality here, since \csname
+ % will fully expand the label anyway.)
+ \edef\temp{#1}%
+ %
+ % Be sure we've read the aux file before we zap it:
+ \readauxfile
+ %
+ % When we read in the aux file next time, define the label:
+ \edef\@wr{\noexpand\writeaux{\string\@definelabel{\temp}{#2}{#3}}}%
+ \@wr
+ \ignorespaces
+}%
+%
+% \@definelabel{LABEL}{DEFINITION}{CLASS} actually defines LABEL of
+% label class CLASS to be DEFINITION.
+%
+\def\@definelabel#1#2#3{%
+ % Define the control sequence.
+ \expandafter\gdef\csname\xrlabel{#1}\endcsname{#2}%
+ %
+ % Remember what kind of label this is, so \ref will know what to do.
+% \global\setproperty{\xrlabel{#1}}{class}{#3}%
+ \setpropertyglobal{\xrlabel{#1}}{class}{#3}%
+}%
+%
+% \reftie is used by several cross-referencing macros to separate
+% optional text from label reference. \refspace is used by \ref to
+% separate optional text from \CLASSword and by \xref to separate
+% optional text from `p. '.
+%
+\def\reftie{\penalty\@M \ }% Do not rely on `~' being defined as a tie.
+\let\refspace\
+%
+% Typeset a reference to the label #1. If optional argument is
+% present it will be tied with \reftie to the reference and become
+% part of the hyperlink.
+%
+\def\xrefn{\@getoptionalarg\@finxrefn}%
+\def\@finxrefn#1{%
+ % Hyperlink and optional TEXT.
+ \hlstart@impl{ref}{#1}%
+ \ifx\@optionalarg\empty \else
+ % Save \@optionalarg before it is trashed by \readauxfile.
+ \let\@xrefnoptarg\@optionalarg
+ % Read .aux file -- \@optionalarg may contain cross-references.
+ \readauxfile
+ % Typeset the \@optionalarg
+ {\@@hloff\@xrefnoptarg}\reftie
+ \fi
+ % Typeset the reference.
+ \plain@xrefn{#1}%
+ \hlend@impl{ref}%
+}%
+% This is equivalent to \xrefn but without the hyperlink stuff and the
+% optional parameter so that its expansion does not contain the many
+% \let's, \def's and such which the expansion of \xrefn contains. It
+% is needed by \eqdefn and \eqsubdefn to be able to `cleanly' write
+% texts of equation labels to .aux file. It is also used when
+% functionality of \xrefn is needed without the hyperlink and the
+% optional parameter.
+\def\plain@xrefn#1{%
+ \readauxfile
+ %
+ \expandafter \ifx\csname\xrlabel{#1}\endcsname\relax
+ \if@citewarning
+ \message{\linenumber Undefined label `#1'.}%
+ \fi
+ %
+ % Give it a dummy definition, though, to stop multiple error messages.
+ \expandafter\def\csname\xrlabel{#1}\endcsname{%
+ `{\tt
+ \escapechar = -1
+ \expandafter\string\csname#1\endcsname
+ }'%
+ }%
+ \fi
+ \csname\xrlabel{#1}\endcsname % Always produce something.
+}%
+%
+% \refn is just a synonym.
+%
+\let\refn = \xrefn
+%
+% One common case: print `p. ' before the page number.
+%
+\def\xrefpageword{p.\thinspace}%
+%
+\def\xref{\@getoptionalarg\@finxref}%
+\def\@finxref#1{%
+ % Hyperlink and optional TEXT.
+ \hlstart@impl{xref}{#1}%
+ \ifx\@optionalarg\empty \else
+ {\@@hloff\@optionalarg}\refspace
+ \fi
+ % Typeset page reference but omit hyperlink.
+ \xrefpageword\plain@xrefn{#1}%
+ \hlend@impl{xref}%
+}%
+%
+% \ref[TEXT]{LABEL} typesets TEXT, \CLASSword for LABEL's class (if it's defined)
+% and then does \refn on LABEL. But amstex also has a \ref, so tell the
+% user if they try to use \ref and have loaded amsppt.sty.
+%
+% \refs{LABEL} is similar, but puts the letter `s' after the \...word, thus
+% producing (for example) `Figures 1.2' (presumably to be followed by
+% `and~\refn{fig-1.3}').
+%
+% Note that \ref takes an optional TEXT, while \refs does not. This
+% text (together with \CLASSword) will become part of the hyperlink
+% generated by \ref. \refs does not include \CLASSword in the
+% hyperlink.
+%
+\def\@maybewarnref{%
+ \ifundefined{amsppt.sty}%
+ % No amsppt.sty, so just use ours.
+ \else
+ \message{Warning: amsppt.sty and Eplain both define \string\ref. See
+ the Eplain manual.}%
+ % Remember their definition.
+ \let\amsref = \ref
+ \fi
+ \let\ref = \eplainref
+ \ref
+}
+\let\ref = \@maybewarnref
+%
+\def\eplainref{\@getoptionalarg\@fineplainref}%
+\def\@fineplainref{\@generalref{1}{}}%
+\def\refs{\let\@optionalarg\empty \@generalref{0}s}%
+%
+% #1 is an integer flag which tells whether hyperlink should include
+% \@optionalarg and class word (non-0) or not (0). #2 is the text to
+% follow the \...word. Both #1 and #2 are supplied by the macros
+% above. #3 comes from the document, and is the LABEL.
+%
+% \reftie separates \@optionalarg or \..word from \refn; \refspace
+% separates \@optionalarg from \..word.
+%
+\def\@generalref#1#2#3{%
+ % Save \@optionalarg before it is trashed by \readauxfile.
+ \let\@generalrefoptarg\@optionalarg
+ \readauxfile
+ % Maybe start hyperlink here.
+ \ifcase#1 \else \hlstart@impl{ref}{#3}\fi
+ % Get the class of the label.
+ \edef\temp{\getproperty{\xrlabel{#3}}{class}}%
+ % If the word for this class is not defined, don't complain.
+ \expandafter\ifx\csname \temp word\endcsname\relax
+ % Produce \@optionalarg followed by a \reftie, if \@optionalarg is
+ % not empty.
+ \ifx\@generalrefoptarg\empty \else {\@@hloff\@generalrefoptarg\reftie}\fi
+ \else
+ \begingroup
+ \@@hloff
+ % Produce \@optionalarg, if not empty, followed by a \refspace.
+ \ifx\@generalrefoptarg\empty \else \@generalrefoptarg \refspace \fi
+ % Produce the word.
+ \csname \temp word\endcsname
+ % Add the suffix and then put in a \reftie before the \refn.
+ #2\reftie
+ \endgroup
+ \fi
+ % Maybe start hyperlink here.
+ \ifcase#1 \hlstart@impl{ref}{#3}\fi
+ % Typeset the reference omitting hyperlinks.
+ \plain@xrefn{#3}%
+ \hlend@impl{ref}%
+}%
+%
+%
+% References to equations are similar.
+%
+% \eqref{foo} produces ``(<text for equation label foo>)''.
+% \eqdefn{foo} advances \eqnumber, resets \eqsubnumber, and defines
+% `foo' to be the new number.
+% \eqsubdefn{foo} advances \eqsubnumber and defines `foo'. \eqref works
+% for both equations and subequations,
+% \eqdef{foo} does \eqdefn, then inserts an \eqno and \eqref.
+% \eqsubdef{foo} does \eqsubdefn, then what \eqdef does.
+%
+% The non-``sub'' macros also take an optional argument; if it's
+% present, we use it as the text for the equation label, instead of the
+% various counters.
+%
+% Because there are no page break issues with equations, we can
+% immediately define the control sequence. But we also need to write
+% the definition out, in case the user wants to forward reference an
+% equation (bad style as that may be).
+%
+% The current equation number is in \eqnumber; we just advance it by one
+% for each \eqdef. You can handle fancier equation numbers (e.g., ones
+% that include a chapter number) by redefining \eqprint, below, and
+% using your own counters. We do provide for one level of substructure,
+% since that's more painful to implement than superstructures.
+%
+\newcount\eqnumber
+\newcount\subeqnumber
+%
+%
+% \eqdefn[TEXT]{LABEL} defines LABEL to be TEXT (if it's present),
+% otherwise it advances \eqnumber and defines LABEL to be that. It
+% doesn't produce anything.
+%
+\def\eqdefn{\@getoptionalarg\@fineqdefn}%
+\def\@fineqdefn#1{%
+ \ifx\@optionalarg\empty
+ \global\advance\eqnumber by 1
+ % We call \eqconstruct here instead of in \@eqdefn because we don't
+ % want to expand it for \eqsubdefn -- \eqsubdefn already includes an
+ % \eqrefn which includes the text of the label which was \eqconstructed.
+ \def\temp{\eqconstruct{\number\eqnumber}}%
+ \else
+ % In the next \def there is (I believe) a spurious \noexpand.
+ % I leave in the old definition, albeit commented out, in case the
+ % \noexpand really _is_ necessary. But I don't thikn so. Adam Lewenberg
+% \def\temp{\noexpand\@optionalarg}%
+ \def\temp{\@optionalarg}%
+ \fi
+ %
+ % Always reset the current subequation number:
+ \global\subeqnumber = 0
+ %
+ % Remember this label, so that we can define subequations:
+ \gdef\@currenteqlabel{#1}%
+ \toks0 = \expandafter{\@currenteqlabel}%
+ %
+ % Actually do the definition, replacing \xrefn and \eqrefn with
+ % \plain@xrefn and taking precautions not to expand \plain@xrefn
+ % in what we output to the aux file. \plain@xrefn expands to many things,
+ % including \count@'s and \edef's and the expansion of \xrlabel, and
+ % it's just a real mess.
+ \begingroup
+ \def\eqrefn{\noexpand\plain@xrefn}%
+ \def\xrefn{\noexpand\plain@xrefn}%
+ \edef\temp{\noexpand\@eqdefn{\the\toks0}{\temp}}%
+ \temp
+ \endgroup
+}%
+%
+%
+% \eqsubdefn defines its argument as a ``subequation'' of the last \eqdef.
+%
+\def\eqsubdefn#1{%
+ \global\advance\subeqnumber by 1
+ \toks0 = {#1}%
+ %
+ % Get the text of the label;
+ \toks2 = \expandafter{\@currenteqlabel}%
+ %
+ % We must expand \@currenteqlabel. We have to not expand
+ % \eqsubreftext here, as well as \plain@xrefn (which we substitute
+ % for \eqrefn and \xrefn), since the first arg to \eqsubreftext
+ % could also include lots of complicated things.
+ \begingroup
+ \def\eqrefn{\noexpand\plain@xrefn}%
+ \def\xrefn{\noexpand\plain@xrefn}%
+ \def\eqsubreftext{\noexpand\eqsubreftext}%
+ \edef\temp{%
+ \noexpand\@eqdefn
+ {\the\toks0}%
+ {\eqsubreftext{\eqrefn{\the\toks2}}{\the\subeqnumber}}%
+ }%
+ \temp
+ \endgroup
+}%
+%
+% \@eqdefn{LABEL}{REF-TEXT} actually handles the equation number
+% definitions and writing to the aux file.
+%
+% In contrast to \xrdef, we define LABEL right away (as REF-TEXT). We
+% can do this since we know right now what the right equation number is.
+% This eliminates some unnecessary warning. It also lets the user put
+% \eqdef{} on all equations and have it work, since then \eqref
+% refers to the just-defined new value.
+%
+\def\@eqdefn#1#2{%
+ % Define hyperlink destination taking care of empty LABEL.
+ \hl@define@eqlabel{#1}%
+ \hldest@impl{eq}{\hl@eqlabel}%
+ % Define cross-reference but not hyperlink destination.
+ \begingroup
+ \@@hldestoff
+ \definexref{#1}{#2}{eq}%
+ \endgroup
+ % Define the LABEL.
+ \@definelabel{#1}{#2}{eq}%
+}%
+%
+% \eqdef{LABEL} defines LABEL, with \eqdefn, then prints it. We allow
+% an optional argument to explicitly specify the text which we define
+% the label as.
+%
+\def\eqdef{\@getoptionalarg\@fineqdef}%
+\def\@fineqdef{%
+ \toks0 = \expandafter{\@optionalarg}%
+ \edef\temp{\noexpand\@eqdef{\noexpand\eqdefn[\the\toks0]}}%
+ \temp
+}%
+%
+% \eqsubdef is to \eqdef as \eqsubdefn is to \eqdefn. No optional
+% argument allowed here.
+%
+\def\eqsubdef{\@eqdef\eqsubdefn}%
+%
+% \@eqdef{DEFN-CMD}{LABEL} defines LABEL, using DEFN-CMD. Then it
+% inserts an \eqno (unless it's called when an \eqno would be invalid).
+% Then it prints the newly-defined value using \eqprint.
+%
+\def\@eqdef#1#2{%
+ % Define the label but not hyperlink destination (we want to define
+ % the destination after \eqno). Note that \@eqdefn will call
+ % \hl@define@eqlabel{#2}, so we won't call it again (definintions in
+ % \hl@define@eqlabel must be global to survive past the group).
+ \begingroup
+ \@@hldestoff
+ #1{#2}%
+ \endgroup
+ % Define hyperlink destination and print the text.
+ \@maybedisableeqno
+ \eqno % \hl@define@eqlabel already called in \@eqdefn.
+ \hldest@impl{eq}{\hl@eqlabel}%
+ \let\@optionalarg\empty % \@fineqref will examine \@optionalarg.
+ {\@@hloff\@fineqref{#2}}% No hyperlink here.
+ \@mayberestoreeqno
+ \ignorespaces
+}%
+%
+%
+% If we are in an alignment or some other inner place, \eqno won't work.
+%
+\let\@mayberestoreeqno = \relax
+%
+\def\@maybedisableeqno{%
+ \ifinner
+ \global\let\eqno = \relax
+ \global\let\@mayberestoreeqno = \@restoreeqno
+ \fi
+}%
+%
+% This makes `\eqno' mean \eqno again.
+%
+\let\@primitiveeqno = \eqno
+\def\@restoreeqno{%
+ \global\let\eqno = \@primitiveeqno
+ \global\let\@mayberestoreeqno = \empty
+}%
+%
+%
+% \eqrefn[TEXT]{LABEL} produces the text for the equation label LABEL, or
+% something suitable if LABEL is undefined. (It possibly issues a
+% warning in the latter case as well.) TEXT followed by a \reftie is
+% prepended to the equation text as part of the hyperlink.
+%
+\def\eqrefn{\@getoptionalarg\@fineqrefn}%
+\def\@fineqrefn#1{%
+ \eqref@start{#1}%
+ % Typeset the equation reference but do not produce hyperlink.
+ \plain@xrefn{#1}%
+ \hlend
+}%
+%
+% \eqref[TEXT]{LABEL} is the usual way to refer to equation labels; it
+% calls \eqprint on the text of LABEL, prepending it with TEXT and a
+% \reftie as part of the hyperlink.
+%
+\def\eqref{\@getoptionalarg\@fineqref}%
+\def\@fineqref#1{%
+ \eqref@start{#1}%
+ % Typeset the equation reference but do not produce hyperlink.
+ \eqprint{\plain@xrefn{#1}}%
+ \hlend@impl{eq}%
+}%
+% Common code executed at the start of \@fineqrefn and \@fineqref.
+\def\eqref@start#1{%
+ % Save \@optionalarg in case \phantomeqlabel is redefined by the
+ % user to something that trashes it.
+ \let\@eqrefoptarg\@optionalarg
+ % Hyperlink (fetch last `phantom' equation label if LABEL is empty).
+ \ifempty{#1}%
+ \hlstart@impl{eq}{\phantomeqlabel}%
+ \else
+ \hlstart@impl{eq}{#1}%
+ \fi
+ % Optional TEXT followed by a \reftie.
+ \ifx\@eqrefoptarg\empty \else
+ {\@@hloff\@eqrefoptarg\reftie}%
+ \fi
+}%
+%
+%
+% \eqconstruct{EQ-TEXT} constructs an equation number, i.e., the text to
+% be defined as the value of a label.
+%
+\let\eqconstruct = \identity
+%
+% \eqprint{EQ-TEXT} produces the typeset equation number EQ-TEXT.
+%
+\def\eqprint#1{(#1)}%
+%
+% \eqsubreftext{EQ-TEXT}{SUBEQ-TEXT} produces the text of a subequation
+% reference. (\eqprint is later called on the result of this to produce
+% output for subequations; I didn't define any \subeqprint.)
+%
+\def\eqsubreftext#1#2{#1.#2}%
+%
+%
+%
+% Indexing.
+%
+% \defineindex{PREFIX} defines an index with ``prefix'' PREFIX. The
+% prefix is used to construct the output filename and the various
+% commands. We just define all the index commands for this index to
+% call the general commands with PREFIX.
+%
+\let\extraidxcmdsuffixes = \empty
+%
+\outer\def\defineindex#1{%
+ \def\@idxprefix{#1}%
+ %
+ % Define the indexing commands for this prefix.
+ \for\@idxcmd:=,marked,submarked,name%
+ \extraidxcmdsuffixes\do
+ {%
+ \@defineindexcmd\@idxcmd
+ }%
+ %
+ % Allocate a stream for the output.
+ \ece\innernewwrite{@#1indexfile}%
+ %
+ % And a conditional to test whether we've opened the file.
+ \ece\innernewif{if@#1indexfileopened}%
+}%
+%
+%
+% \@defineindexcmd{SUFFIX} defines both silent and non-silent index
+% command for prefix \@idxprefix with suffix SUFFIX. That is, we define
+% both `\@idxprefix dxSUFFIX' and `\s\@idxprefix dxSUFFIX' to call the
+% corresponding generic command with \@idxprefix. \silentindexentry is
+% used to decide whether we should ignore following spaces.
+%
+\newif\ifsilentindexentry
+%
+\def\@defineindexcmd#1{%
+ \@defineoneindexcmd{s}{#1}\silentindexentrytrue
+ \@defineoneindexcmd{}{#1}\silentindexentryfalse
+}%
+%
+%
+% \@defineoneindexcmd{PREFIX}{SUFFIX}{PRECALL} does just one silent or
+% non-silent commands. We define the command `\@@PREFIXidxSUFFIX' to do
+% PRECALL, then define \@idxprefix, then call \@idxgetrange with an
+% argument of `\@@{,s}idxSUFFIX'. (So far every indexing command
+% should allow a range. If not, you could redefine `\@@{,s}idxSUFFIX'
+% after this macro is called.)
+%
+\def\@defineoneindexcmd#1#2#3{%
+ \toks@ = {#3}%
+ \edef\temp{%
+ \def
+ % We have to restrict expansion because the generic (\@@...)
+ % commands will be defined after the first call to \defineindex.
+ % Not expanding the user (\idx...) commands is unnecessary unless
+ % the user has defined some new commands, but may as well be cautious.
+ \expandonce\csname#1\@idxprefix dx#2\endcsname % e.g., \idx or \sidxname.
+ {\def\noexpand\@idxprefix{\@idxprefix}% define \@idxprefix
+ % call, e.g., \@@idx or \@@sidxname:
+ \expandonce\csname @@#1idx#2\endcsname
+ }%
+ \def
+ \expandonce\csname @@#1idx#2\endcsname{% e.g., \@@idx
+ % First do PRECALL.
+ \the\toks@
+ % Then call \@idxgetrange with, e.g., \@idx or \@sidxname as its arg.
+ \noexpand\@idxgetrange\expandonce\csname @#1idx#2\endcsname
+ }%
+ }%
+ \temp
+}%
+%
+%
+% \@idxwrite{TERM}{PAGENO} writes a general index entry for TERM on page
+% PAGENO to the index file `\@idxprefix indexfile'. We open the stream
+% as `\indexfilebasename.\@idxprefix dx' if it isn't already open.
+%
+\let\indexfilebasename = \jobname
+%
+\def\@idxwrite#1#2{%
+ % Be sure the file is opened.
+ \csname if@\@idxprefix indexfileopened\endcsname \else
+ \expandafter\immediate\openout\csname @\@idxprefix indexfile\endcsname =
+ \indexfilebasename.\@idxprefix dx
+ \expandafter\global\csname @\@idxprefix indexfileopenedtrue\endcsname
+ \fi
+ %
+ % Save the index term.
+ \def\temp{#1}%
+ %
+ % Write the index term and page number.
+ \edef\@wr{%
+ \expandafter\write\csname @\@idxprefix indexfile\endcsname{%
+ \string\indexentry
+ {\sanitize\temp}%
+ {\noexpand#2}%
+ }%
+ }%
+ \@wr
+ %
+ % Marginalize the index term, if desired.
+ % (the \allowhyphens allows `infinitesimal' in \sidx{Infinitesimal}infinitesimal
+ % to be hyphenated.
+ \ifindexproofing \insert\@indexproof{\indexproofterm{#1}}\allowhyphens\fi
+ %
+ % We just appended at least one non-discardable item (namely, the
+ % whatsit from the \write) to the current list. So in case glue comes
+ % next (not unlikely), be sure we don't inadvertently make that glue a
+ % valid breakpoint, if it wouldn't have been without us.
+ \hookrun{afterindexterm}%
+ %
+ % This is the end of the index entry processing. If this was a silent
+ % entry, ignore following spaces.
+ \ifsilentindexentry \expandafter\ignorespaces\fi
+}%
+%
+%
+% If this conditional is true, we output the index terms on the page
+% where they occur.
+\newif\ifindexproofing
+%
+% We need a new insertion class to collect the proofed terms.
+\newinsert\@indexproof
+\dimen\@indexproof = \maxdimen % No limit on number of terms.
+\count\@indexproof = 0 \skip\@indexproof = 0pt % They take up no space.
+%
+% This actually typesets the proofed term. We don't go to any lengths
+% to provide nice-looking output; since the term might have all kinds of
+% weird characters in it, we just dump it in the smallest standard
+% Computer Modern typewriter font.
+%
+% We put the term in an \hbox, even though that might make the output
+% run off the page, since we don't really need to see all of it, and
+% I think it's better to opt for simplicity -- one term per line.
+\font\indexprooffont = cmtt8
+\def\indexproofterm#1{\hbox{\strut \indexprooffont #1}}%
+%
+%
+% If \output doesn't use \makeheadline, or redefines it, it's up to the
+% new \output to define index hyperlink destination and to call
+% \indexproofunbox.
+\let\@plainmakeheadline = \makeheadline
+\def\makeheadline{%
+ % Define index page destination only when this `cross-reference' is defined.
+ \expandafter\ifx\csname\xrlabel{\idxpagexref{\folio}}\endcsname\relax \else
+ % Say \@@hldeston in case a page break happened at an unfortunate
+ % time when user said \hldestoff.
+ {\@@hldeston \hldest@impl{idx}{\hlidxpagelabel{\folio}}}%
+ \fi
+ \indexproofunbox
+ \@plainmakeheadline
+}%
+%
+% We want to put the proof index terms in the margin, outside the
+% printed area. So if \outsidemargin (for odd pages) and \insidemargin
+% (for even pages) are undefined, we define them (both) to be the default
+% TeX margin -- one inch + \hoffset.
+\def\indexsetmargins{%
+ \ifx\undefined\outsidemargin
+ \dimen@ = 1truein
+ \advance\dimen@ by \hoffset
+ \edef\outsidemargin{\the\dimen@}%
+ \let\insidemargin = \outsidemargin
+ \fi
+}%
+%
+% We always put the terms in the right-hand margin, so long terms run
+% off the page, instead of into the text.
+\def\indexproofunbox{%
+ \ifvoid\@indexproof\else
+ \indexsetmargins
+ \rlap{%
+ \kern\hsize
+ \ifodd\pageno \kern\outsidemargin \else \kern\insidemargin \fi
+ \vbox to 0pt{\unvbox\@indexproof\vss}%
+ }\nointerlineskip
+ \fi
+}%
+%
+%
+% \@idxgetrange\CS parses an optional argument which, if present, should
+% be either `begin' or `end', marking the beginning or ending of a range
+% for the index entry. If we find this, we set the appropriate one of
+% \@idxrangestr. Then we call \CS.
+%
+% If the optional argument is `see' or `seealso' we read another
+% argument, namely, the entry to see.
+%
+\def\idxrangebeginword{begin}%
+\def\idxbeginrangemark{(}% the corresponding magic char to go in the idx file
+%
+\def\idxrangeendword{end}%
+\def\idxendrangemark{)}%
+%
+\def\idxseecmdword{see}%
+\def\idxseealsocmdword{seealso}%
+\newif\if@idxsee
+\newif\if@hlidxencap
+\let\@idxseenterm = \relax
+%
+\def\idxpagemarkupcmdword{pagemarkup}%
+\let\@idxpagemarkup = \relax
+%
+\def\@idxgetrange#1{%
+ \let\@idxrangestr = \empty
+ \let\@afteridxgetrange = #1%
+ \@getoptionalarg\@finidxgetopt
+}%
+\def\@finidxgetopt{%
+ \@hlidxencaptrue
+ %
+ \for\@idxarg:=\@optionalarg\do{%
+ % These are ordered by my guess at frequency of use.
+ \expandafter\@idxcheckpagemarkup\@idxarg=,%
+ %
+ \ifx\@idxarg\idxrangebeginword
+ \def\@idxrangestr{\idxencapoperator\idxbeginrangemark}%
+ \else
+ \ifx\@idxarg\idxrangeendword
+ \def\@idxrangestr{\idxencapoperator\idxendrangemark}%
+ \@hlidxencapfalse
+ \else
+ \ifx\@idxarg\idxseecmdword
+ \def\@idxpagemarkup{indexsee}%
+ \@idxseetrue
+ \@hlidxencapfalse
+ \else
+ \ifx\@idxarg\idxseealsocmdword
+ \def\@idxpagemarkup{indexseealso}%
+ \@idxseetrue
+ \@hlidxencapfalse
+ \else
+ \ifx\@idxpagemarkup\relax
+ \errmessage{Unrecognized index option `\@idxarg'}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ }%
+ % Stick hyperlink encapsulator into \@idxpagemarkup.
+ \ifnum\hldest@place@idx < 0 \else
+ \if@hlidxencap
+ \ifx\@idxpagemarkup\relax
+ % Even when user gives no pagemarkup command, we still do
+ % insert our hyperlink encapsulator.
+ \let\@idxpagemarkup\empty
+ \fi
+ \ifcase\hldest@place@idx \relax
+ % \hldest@place@idx = 0, dests point to a page with a term.
+ \edef\@idxpagemarkup{hlidxpage{\@idxpagemarkup}}%
+ % We want to define index \hldest's only on those
+ % pages which contain at least one index term, so this
+ % `cross-reference' will tell \makeheadline on which pages to
+ % generate an \hldest.
+ {\@@hldestoff \definexref{\idxpagexref{\folio}}{}{}}%
+ \else
+ % \hldest@place@idx = 1, dests point to exact location of a term.
+ \global\advance\hlidxlabelnumber by 1
+ \edef\@idxpagemarkup{hlidx{\hlidxlabel}{\@idxpagemarkup}}%
+ \hldest@impl{idx}{\hlidxlabel}%
+ \fi
+ \fi
+ \fi
+ %
+ \@afteridxgetrange
+}%
+%
+%
+% Check for a command of the form `pagemarkup=\cmd', and if found, set
+% \@idxpagemarkup to `cmd'.
+%
+\def\@idxcheckpagemarkup#1=#2,{%
+ \def\temp{#1}%
+ \ifx\temp\idxpagemarkupcmdword
+ \if ,#2, % If #2 is empty, complain.
+ \errmessage{Missing markup command to `pagemarkup'}%
+ \else
+ % Remove a trailing =.
+ \def\temp##1={##1}%
+ \edef\@idxpagemarkup{\temp\string#2}%
+ \fi
+ \fi
+}%
+%
+%
+% \hlidxpage and \hlidx are hyperlink encapsulators for the two types
+% of hyperlink destinations for index terms.
+%
+% \hldest@place@idx defines which type is selected. When defined to 0,
+% we generate destinations pointing to the page on which the indexed
+% term is located. When defined to 1, we generate destinations
+% pointing to exact location of the indexed term. When negative, we
+% generate no hyperlinks / destinations.
+\def\hldest@place@idx{-1}%
+% Name for a `cross-reference' which \makeheadline uses do decide on
+% which pages to generate \hldest.
+\def\idxpagexref#1{@@IDXPG@@#1}%
+% Hyperlink labels for both types of destinations.
+\newcount\hlidxlabelnumber
+\def\hlidxlabel{IDX\the\hlidxlabelnumber}%
+\def\hlidxpagelabel#1{IDXPG#1}%
+%
+% \hlidx{HYPERLINK-LABEL}{PAGEENCAP}{PAGESPEC}
+\def\hlidx#1#2#3{%
+ \hlstart@impl{idx}{#1}%
+ \csname #2\endcsname{#3}%
+ \hlend@impl{idx}%
+}%
+%
+% \hlidxpage{PAGEENCAP}{PAGESPEC}
+%
+% We expect PAGESPEC to be one of the following:
+% 14 (single page number)
+% 14, 15 (list of two consecutive page numbers)
+% 14--15 (page range)
+%
+% If you configure MakeIndex to use different page list separator
+% (delim_n parameter in .mst file) / different page range separator
+% (delim_r parameter), you should call \setidxpagelistdelimiter /
+% \setidxpagerangedelimiter to setup the new separators.
+%
+% In case of a single page number, we call \PAGEENCAP on the page
+% number and turn the result into a hyperlink.
+%
+% In case of a two-page list, we break the list, call \PAGEENCAP on
+% each of the page numbers separately, and turn each result into a
+% hyperlink, producing page list separator between the page numbers.
+%
+% In case of a page range, we do not break the range, call \PAGEENCAP
+% on the entire range and turn what results into a hyperlink for the
+% first of the page numbers.
+\def\hlidxpage#1#2{%
+ % Set \@idxpagei[i][ref] and \@idxpagesep
+ \@hlidxgetpages{#2}%
+ % Alias for \PAGEENCAP.
+ \expandafter\let\expandafter\@idxpageencap\csname #1\endcsname
+ % Now comes the first part, to be done in any of the three cases.
+ \hlstart@impl{idx}{\hlidxpagelabel{\@idxpageiref}}%
+ \expandafter\@idxpageencap\expandafter{\@idxpagei}%
+ \hlend@impl{idx}%
+ % The second part, to be done only if there is a second page number.
+ \ifx\@idxpageii\empty \else
+ \@idxpagesep
+ \hlstart@impl{idx}{\hlidxpagelabel{\@idxpageiiref}}%
+ \expandafter\@idxpageencap\expandafter{\@idxpageii}%
+ \hlend@impl{idx}%
+ \fi
+}%
+%
+% This macro parses PAGESPEC parameter to \hlidxpage. It sets
+% \@idxpagei to the first page number, \@idxpageii to the second (if
+% present; if not, \@idxpageii will be set to \empty). For the first
+% page number, use \@idxpageiref to construct hyperlink label; for
+% the second page number, use \@idxpageiiref. Use \@idxpagesep to
+% separate the two page numbers.
+%
+% NOTE: we use \@idxpagei[i], not \idxpagei[i], because the user may
+% use \idxparselist / \idxparserange in his \PAGEENCAP, in which case
+% our \idxpagei[i]'s will get garbled.
+\def\@hlidxgetpages#1{%
+ % Try to parse a two-page list.
+ \idxparselist{#1}%
+ \ifx\idxpagei\empty
+ % It is not a two-page list, try page range.
+ \idxparserange{#1}%
+ \ifx\idxpagei\empty
+ % It is neither a two-page list nor a page range, so we assume
+ % it is a single page number.
+ \def\@idxpageiref{#1}% Label for \hlstart.
+ \else
+ % It is a page range.
+ \let\@idxpageiref\idxpagei % Label for \hlstart.
+ \fi
+ \def\@idxpagei{#1}%
+ \let\@idxpageii\empty
+ \else
+ % It is a two-page list.
+ \let\@idxpagei\idxpagei
+ \let\@idxpageii\idxpageii
+ \let\@idxpageiref\idxpagei % Label for \hlstart.
+ \let\@idxpageiiref\idxpageii % Label for \hlstart.
+ \let\@idxpagesep\idxpagelistdelimiter
+ \fi
+}%
+%
+% Set up a macro \@idxparselist and user-accessible \idxparselist for
+% parsing two-page list. Takes list separator (which is saved in
+% \idxpagelistdelimiter). If the list is found, \@idxparselist will
+% set \idxpagei to the first page number, \idxpageii to the second;
+% if not found, it will set \idxpagei to \empty (this implies that
+% the list's first page number should never be empty).
+\def\setidxpagelistdelimiter#1{%
+ \gdef\idxpagelistdelimiter{#1}%
+ \gdef\@removepagelistdelimiter##1#1{##1}%
+ \gdef\@idxparselist##1#1##2\@@{%
+ \ifempty{##2}%
+ \let\idxpagei\empty
+ \else
+ \def\idxpagei{##1}%
+ \edef\idxpageii{\@removepagelistdelimiter##2}%
+ \fi
+ }%
+ \gdef\idxparselist##1{\@idxparselist##1#1\@@}%
+}%
+%
+% Same as previous, but \@idxparserange and \idxparserange will parse
+% page range, range separator is saved in \idxpagerangedelimiter.
+\def\setidxpagerangedelimiter#1{%
+ \gdef\idxpagerangedelimiter{#1}%
+ \gdef\@removepagerangedelimiter##1#1{##1}%
+ \gdef\@idxparserange##1#1##2\@@{%
+ \ifempty{##2}%
+ \let\idxpagei\empty
+ \else
+ \def\idxpagei{##1}%
+ \edef\idxpageii{\@removepagerangedelimiter##2}%
+ \fi
+ }%
+ \gdef\idxparserange##1{\@idxparserange##1#1\@@}%
+}%
+%
+% Set up the default delimiters.
+\setidxpagelistdelimiter{, }%
+\setidxpagerangedelimiter{--}%
+%
+%
+% \@idxtokscollect uses \@idxmaintoks as the token list for the main
+% part of an index entry and \@idxsubtoks for the subpart. Then it
+% calls \@idxwrite.
+%
+\def\idxsubentryseparator{!}%
+\def\idxencapoperator{|}%
+\def\idxmaxpagenum{99999}%
+%
+\newtoks\@idxmaintoks
+\newtoks\@idxsubtoks
+%
+\def\@idxtokscollect{%
+ % Remember the subentry.
+ \edef\temp{\the\@idxsubtoks}%
+ %
+ % We want to expand the conditions, but not the terms. The index
+ % entry starts simply with \@idxmaintoks and \@idxsubtoks.
+ \edef\@indexentry{%
+ \the\@idxmaintoks
+ \ifx\temp\empty\else \idxsubentryseparator\the\@idxsubtoks \fi
+ \@idxrangestr
+ }%
+ %
+ % If this is a `see' or `see also' entry, we need to read one more
+ % arg. We use a giant page number so the entry will be last (for the
+ % benefit of `see also's). MakeIndex rejects page numbers >=1000.
+ %
+ \if@idxsee
+ \@idxseefalse % Reset so the next term won't be a `see'.
+ \edef\temp{\noexpand\@finidxtokscollect{\idxmaxpagenum}}%
+ \else
+ \def\temp{\@finfinidxtokscollect\folio}%
+ \fi
+ \temp
+}%
+%
+%
+% \@finidxtokscollect{PAGENO}{REAL-TERM} reads the final term for
+% see/see also entries. We do not check if the person has put both a
+% range and a see in the same index term (which will confuse makeindex).
+%
+\def\@finidxtokscollect#1#2{%
+ \def\@idxseenterm{#2}%
+ \@finfinidxtokscollect{#1}%
+}%
+%
+% \@finfinidxtokscollect{PAGENO} writes \@indexentry for page PAGENO.
+% Besides \@indexentry, if \@idxpagemarkup is not \relax we output an
+% index entry \@indexentry|\@idxpagemarkup{PAGENO} (but omitting | if
+% this is a range term, because in that case | will have been added
+% together with \@idxrangestr in \@idxtokscollect). And if
+% \@idxseenterm is not \relax we output {\@idxseenterm} after the
+% \@idxpagemarkup. (This will become an argument to the ``markup''
+% command, which will be \indexsee or \indexseealso.)
+%
+\def\@finfinidxtokscollect#1{%
+ % If we've got a page markup command, append it.
+ \ifx\@idxpagemarkup\relax \else
+ \toks@ = \expandafter{\@indexentry}%
+ \edef\@indexentry{%
+ \the\toks@
+ % Add | only if this is not a range term, otherwise | has
+ % already been added with \@idxrangestr by \@idxtokscollect.
+ \ifx\@idxrangestr\empty \idxencapoperator \fi
+ \@idxpagemarkup
+ }%
+ \let\@idxpagemarkup = \relax
+ \fi
+ %
+ % If we've got an argument to the ``page markup'' command, append it.
+ \ifx\@idxseenterm\relax \else
+ \toks@ = \expandafter{\@indexentry}%
+ \edef\@indexentry{\the\toks@{\sanitize\@idxseenterm}}%
+ \let\@idxseenterm = \relax
+ \fi
+ %
+ % Finally, write what we've constructed.
+ \expandafter\@idxwrite\expandafter{\@indexentry}{#1}%
+}%
+%
+%
+% \@idxcollect{MAIN}{SUB} sets up the token registers
+% \@idx{main,sub}toks, then calls \@idxtokscollect. This is convenient
+% for some of the macros below.
+%
+\def\@idxcollect#1#2{%
+ \@idxmaintoks = {#1}%
+ \@idxsubtoks = {#2}%
+ \@idxtokscollect
+}%
+%
+%
+% Following are the TeX macros that correspond to the commands
+% that actually appear in the document.
+%
+% \@idx{TERM} produces TERM in the output and then makes the index entry
+% for TERM as usual. We don't allow a [SUBTERM] here since then we
+% would lose spaces after the command, which would be very inconvenient.
+%
+% As with all our index commands, we've already defined \@idxprefix (in
+% \idx or whatever), to save passing it around, and we've looked for a
+% range argument before TERM.
+%
+\def\@idx#1{%
+ #1% Produce TERM as output.
+ \@idxcollect{#1}{}%
+}%
+%
+% \@sidx{TERM}[SUBTERM] produces an index entry TERM and no output. If
+% SUBTERM is present, this is a subentry. (At the moment, I don't
+% provide for subsubentries, since I've never needed that.)
+%
+\def\@sidx#1{\@idxmaintoks = {#1}\@getoptionalarg\@finsidx}%
+\def\@finsidx{%
+ \@idxsubtoks = \expandafter{\@optionalarg}%
+ \@idxtokscollect
+}%
+%
+%
+% \@idxconstructmarked{TOKS-REG}\CS{TERM}
+%
+\def\idxsortkeysep{@}% This `@' is catcode 11, but it doesn't matter.
+%
+\def\@idxconstructmarked#1#2#3{%
+ \toks@ = {#2}% The control sequence.
+ \toks2 = {#3}% The term.
+ %
+ % Construct TERM@\CS{TERM} as the string to write.
+ \edef\temp{\the\toks2 \idxsortkeysep \the\toks@{\the\toks2}}%
+ %
+ % Save it in TOKS-REG.
+ #1 = \expandafter{\temp}%
+}%
+%
+%
+% \@idxmarked\CS{TERM} outputs \CS{TERM} and then calls the main part of
+% \@sidxmarked.
+%
+\def\@idxmarked#1#2{%
+ #1{#2}% Produce \CS{TERM} as output.
+ \@idxconstructmarked\@idxmaintoks{#1}{#2}%
+ \@idxsubtoks = {}%
+ \@idxtokscollect
+}%
+%
+% \@sidxmarked\CS{TERM}[SUBTERM] outputs an index entry sorted by TERM
+% but producing \CS{TERM}.
+%
+\def\@sidxmarked#1#2{%
+ \@idxconstructmarked\toks@{#1}{#2}%
+ \edef\temp{{\the\toks@}}%
+ \expandafter\@sidx\temp
+}%
+%
+%
+% \@idxsubmarked{TERM}\CS{SUBTERM} is like \@idxmarked, except that it's
+% SUBTERM that's marked instead of TERM.
+%
+\def\@idxsubmarked#1#2#3{%
+ #1 #2{#3}% produce `TERM \CS{SUBTERM} as output.
+ \@sidxsubmarked{#1}{#2}{#3}%
+}%
+%
+% \@sidxsubmarked{TERM}\CS{SUBTERM} is to \@sidxmarked as \@idxsubmarked
+% is to \@idxmarked.
+%
+\def\@sidxsubmarked#1#2#3{%
+ \@idxmaintoks = {#1}%
+ \@idxconstructmarked\@idxsubtoks{#2}{#3}%
+ \@idxtokscollect
+}%
+%
+%
+% \@idxcollectname{FIRST}{LAST} puts `LAST, FIRST' into \temp. (Well,
+% we use \idxnameseparator instead of hardwiring `, '.) If FIRST is
+% empty, don't include the separator.
+%
+\def\idxnameseparator{, }% as in `Tachikawa, Elizabeth'
+%
+\def\@idxcollectname#1#2{%
+ \def\temp{#1}%
+ \ifx\temp\empty
+ \toks@ = {}%
+ \else
+ \toks@ = {\idxnameseparator #1}%
+ \fi
+ \toks2 = {#2}%
+ %
+ \edef\temp{\the\toks2 \the\toks@}%
+}%
+%
+%
+% \@idxname{FIRST}{LAST} also produces `FIRST LAST' in the output and an
+% index entry for `LAST, FIRST'.
+%
+\def\@idxname#1#2{%
+ #1 #2% Separate the names by a space in the output.
+ \@idxcollectname{#1}{#2}%
+ \expandafter\@idxcollect\expandafter{\temp}{}%
+}%
+%
+% \@sidxname{FIRST}{LAST}[SUBTERM] is to \@sidx as \@idxname is to
+% \@idx.
+%
+\def\@sidxname#1#2{%
+ \@idxcollectname{#1}{#2}%
+ \expandafter\@sidx\expandafter{\temp}%
+}%
+%
+%
+% Now we come to actually producing the index, i.e., implementing the
+% formatting commands that MakeIndex outputs.
+%
+% \readindexfile is responsible for formatting and printing the index.
+% It reads \indexfilebasename.ind. We implement the same commands that
+% LaTeX does. I suppose we could allow for different indices having
+% different basenames, but I can't imagine when that would be useful.
+%
+\let\indexfonts = \relax
+%
+\def\readindexfile#1{%
+ \edef\@idxprefix{#1}%
+ %
+ % Does the output file exist?
+ \testfileexistence[\indexfilebasename]{\@idxprefix nd}%
+ \iffileexists \begingroup
+ % If no \begin or \end, define them. The argument will be `{theindex}'.
+ \ifx\begin\undefined
+ \def\begin##1{\@beginindex}%
+ \let\end = \@gobble
+ \fi
+ %
+ % Read the file:
+ \input \indexfilebasename.\@idxprefix nd
+ %
+ % \doublecolumns isn't affected by groups.
+ \singlecolumn
+ \endgroup
+ \else
+ \message{No index file \indexfilebasename.\@idxprefix nd.}%
+ \fi
+}%
+%
+% Here's the default for `\begin{theindex}', if \begin isn't defined.
+\def\@beginindex{%
+ % Define the commands MakeIndex outputs.
+ \let\item = \@indexitem
+ \let\subitem = \@indexsubitem
+ \let\subsubitem = \@indexsubsubitem
+ %
+ % Set up the default formatting:
+ \indexfonts
+ \doublecolumns
+ \parindent = 0pt
+ %
+ % Let the user override the defaults.
+ \hookrun{beginindex}%
+}%
+%
+% MakeIndex puts \indexspace between groups in the ind file.
+\let\indexspace = \bigbreak
+%
+% You can make \afterindexterm appear after the term and before the
+% first page with the following in the ist file:
+% delim_0 "\\afterindexterm "
+% delim_1 "\\afterindexterm "
+% delim_2 "\\afterindexterm "
+\let\afterindexterm = \quad
+%
+%
+% Top-level index entries start with \item.
+\newskip\aboveindexitemskipamount \aboveindexitemskipamount = 0pt plus2pt
+\def\aboveindexitemskip{\vskip\aboveindexitemskipamount}%
+%
+\def\@indexitem{\begingroup
+ \@indexitemsetup
+ \leftskip = 0pt
+ \aboveindexitemskip
+ \penalty-100 % Encourage page breaks before items.
+ %
+ % But forbid page breaks after items, in case a subitem follows.
+ \def\par{\endgraf\endgroup\nobreak}%
+}%
+%
+% Secondary index entries.
+\def\@indexsubitem{%
+ \@indexitemsetup
+ \leftskip = 1em
+}%
+%
+% And tertiary entries.
+\def\@indexsubsubitem{%
+ \@indexitemsetup
+ \leftskip = 2em
+}%
+%
+% Common setup for the formatting.
+\def\@indexitemsetup{%
+ \par
+ \hangindent = 1em
+ \raggedright
+ \hyphenpenalty = 10000
+ \hookrun{indexitem}%
+}%
+%
+%
+% \indexsee{TERM}{PAGENO} ignores PAGENO, and says `see TERM'.
+\def\seevariant{\it}%
+\def\indexseeword{see}%
+\def\indexsee#1#2{{\seevariant \indexseeword\/ }#1}%
+%
+% \indexseealso{TERM}{PAGENO} is similar.
+\def\indexseealsowords{see also}%
+\def\indexseealso#1#2{{\seevariant \indexseealsowords\/ }#1}%
+%
+%
+% We provide one index by default; commands are \idx, \sidx, etc.
+\defineindex{i}%
+%
+%
+%
+% Justification of multiple input lines.
+%
+% You use these by saying
+% {\flushright
+% <flush right text>
+% }
+%
+% and similarly for \flushleft and \center. The command must be
+% embedded in a group. The lines are set in paragraphs as usual, i.e.,
+% blank lines start a new paragraph (by virtue of the
+% \blanklineskipamount vertical glue being inserted).
+%
+% \environment ... \endenvironment isn't appropriate in this case, since
+% these ``environments'' can't be nested.
+%
+\begingroup
+ \catcode `\^^M = \active %
+ \gdef\flushleft{%
+ \def\@endjustifycmd{\@endflushleft}%
+ \def\@eoljustifyaction{\null\hfil\break}%
+ \let\@firstlinejustifyaction = \relax
+ \@startjustify %
+ }%
+ \gdef\flushright{%
+ \def\@endjustifycmd{\@endflushright}%
+ \def\@eoljustifyaction{\break\null\hfil}%
+ \def\@firstlinejustifyaction{\hfil\null}%
+ \@startjustify %
+ }%
+ \gdef\center{%
+ \def\@endjustifycmd{\@endcenter}%
+ \def\@eoljustifyaction{\hfil\break\null\hfil}%
+ \def\@firstlinejustifyaction{\hfil\null}%
+ \@startjustify %
+ }%
+ %
+ % We do this before starting any of the justification commands.
+ \gdef\@startjustify{%
+ \parskip = 0pt
+ \catcode`\^^M = \active %
+ \def^^M{\futurelet\next\@finjustifyreturn}%
+ %
+ % \@eateol is called at the beginning of each justified paragraph.
+ \def\@eateol##1^^M{%
+ \def\temp{##1}%
+ \@firstlinejustifyaction %
+ \ifx\temp\empty\else \temp^^M\fi %
+ }%
+ \expandafter\aftergroup\@endjustifycmd %
+ \checkenv \environmenttrue %
+ \par\noindent %
+ \@eateol %
+ }%
+ %
+ % If the next thing is a ^^M, insert \blanklineskipamount glue. Then
+ % do \@eoljustifyaction (which each justification command defines).
+ \gdef\@finjustifyreturn{%
+ \@eoljustifyaction %
+ \ifx\next^^M%
+ % Insert extra glue when the \@end... command does the \par.
+ \def\par{\endgraf\vskip\blanklineskipamount \global\let\par = \endgraf}%
+ \@endjustifycmd %
+ % Get back into horizontal mode for the next line.
+ \noindent %
+ \@firstlinejustifyaction %
+ \fi %
+ }%
+\endgroup
+%
+\def\@endflushleft{\unpenalty{\parfillskip = 0pt plus1fil\par}\ignorespaces}%
+\def\@endflushright{% Remove the \hfil\null\break we just put on.
+ \unskip \setbox0=\lastbox \unpenalty
+ % We have fil glue at the left of the line; \parfillskip shouldn't
+ % affect that.
+ {\parfillskip = 0pt \par}\ignorespaces
+}%
+\def\@endcenter{% Remove the \hfil\null\break we just put on.
+ \unskip \setbox0=\lastbox \unpenalty
+ % We have fil glue at the left of the line; \parfillskip must balance it.
+ {\parfillskip = 0pt plus1fil \par}\ignorespaces
+}%
+%
+%
+%
+% Automatically-columnated tables.
+%
+% \makecolumns N/K: organizes the entries on the following N lines into
+% K columns. If N is too small, some text beyond the end of the table
+% will be incorporated into the table, probably producing an error
+% message. If N is too large, some of the entries will appear after the
+% table, probably looking very out of place.
+%
+% You can adjust the position of the table on the page by changing
+% \parindent (space to the left of the block) and \hsize (distance from
+% the left margin to the right of the block). (No doubt inside a
+% group.) And you can allow a page break above the valign by changing
+% \abovecolumnspenalty.
+%
+\newcount\abovecolumnspenalty \abovecolumnspenalty = 10000
+\newcount\@linestogo % Lines remaining to process.
+\newcount\@linestogoincolumn % Lines remaining in column.
+\newcount\@columndepth % Number of lines in a column.
+\newdimen\@columnwidth % Width of each column.
+\newtoks\crtok \crtok = {\cr}%
+\newcount\currentcolumn
+%
+% The space matches an end-of-line that will probably be there.
+%
+\def\makecolumns#1/#2: {\par \begingroup
+ % Set \@columndepth to the number of items we will put in a column:
+ % ceiling(N/K), i.e. (N - 1) / K + 1.
+ \@columndepth = #1
+ \advance\@columndepth by -1
+ \divide \@columndepth by #2
+ \advance\@columndepth by 1
+ \@linestogoincolumn = \@columndepth
+ \@linestogo = #1
+ %
+ % We start in the first column.
+ \currentcolumn = 1
+ %
+ \def\@endcolumnactions{%
+ \ifnum \@linestogo<2
+ \the\crtok \egroup \endgroup \par % End \valign and \makecolumns.
+ \else
+ % We've done one more line out of the total.
+ \global\advance\@linestogo by -1
+ %
+ % How many left in the column?
+ %
+ \ifnum\@linestogoincolumn<2
+ % End this column, that was the last line.
+ \global\advance\currentcolumn by 1
+ \global\@linestogoincolumn = \@columndepth
+ \the\crtok
+ \else
+ % Still got more lines to go.
+ &\global\advance\@linestogoincolumn by -1
+ \fi
+ \fi
+ }%
+ %
+ % Set up to read the table.
+ %
+ \makeactive\^^M
+ \letreturn \@endcolumnactions
+ %
+ % Figure out how wide our columns are going to be; each column has
+ % exactly the same template, so we can use the feature described on
+ % p.241 of the TeXbook for repeating preambles.
+ %
+ \@columnwidth = \hsize
+ \advance\@columnwidth by -\parindent
+ \divide\@columnwidth by #2
+ \penalty\abovecolumnspenalty
+ \noindent % It's not a paragraph (usually).
+ \valign\bgroup
+ &\hbox to \@columnwidth{\strut \hsize = \@columnwidth ##\hfil}\cr
+ %
+ % The next end-of-line starts everything going.
+}%
+%
+%
+%
+% \numberedfootnote is like plain TeX's \footnote, but automatically
+% numbered. When you want to reset the footnote number, say
+% \footnotenumber = 0.
+%
+% We also provide for more general formatting than \footnote:
+% \footnotemarkseparation is the space between the reference mark and
+% the footnote text;
+% \interfootnoteskip is the space between footnotes;
+% \everyfootnote is expanded just before we typeset the footnote.
+%
+% The dimensions of the footnote rule are controlled by
+% \footnoterulewidth and \footnoteruleheight (the depth is always zero);
+% the space after the rule is \belowfootnoterulespace.
+%
+\newcount\footnotenumber
+\newcount\hlfootlabelnumber
+\newdimen\footnotemarkseparation \footnotemarkseparation = .5em
+\newskip\interfootnoteskip \interfootnoteskip = 0pt
+\newtoks\everyfootnote
+\newdimen\footnoterulewidth \footnoterulewidth = 2in
+\newdimen\footnoteruleheight \footnoteruleheight = 0.4pt
+\newdimen\belowfootnoterulespace \belowfootnoterulespace = 2.6pt
+%
+\let\@plainfootnote = \footnote
+\let\@plainvfootnote = \vfootnote
+% Hyperlink labels for forward and back references.
+\def\hlfootlabel{FOOT\the\hlfootlabelnumber}%
+\def\hlfootbacklabel{FOOTB\the\hlfootlabelnumber}%
+%
+\def\@eplainfootnote#1{\let\@sf\empty % parameter #2 (the text) is read later
+ \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
+ \global\advance\hlfootlabelnumber by 1
+ \hlstart@impl{foot}{\hlfootlabel}%
+ \hldest@impl{footback}{\hlfootbacklabel}%
+ #1%
+ \hlend@impl{foot}%
+ \@sf\vfootnote{#1}%
+}%
+%
+\let\footnote\@eplainfootnote
+%
+\def\vfootnote#1{\insert\footins\bgroup
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\ht\strutbox % top baseline for broken footnotes
+ \advance\splittopskip by \interfootnoteskip
+ \splitmaxdepth\dp\strutbox
+ \floatingpenalty\@MM
+ \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
+ \everypar = {}%
+ \parskip = 0pt % because of the vskip
+ % Even if typesetting in multicolumns, do footnotes in normal page width.
+ % (We don't have any provision in the output routine for having
+ % footnotes per column, anyway.)
+ \ifnum\@numcolumns > 1 \hsize = \@normalhsize \fi
+ \the\everyfootnote
+ \vskip\interfootnoteskip
+ \indent\llap{%
+ \hlstart@impl{footback}{\hlfootbacklabel}%
+ \hldest@impl{foot}{\hlfootlabel}%
+ #1%
+ \hlend@impl{footback}%
+ \kern\footnotemarkseparation
+ }%
+ \footstrut\futurelet\next\fo@t
+}%
+%
+\def\footnoterule{\dimen@ = \footnoteruleheight
+ \advance\dimen@ by \belowfootnoterulespace
+ \kern-\dimen@
+ \hrule width\footnoterulewidth height\footnoteruleheight depth0pt
+ \kern\belowfootnoterulespace
+ \vskip-\interfootnoteskip
+}%
+%
+\def\numberedfootnote{%
+ \global\advance\footnotenumber by 1
+ \@eplainfootnote{$^{\number\footnotenumber}$}%
+}%
+%
+%
+%
+% Margins.
+%
+% TeX's primitives determine the type area. But some users prefer to
+% think in terms of margins. These definitions allow one to say, for
+% example, `\topmargin = 2in', instead of `\voffset=1in\advance\vsize by
+% -1in'. Constructions like `\advance\topmargin by 1in' give an error
+% message, though, since \topmargin is not a parameter. Instead, the
+% macro \advancetopmargin has to be used.
+%
+\newdimen\paperheight
+\ifnum\mag=1000
+ \paperheight = 11in % No magnification (yet).
+\else
+ \paperheight = 11truein % We already have a magnification.
+\fi
+%
+\def\topmargin{\afterassignment\@finishtopmargin \dimen@}%
+\def\@finishtopmargin{%
+ \dimen2 = \voffset % Remember the old \voffset.
+ \voffset = \dimen@ \advance\voffset by -1truein
+ \advance\dimen2 by -\voffset % Compute the change in \voffset.
+ \advance\vsize by \dimen2 % Change type area accordingly.
+}%
+\def\advancetopmargin{%
+ \dimen@ = 0pt \afterassignment\@finishadvancetopmargin \advance\dimen@
+}%
+\def\@finishadvancetopmargin{%
+ \advance\voffset by \dimen@
+ \advance\vsize by -\dimen@
+}%
+%
+%
+\def\bottommargin{\afterassignment\@finishbottommargin \dimen@}%
+\def\@finishbottommargin{%
+ \@computebottommargin % Result in \dimen2.
+ \advance\dimen2 by -\dimen@ % Compute the change in the bottom margin.
+ \advance\vsize by \dimen2 % Change the type area.
+}%
+\def\advancebottommargin{%
+ \dimen@ = 0pt \afterassignment\@finishadvancebottommargin \advance\dimen@
+}%
+\def\@finishadvancebottommargin{%
+ \advance\vsize by -\dimen@
+}%
+%
+% Find the current bottom margin, putting the result in \dimen2.
+%
+\def\@computebottommargin{%
+ \dimen2 = \paperheight % The total paper size.
+ \advance\dimen2 by -\vsize % Less the text size.
+ \advance\dimen2 by -\voffset % Less the offset at the top.
+ \advance\dimen2 by -1truein % Less the default offset.
+}%
+%
+%
+\newdimen\paperwidth
+\ifnum\mag=1000
+ \paperwidth = 8.5in % No magnification (yet).
+\else
+ \paperwidth = 8.5truein % We already have a magnification.
+\fi
+%
+\def\leftmargin{\afterassignment\@finishleftmargin \dimen@}%
+\def\@finishleftmargin{%
+ \dimen2 = \hoffset % Remember the old \hoffset.
+ \hoffset = \dimen@ \advance\hoffset by -1truein
+ \advance\dimen2 by -\hoffset % Compute the change in \hoffset.
+ \advance\hsize by \dimen2 % Change type area accordingly.
+}%
+\def\advanceleftmargin{%
+ \dimen@ = 0pt \afterassignment\@finishadvanceleftmargin \advance\dimen@
+}%
+\def\@finishadvanceleftmargin{%
+ \advance\hoffset by \dimen@
+ \advance\hsize by -\dimen@
+}%
+%
+%
+\def\rightmargin{\afterassignment\@finishrightmargin \dimen@}%
+\def\@finishrightmargin{%
+ \@computerightmargin % Result in \dimen2.
+ \advance\dimen2 by -\dimen@ % Compute the change in the right margin.
+ \advance\hsize by \dimen2 % Change the type area.
+}%
+\def\advancerightmargin{%
+ \dimen@ = 0pt \afterassignment\@finishadvancerightmargin \advance\dimen@
+}%
+\def\@finishadvancerightmargin{%
+ \advance\hsize by -\dimen@
+}%
+%
+% Find the current right margin, putting the result in \dimen2.
+%
+\def\@computerightmargin{%
+ \dimen2 = \paperwidth % The total paper size.
+ \advance\dimen2 by -\hsize % Less the text size.
+ \advance\dimen2 by -\hoffset % Less the offset at the left.
+ \advance\dimen2 by -1truein % Less the default offset.
+}%
+%
+% There is a potential problem when using the margin macros at a true
+% dimension and then calling \magnification. So we redefine
+% \magnification to address this.
+%
+\let\@plainm@g = \m@g
+\def\m@g{\@plainm@g \paperwidth = 8.5 true in \paperheight = 11 true in}%
+%
+%
+%
+% Double column output.
+%
+% \doublecolumns begins double column output. It can be called
+% in the midst of a page. \singlecolumn restores single column
+% output. (It would be wrong to require \enddoublecolumns, because
+% often one wants double column mode to continue to the end of
+% the document.)
+%
+% The basic approach is that of Appendix E of the TeXbook, p.417.
+% David Guichard made significant improvements to my original implementation.
+%
+% The glue here (the default is intended to be one linespace) is inserted
+% before double columns start, and after they end.
+%
+\newskip\abovecolumnskip \abovecolumnskip = \bigskipamount
+\newskip\belowcolumnskip \belowcolumnskip = \bigskipamount
+%
+% Space between the columns. It can be changed as desired.
+\newdimen\gutter \gutter = 2pc
+%
+% These registers are needed for dealing with switching back and forth.
+\newbox\@partialpage
+\newdimen\@normalhsize
+\newdimen\@normalvsize % The original (before multi-columns) \vsize.
+\newtoks\previousoutput
+%
+% Some synonymous ways to refer to multiple column modes.
+\def\quadcolumns{\@columns4}%
+\def\triplecolumns{\@columns3}%
+\def\doublecolumns{\@columns2}%
+\def\begincolumns#1{\ifcase#1\relax \or \singlecolumn \or \@columns2 \or
+ \@columns3 \or \@columns4 \else \relax \fi}%
+\def\endcolumns{\singlecolumn}%
+\let\@ndcolumns = \relax
+%
+% Set this by default so \vfootnote can unconditionally inspect it.
+\chardef\@numcolumns = 1
+%
+\mathchardef\@ejectpartialpenalty = 10141
+%
+%
+% \@columns: Start typesetting with #1 columns.
+%
+% Before we actually start, we have to make sure that there are at least
+\chardef\@col@minlines = 3
+% free lines.
+% (It could be 2, or even 1, but it might give ugly results; at least one
+% line is absolutely necessary, or the output routine might get confused.)
+% We have to be careful, so that eg.
+% \hbox{TITLE}
+% \nobreak
+% \doublecolumns
+% won't break between the title and the start of the columned output.
+%
+% To achieve this, we add vskip of fixed size equal to
+% @col@minlines * baselineskip
+% and then eject the page.
+% The output routine then catches the pages ejected:
+% 1) if it's a normal page, it is processed by previous output routine;
+% 2) if it's the last one, it is saved and the added skip is removed.
+%
+% When the box is processed according to 1), an underfull vbox can appear,
+% but it's not our problem, the manuscript (or it's macros) has to be fixed.
+%
+% Another note: all assignments are global; it is not possible to call
+% \doublecolumns in a group.
+%
+\def\@columns#1{%
+ \@ndcolumns
+ %
+ \global\let\@ndcolumns = \@endcolumns
+ \global\chardef\@numcolumns = #1
+ \global\previousoutput = \expandafter{\the\output}%
+ %
+ % Grab the page so far (i.e., the material BEFORE \@columns was called)
+ % and save it in \@partialpage.
+ \global\output = {%
+ \ifnum\outputpenalty = -\@ejectpartialpenalty
+ \dimen@ = \vsize
+ \advance\dimen@ by \@col@minlines\baselineskip
+ \global\setbox\@partialpage =
+ \vbox \ifdim \pagetotal > \vsize to \dimen@ \fi {%
+ \unvbox255 \unskip
+ }%
+ \else
+ \the\previousoutput
+ \fi
+ }%
+ %
+ \vskip \abovecolumnskip
+ \vskip \@col@minlines\baselineskip
+ % now execute the output routine:
+ \penalty -\@ejectpartialpenalty
+ %
+ % Reset \output to prepare for the first real page break.
+ \global\output = {\@columnoutput}%
+ %
+ \global\@normalhsize = \hsize
+ \global\@normalvsize = \vsize
+ %
+ % Figure out how wide the columns should be -- for n columns,
+ % decrement by n - 1 gutters.
+ \count@ = \@numcolumns
+ \advance\count@ by -1
+ \global\advance\hsize by -\count@\gutter
+ \global\divide\hsize by \@numcolumns
+ %
+ % Compute \vsize based on what's already on the page
+ % and the number of columns. Also change the mag factor for insertions.
+ %
+ \advance\vsize by -\ht\@partialpage
+ %
+ \advance\vsize by -\ht\footins
+ \ifvoid\footins\else \advance\vsize by -\skip\footins \fi
+ \multiply\count\footins by \@numcolumns
+ %
+ \advance\vsize by -\ht\topins
+ \ifvoid\topins\else \advance\vsize by -\skip\topins \fi
+ \multiply\count\topins by \@numcolumns
+ %
+ \global\vsize = \@numcolumns\vsize
+}%
+%
+% When this is invoked box 255 contains just the right amount of
+% material, whether triggered by an output routine or a change in the
+% number of columns. Because columns have to contain an integral number
+% of lines of type, we take a bit of care with balancing the heights of
+% the columns to prevent either losing material or having a very short
+% last column.
+%
+% When a page ends due to \bye or \eject, box 255 will contain lots of
+% white space, so the columns will not look balanced. To fix this use
+% \singlecolumn before ending the page.
+%
+% [gutterbox material added by AHL on 5 November 1997.]
+% \gutterbox is a hook to enable the placement of arbitrary vertical
+% material in the gutter between columns. For example, to put a
+% vertical line between the columns you could say
+%
+% \def\gutterbox{\vbox to \dimen0{\vfil\hbox{\vrule height\dimen0}\vfil}}%
+%
+% The dimension counter \dimen0 contains the height of the column.
+%
+% By default, we define \gutterbox to be "empty":
+\def\gutterbox{\vbox to \dimen0{\vfil\hbox{\hfil}\vfil}}%
+%
+% [This next paragraph added by AHL on 22 Sep 1996.]
+% There is a special case we have to worry about, namely when we
+% switch from multiple columns to single columns. In this case, we may
+% have a bit of text left over that doesn't fit evenly into the
+% multiple columns. In that case, we will have un-even columns. Not a
+% pretty solution, but I don't have a better one at the moment. The
+% conditional \if@forceextraline tests whether we are in this case.
+%
+\newif\if@forceextraline\@forceextralinefalse
+\def\@columnsplit{%
+ \splittopskip = \topskip
+ \splitmaxdepth = \baselineskip
+ %
+ % \dimen@ will be the height that the double-column material on this
+ % page should have, i.e., the height of the page (\singlecolumvsize)
+ % minus single-column material, which includes insertions. (If you
+ % want your insertions to respect the columns, you will have to
+ % change the output routine.) If you add more insertions, they
+ % should be taken into account both here and in \singlecolumn.
+ %
+ % Unfortunately, we lose on flexible glue because we must
+ % \vsplit to a <dimen>.
+ \dimen@ = \ht255
+ \divide\dimen@ by \@numcolumns
+ %
+ % If we are in an end-column mode and we need extra vertical space
+ % in the last column, advance \dimen@.
+ \if@forceextraline
+ \advance\dimen@ by \baselineskip
+ \fi
+ %
+ % Split the long scroll into columns.
+ \begingroup
+ % We do not want to see underfull \vbox messages unless the final
+ % page is underfull.
+ \vbadness = 10000
+ %
+ % The first (leftmost) column.
+ \global\setbox1 = \vsplit255 to \dimen@ \global\wd1 = \hsize
+ %
+ % The second column.
+ \global\setbox3 = \vsplit255 to \dimen@ \global\wd3 = \hsize
+ %
+ \ifnum\@numcolumns > 2
+ % The third column, if requested.
+ \global\setbox5 = \vsplit255 to \dimen@ \global\wd5 = \hsize
+ \fi
+ \ifnum\@numcolumns > 3
+ % The fourth column, likewise if requested.
+ \global\setbox7 = \vsplit255 to \dimen@ \global\wd7 = \hsize
+ \fi
+ \endgroup
+ \if@forceextraline % If this is the first time
+ \else % through, save the single
+ \setbox\@forcelinebox=\copy\@partialpage % column material.
+ \fi
+ %
+ % Set up \box255 with the real output page, as the previous output
+ % routine expects.
+ \setbox0 = \box255
+ \global\setbox255 = \vbox{%
+ \unvbox\@partialpage
+ \ifcase\@numcolumns \relax\or\relax
+ \or \hbox to \@normalhsize{\box1\hfil\gutterbox\hfil\box3}%
+ \or \hbox to \@normalhsize{\box1\hfil\gutterbox\hfil\box3%
+ \hfil\gutterbox\hfil\box5}%
+ \or \hbox to \@normalhsize{\box1\hfil\gutterbox\hfil\box3%
+ \hfil\gutterbox\hfil\box5%
+ \hfil\gutterbox\hfil\box7}%
+ \fi
+ }%
+ %
+ % Save what's left over in a private register before calling their
+ % output routine.
+ \setbox\@partialpage = \box0
+}%
+%
+% Our output routine splits the columns and then calls the previous one.
+%
+\def\@columnoutput{%
+ \@columnsplit
+ \@recoverclubpenalty
+ \hsize = \@normalhsize % Local to \output's group.
+ \vsize = \@normalvsize
+ \the\previousoutput
+ %
+ % Put back what didn't fit.
+ \unvbox\@partialpage
+ \penalty\outputpenalty
+ %
+ % The correct vsize is the original vsize times the
+ % number of columns.
+ \global\vsize = \@numcolumns\@normalvsize
+}%
+%
+% Go back to single-column typesetting. Assume \doublecolumns has
+% been called.
+%
+\def\singlecolumn{%
+ \@ndcolumns
+ \chardef\@numcolumns = 1
+ \vskip\belowcolumnskip
+ \nointerlineskip
+}%
+%
+\newbox\@forcelinebox
+\def\@endcolumns{%
+ \global\let\@ndcolumns = \relax
+ \par % Shouldn't start in horizontal mode.
+ %
+ \global\output = {\global\setbox1 = \box255}%
+ \pagegoal = \pagetotal
+ \break % Exercise the page builder, i.e., \output.
+ \setbox2 = \box1 % Save material in box2 in case of overflow.
+ \global\setbox255 = \copy2 % Retrieve what the fake \output set.
+ %
+ % \box255 now has the double-column material. On the page where we
+ % switch back to one column, the double-column material might not
+ % fill up the page. We want to split whatever is there.
+ \@columnsplit
+ %
+ % Check that \@columnsplit did not leave any lines in
+ % \@partialpage. If it did, do it again, but this time with longer
+ % columns.
+ \ifvoid\@partialpage
+ \else % There is some left-over.
+ \setbox0=\box\@partialpage % Merely to void \@partialpage
+ \global\setbox255 = \box2 % Retrieve what the fake \output set.
+ \@forceextralinetrue % Add \forcelinebox to \box255 to save single
+ \@columnsplit % column material.
+ \global\setbox255 = \vbox{\box\@forcelinebox\box255}%
+ \fi
+
+ \global\vsize = \@normalvsize
+ \global\hsize = \@normalhsize
+ \global\output = \expandafter{\the\previousoutput}%
+ %
+ \ifvoid\topins\else\topinsert\unvbox\topins\endinsert\fi
+ \unvbox255
+}%
+% [\columnfill]
+% We don't have any way to force a column eject, since the \output
+% routine is only prepared to split up a full page of material. Instead,
+% we provide the following as a guess at enough space to fill up the
+% current column.
+%
+% [April 30, 1998] This definition is from
+% Helmut Jarausch <jarausch@IGPM.Rwth-Aachen.DE> with some
+% modifications by A. Lewenberg <ahl@uakron.edu>.
+%
+% Here is the main difficulty: when \vsplitting the long page into the
+% component columns, \vsplit prepends to the top of each column glue
+% in the amount \topskip - (height of top box). But this happens
+% in the output routine _after_ the \columnfill does its
+% calculations. The result of this is that if we are not careful
+% \columnfill will insert too much space attempting to ``eject'' the
+% current column. There is no simple way around this, so what I have
+% done is have is make \columnfill insert less space than needed, and
+% then not allow any \club lines by setting \clubpenalty to its
+% maximum value. Not a pretty solution, but until something better
+% comes along, it will have to do.
+%
+\def\@saveclubpenalty{% save the current value of \clubpenalty
+ \edef\@recoverclubpenalty{%
+ \global\clubpenalty=\the\clubpenalty\relax%
+ \global\let\noexpand\@recoverclubpenalty\relax
+ }% the \noexpand handles infinite self-reference
+}%
+\let\@recoverclubpenalty\relax
+\newdimen\temp@dimen
+\def\columnfill{%
+ \par
+ \dimen@=\pagetotal % The height of the text set so far.
+ \temp@dimen = \vsize % = \@numcolumns * columnheight
+ \divide\temp@dimen by \@numcolumns % find out column height
+ \loop
+ \ifdim \dimen@ > \temp@dimen
+ \advance \dimen@ by -\temp@dimen
+ \advance \dimen@ by \topskip % fudge factor
+ \repeat
+ \advance \temp@dimen by -\dimen@
+ \advance \temp@dimen by -\prevdepth
+ \@saveclubpenalty
+ \clubpenalty=10000\relax
+ \hrule height\temp@dimen width0pt depth0pt\relax
+ \nointerlineskip
+ \par
+ \nointerlineskip
+ \penalty0\vfil % To allow a page break here.
+ \relax
+}%
+%
+%
+%
+% Hypertext links support.
+%
+% Hyperlink destinations (driver-independent code).
+%
+% \hldest{TYPE}{OPTIONS}{LABEL} defines a hyperlink destination
+% LABEL. OPTIONS is a comma-separated list of option assignments of
+% the form `opt=value'; permitted values for TYPE and OPTIONS depend
+% on selected hyperlink driver.
+%
+% \hldest will be \let to \@hldest by \enablehyperlinks. TYPE,
+% OPTIONS and LABEL will be read by \hl@getparam.
+\def\@hldest{%
+ \def\hl@prefix{hldest}%
+ \let\after@hl@getparam\hldest@aftergetparam
+ % Start the group which will isolate option settings. It will be
+ % ended in \hldest@aftergetparam
+ \begingroup
+ \hl@getparam
+}%
+% This actually produces hyperlink destination. It will be called at
+% the end of \hl@getparam, after the parameters are parsed.
+\def\hldest@aftergetparam{%
+ \ifvmode
+ % In vertical mode we don't raise the destination, so it can go
+ % directly into the vertical list.
+ \hldest@driver
+ \else
+ % In horizontal mode, the destination is raised \hldest@opt@raise
+ % above the baseline and placed inside a zero-width/height/depth
+ % box; the box is surrounded by \allowhyphens in case it is
+ % placed next to a word, to allow hyphenation of that word.
+ \allowhyphens
+ \smash{\ifx\hldest@opt@raise\empty \else \raise\hldest@opt@raise\fi
+ \hbox{\hldest@driver}}%
+ \allowhyphens
+ \fi
+ % End the group which was isolating option settings (it was started
+ % in \@hldest).
+ \endgroup
+}%
+%
+% Hyperlinks (driver-independent code).
+%
+% \hlstart{TYPE}{OPTIONS}{LABEL} starts a hyperlink to destination
+% LABEL. OPTIONS is a comma-separated list of option assignments of
+% the form `opt=value'; permitted values of TYPE and OPTIONS depend on
+% selected hyperlink driver. End the link with \hlend.
+%
+% \hlstart will be \let to \@hlstart by \enablehyperlinks. TYPE,
+% OPTIONS and LABEL will be read by \hl@getparam.
+\def\@hlstart{%
+ \leavevmode
+ \def\hl@prefix{hl}%
+ \let\after@hl@getparam\hlstart@aftergetparam
+ % Start the group which will isolate option settings and color
+ % changes. It will be ended in \@hlend
+ \begingroup
+ \hl@getparam
+}%
+%
+\def\hlstart@aftergetparam{%
+ % Set the color for the link.
+ \ifx\color\undefined \else
+ \ifx\hl@opt@color\empty \else
+ \ifx\hl@opt@colormodel\empty
+ \edef\temp{\noexpand\color{\hl@opt@color}}%
+ \else
+ \edef\temp{\noexpand\color[\hl@opt@colormodel]{\hl@opt@color}}%
+ \fi
+ \temp
+ \fi
+ \fi
+ % Call the driver.
+ \hl@driver
+}%
+% \hlend will be \let to \@hlend by \enablehyperlinks. \@hlend will
+% be defined by a driver.
+%
+% Macros which are used commonly by \hldest and \hlstart to parse and
+% save parameters. \hl@prefix must be set to `hldest' by \hldest and
+% to `hl' by \hlstart.
+%
+% \hl@getparam{TYPE}{OPTIONS}{LABEL} reads, parses and saves the
+% parameters for \hldest or \hlstart into \@hltype, \hl[dest]@opt@...
+% and \@hllabel. After doing that it calls \after@hl@getparam which
+% should be defined by \@hldest and \@hlstart to produce destination /
+% link using the saved parameters.
+\def\hl@getparam#1#2#3{%
+ % Save TYPE in \@hltype (use default if empty).
+ \edef\@hltype{#1}%
+ \ifx\@hltype\empty
+ \expandafter\let\expandafter\@hltype
+ \csname \hl@prefix @type\endcsname
+ \fi
+ % For each supported destination / link type TYPE, a driver should
+ % define \hl[dest]@typeh@TYPE handler.
+ \expandafter\ifx\csname \hl@prefix @typeh@\@hltype\endcsname \relax
+ \errmessage{Invalid type `\@hltype'}%
+ \fi
+ % \for will expand #2 once so user can pass a shortcut macro. We
+ % also ignore empty \hl@arg, so that the following
+ % \hldest{TYPE}{\myopt,height=200pt}{LABEL}
+ % would be legal even when \myopt happens to be empty.
+ \for\hl@arg:=#2\do{%
+ \ifx\hl@arg\empty \else
+ \expandafter\hl@set@opt\hl@arg=,%
+ \fi
+ }%
+ % Save LABEL in \@hllabel.
+ \edef\@hllabel{#3}%
+ % Execute the commands specific to destination / link
+ \after@hl@getparam
+ % Ignore spaces after \hlstart and \hldest.
+ \ignorespaces
+}%
+% Parse and set a (default, not a group) option.
+\def\hl@set@opt#1=#2,{%
+ % For each supported option OPTION, a driver should define
+ % \hl[dest]@opt@OPTION.
+ \expandafter\ifx\csname \hl@prefix @opt@#1\endcsname \relax
+ \errmessage{Invalid option `#1'}%
+ \fi
+ % Save the value of the option.
+ \if ,#2, % if #2 is empty, complain.
+ \errmessage{Missing value for option `#1'}%
+ \else
+ % Remove a trailing =.
+ \def\temp##1={##1}%
+ \expandafter\edef\csname \hl@prefix @opt@#1\endcsname{\temp#2}%
+ \fi
+}%
+% \hl{dest,start,end}@impl{GROUP}{LABEL} will generate `implicit' destination /
+% hyperlink, if the user has not turned off this kind of implicit
+% destinations / hyperlinks. This is used by Eplain's cross-reference
+% macros.
+\def\hldest@impl#1{%
+ \expandafter\ifcase\csname hldest@on@#1\endcsname
+ \relax\expandafter\gobble
+ \else
+ \toks@=\expandafter{\csname hldest@type@#1\endcsname}%
+ \toks@ii=\expandafter{\csname hldest@opts@#1\endcsname}%
+ \edef\temp{\noexpand\hldest{\the\toks@}{\the\toks@ii}}%
+ \expandafter\temp
+ \fi
+}%
+\def\hlstart@impl#1{%
+ \expandafter\ifcase\csname hl@on@#1\endcsname
+ % Still produce \leavevmode, to be consistent with \hloff.
+ \leavevmode\expandafter\gobble
+ \else
+ \toks@=\expandafter{\csname hl@type@#1\endcsname}%
+ \toks@ii=\expandafter{\csname hl@opts@#1\endcsname}%
+ \edef\temp{\noexpand\hlstart{\the\toks@}{\the\toks@ii}}%
+ \expandafter\temp
+ \fi
+}%
+\def\hlend@impl#1{%
+ \expandafter\ifcase\csname hl@on@#1\endcsname
+ \else
+ \hlend
+ \fi
+}%
+%
+% Setting options and types.
+%
+\def\hl@asterisk@word{*}%
+\def\hl@opts@word{opts}%
+\newif\if@params@override
+% We define hyperlink / destination groups. A group is a macro or a
+% group of macros which implicitly generate hyperlink / destination.
+% The user can set parameters for each group individually, as well as
+% the default parameters, with the macros defined below. Group
+% settings will override the default hyperlink / destination
+% parameters.
+\def\hldest@groups{definexref,xrdef,li,eq,bib,foot,footback,idx}%
+\def\hl@groups{ref,xref,eq,cite,foot,footback,idx,url}%
+% \hldesttype [GROUPS]{VALUE}
+% \hldestopts [GROUPS]{VALUE}
+% \hltype [GROUPS]{VALUE}
+% \hlopts [GROUPS]{VALUE}
+%
+% Set hyperlink or destination parameter (type / opts) to VALUE for
+% each group in GROUPS. An empty `group' will set default value for
+% the parameter. A star (*) `group' stands for all groups (exept the
+% empty `group'). If the macro is followed by an exclamation mark
+% (like \hlopts!...), the parameters will be overridden; otherwise,
+% they will be updated (this has effect only on group option list).
+\def\hldesttype{%
+ \def\hl@prefix{hldest}%
+ \def\hl@param{type}%
+ \let\hl@all@groups\hldest@groups
+ \futurelet\hl@excl\hl@param@read@excl
+}%
+\def\hldestopts{%
+ \def\hl@prefix{hldest}%
+ \def\hl@param{opts}%
+ \let\hl@all@groups\hldest@groups
+ \futurelet\hl@excl\hl@param@read@excl
+}%
+\def\hltype{%
+ \def\hl@prefix{hl}%
+ \def\hl@param{type}%
+ \let\hl@all@groups\hl@groups
+ \futurelet\hl@excl\hl@param@read@excl
+}%
+\def\hlopts{%
+ \def\hl@prefix{hl}%
+ \def\hl@param{opts}%
+ \let\hl@all@groups\hl@groups
+ \futurelet\hl@excl\hl@param@read@excl
+}%
+\def\hl@param@read@excl{%
+ \ifx!\hl@excl
+ \let\next\hl@param@read@opt@arg
+ \@params@overridetrue
+ \else
+ \def\next{\hl@param@read@opt@arg{!}}%
+ \@params@overridefalse
+ \fi
+ \next
+}%
+\def\hl@param@read@opt@arg#1{% #1 is the `!', ignore it.
+ \@getoptionalarg\hl@setparam
+}%
+% Set the parameter \hl@param to #1 for each group in \@optionalarg.
+\def\hl@setparam#1{%
+ \ifx\@optionalarg\empty
+ \hl@setparam@default{#1}% Set default.
+ \else
+ % If we find an asterisk in the list, we have no choice but to
+ % finish the list and then call \hl@setparam again, now with
+ % \hl@all@groups for the list of groups.
+ \let\hl@do@all@groups\gobble
+%
+ \for\hl@group:=\@optionalarg\do{%
+ \ifx\hl@group\hl@asterisk@word
+ \def\hl@do@all@groups{\let\@optionalarg\hl@all@groups \hl@setparam}%
+ \else
+ \hl@setparam@group{#1}%
+ \fi
+ }%
+%
+ \hl@do@all@groups{#1}%
+ \fi
+}%
+% Set a parameter (\hl@param) for one group (\hl@group) to the value
+% (#1). The group may be empty, in which case we call
+% \hl@setparam@default
+\def\hl@setparam@group#1{%
+ \ifx\hl@group\empty
+ \hl@setparam@default{#1}%
+ \else
+ \expandafter\ifx\csname\hl@prefix @\hl@param @\hl@group\endcsname\relax
+ \errmessage{Hyperlink group parameter `\hl@prefix:\hl@param:\hl@group' is not defined}%
+ \fi
+ \ifx\hl@param\hl@opts@word
+ % For the `opts' parameter, we want to expand the first token of
+ % #1 once, in case the user passed a macro containing the option
+ % list. We may need to either simply override the old option
+ % list, or to update it with the new option settings.
+ \if@params@override
+ \toks@=\expandafter{#1}%
+ \ece\edef{\hl@prefix @\hl@param @\hl@group}{\the\toks@}%
+ \else
+ \hl@update@opts@with@list{#1}% #1 will be used in the \for
+ % loop, so it will be expanded once.
+ \fi
+ \else
+ % Do not use \edef here to define the parameter, so the user can
+ % define it to, e.g., \normalbaselineskip, and make the parameter
+ % adjustable to a situation.
+ \ece\def{\hl@prefix @\hl@param @\hl@group}{#1}%
+ \fi
+ \fi
+}%
+% Set default parameter values. We have to treat `opts' (list of
+% options) specially, because for option defaults we don't store a
+% list of options (like we do for the group options) but set each
+% option individually.
+\def\hl@setparam@default#1{%
+ \ifx\hl@param\hl@opts@word
+ % `opts'.
+ \for\hl@opt:=#1\do{%
+ \ifx\hl@opt\empty \else
+ \expandafter\hl@set@opt\hl@opt=,%
+ \fi
+ }%
+ \else
+ % Everything except `opts'.
+ \expandafter\ifx\csname\hl@prefix @\hl@param\endcsname\relax
+ \message{Default parameter `\hl@prefix:\hl@param' is not defined}%
+ \fi
+ % Should not use \edef, so the user could define this to, e.g.,
+ % \normalbaselineskip, to make the parameter adjustable to a
+ % situation.
+ \ece\def{\hl@prefix @\hl@param}{#1}%
+ \fi
+}%
+% For each option in the list (#1), call \hl@update@with@opt to update
+% the group's option list (\csname\hl@prefix @opts@ \hl@group\endcsname)
+% with this new option.
+\def\hl@update@opts@with@list#1{%
+ % Start with the current list of the group.
+ \global\expandafter\let\expandafter\hl@update@new@list
+ \csname \hl@prefix @opts@\hl@group\endcsname
+ % We have to isolate the \for loop inside a (TeX) group, to avoid
+ % clashes with the loop in \hl@setparam
+ \begingroup
+ \for\hl@opt:=#1\do{%
+ \hl@update@opts@with@opt
+ }%
+ \endgroup
+ % Save the final list back in the option list for the group.
+ \ece\let{\hl@prefix @opts@\hl@group}\hl@update@new@list
+}%
+% Go through the option list (\hl@update@new@list) and construct the
+% new list (in \hl@update@new@list), replacing the old definition of
+% the option with the new one (\hl@opt).
+\def\hl@update@opts@with@opt{%
+ % Save the old list and the new option.
+ \global\let\hl@update@old@list\hl@update@new@list
+ \global\let\hl@update@new@list\empty
+ \global\let\hl@update@new@opt\hl@opt
+ % Get the key of the new option and save it.
+ \expandafter\hl@parse@opt@key\hl@opt=,%
+ \let\hl@update@new@key\hl@update@key
+ % We will set this to real comma after the first entry.
+ \global\let\hl@update@comma\empty
+ % We have to isolate the \for loop inside a (TeX) group, to avoid
+ % clashes with the loop in \hl@update@opts@with@list
+ \begingroup
+ \for\hl@opt:=\hl@update@old@list\do{%
+ \ifx\hl@opt\empty \else % Skip empty `options'.
+ % Get the key of this option.
+ \expandafter\hl@parse@opt@key\hl@opt=,%
+ % If the key matches, replace the option definition with the
+ % new definition, otherwise, repeat the old definition.
+ \toks@=\expandafter{\hl@update@new@list}%
+ \ifx\hl@update@key\hl@update@new@key
+ \ifx\hl@update@new@opt\empty \else % Skip multiple options.
+ \toks@ii=\expandafter{\hl@update@new@opt}%
+ \xdef\hl@update@new@list{\the\toks@\hl@update@comma\the\toks@ii}%
+ \global\let\hl@update@new@opt\empty
+ \global\def\hl@update@comma{,}%
+ \fi
+ \else
+ \toks@ii=\expandafter{\hl@opt}%
+ \xdef\hl@update@new@list{\the\toks@\hl@update@comma\the\toks@ii}%
+ \global\def\hl@update@comma{,}%
+ \fi
+ \fi
+ }%
+ \endgroup
+ % If nothing was replaced, add the new option to the end of the new list.
+ \ifx\hl@update@new@opt\empty \else
+ \toks@=\expandafter{\hl@update@new@list}%
+ \toks@ii=\expandafter{\hl@update@new@opt}%
+ \xdef\hl@update@new@list{\the\toks@\hl@update@comma\the\toks@ii}%
+ \fi
+}%
+% Parse the key of the option and save it in \hl@update@key
+\def\hl@parse@opt@key#1=#2,{\def\hl@update@key{#1}}%
+%
+% Default and group parameters (options and types).
+%
+% Option `raise' will determine how much to raise hyperlink
+% destinations above the baseline. It will be supported by all
+% drivers, since it is handled outside the drivers, in
+% \hldest@aftergetparam.
+\def\hldest@opt@raise{\normalbaselineskip}%
+% Options `colormodel' and `color' will also be handled outside the
+% drivers, in \hlstart@aftergetparam.
+\def\hl@opt@colormodel{cmyk}%
+\def\hl@opt@color{0.28,1,1,0.35}%
+%
+% Parameters for destinations and links produced implicitly by
+% cross-reference macros. Note that each driver will additionally
+% define \hldest@type and \hl@type parameters which will be used when
+% one of the below is empty, and default values for destination and
+% link options (which are driver-specific).
+%
+% Destination on/off flags (0=off, 1=on).
+\def\hldest@on@definexref{0}%
+\def\hldest@on@xrdef{0}%
+\def\hldest@on@li{0}%
+\def\hldest@on@eq{0}% \eqdef and friends
+\def\hldest@on@bib{0}% \biblabelprint (BibTeX)
+\def\hldest@on@foot{0}% \footnote / \numberedfootnote
+\def\hldest@on@footback{0}% back-ref for \footnote / \numberedfootnote
+\def\hldest@on@idx{0}% both `page' dests and `exact' dests
+% Types of destinations.
+\let\hldest@type@definexref\empty
+\let\hldest@type@xrdef\empty
+\let\hldest@type@li\empty
+\let\hldest@type@eq\empty % \eqdef and friends
+\let\hldest@type@bib\empty % \biblabelprint (BibTeX)
+\let\hldest@type@foot\empty % \footnote / \numberedfootnote
+\let\hldest@type@footback\empty % back-ref for \footnote / \numberedfootnote
+\let\hldest@type@idx\empty % both `page' dests and `exact' dests
+% Options for destinations.
+\let\hldest@opts@definexref\empty
+\let\hldest@opts@xrdef\empty
+\let\hldest@opts@li\empty
+\def\hldest@opts@eq{raise=1.7\normalbaselineskip}% \eqdef and friends
+\let\hldest@opts@bib\empty % \biblabelprint (BibTeX)
+\let\hldest@opts@foot\empty % \footnote / \numberedfootnote
+\let\hldest@opts@footback\empty % back-ref for \footnote / \numberedfootnote
+\let\hldest@opts@idx\empty % both `page' dests and `exact' dests
+%
+% Hyperlink on/off flags (0=off, 1=on).
+\def\hl@on@ref{0}% \refn and \xrefn, \ref, \refs
+\def\hl@on@xref{0}%
+\def\hl@on@eq{0}% \eqref and \eqrefn
+\def\hl@on@cite{0}% \cite (BibTeX)
+\def\hl@on@foot{0}% \footnote / \numberedfootnote
+\def\hl@on@footback{0}% back-reference for \footnote / \numberedfootnote
+\def\hl@on@idx{0}%
+\def\hl@on@url{0}% \url from url.sty
+% Types of links.
+\let\hl@type@ref\empty % \refn and \xrefn, \ref, \refs
+\let\hl@type@xref\empty
+\let\hl@type@eq\empty % \eqref and \eqrefn
+\let\hl@type@cite\empty % \cite (BibTeX)
+\let\hl@type@foot\empty % \footnote / \numberedfootnote
+\let\hl@type@footback\empty % back-reference for \footnote / \numberedfootnote
+\let\hl@type@idx\empty
+\let\hl@type@url\empty % \url from url.sty (this will be set to `url' by
+ % drivers which support the `url' type)
+% Options for links.
+\let\hl@opts@ref\empty % \refn and \xrefn, \ref, \refs
+\let\hl@opts@xref\empty
+\let\hl@opts@eq\empty % \eqref and \eqrefn
+\let\hl@opts@cite\empty % \cite (BibTeX)
+\let\hl@opts@foot\empty % \footnote / \numberedfootnote
+\let\hl@opts@footback\empty % back-reference for \footnote / \numberedfootnote
+\let\hl@opts@idx\empty
+\let\hl@opts@url\empty % \url from url.sty
+%
+% \@hlon[GROUPS]
+% \@hloff[GROUPS]
+% \@hldeston[GROUPS]
+% \@hldestoff[GROUPS]
+% \@@hlon
+% \@@hloff
+% \@@hldeston
+% \@@hldestoff
+%
+% Macros to switch hyperlinks / destinations on/off.
+%
+% The optional arg is the list of groups. It can contain a star (*)
+% which will make the macros affect all groups (but not the low-level
+% macros \hlstart, \hlend and \hldest).
+%
+% \@hlon, \@hldeston, \@hloff and \@hldestoff will turn low-level
+% macros on/off only when they are used either without the optional
+% arg or with an empty `group' in the optional arg, otherwise only the
+% specified groups are affected.
+%
+% The single-`@' variants (\@hl...) are for the user. In your macros,
+% if you want to (temporarily) turn low-level macros on/off, it's
+% better to use the double-`@' variants (\@@hl...), because they are
+% much faster and won't clobber \@optionalarg or anything else.
+%
+\def\@hlon{\@hlonoff@value@stub{hl}\@@hlon1 }%
+\def\@hloff{\@hlonoff@value@stub{hl}\@@hloff0 }%
+\def\@hldeston{\@hlonoff@value@stub{hldest}\@@hldeston1 }%
+\def\@hldestoff{\@hlonoff@value@stub{hldest}\@@hldestoff0 }%
+%
+\def\@hlonoff@value@stub#1#2#3{%
+ \def\hl@prefix{#1}%
+ \let\hl@on@empty#2%
+ \def\hl@value{#3}%
+ \expandafter\let\expandafter\hl@all@groups
+ \csname \hl@prefix @groups\endcsname
+ \@getoptionalarg\@finhlswitch
+}%
+%
+\def\@finhlswitch{%
+ \ifx\@optionalarg\empty
+ \hl@on@empty
+ \fi
+ % If we find an asterisk in the list, we have no choice but to
+ % finish the list and then call \@finhlswitch again, now with
+ % \hl@all@groups for the list of groups.
+ \let\hl@do@all@groups\relax
+%
+ \for\hl@group:=\@optionalarg\do{%
+ \ifx\hl@group\hl@asterisk@word
+ \let\@optionalarg\hl@all@groups
+ \let\hl@do@all@groups\@finhlswitch
+ \else
+ \ifx\hl@group\empty
+ \hl@on@empty
+ \else
+ \expandafter\ifx\csname\hl@prefix @on@\hl@group\endcsname \relax
+ \errmessage{Hyperlink group `\hl@prefix:on:\hl@group'
+ is not defined}%
+ \fi
+ \ece\edef{\hl@prefix @on@\hl@group}{\hl@value}%
+ \fi
+ \fi
+ }%
+%
+ \hl@do@all@groups
+}%
+% Turn low-level macros on/off.
+\def\@@hlon{%
+ \let\hlstart\@hlstart
+ \let\hlend\@hlend
+}%
+\def\@@hloff{%
+ \def\hlstart##1##2##3{\leavevmode\ignorespaces}%
+ \let\hlend\relax
+}%
+\def\@@hldeston{%
+ \let\hldest\@hldest
+}%
+\def\@@hldestoff{%
+ \def\hldest##1##2##3{\ignorespaces}%
+}%
+%
+% Hyperlink drivers.
+%
+% \enablehyperlinks[OPTIONS] will enable hyperlinks. OPTIONS is a
+% list of comma-separated options. An option is one of the following:
+%
+% idxexact Point index links to exact locations of the term
+% idxpage Point index links to pages with the term (default)
+% idxnone No links for index entries
+% <driver-name> Force the hyperlink driver
+%
+% If <driver-name> is omitted, appropriate driver will be detected, if
+% possible; if not, we fall back on `dvipdfm' (currently this means
+% `pdftex' when \ifpdf, and `dvipdfm' otherwise).
+\def\hl@idxexact@word{idxexact}%
+\def\hl@idxpage@word{idxpage}%
+\def\hl@idxnone@word{idxnone}%
+%
+\def\enablehyperlinks{\@getoptionalarg\@finenablehyperlinks}%
+\def\@finenablehyperlinks{%
+ \let\hl@selecteddriver\empty
+ % By default we generate `idxpage' index hyperlinks.
+ \def\hldest@place@idx{0}%
+ % Go through the option list.
+ \for\hl@arg:=\@optionalarg\do{%
+ \ifx\hl@arg\hl@idxexact@word
+ \def\hldest@place@idx{1}%
+ \else
+ \ifx\hl@arg\hl@idxnone@word
+ \def\hldest@place@idx{-1}%
+ \else
+ \ifx\hl@arg\hl@idxpage@word
+ \def\hldest@place@idx{0}%
+ \else
+ \let\hl@selecteddriver\hl@arg
+ \fi
+ \fi
+ \fi
+ }%
+ % Check the driver name.
+ \ifx\hl@selecteddriver\empty
+ % The user did not specify a driver, detect.
+ \ifpdf
+ \def\hl@selecteddriver{pdftex}%
+ \message{^^JUsing `pdftex' hyperlink driver.}%
+ \else
+ \def\hl@selecteddriver{dvipdfm}%
+ \message{^^JUsing `dvipdfm' hyperlink driver.}%
+ \fi
+ \else
+ % Check that the requested driver's initialization routine is
+ % available.
+ \expandafter\ifx\csname hldriver@\hl@selecteddriver\endcsname \relax
+ \errmessage{No hyperlink driver `\hl@selecteddriver' available}%
+ \fi
+ \fi
+ % Call the driver's initialization routine.
+ \csname hldriver@\hl@selecteddriver\endcsname
+ % Driver should not be changed later.
+ \def\@finenablehyperlinks{\errmessage{Hyperlink driver `\hl@selecteddriver'
+ already selected}}%
+ % Free memory taken up by the drivers.
+ \let\hldriver@nolinks\undefined
+ \let\hldriver@pdftex \undefined
+ \let\hldriver@dvipdfm\undefined
+ % The user can use these to turn the links / destinations on/off
+ % (see comments to the driver `nolinks').
+ \let\hloff\@hloff
+ \let\hlon\@hlon
+ \let\hldestoff\@hldestoff
+ \let\hldeston\@hldeston
+ % Turn everything on by default.
+ \hlon[*,]%
+ \hldeston[*,]%
+}%
+%
+% Driver `nolinks'.
+%
+% Select this driver to suppress any hyperlinks / destinations in your
+% document.
+%
+% NOTE: selecting this driver is quite different from not selecting
+% any driver at all, or from selecting some driver and then turning
+% off links and destinations for the entire document with \hloff and
+% \hldestoff.
+%
+% The purpose of \hldestoff and \hloff is to mark (parts) of document
+% where links should never appear. (Imagine you want to prevent a
+% cross-referencing macro from generating a link at a certain spot in
+% your document.)
+%
+% If instead you have prepared a document with links and just want to
+% compile a version without the links, it is better to select the
+% driver `nolinks'. This will ensure that spacing and pagebreaking
+% will be the same as what you were getting with hyperlinks enabled.
+%
+% The reason for this is that hyperlinks are produced by \special
+% commands. Each \special is placed inside a whatsit which may
+% introduce a legitimate breakpoint at places where none would exist
+% without the whatsit. The macros \hldestoff and \hloff disable
+% hyperlink macros so drastically that no whatsits are produced.
+%
+% On the other hand, `nolinks' driver does not completely disable
+% hyperlink macros. Instead, it defines them to write to the log
+% file (what gets written is not really important). This will produce
+% the whatsits imitating the whatsits from the \special's. (This
+% trick was borrowed from graphics bundle.)
+%
+% Another reason for using `nolinks' is that in horizontal mode
+% \hldest places destinations inside zero-width/height/depth boxes.
+% When you say \hldestoff, \hldest will omit both destination specs
+% and these boxes. The missing boxes can cause typesetting to be
+% inconsistent with what you were getting with destinations enabled.
+% Again, `nolinks' driver helps here by defining \hldest to still
+% produce the empty boxes.
+%
+\def\hldriver@nolinks{%
+ \def\@hldest##1##2##3{%
+ \ifvmode
+ \write-1{\string\hldest: ##3}%
+ \else
+ \allowhyphens
+ \smash{\write-1{\string\hldest: ##3}}%
+ \allowhyphens
+ \fi
+ \ignorespaces
+ }%
+ \def\@hlstart##1##2##3{%
+ \leavevmode
+ \begingroup % Start the color group.
+ \write-1{\string\hlstart: ##3}%
+ \ignorespaces
+ }%
+ \def\@hlend{\write-1{\string\hlend}\endgroup}% End the group from \@hlstart.
+}%
+%
+% Driver `pdftex'.
+%
+\def\hldriver@pdftex{%
+\ifpdf % PDF output is enabled.
+ \def\hl@raw@word{raw}%
+ %
+ % Hyperlink destinations.
+ %
+ % Default type.
+ \def\hldest@type{xyz}%
+ % Set defaults for the options and tell \hl@set@opt what options we
+ % support. (We do not define \hldest@opt@raise, \hl@opt@colormodel
+ % and \hl@opt@color, they are defined and used outside the drivers.)
+ \let\hldest@opt@width \empty
+ \let\hldest@opt@height \empty
+ \let\hldest@opt@depth \empty
+ \let\hldest@opt@zoom \empty
+ \let\hldest@opt@cmd \empty
+ % Multiplexer for all supported destination types.
+ \def\hldest@driver{%
+ % Special case for `raw' destinations.
+ \ifx\@hltype\hl@raw@word
+ \csname \hldest@opt@cmd \endcsname
+ \else
+ \pdfdest name{\@hllabel}\@hltype
+ \csname hldest@typeh@\@hltype\endcsname
+ \fi
+ }%
+ % Define handlers for each supported destination type.
+ \let\hldest@typeh@raw \empty
+ \let\hldest@typeh@fit \empty
+ \let\hldest@typeh@fith \empty
+ \let\hldest@typeh@fitv \empty
+ \let\hldest@typeh@fitb \empty
+ \let\hldest@typeh@fitbh \empty
+ \let\hldest@typeh@fitbv \empty
+ \def\hldest@typeh@fitr{%
+ \ifx\hldest@opt@width \empty \else width \hldest@opt@width \fi
+ \ifx\hldest@opt@height \empty \else height \hldest@opt@height \fi
+ \ifx\hldest@opt@depth \empty \else depth \hldest@opt@depth \fi
+ }%
+ \def\hldest@typeh@xyz{%
+ \ifx\hldest@opt@zoom\empty \else zoom \hldest@opt@zoom \fi
+ }%
+ %
+ % Hyperlinks.
+ %
+ % Default type.
+ \def\hl@type{name}%
+ % We support `url' hyperlinks, so set the `url' group type.
+ \ifx\hl@type@url\empty
+ \def\hl@type@url{url}%
+ \fi
+ % Set defaults for the options and tell \hl@set@opt what options we
+ % support.
+ \let\hl@opt@width \empty
+ \let\hl@opt@height \empty
+ \let\hl@opt@depth \empty
+ \def\hl@opt@bstyle {S}%
+ \def\hl@opt@bwidth {1}%
+ \let\hl@opt@bcolor \empty
+ \let\hl@opt@hlight \empty
+ \let\hl@opt@bdash \empty
+ \let\hl@opt@pagefit \empty
+ \let\hl@opt@cmd \empty
+ \let\hl@opt@file \empty
+ \let\hl@opt@newwin \empty
+ % Multiplexer for all supported link types.
+ \def\hl@driver{%
+ % Special case for `raw' links.
+ \ifx\@hltype\hl@raw@word
+ \csname \hl@opt@cmd \endcsname
+ \else
+ % See if we will construct a /BS spec. We want to bother only
+ % if any of \hl@opt@bstyle, \hl@opt@bwidth and \hl@opt@bdash is
+ % not empty.
+ \let\hl@BSspec\relax % construct
+ \ifx\hl@opt@bstyle \empty
+ \ifx\hl@opt@bwidth \empty
+ \ifx\hl@opt@bdash \empty
+ \let\hl@BSspec\empty % don't construct
+ \fi
+ \fi
+ \fi
+ % Construct common preamble of a link.
+ \def\hlstart@preamble{%
+ \pdfstartlink
+ \ifx\hl@opt@width \empty \else width \hl@opt@width \fi
+ \ifx\hl@opt@height \empty \else height \hl@opt@height \fi
+ \ifx\hl@opt@depth \empty \else depth \hl@opt@depth \fi
+ attr{%
+ \ifx\hl@opt@bcolor\empty\else /C[\hl@opt@bcolor]\fi
+ \ifx\hl@opt@hlight\empty\else /H/\hl@opt@hlight\fi
+ \ifx\hl@BSspec\relax
+ /BS<<%
+ /Type/Border%
+ \ifx\hl@opt@bstyle\empty\else /S/\hl@opt@bstyle\fi
+ \ifx\hl@opt@bwidth\empty\else /W \hl@opt@bwidth\fi
+ \ifx\hl@opt@bdash\empty \else /D[\hl@opt@bdash]\fi
+ >>%
+ \fi
+ }%
+ }%
+ % Call the handler.
+ \csname hl@typeh@\@hltype\endcsname
+ \fi
+ }%
+ % Link type handlers
+ \let\hl@typeh@raw\empty
+ \def\hl@typeh@name{\hlstart@preamble goto name{\@hllabel}}%
+ \def\hl@typeh@num{\hlstart@preamble goto num \@hllabel}%
+ \def\hl@typeh@page{%
+ % PDF requires pages to start from 0, so adjust page number.
+ \count@=\@hllabel
+ \advance\count@ by-1
+ %
+ \hlstart@preamble
+ user{%
+ /Subtype/Link%
+ /Dest%
+ [\the\count@
+ \ifx\hl@opt@pagefit\empty/Fit\else\hl@opt@pagefit\fi]%
+ }%
+ }%
+ \def\hl@typeh@filename{\hl@file{(\@hllabel)}}%
+ \def\hl@typeh@filepage{%
+ % PDF requires pages to start from 0, so adjust page number.
+ \count@=\@hllabel
+ \advance\count@ by-1
+ %
+ \hl@file{%
+ [\the\count@ \ifx\hl@opt@pagefit\empty/Fit\else\hl@opt@pagefit\fi]%
+ }%
+ }%
+ \def\hl@file##1{%
+ \hlstart@preamble
+ user{%
+ /Subtype/Link%
+ /A<<%
+ /Type/Action%
+ /S/GoToR%
+ /D##1%
+ /F(\hl@opt@file)%
+ \ifx\hl@opt@newwin\empty \else
+ /NewWindow \ifcase\hl@opt@newwin false\else true\fi
+ \fi
+ >>%
+ }%
+ }%
+ \def\hl@typeh@url{%
+ \hlstart@preamble
+ user{%
+ /Subtype/Link%
+ /A<<%
+ /Type/Action
+ /S/URI%
+ /URI(\@hllabel)%
+ >>%
+ }%
+ }%
+ %
+ \def\@hlend{\pdfendlink\endgroup}% End the group from the \@hlstart.
+%
+\else % PDF output is not enabled.
+ \message{Warning: `pdftex' hyperlink driver: PDF output is
+ not enabled, falling back on `nolinks' driver.}%
+ \hldriver@nolinks
+\fi
+}%
+%
+% Driver `dvipdfm'.
+%
+\def\hldriver@dvipdfm{%
+ \def\hl@raw@word{raw}%
+ %
+ % Hyperlink destinations.
+ %
+ % Default type.
+ \def\hldest@type{xyz}%
+ % Set defaults for the options and tell \hl@set@opt what options we
+ % support. (We do not define \hldest@opt@raise, \hl@opt@colormodel
+ % and \hl@opt@color, they are defined and used outside the drivers.)
+ \let\hldest@opt@left \empty
+ \let\hldest@opt@top \empty
+ \let\hldest@opt@right \empty
+ \let\hldest@opt@bottom \empty
+ \let\hldest@opt@zoom \empty
+ \let\hldest@opt@cmd \empty
+ % Multiplexer for all supported destination types.
+ \def\hldest@driver{%
+ % Special case for `raw' destinations.
+ \ifx\@hltype\hl@raw@word
+ \csname \hldest@opt@cmd \endcsname
+ \else
+ % Construct common preamble of a destination.
+ \def\hldest@preamble{%
+ pdf: dest (\@hllabel) [@thispage
+ }%
+ % Call the handler.
+ \csname hldest@typeh@\@hltype\endcsname
+ \fi
+ }%
+ % Define handlers for each supported destination type.
+ \let\hldest@typeh@raw\empty
+ \def\hldest@typeh@fit{%
+ \special{\hldest@preamble /Fit]}%
+ }%
+ \def\hldest@typeh@fith{%
+ \special{\hldest@preamble /FitH
+ \ifx\hldest@opt@top\empty @ypos \else \hldest@opt@top \fi]}%
+ }%
+ \def\hldest@typeh@fitv{%
+ \special{\hldest@preamble /FitV
+ \ifx\hldest@opt@left\empty @xpos \else \hldest@opt@left \fi]}%
+ }%
+ \def\hldest@typeh@fitb{%
+ \special{\hldest@preamble /FitB]}%
+ }%
+ \def\hldest@typeh@fitbh{%
+ \special{\hldest@preamble /FitBH
+ \ifx\hldest@opt@top\empty @ypos \else \hldest@opt@top \fi]}%
+ }%
+ \def\hldest@typeh@fitbv{%
+ \special{\hldest@preamble /FitBV
+ \ifx\hldest@opt@left\empty @xpos \else \hldest@opt@left \fi]}%
+ }%
+ \def\hldest@typeh@fitr{%
+ \special{\hldest@preamble /FitR
+ \ifx\hldest@opt@left\empty @xpos\else\hldest@opt@left\fi\space
+ \ifx\hldest@opt@bottom\empty @ypos\else\hldest@opt@bottom\fi\space
+ \ifx\hldest@opt@right\empty @xpos\else\hldest@opt@right\fi\space
+ \ifx\hldest@opt@top\empty @ypos\else\hldest@opt@top \fi]}%
+ }%
+ \def\hldest@typeh@xyz{%
+ \begingroup
+ % Convert zoom factor: 12345 -> 12.345
+ \ifx\hldest@opt@zoom\empty
+ \count1=\z@ \count2=\z@
+ \else
+ \count2=\hldest@opt@zoom
+ \count1=\count2 \divide\count1 by 1000
+ \count3=\count1 \multiply\count3 by 1000
+ \advance\count2 by -\count3
+ \fi
+ \special{\hldest@preamble /XYZ
+ \ifx\hldest@opt@left\empty @xpos\else\hldest@opt@left\fi\space
+ \ifx\hldest@opt@top\empty @ypos\else\hldest@opt@top\fi\space
+ \the\count1.\the\count2]}%
+ \endgroup
+ }%
+ %
+ % Hyperlinks.
+ %
+ % Default type.
+ \def\hl@type{name}%
+ % We support `url' hyperlinks, so set `url' group type.
+ \ifx\hl@type@url\empty
+ \def\hl@type@url{url}%
+ \fi
+ % Set defaults for the options and tell \hl@set@opt what options we
+ % support.
+ \def\hl@opt@bstyle {S}%
+ \def\hl@opt@bwidth {1}%
+ \let\hl@opt@bcolor \empty
+ \let\hl@opt@hlight \empty
+ \let\hl@opt@bdash \empty
+ \let\hl@opt@pagefit \empty
+ \let\hl@opt@cmd \empty
+ \let\hl@opt@file \empty
+ \let\hl@opt@newwin \empty
+ % Multiplexer for all supported link types.
+ \def\hl@driver{%
+ % Special case for `raw' links.
+ \ifx\@hltype\hl@raw@word
+ \csname \hl@opt@cmd \endcsname
+ \else
+ % See if we will construct a /BS spec. We want to bother only
+ % if any of \hl@opt@bstyle, \hl@opt@bwidth and \hl@opt@bdash is
+ % not empty.
+ \let\hl@BSspec\relax % construct
+ \ifx\hl@opt@bstyle \empty
+ \ifx\hl@opt@bwidth \empty
+ \ifx\hl@opt@bdash \empty
+ \let\hl@BSspec\empty % don't construct
+ \fi
+ \fi
+ \fi
+ % Construct common preamble of a link.
+ \def\hlstart@preamble{%
+ pdf: beginann
+ <<%
+ /Type/Annot%
+ /Subtype/Link%
+ \ifx\hl@opt@bcolor\empty\else /C[\hl@opt@bcolor]\fi
+ \ifx\hl@opt@hlight\empty\else /H/\hl@opt@hlight\fi
+ \ifx\hl@BSspec\relax
+ /BS<<%
+ /Type/Border%
+ \ifx\hl@opt@bstyle\empty\else /S/\hl@opt@bstyle\fi
+ \ifx\hl@opt@bwidth\empty\else /W \hl@opt@bwidth\fi
+ \ifx\hl@opt@bdash\empty \else /D[\hl@opt@bdash]\fi
+ >>%
+ \fi
+ }%
+ % Call the handler.
+ \csname hl@typeh@\@hltype\endcsname
+ \fi
+ }%
+ % Link type handlers.
+ \let\hl@typeh@raw\empty
+ \def\hl@typeh@name{\special{\hlstart@preamble /Dest(\@hllabel)>>}}%
+ \def\hl@typeh@page{%
+ % PDF requires pages to start from 0, so adjust page number.
+ \count@=\@hllabel
+ \advance\count@ by-1
+ %
+ \special{%
+ \hlstart@preamble
+ /Dest[\the\count@
+ \ifx\hl@opt@pagefit\empty/Fit\else\hl@opt@pagefit\fi]%
+ >>%
+ }%
+ }%
+ \def\hl@typeh@filename{\hl@file{(\@hllabel)}}%
+ \def\hl@typeh@filepage{%
+ % PDF requires pages to start from 0, so adjust page number.
+ \count@=\@hllabel
+ \advance\count@ by-1
+ %
+ \hl@file{%
+ [\the\count@ \ifx\hl@opt@pagefit\empty/Fit\else\hl@opt@pagefit\fi]%
+ }%
+ }%
+ \def\hl@file##1{%
+ \special{%
+ \hlstart@preamble
+ /A<<%
+ /Type/Action%
+ /S/GoToR%
+ /D##1%
+ /F(\hl@opt@file)%
+ \ifx\hl@opt@newwin\empty \else
+ /NewWindow \ifcase\hl@opt@newwin false\else true\fi
+ \fi
+ >>%
+ >>%
+ }%
+ }%
+ \def\hl@typeh@url{%
+ \special{%
+ \hlstart@preamble
+ /A<<%
+ /Type/Action
+ /S/URI%
+ /URI(\@hllabel)%
+ >>%
+ >>%
+ }%
+ }%
+ %
+ \def\@hlend{\special{pdf: endann}\endgroup}% End the group from \@hlstart.
+}%
+%
+% Internal hyperlink macros.
+%
+% \hl@define@eqlabel{LABEL} will define \hl@eqlabel to a non-empty
+% hyperlink label for an equation. The idea is to generate
+% (hopefully) unique label in cases when LABEL is empty (e.g., when
+% user says `\eqdef{}'). To customize the autogenerated labels
+% redefine \phantomeqlabel.
+%
+\newcount\phantomeqnumber
+\def\phantomeqlabel{PHEQ\the\phantomeqnumber}%
+%
+\def\hl@define@eqlabel#1{%
+ % Make all definitions global so they are not shadowed by groups
+ % (\@eqdef depends on this).
+ \ifempty{#1}%
+ \global\advance\phantomeqnumber by1
+ \xdef\hl@eqlabel{\phantomeqlabel}%
+ \else
+ \gdef\hl@eqlabel{#1}%
+ \fi
+}%
+%
+% Cross-reference macros call hyperlink macros, so define them to
+% produce nothing by default. However, we still want \hldest and
+% \hlstart to produce \leavevmode and/or \ignorespaces, to make
+% cross-reference macros consistent. Note that this, strictly
+% speaking, makes cross-reference macros incompatible with
+% pre-hyperlink releases of eplain, in cases where paragraph is
+% started by a cross-reference macro. It is quite unlikely though
+% that any problem will arise.
+\let\hldeston\relax \let\hldestoff\relax
+\let\hlon\relax \let\hloff\relax
+\@@hloff
+\@@hldestoff
+%
+%
+%
+% Support for LaTeX packages under plain TeX.
+%
+% We use miniltx.tex from the LaTeX graphics collection and build on
+% it to provide package options support, package version check,
+% recursive package loading with \RequirePackage, proper handling of
+% \AtBeginDocument and \AtEndOfPackage.
+%
+% Much of the following was borrowed from LaTeX.
+%
+% The internal variables are quite a mess, so here is a hint:
+%
+% - \usepkg@pkg, \usepkg@options, \usepkg@date are used by
+% \usepackage to save its parameters.
+%
+% - When \RequirePackage is called within a package, the above
+% variables are saved in \usepkg@save@VAR@RECURSIONLEVEL, where
+% VAR={pkg,options,date}, and RECURSIONLEVEL is incremented for
+% each nested package inclusion. This way the variables can be
+% restored after the (nested) package will have been loaded.
+%
+% - Options for package PACKAGE (no .sty extension) are accumulated
+% in \usepkg@options@PACKAGE.
+%
+% - For each declared option OPTION in package PACKAGE, we save the
+% code which enables OPTION in \usepkg@option@PACKAGE@OPTION.
+% There may be a star (`*') option declaration, the code from which
+% will be used to process options not declared by the package
+% (without it, an undeclared option will cause an error).
+%
+% - For each loaded PACKAGE / FILE.EXT we declare \ver@PACKAGE.sty /
+% \ver@FILE.EXT. We use \ver@PACKAGE.sty to detect reloading
+% of packages. Some packages also use these macros.
+%
+% - Calls to \AtBeginDocument accumulate the code in
+% \usepkg@at@begin@document. We will expand it at the end of the
+% \beginpackages...\endpackages `environment'.
+%
+% - Calls to \AtEndOfPackage accumulate the code in
+% \usepkg@at@end@of@package. We will expand it after the package
+% is loaded. To allow recursive package loading, \RequirePackage
+% saves \usepkg@at@end@of@package analogous to \usepkg@pkg.
+%
+\newif\ifusepkg@miniltx@loaded
+\newcount\usepkg@recursion@level
+\def\usepkg@rcrs{\the\usepkg@recursion@level}%
+\let\usepkg@at@begin@document\empty
+\let\usepkg@at@end@of@package\empty
+\def\usepkg@word@autopict{autopict}%
+\def\usepkg@word@psfrag{psfrag}%
+% \beginpackages...\endpackages
+%
+% All packages must be loaded within this `environment' (a kind of
+% LaTeX's preamble). This is so to give us a chance to expand the
+% accumulated \AtBeginDocument commands. Usually, you will want to
+% restrict all \usepackage's to a single \beginpackages...\endpackages,
+% just like in LaTeX, where you load all packages within a (single)
+% preamble.
+\long\def\beginpackages#1\endpackages{%
+ \let\usepackage\real@usepackage
+ #1%
+ \usepkg@at@begin@document
+ \global\let\usepkg@at@begin@document\empty
+ \global\let\usepackage\fake@usepackage
+}%
+% \fake@usepackage
+%
+% This is what \usepackage is defined to outside of
+% \beginpackages...\endpackages `environment'.
+\def\fake@usepackage{\errmessage{You should not use \string\usepackage\space outside of^^J
+ \@spaces\string\beginpackages...\string\endpackages\space environment}%
+}%
+% \RequirePackage[OPTIONS]{PACKAGES}[YYYY/MM/DD]
+%
+% Save parameters for the package being loaded and call \usepackage to
+% load PACKAGES. We depend on \usepackage to restore the saved
+% parameters. We allow for nested calls to \RequirePackage.
+\def\eplain@RequirePackage{%
+ \global\ece\let{usepkg@save@pkg\usepkg@rcrs}\usepkg@pkg
+ \global\ece\let{usepkg@save@options\usepkg@rcrs}\usepkg@options
+ \global\ece\let{usepkg@save@date\usepkg@rcrs}\usepkg@date
+ \global\ece\let{usepkg@at@end@of@package\usepkg@rcrs}\usepkg@at@end@of@package
+ \global\advance\usepkg@recursion@level by\@ne
+ \real@usepackage
+}%
+% \usepackage[OPTIONS]{PACKAGES}[YYYY/MM/DD]
+%
+% Load each of the PACKAGES with OPTIONS, checking that the package
+% date is at least YYYY/MM/DD; if it is not, issue a warning.
+\let\usepackage\fake@usepackage
+\def\real@usepackage{\@getoptionalarg\@finusepackage}%
+\def\@finusepackage#1{%
+ \let\usepkg@options\@optionalarg
+ \ifempty{#1}%
+ \errmessage{No packages specified}%
+ \fi
+ % Load miniltx.tex, if it is not loaded.
+ \ifusepkg@miniltx@loaded \else
+ \testfileexistence[miniltx]{tex}%
+ \if@fileexists
+ \input miniltx.tex
+ \global\usepkg@miniltx@loadedtrue
+ % Redefine some macros from miniltx.tex
+ \global\let\RequirePackage\eplain@RequirePackage
+ \global\let\DeclareOption\eplain@DeclareOption
+ \global\let\PassOptionsToPackage\eplain@PassOptionsToPackage
+ \global\let\ExecuteOptions\eplain@ExecuteOptions
+ \global\let\ProcessOptions\eplain@ProcessOptions
+ \global\let\AtBeginDocument\eplain@AtBeginDocument
+ \global\let\AtEndOfPackage\eplain@AtEndOfPackage
+ \global\let\ProvidesFile\eplain@ProvidesFile
+ \global\let\ProvidesPackage\eplain@ProvidesPackage
+ \else
+ \errmessage{miniltx.tex not found, cannot load LaTeX packages}%
+ \fi
+ \fi
+ % Read the trailing optional arg (YYYY/MM/DD).
+ \@ifnextchar[%]
+ {\@finfinusepackage{#1}}%
+ {\@finfinusepackage{#1}[]}%
+}%
+%
+\def\@finfinusepackage#1[#2]{%
+ \edef\usepkg@date{#2}%
+ % Load each package from the list. Do it outside the \for loop to
+ % avoid clashes with any \for loops executed by the package.
+ \let\usepkg@load@list\empty
+ \for\usepkg@pkg:=#1\do{%
+ \toks@=\expandafter{\usepkg@load@list}%
+ \edef\usepkg@load@list{%
+ \the\toks@
+ \noexpand\usepkg@load@pkg{\usepkg@pkg}%
+ }%
+ }%
+ \usepkg@load@list
+ % Restore parameters in case we were called from \RequirePackage.
+ \ifnum\usepkg@recursion@level>0
+ \global\advance\usepkg@recursion@level by\m@ne
+ \expandafter\let\expandafter\usepkg@pkg\csname usepkg@save@pkg\usepkg@rcrs\endcsname
+ \expandafter\let\expandafter\usepkg@options\csname usepkg@save@options\usepkg@rcrs\endcsname
+ \expandafter\let\expandafter\usepkg@date\csname usepkg@save@date\usepkg@rcrs\endcsname
+ \expandafter\let\expandafter\usepkg@at@end@of@package\csname usepkg@at@end@of@package\usepkg@rcrs\endcsname
+ % Free the memory.
+ \global\ece\let{usepkg@save@pkg\usepkg@rcrs}\undefined
+ \global\ece\let{usepkg@save@options\usepkg@rcrs}\undefined
+ \global\ece\let{usepkg@save@date\usepkg@rcrs}\undefined
+ \global\ece\let{usepkg@at@end@of@package\usepkg@rcrs}\undefined
+ \fi
+}%
+% Load one package. We assume packages have `sty' extension.
+\def\usepkg@load@pkg#1{%
+ % Special cases for `autopict' and `psfrag' packages:
+ % - `psfrag' is loaded by psfrag.tex.
+ % - `autopict' is loaded by picture.tex, but the package file is
+ % autopict.sty.
+ \def\usepkg@pkg{#1}%
+ \ifx\usepkg@pkg\usepkg@word@autopict
+ \testfileexistence[picture]{tex}%
+ \if@fileexists \else
+ \errmessage{Loader `picture.tex' for package `\usepkg@pkg' not found}%
+ \fi
+ \else
+ \ifx\usepkg@pkg\usepkg@word@psfrag
+ \testfileexistence[psfrag]{tex}%
+ \if@fileexists \else
+ \errmessage{Loader `psfrag.tex' for package `\usepkg@pkg' not found}%
+ \fi
+ \fi
+ \fi
+ % See if the package was loaded. If it was, we just bail out.
+ % (Maybe we should skip reloading it/warn? We don't want to go into
+ % checking that the package was first loaded with a subset of
+ % options which are requested now.) \ProvidePackage and
+ % \ProvideFile define the macro \ver@PACKAGE.sty (see
+ % \eplain@pr@videpackage below).
+ \ifundefined{ver@\usepkg@pkg.sty}\else
+ \errmessage{Package `\usepkg@pkg' already loaded}%
+ \fi
+ \testfileexistence[\usepkg@pkg]{sty}%
+ \if@fileexists \else
+ \errmessage{Package `\usepkg@pkg' not found}%
+ \fi
+ % Construct option list for the package. Include any options
+ % passed to us by \PassOptionsToPackage and \RequirePackage.
+ \expandafter\let\expandafter\temp\csname usepkg@options@\usepkg@pkg\endcsname
+ \ifx\temp\relax
+ \let\temp\empty
+ \fi
+ \ifx\temp\empty
+ \let\temp\usepkg@options
+ \else
+ \ifx\usepkg@options\empty \else
+ \edef\temp{\temp,\usepkg@options}%
+ \fi
+ \fi
+ \global\ece\let{usepkg@options@\usepkg@pkg}\temp
+ % For the duration of the package, we want any calls to \usepackage
+ % to be mapped to \RequirePackage, to allow nested package loads
+ % without clobbering up anything. (Maybe packages never use
+ % \usepackage instead of \RequirePackage, but this won't hurt.)
+ \let\usepackage\eplain@RequirePackage
+ % Clear \AtEndOfPackage commands (can be non-empty during recursive
+ % package loading).
+ \global\let\usepkg@at@end@of@package\empty
+ % Load the package. If the package asks to load other package,
+ % \RequirePackage will save our \usepkg@{pkg,options,date} and
+ % \AtEndOfPackage commands, and \usepackage will restore them after
+ % recursively loading that package, so we don't worry about our
+ % setup being clobbered.
+ \ifx\usepkg@pkg\usepkg@word@autopict
+ \input picture.tex
+ \else
+ \ifx\usepkg@pkg\usepkg@word@psfrag
+ \input \usepkg@pkg.tex
+ \else
+ \input \usepkg@pkg.sty
+ \fi
+ \fi
+ % Execute the accumulated \AtEndOfPackage commands, and reset them
+ % to free the memory.
+ \usepkg@at@end@of@package
+ \global\let\usepkg@at@end@of@package\empty
+ % Restore the `real' \usepackage definition.
+ \let\usepackage\real@usepackage
+ % Clear the option list for the loaded package (we won't load a
+ % second copy anyway).
+ \global\ece\let{usepkg@options@\usepkg@pkg}\undefined
+ % Set \Url@HyperHook for url.sty
+ \def\Url@HyperHook##1{\hlstart@impl{url}{\Url@String}##1\hlend@impl{url}}%
+ % We check package version in \ProvidePackage, before reading the
+ % rest of the package, so that in case of errors (which can be
+ % numerous) the warning hopefully comes before the errors.
+% \@ifl@ter{sty}\usepkg@pkg\usepkg@date{}%
+% {\message{Warning: you have requested package `\usepkg@pkg', version \usepkg@date,^^J
+% \@spaces but only version `\csname ver@\usepkg@pkg.sty\endcsname' is available.}}%
+}%
+% \DeclareOption{OPTION}{CODE}
+%
+% Save CODE in `usepkg@option@PACKAGE@OPTION'. Starred version is not
+% treated any different here, but when defined it will be used by
+% \ProcessOptions and \ExecuteOptions to process undeclared options.
+\def\eplain@DeclareOption#1#2{%
+ \toks@{#2}%
+ \expandafter\xdef\csname usepkg@option@\usepkg@pkg @#1\endcsname{\the\toks@}%
+}%
+% \PassOptionsToPackage{OPTIONS}{PACKAGES}
+%
+% Add OPTIONS to the option list for each of the PACKAGES.
+\def\eplain@PassOptionsToPackage#1#2{%
+ \ifempty{#1}\else
+ \for\usepkg@temp:=#2\do{%
+ \expandafter\let\expandafter\temp\csname usepkg@options@\usepkg@temp\endcsname
+ \ifx\temp\relax
+ \let\temp\empty
+ \fi
+ \ifx\temp\empty
+ \edef\temp{#1}%
+ \else
+ \edef\temp{\temp,#1}%
+ \fi
+ \global\ece\let{usepkg@options@\usepkg@temp}\temp
+ }%
+ \fi
+}%
+% \ExecuteOptions{OPTIONS}
+% \ProcessOptions
+%
+% \ExecuteOptions executes each option from OPTIONS, \ProcessOptions
+% executes each option from the option list for the current package.
+% If the star (`*') option is declared, it will be used to process
+% undeclared options; otherwise, undeclared option will cause an
+% error.
+\def\usepkg@exec@options#1{%
+ % The iterator \CurrentOption below was used purposely. Some
+ % packages use it in the argument to \DeclareOption.
+ \for\CurrentOption:=#1\do{%
+ \expandafter\let\expandafter\usepkg@temp
+ \csname usepkg@option@\usepkg@pkg @\CurrentOption\endcsname
+%
+ \ifx\usepkg@temp\relax
+ % Option is not declared. If a `default' option handler is
+ % declared, use it.
+ \expandafter\let\expandafter\temp\csname usepkg@option@\usepkg@pkg @*\endcsname
+ \ifx\temp\relax
+ \errmessage{Unknown option `\CurrentOption' to package `\usepkg@pkg'}%
+ \else
+ \temp
+ \fi
+ \else
+ % Option is declared.
+ \usepkg@temp
+ \fi
+ }%
+}%
+%
+\let\eplain@ExecuteOptions\usepkg@exec@options
+\def\eplain@ProcessOptions{%
+ \expandafter\usepkg@exec@options\csname usepkg@options@\usepkg@pkg\endcsname
+}%
+% \AtBeginDocument{CODE}
+% \AtEndOfPackage{CODE}
+%
+% miniltx.tex defines \AtBeginDocument to execute its parameter right
+% away, but some packages depend on \AtBeginDocument to be executed
+% after packages are processed. So we redefine \AtBeginDocument to
+% accumulate its argument, to be executed by us at the end of
+% \beginpackages...\endpackages. \AtEndOfPackage is not defined by
+% miniltx.tex at all; we define it similar to \AtBeginDocument.
+\def\usepkg@accumulate@cmds#1#2{%
+ \toks@=\expandafter{#1}%
+ \toks@ii={#2}%
+ \xdef#1{\the\toks@\the\toks@ii}%
+}%
+\def\eplain@AtBeginDocument{\usepkg@accumulate@cmds\usepkg@at@begin@document}%
+\def\eplain@AtEndOfPackage{\usepkg@accumulate@cmds\usepkg@at@end@of@package}%
+% \ProvidesFile{FILENAME.EXT}[VERSION]
+% \ProvidesPackage{PACKAGENAME}[VERSION]
+%
+% miniltx.tex defines \ProvidesFile and \ProvidesPackage to only log a
+% message. We want to define \ver@PACKAGE.sty / \ver@FILENAME.EXT, as
+% we depend on these to know when a package/file has been loaded, and
+% some packages depend on them, too.
+\def\eplain@ProvidesPackage#1{%
+ \@ifnextchar[%]
+ {\eplain@pr@videpackage{#1.sty}}{\eplain@pr@videpackage#1[]}%
+}%
+\def\eplain@pr@videpackage#1[#2]{%
+ \wlog{#1: #2}%
+ % This will flag the package as loaded.
+ \expandafter\xdef\csname ver@#1\endcsname{#2}%
+% \expandafter\edef\expandafter\temp{\csname usepkg@options@\usepkg@pkg\endcsname}%
+% \message{^^JPackage:\usepkg@pkg^^JOptions:\usepkg@options^^J+ passed options:\temp^^J}%
+ % Check package version.
+ \@ifl@t@r{#2}\usepkg@date{}%
+ {\message{Warning: you have requested package `\usepkg@pkg', version \usepkg@date,^^J
+ \@spaces but only version `\csname ver@#1\endcsname' is available.}}%
+}%
+%
+\def\eplain@ProvidesFile#1{%
+ \@ifnextchar[%]
+ {\eplain@pr@videfile{#1}}{\eplain@pr@videfile#1[]}%
+}%
+\def\eplain@pr@videfile#1[#2]{%
+ \wlog{#1: #2}%
+ % This will flag the file as loaded.
+ \expandafter\xdef\csname ver@#1\endcsname{#2}%
+ % We don't check file version. graphics calls \ProvideFile to
+ % \includegraphics, and it does not give any date at the beginning
+ % of #2, so checking the date will cause an error.
+}%
+% Check package version. From LaTeX.
+\def\@ifl@ter#1#2{%
+ \expandafter\@ifl@t@r
+ \csname ver@#2.#1\endcsname
+}%
+\def\@ifl@t@r#1#2{%
+ \ifnum\expandafter\@parse@version#1//00\@nil<%
+ \expandafter\@parse@version#2//00\@nil
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi
+}%
+\def\@parse@version#1/#2/#3#4#5\@nil{#1#2#3#4 }%
+% Needed by some packages.
+\def\@spaces{\space\space\space\space}%
+\def\@inmatherr#1{%
+ \relax
+ \ifmmode
+ \errmessage{The command is invalid in math mode}%
+ \fi
+}%
+%
+%
+%
+\let\wlog = \@plainwlog
+\catcode`@ = \@eplainoldatcode
+%
+\def\fmtname{eplain}%
+\def\eplain{t}%
+{\edef\plainversion{\fmtversion}%
+ \xdef\fmtversion{REPLACE-WITH-VERSION: REPLACE-WITH-DAY-MONTH-YEAR (and plain \plainversion)}%
+}%
+%
+%
+%
+%
+% Local variables:
+% page-delimiter: "^% \f"
+% End: