summaryrefslogtreecommitdiff
path: root/macros/lollipop
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/lollipop
Initial commit
Diffstat (limited to 'macros/lollipop')
-rw-r--r--macros/lollipop/README86
-rw-r--r--macros/lollipop/config/lollipop.ini23
-rw-r--r--macros/lollipop/doc/manual/address.tex186
-rw-r--r--macros/lollipop/doc/manual/appendix.tex69
-rw-r--r--macros/lollipop/doc/manual/btxmac.tex812
-rw-r--r--macros/lollipop/doc/manual/comm.tex642
-rw-r--r--macros/lollipop/doc/manual/comment.tex129
-rw-r--r--macros/lollipop/doc/manual/example.tex4
-rw-r--r--macros/lollipop/doc/manual/extern.tex428
-rw-r--r--macros/lollipop/doc/manual/head.tex118
-rw-r--r--macros/lollipop/doc/manual/list.tex442
-rw-r--r--macros/lollipop/doc/manual/lollipop-manual.bib59
-rw-r--r--macros/lollipop/doc/manual/lollipop-manual.pdfbin0 -> 328623 bytes
-rw-r--r--macros/lollipop/doc/manual/lollipop-manual.tex92
-rw-r--r--macros/lollipop/doc/manual/mandefs.tex225
-rw-r--r--macros/lollipop/doc/manual/opt.tex408
-rw-r--r--macros/lollipop/doc/manual/out.tex349
-rw-r--r--macros/lollipop/doc/manual/prelim.tex327
-rw-r--r--macros/lollipop/doc/manual/struct.tex264
-rw-r--r--macros/lollipop/doc/manual/titlepag.tex85
-rw-r--r--macros/lollipop/doc/manual/trace.tex61
-rw-r--r--macros/lollipop/doc/tex-inde.xen261
-rw-r--r--macros/lollipop/tex/lollipop-define.tex425
-rw-r--r--macros/lollipop/tex/lollipop-document.tex381
-rw-r--r--macros/lollipop/tex/lollipop-float.tex51
-rw-r--r--macros/lollipop/tex/lollipop-fontdefs.tex42
-rw-r--r--macros/lollipop/tex/lollipop-fonts.tex416
-rw-r--r--macros/lollipop/tex/lollipop-heading.tex49
-rw-r--r--macros/lollipop/tex/lollipop-lists.tex362
-rw-r--r--macros/lollipop/tex/lollipop-output.tex744
-rw-r--r--macros/lollipop/tex/lollipop-plain.tex1249
-rw-r--r--macros/lollipop/tex/lollipop-text.tex553
-rw-r--r--macros/lollipop/tex/lollipop-tools.tex1509
-rw-r--r--macros/lollipop/tex/lollipop.tex141
34 files changed, 10992 insertions, 0 deletions
diff --git a/macros/lollipop/README b/macros/lollipop/README
new file mode 100644
index 0000000000..fd6a650318
--- /dev/null
+++ b/macros/lollipop/README
@@ -0,0 +1,86 @@
+About Lollipop and its manual.
+
+You have obtained a package containing the Lollipop format
+and its manual.
+
+The manual is a pretty good illustration of the power of
+Lollipop, but there is also a file 'address.tex' which
+contains example macros for an address book.
+
+Lollipop is still under development. The manual contains
+some remarks about what is still to be done. If you have any
+questions, remarks, suggestions (or if you want to voice
+your appreciation :-) , feel free to contact me:
+
+ Vafa Khalighi
+ persian-tex@tug.org
+
+Here is how much of TeX's memory you used:
+ 1194 strings out of 496579
+ 16173 string characters out of 6202690
+ 72655 words of memory out of 5000000
+ 3270 multiletter control sequences out of 15000+600000
+ 11241 words of font info for 40 fonts, out of 8000000 for 9000
+ 19 hyphenation exceptions out of 8191
+ 24i,4n,24p,187b,562s stack positions out of 5000i,500n,10000p,200000b,80000s
+
+Output written on lollipop-manual.dvi (59 pages, 155468 bytes).
+
+History so far:
+
+0.9 October 1992, first public release
+
+0.91 Unannounced update
+ TeX3 based lollipop-plain
+ penalties and white space in embedded constructs
+ splittopskip set equal to topskip
+
+0.92 November 1992, update for friends and family
+ Copyright notices added
+ math family setting for \rm, \bf, \tt
+ bugs in penalties corrected
+
+0.93 December 1992, official update
+ Lots of nobreaks in pre/post-tex material of constructs
+ Synonym counters repaired
+ Topskip and raggedbottom in state of repair
+
+0.94 December 1992, unofficial update
+ Adaptive distances
+
+0.95 January 1993, unofficial update
+ Short titles, rewritten external files,
+ address book example format.
+
+0.97 4 April 2014, organized and updated
+ files and also generated format.
+
+0.98 6 April 2014, changed all lollipop filenames
+ to start with `lollipop' prefix, and fixed typewriter font.
+
+0.99 9 April 2014, improved ini file, and the error in
+ address.tex example fixed.
+
+1.00 11 April 2014, updated lollipop-plain.tex and manual.
+
+1.01 12 April 2014, Updated lollipop-text.tex (changed "#1 cs to \"#1 cs
+ to be compatible with plain
+
+1.02 16 April 2014, Updated lollipop-text.tex (defined \EveryParagraph,
+ \EveryMath, and \EveryDisplay), defined \PointSizeScriptSizes:12
+
+1.03 19 April 2014, Fixed the wrong numbering of nested enumerate lists
+
+1.05 16 April 2016, Changed \lolli@name to \lollipop@name
+ added \footnoterule to output routine
+ defined \PushLeftIndentLevel, \PopLeftIndentLevel,
+ \PushRightIndentLevel, \PopRightIndentLevel,
+ \PushLeftRightIndentLevels, and \PopLeftRightIndentLevels
+ commands. \PushIndentLevel is now a synonym for
+ \PushLeftIndentLevel and \PopIndentLevel is a synonym
+ for \PopLeftIndentLevel
+ fixed the error caused by \newhelp
+
+1.06 14 May 2016, Defined \FrenchSpacing
+
+1.07 21 May 2016, Some minor changes \ No newline at end of file
diff --git a/macros/lollipop/config/lollipop.ini b/macros/lollipop/config/lollipop.ini
new file mode 100644
index 0000000000..d7314a3e44
--- /dev/null
+++ b/macros/lollipop/config/lollipop.ini
@@ -0,0 +1,23 @@
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\scrollmode
+\input lollipop
+\dump
+\endinput
+
+% lollipop.fmt is generated by `tex -ini -jobname=lollipop -progname=lollipop lollipop.ini' \ No newline at end of file
diff --git a/macros/lollipop/doc/manual/address.tex b/macros/lollipop/doc/manual/address.tex
new file mode 100644
index 0000000000..3627c90d55
--- /dev/null
+++ b/macros/lollipop/doc/manual/address.tex
@@ -0,0 +1,186 @@
+% address book macros
+% copyright 1993 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+% These macros are based on the Lollipop macro package,
+% copyright 1992/3 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+% Format this file twice to get external files right.
+%
+
+% Some general options.
+% Please use another typeface if you have it!
+%
+\Distance:whitebefore=0pt \Distance:whiteafter=0pt
+\AlwaysIndent:no \FlushRight:no
+\TypeFace:ComputerSans \PointSize:8 \Style:roman
+\def\\{,\Spaces:1 }
+
+% The page is four columns, no footers etc
+%
+\DefinePageGrid:ThePage width:page=6.5in height:page=5in
+ textband:start text white:10pt text white:10pt
+ text white:10pt text textband:stop Stop
+
+% The main macro is the text block \Entity, representing one item
+% in the address book.
+%
+\DefineTextBlock:Entity HasTitle:short
+ whitebefore:{6pt plus 6pt minus 3pt} whiteafter:whitebefore
+ line:start rule:v={height 7pt width7pt depth0pt} Spaces:2
+ Style:italic title line:stop Stop
+
+% Data in an entity is formatted as a number of headings.
+% We declare all headings to be embedded, ie, they form a paragraph.
+% The 'nomarks' option is to prevent memory overflow.
+%
+\OptionsMacro:embed=embedded:yes nomarks
+ whitebefore:0pt whiteafter:0pt Stop
+\DefineHeading:phone HasTitle:short macro:embed
+ literal:phone : Spaces:1.5 title , Spaces:2 Stop
+\DefineHeading:fax HasTitle:short macro:embed
+ literal:fax : Spaces:1.5 title , Spaces:2 Stop
+\DefineHeading:Address HasTitle:short macro:embed
+ title , Spaces:2 Stop
+\DefineHeading:Note HasTitle:short macro:embed
+ ( title ) Spaces:2 Stop
+
+% Here's an example of non-standard handling of the title:
+% email addresses are set in \tt, and can be broken differently
+%
+\def\breakemail{\hyphenchar\font=`. }
+\DefineHeading:email HasTitle:short macro:embed
+ begingroup tt breakemail title endgroup , Spaces:2 Stop
+
+% This is invisible information; maybe later we'll do something
+% with it.
+\DefineHeading:Route HasTitle:short Stop
+
+% Here is the first really cute application.
+% If a person is declared to be \At a certain company, then
+% that fact is written out to an external file, which can be loaded
+% later.
+%
+\DefineExternalFile:companies=ats
+\def\WorksAt{Works at: }
+\DefineHeading:At macro:embed
+ HasTitle:short WorksAt title Spaces:2
+ external:companies title unhskip title:Entity unhskip external:stop Stop
+% When the 'companies' file gets loaded the title only gets
+% parsed by the macro \CompNam, and nothing else happens.
+% The title is split into company and person; #1 becomes the name
+% of a list to which #2 is added.
+%
+\def\CompNam#1\unhskip#2\unhskip{
+ \if\UndefinedCS{#1}\NewList:{#1} \fi
+ \AppendToList:#1={#2\unhskip, } }
+\DefineExternalItem:At file:companies
+ expandafter CompNam title Stop
+% The company lists are later simply loaded; see below.
+
+% Even more complicated: birthdays.
+% All birthdays are written to an external file.
+%
+\DefineExternalFile:births=brt
+\DefineHeading:birthday HasTitle:short macro:embed
+ literal:Born : title Spaces:2
+ external:births title unhskip title:Entity unhskip external:stop Stop
+% Later every month becomes something like an entity;
+% here is how we generate a token list for each month.
+%
+\def\month#1{\ifcase#1\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}
+\tempcounta=1 \loop\ifnum\tempcounta<13
+ \xp\NewList\xp:\xp{\month\tempcounta}
+ \advance\tempcounta1 \repeat
+% Formatting the caboodle means:
+% -- loading the 'births' file
+% -- formatting each month separately by \OneMonth
+% which is essentially a call to the text block \Month
+%
+\def\AllBirths{\LoadExternalFile:births
+ \tempcounta=1 \loop\ifnum\tempcounta<13
+ \OneMonth \advance\tempcounta1 \repeat}
+\def\OneMonth{\xp\Month\month\tempcounta\par
+ \TheList:{\month\tempcounta} \>}
+% Month is much like \Entity, just a bit different visually.
+%
+\DefineTextBlock:Month
+ whitebefore:{6pt plus 6pt minus 3pt} whiteafter:whitebefore
+ line:start rule:v={height 7pt width7pt depth0pt} Spaces:2
+ Style:italic title Spaces:2
+ fillup rule:v={height 7pt width7pt depth0pt} line:stop
+ Stop
+% When the external file is loaded, every birthday is processed
+% by \BirNam which splits it into #1 year #2 month #3 day and
+% #4 person's name. This is then written to the list for the
+% appropriate month.
+%
+\def\BirNam#1 #2 #3\unhskip #4\unhskip
+ {\tempcounta#2\relax
+ \AppendToList:{\month\tempcounta}={\JollyFellow #3 #4 (#1)\par}
+ }
+\DefineExternalItem:birthday file:births
+ expandafter BirNam title Stop
+\DefineHeading:JollyFellow title nomarks Stop
+
+% Phooeew! Now we can get down to business!
+
+\WriteExtern:yes
+\Start
+\LoadExternalFile:companies
+
+\Entity Adam Aardvark
+\Address Page~1, English Language Dictionary
+\>
+
+\Entity Barbara Beeton
+\At Tugbt
+\Note Editor in chief
+\>
+
+\Entity Jane Doe
+\email doe@re.mi.sol
+\>
+
+\Entity John Doe
+\phone +1 212 555 4141
+\>
+
+\Entity Victor Eijkhout
+\Address Department of Computer Science, University of Tennessee
+\phone +1 615 974 8298
+\At Tugbt
+\Note merely associate editor
+\email eijkhout@cs.utk.edu
+\birthday 1959 11 29
+\>
+
+\Entity Elvis Presley
+\birthday 1938(?) 01 08
+\>
+
+\Entity Tugboat
+\TheList:Tugbt
+\>
+
+\AllBirths
+
+\Stop
+
diff --git a/macros/lollipop/doc/manual/appendix.tex b/macros/lollipop/doc/manual/appendix.tex
new file mode 100644
index 0000000000..5b05e32214
--- /dev/null
+++ b/macros/lollipop/doc/manual/appendix.tex
@@ -0,0 +1,69 @@
+% appendix.tex copyright1992 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\Chapter Example styles
+
+To show you the strength of \Lollipop, this chapter collects a few
+example style definitions. The first one is that of this manual.
+
+\Section The style definition for this book
+
+In case you were wondering how this book was typeset, here is the
+full style definition. By the standards of what Lollipop can do it is
+pretty pedestrian.
+
+One thing that may have provide intellectual titilation is the
+definition of \cs{Example} and \cs{OutExample}.
+It allowed me to keep the examples in sync with their output.
+
+Of course that
+doesn't really rely on \Lollipop. It does illustrate the fact that
+\Lollipop\ is interfaceable to arbitrary macros. (But don't try
+loading \Lollipop\ on top of \LaTeX! On second thought, do. It
+disables most of \LaTeX. Just kidding.)
+
+\begingroup \PointSize:8 \tt
+\verbatimfile{mandefs.tex}\endgroup
+
+\Section[sec:address] Address book
+
+The following macros generate an address book. Several noteworthy
+features:
+\Itemize\item Most titles are short, that is, delimited by the line
+end.
+ \item Since a page will now have several dozens of headings, the
+number of marks placed will become a problem, therefore the option
+\opt{nomarks} is included everywhere. Without this you would easily
+have memory overflows.
+ \item The \cs{At} heading writes its information to an external
+file. This is then parsed by the macro \cs{CompNam}. A~slight amount
+of knowledge of Lollipop internals is used here for parameter parsing,
+but not more than can be gleaned from simply looking at the external
+file.\par
+ Then a token list is created for each company, and these lists are
+printed somewhere down the file. This is a bit of \TeX\ programming
+that is not quite elementary, but still \Lollipop saves you a lot of
+work.
+ \>
+If you want to see the output, run \TeX\ with Lollipop twice on the
+\file{address.tex} file.
+
+ \begingroup \PointSize:8 \tt
+\verbatimfile{address.tex}\endgroup
+
+\endinput \ No newline at end of file
diff --git a/macros/lollipop/doc/manual/btxmac.tex b/macros/lollipop/doc/manual/btxmac.tex
new file mode 100644
index 0000000000..3093ed1a83
--- /dev/null
+++ b/macros/lollipop/doc/manual/btxmac.tex
@@ -0,0 +1,812 @@
+%% @texfile{
+%% author = "Karl Berry and Oren Patashnik",
+%% version = "0.99h",
+%% date = "24 Apr 1991",
+%% filename = "btxmac.tex",
+%% address = "Please use electronic mail",
+%% checksum = "812 4053 30557",
+%% email = "opbibtex@neon.stanford.edu",
+%% codetable = "ISO/ASCII",
+%% supported = "yes",
+%% docstring = "Defines macros that make BibTeX work with plain TeX",
+%% }
+% BibTeX-for-TeX macros, version 0.99h, for BibTeX 0.99c, TeX 3.0 or later.
+% Copyright (C) 1990--91 by Karl Berry and Oren Patashnik; all rights reserved.
+% You may copy this file provided: that it's accompanied by the
+% "BibTeXing" document, whose text is contained in the file `btxdoc.tex';
+% that any documentation you write for these macros also gives a
+% reference for "BibTeXing"; and that either you make absolutely no
+% changes to your copy, or if you do make changes, (1) you name the file
+% something other than `btxmac.tex' and you remove all occurrences of
+% `btxmac.tex' from the file, (2) you put, somewhere in the first twenty
+% lines of the file, your name, along with an electronic address at which
+% others who might use the file may reach you, and (3) you remove each
+% occurrence of Oren's name and electronic address from this file. These
+% restrictions help ensure that all standard versions of these macros are
+% identical, and that Oren doesn't get deluged with inappropriate e-mail.
+%
+% This file, btxmac.tex, contains TeX macros that allow BibTeX, a
+% bibliography program that was originally designed for use with LaTeX,
+% to work with plain TeX. Please report any bugs (outright goofs,
+% improvable macros, misfeatures, or unclear documentation) to Oren
+% Patashnik (opbibtex@neon.stanford.edu). These macros will become
+% frozen shortly after BibTeX version 1.00 is released.
+%
+% To use these macros you should be familiar with how BibTeX interacts
+% with LaTeX, since BibTeX's interaction with TeX is very similar; that
+% interaction is explained in the LaTeX manual. It also helps to
+% have read "BibTeXing", the documentation that accompanies BibTeX.
+% Then, if you want, you should redefine any of the macros that begin
+% with `\bbl' or `\biblabel' or `\print' that you need to get formatting
+% different from the default (the default settings are designed to
+% accompany a bibliography style like BibTeX's standard style `plain').
+% The macros you might want to change are described briefly a few
+% paragraphs hence. Finally, as long as you follow the guidelines given
+% by the LaTeX manual and "BibTeXing", you simply \input btxmac.
+% [Remember the general scheme: Running (La)TeX writes information on
+% the .aux (auxiliary) file; then running BibTeX reads information from
+% the .aux, .bst (style), and .bib (database) files, and writes
+% information (the bibliography) on a .bbl file; then running (La)TeX
+% incorporates the bibliography; then running (La)TeX once more fixes
+% the remaining forward references into the bibliography. Thus, to get
+% everything incorporated into your output, you'll have to run (La)TeX,
+% BibTeX, (La)TeX, (La)TeX. (Standup, sitdown, fight, fight, fight.)]
+%
+% These macros can stand alone or they can be \input into macro packages
+% like Eplain. If you want to try out these macros on the 0.99 version
+% of the xampl.bib file that's distributed with BibTeX (that version of
+% the file has no self-identification), you'll need to define \mbox,
+% which is a LaTeX command, to be \hbox.
+%
+%
+% HISTORY
+%
+% Karl Berry wrote the original version of these macros in 1989 and
+% 1990, for use in his `Eplain' package. Oren Patashnik modified them
+% slightly in July 1990, as part of the official BibTeX distribution.
+%
+% 1-Aug-90 Version 0.99a, not released to the general public.
+% 14-Aug-90 0.99b, first general release.
+% 26-Aug-90 0.99c, made \@undefinedmessage work with other macro packages.
+% 6-Sep-90 0.99d, allowed for general formatting of bibliography labels,
+% for general formatting of (in-text) citations, and for
+% changing certain catcodes while reading the .aux file.
+% 14-Nov-90 0.99e, changed the way \@setletters works, made some \new...'s
+% non-outer, and changed the way Eplain reads this file.
+% 12-Dec-90 0.99f, made \@resetnumerals change the `,' and `.' catcodes; and
+% added \biblabelextrahang, \@getoptionalarg, and \bblsc.
+% 11-Mar-91 0.99g, made a few minor changes required by the way Eplain reads
+% this file, but no functional changes.
+% 24-Apr-91 0.99h, inhibited the reading and writing of the .aux file if it
+% isn't used or if the \noauxfile macro is defined, and
+% removed some .aux-file-opening detritus; printed the
+% cite-key of undefined citations in \tt font; changed the
+% catcode of `_' inside \cite; and called \@resetnumerals
+% from inside a group.
+%
+%
+% The LaTeX-related commands defined in this file include (a) the four
+% commands that a user types (\bibliography, \bibliographystyle, \cite,
+% and \nocite); (b) the three commands that BibTeX looks for in the .aux
+% file (\bibdata, \bibstyle, and \citation---there is a fourth command
+% that BibTeX looks for, but that command is related to LaTeX's \include
+% facility, so these macros ignore that command); and (c) a LaTeX
+% command (\newcommand) that's written by one of the four standard
+% bibliography styles (alpha). The definitions here are not exactly the
+% same as the corresponding LaTeX definitions (those eight LaTeX
+% definitions depend on a significant fraction of LaTeX itself). But
+% the only substantial differences are with \newcommand, which here,
+% without complaining, lets you redefine a preexisting control sequence
+% (in LaTeX, \newcommand won't let you redefine a preexisting command),
+% and which here doesn't make the control sequences it defines \long (in
+% LaTeX, that happens automatically); there may also be other minor
+% differences. To summarize: Unless you know what you're doing, you
+% shouldn't define any control sequences with these eight names:
+%
+% \bibdata
+% \bibliography
+% \bibliographystyle
+% \bibstyle
+% \citation
+% \cite
+% \newcommand
+% \nocite
+%
+% There are three other commands written by one or more of the four
+% standard (plain, abbrv, alpha, unsrt) or four semistandard (acm,
+% apalike, ieeetr, siam) bibliography styles; they take effect only
+% within the bibliography, and are redefinable, as explained later:
+%
+% \em
+% \newblock
+% \sc
+%
+% There's one control sequence you might want to use (but not redefine)
+% in redefining \biblabelprint:
+%
+% \biblabelwidth
+%
+% There are twelve other control sequences (explained later in more detail)
+% that the macros of this file will use if you define them---you should
+% define them after the \input btxmac command but before the \bibliography
+% command. The first five begin with `\bbl' and affect fonts, spacing,
+% and perhaps other characteristics of the bibliography; the next three
+% begin with `\biblabel' and determine how labels are formatted in the
+% bibliography; and the last four begin with `\print' and determine how
+% the in-text citations are formatted:
+%
+% \bblem
+% \bblhook
+% \bblnewblock
+% \bblrm
+% \bblsc
+% \biblabelcontents
+% \biblabelextrahang
+% \biblabelprint
+% \printbetweencitations
+% \printcitefinish
+% \printcitenote
+% \printcitestart
+%
+% If it's defined before the \input btxmac command, the control sequence
+% below inhibits the reading and writing of the .aux file(s), and the
+% issuing of related warning messages. Any definition will do. This
+% feature might help when you're working on draft stages of a document:
+%
+% \noauxfile
+%
+% Here's another control sequence (it's described later), with an `@'
+% in its name, that you probably won't want to redefine unless you are
+% writing another macro package; if you do redefine it, however, do it
+% before the \input btxmac command:
+%
+% \@undefinedmessage
+%
+% And here are still more control sequences that, should you already have
+% them defined, might conflict with the way the btxmac.tex macros use them
+% (but since each of these has an `@' in its name, it's unlikely that such
+% conflicts will arise unless you intend them):
+%
+% \@auxfile \@auxfiledonefalse \@auxfiledonetrue
+% \@bracketcheck \@citation \@cite
+% \@citedef \@citelabel \@citewarningfalse
+% \@citewarningtrue \@commandname \@continuenewcommand
+% \@emptymarkA \@emptymarkB \@fileexistsfalse
+% \@fileexiststrue \@finishcitedef \@finishtestfileexistence
+% \@for \@forloop \@fornoop
+% \@fortmp \@getoptionalarg \@@getoptionalarg
+% \@gobble \@if@auxfiledone \if@citewarning
+% \@ifempty \@@ifempty \if@fileexists
+% \if@notfirstcitation \@iforloop \@innerdef
+% \@innernewcount \@innernewdimen \@innernewif
+% \@innernewwrite \@itemnum \@letter
+% \@linenumber \@newcommandwithargs \@newcommand
+% \@next \@nextwhile \@nil
+% \@nnil \@notfirstcitationfalse \@notfirstcitationtrue
+% \@numparams \@oldatcatcode \@onecitation
+% \@optionalarg \@other \@paramdef
+% \@readauxfile \@readbblfile \@resetnumerals
+% \@scfont \@setletters \@spacesub
+% \@startdef \@testfileexistence \@tokstostring
+% \@ttsA \@ttsB \@ttsmarkA
+% \@ttsmarkB \@undefined \@writeaux
+%
+%
+% So to start things off we turn `@' into a letter (category code 11),
+% keeping track of the old category code for future restoration.
+% (Simply resetting it to 12 when we leave these macros is
+% insufficient.) The use of `\cite' as a temporary control sequence is
+% a kludge, but it's a reasonably simple way to accomplish what we need
+% without possibly overwriting something (without an `@' in its name)
+% that might already be defined.
+%
+\edef\cite{\the\catcode`@}%
+\catcode`@ = 11
+\let\@oldatcatcode = \cite
+\chardef\@letter = 11
+\chardef\@other = 12
+%
+%
+% Next come some things that will be useful later.
+%
+% Make an outer definition into an inner one (due to Chris Thompson).
+% The arguments should be the control sequence to be defined, and the
+% new of the \outer control sequence, as characters; the control
+% sequence #1 is defined to be just the same as \csname#2\endcsname, but
+% not \outer. For example, \@innerdef\innernewcount{newcount} would
+% define \innernewcount to be a non-outer version of \newcount.
+%
+\def\@innerdef#1#2{\edef#1{\expandafter\noexpand\csname #2\endcsname}}%
+%
+% We use \@innerdef to make some of our allocations local, because
+% Eplain includes our code inside a conditional. We put @'s in the
+% names to minimize the (already small) chance of conflicts.
+%
+\@innerdef\@innernewcount{newcount}%
+\@innerdef\@innernewdimen{newdimen}%
+\@innerdef\@innernewif{newif}%
+\@innerdef\@innernewwrite{newwrite}%
+%
+%
+% Swallow one parameter.
+%
+\def\@gobble#1{}%
+%
+%
+% Use TeX 3.0's \inputlineno to get the line number, for better error
+% messages, but if we're using an old version of TeX, don't do anything.
+%
+\ifx\inputlineno\@undefined
+ \let\@linenumber = \empty % Pre-3.0.
+\else
+ \def\@linenumber{\the\inputlineno:\space}%
+\fi
+%
+%
+% \@getoptionalarg\CS gets an optional argument from the input, enclosed
+% in brackets, then expands \CS. We set \@optionalarg to \empty if we
+% don't find one, otherwise to the text of the argument. This assumes
+% the brackets don't have a funny category code.
+%
+\def\@getoptionalarg#1{\let\temp = #1\futurelet\next\@bracketcheck}%
+\def\@bracketcheck{\begingroup
+ \if [\next
+ \aftergroup\@@getoptionalarg
+ \else
+ \global\let\@optionalarg = \empty
+ %
+ % We can't do the \aftergroup\temp after the \fi, because then the
+ % \temp gets in the way of reading the optional argument from the
+ % input, if we do have one.
+ \aftergroup\temp
+ \fi
+\endgroup}%
+%
+\def\@@getoptionalarg[#1]{%
+ \def\@optionalarg{#1}%
+ \temp
+}%
+%
+%
+% \@tokstostring converts its argument into a list of character tokens.
+% It uses no commands that are executed in the stomach, only expansions
+% handled in the gullet. (This is necessary for use with \edef).
+%
+% Control sequences in the argument are not expanded. Blanks become a
+% \spacesub. The argument shouldn't contain other special characters.
+%
+\def\@tokstostring#1{\@ttsA#1 \@ttsmarkA}%
+%
+% \@ttsA partitions a sequence of tokens into portions delimited by blanks.
+%
+\def\@ttsA#1 #2\@ttsmarkA{%
+ \@ifempty{#1}\else
+ \@ttsB #1\@ttsmarkB
+ %
+ \@ifempty{#2}\else
+ \@spacesub\@ttsA#2\@ttsmarkA
+ \fi
+ \fi
+}%
+%
+% \@ttsB processes a sequence of tokens with no contained blanks.
+%
+\def\@ttsB#1{%
+ \ifx #1\@ttsmarkB\else
+ \string #1%
+ \expandafter\@ttsB
+ \fi
+}%
+%
+% This is just so \ifx won't complain about an undefined control sequence.
+%
+\def\@ttsmarkB{\@ttsmarkB}% should never be expanded
+%
+% The expansion of this macro replaces spaces.
+%
+\def\@spacesub{+}%
+%
+%
+% \@ifempty tests if it is given an argument.
+%
+\def\@ifempty#1{\@@ifempty #1\@emptymarkA\@emptymarkB}%
+\def\@@ifempty#1#2\@emptymarkB{\ifx #1\@emptymarkA}%
+%
+\def\@emptymarkA{\@emptymarkA}% Again, so \ifx won't complain.
+%
+%
+% From LaTeX.
+%
+\def\@nnil{\@nil}%
+\def\@fornoop#1\@@#2#3{}%
+%
+\def\@for#1:=#2\do#3{%
+ \edef\@fortmp{#2}%
+ \ifx\@fortmp\empty \else
+ \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}%
+ \fi
+}%
+%
+\def\@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else
+ #5\def#4{#2}\ifx #4\@nnil \else#5\@iforloop #3\@@#4{#5}\fi\fi
+}%
+%
+\def\@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
+ \let\@nextwhile=\@fornoop \else
+ #4\relax\let\@nextwhile=\@iforloop\fi\@nextwhile#2\@@#3{#4}%
+}%
+%
+%
+% This macro tests if a file \jobname.#1 exists, and sets
+% \if@fileexists appropriately. If an optional argument is given, it is
+% used as the root part of the filename instead of \jobname.
+%
+\@innernewif\if@fileexists
+%
+\def\@testfileexistence{\@getoptionalarg\@finishtestfileexistence}%
+\def\@finishtestfileexistence#1{%
+ \begingroup
+ \def\extension{#1}%
+ \immediate\openin0 =
+ \ifx\@optionalarg\empty\jobname\else\@optionalarg\fi
+ \ifx\extension\empty \else .#1\fi
+ \space
+ \ifeof 0
+ \global\@fileexistsfalse
+ \else
+ \global\@fileexiststrue
+ \fi
+ \immediate\closein0
+ \endgroup
+}%
+%
+%
+%% [[[start of BibTeX-specific stuff]]]
+%
+% Now come the four main LaTeX commands and their associated .aux
+% commands. Just as in LaTeX, \bibliographystyle defines the BibTeX
+% style name (.bst file, that is), and \bibliography defines the
+% database (.bib) file(s). The corresponding .aux-file commands are
+% \bibstyle and \bibdata, which are there only for BibTeX's (but not
+% LaTeX's) use.
+%
+\def\bibliographystyle#1{%
+ \@readauxfile
+ \@writeaux{\string\bibstyle{#1}}%
+}%
+\let\bibstyle = \@gobble
+%
+% As well as writing the \bibdata command to tell BibTeX
+% which .bib files to read, we read the .bbl file that
+% BibTeX (or a person, conceivably) has produced.
+%
+\def\bibliography#1{%
+ \@readauxfile
+ \@writeaux{\string\bibdata{#1}}%
+ \@testfileexistence{bbl}%
+ \if@fileexists
+ \@readbblfile
+ \fi
+}%
+\let\bibdata = \@gobble
+%
+% The \nocite{label,label,...} command writes its argument to \@auxfile,
+% unless instructed not to, but produces no text in the document. Both
+% the \nocite and \cite commands produce \citation commands in the .aux file.
+%
+\def\nocite#1{%
+ \@readauxfile
+ \@writeaux{\string\citation{#1}}%
+}%
+%
+\@innernewif\if@notfirstcitation
+%
+% \cite[note]{label,label,...} produces the citations for the labels as
+% well. If the optional argument `note' is present, it's added after
+% the labels. Since \cite calls \nocite before doing any writing, it
+% doesn't need to call \@readauxfile. We change the category code of
+% `_' so that the dummy definition given to the citation label doesn't
+% include a subcript character; that would cause TeX to complain.
+%
+\def\cite{\begingroup\catcode`_ = \@letter \@getoptionalarg\@cite}%
+%
+% Typeset the citations for the labels in #1, followed by the note, if
+% it exists. To change the citation's format in the text, redefine one
+% or more `\print...' macros, whose defaults appear later in this file.
+%
+\def\@cite#1{%
+ \nocite{#1}%
+ % Start printing the text, beginning with a left bracket by default.
+ %
+ \printcitestart
+ \@notfirstcitationfalse
+ \@for \@citation :=#1\do
+ {%
+ \expandafter\@onecitation\@citation\@@
+ }%
+ \ifx\empty\@optionalarg\else
+ \printcitenote{\@optionalarg}%
+ \fi
+ \printcitefinish
+ \endgroup
+}%
+%
+\def\@onecitation#1\@@{%
+ \if@notfirstcitation
+ \printbetweencitations
+ \fi
+ %
+ \expandafter \ifx \csname\@citelabel{#1}\endcsname \relax
+ \if@citewarning
+ \message{\@linenumber Undefined citation `#1'.}%
+ \fi
+ % Give it a dummy definition:
+ \expandafter\gdef\csname\@citelabel{#1}\endcsname{%
+ {\tt \nobreak\hskip0pt#1\nobreak\hskip0pt}}%
+ \fi
+ % Now produce the text, whether it was undefined or not.
+ \csname\@citelabel{#1}\endcsname
+ \@notfirstcitationtrue
+}%
+%
+% Given a label `foo', the macro `\b@foo' is supposed to
+% hold the text that should be produced.
+%
+\def\@citelabel#1{\@tokstostring{b@#1}}%
+%
+% So, how does a citation label get defined? When we read the .bbl file
+% (below), a \bibitem writes out a \@citedef command. And when we read
+% the \@citedef, we define \@citelabel{#1}, where #1 is the user's
+% label. But we have to be careful when reading the \@citedef, because
+% the second argument might have accents or other commands with numbers
+% as arguments. We have given the numerals category code 11 for reading
+% the .aux file, and that prevents them from being recognized as TeX
+% <number>s. Similarly for the other characters that can be part of a
+% <number>. So we have to reset the category codes before reading the
+% second argument. We also have to reset them back to letters when we
+% finish reading the \@citedef's, because there might be more labels
+% with numerals in them defined afterwards in the .aux file, put there
+% by Eplain or whatever.
+%
+\def\@citedef#1{%
+ \begingroup
+ \@resetnumerals
+ \@finishcitedef{#1}%
+}%
+\def\@finishcitedef#1#2{%
+ \expandafter\gdef\csname\@citelabel{#1}\endcsname{#2}%
+ \endgroup
+}%
+\def\@resetnumerals{%
+ \catcode`0 = \@other \catcode`1 = \@other \catcode`2 = \@other
+ \catcode`3 = \@other \catcode`4 = \@other \catcode`5 = \@other
+ \catcode`6 = \@other \catcode`7 = \@other \catcode`8 = \@other
+ \catcode`9 = \@other \catcode`" = \@other \catcode`' = \@other
+ \catcode`` = \@other \catcode`, = \@other \catcode`. = \@other
+}%
+%
+%
+% Reading the .bbl file also produces the typeset bibliography. Please
+% notice, however, that we do not produce the title for the references
+% (e.g., `References'), as LaTeX does. The formatting and spacing of
+% that title, whether it should go into the headline, and so on, are all
+% things determined by your format. We cannot know those things in
+% advance. If you wish, you can define \bblhook to produce the title.
+% Or just do it before the \bibliography command.
+%
+\def\@readbblfile{%
+ % Define a counter to tell us which item number we are on.
+ \@innernewcount\@itemnum
+ %
+ \begingroup
+ \def\begin##1##2{%
+ % ##1 is just `thebibliography'.
+ % ##2 is the widest label.
+ % We set (new dimen) \biblabelwidth based on the widest label
+ \setbox0 = \hbox{\biblabelcontents{##2}}%
+ \biblabelwidth = \wd0
+ }%
+ \def\end##1{}% ##1 is `thebibliography' again.
+ %
+ % Here we have two possibilities:
+ % \bibitem[typesetlabel]{citationlabel}
+ % \bibitem{citationlabel}
+ % If we have the second of these, the citations are numbered, starting
+ % from one; we use our own count register \@itemnum for this.
+ %
+ \@itemnum = 0
+ \def\bibitem{\futurelet\next\@bibitem}%
+ \def\@bibitem{%
+ \begingroup \if [\next
+ \aftergroup\@alphabibitem
+ \else
+ \aftergroup\@numberedbibitem
+ \fi \endgroup
+ }%
+ \def\@alphabibitem[##1]##2{%
+ % Need \xdef here for various reasons.
+ \expandafter \xdef\csname\@citelabel{##2}\endcsname {##1}%
+ \@finishbibitem{##2}%
+ }%
+ %
+ \def\@numberedbibitem##1{%
+ \advance\@itemnum by 1
+ \expandafter \xdef\csname\@citelabel{##1}\endcsname{\number\@itemnum}%
+ \@finishbibitem{##1}%
+ }%
+ %
+ \def\@finishbibitem##1{%
+ \biblabelprint{\csname\@citelabel{##1}\endcsname}%
+ \@writeaux{\string\@citedef{##1}{\csname\@citelabel{##1}\endcsname}}%
+ \ignorespaces
+ }%
+ %
+ % Do the printing (we're producing the bibliography, remember).
+ %
+ \let\em = \bblem
+ \let\newblock = \bblnewblock
+ \let\sc = \bblsc
+ % Punctuation won't affect spacing;
+ \frenchspacing
+ % the penalties below are from LaTeX's [article,book,report].sty;
+ \clubpenalty = 4000 \widowpenalty = 4000
+ % the next two values come from LaTeX's \sloppy command;
+ \tolerance = 10000 \hfuzz = .5pt
+ \everypar = {\hangindent = \biblabelwidth
+ \advance\hangindent by \biblabelextrahang}%
+ \bblrm
+ % the \parskip is a guess at what looks good;
+ \parskip = 1.5ex plus .5ex minus .5ex
+ % and the .5em matches the \enspace of \biblabelprint below.
+ \biblabelextrahang = .5em
+ \bblhook
+ %
+ \input \jobname.bbl
+ \endgroup
+}%
+%
+% The widest label's width is useful for redefining \biblabelprint; you
+% redefine \biblabelwidth, in effect, by redefining the
+% \biblabelcontents macro that appears below. And \biblabelextrahang,
+% which is redefinable inside \bblhook, is added to \biblabelwidth to
+% determine the amount of hanging indentation.
+%
+\@innernewdimen\biblabelwidth
+\@innernewdimen\biblabelextrahang
+%
+% Now come the main macros that are related to the printing of the
+% bibliography. Since you might want to redefine them, they are given
+% default definitions outside of \@readbblfile.
+%
+% The first one controls the printing of a bibliography entry's label.
+% If you change it, make sure that it starts with something like
+% \noindent or \indent that puts TeX into horizontal mode (even if the
+% label itself is empty); otherwise, the hanging indentation will get
+% messed up in certain circumstances.
+%
+\def\biblabelprint#1{%
+ \noindent\hbox to \biblabelwidth{\biblabelcontents{#1}\hss}\enspace}%
+%
+% By default the labels are typeset in \bblrm, and enclosed in brackets.
+%
+\def\biblabelcontents#1{\bblrm [#1]}%
+%
+% The main text, too, is typeset using \bblrm, which is \rm by default.
+%
+\def\bblrm{\rm}%
+%
+% Emphasis for producing, e.g., titles, is done with \it by default.
+%
+\def\bblem{\it}%
+%
+% Some styles use a caps-and-small-caps font for author names. LaTeX
+% defines an \sc command but plain TeX doesn't, so we need one here.
+% The definition below doesn't load the font unless it's needed, but it
+% tries to load only the 10pt version, because it might not exist at
+% other point sizes.
+%
+\def\bblsc{\ifx\@scfont\@undefined
+ \font\@scfont = cmcsc10
+ \fi
+ \@scfont
+}%
+%
+% The major parts of an entry are separated with \bblnewblock. The
+% numbers below are taken from LaTeX's `article' style.
+%
+\def\bblnewblock{\hskip .11em plus .33em minus .07em}%
+%
+% Here's where you stick any other bibliography-formatting goodies, or
+% redefine the values above.
+%
+\let\bblhook = \empty
+%
+%
+% Here are the four default definitions for formatting the in-text
+% citations. These are what you redefine (after your \input btxmac but
+% before your \bibliography) to get parens instead of brackets, or
+% superscripts, or footnotes, or whatever.
+%
+\def\printcitestart{[}% left bracket
+\def\printcitefinish{]}% right bracket
+\def\printbetweencitations{, }% comma, space
+\def\printcitenote#1{, #1}% comma, space, note (if it exists)
+%
+% That scheme is pretty flexible. For example you could use
+% \def\printcitestart{$^\bgroup}
+% \def\printcitefinish{\egroup$}
+% \def\printbetweencitations{,}
+% \def\printcitenote#1{\hbox{\sevenrm\space (#1)}}
+% to get superscripted in-text citations. To get something radically
+% different, however, you'll have to define your own \cite command.
+%
+% When we read this from the .aux file, \citation means nothing.
+%
+\let\citation = \@gobble
+%
+%
+% Now comes the stuff for dealing with LaTeX's \newcommand. As
+% mentioned earlier, this \newcommand will redefine a preexisting
+% command; that's different from how LaTeX's \newcommand behaves.
+%
+\@innernewcount\@numparams
+%
+% \newcommand{\foo}[n]{text} defines the control sequence \foo to have
+% n parameters, and replacement text `text'.
+%
+\def\newcommand#1{%
+ \def\@commandname{#1}%
+ \futurelet\@next\@continuenewcommand
+}%
+%
+% Figure out if this definition has parameters.
+%
+\def\@continuenewcommand{\begingroup
+ \if [\@next
+ \aftergroup\@newcommandwithargs
+ \else
+ \global\@numparams = 0
+ \aftergroup\@newcommand
+ \fi
+\endgroup}%
+%
+\def\@newcommandwithargs[#1]{%
+ \global\@numparams = #1
+ \@newcommand
+}%
+%
+% \@numparams is how many arguments this command has. The name of the
+% command is \@commandname. The replacement text for the new macro is #1.
+%
+\def\@newcommand#1{%
+ \def\@startdef{\expandafter\edef\@commandname}%
+ \ifnum\@numparams=0
+ \let\@paramdef = \empty
+ \else
+ \ifnum\@numparams>9
+ \errmessage{\the\@numparams\space is too many parameters}%
+ \else
+ \ifnum\@numparams<0
+ \errmessage{\the\@numparams\space is too few parameters}%
+ \else
+ \edef\@paramdef{%
+ % This is disgusting, but \loop doesn't work inside \edef,
+ % because \body isn't defined.
+ %
+ \ifcase\@numparams
+ \empty No arguments.
+ \or ####1%
+ \or ####1####2%
+ \or ####1####2####3%
+ \or ####1####2####3####4%
+ \or ####1####2####3####4####5%
+ \or ####1####2####3####4####5####6%
+ \or ####1####2####3####4####5####6####7%
+ \or ####1####2####3####4####5####6####7####8%
+ \or ####1####2####3####4####5####6####7####8####9%
+ \fi
+ }%
+ \fi
+ \fi
+ \fi
+ \expandafter\@startdef\@paramdef{#1}%
+}%
+%
+%% [[[end of BibTeX-specific stuff]]]
+%
+%
+% Names of references (arguments given in the \cite and \nocite
+% commands) and file names (arguments given in the \bibliography and
+% \bibliographystyle commands) are recorded in \jobname.aux, called the
+% \@auxfile in these macros. Here's how they get read in.
+%
+\def\@readauxfile{%
+ \if@auxfiledone \else % remember: \@auxfiledonetrue if \noauxfile is defined
+ \global\@auxfiledonetrue
+ \@testfileexistence{aux}%
+ \if@fileexists
+ \begingroup
+ % Because we might be in horizontal mode when \@readauxfile
+ % is called (if it's in response to a \cite or \nocite), we
+ % want to ignore all the would-be spaces at the ends of
+ % lines in the aux file. Fortunately, there are never any
+ % (non-pathological) cases where an end-of-line might
+ % actually be desired. If you really need to do something
+ % strange, you can redefine \@setletters to do something
+ % besides what it does now (this is intentionally left as
+ % being somewhat painful to do).
+ \endlinechar = -1
+ \@setletters
+ \input \jobname.aux
+ \endgroup
+ \else
+ \message{\@undefinedmessage}%
+ \global\@citewarningfalse
+ \fi
+ \immediate\openout\@auxfile = \jobname.aux
+ \fi
+}%
+%
+% The \@readauxfile macro does all that work the first time it's called.
+% Since it's called once for every \cite, \nocite, \bibliography, and
+% \bibliographystyle command that the user issues, we need to remember
+% whether the work's been done. It's considered done if we're not to do
+% it---that is, if \noauxfile is defined.
+%
+\newif\if@auxfiledone
+\ifx\noauxfile\@undefined \else \@auxfiledonetrue\fi
+%
+% Since lots of characters are allowable inside reference names, and
+% since a reference name can get converted into a control sequence,
+% \@readauxfile must treat many characters as letters. It does that by
+% calling \@setletters, which changes the category code of all \@other
+% characters to \@letter. The 128/256 business arises because character
+% codes go up to 256 starting with TeX 3.0, but up to only 128 with
+% earlier versions.
+%
+\def\@setletters{%
+ \count255 = 0
+ \edef\temp{\ifx\inputlineno\@undefined 128\else 256\fi}%
+ \loop
+ \ifnum\catcode\count255 = \@other
+ \catcode\count255 = \@letter
+ \fi
+ \advance\count255 by 1
+ \ifnum\count255<\temp
+ \repeat
+ % The Eplain package uses underscores to construct the label names.
+ \catcode`\_ = \@letter
+}%
+%
+% It's conceivable you'd want to change how other characters are read;
+% to do that, change their category code before doing \input btxmac.
+%
+%
+% After reading the .aux file, \@readauxfile opens it for writing.
+% The \@writeaux macro does the actual writing (as long as
+% \noauxfile is undefined).
+%
+\@innernewwrite\@auxfile
+\def\@writeaux#1{\ifx\noauxfile\@undefined \write\@auxfile{#1}\fi}%
+%
+%
+% A macro package that uses btxmac.tex might define
+% \@undefinedmessage (before doing an \input btxmac).
+%
+\ifx\@undefinedmessage\@undefined
+ \def\@undefinedmessage{No .aux file; I won't give you warnings about
+ undefined citations.}%
+\fi
+%
+% Even if citations are undefined, we want to complain only if
+% \@citewarningtrue. The default is to set \@citewarningtrue unless
+% \noauxfile is defined. Again, a macro package that uses
+% btxmac.tex might want to redefine this.
+%
+\@innernewif\if@citewarning
+\ifx\noauxfile\@undefined \@citewarningtrue\fi
+%
+%
+% Finally, before leaving we restore @'s old category code.
+%
+\catcode`@ = \@oldatcatcode
diff --git a/macros/lollipop/doc/manual/comm.tex b/macros/lollipop/doc/manual/comm.tex
new file mode 100644
index 0000000000..2876acf959
--- /dev/null
+++ b/macros/lollipop/doc/manual/comm.tex
@@ -0,0 +1,642 @@
+% comm.tex copyright 1992 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\Chapter Commands
+
+\Section[sec:counters] Counters
+
+Counters can be declared explicitly by the user, but more often they
+are defined automatically in some generic construct:
+
+The \cs{Foo} defined by
+\Ver>\DefineBar:Foo ...
+ counter:i ...
+ Stop<Rev
+
+will have a counter that counts in roman lowercase, and which is
+accessible as \refcs{FooCounter}. Everytime \cs{Foo} is used, this
+counter is increased by one.
+
+The use of the \opt{counter} option is described
+in~\ref[sec:opt:counter].
+Here are the commands for explicit manipulation of counters.
+
+\SubSection[sec:counter:repr] Allocation and representation
+
+A counter is created by for instance
+\Ver>\NewCounter:Things<Rev
+This will create control sequence \cs{ThingsCounter} that will print
+the value of the counter.
+The counter will usually be printed as an Arabic numeral, but other
+counter representations can be specified by
+\refcs{CounterRepresentation}. Here are their codes: \Description
+\item 1
+numeric
+\item a
+lowercase character
+\item A
+uppercase character
+\item i
+lowercase roman
+\item I
+lowercase roman
+\>
+for instance
+\Ver>\CounterRepresentation:Things=i<Rev
+will cause \cs{ThingsCounter} to print a lowercase Roman numeral.
+
+However, a call such as
+\Ver>\CounterRepresentation:Theorem=Lemma<Rev
+will make the \cs{TheoremCounter} a synonym of an earlier created
+\cs{LemmaCounter}
+
+\SubSection Counter manipulation
+
+The following commands can be used to manipulate counters, both when
+they are created by hand using \refcs{NewCounter} and when they were
+generated automatically in some generic construct:
+
+With \refcs{StartCounter} reset the counter to one:
+ \Ver>\StartCounter:things<Rev
+
+With \refcs{StepCounter} increase the counter by one:
+ \Ver>\StepCounter:things<Rev
+
+With \refcs{BackStepCounter} decrease the counter by one:
+ \Ver>\BackStepCounter:things<Rev
+
+With \refcs{SetCounter} set the counter to some specified value:
+ \Ver>\SetCounter:things=5<Rev
+
+With \refcs{AddToCounter} increase the counter by some
+specified value:
+ \Ver>\AddToCounter:things=7<Rev
+
+The last two commands accept names of numerical parameters, for
+instance the value of a counter:
+ \Ver>\NewCounter:Favourite
+\AddToCounter:things=FavouriteValue<Rev
+More about this `value' thing in the next section.
+
+\SubSection What do you get when you define a counter?
+
+After you define a counter as \Ver>\NewCounter:MyThings<Rev there are
+two commands that it is important to distinguish between. First of
+all, \cs{MyThingsCounter} gives the {\it printed\/} value of the
+counter. This is the command that you will use mostly. It uses
+whatever representation you have specified for the counter, or plain
+Arabic numerals if haven't specified anything.
+
+Secondly, \cs{MyThingsValue} gives the value of the counter. You can
+not use this command on its own: you will get a `number expected'
+error.
+
+\SubSection Counter hierarchies
+
+Often counters are related to each other. For instance, when a new
+section begins, the subsection counter has to be reset. The same may
+be true for equation counters. In Lollipop such a relation is
+indicated by a call to \refcs{GoverningCounter}, for instance
+
+\Ver>\GoverningCounter:SubSection=Section<Rev
+
+All of the counter manipulation commands applied to a governing
+counter will cause all governed counters to be reset. Such a reset
+also occurs if the counter was created in some generic construct.
+
+For examples, see section~\ref[sec:head:examples].
+
+\SubSection Referencing counters
+
+All counters that are declared as part of a generic construct, or
+explicitly through \refcs{NewCounter} automatically become the current
+reference when they are altered. Thus \ver>\label[bar]> will make
+\ver>\ref[bar]> refer to the value of the counter most recently
+changed. The way the counter is referenced can be altered by the
+\opt{label} option in generic constructs; see
+section~\ref[sec:opt:label].
+
+For generic constructs with a counter no explicit \refcs{label} commands
+need to be given; such commands take an optional argument with the
+label key:
+\Ver>\Section[sec:examples] Examples<Rev
+
+\SubSection Adaptive counters
+
+It may happen that you want to compute a value during one run of
+\TeX, and use it in the next. An example is the fact that this manual
+states the total number of pages on the title page. For this you can
+use \refcs{AdaptiveCounter}
+ \Ver>\AdaptiveCounter:LastPage<Rev
+which is like \cs{NewCounter}, except that the value of this counter
+gets written to the \file{.aux} file.
+
+There are two ways of setting an adaptive counter: you can simply use
+it in some construct (for instance through a counter synonym;
+section~ref[sec:counter:repr]), or you can set it explicitly, for
+instance as
+ \Ver>\SetCounter:LastPage=PageValue<Rev
+See how this manual does it.
+
+\SubSection Examples of counter usage
+
+Items start at the value of one, so if a starting value of zero is
+necessary, the following will work
+\Ver>
+\Enumerate \SetCounter:item=-1
+\item ...<Rev
+
+
+\Section[sec:font] Font selection
+
+In \Lollipop, choosing a font is done through three parameters:
+\Description\item Typeface
+A collection of related styles and sizes. The typeface is set by the
+command \refcs{Typeface}.
+\item Style
+Italic, bold, roman, typewriter. You know. The style is set by the
+command \refcs{Style}.
+\item PointSize
+The size of a font in typographical points ($72.27$ per inch).
+The pointsize is set by the command \refcs{PointSize}.
+\>
+
+The most common change of font is a change in style. Therefore,
+issuing a command such as \Ver>\Style:bold<Rev immediately changes
+the font to the bold of the current typeface in the current pointsize.
+
+However, issuing a command such as \Ver>\Typeface:GoudyOldStyle<Rev
+or \Ver>\PointSize:28<Rev will not change the font, since such
+changes are usually accompanied by a change in style. In case that an
+immediate switch is necessary, the command
+\refcs{SetFont} can be given.
+This evaluates the current value of the typeface, style, and
+pointsize commands, and sets the font accordingly.
+
+A number of typeface names have been predefined in \Lollipop,
+however, in order to print them your printer (software) must have them
+available.
+
+\Example
+\SerifFace \PointSize:12
+\Style:roman This \Style:italic sentence \PointSize:10 has
+\SetFont way \SansFace \Style:roman too \SetFont many
+\PointSize:12 \SetFont font \Style:bold changes.
+\ExampleStop
+
+(The commands \cs{SerifFace} and \cs{SansFace} are defined in
+the master file of this manual, and serve to make this manual
+formattable on any system.)
+
+\SubSection Relative size changes
+
+Apart from setting the pointsize explicitly, it is also possibly to
+make size changes relative to the current size. For instance,
+\refcs{PointSizeLarger} and \refcs{PointSizeSmaller} with an optional
+argument indicating the size of the change can be used. These
+commands are not cumulative.
+
+\Example
+\SerifFace
+\PointSize:9 \SetFont Every once in a while,\SaveFont
+\PointSizeLarger[2] shouting \PointSizeLarger helps.
+\PointSizeSmaller[2]But most of the times it doesn't.
+\RestoreFont Unfortunately.
+\ExampleStop
+
+Similar to the changes in mathematics mode to script and scriptscript
+size, the same relative changes are available in text mode through
+the control sequences \refcs{script} and \refcs{scriptscript}.
+The control
+sequence \refcs{normal} can be used to restore the default size.
+
+Here is one application of such relative changes:
+\Ver>
+L\kern -.3em\raise .35ex\hbox {\script A}\kern -.1em\TeX<Rev
+which gives definition of the \LaTeX\ logo that is independent
+of typeface, size and style.
+
+The relative sizes of script and scriptscript fonts are by default at
+$70\%$ and $50\%$, but they can be set explicitly by
+\Ver>\PointSizeScriptSizes:10=10,7,5<Rev
+This also gives the possibility to have the \cs{normal} size to be
+different from the surrounding pointsize.
+
+\SubSection Typeface definition
+
+Defining a typeface means telling \Lollipop\ how the external font
+name, that is, the name of the \n{tfm} file, is to be constructed from
+the internal parameters. The command \refcs{DefineTypeface} takes four
+parameters and an optional fifth. The parameters are in sequence
+\Enumerate\item The internal name of the typeface: the name that is
+given to the \cs{Typeface} command.
+\item The root of the external file name. It is assumed that all
+font names of different styles and sizes are constructed by appending
+characters to this base.
+\item Suffixes corresponding to the styles that are available.
+\item Suffixes corresponding to the sizes that are available.
+\>
+
+Here is the definition of the Computer Modern typeface:
+
+\Ver>
+\DefineTypeface{ComputerModern}{cm}
+ {roman:r; slant:sl; italic:ti; mitalic:mi; bold:bx; typewriter:tt;
+ default:r;}
+ {<6:5; <7:6; <8:7; <9:8; <10:9; <11:10;
+ <12:10 \scaled\magstephalf;
+ <14:10 \scaled\magstep1; <16:10 \scaled\magstep2;
+ <20:10 \scaled\magstep3; >19:10 \scaled\magstep4;
+ default:10;}<Rev
+
+Actually, not all combinations of styles and sizes are available.
+That's where the optional argument comes in. This argument can be
+used to specify with \TeX\ conditionals exceptional style/size
+combinations. Here some trickery is needed: internally the size is
+stored in \cs{Fsize}, and in order to use this parameter we need to
+make the at-sign a letter temporarily.
+
+\Ver>\makeatletter
+\DefineTypeface{Compu ...
+ ...
+ default:10;}
+ [\ifStyle:italic \ifnum\Fsize<7 ti7\fi\fi
+ \ifStyle:typewriter \ifnum\Fsize<8 tt8\fi\fi]<Rev
+
+You may have noticed that this scheme is not all-powerful. Thus
+I~found it easier to move all Computer Modern sans serif fonts into a
+new typeface: \n{ComputerSans}.
+
+For other typefaces specifying the size suffix may be much easier
+than for Computer Modern. For instance, here is the definition of the
+PostScript Helvetica typeface.
+
+\Ver>\makeatletter
+\DefineTypeface{psHelvetica}{helv}
+ {roman:; italic:i; mitalic:i; bold:b; default:;}
+ {default: at \Fsize pt;}
+\makeatother<Rev
+
+
+\SubSection Math fonts
+
+Switching styles in math mode should be possible:
+$${\Style:bold x\Style:roman y}z$$
+
+\SubSection Other font matters
+
+The combination \refcs{SaveFont} with a subsequent
+\refcs{RestoreFont} can
+be used to save and restore the current font.
+
+An abbreviation for a font can be defined by
+\Ver>\DefineFont:name=face,size,style<Rev
+This has the same effect as
+\Ver>\def\name{\TypeFace:face \PointSize:size \Style:style }<Rev
+but it takes considerable less processing inside \TeX.
+
+Even if you don't use Computer Modern as your main typeface, the
+typewriter style is not bad, so a control sequence
+\Ver>
+\def\tt{\Typeface:ComputerModern \Style:typewriter }<Rev
+has been given that makes \refcs{tt} always refer to the
+\n{cmtt} fonts. You're at liberty to change this, of course.
+
+\Section Baselineskip
+
+Corresponding to a font size usually the baseline skip has to change.
+By default a fixed ratio of~$1.2$ for this is taken, for instance
+using a 12~point baseline skip for 10~point fonts. Changing the ratio
+can be done by
+\Ver>\BaselineSkipPointSizeRatio:1.3<Rev
+
+If only for some specific size the baseline skip has to deviate from
+the default ratio, then this can be set by
+\Ver>\SetPointSizeBaselineSkip:9=12<Rev
+
+\Section[sec:indent:control] Indentation Control
+
+\SubSection To indent or not to indent
+
+In most documents there is a general rule that all paragraphs indent
+unless a certain condition, or that they do not indent unless certain
+special conditions hold. For \Lollipop\ documents this is determined
+by the command \refcs{AlwaysIndent}, with values \n{yes}/\n{no}.
+
+To override this default setting a command \refcs{Indent}
+(with values \n{yes}/\n{no}) exists, but that is mostly useful as an
+option in generic constructs, and even there it will not be used much.
+See section~\ref[sec:opt:indent] for options relating to indentation.
+
+Important: never set \cs{parindent} to zero. Preventing indentation
+globally should be done through \ver>\AlwaysIndent:no>.
+
+\SubSection[sec:basic-indent] Basic indent
+
+There is a quantity \refcs{basicindent} that is used on the first
+indentation level (see the next section for an explanation of these
+levels). At the start of a document it is set to the then current
+value of \cs{parindent}. You can override that by
+\refcs{BasicIndentIsSet}: give
+\Ver>\BasicIndentIsSet:no<Rev before the \cs{Start} command.
+
+This way, setting \cs{parindent} in the style definition controls the
+indentation in the whole document.
+
+\SubSection Indentation levels; indentation size
+
+When \Lollipop\ decides that text should be indented, it refers to a
+list of indentations for the exact amount. This list contains
+indentation amounts for each `level' of indentation: initially the
+level is one, and if you nest constructs that indent (for instance
+using a list inside a list) the level goes up one step per nested
+construct.
+
+By
+default the indentation on different levels is a fraction of the
+\cs{basicindent}. Thus you can regulate the indentation on
+all levels simultaneously by resetting the \cs{basicindent}.
+
+\Example
+\Distance:basicindent=15pt
+\DefineList:TestList item:left itemCounter item:stop Stop
+\TestList\item Level one \TestList\item Level two
+\TestList\item Level three\>]
+\Distance:basicindent=25pt
+\TestList\item Level one \TestList\item Level two
+\TestList\item Level three\>]
+\ExampleStop
+
+The amount of
+indentation on a certain level can be set explicitly with
+\refcs{LevelIndent}.
+
+\Example
+\Distance:basicindent=15pt
+\LevelIndent:2=20pt
+\DefineList:TestList item:left itemCounter item:stop Stop
+\TestList\item Level one \TestList\item Level two
+\TestList\item Level three\>]
+\ExampleStop
+
+In fact, sometimes you may want to know the name of the indentation
+on a certain level. This is a control sequence such as
+\refcs{levelindentii} for the second level. You get the idea.
+
+\SubSection Manipulating the indentation level
+
+Every once in a while it can be useful to move to a next indentation
+level, or to return to a previous level. For this
+the two commands \refcs{PushIndentLevel} and \refcs{PopIndentLevel} are
+available. One application is for `interrupted lists':
+
+\Example
+\Itemize\item One
+{\par\PopIndentLevel Interrupted text!\par}
+\item Two\>
+\ExampleStop
+
+See chapter~\ref[chap:external-files] for examples of the use of
+\cs{PushIndentLevel}
+
+\Section Margins
+
+By default, \Lollipop\ tries to keep straight margins. You can change
+its mind about that by \refcs{FlushRight} and \refcs{FlushLeft}
+which are tests:
+\Ver>\FlushRight:no \FlushLeft:no<Rev
+If the margins are not flush, the stretchable white space used
+is \refcs{rightmarginstretch} and \refcs{leftmarginstretch},
+which can be set by \cs{Distance}.
+
+You have to set the amount of stretch {\it before} specifying that
+the margins will not be flush. The \cs{FlushRight/Left} commands take
+the current value whenever they are called.
+
+\Section White Space
+
+White space can be indicated by \refcs{hwhite} and \refcs{vwhite}.
+They are often useful in style definitions. Use:
+\Ver>\vwhite:15pt<Rev
+or \Ver>\hwhite:{15pt minus 3pt}<Rev
+for stretch and shrink. The command \refcs{white} is independent
+of the mode, and it expands to \cs{hwhite} or \cs{vwhite}
+depending on the prevailing mode of \TeX.
+
+The command \refcs{fillup} is mostly useful in style definitions:
+it tries to fill up as much white space as is possible.
+For instance
+\Ver> line:start litteral:foo fillup litteral:bar line:stop<Rev
+will push \n{foo} and \n{bar} as far apart as is possibly
+within the margins.
+
+\ImpNote
+All three control sequences \cs{white}, \cs{hwhite}, \cs{vwhite}
+have internal equivalents, for instance
+\Ver>\def\white:#1 {\@white{#1}}<Rev
+\ImpNoteStop
+
+\Section[sec:com:distance] Distances
+
+The command \refcs{Distance} can be used
+to declare a name for a certain
+distance, or in more correct \TeX nical lingo, for a certain piece of
+glue. For instance, declaring that
+ \Ver>\Distance:oneline=15pt<Rev
+means that you can specify in some constructs
+\Ver>\DefineFoo:Bar whitebefore:oneline whiteafter:oneline<Rev
+If you change your mind later about the value of \n{oneline} you only
+need to change one line in the style definition.
+
+Since the second parameter of \cs{Distance} is bounded by a space (or
+the line end, whatever comes first), you can specify stretchable
+distances by enclosing \n{plus} and \n{minus} parts in braces:
+\Ver>\Distance:oneline={15pt plus 2pt minus 3pt}<Rev
+
+The effect of \cs{Distance} is global. Let me know if you don't
+like it.
+
+\SubSection Distance synonyms
+
+Another use of \cs{Distance} is to define one distance as a synonym
+of another. This may come in handy if you use some basic distance,
+such as \n{oneline} for several purposes. Example: if you specify
+\Ver>\Distance:whitebefore=oneline<Rev
+than the whitespace before a construct will be taken to be
+\n{oneline} if you don't use the \opt{whitebefore} option explicitly.
+
+\SubSection[sec:adapt-distance] Adaptive distances
+
+Suppose you want to declare a section heading as
+ \Ver>\DefineHeading:Section ...
+ block:start [...] fillupto:widelabel title<Rev
+where \cs{widelabel} is the width of the widest label that
+occurs in your document. This requires just a tad of \TeX\
+programming. Just copy the details from the example below, which is
+the definition of \cs{Section} in this manual.
+
+By declaring something a \refcs{AdaptiveDistance} instead of just
+\cs{Distance} its value gets written to the \file{.aux} file at the
+end of the run, and restored in the next run. The second argument is
+simply the default value, in case you don't have an auxiliary file
+yet.
+
+\Ver>\AdaptiveDistance:WidestLabel=15pt
+\def\MeasureLabel{\ifdim\BlockWidth>\WidestLabel
+ \global\WidestLabel\BlockWidth\fi}
+\DefineHeading:Section
+ whitebefore:{20pt plus 2pt} whiteafter:14pt
+ line:start PointSize:14 Style:italic
+ block:start block:start ChapterCounter . SectionCounter
+ Spaces:1 block:stop MeasureLabel
+ fillupto:WidestLabel
+ title line:stop
+ external:contents title external:stop
+ label:start ChapterCounter . SectionCounter label:stop
+ Stop<Rev
+
+Note how two nested blocks are used: the first is to measure the
+label, and the width is written to the adaptive distance by means of
+a small macro; the second block is to fill out the white space.
+
+If you want the paragraph indentation to depend on this adaptive
+width, you can give
+ \Ver>\StartCommand{\Distance:parindent=WidestLabel }<Rev
+to set \cs{parindent} at the start of the document.
+See section~\ref[sec:doc-start-stop] and~\ref[sec:basic-indent].
+
+\Section[sec:InputFile] Input Files
+
+Parts of a document can be loaded by
+\Ver>\InputFile:parta
+\InputFile:partb<Rev
+et cetera. A~document part loaded by \refcs{InputFile} always starts
+on a new page. In section~\ref[sec:ref-local] it was already
+explained how local references for such files can be created.
+
+Perhaps most importantly, loading files this way provides a form of
+error checking; \Lollipop\ checks at the end of such a file whether all
+used constructs are balanced properly.
+
+
+\Section[sec:tests] Tests
+
+Users can define tests:
+\Ver>\DefineTest:SomethingTheMatter<Rev
+which are set like any other test:
+\Ver>\SomethingTheMatter:yes<Rev
+or \Ver>\SomethingTheMatter:no<Rev
+
+Tests can be used as \Ver>\ifSomethingTheMatter ... \else ... \fi<Rev
+Like any other conditional, test can be used inside constructs.
+\Ver>\DefineFoo:Bar [...]
+ ifSomethingTheMatter [...] fi
+ [...] Stop<Rev
+
+\Section Goodies
+
+\SubSection List commands
+
+Lollipop does a lot of list processing internally, and a few
+of the commands have been made available to the user.
+
+\Description\item \refcs{NewList}
+creates a list, and sets it to empty:
+ \Ver>\NewList:mylist<Rev
+ \item \refcs{EmptyList}
+just empty a list.
+ \item \refcs{TheList}
+inserts the list. This will typeset the contents of it.
+ \Ver>\TheList:mylist<Rev
+ \item \refcs{AppendToList}
+adds data to a list. \Ver>\AppendToList:mylist={my data}<Rev
+The data are terminated by a space or line end, hence the braces.
+\>
+
+\SubSection Programming Tools
+
+A few commands are useful for the Lollipop style designer who wants
+to write more sophisticated macros (see for instance the address book
+macros in the last chapter).
+
+\Description\item \refcs{UndefinedCS}
+is a test on control sequences.
+ \Ver>\if\UndefinedCS{testcs} ... \else ... \fi<Rev
+ \item \refcs{EqualString}
+tests equality of strings.
+ \Ver>\if\EqualString{one}{two} ... \else ... \fi<Rev
+ \item \refcs{EqualStringX}
+tests equality of strings, using only expansion.
+ \Ver>\if\EqualStringX{one}{two} ... \else ... \fi<Rev
+ \item \refcs{StringBefore}
+tests lexicographic ordering of strings. The string are not supposed
+to contain characters with char codes~0, 127,~255.
+ \Ver>\if\StringBefore{one}{two} ... \else ... \fi<Rev
+ \item \refcs{NextChar}
+chooses between two actions, based on the next character.
+ \Ver>\if\NextChar[{\macro}{\macro[default]} ...<Rev
+ \item \refcs{IsEmptyList}
+can test whether an argument is empty.
+ \Ver>\if\IsEmptyList{#1} ...<Rev
+is true for calls such as \ver>\macro{}>.
+ \item\refcs{loop}
+can be used for repeated execution of statements. (Users of plaing
+\TeX\ may recognize this macro; it is slightly extended here
+to include the \cs{else} case.) It is
+used as:
+ \Ver>\loop ... \if ... \repeat<Rev
+of \Ver>\loop ... \if ... \else ... \repeat<Rev
+
+
+ \>
+
+\SubSection[sec:everypar] \cs{everypar}
+
+The \TeX\ primitive \cs{everypar} should not be used any more.
+Instead use the command \refcs{EveryParagraph} as if you are setting
+a token list:
+ \Ver>\EveryParagraph{ ... }<Rev
+
+\SubSection[sec:everymath] \cs{everymath}
+
+The \TeX\ primitive \cs{everymath} should not be used any more.
+Instead use the command \refcs{EveryMath} as if you are setting
+a token list:
+ \Ver>\EveryMath{ ... }<Rev
+
+\SubSection[sec:everydisplay] \cs{everydisplay}
+
+The \TeX\ primitive \cs{everydisplay} should not be used any more.
+Instead use the command \refcs{EveryDisplay} as if you are setting
+a token list:
+ \Ver>\EveryDisplay{ ... }<Rev
+
+\SubSection Allocation
+
+The commands \refcs{SaveAlloc} and subsequent \refcs{RestoreAlloc} save and
+reset the internal \TeX\ allocation counters.
+
+\endinput
+
+% 2014/04/13 Added some notes about \EveryMath, and
+% \EveryDisplay. Also the wrong spelling of `note' changed
+% to `not' in `sec:everypar'.
+% 2014/04/11 Changed \n{tty} style to \n{typewriter} style
+% 92/11/18 Adaptive distances explained
+% 92/11/20 Adaptive counters explained
+% 93/05/13 changes in font macros
diff --git a/macros/lollipop/doc/manual/comment.tex b/macros/lollipop/doc/manual/comment.tex
new file mode 100644
index 0000000000..fb7047c425
--- /dev/null
+++ b/macros/lollipop/doc/manual/comment.tex
@@ -0,0 +1,129 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% comment.sty version 3.0, 3 September 1992
+% selectively in/exclude pieces of text: the user can define new
+% comment versions, and each is controlled separately.
+% Special comments can be defined where the user specifies the
+% action that is to be taken with each comment line.
+%
+% This style can be used with plain TeX or LaTeX, and probably
+% most other packages too.
+%
+% Author
+% Victor Eijkhout and Vafa Khalighi
+% persian-tex@tug.org
+%
+% Usage: all text included in between
+% \comment ... \endcomment
+% or \begin{comment} ... \end{comment}
+% is discarded. The closing command should appear on a line
+% of its own. No starting spaces, nothing after it.
+% This environment should work with arbitrary amounts
+% of comment.
+%
+% Other 'comment' environments are defined by
+% and are selected/deselected with
+% \includecomment{versiona}
+% \excludecoment{versionb}
+%
+% These environments are used as
+% \versiona ... \endversiona
+% or \begin{versiona} ... \end{versiona}
+% with the closing command again on a line of its own.
+%
+% Special comments are defined as
+% \specialcomment{name}{before commands}{after commands}
+% where the second and third arguments are executed before
+% and after each comment. By defining a control sequence
+% \Thiscomment#1{...} in the before commands the user can
+% specify what is to be done which each comment line.
+%
+% Basic approach:
+% to comment something out, scoop up every line in verbatim mode
+% as macro argument, then throw it away.
+% For inclusions, both the opening and closing comands
+% are defined as noop
+%
+% This file copyright Victor Eijkhout and Vafa Khalighi.
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+
+\def\makeinnocent#1{\catcode`#1=12 }
+\def\csarg#1#2{\expandafter#1\csname#2\endcsname}
+
+\def\TreatAsComment#1{\begingroup
+ \def\CurrentComment{#1}%
+ \let\do\makeinnocent \dospecials
+ \makeinnocent\^^L% and whatever other special cases
+ \endlinechar`\^^M \catcode`\^^M=12 \xComment}
+{\catcode`\^^M=12 \endlinechar=-1 %
+ \gdef\xComment#1^^M{\def\test{#1}
+ \csarg\ifx{PlainEnd\CurrentComment Test}\test
+ \def\next{\endgroup\AfterComment}%
+ \else \csarg\ifx{LolliEnd\CurrentComment Test}\test
+ \def\next{\endgroup\AfterComment}%
+ \else \csarg\ifx{LaLaEnd\CurrentComment Test}\test
+ \edef\next{\endgroup\noexpand\AfterComment
+ \noexpand\end{\CurrentComment}}
+ \else \ThisComment{#1}\let\next\xComment
+ \fi \fi \fi \next}
+}
+
+\def\includecomment
+ #1{\message{Including comment '#1'}%
+ \expandafter\def\csname#1\endcsname{}%
+ \expandafter\def\csname end#1\endcsname{}}
+\def\excludecomment
+ #1{\message{Excluding comment '#1'}%
+ \csarg\def{#1}{\let\AfterComment\relax
+ \def\ThisComment####1{}\TreatAsComment{#1}}%
+ {\escapechar=-1\relax
+ \csarg\xdef{PlainEnd#1Test}{\string\\end#1}%
+ \csarg\xdef{LolliEnd#1Test}{\string\\#1Stop}%
+ \csarg\xdef{LaLaEnd#1Test}{\string\\end\string\{#1\string\}}%
+ }}
+\long\def\specialcomment
+ #1#2#3{\message{Special comment '#1'}%
+ \csarg\def{#1}{\def\ThisComment{}\def\AfterComment{#3}#2%
+ \TreatAsComment{#1}}%
+ {\escapechar=-1\relax
+ \csarg\xdef{PlainEnd#1Test}{\string\\end#1}%
+ \csarg\xdef{LolliEnd#1Test}{\string\\#1Stop}%
+ \csarg\xdef{LaLaEnd#1Test}{\string\\end\string\{#1\string\}}%
+ }}
+\excludecomment{comment}
+
+\endinput
+
+% a test of the special comments
+\newcount\comlines
+\specialcomment{countedcomment}
+ {\comlines=-1\relax %note that the rest of the first line is also comment
+ \def\ThisComment{\global\advance\comlines1\relax}}
+ {\endgraf **Comment: \number\comlines\ line(s) removed**\endgraf}
+
+This is a line of text
+\countedcomment
+Oneline
+\endcountedcomment
+another line of text
+\countedcomment
+One line
+Two line
+Three line
+\endcountedcomment
+last line of text
+\end
diff --git a/macros/lollipop/doc/manual/example.tex b/macros/lollipop/doc/manual/example.tex
new file mode 100644
index 0000000000..5b38d8eefb
--- /dev/null
+++ b/macros/lollipop/doc/manual/example.tex
@@ -0,0 +1,4 @@
+
+\Itemize\item One
+{\par\PopIndentLevel Interrupted text!\par}
+\item Two\>
diff --git a/macros/lollipop/doc/manual/extern.tex b/macros/lollipop/doc/manual/extern.tex
new file mode 100644
index 0000000000..aff8e97d59
--- /dev/null
+++ b/macros/lollipop/doc/manual/extern.tex
@@ -0,0 +1,428 @@
+% extern.tex copyright 1992 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\Chapter[chap:referencing]
+Referencing
+
+In manuals and scientific documents you often want to write something
+like `see Chapter~4'. But what if you shuffle the chapters a bit? It
+would be nice if the number would be updated automatically. With
+\Lollipop, as with many other \TeX\ macro packages, this is easily
+done.
+
+Here is an example to set the mood for the rest of this chapter.
+The sort of thing that is referred to most is a heading. So suppose
+you want to refer to a section number.
+
+\Example
+\DefineHeading:TestSection
+ line:start Style:italic TestSectionCounter Spaces:2 title
+ line:stop Stop
+\TestSection[one:section?] First section\par
+After this section will come section~\ref[other:section!].
+
+\TestSection[other:section!] Another section\par
+This is the section that came after section~\ref[one:section?].
+\ExampleStop
+
+\Section What and how do you reference?
+
+You can reference not only headings but everything that has a
+counter. Thus all generic constructs can be referenced, and in
+addition you can reference item numbers in a list (there are examples
+of this latter possibility in section~\ref[sec:bib]). The simplest way
+of referencing something is to put the key in square brackets behind
+it:
+
+\Ver>\Section[this:section] The title of This Section<Rev
+You can then reference the key by \refcs{ref}, or the page
+where it appeared by~\refcs{pgref}:
+\Ver>Section \ref[this:section] on page \pgref[this:section]<Rev
+
+As you may have guessed from the above examples, keys can contain all
+sorts of characters. Only brackets, braces, and the hash sign are
+excepted. You get an error message if you try to use the same key
+twice.
+
+Another way of declaring a key is to use the command \refcs{label}
+carrying the key
+\Ver>\label[the:key]<Rev
+This can be useful if you want to declare two keys for a single
+reference. Make sure that the \cs{label} command is not part of the
+title. Unexplained phenomena occur if you do that. Instead put the
+label after the construct you want to reference:
+\Ver>\Section Precautions and remedies
+
+\label[sec:precautions]\label[sec:remedies]
+In this section ...<Rev
+
+\Section[sec:shape:reference] The shape of the reference
+
+By default, a reference consists of just the number of the thing you
+reference. There are two ways in which you can change this, one
+systematic, and one on-the-fly.
+
+\SubSection Defining the shape of the reference
+
+You can customize the way an object is
+referenced by using the option \refopt{label} in its definition. For
+instance, often you want things like parentheses around references.
+Putting this information in the label definition saves you a lot of
+work in case you change your mind later.
+
+\Example
+\DefineHeading:TestSection
+ line:start Style:italic TestSectionCounter Spaces:2 title line:stop
+ label:start ( TestSectionCounter ) label:stop Stop
+\TestSection[one:section?2] First section\par
+After this section will come section~\ref[other:section!2].
+
+\TestSection[other:section!2] Another section\par
+This is the section that came after section~\ref[one:section?2].
+\ExampleStop
+
+Another use of customized labels is including other counters in the
+reference:
+
+\Example
+\DefineHeading:TestChapter
+ line:start Style:bold TestChapterCounter / title line:stop Stop
+\DefineHeading:TestSection
+ line:start Style:italic TestSectionCounter Spaces:2 title line:stop
+ label:start TestChapterCounter .
+ TestSectionCounter label:stop Stop
+\TestChapter First chapter\par
+Pretty short chapter
+\TestChapter Second chapter\par
+\TestSection[one:section?3] First section\par
+After this section will come section~\ref[other:section!3].
+
+\TestSection[other:section!3] Another section\par
+This is the section that came after section~\ref[one:section?3].
+\ExampleStop
+
+A more surprising application of explicit definition of labels is
+inclusion of the title in the reference.
+\Example
+\DefineHeading:TestSection
+ line:start Style:italic TestSectionCounter Spaces:2 title line:stop
+ label:start TestSectionCounter literal: Spaces:1
+ Style:italic title label:stop Stop
+\TestSection[one:section?4] First section\par
+After this section will come section~\ref[other:section!4].
+
+\TestSection[other:section!4] Another section\par
+This is the section that came after section~\ref[one:section?4].
+\ExampleStop
+
+\SubSection[sec:exp-ref] Explicit specification of the reference
+
+For every specific object referenced you can specify the reference by
+using an optional argument before the label key. Have a look at the
+next example.
+
+\Example
+\DefineHeading:TestSection counter:A
+ line:start Style:bold TestSectionCounter . Spaces:2 title line:stop
+ Stop
+\TestSection[ref:one] Lalala\par
+This is before section \ref[ref:two].
+\TestSection<`the Didi section'>[ref:two] Dididi\par
+This is after section \ref[ref:one].
+\ExampleStop
+
+This mechanism is also used in lists, where it's mostly useful for
+bibliographies generated by Bib\TeX; see section~\ref[sec:BibTeX].
+
+\Section[sec:ref-local] Local references
+
+Some documents are
+collated out of parts that were documents in themselves.
+The \Lollipop\ command \cs{InputFile} facilitates in a number
+of ways working with such a segmented file (see
+section~\ref[sec:InputFile]). One of the problems with input files is
+that in such a case it may happen that the same reference key is used
+in more than one part of the document. This phenomenon is
+not at all unknown in multiple authored documents. Ordinarily this
+would result in incorrect references.
+
+To prevent such collisions \Lollipop\ can use local
+references: the command \refcs{LocalReferences} has default \n{no},
+and specifying
+\Ver>LocalReferences:yes<Rev
+creates local \file{aux} files for each input file.
+
+\Section[sec:bib] Bibliography citations
+
+\Lollipop\ has an interface to Bib\TeX. However, since a bibliography
+is just a list, referencing items in it is quite easy, even if you
+don't use Bib\TeX.
+
+\SubSection Bibliographies without Bib\TeX
+
+This section doesn't tell you anything that cannot be found elsewhere
+in this manual. The following two examples define a bibliography as
+just a list, and by giving labels to the items you can refer to them.
+
+\Example
+\DefineList:BibList item:left [ itemCounter ] item:stop
+ label:start [ itemCounter ] label:stop Stop
+In this example we shall have occasion to refer to
+\ref[Abee80] and~\ref[Ceede79].\par
+\Indent:no Bibliography
+\BibList \item[Ace55] C.D. Ace, Inscrutible title.
+\item[Abee80] E.F. Abee, Worthless drivel.
+\item[Ceede79] G.H. Ceede, Contractual obligation.
+\>
+\ExampleStop
+
+Here is a way to customize the label (if you need to refresh your
+memory about description lists, see
+section~\ref[sec:description:list]).
+
+\Example
+\DefineList:BibList item:left [ itemCounter ] item:stop
+ label:start ( description ) label:stop Stop
+In this example we shall have occasion to refer to
+\ref[Abe80] and~\ref[Ceedee79].\par
+\Indent:no Bibliography
+\BibList \item[Aace55] Aace55
+C.D. Aace, Inscrutible title.
+\item[Abe80] Abe80
+E.F. Abe, Worthless drivel.
+\item[Ceedee79] Ceedee79
+G.H. Ceedee, Contractual obligation.
+\>
+\ExampleStop
+
+\SubSection[sec:BibTeX] Bibliographies with Bib\TeX
+
+\Lollipop has an interface to the popular Bib\TeX\
+bibliography database program, based on the `BtxMac' macros
+by Karl Berry and Oren Patashnik. \Lollipop\ is set up for them, you
+only have to \cs{input} the file \file{btxmac.tex}. (The version
+of btxmac used to test this is \n{0.99h}.) You can find global
+information about Bib\TeX\ in the \LaTeX\ book~{%\tracingmacros=2
+%\tracingcommands\tracingmacros
+\bibref[La:book]},
+since Bib\TeX\ was
+originally written for \LaTeX.
+
+Since there is some redefining going on between btxmac and \Lollipop\
+you have to load the btxmac file before the \cs{Start} command (see
+section~\ref[sec:doc-start-stop]).
+
+Since the btxmac file already has a default way of formatting the
+bibliography you can get away with just putting the lines
+ \Ver>\bibliography{ <bfile> }
+\bibliographystyle{ <bstyle> }<Rev
+ in your file wherever you want the bibliography.
+
+If you want to define your own bibliography, you have to use
+\refcs{DefineBBL} which is practically a synonym for
+\ver>\DefineList:BBL>, so you can see in the `lists' chapter of this
+manual what options apply.
+
+For example:
+ \Ver>\DefineBBL line:start Style:italic literal:Literature line:stop
+ item:left [ begingroup Style:bold itemCounter
+ endgroup ] item:stop
+ Stop<Rev
+
+You refer to a bibliography item by \refcs{bibref}, as in
+\ver>\bibref[Knuth80]>. This command has a very simple definition
+ \Ver>\def\bibref[#1]{[\ref[#1]]\nocite{#1}}<Rev
+so you can easily redefine it. For instance
+ \Ver>\def\supref[#1]{$^{\rm \ref[#1]}$\nocite{#1}}<Rev
+ will make your references into superscripts.
+Make sure that
+the call to \cs{nocite} appears, because that generates the request for
+Bib\TeX.
+
+The \Lollipop\ command \ver>\WriteExtern:no> (see
+section~\ref[sec:write-extern]) defines \cs{noauxfile} to prevent
+regeneration of the bib entries in the \file{.aux} file.
+You don't have to do that anymore.
+
+\Section Obscure details
+
+For the sake of efficiency, not all macros in Lollipop automatically
+accept labels for referencing, only the ones that use the \n{label}
+option, or that have a counter (remember, the default form of the
+reference is just the counter). If you want a macro that has no
+counter and no label specification to accept a label, use the option
+\refopt{haslabel}. One reason for doing this is that you have access to
+the label itself through the control sequence \refcs{RefLabel}.
+
+\Chapter[chap:external-files] External Files
+
+Some document require information to be collected during a run. Such
+information typically is a table of contents or index, and it is
+gathered in an external file. (The reason for gathering such
+information in a file at all is that often some external manipulation,
+for instance sorting of an index, is needed.) Since there are many
+possibilities for external files (mathematical monographs may have a
+list of definitions, or a list of notations) \Lollipop\ does not
+predefine such files, but supplies all of the tools for creating them.
+
+External files involve four actions:
+\Enumerate\item The file should be declared.
+\item It should be specified what information is to be written to the
+file.
+\item The formatting of the contents of the file has to be specified.
+\item The file has to be loaded.
+\>
+
+You can have at most 15 external files per document.
+
+\Section[sec:write-extern] Declaring and loading an external file
+
+The first act, declaring the existence of the external file is very
+easy with the command \refcs{DefineExternalFile}:
+ an internal name and a three-character file name extension have
+to be given as parameters.
+\Ver>\DefineExternalFile:contents=toc<Rev
+With this definition, if the document is called \file{book.tex} then
+the `contents' will be gathered in a file called \file{book.toc}.
+(The declaration of an external file has to come before any calls
+to \cs{ExternalItem} or any options \n{external} that write
+to this file.)
+
+For each external file \n{Foo} there is a command to determine whether
+that file will be regenerated in the next run of \TeX:
+\refcs{WriteFoo} with values \n{yes}/\n{no} will allow or prevent the
+file being regenerated. The value \opt{yes} is default. The
+command \refcs{WriteExtern} (values \n{yes}/\n{no})
+can be used to prevent writing out any external files (including the
+\file{.aux} file that keeps track of references).
+
+The final act, loading an external file, is as easy as declaring it:
+use \refcs{LoadExternalFile} as in
+\Ver>\LoadExternalFile:contents<Rev
+This does not cause any page breaks or headings to be set over the
+loaded material, so you have to do that explicitly.
+
+\Section[sec:ext-option] Generating external files
+
+Next, macros that write to the table of contents have to declare this
+information. The \refopt{external} option is used for this.
+Any counter that the construct has will be written out
+automatically, and the style designer usually has to specify only
+that the title will be written out.
+\Ver>\DefineHeading:Section
+ [...]
+ external:contents title external:stop<Rev
+
+There is no objection to a construct writing information to more than
+one external file.
+
+If you write more than just \n{title} to an external file, know that
+any control sequence you specify is automatically protected from
+expansion. See section~\ref[opt:csname] for an exception to this.
+
+Other titles can be included by specifying \opt{title:OtherThing}.
+Using \opt{OtherThingTitle} would not work, because of the protection
+of control sequences mentioned above.
+
+You can write arbitrary information to an external file, if you see a
+reason to do so, by \refcs{ToExternalFile}, which takes a file name
+and an text argument. The example below has an instance of this
+command. In order to format this information you have to define an
+external construct of type \cs{anon}.
+
+\Section[sec:ext-item] Formatting an external file
+
+The hardest part is declaring the formatting of an external file. For
+this a separate generic construct exists: the `external item' with
+defining command \refcs{DefineExternalItem}. For example, if
+\cs{Section} writes to \n{contents}, than an external item \n{Section}
+corresponding to this file has to be declared. The option
+\refopt{file} is use to declare to which file the external item
+belongs. This way the same name can be reused for more than one file.
+
+\Ver>\DefineExternalItem:Section file:contents
+ [...] Stop<Rev
+
+An external item is basically a list with just one item. Thus, the
+option \refopt{item} is available. The elements of an external item are
+the label (the counter value), the page number where the information
+was generated, and the title.
+For the label (say for a construct \cs{Foo})
+an option \refopt{FooLabel} is created.
+Thus the typical formating looks like
+\Ver>\DefineExternalItem:Chapter file:contents
+ item:left ChapterLabel item:stop
+ title begingroup Spaces:2 Style:italic Page endgroup
+ Stop<Rev
+In fact, a control sequence \refcs{FooLabel} is created, which
+can be used in other external items.
+
+Since an external item is a list in itself, you have to pull a
+certain trick to get items for subsections to indent further than
+those for sections. This is what the command \cs{PushIndentLevel} was
+designed for.
+
+A typical indented item looks like:
+\Ver>\DefineExternalItem:SubSection file:contents
+ PushIndentLevel PushIndentLevel
+ item:left SectionLabel . SubSectionLabel item:stop
+ title begingroup Spaces:2 Style:italic Page endgroup
+ Stop<Rev
+
+\Section Example
+
+The following example is for a typical table of contents that
+records sections and subsections. In good old-fashioned style, the
+subsections are indented with respect to the sections.
+\endinput
+\Example
+\DefineExternalFile:TheContents=tct
+\DefineHeading:TestChapter Style:bold
+ line:start TestChapterCounter Spaces:2 title line:stop
+ external:TheContents title external:stop Stop
+\DefineExternalItem:TestChapter file:TheContents
+ item:left Style:bold TestChapterLabel item:stop title white:5pt
+ Page par Stop
+\DefineHeading:TestSection Style:italic
+ line:start TestChapterCounter . TestSectionCounter
+ Spaces:2 title line:stop
+ external:TheContents title external:stop Stop
+\GoverningCounter:TestSection=TestChapter
+\DefineExternalItem:TestSection file:TheContents PushIndentLevel
+ item:left Style:bold TestChapterLabel . TestSectionLabel item:stop
+ title white:5pt Page par Stop
+\DefineExternalItem:anon file:TheContents begingroup
+ Style:italic title white:5pt Page par Stop
+
+\LoadExternalFile:TheContents
+\TestChapter First heading\par
+\TestSection First subheading\par
+Some text might be nice.
+\TestSection Second subheading\par
+Some more text.
+\ToExternalFile:TheContents={Enclosed Graphics}
+\TestChapter Second heading\par
+\TestSection Third subheading\par
+Yet more text.
+\TestSection Fourth subheading\par
+And again: text.
+\ExampleStop
+
+\endinput
+
+% 92/11/26 BibTeX section
diff --git a/macros/lollipop/doc/manual/head.tex b/macros/lollipop/doc/manual/head.tex
new file mode 100644
index 0000000000..2053c58c63
--- /dev/null
+++ b/macros/lollipop/doc/manual/head.tex
@@ -0,0 +1,118 @@
+% head.tex copyright 1992 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\Chapter Headings
+
+Headings for sections, chapters, and such, are an essential part of
+any \TeX\ macro package. In Lollipop they are maybe a bit less
+special: all options for headings are general options, meaning that
+they also apply to text blocks and lists. There are only two things
+that distinguish headings:
+
+\Enumerate
+\item there will be no page break after a heading;
+\item there is no closing command for a heading.
+\>
+
+\Section[sec:head:examples] Examples
+
+Headings are defined by \refcs{DefineHeading}.
+The most obvious element in a heading is the title, marked by the
+option \refopt{title}. The title is anything that follows the heading
+command, upto the first empty line.
+
+\Ver>\SomeHeading Some title
+
+And some text following it.<Rev
+
+\ImpNote
+Titles can also be terminated by \cs{par}, but knowledge of this is
+not encouraged. See further~\ref[imp:title:delimiting].
+\ImpNoteStop
+
+The title has to be
+included in a line or a textcolumn for proper handling (see
+also section~\ref[sec:opt:traps]). For titles that do not exceed one
+line, the \opt{line} option suffices (section~\ref[sec:opt:line]); if a
+title is possibly more than one line long, the \opt{textcolumn} option
+has to be used (section~\ref[sec:opt:textcolumn].
+
+\Example
+\DefineHeading:TestSection Style:bold
+ line:start TestSectionCounter Spaces:2 title line:stop
+ Stop
+\TestSection The Title
+
+The text after the heading.
+\ExampleStop
+
+By default, the text after a heading is indented. Overriding this
+default behaviour is done with the option \refopt{indentafter}.
+
+\Example
+\AlwaysIndent:no % as a default, don't indent paragraphs
+\DefineHeading:TestSection Style:bold
+ line:start TestSectionCounter Spaces:2 title line:stop
+ indentafter:yes Stop
+\TestSection The Title
+
+The text after the heading.\par
+The second paragraph after the heading
+\ExampleStop
+
+Usually headings come in a hierarchy, where the counter of one type,
+for instance a subsection, is reset everytime the counter of a higer
+level is stepped. In \Lollipop, this subordinating of headings is
+done by declaring one counter to be governed by another (counters
+are explained in full detail in section~\ref[sec:counters]).
+
+\Example
+\DefineHeading:TestChapter Style:bold
+ line:start TestChapterCounter Spaces:1 title line:stop
+ Stop
+\DefineHeading:TestSection Style:italic
+ line:start TestChapterCounter : TestSectionCounter . Spaces:1
+ title line:stop Stop
+\GoverningCounter:TestSection=TestChapter
+
+\TestChapter Level One Heading\par
+\TestSection Level Two Heading\par
+Some text.
+\TestSection Level Two again\par
+More text.
+\TestChapter Level One is Stepped\par
+\TestSection Level Two\par
+Again text.
+\ExampleStop
+
+Headings will often wind up in a table of contents. For this, the
+table of contents will have to be declared:
+\Ver>\DefineExternalFile:contents=toc<Rev
+and its formatting will have to be specified, but also every
+construct that writes to this file has to be declared as such.
+
+\Ver>\DefineHeading:TestSection
+ [...]
+ external:contents title external:stop
+ Stop<Rev
+
+Usually, the title is all that has to be written out (the counter
+value is written by default), but the possibility exists for writing
+out other information as well. See section~\ref[sec:ext-option].
+
+\endinput \ No newline at end of file
diff --git a/macros/lollipop/doc/manual/list.tex b/macros/lollipop/doc/manual/list.tex
new file mode 100644
index 0000000000..24df43a61b
--- /dev/null
+++ b/macros/lollipop/doc/manual/list.tex
@@ -0,0 +1,442 @@
+% list.tex copyright 1992 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\Chapter Lists
+
+Lists in Lollipop are defined by \refcs{DefineList}:
+
+\Ver>\DefineList:Foo [...]
+ item:start [...] item:stop
+ [...] Stop<Rev
+and the resulting list is used as
+\Ver>\Foo
+\item [ ..text.. ]
+\item [ ... ]
+\FooStop<Rev
+where the closing command can be abbreviated as~\cs{>}.
+
+\Section Label alignment
+
+In general there is a default position for labels;
+either aligning with the
+left or the right side of the margin over which the list is indented.
+The two ways are indicated with the option \refopt{item}:
+\Ver> item:left [...] item:stop<Rev
+and \Ver> item:right [...] item:stop<Rev respectively.
+Specifying \opt{item:start} gives the default left aligning position.
+
+\Example
+\DefineList:enumerate
+ item:start itemCounter ) item:stop Stop
+\DefineList:enumerateright
+ item:right ( itemCounter ) Spaces:1 item:stop Stop
+\enumerate\item Some item
+\item And another
+\enumerateright\item First nested item
+\item Next nested item\>
+\item And back to the original list.\>
+\ExampleStop
+
+\Section List indentation
+
+The amount over which the text of a list (excluding the item labels)
+is indented is controled by a list of indentations. This is explained
+in section~\ref[sec:indent:control]. The indentation amount is most of
+the time also equal to the value of the paragraph indentation outside
+that list.
+
+In the rare case where the indentation of a list has to be controlled
+explicitly, there is an option \refopt{indentation} with one value.
+\Ver>\DefineList:SomeList indentation=30pt [...] Stop<Rev
+
+
+\Section Label style
+
+Every list that uses the \refopt{itemsign} option is an `itemize' list,
+no matter what it's name, and there is a counter in Lollipop that
+keeps track of how deep you are in itemize lists. Similarly, every
+list that uses \refopt{itemCounter} is an `enumerate' lists, and these
+are counted too.
+
+On every next level a new style of item sign or counter is used. For
+item signs this is in sequence: $\bullet$, $\circ$, --, and $\cdot$
+for all higher levels. The style of sign can be changed by
+\refcs{SetItemSign}: \Ver>\SetItemSign:6=m<Rev where the letter
+indicating the sign is interpreted as: \n b~$\bullet$ (bullet), \n
+c~$\circ$ (circle), \n d~$\diamond$ (diamond), \n m~--- (em-dash), \n
+n~-- (en-dash), \n .~$\cdot$.
+
+Similarly, the counter style can be set by
+\refcs{SetItemCounterRepresentation}:
+\Ver>\SetItemCounterRepresentation:2=i<Rev where the letter
+representing the style is interpreted as: 1~Arabic, I~uppercase roman,
+i~lowercase roman, A~uppercase characters, a~lowercase characters.
+
+\Section Label width
+
+The default width for a label is at most the width of the margin over
+which the list is indented. Using \opt{item:left} or \opt{item:right}
+will have the label pushed to the left or right side of this margin
+respectively. Now what if the label material is wider than this
+margin? Usually you want the label then to expand to the right, and
+that is indeed what happens, unless you specify
+\refopt{labeloverflow} with value \n{left}, in which case the right
+boundary of the label will not budge, and the label will start
+protruding into the outer margin.
+
+\Section[sec:description:list] Description lists
+
+A common type of list is the type where each item label consists of a
+piece of text. Such a list is called a `description' list in
+\Lollipop, and it recognized by the occurrence of the option
+\refopt{description} in its definition. A~description list can also use
+the item sign or the item counter, of course.
+
+Using a description list, the description text is everything that
+follows the command \cs{item}, up to the end of the line.
+
+\Example
+\DefineList:TestList
+ item:left Style:bold itemCounter . Spaces:1 description
+ Spaces:2 item:stop Stop
+\TestList\item Do
+A deer, a female deer.\item Re
+According to mr. Fowler only a legal term.
+\item Mimi Jett
+The owner/founder of ETP\>
+\ExampleStop
+
+As you can see, the problem of label overflow can easily occur with
+description lists. Thus it is a good idea to end the item material
+with some white space, as in the above example.
+
+ Exceptional situation:
+if you use an empty description text, you should write \ver>\item{}>.
+
+\Section Suspended lists
+
+Occasionally the is a need to resume an enumerate list, that is,
+after a piece of text that is not part of the list an enumerate list
+should start counting from the previous value on. In \Lollipop\ this
+phenomenon can be realized by never ending the enumerate list, and
+simply moving the text one indentation level back with
+\refcs{PopIndentLevel}.
+
+\Example
+\DefineList:enumerate item:left itemCounter item:stop Stop
+\enumerate\item First some item\par
+{\PopIndentLevel \Indent:no
+This text seems to be outside the list. Don't you believe it.\par}
+\item And another item\>
+\ExampleStop
+
+Note that the `popped' text has to be in a group (otherwise the
+subsequent items will also be popped back), and it has to be
+separated from the preceding and following text by \cs{par}; the
+trailing \cs{par} has to be in the group.
+
+\Section Item counter manipulation
+
+The item counter can be manipulated explicitly. This is necessary for
+instance for starting a list at another value than one. What you need
+to realize here is that the command \cs{item} starts by incrementing
+the counter. Furthermore, the only way to access the item counter is
+through the commands for counters; see section~\ref[sec:counters].
+
+\Example
+\DefineList:enumerate item:left itemCounter item:stop Stop
+\enumerate \SetCounter:item=-1
+\item Escape: usually the backslash.
+\item Begin Group.\>
+\ExampleStop
+
+\Section List titles and list tails
+
+Lists can have titles. The title follows the command that invokes the
+list, in the usual manner. Material to follow the list can also be
+specified: anything following the option \refopt{text} is considered to
+be trailing material.
+
+\Example
+\DefineList:TestList hrule line:start Style:bold title line:stop
+ item:left Style:italic itemCounter item:stop
+ text vwhite:3pt hrule Stop
+\TestList In the last fiscal year, have you:\par
+\item Eaten peanuts? \item Walked the dog?
+\item Bought a Frank Zappa record?\>
+\ExampleStop
+
+In case you wonder what happens with textual material after
+\opt{item:stop} and before any \opt{text}, well, that is taken to be
+inserted immediately after each item label.
+
+\Section Between the items
+
+There are special list options controlling what happens in between
+items. \Lollipop\ has an option \refopt{breakbetween}, analogous to
+\opt{breakbefore} and \opt{breakafter}; see
+section~\ref[sec:opt:penalties]. This item be default has a
+value of~\n{$-50$}, implying that breaks in between items
+should be preferred slightly over breaks in between the
+lines of an item.
+
+Similarly, there is an option \refopt{whitebetween}
+controlling the amount of white space in between items that is
+analogous to \opt{whitebefore} and \opt{whiteafter}. Like these two
+options, it can also be set by the \cs{Distance} command
+(section~\ref[sec:com:distance]).
+
+\Section Indentation in lists
+
+An item can be considered to be consisting of at least one paragraph.
+That paragraph is never indented. For the behaviour of any next
+paragraph within the same item, the option \refopt{indentinside} can be
+used. This option has values yes/no. In case paragraphs inside an
+item indent, the indentation amount is level-controlled; see
+section~\ref[sec:indent:control].
+
+\Chapter[chap:text:block] Text Blocks
+
+The `text block' is a way of treating a moderate sized chunk of text
+in a different way from the surrounding text. Text blocks are
+created by \refcs{DefineTextBlock}. Here is a small example.
+
+\Example
+\DefineTextBlock:Quote
+ PushIndentLevel PointSize:9 SetFont text Stop
+\Indent:no In some context it has been written that
+\Quote No man is an island.\QuoteStop
+In another:
+\Quote Run don't walk to the nearest island.\>
+Sometimes one would wish women weren't so logical.
+\ExampleStop
+
+Note that the text block has an explicit closing command,
+consisting of the name of the block followed by \opt{Stop},
+and that implicit closing by \cs{>} is possible.
+
+\Section The \opt{text} option
+
+Text blocks have only one specific option: \refopt{text}. This option
+is used to separate material heading the block from material trailing
+the block. Example:
+
+\Example
+\DefineTextBlock:DisplayEq
+ whitebefore:abovedisplayskip whiteafter:belowdisplayskip
+ line:start white:parindent $ displaystyle text $ line:stop Stop
+The formula
+\DisplayEq e^{\pi i}+1=0\>
+contains nature's five most interesting constants.
+\ExampleStop
+
+Here one dollar comes before the text, and one after, so the first is
+inserted by \cs{DisplayEq} and the second by the corresponding
+closing command.
+
+Material before and after the text should usually not be broken.
+Hence \cs{nobreak} is automatically inserted. See the \cs{Example}
+macro for this manual: pages should not be broken after rules, or
+around the text `example~xyz'.
+
+\Section More examples
+
+A text block can encompass more than one paragraph, so the options
+\opt{indentinside} and \opt{indentfirst} are particularly useful here.
+
+\Example
+\AlwaysIndent:no
+\DefineTextBlock:TestBlock PushIndentLevel
+ indentafter:yes indentfirst:no indentinside:yes
+ text unskip hfill $ bullet $ par Stop
+One paragraph.\par The next paragraph
+\TestBlock Inside the block one paragraph.\par
+Inside the block the next paragraph.\>
+Outside the following paragraph.\par And the last paragraph.
+\ExampleStop
+
+\ImpNote
+\iSection[imp:gen:open:close] The environment in generic constructs
+
+The text block is just about the purest use of the \Lollipop\
+environment mechanism. Here is how a text block is defined:
+\Ver>
+\def\@DefineTextBlock{
+ \csarg\edef{\@name}{\@gen@open
+ \the\before@coms
+ }
+ \@DefineStopCommand{\the\after@coms \@gen@close}
+ }<Rev
+
+The \cs{before@coms} and \cs{after@coms} are two token lists with
+the heading and trailing commands.
+
+It is important to note that the definition of the control sequence
+of the block is defined by \cs{edef}. This first of all unwraps the
+token lists, but it also has an important effect on
+\cs{@gen@open/close}. These control sequences contain a lot of
+conditionals which, in combination with the \cs{edef} give a really
+dynamic definition of generic constructs in \Lollipop.
+
+First of all, the opening and closing commands induce a group
+so that various quantities can be set locally.
+\Ver>
+\def\@gen@open{\outer@start@commands
+ \begingroup \inner@start@commands}
+\def\@gen@close{\inner@end@commands
+ \endgroup \outer@end@commands}<Rev
+
+The outer start commands concern global actions such as backspacing
+previous skips, incrementing counters and setting references.
+\Ver>
+\def\outer@start@commands{%
+ \iftext@construct
+ \ifleft@embedded@construct
+ \nxp\bsp@hack
+ \else \nxp\leavehmode \nxp\bvwit{\the\@whitebefore}\fi<Rev
+The `embedded construct' tests are only true if the construct
+can be embedded in a paragraph. A~rare occurence most of the time.
+\Ver>
+ % backspace previous white space while it's visible
+ \nxp\if@headed\nxp\else
+ \ifforced@break@before\@beforepenalty
+ \else\nxp\ifnum\lastpenalty=\z@
+ \@beforepenalty\nxp\fi
+ \fi
+ \nxp\fi<Rev
+A subtle point: a preceding heading will have placed \cs{nobreak}
+followed by a skip. It is dangerous to place any sort of penalty
+after this because it might induce a page break.
+
+Now the counter, title, and stuff connected to that.
+\Ver>
+ \fi
+ \ifhas@counter \nxp\StepCounter:\expandafter\@name\@space
+ % This sets the \current@label by default<Rev
+Since this is used inside an \cs{edef} we can use some trickery
+to get the space token after the argument to \cs{StepCounter}.
+\Ver>
+ \ifhas@marks \edef\nxp\cs@e
+ {\nxp\nxp\nxp\refresh@mark@item
+ {\@name Counter}{\CSname{\@name Counter}}}%
+ \nxp\cs@e
+ \fi
+ \fi
+ \iflabel@defined
+ \global\current@label={\the\@labelcoms}\fi
+ \ifhas@title \install@title@code<Rev
+This title business is explained in~\ref[imp:install:title].
+This piece of code also refreshes the title in the mark structure.
+This has to be done after any page break for the benefit
+of headers/footers.
+\Ver>
+ \fi
+ \ifhas@marks\nxp\ifnin{\nxp\place@mark}\fi
+ %otherwise IniTeX'ing Lollipop will output a page
+ \nxp\xx@label\the\extern@toks\penalty\@M
+ % also subtle: if this white space would be higher, it would
+ % be invisible because of marks et cetera.
+ % insert nobreak after marks/writes to prevent page breaks.
+ \iftext@construct
+ \ifleft@embedded@construct
+ \else \nxp\@vwhite{\the\@whitebefore}\fi
+ \fi
+ }<Rev
+
+Inner start commands are concerned with setting local values.
+\Ver>
+\def\inner@start@commands{%
+ \nxp\Open@Group\CSname{\@class}\CSname{\@name}%<Rev
+The \cs{Open@Group} call makes it possible to track down groups
+that have inadvertendly been left open. Since we now know the
+name we can give helpful error msgs.
+\Ver>
+ \install@stop<Rev
+Install the right implicit closing, see~\ref[sec:implicit:close]
+and~\ref[imp:implicit:close].
+\Ver>
+ \ifleft@embedded@construct
+ \else \nxp\hold@parskip
+ \nxp\@defaulteverypar
+ \ifwhiteleft@defined \advance\leftskip \the\@whiteleft \relax \fi
+ \ifwhiteright@defined \advance\rightskip \the\@whiteright \relax \fi
+ \nxp\let\nxp\par=\nxp\@par %explain to me again why this is necessary...
+ \inside@indent \first@indent
+ \fi
+ \advance\nest@depth\@ne<Rev
+The nest depth is used for determining indentation levels.
+\Ver>
+ }<Rev
+
+End commands set up some conditions, most of which will be tested
+by the start of any next construct.
+\Ver>
+\def\inner@end@commands{%
+ \nxp\Close@Group\CSname{\@class}\CSname{\@name}%
+ \ifright@embedded@construct \else \nxp\leavehmode \fi
+ \@afterpenalty
+ \ifright@embedded@construct \else \nxp\@vwhite{\the\@whiteafter}\fi
+ }
+\def\outer@end@commands{%
+ \the\after@toks
+ \ifright@embedded@construct
+ \nxp\@headedno \nxp\esp@hack
+ \else
+ \after@indent \nxp\dono@parskip
+ \fi}<Rev
+
+\iSection[imp:implicit:close] Implicit closing
+
+Constructs with an explicit closing command, lists and text blocks,
+can be closed by~\cs{>}, which simply closes the current
+construct. A~more drastic version, \cs{>]}, closes all currently
+open constructs.
+\Ver>
+\def\outer@stop@command{\Emessage{Vacuous group closing}}
+\let\default@stop@command\outer@stop@command
+\def\>{\default@stop@command%[fool the editor
+ \ifNextChar]{%
+ \ifx\default@stop@command\outer@stop@command
+ \xp\take@one
+ \else \xp\>\fi}{}}<Rev
+The \cs{outer@stop@command} is meant to give an error msg if the
+user attempts to close a group while none is open.
+
+The current meaning of~\cs{>} is installed in
+\cs{inner@start@commands}:
+\Ver>
+\def\install@stop{\if@implicitclose
+ \def\nxp\default@stop@command
+ {\CSname{\stop@command}}%
+ \else \let\nxp\default@stop@command
+ \nxp\outer@stop@command
+ \fi}<Rev
+
+By default, constructs can be closed implicitly, but there is an
+option \refopt{noimplicitclose} to disable this.
+\Ver>
+\newif\if@implicitclose
+\add@generic@default{\@implicitcloseyes}
+\@GenericOption{noimplicitclose}{\@implicitcloseno}<Rev
+This option is for instance used in the examples in this manual.
+Otherwise closing a construct in the example would also close the
+example itself.
+
+\ImpNoteStop
+
+\endinput \ No newline at end of file
diff --git a/macros/lollipop/doc/manual/lollipop-manual.bib b/macros/lollipop/doc/manual/lollipop-manual.bib
new file mode 100644
index 0000000000..d742991915
--- /dev/null
+++ b/macros/lollipop/doc/manual/lollipop-manual.bib
@@ -0,0 +1,59 @@
+@article{EL:Cork,
+author = {Victor Eijkhout and Andries Lenstra},
+title = {The document style designer as a separate entity},
+journal = {TUGboat},
+volume = {12},
+issue = {1},
+year = {1991},
+pages = {31--34}
+}
+
+@misc{E:book,
+author = {Victor Eijkhout},
+title = {{\TeX} by Topic},
+publisher = {Addison-Wesley},
+howpublished = {{\tt http://eijkhout.net/texbytopic/texbytopic.html}},
+year = {1992}
+}
+
+@article{E:Portland,
+author = {Victor Eijkhout},
+title = {Just give me a Lollipop (it makes my heart go giddy-up)},
+journal = {TUGboat},
+volume = {13},
+issue = {3},
+year = {1992},
+pages = {341--346}
+}
+
+@book{Kn:book,
+author = {Donald E. Knuth},
+title = {The {\TeX} Book},
+publisher = {Addison-Wesley},
+year = {1984, reprinted with corrections 1989}
+}
+
+@book{La:book,
+author = {Leslie Lamport},
+title = {{\LaTeX} A Document Preparation System},
+publisher = {Addison-Wesley},
+year = {1986}
+}
+
+@article{Pe:epigrams,
+author = {Alan Perlis},
+title = {Epigrams on programming},
+journal = {ACM Sigplan Notices},
+volume = {17},
+issue = {9},
+year = {1982},
+pages = {7--13}
+}
+
+@book{SeLe:book,
+author = {Raymond Seroul and Silvio Levy},
+title = {A Beginner's Book of \TeX},
+publisher = {Springer Verlag},
+year = {1990}
+}
+
diff --git a/macros/lollipop/doc/manual/lollipop-manual.pdf b/macros/lollipop/doc/manual/lollipop-manual.pdf
new file mode 100644
index 0000000000..533d578a0b
--- /dev/null
+++ b/macros/lollipop/doc/manual/lollipop-manual.pdf
Binary files differ
diff --git a/macros/lollipop/doc/manual/lollipop-manual.tex b/macros/lollipop/doc/manual/lollipop-manual.tex
new file mode 100644
index 0000000000..b2e7884733
--- /dev/null
+++ b/macros/lollipop/doc/manual/lollipop-manual.tex
@@ -0,0 +1,92 @@
+% lollipop-manual.tex master file for the Lollipop TeX manual.
+% this file and all input files for it copyright 1992 Victor Eijkhout,
+% copyright 2014--2016 Vafa Khalighi,
+% except where indicated otherwise.
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\tracingstats=1
+\makeatletter
+\makeatother
+\showboxdepth=-1
+
+\input comment
+% By shuffling the \comment line you can load different fonts.
+% This is machine dependent, so by default you get the CM font,
+% which should work everywhere.
+%
+\def\SerifFace{\TypeFace:ComputerModern }
+\def\SansFace{\TypeFace:ComputerSans }
+
+
+% Now load the style definition. This takes some time.
+\input mandefs
+
+% Prevent regeneration of external files; change 'yes' into 'no'
+% if you are changing page dimensions or so.
+\WriteExtern:yes
+
+% BibTeX interface by Berry and Patashnik
+\input btxmac
+
+% Start formating
+\Start
+
+% Include the next line if you are formatting the second half
+% of this manual:
+%\comment
+
+\CounterRepresentation:Page=i \RightPage
+\InputFile:titlepag
+
+\InputFile:prelim
+\SetCounter:LastInPage=PageValue
+\BackStepCounter:LastInPage
+
+\ToRecto\RightPage
+\CounterRepresentation:Page=1 \SetCounter:Page=1
+
+\InputFile:struct
+
+\InputFile:head
+
+\InputFile:list
+
+% For the first half include the following line:
+%\Stop
+% For second half include the following lines:
+%\endcomment
+%\RightPage \SetCounter:Page=11
+
+\InputFile:out
+
+\InputFile:extern
+
+\InputFile:opt
+
+\InputFile:comm
+
+\InputFile:trace
+
+\InputFile:appendix
+
+\SetCounter:LastRegPage=PageValue
+\BackStepCounter:LastRegPage
+\Stop
+
+% 2016/04/09 Updated the manual
+% 92/11/20 Total pages counter
+% 93/01/08 \comment and such for two part processing
diff --git a/macros/lollipop/doc/manual/mandefs.tex b/macros/lollipop/doc/manual/mandefs.tex
new file mode 100644
index 0000000000..dbc822d78d
--- /dev/null
+++ b/macros/lollipop/doc/manual/mandefs.tex
@@ -0,0 +1,225 @@
+% mandefs.tex style definition for the Lollipop manual
+% copyright 1992/3 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\def\con#1{{\tt#1}}
+\def\n#1{{\tt#1}}
+\def\file#1{{\tt#1}}
+
+\def\Lollipop{Lollipop}
+
+\Distance:rightmarginstretch={0cm plus 2.54cm}
+\Distance:whitebefore={6pt plus 3pt minus 2pt}
+\Distance:whiteafter=whitebefore
+\FlushRight:no
+
+\DefineExternalFile:contents=toc
+
+\DefineHeading:Chapter
+ breakbefore:yes whiteafter:20pt
+ line:start PointSize:14 Style:bold literal:Chapter
+ Spaces:1 ChapterCounter line:stop
+ vwhite:15pt
+ line:start PointSize:16 Style:bold title line:stop
+ external:contents title external:stop
+ Stop
+
+\AdaptiveDistance:WidestLabel=15pt
+\def\MeasureLabel{\ifdim\BlockWidth>\WidestLabel
+ \global\WidestLabel\BlockWidth\fi}
+\StartCommand{\Distance:parindent=WidestLabel }
+\DefineHeading:Section
+ whitebefore:{20pt plus 2pt} whiteafter:14pt
+ line:start PointSize:14 Style:italic
+ block:start block:start ChapterCounter . SectionCounter
+ Spaces:1 block:stop MeasureLabel
+ fillupto:WidestLabel
+ title line:stop
+ external:contents title external:stop
+ label:start ChapterCounter . SectionCounter label:stop
+ Stop
+\GoverningCounter:Section=Chapter
+
+\DefineHeading:SubSection
+ whitebefore:{14pt plus 2pt} whiteafter:8pt
+ line:start PointSize:10 Style:italic
+ ChapterCounter . SectionCounter . SubSectionCounter
+ Spaces:1 title line:stop
+ label:start ChapterCounter . Spaces:.2 SectionCounter
+ . Spaces:.2 SubSectionCounter label:stop
+ Stop
+\GoverningCounter:SubSection=Section
+
+\DefineExternalFile:impnotes=imp
+\DefineHeading:iSection
+ whitebefore:{10pt plus 1pt} whiteafter:8pt
+ line:start PointSize:12 Style:bold I -
+ Style:italic iSectionCounter
+ Spaces:1 title line:stop
+ label:start I - iSectionCounter label:stop
+ external:impnotes title external:stop
+ Stop
+%\GoverningCounter:iSection=Chapter
+\DefineExternalItem:iSection file:impnotes PushIndentLevel
+ item:left I - Style:italic iSectionLabel item:stop
+ title begingroup Spaces:2 Style:italic Page endgroup
+ Stop
+
+\DefineExternalItem:Chapter file:contents
+ item:left ChapterLabel item:stop
+ title begingroup Spaces:2 Style:italic Page endgroup
+ Stop
+\DefineExternalItem:Section file:contents PushIndentLevel
+ item:left ChapterLabel . SectionLabel item:stop
+ title begingroup Spaces:2 Style:italic Page endgroup
+ Stop
+
+\def\impnotetxt{Implementor's Note}
+\DefineTextBlock:ImpNote PushIndentLevel
+ whitebefore:12pt whiteafter:11pt
+ line:start PointSize:12 Style:italic impnotetxt line:stop
+ SansFace PointSize:9 SetFont text
+ Stop
+\excludecomment{ImpNote}
+
+\DefineTextBlock:WizNote
+ PushIndentLevel PointSize:9 SetFont text
+ Stop
+
+\DefineList:Description
+ item:left description Spaces:2 item:stop whitebetween:6pt
+ Stop
+
+\DefineList:cDescription
+ item:left tt char busje description Spaces:2 item:stop
+ whitebetween:6pt
+ Stop
+
+\DefineList:Enumerate
+ item:left itemCounter item:stop
+ Stop
+
+\DefineList:Itemize
+ item:left itemsign item:stop
+ Stop
+
+\DefineBBL
+ item:left [ - itemCounter - ] item:stop
+ Stop
+
+\SerifFace \SetFont
+
+\newwrite\exfile
+\def\HereAndOut#1{\immediate\write\exfile{#1}}
+\specialcomment{Example}
+ {\EExample
+ \immediate\openout\exfile=example.tex\relax
+ \let\ThisComment\HereAndOut}
+ {\immediate\closeout\exfile
+ \begingroup \tt \SetFont
+ \verbatimfile{example.tex}\endgroup
+ \SaveAlloc \input example.tex\relax \RestoreAlloc
+ \EExampleStop}
+\DefineTextBlock:EExample whiteafter:{6pt plus 5pt}
+ noimplicitclose rule:h vwhite:3pt
+ line:start literal:Example Spaces:1.5
+ ChapterCounter . EExampleCounter
+ line:stop
+ vwhite:3pt rule:h vwhite:3pt text vwhite:3pt rule:h
+ Stop
+\GoverningCounter:EExample=Chapter
+
+\specialcomment{OutExample}
+ {\EExample
+ \immediate\openout\exfile=example.tex\relax
+ \let\ThisComment\HereAndOut}
+ {\immediate\closeout\exfile
+ \begingroup \tt \SetFont
+ \verbatimfile{example.tex}\endgroup
+ \par\penalty0\relax
+ \SaveAlloc \SuspendOutput \begingroup \CountSheetsno
+ \global\setbox\PageRow\hbox{}%
+ \let\CurrentShipout\ToPageRow
+ \xInputFile:example
+ \endgroup
+ \ResumeOutput \RestoreAlloc
+ \noindent\unhbox\PageRow\hbox{}\par
+ \EExampleStop}
+\newbox\PageRow\newbox\RowPage
+\def\ToPageRow{\setbox\RowPage\box\WholePage \xToPageRow}
+\def\xToPageRow{\global\setbox\PageRow
+ \hbox{\unhbox\PageRow\box\RowPage\hfill}}
+
+\def\opt#1{{\tt#1}}
+\DefineExternalFile:optindex=oix
+\def\refopt#1{\OptToIdx #1\par}
+\DefineHeading:OptToIdx embedded:yes
+ block:start tt title block:stop
+ external:optindex title external:stop
+ nomarks Stop
+\DefineExternalItem:OptToIdx file:optindex
+ embedded:yes
+ begingroup tt title endgroup
+ nobreak Spaces:1.5 Page Spaces:2.5 Stop
+
+\DefineExternalFile:csindex=cix
+\def\refcs#1{\CsToIdx #1\par}
+\DefineHeading:CsToIdx embedded:yes
+ block:start tt char busje title block:stop
+ external:csindex title external:stop
+ nomarks Stop
+\DefineExternalItem:CsToIdx file:csindex
+ embedded:yes
+ begingroup tt char busje title endgroup
+ nobreak Spaces:1.5 Page Spaces:2.5 Stop
+
+\topskip20pt
+\OptionsMacro:PageDims=width:page=15cm height:page=23cm Stop
+\DefinePageGrid:LeftPage macro:PageDims
+ band:start block:start PointSize:9 Style:italic
+ FirstPlaced:ChapterCounter Spaces:2 stickout:left
+ FirstPlaced:ChapterTitle band:stop
+ textband:start text textband:stop
+ band:invisible block:start PointSize:9 Style:bold
+ PageCounter Spaces:2 stickout:left band:stop
+ NextPageGrid:RightPage Stop
+\DefinePageGrid:RightPage macro:PageDims
+ band:start fillup PointSize:9 Style:italic
+ LastPlaced:SectionTitle
+ block:start Spaces:2 LastPlaced:ChapterCounter .
+ LastPlaced:SectionCounter stickout:right
+ band:stop
+ textband:start text textband:stop
+ band:invisible fillup
+ block:start PointSize:9 Style:bold Spaces:2
+ PageCounter stickout:right band:stop
+ NextPageGrid:LeftPage Stop
+\DefinePageGrid:EmptyPage macro:PageDims
+ textband:start text textband:stop
+ NextPageGrid:LeftPage Stop
+
+\AdaptiveCounter:LastInPage \CounterRepresentation:LastInPage=i
+\AdaptiveCounter:LastRegPage \CounterRepresentation:LastRegPage=1
+%\SetCounter:LastInPage=PageValue -- at the end of prelim.tex
+%\SetCounter:LastRegPage=PageValue -- at the end of manual.tex
+
+\endinput
+
+% 92/11/05 stretch added
+% 92/11/18 adaptive label width
+% 92/11/19 adaptive last page \ No newline at end of file
diff --git a/macros/lollipop/doc/manual/opt.tex b/macros/lollipop/doc/manual/opt.tex
new file mode 100644
index 0000000000..1d0b5d7959
--- /dev/null
+++ b/macros/lollipop/doc/manual/opt.tex
@@ -0,0 +1,408 @@
+% opt.tex copyright 1992 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\Chapter Options
+
+This chapter discusses the various options that are common to all
+\Lollipop\ constructs.
+
+\Section Titles
+
+Any construct can have a title, although of course it is most useful
+for headings.
+A construct has a title if the option \refopt{title} appears.
+Example:
+\Ver>
+\DefineHeading:Section [...]
+ Style:bold title
+ [...] Stop<Rev
+
+will define a \cs{Section} macro that has a title.
+The macro is then used as
+\Ver>
+\Section The title of this section
+
+Some text in this section.<Rev
+that is, the title is delimited by an empty line.
+
+The title is actually available as a macro \refcs{FooTitle}, so that you
+can write a macro, for instance
+\Ver>
+\def\ComplicatedTitle{ .. \hrule ...
+ \vrule ... \vbox \bgroup ...
+ \FooTitle ...
+ }<Rev
+and use this macro instead of the \opt{title} option
+\Ver>\DefineBar:Foo ...
+ ComplicatedTitle
+ ... Stop<Rev
+However, since the option \opt{title} now doesn't appear anymore, it
+becomes necessary to specify explicitly that there is a title.
+This can be done with the \refopt{HasTitle} option. For instance,
+you define
+\Ver>\DefineBar:Foo ...
+ HasTitle
+ ComplicatedTitle
+ ... Stop<Rev
+where \cs{ComplicatedTitle} is a macro that formats the title.
+
+\SubSection Short titles
+
+The option \opt{HasTitle} can have a parameter \n{short}, denoting that
+the title is not delimited by an empty line (or \cs{par}) but by the
+line end. For an example see section~\ref[sec:address].
+
+\Section[sec:opt:counter] Counters
+
+There are three ways for Lollipop to figure out that a generic
+construct has a counter. First of all, in
+\Ver>\DefineFoo:Bar [...]
+ BarCounter [...]<Rev
+the \cs{BarCounter} will be defined automatically.
+
+Additionally there is the option \refopt{counter}, which can be used
+to declare the representation of the option, for instance
+\opt{counter:i} allocated a counter that is printed in lowercase roman
+numerals. For the available representations,
+see~\ref[sec:counter:repr].
+
+Finally, if the counter is only used in a macro, the
+option \refopt{HasCounter} will cause the counter to be created anyhow.
+This is analogous to the \opt{HasTitle} option.
+
+\SubSection Counter synonyms
+
+Every once in a while you may want different constructs to use the same
+counter. For instance, if your book has definitions, theorems, lemmas,
+corollaries and notations, it may confuse the reader if they all have
+their own counter. The numbering would seem to jump all over the place.
+
+A `counter synonym' can be declared in \Lollipop\ by a slight abuse of
+the \opt{counter} option.
+\Example
+\DefineTextBlock:Theorem counter:1 begingroup Style:bold
+ literal:Theorem Spaces:1 TheoremCounter Spaces:2 endgroup
+ text Stop
+\DefineTextBlock:Corollary counter:Theorem begingroup Style:italic
+ literal:Corollary Spaces:1 CorollaryCounter Spaces:2 endgroup
+ text Stop
+\DefineTextBlock:Definition counter:Theorem begingroup Style:roman
+ literal:Definition Spaces:1 DefinitionCounter Spaces:2 endgroup
+ text Stop
+\Definition We define a {\it Foo} to be an arbitrary object\>
+\Theorem Foos have arbitrary properties\>
+\Corollary Foos are extremely valuable\>
+\Corollary Foos are extremely worthless\>
+\Theorem Foos don't exist\>
+\ExampleStop
+
+You can only declare a counter to be synonym for something that has
+already been created. In the above example you cannot define the
+\cs{Theorem} after the \cs{Corollary}.
+
+\ImpNote
+At the start of defining the construct, \cs{BarCounter} is defined to
+be an option:
+\Ver>\add@generic@default{\has@counterno
+ \def\counter@repr{1}
+ \csarg\def{\gen@option@name{\@name Counter}}{%
+ \@add@toks{\@name Counter}\global\has@counteryes}}<Rev
+
+Then,
+\Ver>\add@generic@stop@default{\ifhas@counter
+ \xp\expandafter\xp\install@counter
+ \xp\counter@repr\@space\fi}<Rev
+
+
+The counter is stepped, and the new value is stored in a mark item,
+in \cs{outer@start@commands}:
+
+\Ver>
+ \ifhas@counter
+ \nxp\StepCounter:\expandafter\@name\@space
+ % This sets the \current@label by default
+ \ifhas@marks \edef\nxp\cs@e
+ {\nxp\nxp\nxp\refresh@mark@item
+ {\@name Counter}{\CSname{\@name Counter}}}%
+ \nxp\cs@e
+ \fi
+ \fi<Rev
+\ImpNoteStop
+
+\Section Chunks of text
+
+Especially in headings, short chunks of text may need a special
+treatment. For instance, the number may have to be filled to a certain
+width, or a line may have to be drawn of the exact length of the
+title. Lollipop have various general options (so they can also be used
+in other contexts than headings) for handling pieces of text.
+
+\SubSection[sec:opt:block] The \opt{block} option\label[opt:block]
+
+The \refopt{block} option takes up a piece of text and fits it on one
+line. It can measure the text, or set the size. Also there are a number
+of ways of placing a block.
+
+Basic usage:
+\Ver> block:start [...] block:stop<Rev
+This takes the enclosed text, and reproduces it. This is mostly
+interesting in combination with \opt{textcolumn},
+see~\ref[sec:opt:textcolumn].
+\Ver> block:hang [...] block:stop<Rev
+The resulting block is dropped until its top touches the baseline.
+For uniformity of appearance, the resulting width of the block can be
+specified:
+\Ver> block:start [...] fillupto:20pt<Rev
+The name of a \cs{Distance} parameter can be used here.
+
+\Example
+\DefineHeading:TestHeading
+ line:start block:hang PointSize:8 SetFont
+ TestHeadingCounter fillupto:20pt
+ block:hang PointSize:14 SetFont title block:stop
+ line:stop Stop
+\TestHeading Top Aligning the Title
+
+\endExample
+
+The block is usually in between the margins of the text, but it can be
+made to stick out into the margin, by closing it with the option
+\refopt{stickout}. For the left margin this done as
+ \Ver> block:start [...] stickout:left<Rev
+and for the right margin
+ \Ver> block:start [...] stickout:right<Rev
+The size of the box can be specified, for instance as
+ \Ver> block:start [...] stickout:left=20pt<Rev
+For a left box the material in it is pushed to the left edge, for a
+right sticking box it is shifted to the right.
+
+\SubSection[sec:blockwidth] Block Measuring
+
+All blocks are immediately measured when they are placed. This makes it
+possible for instance to underline a title exactly. After a block has
+been placed, its width is available as \refcs{BlockWidth}.
+ \Example
+\def\rulespecs{height 1pt width \BlockWidth\relax}
+\DefineHeading:TestHeading Style:bold
+ line:start block:start TestHeadingCounter . Spaces:2 stickout:left
+ block:start title block:stop line:stop
+ vwhite:2pt hrule rulespecs vwhite:10pt Stop
+\TestHeading The Title Is Underlined
+
+The text follows.
+\ExampleStop
+Observe how a control sequence \cs{rulespecs} is used to sneak the
+height and width of the rule into the definition. This is necessary
+because control sequences are not allowed in a construct definition.
+
+\SubSection[sec:opt:line] The \opt{line} option
+
+The option \refopt{line} is used to create a single strip of text that
+fits exactly in between the margins of the page. Most of the time, titles
+will be in a line.
+
+\Example
+\DefineHeading:TestHeading
+ line:start block:start TestHeadingCounter Spaces:1.5 stickout:left
+ title line:stop Stop
+\TestHeading A Title
+
+\endExample
+
+Another example was above. Here is another use of a line:
+
+\Example
+\DefineHeading:TestHeading
+ line:start TestHeadingCounter fillup title line:stop Stop
+\TestHeading The title
+
+\endExample
+
+\SubSection[sec:opt:textcolumn] The \opt{textcolumn} option
+
+In the examples above all titles fit on one line comfortably. If this
+is not the case, the title can be put in a \refopt{textcolumn} which can
+span several lines.
+
+\Example
+\DefineHeading:TestHeading
+ line:start block:start TestHeadingCounter Spaces:2 block:stop
+ textcolumn:topline title textcolumn:stop
+ line:stop Stop
+\TestHeading A very very very very very very very very very very very
+very very very very very very very very very very very very very
+very very very very very very very very long title
+
+\endExample
+
+This option is mostly interesting in combination with others such as
+\opt{block} and \opt{line}. As is apparent from the above example: a
+block placed in the same line as a text column will detract from the
+latter's width.
+
+(In fact it is the other way around: \Lollipop\ sets
+the line with a text column of width zero to determine the remaining
+space. Then the line is set again. This may give problems if you
+manipulate parameters inside the line, because the line is in effect
+typeset twice. Also make sure not to have other \cs{vbox}-es in the
+line than the text column.)
+
+\SubSection[sec:opt:traps] Traps
+
+It is a bad idea to have material in headings and such that is not
+inside a block, textcolumn, or line. For instance:
+
+\Example
+\DefineHeading:TestHeading
+ block:start TestHeadingCounter Spaces:2 block:stop
+ title Stop
+\TestHeading Where does the title go?
+
+\endExample
+
+\Section[sec:opt:label] Labels
+
+References to any counter will always be correct, no matter if that
+counter has changed after retypesetting the document, if symbolic
+references are used. Referencing is explained in detail in
+chapter~\ref[chap:referencing].
+
+The way a symbolic reference is formatted can be altered from the
+default (just give the counter) by using the \refopt{label} option.
+\Ver>\DefineHeading:TestSection
+ line:start Style:italic TestSectionCounter Spaces:2 title line:stop
+ label:start ( TestSectionCounter ) label:stop Stop<Rev
+See further section~\ref[sec:shape:reference].
+
+
+\Section[sec:opt:penalties] Break before / after
+
+The options \refopt{breakbefore} and \refopt{breakafter} control how
+eager \TeX\ will be to break the page before or after a construct. These
+options take one value, a so-called `penalty' value, meaning that the
+higher the value you specify, the higher the penalty is, and
+therefore the less likely it is that the page will be broken there.
+
+Numerical values are typically in the tens or hundreds; any value
+of \n{10$\,$000} or more means that there will never be a break at
+that point; a value of \n{-10$\,$000} or less means a guaranteed
+break. If you don't want to remember these rules, values of \n{yes}
+and \n{no} mean a guaranteed break, and no break respectively.
+
+\WizNote
+A further exceptional value is \n{breakbefore/after:0}, this will
+cause no penalty to be placed. The reason for this is highly \TeX
+nical.
+\>
+
+\Section[sec:opt:indent] Indentation
+
+The option \refopt{indentafter} controls the behaviour of the first
+paragraph after a generic construct., \refopt{indentinside},
+\refopt{indentfirst}.
+
+\Section Rules
+
+There is an option \refopt{hrule}. You should not write
+\Ver>\def\rulemacro{\hrule height [...] }
+\DefineHeading [...] rulemacro [...] Stop<Rev
+because then \Lollipop\ cannot prevent page breaks around the rule.
+Instead write
+\Ver>\def\rulespecs{ height [...] }
+\DefineHeading [...] hrule rulespecs [...] Stop<Rev
+so that the option \opt{hrule} is used. See
+section~\ref[sec:blockwidth] for an example.
+
+\Section Embedded constructs
+
+Most generic constructs will be vertically separated from the
+surrounding text. However, in rare cases (and for unusual applications)
+it be desired to have a construct that is part of a paragraph. For this
+the option \refopt{embedded} exists.
+
+This option has the following values.
+\Ver> embedded:no<Rev
+This is the default.
+\Ver> embedded:left<Rev
+The construct continues an already started paragraph, but after the
+construct a vertical break follows.
+\Ver> embedded:right<Rev
+After the construct a paragraph can continue, but the construct is
+separated vertically from preceding text.
+\Ver> embedded:yes<Rev
+The construct is both left and right embedded.
+
+Embedding a construct has an interesting application to generating
+indexes. (See chapter~\ref[chap:external-files] for general information
+about external files.) This can be done by having embedded headings
+that write their title to the index file.
+
+\Example
+\DefineExternalFile:tIndex=tix
+\DefineHeading:NewWord embedded:yes
+ block:start Style:bold title block:stop
+ external:tIndex title external:stop Stop
+\def\introword#1{\NewWord #1\par}
+In this sentence two \introword{flubrious} words are
+\introword{stinselsed}.
+\ExampleStop
+
+Cute, ain't it?
+
+A word of warning though. Headings and such generate \TeX\ `marks'
+which take up main memory. You only need these if you are going
+to be referring to that object with \cs{LastPlaced} or such; see
+section~\ref[sec:head/foot]. Embedded headings used as above
+usually don't need these marks, so you can prevent \TeX\ overflow by
+putting the option \opt{nomarks} in their definition.
+
+\Section Obscure options
+
+\SubSection Arguments
+
+In case you want to interface to other macro packages, you may want to
+let a construct generate a call to the other package. For this, the
+\Lollipop\ macro should be able to produce sequences such as
+\ver>\begin{itemize}>. The problem here is the braces. The option
+\refcs{arg} produces a braced expression.
+
+For instance
+\Ver>\DefineTextBlock:LaTeXlist begin arg:{itemize} text
+ end arg:{itemize} Stop<Rev
+makes it possible to use call \LaTeX\ macros from \Lollipop.
+
+\SubSection[sec:implicit:close] Implicit closing
+
+The control sequence \refcs{>} closes the current group, and \refcs{>]}
+closes all currently open groups. Every once in a while this is too
+drastic. Hence there is an option \refopt{noimplicitclose} that can be
+used to prevent a construct from being closed implicitly. Using \cs{>]}
+inside such a construct will close all enclosed constructs.
+
+See the definition of \cs{EExample} in this manual for an example.
+
+\Section[sec:opt:test] Testing
+
+There is an option \opt{test}.
+
+\endinput
+
+% 92/11/10 \BlockWidth discussed in 'block' section
+% 92/11/15 counter:othercounter discussed
+% 92/11/21 option 'arg'
+
diff --git a/macros/lollipop/doc/manual/out.tex b/macros/lollipop/doc/manual/out.tex
new file mode 100644
index 0000000000..23dab4395d
--- /dev/null
+++ b/macros/lollipop/doc/manual/out.tex
@@ -0,0 +1,349 @@
+% out.tex copyright 1992/3 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\Chapter[chap:output] Output
+
+Every page is formatted according to a `page grid' consisting of
+three elements:
+
+\Enumerate \item the page head, this is everything that's over the
+running text;
+\item the page foot, this is everything that is below the running
+text;
+\item the running text. \TeX\ acts as if text is on a long scroll,
+and the running text part of a page is simply a portion cut off from
+this scroll.\>
+Either or both of the head and foot of the page can be empty, but
+usually one of the two contains a page number.
+
+\OutExample
+\OptionsMacro:ManPageSize=raggedbottom:10pt topskip:12pt
+ height:page=5cm width:page=6cm Stop
+\DefinePageGrid:TestPage macro:ManPageSize
+ pagerule textband:start text textband:stop
+ pagerule band:start PageCounter band:stop Stop
+\TestPage
+This page does not contain much special.\EjectPage
+This page is hardly better.
+\OutExampleStop
+
+This example illustrates how you first define a page grid by
+\refcs{DefinePageGrid}, and then activate it by calling its name. That
+last action is in fact not necessary: each definition of a page grid
+automatically installs that grid as the current one.
+
+\Section Page dimensions
+
+Most of the time it is easiest to specify the total height of a page,
+that is, including head and bottom, but sometimes it is more
+convenient to specify the height of the text, and let the head and
+foot simply go over and under that.
+
+In the first case you can give the command \refcs{Height} with
+two parameters:
+\Ver>\Height:Page=23.5cm<Rev or inside a page grid definition the
+option \refopt{height}\n{:page=...}.
+
+In the second case you can give the command
+\Ver>\Height:Text=19.55cm<Rev or inside a page grid definition the
+option \opt{height:text=...}.
+
+In page grid definitions there is the additional option
+\opt{height:lines=23}.
+
+The \cs{Height} command cannot be used in a page grid definition.
+
+\Section Positioning the page on the paper
+
+If your printer driver is up to specs (and you have not done any
+creative macro writing) it should have the upper left corner of the
+text landing at $2.54$cm from the top and left side of the paper.
+If the result is not to your liking, you can shift the page by
+\Ver>\Distance:hoffset= ...
+\Distance:voffset= ...<Rev
+These offset parameters are zero ordinarily, and they indicate the
+extra shift added to the customary $2.54$cm in horizontal and
+vertical direction.
+
+\Section Page head, foot, text
+
+Somewhere in the page grid the option \refopt{text} has to appear. This
+option has to be inside a \refopt{textband}:
+\Ver> textband:start text textband:stop<Rev
+This is not a case of overspecification, because inside a textband
+the text option can appear more than once. In this manner a multicolumn
+page grid can be specified.
+
+\def\sometext{Just a bit of words, words. }
+\edef\sometext{\sometext\sometext\sometext}
+\edef\sometext{\sometext\sometext\sometext\sometext}
+\OutExample
+\DefinePageGrid:TestPage macro:ManPageSize
+ pagerule textband:start text hwhite:10pt text textband:stop
+ pagerule band:start PageCounter band:stop Stop
+\FlushRight:no \sometext
+\OutExampleStop
+
+Next to the option \opt{textband} there is \refopt{band}.
+Both are ways of
+creating a page wide band. The option \opt{band} is used for all
+material that is not a text column, for instance footers, as in the
+above examples.
+
+The option \opt{band} can have one unusual parameter: \n{invisible}.
+This makes the band act as if it has zero height or width, depending
+on whether it is below or above the text, respectively.
+
+\OutExample
+\DefinePageGrid:TestPage macro:ManPageSize
+ pagerule textband:start text hwhite:10pt text textband:stop
+ pagerule
+ band:invisible block:start Style:bold PageCounter Spaces:2
+ stickout:left band:stop Stop
+\FlushRight:no \sometext
+\OutExampleStop
+
+\SubSection More about text bands
+
+The text band is that part of the page that has the text in it. You can
+also put other material in it, such as rules or white space.
+
+\OutExample
+\DefinePageGrid:TestPage macro:ManPageSize pagerule
+ textband:start vrule white:3pt text white:3pt vrule textband:stop
+ pagerule band:start white:fillup PageCounter band:stop Stop
+\TestPage This page contains some text, a bit more text,
+and even more than that. In all still just a few lines.\EjectPage
+This page contains more text, still more text, and still more.
+\OutExampleStop
+
+In the previous example the width of the page was specified.
+If we only give the width of the text, the page width is calculated
+dynamically.
+
+\OutExample
+\DefinePageGrid:TestPage macro:ManPageSize
+ textband:start vrule white:3pt text white:3pt vrule textband:stop
+ pagerule band:start white:fillup PageCounter band:stop Stop
+\noindent This page contains some text, a bit more text,
+and even more than that. In all still just a few lines.\EjectPage
+This page contains more text, still more text, and still more.
+\OutExampleStop
+
+Note how the \refopt{pagerule} and \opt{band} objects stretch
+with the page.
+
+
+\SubSection Topskip
+
+In between the page head and the text is some white space, the
+topskip, with special properties. The topskip is defined from the
+bottom of the head to the bottom of the first line of the text. If
+the height of this first line varies from page to page the topskip
+acts as a buffer, keeping the bottom-to-bottom distance constant.
+
+Topskip is set by the option \refopt{topskip}, for example
+\Ver> topskip:25pt<Rev
+but if this option is left out, the page grid uses the value of
+\cs{topskip} that was current at the time of the definition.
+Unfortunately there is no way to change this value after the definition.
+
+\Section[sec:page-counter] The page number
+
+The page number behaves as if it had been defined by
+\Ver>\NewCounter:Page
+\CounterRepresentation:Page=1<Rev
+Thus you can use any command from section~\ref[sec:counters] on it.
+For instance, you can have page numbers in roman numerals by
+specifying
+\Ver>\CounterRepresentation:Page=I<Rev
+
+The page number is typically used as the option \refopt{PageCounter},
+but for some applications the corresponding command \refcs{PageCounter}
+can be used.
+
+If you process a \Lollipop\ document you see that everytime a page is
+generated, an item such as \ver>[8,7]> is written on the log file or the
+screen. Most of the time the two numbers will be the same, as in
+\ver>[8,8]>, but they will differ if you have tinkered with the page
+number. The first number is the `sheet counter': it counts how many
+pages you have produced so far. The second number is the value of
+\cs{PageCounter} for the page that was written out. Take a look at the
+log file for this manual for an example.
+
+\Section[sec:page:tests] Page tests
+
+The page grid definition can set/query several properties of the
+page. The following tests have been provided (see
+section~\ref[sec:tests] for tests):
+\Ver>\DefineTest:IsRightPage
+\DefineTest:IsLeftPage
+\DefineTest:FirstPage
+\DefineTest:LastPage
+\DefineTest:FlushBottom<Rev
+\Itemize\item The tests for left/right pages are done by
+ testing whether the page number of odd or even.
+\item The first/last page tests can be used either for the whole
+document, or for a file that's loaded as an \cs{InputFile}.
+\item The first page test doesn't work at present.
+\>
+
+\OutExample
+\DefinePageGrid:TestPage macro:ManPageSize
+ pagerule textband:start text textband:stop pagerule
+ band:start ifIsLeftPage else hwhite:fillup fi PageCounter
+ band:stop Stop \SetCounter:Page=12
+This is a left hand page. \EjectPage
+This page is on the right side of a spread.
+\OutExampleStop
+
+\Section[sec:head/foot] Running heads / footers
+
+Above it was explained how pages can be given a head and foot part.
+Quite often you want changing information in such parts, for instance
+the head of a left page often contains the number or title of section
+that was current when that page started; the head of a right page
+often contains the number or title of the section that was current
+when that page ended.
+
+In \Lollipop\ all constructs that have a title or a counter can have
+that information referenced in page grids.
+\Description\item \refcs{FirstPlaced}:SectionTitle
+Take the title of the first section that started on this page, or
+the last one that started before this page if no section started on
+this page.\item \refcs{LastPlaced}:SubSectionCounter
+Take the title of the last subsection that started on this page, or
+the last one that started before this page if no subsection started
+on this pgae.\item \refcs{PreviousPlaced}:SectionCounter
+Take the counter value of the last section that started before this
+page.\>
+
+\OutExample
+\DefinePageGrid:TestPage macro:ManPageSize
+ pagerule textband:start text textband:stop pagerule
+ band:start Style:italic FirstPlaced:HeadTitle
+ white:fillup PageCounter band:stop Stop
+\DefineHeading:TestHeading Style:bold
+ line:start TestHeadingCounter Spaces:2 title line:stop Stop
+\TestHeading A first section\par And some text.\EjectPage
+This page contains text. \TestHeading A second Section\par
+And more text.
+\OutExampleStop
+
+The commands \cs{FirstPlaced} and \cs{PreviousPlaced} are typically
+used on left pages; \cs{LastPlaced} is more common on right pages.
+You can test on what sort of page you are; see
+section~\ref[sec:page:tests].
+
+\OutExample
+\DefinePageGrid:TestPage macro:ManPageSize
+ pagerule textband:start text textband:stop pagerule
+ band:start Style:italic
+ ifIsLeftPage FirstPlaced:HeadTitle white:fillup fi
+ PageCounter
+ ifIsRightPage white:fillup LastPlaced:HeadTitle fi
+ band:stop Stop \SetCounter:Page=10
+\DefineHeading:TestHeading Style:bold
+ line:start TestHeadingCounter Spaces:2 title line:stop Stop
+\TestHeading A first section\par And some text.
+\TestHeading Second section\par More text.\EjectPage
+\TestHeading Third section\par Is on the right page.
+\TestHeading Fourth section\par Concludes this page.
+\OutExampleStop
+
+
+\Section Alternating page grids
+
+In \Lollipop\ it is very easy to switch page grids with the option
+\refopt{NextPageGrid}: you simply specify
+ \Ver> NextPageGrid:otherpage<Rev as one of the options
+in the definition. If no next grid is indicated, the same page grid keeps
+being used continuously until another page grid is activated
+explicitly.
+
+\OutExample
+\DefinePageGrid:LTestPage macro:ManPageSize
+ pagerule textband:start text textband:stop pagerule
+ band:start Style:italic
+ PageCounter white:fillup FirstPlaced:HeadTitle
+ band:stop NextPageGrid:RTestPage Stop
+\DefinePageGrid:RTestPage macro:ManPageSize
+ pagerule textband:start text textband:stop pagerule
+ band:start Style:italic
+ LastPlaced:HeadTitle white:fillup PageCounter
+ band:stop NextPageGrid:LTestPage Stop
+\SetCounter:Page=42
+\DefineHeading:TestHeading Style:bold
+ line:start TestHeadingCounter Spaces:2 title line:stop Stop
+\LTestPage
+\TestHeading A first section\par And some text.
+\TestHeading Second section\par More text.\EjectPage
+\TestHeading Third section\par Is on the right page.
+\TestHeading Fourth section\par Concludes this page.
+\OutExampleStop
+
+Another very useful application of this mechanism is to have a
+special definition for the opening page of a chapter. This manual uses a
+one-shot page grid \cs{EmptyPage} to remove the header and footer on the
+title page. It installs \cs{LeftPage} as the next grid.
+
+\Section Additional User Control
+
+\SubSection Elementary manipulation
+
+There are a few commands for simple page manipulation:
+\Description\item \refcs{EjectPage}
+The current page is filled up with white space, and
+a new page is started.\item \refcs{ToRecto}
+As \cs{EjectPage} but if the next page is a left page (meaning
+that the page number is even) then the page number is increased by
+one, so that the next page is a right hand page.\item \refcs{ToVerso}
+As \cs{ToRecto}, except that the next page is a left page.
+\>
+
+Additionally, \refcs{NoPages} lets
+all formatting and updating of values be performed, but
+no pages are written to the dvi file;
+\refcs{PagesOut}
+reverts the effect of previous command. Note that \cs{NoPages} does not
+incur any savings in time: full processing of the document is performed.
+
+When a page is finished it rests in box \refcs{WholePage}. Then a call is
+made to \refcs{CurrentShipout}, which is by default
+\ver>\shipout\box\WholePage>. However, you are free to define it
+otherwise. If your \cs{CurrentShipout} does not actually ship out pages,
+you may want to set \refcs{CountSheetsno} to prevent the effective page
+counter from being updated.
+
+Redefining \cs{CurrentShipout} usually goes together with
+\refcs{SuspendOutput} and \refcs{ResumeOutput}. These commands
+temporarily save the page number and the current state of the page,
+including the current definition of \cs{CurrentOutput}. (This is necessary
+because a number of parameters concerned are changed by global
+assignments.) See the definition of \cs{OutputExample} in the appendix of
+this manual for an elaborate example.
+
+If you want to see te output routines in action, specify
+\Ver>\Trace:out<Rev In addition \Ver>\Trace:mark<Rev tells you what
+information is being saved for running head and foot lines.
+
+\endinput
+
+% 2014/04/12 Made `output' capitalized.
+% 92/11/20 Left right output examples
+% 93/01/17 New description of \CurrentShipout
diff --git a/macros/lollipop/doc/manual/prelim.tex b/macros/lollipop/doc/manual/prelim.tex
new file mode 100644
index 0000000000..d0af6d3e02
--- /dev/null
+++ b/macros/lollipop/doc/manual/prelim.tex
@@ -0,0 +1,327 @@
+% prelim.tex copyright 1992 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\Chapter[chap:prelim] Preliminaries
+
+\Section What is Lollipop?
+
+Lollipop is `\TeX\ made easy'. Lollipop is a macro package
+that functions as a toolbox for writing \TeX\ macros. It was my
+intention to make macro writing so easy that implementing a fully new
+layout in \TeX\ would become a matter of less than an hour for an
+average document, and that it would be a task that could be
+accomplished by someone with only a very basic training in \TeX\
+programming.
+
+Lollipop is an attempt to make structured text formatting available
+for environments where previously only wysiwyg packages could be used
+because adapting the layout is so much more easy with them than with
+traditional \TeX\ macro packages.
+
+\Section But is it compatible?
+
+Lollipop, like \LaTeX, is not compatible with plain \TeX. I~don't
+consider this a real problem. Most plain \TeX\ commands will work in
+\Lollipop\ with the exception of anything output routine related.
+(See also below.)
+
+\Lollipop\ is also not compatible with \LaTeX, although it has a lot
+of the same functionality. There are two reasons why \Lollipop\ still
+has a reason for existing, even though \LaTeX\ is used pretty much
+all over the scientific world.
+
+For one, Lollipop is targeted in part
+to different users than the typical plain \TeX\ or
+\LaTeX\ user. For another, I~have a vain hope that I~can capture some
+of the \LaTeX\ market share. Since developing styles in \Lollipop\ is
+so much more easier than in \LaTeX, I~may stand a fighting chance.
+
+\SubSection \Lollipop\ and plain \TeX
+
+Having said the above, I'll conceded that \Lollipop\ is more
+compatible with plain \TeX\ than with \LaTeX. You can use quite some
+plain \TeX\ commands in \Lollipop. However, stay away from the
+following:\Description\item \cs{everypar}
+This one is heavily used by \Lollipop. You may use \cs{EveryParagraph}
+instead, which functions pretty much like \cs{everypar}; see
+section~\ref[sec:everypar].\item \cs{everymath}
+This one is heavily used by \Lollipop. You may use \cs{EveryMath}
+instead, which functions pretty much like \cs{everymath}; see
+section~\ref[sec:everymath].\item \cs{everydisplay}
+This one is heavily used by \Lollipop. You may use \cs{EveryDisplay}
+instead, which functions pretty much like \cs{everydisplay}; see
+section~\ref[sec:everydisplay].\item \cs{output}
+Page output is done so very differently from plain \TeX\ that all
+commands pertaining to page numbers and head/footlines have been
+eradicated. (Well, \cs{pageno} still gives the page number.) See
+chapter~\ref[chap:output].
+ \>
+
+The current version of \Lollipop\ is based on the plain \TeX\ file
+that comes with \TeX\ version~3.141592653.
+
+\SubSection \Lollipop\ and \TeX\ programming
+
+The tools in \Lollipop\ allow you to program in a simple manner quite
+complicated macros. Still you may want to have some knowledge of
+ordinary \TeX\ macro programming. If you are just starting in \TeX\
+you can pick up the basics from the book by Seroul and
+Levy~\bibref[SeLe:book],
+and after that there is the book by
+the original author of \TeX~\bibref[Kn:book] and my own \TeX\
+reference guide~\bibref[E:book].
+
+ \Section How to Use \Lollipop
+
+The following files comprise the Lollipop format:
+\Ver>
+ lollipop-define.tex lollipop-document.tex
+ lollipop-float.tex lollipop-fontdefs.tex
+ lollipop-fonts.tex lollipop-heading.tex
+ lollipop-lists.tex lollipop-output.tex
+ lollipop-plain.tex lollipop-text.tex
+ lollipop-tools.tex lollipop.tex<Rev
+
+
+To process a file, say \file{test.tex}, with
+Lollipop you then type:
+
+\Ver>
+> lollipop test.tex <Rev
+
+to get the dvi output.
+
+
+\Section[sec:style-dump] Processing a Lollipop file
+
+Files that you make to be processed with Lollipop contain of course
+the input text, but they also have to contain the design macros that
+determine the layout. There are two possibilities for these design
+macros:
+
+\Itemize
+\item You can simply put them in the same file, either in the
+beginning or wherever they are first needed, or
+\item You can put the layout definition in a separate file and call this
+definition file in your main file. For instance, you can put the layout definition of a
+book in a file \file{bookstyle.tex}, and then call this definition file in your
+main Lollipop file by putting
+
+\Ver>
+\InputLollipop:bookstyle.tex <Rev
+
+somewhere in your main Lollipop file.
+
+
+
+If you have used \TeX\ before, you will notice that the page numbers
+get reported slightly differently from the usual way. See
+section~\ref[sec:page-counter] for the explanation.
+
+\Section The errors of \Lollipop / known bugs
+
+Since \Lollipop\ is an order of magnitude more powerful
+(and hence complicated) than formats such as \LaTeX, its error
+messages can also be an order of magnitude more cryptic (see
+section~\ref[sec:error-msg] for the possible origin of some of the
+more obscure error messages).
+
+Fortunately, \Lollipop\ is also quite a
+bit better than existing formats at catching potential errors. Typos
+in a style definition will usually lead to warning messages, and also
+during run time \Lollipop\ is able to track down ommisions.
+
+In addition, you can switch on various trace modes to get more
+detailed information about \Lollipop's thought processes. See
+chapter~\ref[chap:tracing].
+
+These are the known bugs in \Lollipop\ at the moment.
+
+\Enumerate\item Local references have been insufficiently tested,
+and the code definitely is buggy.
+\item The `firstpage' test in the page grids does not work.
+\item The table of contents example is slightly wrong.
+\item Titles get written to the aux file with double spaces.
+This shouldn't cause any problem, but it has to be fixed.
+\item Rules in page grids get white space around them.
+\item External items shouldn't declare \cs{FooTitle} or
+\cs{FooCounter}.
+\item \cs{ToExternalFile} doesn't work.
+\>
+
+
+If you find any other issues, or if you have any fixes/workarounds
+for any existing issues, then please post them on GitHub.
+
+\Section About this manual
+
+This manual consists of a main file \file{lollipop-manual.tex}, and the
+following input files:
+\Ver>
+titlepag.tex prelim.tex struct.tex head.tex list.tex
+out.tex extern.tex opt.tex comm.tex trace.tex appendix.tex<Rev
+and the style definition file \file{mandefs.tex}.
+
+In addition, you need \file{comment.tex} which is used to format this
+manual, and \file{btxmac.tex} for the Bib\TeX\ interface, but these
+are not really a part of \Lollipop.
+
+If you format this manual (which you'll have to do three times
+to get the page numbering and the table of contents straight) you'll
+notice something strange. The file \file{example.tex} is read in
+many, many times. This is because this manual formats its examples
+along the way, first writing them out, and then reading them in to
+show both their code and their output. This way it is guaranteed that
+the examples in the manual will always work.
+
+As a result of formatting this manual you will wind up with, apart
+from the usual \file{pdf} and \file{log} file, with \file{lollipop-manual} files
+with extensions \file{aux}, \file{toc}, and \file{imp};
+\file{oix} and \file{cix} for indexes of options and commands,
+and
+\file{tct}, file{tix} which are for the examples. For the
+bibliography there are the Bib\TeX\ input file \file{lollipop-manual.bib} and
+output file \file{lollipop-manual.bbl}.
+
+This manual needs quite some resources: here's what \TeX\ told me
+it needed.
+\Ver>Here is how much of TeX's memory you used:
+ 1194 strings out of 496579
+ 16173 string characters out of 6202690
+ 72655 words of memory out of 5000000
+ 3270 multiletter control sequences out of 15000+600000
+ 11241 words of font info for 40 fonts, out of 8000000 for 9000
+ 19 hyphenation exceptions out of 8191
+ 24i,4n,24p,187b,562s stack positions out of 5000i,500n,10000p,200000b,80000s<Rev
+
+
+Because of all the examples this manual takes quite some time to
+process. A~factor of four over the time for a regular document of
+similar length should be expected. Ordinary Lollipop documents will
+proceed far faster.
+
+\Section The most boring section in this manual
+
+There are a few things about \Lollipop\ that I~want to be clear about.
+
+\SubSection I am going to hurt you and I am not sorry
+
+In the secret handbook for the software industry it says that the
+final test phase of a product consists of putting it in stores and
+having innocent suckers pay good money for it. (You guessed it, this
+is the disclaimer section.) So let me just say that
+\Lollipop\ is probably good for nothing, at least, I~don't claim it
+is. And if you hurt yourself by using it, don't blame me. I~warned
+you.
+
+\SubSection Get a \Lollipop, give one away
+
+\Lollipop\ is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+The easiest way to get the current copy of \Lollipop\ is to use
+a more recent \TeX{} distribution (\TeX Live or Mik\TeX).
+
+\SubSection The status of \Lollipop
+
+\Lollipop\ is still under development. Although I~will try not to
+make any drastic changes in the user interface (this says nothing
+about the internals!) I~really cannot guarantee anything.
+However, I~do listen to complaints and suggestions.
+
+If you have suggestions or complaints about the
+useability of \Lollipop\ or the implementation, feel free to contact
+me at \n{persian-tex@tug.org} on the Internet.
+
+\SubSection[sec:wish:list] The wish list
+
+\Lollipop\ is not quite perfect. Here's a list of things that I~am
+going to be adding in the near future. If you want to add items to
+this list, just open a ticket on the tickets.
+
+\Enumerate\item Raggedbottom should really, really be added. Soon!
+
+\item Capitalization and initial capping of titles. If a
+title appears in mixed case, it should be possible to have it in all
+uppercase in running heads. Some code has been disabled now.
+
+\item A better multi-column mode.
+
+\item Interface to Bib\TeX\ seems to largely in place; what happens
+if you don't load btxmac?
+
+\item Inserts, in particular footnotes. At the moment floating
+figures are entirely lacking. (As a matter of fact, the plain \TeX\
+macros are availble, but I'm not telling that.)
+
+\item A `nomarks' option to prevent wasting two token lists.
+Maybe other recourse saving optio for the expert designer?
+
+\item More sophisticated white space right before and after
+page breaks. (Use at least so and so much.)
+
+\item Dynamic topskip.
+
+\item Sup­port for RTL lan­guages (such as Per­sian).
+
+
+{\PopIndentLevel\Indent:no The following points are debatable:
+maybe I~should just steal a few components from \LaTeX. Maybe this
+sort of stuff does not belong in \Lollipop.\par}
+
+\item A tabular mode. Personally I~always felt \cs{halign} to be more
+than sufficient, but some people seem to think otherwise.
+
+\item Maths constructs. Some things in the \cs{eqalign} vein would be
+nice.
+
+\>
+
+\SubSection A bit of history
+
+The \Lollipop\ format was begun in late 1989 to typeset Victor Eijkhout's Ph.D.
+thesis, `{\Style:italic Vectorizable and Parallelizable
+Preconditioners for the Conjugate Gradient Method}'. At that time
+Victor~was using \TeX\ on an Atari 1040ST.
+Loading the style definition for the thesis took about two minutes.
+\Lollipop\ was heavily augmented in late 1991 to typeset his book
+`{\Style:italic \TeX\ by Topic}', for which he~used Sun~3 and Sun~4
+computers. Writing this manual brought \Lollipop\ to its version 0.96; the first public release (version~0.9) was announced on the
+internet in October 1992.
+
+Between 1992 and 2014, Lollipop was unmaintained and Vafa Khalighi took over the
+development of Lollipop in April 2014.
+
+The name `\n{Lollipop}' refers to a quote by Alan
+Perlis~\bibref[Pe:epigrams], quoted on page 365 of the \TeX
+book~\bibref[Kn:book]. In a way it's rather pretentious. The philosophy
+of the \n{Lollipop} format is described~\bibref[EL:Cork,E:Portland].
+
+\endinput
+
+% 2014/04/13 Added some notes about \EveryMath,
+% and \EveryDisplay. Also \EveryPar changed to
+% \EveryParagraph
+% 2014/04/12 Added note about xelollipop format
+% 2014/04/11 Updated the manual
+% 92/10/22 historical remark about name added
+% 92/11/03 section 'Lollipop and plain TeX' added;
+% remarks about IniTeX in Textures
+% 92/11/26 uses bibrefs
diff --git a/macros/lollipop/doc/manual/struct.tex b/macros/lollipop/doc/manual/struct.tex
new file mode 100644
index 0000000000..7590b5a365
--- /dev/null
+++ b/macros/lollipop/doc/manual/struct.tex
@@ -0,0 +1,264 @@
+% struct.tex copyright 1992 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\Chapter The structure of Lollipop
+
+Lollipop provides tools for realizing the style or layout of a
+document. Some of these tools are macros ready to be used by the end
+user; they concern for instance selection of fonts.
+Others, the `generic constructs', are for the style designer so that
+she can use them to program the macros for the user.
+
+\Section[sec:doc-start-stop] Lollipop Files
+
+Any Lollipop document has to have a \cs{Start} and \cs{Stop} command.
+Before the \cs{Start} there can be style definition commands, but no
+text. For a number of reasons it is advisable to put as much of the
+style definition before the \cs{Start} command as possible. You can
+do that easily by loading the style as an input file, or by first
+dumping it as a format (see section~\ref[sec:style-dump]).
+
+\ImpNote
+Before the \cs{Start} command, \cs{everypar} contains an error
+message. The start command installs the default value for
+\cs{everypar}.
+\ImpNoteStop
+
+Both the start and the stop file load the \file{.aux} auxiliary file.
+None of this should concern you, really. Expert users who want to
+have certain actions performed at the start of the document may want
+to use \refcs{StartCommand} to specify what they wish done. See
+section~\ref[sec:adapt-distance] for an example.
+
+\Section Generic Constructs
+
+\label[generic:construct]\label[option:macro]
+There are five `generic constructs': headings, lists, text blocks, page
+grids, and external items. For each construct type there is a defining
+command, for instance \cs{DefineHeading}
+which is followed a list of `options', terminated by the word `Stop'.
+
+Options (possibly with values) have to be separated by a
+space or a line end; the keyword \opt{Stop} has to be followed by a
+space or a line end.
+Options may have zero, one or two values; if there are values, then
+the first one is separated from the option by a colon, the second is
+separated from the first by an equals sign.
+
+\Ver>\DefineFoo:Bar optiona optionb optionc:value
+ optiond:valuea=valueb optione
+ optionf Stop<Rev
+
+ As a result of this definition, a command
+\cs{Bar} is created. If the \con{Foo} construct was a \con{List} or
+\con{TextBlock}, an additional command \cs{BarStop} is created.
+
+This command can then be used in the ordinary way, for instance
+after \ver>\DefineHeading:Foo> you can type
+\Ver>\Foo The title<Rev and after \ver>\DefineList:Foo> you can type
+\Ver>\Foo
+\item One item
+\item And another
+\FooStop<Rev
+
+\ImpNote
+Actually, this `Stop' business can be customized for other languages.
+The file \file{tools} has the following lines:
+\Ver>
+\def\stop@command@suffix{Stop}
+\def\stop@command{\@command\stop@command@suffix}<Rev
+\ImpNoteStop
+
+\Section Options
+
+Options are mostly used to specify how a construct will look. Some
+options, for instance \opt{title}, indicate material that will appear
+on the page. Other options are interpreted as commands, for instance
+\opt{IndentAfter:yes} in the definition of a heading indicates that
+the first paragrah after such a heading will indent.
+
+In addition to keywords that only exist as options, commands can
+be used as options. Also, single characters are accepted as options.
+For instance a definition of a subsection heading can contain:
+
+\Ver>\DefineHeading:SubSection
+ [...]
+ SectionCounter . SubSectionCounter
+ [...] Stop<Rev
+(Here and later the \n{[...]} will denote arbitrary omitted text.)
+This definition contains the commands \cs{SectionCounter} and
+\cs{SubSectionCounter} and the \n{.} character.
+
+If a number of options appears together in a number of constructs it
+is convenient to have an abbreviation for them. This can be done with the command
+\refcs{OptionsMacro} as follows. The options that appear together are
+given a common name
+ \Ver>\OptionsMacro:baz=optiona optionb:value optionc
+ Stop<Rev
+(be sure to leave
+no spaces around the equals sign) and this name is then used as
+ \Ver> macro:baz<Rev
+in the option list wherever the options are needed.
+
+This is for
+instance a good way of specifying identical white space around all
+sorts of constructs without duplicating the typing each time.
+However, it is only for your convenience: it doesn't save any \TeX\
+resources or processing time.
+
+\Section[sec:error-msg] Popular error messages. Not!
+
+Lollipop is a macro package on top of an existing program, \TeX.
+Therefore it is inevitable that you will get \TeX\ error messages
+every once in a while. Some of these may confuse you.
+
+Here are a few of the errors that I~keep making.
+
+\SubSection Missing \cs{endcsname} inserted
+
+If you forget the second parameter in a \cs{Distance} or
+\cs{SetCounter} command, writing for instance
+ \Ver>\Distance:TheWidth<Rev
+instead of \Ver>\Distance:TheWidth=15pt<Rev
+ \TeX\ will scan
+forward, and it can easily bump into something that is highly
+unexpected given the context. If this is a \cs{def} or \cs{Define...}
+command, a `missing \cs{endcsname}' results. If a blank line follows
+the incomplete declaration, the following section applies.
+
+\SubSection Paragraph ended before something was complete
+
+\TeX\ has found a blank line (or a~\cs{par} command) where this was
+not expected. See for instance the previous section.
+
+\SubSection Missing number
+
+You have used something that you thought was the name of a control
+sequence, but it wasn't. Example:
+\Ver>\Distance:parskip=parundent<Rev
+Since \cs{parundent} is undefined, \Lollipop\ thought you were
+writing something like
+ \Ver>\Distance:parskip=5pt<Rev
+
+And yes, the message refers to `number' even though what is missing
+is a distance.
+
+\ImpNote
+\iSection Defining Generic Constructs
+
+The \cs{Define...} commands are not defined explicitly, instead they
+are generated by a call such as
+\Ver> \@GenericConstruct{Heading}<Rev
+Full definition:
+\Ver>\def\@GenericConstruct#1{<Rev
+to be used as \ver>\@GenericConstruct{Foo}>;
+\Ver> \append@to@list{@gencons}{\\#1;}<Rev
+book keeping of existing generic constructs;
+\Ver> \csarg\newtoks{#1@defaults}
+ \csn #1@defaults\ecs{}<Rev
+default commands to be executed whenever
+an instance of this construct
+is defined;
+\Ver> \csarg\def{add@#1@default}##1%
+ {\append@to@list{#1@defaults}{##1}}<Rev
+the command \cs{add@Foo@default}
+to add defaults for this construct;
+\Ver> \Install@Noops{#1}<Rev
+possibility to generate error msgs for the use of an option that is
+not allowed for this type of construct;
+\Ver> \csarg\def{Define#1}:##1 {<Rev
+instances of this construct will be defined
+by a statement like \ver>\DefineFoo:Bar>;
+\Ver> \def\@name{##1}\def\@class{#1}
+ \Tmessage[def]{Defining a #1: ##1}<Rev
+\ver>DefineFoo:Bar> leads to \cs{@name} begin \n{Bar},
+\cs{@class} being \n{Foo};
+\Ver> \the\generic@defaults
+ \csarg\the{#1@defaults}<Rev
+unpack token lists of generic and specific default actions;
+\Ver> \Get@Items}<Rev
+start recursive processing of list of options. This ends the
+definition of \cs{DefineFoo}; the definition of
+\cs{@GenericConstruct} ends with
+\Ver> \csarg\def{@#1Option}##1%
+ {\csarg\def{#1@##1}####1####2}<Rev
+which defines the \cs{@FooOption} macro; see~\ref[imp:option].
+\Ver> }<Rev
+
+\iSection Items Processing
+
+Processing the list of items is recursive; at the end some concluding
+actions have to be taken, mostly the actual definition of the
+construct.
+
+First we have to filter out empty arguments, which can be caused by
+the use of option macros (\ref[option:macro], \ref[imp:option:macro]).
+
+\Ver>\def\Get@Items#1 {\if\EmptyList{#1}\let\get@next@item\Get@Items
+ \else\def\get@next@item{\@Get@Items#1 }\fi
+ \get@next@item}<Rev
+
+Next, check if the argument is \opt{Stop} (defined by
+\ver>\NewDummy{Stop}>, \ref[imp:new:dummy]), in which case you
+have reached the end of a generic definition, and can start performing
+the final rites. Otherwise, dissect this option item
+and go on with the rest
+of the options.
+\Ver>
+\def\@Get@Items#1 {\let\get@next@item=\Get@Items
+ \csarg\ifx{#1}\Stop
+ \the\generic@stop@defaults
+ \let\get@next@item=\relax
+ \else \Item@or@Macro#1::. \fi \get@next@item}<Rev
+
+The \n{::.} concluding \cs{Item@or@Macro} accomodates one,
+possibly empty, argument.
+
+\iSection Options\label[imp:option]\label[imp:option:macro]
+
+Options can either be specific, defined as
+\Ver>\@FooOption{Bar}{ [...] }<Rev
+in which case the option \opt{Bar} can only be used inside
+a call to \cs{DefineFoo},
+or they can be generic, defined as
+\Ver>\@GenericOption{Bar}{ [...] }<Rev
+For both definitions, the definition text can use up to two parameters.
+Parameters are given to the options as
+\Ver> optiona:par1 optionb:par1=par2<Rev
+
+Specific options are defined by the line
+\Ver>
+ \csarg\def{@#1Option}##1%
+ {\csarg\def{#1@##1}####1####2}<Rev
+in \cs{@DefineGenericConstruct}; a call
+\Ver>\@FooOption{Bar}{ ... }<Rev
+expands to
+\Ver>\def\Foo@Bar#1#2{ ... }<Rev
+Generic options are defined by the
+following command:
+\Ver>\def\@GenericOption#1{
+ \append@to@list{@GenericOptions}{\\#1;}
+ \csarg\def{Option@#1}##1##2}<Rev
+A call
+\Ver>\@GenericOption{Bar}{ ... }<Rev
+expands to
+\Ver>\def\Option@Bar#1#2{ ... }<Rev
+
+\ImpNoteStop
+
+\endinput
diff --git a/macros/lollipop/doc/manual/titlepag.tex b/macros/lollipop/doc/manual/titlepag.tex
new file mode 100644
index 0000000000..c03ee4cd9e
--- /dev/null
+++ b/macros/lollipop/doc/manual/titlepag.tex
@@ -0,0 +1,85 @@
+% titlepag.tex copyright 1992 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\EmptyPage
+\begingroup\AlwaysIndent:no
+\PointSize:25 \Style:bold Lollipop Unwrapped
+
+{\tt https://github.com/persian-tex/lollipop}
+
+\white:30pt
+
+\PointSize:20 \SetFont Victor Eijkhout {\rm(Original author)}
+
+\white:10pt
+
+Vafa Khalighi {\rm(Current developer)}
+
+\white:50pt
+
+\PointSize:15 \Style:roman
+A manual for the Lollipop \TeX\ format\par
+Version 1.07\par
+Last updated 21 May 2016\par
+Pages: \LastInPageCounter+\LastRegPageCounter
+% so far we could have done this with labels, however
+\AddToCounter:LastRegPage=LastInPageValue
+=\LastRegPageCounter.
+
+\EjectPage
+\endgroup
+
+\Chapter Contents
+
+\Section Regular sections
+
+\LoadExternalFile:contents
+
+%\Section Implementer's notes
+
+%\LoadExternalFile:impnotes
+
+\Section All of the options
+
+(You know, this section and the next look much better if you sort the
+\file{manual.oix} and \file{manual.cix} files before you format the
+document the last time. Do put lines
+ \Ver>\Writeopindex:no
+\Writecsindex:no<Rev somewhere in
+the top of the \file{manual.tex} file in order to prevent
+overwriting of these files
+after you've sorted them.)
+
+\Indent:no \rightskip=0pt plus 5cm
+\LoadExternalFile:optindex
+
+\Section All of the commands
+
+\Indent:no
+\LoadExternalFile:csindex
+
+\Section Bibliography
+
+\bibliographystyle{plain}
+\bibliography{lollipop-manual}
+
+\endinput
+
+% 2016/04/09 Updated the manual
+% 92/11/19 Page total included
+% 92/11/26 Bibliography
diff --git a/macros/lollipop/doc/manual/trace.tex b/macros/lollipop/doc/manual/trace.tex
new file mode 100644
index 0000000000..febf97fa76
--- /dev/null
+++ b/macros/lollipop/doc/manual/trace.tex
@@ -0,0 +1,61 @@
+% trace.tex copyright 1992 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\Chapter[chap:tracing] Tracing
+
+\Section Do you really want to see this?
+
+You can get glimpses of Lollipop's internal workings by enabling some
+of the internal traces. The extreme positions
+\Ver> \Trace:yes<Rev
+and
+\Ver> \Trace:no<Rev
+cause all trace information and no trace at all respectively to be
+generated. You may find this trace interesting, or it may dumbfound you.
+Of course, if your name is Victor you find it pretty useful.
+
+The following traces are available:
+\Ver> \NewTrace:def % definition of user constructs
+ \NewTrace:ref % cross references
+ \NewTrace:ext % external files
+ \NewTrace:doc % document structure
+ \NewTrace:font % font loading
+ \NewTrace:out % output routine
+ \NewTrace:indent % indentation control
+ \NewTrace:gen % general tools<Rev
+
+\ImpNote
+Trace messages are generated by calls to
+\Ver> \Tmessage[type]{text}<Rev
+Setting
+\Ver> \Trace:no<Rev
+defines \cs{Tmessage} to discard its arguments. This is the most
+efficient way of generating no trace information.
+
+Tracing is controlled by a global parameter \cs{trace@all}.
+A value of~$-1$
+disables all tracing; $+1$~corresponds to all tracing on; $0$~gives
+selective tracing. In the third case a call
+\Ver> \Trace:xyz<Rev
+set \ver>\trace:xyz> positive so that only
+\ver>\Tmessage[xyz]{...}> calls will
+produce output. Enabling a selective trace sets \cs{trace@all} to zero, in
+case it was~$-1$.
+\ImpNoteStop
+
+\endinput
diff --git a/macros/lollipop/doc/tex-inde.xen b/macros/lollipop/doc/tex-inde.xen
new file mode 100644
index 0000000000..3f8f2acca6
--- /dev/null
+++ b/macros/lollipop/doc/tex-inde.xen
@@ -0,0 +1,261 @@
+TeX-index entries
+
+%% the Lollipop format
+
+The Lollipop format is designed to make implementation of
+new style definitions easy, even for people who can barely
+program TeX macros. It is not compatible with either plain
+TeX or LaTeX, although a lot of plain TeX constructs are
+available. There is a manual with many elaborate examples;
+see below.
+
+
+
+Name: lollipop-define.tex
+Description: cross referencing macros for
+ the lollipop package
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the lollipop package, see lollipop.tex.
+
+Name: lollipop-document.tex
+Description: document handling macros for the
+ lollipop package
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the lollipop package, see lollipop.tex.
+
+Name: lollipop-float.tex
+Description: floating insertion macros
+ for the lollipop package
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the lollipop package, see lollipop.tex.
+
+Name: lollipop-fontdefs.tex
+Description: fontdefinitions for the lollipop package
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the lollipop package, see lollipop.tex.
+
+Name: lollipop-fonts.tex
+Description: font handling macros
+ for the lollipop package
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the lollipop package, see lollipop.tex.
+
+Name: lollipop-heading.tex
+Description: heading macros for the lollipop package
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the lollipop package, see lollipop.tex.
+
+Name: lollipop-lists.tex
+Description: list definition macros
+ for the lollipop package
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the lollipop package, see lollipop.tex.
+
+Name: lollipop.tex
+Description: main file for the lollipop package
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: requires lollipop-define.tex, lollipop-document.tex
+ lollipop-float.tex, lollipop-fontdefs.tex, lollipop-fonts.tex,
+ lollipop-heading.tex, lollipop-lists,tex,
+ lollipop-plain.tex, lollipop-output.tex, lollipop-math.tex,
+ lollipop-text.tex, lollipop-tools.tex.
+
+Name: lollipop-plain.tex
+Description: version of plain.tex customized
+ for the lollipop package
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the lollipop package, see lollipop.tex.
+
+Name: lollipop-output.tex
+Description: output routine macros
+ for the lollipop package
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the lollipop package, see lollipop.tex.
+
+Name: lollipop-text.tex
+Description: text environment definitions
+ for the lollipop package
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the lollipop package, see lollipop.tex.
+
+Name: lollipop-tools.tex
+Description: utility macros for the lollipop package
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the lollipop package, see lollipop.tex.
+
+%% lollipop manual
+
+Name: comment.tex
+Description: comment environment for plain TeX,
+ LaTeX, and lollipop TeX.
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the manual of the lollipop package,
+ see lollipop.tex.
+
+Name: extern.tex
+Description: description of external file handling
+ in lollipop TeX.
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the manual of the lollipop package,
+ see lollipop.tex.
+
+Name: head.tex
+Description: description of headings in lollipop TeX.
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the manual of the lollipop package,
+ see lollipop.tex.
+
+Name: list.tex
+Description: description of lists in lollipop TeX.
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the manual of the lollipop package,
+ see lollipop.tex.
+
+Name: mandefs.tex
+Description: style definition for the lollipop TeX manual.
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the manual of the lollipop package,
+ see lollipop.tex.
+
+Name: lollipop-manual.tex
+Description: master file for the lollipop TeX manual
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: requires comment.tex, extern.tex, head.tex, list.tex
+ mandefs.tex, lollipop-manual.bbl, opt.tex, out.tex, prelim.tex,
+ struct.tex, titlepag.tex, trace.tex.
+
+Name: opt.tex
+Description: description of construct options
+ in lollipop TeX
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the manual of the lollipop package,
+ see lollipop.tex.
+
+Name: out.tex
+Description: description of output handling
+ in lollipop TeX.
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the manual of the lollipop package,
+ see lollipop.tex.
+
+Name: prelim.tex
+Description: introductory chapter of lollipop manual.
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the manual of the lollipop package,
+ see lollipop.tex.
+
+Name: struct.tex
+Description: description of the overall structure of
+ lollipop TeX files
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the manual of the lollipop package,
+ see lollipop.tex.
+
+Name: titlepag.tex
+Description: titlepage of the lollipop manual
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the manual of the lollipop package,
+ see lollipop.tex.
+
+Name: trace.tex
+Description: description of trace modes in lollipop TeX
+Keywords: lollipop, macro package, style definitions
+Author: Victor Eijkhout and Vafa Khalighi
+Supported: yes
+Latest version: v1.07, 21 May 2016
+Archives: http://ctan.org/pkg/lollipop
+Note: part of the manual of the lollipop package,
+ see lollipop.tex.
+
diff --git a/macros/lollipop/tex/lollipop-define.tex b/macros/lollipop/tex/lollipop-define.tex
new file mode 100644
index 0000000000..6f805a2791
--- /dev/null
+++ b/macros/lollipop/tex/lollipop-define.tex
@@ -0,0 +1,425 @@
+% lollipop-define.tex copyright 1992/3 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\NewTrace:ref
+%%%%%%%%%%%%%%%% Symbolic references
+
+% User command for labels.
+% this is hardly ever necessary:
+% most commands directly accept the label.
+%
+\def\label[#1]{\bsp@hack\@label{#1}\esp@hack}
+
+% Automatic generation of labels.
+% after \@Labelize{command}, it is possible to write \command[sym:ref]
+% This is done for any generic construct that has a counter.
+%
+%\add@generic@stop@default{\ifhas@label \@Labelize{\@command}\fi}
+\newif\ifhas@label
+\add@generic@default{\has@labelno}
+\@GenericOption{haslabel}{\global\has@labelyes}
+\def\@Labelize#1{\edef\cs@e{\let\CSname{lab@#1}=\CSname{#1}}\cs@e
+ \csarg\edef{#1}{\begingroup
+ \aftergroup\CSname{lab@#1}\nxp\@referentiep}}
+\def\@referentiep
+ {\ifnextchar[%]
+ \x@label{\ifNextChar<%>
+ \x@o@label{\gdef\xx@label{}\endgroup}%
+ }}
+
+% if \command has a symbolic key,
+% \x@label#1 =
+% \def\xx@label
+% \@label{#1}
+% \xx@label <- {}
+% the \xx@label command is called at the start of every environment
+% this delay is necessary, because the label is seen before
+% the title, or before any counter is stepped.
+%
+\newif\ifcustom@label
+\def\xx@label{}\def\RefLabel{}
+\def\x@o@label<#1>{\global\custom@labeltrue
+ \global\current@label{#1}\x@label}
+\def\x@label[#1]{\gdef\RefLabel{#1}%
+ \gdef\xx@label{\@label{#1}\global\custom@labelfalse
+ \gdef\xx@label{}}\endgroup}
+
+% Label contents
+% mostly generated by \step@counter or so
+%
+\newtoks\current@label
+\def\define@reference
+ #1{\ifcustom@label\else
+ \edef\cs@e{\global\current@label
+ {\counter@@repr{#1}{\csarg\number{\counter@name{#1}}}}}%
+ \cs@e
+ \fi}
+
+% Internal labeling command
+% 1/ \current@label contains tokens describing the reference
+% do a twostep unwrap of that
+% 2/ write out the result to the .aux file
+% 3/ if the current file has been \InputeFile'd,
+% write out to the .aux of the input file.
+%
+% the string written out is for \@label{Key}:
+% \refer@label{ref@Key}{label value}{page counter}
+%
+\def\@label@key#1{ref@#1}
+\noeol
+\def\@label#1{\Tmessage[ref]{Label definition: <#1>=\the
+ \current@label}
+ \ifWriteExtern \begingroup
+ \def\label[##1]{}\normalesc
+ \def\cprotect{\xp\string}
+ %\xp\xp\xp\string\FooCounter =>
+ %\xp\string\Foo@R{\number\Foo@C} => \string\@arabic{123}
+ \def\protect{\noexpand\protect\noexpand}
+ %\test@defined@key{#1}
+ \edef\cs@e{\edef\nxp\cs@e{\current@label={\the\current@label}}
+ \nxp\cs@e}
+ \cs@e
+ %\Tmessage[ref]{Label as written: <\the\current@label>}
+ \edef\cs@e{\the\current@label}
+ \edef\cs@a##1{\nxp\csarg\write{##1@file}
+ {\string\refer@label{\@label@key{#1}}
+ {\macro@meaning\cs@e}{\noexpand\PageCounter}}}
+ \cs@a{aux}
+ \ifx\@invoernaam\@leeg
+ \else \ifLocalReferences \cs@a{incaux}\relax \fi\fi
+ \endgroup\fi}
+\newcount\duplicate@labels
+\def\test@defined@key#1{\if\UndefinedCS{\@label@key{#1}}
+ \Tmessage[ref]{First time definition of <#1>}
+ \else\xp\xp\xp\xp\xp\xp\xp\ifx\xp\xp\xp
+ \third@of@three\csn \@label@key{#1}\ecs\StaleRef
+ \begingroup
+ \edef\cs@e{\CSname{\@label@key{#1}}}
+ \xp\xp\xp\def\xp\xp\xp\cs@e\xp\xp\xp{\cs@e}
+ \temptoksa\xp\xp\xp{\xp\first@of@three\cs@e}
+ \edef\cs@e{\CSname{\@label@key{#1}}}
+ \xp\xp\xp\def\xp\xp\xp\cs@e\xp\xp\xp{\cs@e}
+ \temptoksb\xp\xp\xp{\xp\second@of@three\cs@e}
+ \edef\cs@e{\temptoksa
+ {{\the\temptoksa}{\the\temptoksb}\nxp\FreshRef}}
+ \cs@e
+ \csarg\xdef{\@label@key{#1}}{\the\temptoksa}
+ \endgroup
+ \Tmessage[ref]{Refreshing definition of <#1>:\@space
+ \xp\meaning\csn \@label@key{#1}\ecs}
+ \else\Wmessage{Duplicate label: <#1>}%
+ \advance\duplicate@labels\@ne\fi\fi}
+\normaleol
+
+% complete expandable exploding of token lists
+\def\macro@meaning#1{\xp\strip@macro@meaning\meaning#1}
+\def\toks@meaning#1{\edef\cs@e{\the#1}\macro@meaning\cs@e}
+\begingroup\escapechar=-1
+\xp\xp\xp\gdef\xp\xp\xp\strip@macro@meaning\xp\string
+ \csname macro:->\endcsname{}
+\endgroup
+
+\NewDummy{StaleRef}\NewDummy{FreshRef}
+
+% Referring and Page references.
+% first of all, when the .aux file is read:
+% \refer@label{ref@Key}{label}{page} =
+% \gdef\ref@Key{ {{label}} {{page}} }
+% with extra braces for occurring fonts
+%
+\def\refer@label#1#2#3{\csarg\gdef{#1}{{{#2}}{{#3}}\StaleRef}}
+
+% then \ref[key] = \@ref\take@former[key]
+% \pgref[key] = \@ref\take@latter[key]
+% and \@ref\cs[key] = \expandafter\cs\ref@key
+% = \cs {{label}} {{page}}
+%
+\def\ref {\ifnextchar(%)
+ {\@ref\first@of@three}{\@ref\first@of@three()}}
+\def\pgref{\ifnextchar(%)
+ {\@ref\second@of@three}{\@ref\second@of@three()}}
+\newcount\unknown@refs
+\add@start@command{\unknown@refs\z@}
+\def\@ref#1(#2)[#3]{%
+ \if\UndefinedCS{\@label@key{#3}}%
+ \message{Unknown #1{}{page}{}reference: <#3>}{\bf ??}%
+ \global\advance\unknown@refs\@ne
+ \else \@@ref{#1}{#2}{\@label@key{#3}}\fi}
+\def\@@ref#1#2#3{\@@@ref#1{#3}%
+ \if\IsEmptyList{#2}\else,\penalty200\ #2\fi}
+\def\@@@ref#1#2{%
+ \xp\xp\xp#1\csname#2\endcsname}
+% for btxmac
+\def\@printlabel#1{\@ref\first@of@three()[#1]}
+%\@@@ref\first@of@three{\@label@key{#1}}}
+
+% Test for changed references
+% at the end of the job
+%
+\def\test@refer@label#1#2#3{
+ \def\cs@a{{{#2}}{{#3}}\FreshRef}
+ \def\cs@b{{{#2}}{{#3}}\StaleRef}
+ \csarg\ifx{#1}\cs@a
+ \else \csarg\ifx{#1}\cs@b
+ \else \labels@changedyes
+ \Tmessage[ref]{New definition for <#1>}
+ \fi\fi}
+
+% Citations.
+% \cite[key] = [\ref[key]]
+% \cite(string)[key] = [\ref[key], string]
+%
+%\def\cite{\ifnextchar(\y@cite\x@cite}
+%\def\y@cite(#1)[#2]{[\ref[#2], #1]}
+%\def\x@cite[#1]{[\ref[#1]]}
+
+% External Generic Option
+% use: external:extfile ... external:stop
+% stores result in \extern@x/y/z@toks in a tricky way:
+% 'x' stores expandable parts, 'y' stores protectable parts.
+% this is inserted in \@outerstartcommands
+%
+\NewTrace:ext
+\newif\ifin@external
+\add@generic@default{\in@externalno}
+\newtoks\extern@toks \newtoks\late@extern@toks
+\newtoks\build@extern@toks
+\newtoks\extern@x@toks \newtoks\extern@y@toks \newtoks\extern@z@toks
+\adds@generic@default{
+ \extern@toks\empty@toks \late@extern@toks\empty@toks
+ \extern@x@toks\empty@toks\extern@y@toks\empty@toks}
+\@GenericOption{external}{
+ \switch {\if\EqualString{#1}}
+ {stop} {\external@stop{extern@toks}}
+ {late} {\external@stop{late@extern@toks}}
+ {default} {\external@start{#1}}
+ \endswitch}
+\def\external@start#1{\b@group[external]\in@externalyes
+ \build@extern@toks\empty@toks
+ \switch@to@options@list{build@extern@toks}
+ \if\UndefinedCS{\file@ext@name{#1}}
+ \Wmessage{Unknown external file: <#1>
+ while defining <\@name>}\def\@add@toks##1{}%
+ \else \generate@extern{#1}% document: this writes the file name
+ \Tmessage[ext]{External definition <#1>}
+ \fi
+ \extern@x@toks\empty@stack \extern@y@toks\empty@stack
+ \extern@z@toks\empty@toks
+ \begingroup \switch@to@options@list{extern@z@toks}
+ }
+\def\external@handle@title#1{\seen@textyes
+ \external@handle@expandable{#1}{\csn\@@@title{#1}\ecs}{title: <#1>}}
+\def\external@handle@expandable#1#2#3{
+ \extern@push@part{y}{\the\extern@z@toks}
+ \extern@push@part{x}{#2}
+ \Tmessage[ext]{External pushed #3}
+ \extern@z@toks\empty@toks}
+\def\extern@push@part#1{\csarg{\let\xp\cs@a}{extern@#1@toks}
+ \xp\push@onto@cs\xp\cs@a\xp}
+\def\extern@pop@n@pop{}
+\def\external@before@title{\in@externalyes\seen@textno
+ \switch@to@options@list{e@before@toks}}
+\def\in@ref@protect{\ifin@label\@add@toks{\protect}\fi}
+\def\cs@in@ref@protect#1{%
+ \ifin@label \title@count@no@protect{#1} \fi
+ \ifin@external \title@count@no@protect{#1} \fi
+}
+\def\title@count@no@protect#1{%
+ \if\has@no@count@string #1Counter?
+ \if\has@no@title@string #1Title?
+ \@add@toks{\protect}\fi\fi}
+\def\has@no@count@string #1Counter#2?
+ {00\fi\if\IsEmptyList{#2}}
+\def\has@no@title@string #1Title#2?
+ {00\fi\if\IsEmptyList{#2}}
+% wind up making an external: invert the stacks
+% and append them
+\def\external@stop#1{\extern@push@part{y}{\the\extern@z@toks}
+ \invert@csstack\extern@x@toks \invert@csstack\extern@y@toks
+ \xdef\cs@e{\nxp\@add@toks
+ {{\the\extern@x@toks}{\the\extern@y@toks}}}
+ \endgroup %revert to build@extern@toks
+ \cs@e \@add@toks{\e@extern}
+ \switch@to@options@list{#1}
+ \edef\cs@e{\nxp\@add@toks{\the\build@extern@toks}}\cs@e
+ \e@group[external]}
+% how do we write stuff to the aux file?
+% #1 is the x toks, #2 the y
+\def\aux@write@external#1#2{%
+ \extern@x@toks{#1}\extern@y@toks{#2}%
+% \let\\\relax
+%\message{Expandables <\the\extern@y@toks>}
+% \edef\cs@e{\extern@y@toks{#2}}\cs@e
+%\message{becomes <\the\extern@y@toks>}
+ \length@of@csstack\extern@x@toks
+ \tempcounta\z@ \extern@toks\empty@toks
+ \loop\ifnum\tempcounta<\stack@length
+ \pop@cs@into\extern@z@toks\extern@y@toks
+ \append@cslist@to@cslist\extern@toks\extern@z@toks
+ \pop@cs@into\extern@z@toks\extern@x@toks
+ \extern@z@toks\xp\xp\xp{\the\extern@z@toks}%
+ \append@cslist@to@cslist\extern@toks\extern@z@toks
+ \advance\tempcounta\@ne\repeat
+ \pop@cs@into\extern@z@toks\extern@y@toks
+ \append@cslist@to@cslist\extern@toks\extern@z@toks
+ \xp\def\xp\cs@e\xp{\the\extern@toks}\edef\cs@e
+ {\write\aux@file{\real@meaning\cs@e}}\cs@e}
+%
+% Protection of expandable control sequences;
+% value \nxp\protect\nxp is set during label definition and shipout
+% \protect should be empty during execution
+%
+\def\protect{}
+
+%%%%%%%%%%%%%%%% External references
+% define explicitly the form a reference will take
+% label:start ... label:stop
+%
+% Maybe this can be unified with the `external' option
+%
+\newif\ifin@label
+\newif\iflabel@defined \newtoks\@labelcoms
+\add@generic@default{\@labelcoms{} \label@definedno \in@labelno}
+\@GenericOption{label}{
+ \if\EqualString{#1}{stop}\e@group[label]
+ \else \global\label@definedyes\global\has@labelyes
+ \b@group[label] \in@labelyes
+ \switch@to@options@list{@labelcoms}
+ \fi}
+
+%%%%%%%%%%%%%%%% Substitutions
+
+% Long substitutions
+% the style designer declares the existence of a substitution
+%
+% \DefineSubstitution:Foo =
+% \def\Foo#1\par
+%
+\def\DefineSubstitution:#1
+ {\Tmessage[def]{Substitution being defined: #1}
+ \csarg\edef{#1}##1\par{\@@subdef{#1}}
+ \edef\cs@e{\let\CSname{if#1Exists}=\CSname{iffalse}}
+ \cs@e
+ }
+\def\@@subdef#1{\let\CSname{if#1Exists}=\CSname{iftrue}%
+ \def\CSname{#1@text}{##1}}
+
+% Short substitutions
+% almost the same, but to end of line instead of to \par
+%
+\def\DefineShortSubstitution:#1
+ {\@DefineShortSubstitution{#1}}
+{\noeol
+\othercr
+\gdef\@DefineShortSubstitution#1{
+ \Tmessage[def]{Defining short substitution: #1}
+ {\othercr
+ \csarg\xdef{#1}{\noexpand\othercr \CSname{@#1}}
+ \csarg\xdef{@#1}##1^^M{
+ \@@subdef{#1}\noexpand\normalcr}}
+ \global\csarg\let{ifExists#1}=\iffalse}}
+
+
+% Substitute
+% is then a command for both user and style designer.
+% \Substitute:text=uppercase/lowercase is possible
+% but these take more than just expansion.
+%
+\def\Substitute:#1 {\@substitute#1== }
+\def\@substitute#1=#2=
+ {\if\ifempty{#2}{\csname#1@text\endcsname}%
+ \else\if\EqualString{#2}{uppercase}%
+ \uppercase\xp\xp\xp{\csname#1@text\endcsname}%
+ \else \lowercase\xp\xp\xp{\csname#1@text\endcsname}%
+ \fi
+ \fi}%why did this say \noesc\csname\string#1@text... ?
+
+{\noeol
+\othercr
+\gdef\variant{\bgroup\othercr \@variant}
+\gdef\@variant:#1=#2^^M#3\variantstop{
+ \csarg\gdef{#1}{\par\bgroup #3 \csname#2\endcsname}
+ \csarg\xdef{#1stop}{\CSname{#2stop}\egroup}
+ \egroup}
+}
+
+% Value
+% this is analogous to \Distance (in file text)
+%
+\def\Value:#1=#2
+ {\edef\cs@e{\if\UndefinedCS{#1}\noexpand\new@count
+ \else \noexpand\set@value \fi
+ {#1}%
+ \if\UndefinedCS{#2}{#2}%
+ \else \CSname{#2}\fi}
+ \cs@e}
+
+%%%%%%%%%%%%%%%% Tests
+%
+% Test user command
+%
+\def\DefineTest:#1
+ {\Tmessage[def]{Defining test: #1}
+ \csarg\newif{if#1}
+ \csarg\def{#1}:##1 {\csname #1##1\endcsname}}
+
+% Test generic option
+%
+% option test:Foo tests if \ifFoo is defined
+%
+% if not, \let\ifFoo=\iffalse, and
+% \StyleDefinitionStop performs a test
+% and warns if still undefined
+%
+% \let\hang@fi\@empty globally
+% \def\hang@fi{\@add@toks{\fi}} is defined locally
+% ==> check on unclosed test options.
+%
+\@GenericOption{test}{
+ \switch {\if\EqualString{#1}}
+ {otherwise}{\hang@else}
+ {stop}{\hang@fi \e@group}
+ {default}{\b@group
+ \if\UndefinedCS{if#1}
+ \check@existence{if#1}
+ \edef\cs@e{\global\let\CSname{if#1}\CSname{iffalse}}
+ \cs@e
+ \fi
+ \hang@fi@define
+ \edef\cs@e{\nxp\@add@toks{\CSname{if#1}}}\cs@e
+ }
+ \endswitch}
+
+% The body of these macros has to be kept outside of conditionals
+%
+\def\hang@else{\@add@toks{\else}}
+\def\hang@fi@define{\def\hang@fi{\@add@toks{\fi}}}
+\add@generic@default{\let\hang@fi\@empty}
+\add@generic@stop@default
+ {\ifx\hang@fi\@empty\else
+ \Emessage{There are tests open in \@name}\fi}
+
+% voorgegeven tests uit TOOLS
+\newif\ifVoortgang
+\def\Voortgang:#1 {\csname Voortgang#1\endcsname}
+\DefineTest:Diagnose
+
+\endinput
+
+% 92/11/26 ifcustom@label and attendant handling
+% 92/12/05 \@label@key \ No newline at end of file
diff --git a/macros/lollipop/tex/lollipop-document.tex b/macros/lollipop/tex/lollipop-document.tex
new file mode 100644
index 0000000000..e643cfcab0
--- /dev/null
+++ b/macros/lollipop/tex/lollipop-document.tex
@@ -0,0 +1,381 @@
+% lollipop-document.tex copyright 1992/3 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% D O C U M E N T S T R U C T U R E %%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\DefineTest:LocalReferences
+\NewTrace:doc
+
+% Start
+% open external files and execute default commands
+%
+\newif\if@started
+\def\Start{\@startedyes \the\start@commands
+ \ifBasicIndentIsSet\else
+ \Distance:basicindent=parindent \fi
+ \set@level@indent}
+\def\StartCommand#1{\adds@start@command{#1}}
+
+% End
+% 1/ close any open groups and give warnings
+% 2/ \vfil\eject the last page
+% 3/ \immediate\close the .auxs file
+% 4/ load the .aux for writing the external files
+% and testing changed references
+%
+\let\@end=\end
+\def\Stop{\Close@all@groups
+ \the\stop@commands
+ \vfil \penalty\slotpenalty
+ \ifnum\unknown@refs>\z@
+ \message{-- There \ifnum\unknown@refs=\@ne was an \else
+ were \number\unknown@refs\@space\fi
+ unresolved reference\ifnum\unknown@refs>\@ne s\fi.}\fi
+ \ifnum\duplicate@labels>\z@
+ \message{-- There \ifnum\duplicate@labels=\@ne was an\else
+ were \number\duplicate@labels\@space\fi
+ duplicate label\ifnum\duplicate@labels>\@ne s\fi.}\fi
+ \immediate@close@aux@file{aux}
+ \ifWriteExtern \final@load@aux \fi
+ \@end}
+\def\StopCommand#1{\adds@stop@command{#1}}
+
+%%%%%%%%%%%% input other files
+\newwrite\aux@file \newwrite\incaux@file
+\let\ifWriteaux\iftrue
+\def\aux@name{aux} \def\aux@extension{aux}
+\newif\if@auxopen \newif\if@incauxopen
+
+% the following line is in output.tex
+%\add@mark@item{first@page}
+
+% Input files are in a group,
+% they also set the IsFirstPage test
+\def\InputFile:#1 {\begingroup \def\input@name{#1}
+ \Tmessage[doc]{Input File: #1}
+ \refresh@mark@item{first@page}{yes}
+ \refresh@mark@item{first@page}{no}
+ \ifLocalReferences
+ \get@aux@file{#1}{incaux}{aux}\fi
+ \input@file{#1}%
+ \immediate@close@aux@file{incaux}
+ \Close@all@groups
+ \def\test@input@name{#1}\ifx\input@name\test@input@name\else
+ \Wmessage{Input `#1' overbalanced}\fi
+ \endgroup}
+\def\xInputFile:#1 {\input@file{#1}}
+\def\input@file#1{\input #1 \vfil\penalty\slotpenalty\par}
+
+\let\input@name=\@empty
+\let\test@input@name=\@empty
+
+% Input of Lollipop files
+%
+\def\InputLollipop:#1 {\makeatletter\input#1\relax\makeatother}
+
+%%%%%%%%%%%%%%%% External Communication
+
+% List of files
+% not including the .aux file
+%
+\newtoks\ext@files@list \ext@files@list={}
+
+% I don't want to remember my own naming conventions.
+%
+\def\file@ext@name#1{#1@extension}
+\def\cs@file@ext@name#1{\csname#1@extension\endcsname}
+
+% Define External File
+% #1 is name known to style definition,
+% #2#3#4 is three-letter file extension in
+% file system
+%
+% correspondence: \#1@extension = #2#3#4, \#2#3#4@name = #1
+%
+% user test \Write#1 to prevent overwriting
+% internal test \if@#2#3#4open
+% \newwrite\#2#3#4@file
+%
+\def\DefineExternalFile:#1=#2#3#4#5
+ {\Tmessage[doc]{Define external file `#1' (ext=#2#3#4)}
+ \csarg\newwrite{#2#3#4@file}
+ \append@to@list{ext@files@list}{\\#2#3#4; }
+ \csarg\newtoks{#1@local@defs}%constructed in \ExternalItem
+ \csarg\gdef{\file@ext@name{#1}}{#2#3#4}
+ \csarg\gdef{#2#3#4@name}{#1}
+ \DefineTest:{Write#1}
+ \global\csname Write#1yes\endcsname
+ \csarg\newif{if@#2#3#4open}
+ }
+
+%%%% Load
+
+% Initial load of the auxiliary file
+%
+\def\initial@load@aux{%\begingroup%why this group?
+ \disable@external@write@command
+ \Tmessage[doc]{Load initial aux file}
+ \get@aux@file{\jobname}{aux}{aux}
+ %\endgroup
+ \ifWriteExtern
+ \open@ext@file@for@output{\jobname}{aux}{aux}
+ \fi}
+% A test to determine all-or-nothing writing of .aux file.
+% below there is a redefinition for bibTeX
+\DefineTest:WriteExtern \WriteExtern:yes
+\ifini{\add@start@command{\initial@load@aux}}
+
+% Load of external file
+%
+\def\LoadExternalFile:#1
+ {\if\UndefinedCS{\file@ext@name{#1}}
+ \Wmessage{LoadExternalFile: unknown external file `#1'}
+ \else \begingroup
+ \Tmessage[doc]{Loading external file: #1}
+ \WriteExtern:no %prevent trouble with undefined entries
+ \csarg\the{#1@local@defs}
+ \get@aux@file{\jobname}{\cs@file@ext@name{#1}}
+ {\cs@file@ext@name{#1}}
+ \endgroup
+ \fi}
+
+% Basic load
+%
+\def\get@aux@file#1#2#3{
+ \csarg\openin{#2@file} #1.#3
+ \csarg\ifeof{#2@file}
+ \message{No aux file `\csname#2@name\endcsname'}
+ \else \csarg\closein{#2@file}
+ \Tmessage[ref]{Inputting aux file <#2>: <#1.#3>}
+ \Tmessage[ext]{Inputting aux file <#2>: <#1.#3>}
+ \makeatletter \input #1.#3 \makeatother
+ \fi}
+
+% Open for output:
+% initially used for the .aux file
+% at the final load of the .aux file used to generate .toc
+% et cetera
+%
+\def\open@ext@file@for@output#1#2#3{
+ \csname ifWrite\csname #2@name\endcsname\endcsname
+ \immediate\openout\csname#2@file\endcsname=#1.#3
+ \global\csname @#2openyes\endcsname
+ \immediate\write\csname#2@file\endcsname{\relax}
+ \Tmessage[doc]{File '#2' (#3) open for output}
+ \Tmessage[ext]{File '#2' (#3) open for output}
+ \else
+ \global\csname @#2openno\endcsname
+ \Tmessage[doc]{File '#2' (#3) not open for output}
+ \Tmessage[ext]{File '#2' (#3) not open for output}
+ \fi}
+\def\open@external@files@for@output{
+ \def\protect{\noexpand\protect\noexpand}
+ \def\\##1;{##1}\Tmessage[doc]{External files: \the\ext@files@list}
+ \def\\##1;{\open@ext@file@for@output{\jobname}{##1}{##1}}
+ \the\ext@files@list}
+
+\newif\iflabels@changed
+\def\final@load@aux{\labels@changedno
+ \def\refer@label##1##2##3{\test@refer@label{##1}{##2}{##3}}
+ \open@external@files@for@output
+ \install@external@write@command
+ \Tmessage[doc]{Load aux for label testing and ext file generation}
+ \Tmessage[ext]{Load aux for label testing and ext file generation}
+ \makeatletter \input \jobname.aux
+ \end@write@extern
+ \iflabels@changed \Wmessage{Labels have changed. Rerun!} \fi
+ \makeatother}
+\def\end@write@extern{
+ \def\\##1;{\immediate@close@aux@file{##1}}
+ \the\ext@files@list}
+\def\close@aux@file #1{\csname if@#1open\endcsname
+ \write\csname#1@file\endcsname{\relax}
+ \closeout\csname#1@file\endcsname
+ \Tmessage[doc]{File '#1' closed}\fi}
+\def\immediate@close@aux@file#1{\csname if@#1open\endcsname
+ \immediate\write\csname#1@file\endcsname{\relax}
+ \immediate\closeout\csname#1@file\endcsname
+ \Tmessage[doc]{File '#1' immediately closed}\fi}
+
+
+% Generate the extern call in the style definition
+% this one is part of 'external:<file name>'
+%
+\def\generate@extern#1{\edef\cs@e
+ {\nxp\@add@toks{\nxp\@extern
+ {\CSname{\file@ext@name{#1}}}
+ {\@name}
+ {\ifhas@counter \CSname{\@name Counter}\fi}
+%\counter@@repr{\@name}
+%{\nxp\the\counter@@name{\@name}}\fi}%
+ }}\cs@e}
+
+% call:
+% \@extern{extension}{object}{counter}\the\title@toks\e@extern
+% to aux:
+% \write@to@external{extension}{object}{counter}{page}{tekst}\ew@extern
+% to .extension file:
+% \object{counter}{page}tekst\par
+% where \object is locally defined in the 'extension' file.
+%
+\def\ToExternalFile:#1=#2
+ {\edef\cs@e{\nxp\x@extern{\cs@file@ext@name{#1}}}%
+ \cs@e{anon}{}{\\{#2}\\{}}{\\{}\\{}\\{}}\e@extern}
+\def\@extern{\ifWriteExtern
+ \xp\x@extern \else \xp\skip@extern \fi}
+\def\skip@extern#1#2#3\e@extern
+ {\Tmessage[ext]{Skipped `#2' for `#1'}}
+\newtoks\ext@text@toks
+\newtoks\ext@labl@toks
+\newtoks\ext@page@toks
+\begingroup\noeol\catcode`\?\catcode`\%\catcode`\%=12
+\gdef\x@extern#1#2#3#4#5\e@extern
+ {\begingroup\normalesc
+ \def\label[##1]{}
+ \def\protect{\noexpand\protect\noexpand}
+ \def\cprotect{\xp\string}
+ \Tmessage[ext]{Write to aux `#2' for `\csname#1@name\endcsname'}
+ \edef\cs@e{\write\aux@file{\string\write@to@external
+ {#1}{#2}{#3}}}\cs@e
+ \write\aux@file{
+ {\counter@@repr{Page}{\csarg\number{\counter@name{Page}}}}%}
+ \aux@write@external{#4}{#5}
+ \write\aux@file{\string\ew@extern}
+ \endgroup}
+\normaleol\endgroup
+
+% string a word, delimited by a space,
+% first see whether it is a group, recognized by the fact
+% that there is another space in it.
+\def\string@um@up#1 {\string@space@group#1 \>\@bean}
+\def\string@space@group#1 #2#3\@bean
+ {\ifx#2\> \string@word#1\@roy
+ \else \string{\string@um@up#1 #2#3 \string}%
+ \fi \@space\string@um@up}
+% a word is delimited by \@roy; if the word is \> then this
+% is the last word, and we should remove
+% a trailing \@roy plus the \@space\string@um@up tokens after the call,
+% but also parts of the conditional after the call have to be removed:
+% \expandafter \take@three \expandafter \@roy \else .. \fi \@space\string@..
+%
+% sick. very sick.
+%
+\def\string@word#1{\ifx#1\>\xp\expandafter\xp\take@three\xp\expandafter
+ \else \ifx#1\@roy
+ \else \string#1\ifcat\nxp#1\relax\@space\fi
+ \xp\xp\xp\string@word
+ \fi \fi}
+
+% an attempt to string up a title.
+% this covers for the case where there are groups,
+% but it is still quite wrong if \else or so is in the title
+%
+\NewDummy{@roy}\NewDummy{@bean}\NewDummy{@rope}\NewDummy{@bear}
+\NewDummy{@Rope}
+% Enable/Disable communication to external files
+% former during initial load of .aux file,
+% latter during final load of .aux file
+%
+\def\disable@external@write@command
+ {\def\write@to@external##1\ew@extern{}}
+\disable@external@write@command %do this initially just to be sure
+\def\install@external@write@command %grouping ok?
+ {\def\write@to@external##1##2##3##4##5\ew@extern
+ {\csname if@##1open\endcsname
+ \Tmessage[ext]{Write `##2'
+ to `\csname##1@name\endcsname'}
+ \ext@labl@toks{##3}
+ \ext@page@toks{##4}
+ \ext@text@toks{##5}
+ \immediate\write\csname##1@file\endcsname
+ {\CSname{##2}{\the\ext@labl@toks}%
+ {\the\ext@page@toks}\the\ext@text@toks
+ \string\par}
+ \else
+ \Tmessage[ext]{Skipped `##2'
+ for `\csname##1@name\endcsname'}
+ \fi}}
+
+%%%%%%%%%%%%% BibTeX interface
+% we interface ourselves to the BtxMac macros
+% of Karl Berry and Oren Patashnik, version 0.99h
+
+% prevent btxmac from rewriting *our* auxfile
+% if btxmac has not been loaded this is just \relax
+\adds@start@command{\csn @auxfiledonetrue\ecs}
+
+% alternate name for the aux write stream
+\adds@start@command{\let\@auxfile\aux@file}
+
+% disable / alter Btxmac definitions
+\def\bbl@hook{\default@everypar}
+\adds@start@command{\let\bblhook\bbl@hook}
+
+% switch off btxmac if need be
+\xp\def\xp\WriteExternno\xp
+ {\WriteExternno \let\noauxfile\@space}
+
+% if you want to read an aux file but not load btxmac:
+\let\bibstyle\take@one \let\bibdata\take@one
+\let\citation\take@one \let\nocite\take@one
+% similarly the source:
+\let\bibliography\take@one \let\bibliographystyle\take@one
+
+% user defined bibliography
+\def\DefineBBL{\let\bbl@hook\BBL@hook \DefineList:BBL }
+\def\BBL@hook
+ {\def\begin##1##2{\default@everypar\BBL}\def\end##1{\>}%
+ %intercept \begin{thebibliography}{width}
+ \def\bibitem{\ifNextChar[%]
+ \bbl@print@item\bbl@item}
+ \def\biblabelprint##1{}
+ }
+\def\bbl@item#1{\item[#1]}
+\def\bbl@print@item[#1]#2{\item<#1>[#2]}
+
+% refer to a bib item
+\def\bibref[#1]{\cite{#1}}%{[\ref[#1]]\nocite{#1}}
+
+\def\one@bib@citation#1\@@{% this is what \bib@citation will become
+ \if@notfirstcitation
+ \printbetweencitations
+ \fi
+ %
+ \expandafter \ifx \csname\@citelabel{#1}\endcsname \relax
+ \if@citewarning
+ \message{\@linenumber Undefined citation `#1'.}%
+ \fi
+ % Give it a dummy definition:
+ \expandafter\gdef\csname\@citelabel{#1}\endcsname{%
+ {\tt \nobreak\hskip0pt#1\nobreak\hskip0pt}}%
+ \fi
+ \@printlabel{#1}%
+ \@notfirstcitationtrue
+}
+\def\@c@l#1{@empty}
+\adds@start@command{\let\@onecitation\one@bib@citation
+ \let\@citelabel\@c@l}
+
+\endinput
+
+% 92/11/18 \Start extended with start@commands and \basicindent
+% 92/11/20 \StopCommand added
+% 92/11/21 groups removed from initial loading aux (twice)
+% 92/11/26 BibTeX interface \ No newline at end of file
diff --git a/macros/lollipop/tex/lollipop-float.tex b/macros/lollipop/tex/lollipop-float.tex
new file mode 100644
index 0000000000..6f493748f9
--- /dev/null
+++ b/macros/lollipop/tex/lollipop-float.tex
@@ -0,0 +1,51 @@
+% lollipop-floats.tex copyright 1992/3 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+% these macros handle inserts for the Lollipop format
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%% Floating insertions %%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\@GenericConstruct{Insertion}
+
+\NewTrace:ins
+
+\@InsertionOption{location}{
+ \switch {\if\EqualString{#1}}
+ {top} {}
+ {bot} {}
+ {mid} {}
+ {default} {\Wmessage{Unknown qualifier: <location:#1>}}
+ \endswitch}
+\newif\ifsplit@insert
+\add@Insertion@default{\split@insertno}
+\@InsertionOption{split}{
+ \switch {\if\EqualString{#1}}
+ {no} {\split@insertno}
+ {default} {\split@insertyes}
+ \endswitch}
+
+\def\@DefineInsertion{
+ \csarg\newinsert{\@name @ins}
+ \csarg\edef{\@name}{\insert\CSname{\@name @ins}
+ \ifsplit@insert\else\vbox\fi % make this a box if no split allowed
+ \bgroup \the\before@coms
+ }
+ \@DefineStopCommand{\the\after@coms \egroup}
+ }
+\endinput
diff --git a/macros/lollipop/tex/lollipop-fontdefs.tex b/macros/lollipop/tex/lollipop-fontdefs.tex
new file mode 100644
index 0000000000..1d10a3d411
--- /dev/null
+++ b/macros/lollipop/tex/lollipop-fontdefs.tex
@@ -0,0 +1,42 @@
+% lollipop-fontdefs.tex copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+%\noeol
+% good (?) old Computer Modern
+\DefineTypeface{ComputerModern}{cm}%
+ {roman:r; slant:sl; italic:ti; mitalic:mi; bold:bx; typewriter:tt;
+ default:r;}%
+ {<6:5; <7:6; <8:7; <9:8; <10:9; <11:10; <12:10 \sc@led\magstephalf;
+ <14:10 \sc@led\magstep1; <16:10 \sc@led\magstep2;
+ <20:10 \sc@led\magstep3; >19:10 \sc@led\magstep4;
+ default:10;}%
+ [\ifStyle:italic \ifnum\Fsize<7 ti7\fi\fi
+ \ifStyle:typewriter \ifnum\Fsize<8 tt8\fi\fi]
+\DefineTypeface{ComputerSans}{cmss}%
+ {roman:; italic:i; mitalic:i; bold:bx; demiboldcondensed:dc;
+ default:;}%
+ {<9:8; <10:9; <11:10; <12:10 \sc@led\magstephalf;
+ <14:10 \sc@led\magstep1; <16:10 \sc@led\magstep2;
+ <20:10 \sc@led\magstep3; >19:10 \sc@led\magstep4;
+ default:10;}%
+ [\ifStyle:bold \ifnum\Fsize<10 bx10\fi\fi]
+
+
+\endinput
+
+% 2016/04/13 Removed \DefineTypeface definitions for fonts
+% not in TeXLive \ No newline at end of file
diff --git a/macros/lollipop/tex/lollipop-fonts.tex b/macros/lollipop/tex/lollipop-fonts.tex
new file mode 100644
index 0000000000..3b9a72c19f
--- /dev/null
+++ b/macros/lollipop/tex/lollipop-fonts.tex
@@ -0,0 +1,416 @@
+% lollipop-fonts.tex copyright 1992/3 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%% Font selection macros %%%%%%%%%%%
+
+%%%%
+%%%% Text Fonts
+%%%%
+
+\NewTrace:font
+
+% User commands to change the three parameters
+
+% \Typeface:FACE
+% \F@name <-- FACE
+%
+\def\Typeface:#1
+ {\if\UndefinedCS{#1@code}\Wmessage{Undefined typeface: `#1'}\fi
+ \def\F@name{#1}}
+\let\TypeFace\Typeface
+
+% \Pointsize:NN
+% \Fsize <-- NN
+% compute script/sscript sizes
+% if necessary install math fonts
+%
+\def\PointSize:#1 {\tempcounta=\@ww{#1}%
+ \edef\Fsize{\the\tempcounta}%this line is used in \set@mathfont
+ \xp\@setsizes\xp{\Fsize}%
+ \xp\pointsize@baselineskip\xp{\Fsize}}
+\let\Pointsize=\PointSize
+
+% \Style:STYLE
+% \F@style <-- STYLE
+% load actual font
+% put font in \textfont0
+% install value of \@space
+%
+\def\Style:#1 {\def\F@style{#1}%
+ \ifmmode\SetFamily\else\SetFont\fi}
+\def\ifStyle:#1 {\xp\if\xp\EqualStringX\xp{\F@style}{#1}}
+
+% and together this makes:
+%
+\def\current@font{\F@name\F@style\romannumeral\Fsize}
+
+
+% abbreviations for common styles
+%
+\def\tty{\Style:typewriter }
+\def\rm{\Style:roman }\def\bf{\Style:bold }\def\it{\Style:italic }
+\def\sl{\Style:italic }
+
+% Command for actual loading is also user command.
+% If this is in a style definition, fill the math families.
+%
+\def\SetFont{\maybe@load@font
+ \if@started\else\store@main@font\fi
+ \ifx\cs@a\relax %error condition if load not succeeded
+ \else \csname\cs@a\endcsname
+ \@@space=.5em\relax
+ \fi}
+\def\maybe@load@font{\edef\cs@a{\current@font}%
+ \if\UndefinedCS{\cs@a}\load@font\fi}
+\def\load@font{\def@f@ext@name
+ \Tmessage[font]{Loading font (text): \cs@a=`\f@ext@name'}%
+ \edef\cs@e{\global\font\CSname{\cs@a}=\f@ext@name\relax}\cs@e
+ }
+\def\def@f@ext@name
+ {\edef\f@ext@name{\ext@combo}%
+ \edef\f@ext@name{\ext@name
+ \ifx\f@ext@name\@empty \ext@style\ext@size
+ \else \f@ext@name \fi}}
+
+\def\face@tag{\F@name @code}
+\def\cs@face@tag{\csname\face@tag\endcsname}
+
+% Find relative sizes of the current size
+% and install math fonts
+%
+\def\@ps@rls#1{ps@rls\romannumeral#1}
+\def\PointSizeScriptSizes:#1=#2,#3,#4
+ {\csarg\def{\@ps@rls#1}{{#2}{#3}{#4}}}
+\def\@setsizes#1{\if\UndefinedCS{\@ps@rls{#1}}\tempcounta#1\relax
+ \tempcountb\tempcounta \multiply\tempcountb7 \divide\tempcountb10
+ \tempcountc\tempcounta \divide\tempcountc2
+ \edef\@@setsizes
+ {{\the\tempcounta}{\the\tempcountb}{\the\tempcountc}}%
+ \else
+ \edef\@@setsizes{\csname\@ps@rls{#1}\endcsname}%
+ \fi
+ \expandafter\@setsize\@@setsizes}
+\PointSizeScriptSizes:0=0,0,0
+\PointSizeScriptSizes:1=1,1,1
+\PointSizeScriptSizes:2=2,2,2
+\PointSizeScriptSizes:3=2,3,3
+\PointSizeScriptSizes:4=4,4,4
+\PointSizeScriptSizes:5=5,5,5
+\PointSizeScriptSizes:6=6,5,5
+\PointSizeScriptSizes:7=7,6,5
+\PointSizeScriptSizes:8=8,6,5
+\PointSizeScriptSizes:9=9,7,5
+\PointSizeScriptSizes:10=10,7,5
+\PointSizeScriptSizes:11=11,8,6
+\PointSizeScriptSizes:12=12,9,7
+
+% Fill in a math font family corresponding to the
+% surrounding size
+\def\SetFamily{\ifface@size@changed\begingroup
+%\tracingmacros=2 \tracingcommands\tracingmacros
+ \edef\tmp@sizes{\csname\@ps@rls{\Fsize}\endcsname}
+ \edef\Fsize{\xp\first@of@three\tmp@sizes}\maybe@load@font
+ \edef\cs@e{\global\textfont
+ \CSname{\F@style @fam}\CSname{\cs@a}}\cs@e
+ \edef\Fsize{\xp\second@of@three\tmp@sizes}\maybe@load@font
+ \edef\cs@e{\global\scriptfont
+ \CSname{\F@style @fam}\CSname{\cs@a}}\cs@e
+ \edef\Fsize{\xp\third@of@three\tmp@sizes}\maybe@load@font
+ \edef\cs@e{\global\scriptscriptfont
+ \CSname{\F@style @fam}\CSname{\cs@a}}\cs@e
+ \endgroup\fi
+ \csarg\fam{\F@style @fam}}
+\newfam\roman@fam \def\roman@face@size{{foo}{bar}}
+\newfam\italic@fam \def\italic@face@size{{foo}{bar}}
+\newfam\bold@fam \def\bold@face@size{{foo}{bar}}
+\newfam\tty@fam \def\tty@face@size{{foo}{bar}}
+\def\ifface@size@changed{\iftrue}
+\def\temporarily@out@of@order
+ {\edef\cs@a{\csn\F@style @face@size\ecs}
+ \if\EqualString{\F@name}{\xp\take@former\cs@a}
+ \if\EqualString{\Fsize}{\xp\take@latter\cs@a}
+ \csn iffalse\xp\xp\xp\ecs
+ \else \Tmessage[font]{Loading family <\F@style>}
+ \csarg\edef{\F@style @face@size}%
+ {{\F@name}{\Fsize}}
+ \csn iftrue\xp\xp\xp\ecs\fi
+ \else \Tmessage[font]{Loading family <\F@style>}
+ \csarg\edef{\F@style @face@size}%
+ {{\F@name}{\Fsize}}
+ \csn iftrue\xp\ecs \fi}
+
+% Define relative sizes,
+% and install math fonts,
+% loading if necessary
+%
+\def\@setsize#1#2#3{%
+ \def\normal{\def\Fsize{#1}\SetFont}\relax
+ \def\script{\def\Fsize{#2}\SetFont}\relax
+ \def\scriptscript{\def\Fsize{#3}\SetFont}\relax
+ \def\style@sizes{#1,#2,#3 }}
+\newif\ifloading@math
+\def\math@setsize#1,#2,#3 {%
+ \SaveFont \loading@mathyes
+ \set@mathfont{#1}\textfont
+ \set@mathfont{#2}\scriptfont
+ \set@mathfont{#3}\scriptscriptfont
+ \RestoreFont \loading@mathno
+ }
+
+% these lines are in 'text.tex'
+%\everymath{\the\every@everymath}
+%\everydisplay{\the\every@everymath}
+%\every@everymath{\high@fam\count18\relax \xp\math@setsize\style@sizes}
+
+% Strut: .8\baselineskip+.2\baselineskip
+% note: struts should be locally defined!
+%
+\def\make@strut{\tempdima=.8\baselineskip \tempdimb=.2\baselineskip
+ \edef\strut{\vrule height \the\tempdima width \z@
+ depth \the\tempdimb \relax}}
+
+% Main Font
+% is the font that's current at the end of the style definition
+% this is switched to in the output routine (head/footline!)
+% and the user can use it too.
+% this does not take properly care of baselineskip and strut.
+% nor math fonts, come to think of it.
+%
+\def\store@main@font
+ {\edef\MainFace{\def\nxp\F@name{\F@name}}
+ \SaveFont \let\MainFont\RestoreFont}
+\let\MainFont\relax %cs is used in output@setup, which may be called
+ %from lollipop.tex
+
+% Save and restore fonts
+%
+\def\SaveFont
+ {\edef\RestoreFont{\def\nxp\F@name{\F@name}%
+ \def\nxp\Fsize{\Fsize}%
+ \def\nxp\F@style{\F@style}%
+ \nxp\SetFont
+ \baselineskip=\the\baselineskip\relax
+ }
+ }
+\def\RestoreFont{\Wmessage{No `Savefont' has been given}}
+
+% Defined Fonts
+% rather limited, because not upscalable.
+%
+\def\DefineFont:#1=#2,#3,#4 {\begingroup
+ \Typeface:#2 \PointSize:#3 \Style:#4
+ \edef\cs@e{\global\let\CSname{#1}=\CSname{\current@font}}\cs@e
+ \endgroup}
+
+
+% Increase / decrease point size
+%
+\def\PointSizeLarger{\if\NextChar[%]
+ \ps@plus{\ps@plus[1]}}
+\def\PointSizeSmaller{\if\NextChar[%]
+ \ps@minus{\ps@minus[1]}}
+\def\ps@plus[#1]{\let\save@Fsize\Fsize
+ \tempcounta\Fsize\relax \advance\tempcounta#1\relax
+ \edef\Fsize{\the\tempcounta}\SetFont
+ \let\Fsize\save@Fsize}
+\def\ps@minus[{\ps@plus[-%]
+ }%]
+
+% Baselineskip
+%
+\def\BaselineSkip:#1 {\baselineskip\@ww{#1}\make@strut}
+\def\@ps@bls#1{ps@bls\romannumeral#1}
+\def\@@ps@bls#1{\tempcounta#1\relax\baselineskip\tempcounta pt
+ \baselineskip\bls@ps@ratio\baselineskip\relax}
+\def\BaselineSkipPointSizeRatio:#1 {\def\bls@ps@ratio{#1}}
+\BaselineSkipPointSizeRatio:1.2
+\def\PointSizeBaselineSkip:#1
+ {\edef\cs@e{\nxp\pointsize@baselineskip{\w@w{#1}}}\cs@e}%nxp?
+\def\pointsize@baselineskip#1{%also used in \PointSize
+ \if\UndefinedCS{\@ps@bls{#1}}\@@ps@bls{#1}%
+ \else \baselineskip\csname \@ps@bls{#1}\endcsname \fi
+ \make@strut}
+\def\SetPointSizeBaselineSkip:#1=#2
+ {\edef\cs@e{\w@w{#1}}%
+ \csarg\edef{\@ps@bls\cs@e}{\w@w{#2}}}
+
+\def\exblssizes#1{\ifcase#1\z@ \or \z@ \or \z@ \or \z@ \or \z@
+ \or 6.1pt %5
+ \or 7.3pt %6
+ \or 8.5pt %7
+ \or 9.7pt %8
+ \or 11pt %9
+ \or 12pt %10
+ \or 13pt %11
+ \or 14.5pt %12
+ \or 15.6pt %13
+ \or 16.8pt %14
+ \or 18pt %15
+ \or 19.2pt %16
+ \or 20.4pt %17
+ \or 21.6pt %18
+ \or 22.8pt %19
+ \or 24pt %20
+ \else \ifnum#1=24 28pt \else
+ \ifnum#1=30 36pt \else
+ \ifnum#1=32 38pt \else
+ \ifnum#1=48 56pt \else
+ \z@ \Emessage{Unknown pointsize: #1}\fi\fi\fi\fi
+ \fi \normalbaselineskip\baselineskip}
+
+%%%% Math Fonts
+% Math fonts are loaded through the \everymath and \everydisplay.
+% This means that they are undefined outside math.
+% Therefore, any load during the style definition is global.
+%
+% Symbol and extension fonts don't change with type
+% Control sequences \m@.. are \let to 0 or 1 to indicate that
+% math at a certain size has been loaded
+
+% The ten point extension font is special because it is used
+% for all smaller sizes
+\font\exx=cmex10
+
+% Size to external name conversion for math fonts
+\def\mi@size#1{\ifcase#1 \or \or \or \or \or 5\or 6\or 7\or 8\or
+ 9\or 10\or 10 \sc@led \magstephalf \or 10 \sc@led \magstep1\or
+ \or 10 \sc@led \magstep2\or \or 10 \sc@led \magstep3\or
+ \or 10 \sc@led \magstep3\or \or 10 \sc@led \magstep4\fi}
+\let\sy@size=\mi@size \let\cm@size=\mi@size
+\def\ex@size#1{\ifnum#1<10 10 \else\mi@size{#1}\fi}
+
+
+% For a size, test if it has been loaded yet, if not do;
+% then install as given style
+%
+\def\set@mathfont#1#2%% #1=size #2=\text/script/scriptscript style
+ {\if\UndefinedCS{m@\romannumeral#1}\begingroup
+ \Tmessage[font]{Loading math style \string#2 at #1pt}%\globaldefs\@ne
+ \load@mathfammember{cm}{MathIT}{mi}{#1}\mi@size{'177}\relax
+ \load@mathfammember{cm}{MathSY}{sy}{#1}\sy@size{'060}\relax
+ \load@mathfammember{cm}{MathRM} {r}{#1}\cm@size{-1}\relax
+ \ifnum#1>10 \load@mathfammember{cm}{MathEX}{ex}{#1}\ex@size{-1}\relax
+ \else \global\csarg\let{MathEX\romannumeral#1}\exx
+ \fi
+ \global\csarg\let{m@\romannumeral#1}1\relax
+ \endgroup\fi
+ \if\UndefinedCS{\F@name VMI\romannumeral#1}\begingroup
+ \def\Fsize{#1}\def\F@style{mitalic}%
+ \load@mathfammember{\cs@face@tag}
+ {\F@name VMI}{\ext@style}{#1}
+ {\ext@size\take@one}{-1}\relax
+ \endgroup\fi
+ \def\Fsize{#1}\SetFont #20\the\font
+ #21 \csname MathIT\romannumeral#1\endcsname
+ #22 \csname MathSY\romannumeral#1\endcsname
+ #23 \csname MathEX\romannumeral#1\endcsname
+ #2\Kgriek \csname MathRM\romannumeral#1\endcsname
+ #2\VMIfam \csname \F@name VMI\romannumeral#1\endcsname}
+\def\load@mathfammember
+ #1#2#3#4#5#6%
+ %% #1=root of external name #2=internal tag
+ %% #3=external tag #4=size #5=size convertor #6=skew character
+ {\Tmessage[font]{Loading font (math)
+ \csname#2\romannumeral#4\endcsname=#1#3#5{#4}}%
+ \global\xp\font\csname#2\romannumeral#4\endcsname=
+ #1#3#5{#4}\relax
+ \global\xp\skewchar\csname#2\romannumeral#4\endcsname=#6\relax
+ }
+
+% Allocate a family for cmr, which has Greek capitals
+%
+\storecat"
+\ifini{\newfam\Kgriek}
+\mathchardef\Gamma="0\hexdigit\Kgriek 00
+\mathchardef\Delta="0\hexdigit\Kgriek 01
+\mathchardef\Theta="0\hexdigit\Kgriek 02
+\mathchardef\Lambda="0\hexdigit\Kgriek 03
+\mathchardef\Xi="0\hexdigit\Kgriek 04
+\mathchardef\Pi="0\hexdigit\Kgriek 05
+\mathchardef\Sigma="0\hexdigit\Kgriek 06
+\mathchardef\Upsilon="0\hexdigit\Kgriek 07
+\mathchardef\Phi="0\hexdigit\Kgriek 08
+\mathchardef\Psi="0\hexdigit\Kgriek 09
+\mathchardef\Omega="0\hexdigit\Kgriek 0A
+
+% Math italic variables have to be from the current typeface
+% maybe this should be switchable
+%
+\def\loop@redef@until#1{
+\loop \mathcode\tempcountb\tempcountc
+ \advance\tempcountb\@ne
+ \advance\tempcountc\@ne
+ \ifnum\tempcountb>#1\relax\else \repeat}
+\ifini{
+\newfam\VMIfam
+\tempcounta=-"100 \advance\tempcounta"\hexdigit\VMIfam00
+\tempcountb=`a \tempcountc=\mathcode`a
+\advance\tempcountc\tempcounta
+\loop@redef@until{`z}
+\tempcountb=`A \tempcountc=\mathcode`A
+\advance\tempcountc\tempcounta
+\loop@redef@until{`Z}
+}
+
+\restorecat"
+\def\cal{\fam2}
+
+% Typewriter is a bit of a problem
+%
+ \font\ttix=cmtt9
+ \font\ttx=cmtt10 \font\ttxi=cmtt10 \sc@led \magstephalf
+ \font\ttxii=cmtt10 \sc@led \magstep1
+ \font\ttxiv=cmtt10 \sc@led \magstep2
+ \font\ttxvii=cmtt10 \sc@led \magstep3
+ \font\ttxx=cmtt10 \sc@led \magstep4
+
+\def\tt{\Typeface:ComputerModern \Style:typewriter }
+\def\terugstreep{{\tt \char`\\}}
+
+% Typeface Definition
+% \DefineTypeface{Naam}{rump}{style:exts}{size:exts}{combo:exts}
+% after this \Typeface:Naam can be used
+% the rump and the extension construct the external file names
+%
+\def\DefineTypeface#1#2#3#4{\csarg\def{#1@code}{#2}
+ \csarg\def{#1@styles}{#3 }
+ \csarg\def{#1@sizes}{#4 }
+ \if\NextChar[%]
+ {\DefineTypeface@combos{#1}}{\DefineTypeface@combos{#1}[]}}
+\def\DefineTypeface@combos#1[#2]{\csarg\def{#1@combos}{#2}}
+
+\def\style@selector{\mswitch \xp\if\xp\EqualStringX\xp{\F@style} in: }
+\def\a@style@selector#1{\mswitch \xp\if\xp\EqualStringX\xp{#1} in: }
+\def\size@selector{\fswitch {\ifnum\Fsize} in: }
+\def\a@size@selector#1{\fswitch {\ifnum#1} in: }
+
+\def\ext@combo{\csname\F@name @combos\endcsname}
+\def\ext@style{\xp\xp\xp\style@selector
+ \csname\F@name @styles\endcsname\endswitch}
+\def\ext@size {\xp\xp\xp\size@selector
+ \csname\F@name @sizes\endcsname\endswitch}
+\def\ext@name{\csname\F@name @code\endcsname}
+
+%\noeol
+\endinput
+
+% 2014/04/16 defined \PointSizeScriptSizes:12
+% 92/11/05 math family setting
+% 93/07/03 removed \bold, \italic etc because of change in tools
+% 93/07/24 F@size -> Fsize, fontdefs file split off \ No newline at end of file
diff --git a/macros/lollipop/tex/lollipop-heading.tex b/macros/lollipop/tex/lollipop-heading.tex
new file mode 100644
index 0000000000..02f0a23596
--- /dev/null
+++ b/macros/lollipop/tex/lollipop-heading.tex
@@ -0,0 +1,49 @@
+% lollipop-heading.tex copyright 1992 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%% H E A D I N G S %%%%%%%%%%%%
+\@GenericConstruct{Heading}
+
+\newif\if@headed
+\add@generic@default{\add@after@command{\@headedno}}
+\add@Heading@default{\add@after@command{\@headedyes}}
+
+\add@Heading@default{\def\@afterpenalty{\penalty\@M}
+ \default@break@afterno}
+\add@Heading@default{\has@marksyes}
+
+\def\@DefineHeading{
+ \@DefineStopCommand{\relax}
+ \csarg\edef{\@name}%
+ {\@gen@open % this contains: \let\CSname{\@name Title}\nxp\tmp@title
+ \the\@main@options@list
+ \@gen@close}
+ }
+
+\@HeadingOption{TwoLines}{\switch {\if\EqualString{#1}}
+ {yes} {\add@after@command{\next@paragraph{\clubpenalty\M@
+ \next@paragraph{\global\clubpenalty\default@clubpenalty}}}}
+ {no} {\add@after@command{\clubpenalty\default@clubpenalty}}
+ {default} {\edef\cs@e{\nxp\add@after@command{\nxp\next@paragraph
+ {\clubpenalty\@w@w{#1}\relax\nxp\next@paragraph
+ {\global\clubpenalty\default@clubpenalty}}}}
+ \cs@e}
+ \endswitch}
+
+\endinput \ No newline at end of file
diff --git a/macros/lollipop/tex/lollipop-lists.tex b/macros/lollipop/tex/lollipop-lists.tex
new file mode 100644
index 0000000000..578610f2c6
--- /dev/null
+++ b/macros/lollipop/tex/lollipop-lists.tex
@@ -0,0 +1,362 @@
+% lollipop-lists.tex copyright 1992/3 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%% L I S T S
+
+
+\@GenericConstruct{List}
+
+\newif\if@initem \@initemyes \newif\if@alitem
+\newbox\@labelbox
+
+\def\item{\Emessage{Item command outside list}}
+
+% Breakpoints around a list
+%
+% first redefine generic defaults:
+% try not to break before, maybe not after,
+%
+\add@List@default{\def\@beforepenalty{\penalty1000 }}
+\add@List@default{\def\@afterpenalty{\penalty200 }}
+
+% between items is okay
+%
+\add@List@default{\def\@betweenpenalty{\penalty-50 }}
+\@ListOption{breakbetween}{
+ \switch {\if\EqualString{#1}}
+ {no} {\def\@betweenpenalty{\penalty\@M}}
+ {yes} {\def\@betweenpenalty{\CSname{\h@or@v fil}\penalty-\@M}}
+ {0} {\def\@betweenpenalty{}}
+ {default} {\edef\cs@e{\def\nxp\@betweenpenalty{\penalty\@w@w{#1}\relax}}
+ \cs@e}
+ \endswitch
+ }
+
+\newtoks\indent@depth
+\add@List@default{\indent@depth={}}
+
+\noeol
+\def\@DefineList{
+ \@DefineStopCommand{\nxp\xx@label \the\item@e@coms\@gen@close}
+ \csarg\edef{\@name}{\@gen@open
+ \ifitem@list \nxp\step@counter{itemlevel}\fi
+ \ifenum@list \nxp\step@counter{enumlevel}
+ \nxp\represent@counter{item}
+ {\nxp\enum@repr{\counter@@name{enumlevel}}}\fi
+ \ifleft@embedded@construct \previousindent\z@
+ \else \nxp\PushIndentLevel
+ \ifauto@indent \else \levelindent\the\indent@depth \fi
+ \parindent\levelindent
+ \fi
+ \nxp\@alitemno
+ \nxp\start@counter{item}%
+ \the\item@b@coms
+ \def\nxp\item@label{
+ \nxp\ifdim\wd\@labelbox>\tempdima
+ \ifitem@tab \advance\tempdima20pt\relax
+ {\nxp\item@label}
+ \else \iflabel@flow@right
+ \ifleft@embedded@construct
+ \else\hskip-\previousindent\fi
+ \box\@labelbox
+ \else \nxp\llap{\box\@labelbox}\fi\fi
+ \nxp\else \llap{\hbox to \tempdima
+ {\ifleft@item\else\hfil\fi
+ \box\@labelbox \ifleft@item\hfil\fi}}
+ \nxp\fi}%
+ \def\nxp\num@item
+ {\setbox\@labelbox=\hbox{\the\item@coms}
+ \tempdima\previousindent
+ \nxp\item@label %\nxp\Indent:no
+ \the\item@a@coms \nxp\xx@label}
+ \def\nxp\item
+ {\ifleft@embedded@construct
+ \else \nxp\if@alitem\@par%\CSname{@itembreek}%
+ \nxp\hold@parskip \nxp\fi \fi
+ \nxp\if\nxp\TestCounter:item >0 \@betweenpenalty \nxp\fi
+ \CSname{@\h@or@v white}{\white@between}
+ \nxp\@initemno \nxp\@alitemyes \nxp\noindent
+ \nxp\step@counter{item}\relax
+ \iflabel@defined\else\nxp\define@reference{item}\fi
+ \CSname{\@name @item}}
+ }
+ \csarg\edef{\@name @item}{
+ \iflist@has@description \nxp\desc@item
+ \else \nxp\num@item\fi}
+ \@Labelize{\@name @item}
+ }
+\normaleol
+
+% Inside a list Foo \item is defined as
+%
+% \item = all sorts of skips and switches
+% step item counter, define reference
+% \Foo@item
+%
+% \Foo@item[opt.lab.] = \desc@item or \num@item
+%
+% \desc@item =
+% { \aftergroup\num@item \@description}
+%
+% \num@item = \item@label \item@a@coms \xx@label
+%
+
+% Item
+% start with start/left/right
+% indicating alignment, start = left
+%
+\newif\ifleft@item \newif\ifitem@tab
+\add@List@default{\left@itemyes \item@tabno}
+\newtoks\item@coms % content of the item label
+\newtoks\item@b@coms % start of the list?
+\newtoks\item@a@coms % immediately after the item
+\newtoks\item@e@coms % after the whole list
+\add@List@default{\item@coms{}\item@b@coms{}\item@a@coms{}
+ \item@e@coms{}\def\@current@options@list{item@b@coms}}
+\@ListOption{item}{
+ \switch {\if\EqualString{#1}}
+ {stop} {\@add@toks{\egroup}\e@group
+ \def\@current@options@list{item@a@coms}}
+ {tabstop} {\item@tabyes
+ \@add@toks{\egroup}\e@group
+ \def\@current@options@list{item@a@coms}}
+ {left} {\global\left@itemyes
+ \b@group\def\@current@options@list{item@coms}%
+ \@add@toks{\bgroup}}
+ {start}{\global\left@itemyes
+ \b@group\def\@current@options@list{item@coms}%
+ \@add@toks{\bgroup}}
+ {right}{\global\left@itemno
+ \b@group\def\@current@options@list{item@coms}%
+ \@add@toks{\bgroup}}
+ {default} {\Emessage{Unknown option #1 for List, item}}
+ \endswitch}
+
+% Label overflow
+%
+\newif\iflabel@flow@right
+\add@List@default{\label@flow@rightyes}
+\@ListOption{labeloverflow}{
+ \if\EqualString{#1}{left}\label@flow@rightno
+ \else\label@flow@rightyes\fi}
+
+% Description
+% the line after \item gets picked up,
+% and becomes available as `description'
+%
+\newif\iflist@has@description
+\add@List@default{\list@has@descriptionno}
+\@ListOption{description}{
+ \global\list@has@descriptionyes \@add@toks{\description@text}}
+{\noeol
+ \othercr
+\gdef\@description{\bgroup\othercr \@@description}
+\gdef\@@description#1^^M
+ {\gdef\description@text{#1}%
+ \egroup % balance the \bgroup in \@description
+ % which kept the \othercr local
+ \egroup % balance the \bgroup in \desc@item
+ % which enabled the \aftergroup\num@item
+ }
+}
+\def\desc@item{\bgroup
+ \aftergroup\num@item
+ \@description}
+
+% White between items
+%
+\add@List@default{\def\white@between{0pt}}
+\@ListOption{whitebetween}{\def\white@between{#1}}
+% \edef\white@between{\@w@w{#1}}}
+
+% Indentation
+% is automatic (default) and level dependent
+% or explicit
+%
+\newif\ifauto@indent
+\add@List@default{\auto@indentyes}
+\@ListOption{indentation}{
+ \if\EqualString{#1}{automatic}\auto@indentyes
+ \else\auto@indentno
+ \edef\cs@e{\nxp\indent@depth={\@w@w{#1}}}\cs@e
+ \fi}
+
+% Tail of the list:
+% everything after the keyword 'text' is tail
+%
+\@ListOption{text}{\at@breakpointyes
+ \def\@current@options@list{item@e@coms}}
+
+%%%%%%%%%%%%%%%% List Nesting Counters
+%
+
+% Item sign
+% gives the default, level dependent marker
+%
+\new@@counter{itemlevel} \set@counter{itemlevel}0
+\newif\ifitem@list
+\add@List@default{\item@listno}
+\@ListOption{itemsign}{
+ \global\item@listyes
+ \edef\cs@e{\nxp\@add@toks
+ {\nxp\ifcustom@label\nxp\the\current@label
+ \nxp\else\nxp\item@sign\counter@@name{itemlevel}%
+ \nxp\fi}}
+ \cs@e}
+\def\@item@sign#1{itemsign\romannumeral#1}
+\def\item@sign#1{\if\UndefinedCS{\@item@sign{#1}}\@@item@sign{#1}%
+ \else \csname \@item@sign{#1}\endcsname \fi}
+\def\@@item@sign#1{\ifcase#1\relax\or
+ $\bullet$\or $\circ$ \or --\else $\cdot$\fi}
+\def\SetItemSign:#1=#2{\csarg\edef{\@item@sign{#1}}%
+ {\cswitch \ifx#2 in:
+ b $\bullet$;
+ c $\circ$;
+ d $\diamond$;
+ m ---;
+ n --;
+ . $\cdot$;
+ default $\cdot$;
+ \endswitch}}
+
+% Item Counter
+%
+% Allocate a bare bones counter
+\new@@counter{item}\represent@counter{item}1
+\newtoks\item@RL \item@RL{}
+
+% Keep track of enumerate list level
+%
+\new@@counter{enumlevel} \set@counter{enumlevel}0
+\newif\ifenum@list
+\add@List@default{\enum@listno}
+\@ListOption{itemCounter}{
+ \global\enum@listyes
+ \@add@toks{\pad@clear\ifcustom@label\the\current@label
+ \else\itemCounter\fi}
+ }
+\def\@enum@repr#1{enumrepr\romannumeral#1}
+\def\enum@repr#1{\if\UndefinedCS{\@enum@repr{#1}}\@@enum@repr{#1}%
+ \else \csname \@enum@repr{#1}\endcsname \fi}
+\def\@@enum@repr#1{\ifcase#1\relax\or
+ 1\or A\or I\or a\or i\else 1\fi}
+\def\SetItemCounterRepresentation:#1=#2{\csarg\edef{\@enum@repr{#1}}{#2}}
+
+%
+\def\@itembreek{\if@initem\par\fi}
+
+% Clear items for Widest.
+% this is rather susceptible for improvement.
+%
+\def\ClearFor:#1
+ {\def\widest@pad{#1}}
+\def\widest@pad{\m@ne}
+\def\pad@clear{\ifnum\widest@pad=\m@ne\else
+ \tempcounta\widest@pad
+ \advance\tempcounta-\LogTen{\cs@counter@name{item}}\relax
+ \hphantom{\ifcase\tempcounta \or 9\or 99 \or 999 \or 9999 \else 99999\fi
+ }%
+ \fi}
+
+%%%%%%%%%%%%%%%% Stripped Lists
+%
+% for use in external files
+%
+
+\@GenericConstruct{ExternalItem}%stripped list
+
+\add@ExternalItem@default{\extra@args\tw@}
+
+\noeol
+\def\@DefineExternalItem{
+ \@DefineStopCommand{\@gen@close}
+ \ifx\pre@fix\@empty \Wmessage{No file for external item: \@name}\fi
+ \edef\cs@e{\nxp\append@to@list
+ {\pre@fix @local@defs}
+ {\nxp\if\nxp\UndefinedCS{\@command}
+ \nxp\Wmessage{Item `\@name' not defined for `\pre@fix'}
+ \nxp\else
+ \let\CSname{\@name}\CSname{\@command}
+ \nxp\fi}}
+ \cs@e
+ \csarg\edef{\@command}##1##2{
+ \def\CSname{\@name Label}{##1}
+ \@gen@open\def\nxp\Page{##2}
+ \nxp\PushIndentLevel \let\nxp\nl\relax
+ \the\item@b@coms
+ \def\nxp\item{\ifleft@embedded@construct\else\noindent\fi
+ \setbox\@labelbox=\hbox{\the\item@coms}
+ \nxp\ifdim\wd\@labelbox>\previousindent
+ \iflabel@flow@right \hskip-\previousindent\box\@labelbox
+ \else \nxp\llap{\box\@labelbox}\fi
+ \nxp\else \llap{\hbox to \previousindent
+ {\ifleft@item\else\hfil\fi
+ \box\@labelbox \ifleft@item\hfil\fi}}
+ \nxp\fi}%
+ \ifexternal@item@has@item\nxp\item\the\item@a@coms\fi
+ \ifright@embedded@construct\else\@par\fi
+ \iflong@external\else\nxp\>\fi
+ }
+ }
+\normaleol
+
+\add@ExternalItem@default{\@whitebefore\z@toks}
+\add@ExternalItem@default{\@whiteafter\z@toks}
+\add@ExternalItem@default{\let\Page\@space
+ \csarg\let{\@name Label}\@space}
+
+% Specify for what external file this is meant
+%
+\@ExternalItemOption{file}{
+ \if\UndefinedCS{\file@ext@name{#1}}
+ \Emessage{File <#1> has not been defined yet}\fi
+ \def\pre@fix{#1}}
+
+\newif\iflong@external
+\add@ExternalItem@default{\long@externalno}
+\@ExternalItemOption{long}{
+ \csname long@external#1\endcsname}
+
+% Commands before and after
+% option 'title' is dummy
+%
+%\@ExternalItemOption{title}{}
+% dangerous: better rely on automatic titelization
+
+% Item
+% start with start/left/right
+% indicating alignment, start = left
+%
+\add@ExternalItem@default{\left@itemyes}
+\add@ExternalItem@default{\item@coms{}\item@b@coms{}\item@e@coms{}
+ \item@a@coms{}\def\@current@options@list{item@b@coms}}
+\newif\ifexternal@item@has@item
+\adds@ExternalItem@default{\external@item@has@itemno}
+\def\ExternalItem@item{\external@item@has@itemyes
+ \List@item}
+
+% Label overflow
+%
+\add@ExternalItem@default{\label@flow@rightyes}
+\let\ExternalItem@labeloverflow\List@labeloverflow
+
+\endinput
+
+% 92/11/26 itemsign / itemCounter changed to handle custom@label
+% 93/01/03 item call in ExternalItem made conditional \ No newline at end of file
diff --git a/macros/lollipop/tex/lollipop-output.tex b/macros/lollipop/tex/lollipop-output.tex
new file mode 100644
index 0000000000..57b0ef8332
--- /dev/null
+++ b/macros/lollipop/tex/lollipop-output.tex
@@ -0,0 +1,744 @@
+% lollipop-output.tex copyright 1992/3 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%% O U T P U T %%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\@GenericConstruct{PageGrid}
+
+\newif\if@pagegrid@installed
+\ifini{\next@paragraph
+ {\if@pagegrid@installed \else
+ \Wmessage{No page grid installed}\fi
+ }}
+\NewTrace:out
+\add@PageGrid@default{\text@constructno}
+\add@PageGrid@default{\has@marksyes}
+
+\newtoks\user@overrides
+\def\add@user@override#1{\append@to@list{user@overrides}{#1}}
+
+\newif\if@nubalanceren
+\newinsert\botins
+
+%%%% Page counting
+%
+% \count0 is the paper counter:
+% is increased for every \shipout in the output routine
+% \count1 is the page counter:
+% you can do with it whatever you like.
+
+% This appears to the users as if \NewCounter:Page had been done.
+% We do it by hand because the number has to be 1.
+%
+\countdef\sheet@counter=0
+\csarg\countdef{\counter@name{Page}}=1
+\edef\PageValue{\counter@@name{Page}}
+\CounterRepresentation:Page=1
+\newtoks\Page@RL %trudge trudge!
+\SetCounter:Page=1
+
+%%%% Tests
+%
+\DefineTest:IsRightPage
+\DefineTest:IsLeftPage
+\DefineTest:IsFirstPage
+\DefineTest:IsLastPage
+\DefineTest:FlushBottom
+
+%% anonieme cs'en zijn in gebruik bij opbouw en gebruik %%
+% \tempdima : / klad; gebruikt voor hoofdmeting; daarna in \text@column
+% \tempdimc : / klad; gebruikt voor voetmeting
+% \cs@a : in gebruik door \haalitems
+
+\def\slotpenalty{-10001}
+
+\def\@pseudoif#1#2{\tempcounta\escapechar \noesc
+ \edef\cs@e{\let\CSname{if@\string#1}\CSname{if\string#2}}\cs@e
+ \escapechar\tempcounta}
+\@pseudoif\IsFirstPage\true \@pseudoif\IsLastPage\true
+\@pseudoif\IsRightPage\true
+\@pseudoif\IsLeftPage\false
+
+\def\leftright@setup
+ {\csarg\ifodd{\counter@name{Page}}\relax
+ \IsRightPage:yes \IsLeftPage:no
+ \else \IsRightPage:no \IsLeftPage:yes
+ \fi}
+\def\firstpage@setup{\def\cs@a{yes}
+ \edef\cs@b{\xp\get@placed\xp{\firstmark}{first@page}}
+ \ifx\cs@a\cs@b \IsFirstPage:yes \else \IsFirstPage:no \fi}
+\def\lastpage@setup
+ {\ifnum\outputpenalty=\slotpenalty\relax
+ \Tmessage[out]{Last page}\IsLastPage:yes
+ \else \IsLastPage:no
+ \fi}
+\def\output@setup{\let\par\@par
+ \parindent\z@ \leftskip\z@ \rightskip\z@ \lineskip\z@
+ \default@everypar \MainFont
+ \leftright@setup \firstpage@setup \lastpage@setup
+ \@colnum\@ne \output@set@page@width
+ \Tmessage[out]{Incoming text: (\the\ht\@cclv+\the\dp\@cclv) x
+ \the\wd\@cclv}
+ }
+
+%%%%%%%%%%%%%%%% Head, Foot, Body
+%
+% Separate boxes are allocated for the page
+% head, body, and foot.
+% Head and foot contain static material, the
+% body contains the text. The body can be empty.
+%
+\newbox\page@head@box \newtoks\page@head@toks
+\page@head@toks{}
+\add@PageGrid@default
+ {\page@head@toks={\setbox\page@head@box=\vbox\bgroup}}
+\newdimen\head@height
+\def\measure@head{\head@height=\ht\page@head@box
+ \advance\head@height\dp\page@head@box
+ \Tmessage[out]{Head measurement: \the\head@height}}
+
+\newbox\page@foot@box \newtoks\page@foot@toks
+\page@foot@toks{}
+\add@PageGrid@default{\page@foot@toks=
+ {\setbox\page@foot@box=\vbox\bgroup}}
+\newdimen\foot@height
+\def\measure@foot{\foot@height=\ht\page@foot@box
+ \advance\foot@height\dp\page@foot@box
+ \Tmessage[out]{Foot measurement: \the\foot@height}}
+
+\def\goal@height@trace
+ {\tempdimb\text@height
+ \multiply\tempdimb\ifnum\user@n@cols=\m@ne\n@cols\else\user@n@cols\fi
+ \Tmessage[out]{Aim for text height: \the\text@height\@space
+ \ifnum\user@n@cols>\m@ne (\the\user@n@cols\@space columns;
+ total height: \the\tempdimb)
+ \else\ifnum\n@cols>\@ne (\the\n@cols\@space columns;
+ total height: \the\tempdimb)
+ \fi\fi}}
+
+\def\report@body@measurement{
+ \Tmessage[out]{Body measurement:
+ (\the\ht\page@body@box+\the\dp\page@body@box)
+ x\the\wd\page@body@box}
+ \ifvoid\topins\else
+ \Tmessage[out]{Top inserts: \the\ht\topins+\the\dp\topins}\fi
+ \ifvoid\botins\else
+ \Tmessage[out]{Foot inserts: \the\ht\footins+\the\dp\footins}\fi
+ }
+
+\newbox\page@body@box \newtoks\page@body@toks
+\page@body@toks{}
+\add@PageGrid@default
+ {\page@body@toks={\setbox\page@body@box=\vbox\bgroup}}
+
+\def\finish@part@routines
+ {\append@to@list{page@head@toks}{\egroup\measure@head}
+ \append@to@list{page@foot@toks}{\egroup\measure@foot}
+ \append@to@list{page@body@toks}{\egroup}}
+
+\newbox\WholePage
+\def\make@page{
+ \setbox\WholePage=\vbox
+ {\box\page@head@box
+ \ifabut@head\nointerlineskip\fi
+ \ifabut@foot\tempdima\dp\page@body@box\fi
+ \box\page@body@box
+ \ifabut@foot\ifvoid\page@foot@box\else
+ \kern-\tempdima\relax\nointerlineskip\fi\fi
+ \box\page@foot@box}%\showbox\WholePage
+ }
+
+% \vsize has two possibilities:
+% 1/ it is calculated dynamically by subtracting
+% body and foot height from the total page height.
+% If \vsize is different from \ht255, the page
+% is thrown back.
+% 2/ it is set and the page has whatever size results.
+%
+\newif\iftext@fits
+\def\see@if@text@fits
+ {{\multiply\text@height\n@cols
+ \tempdima\text@height
+ \advance\tempdima-\vsize
+ \ifdim\tempdima<\z@ \tempdima=-\tempdima \fi
+ \ifdim\tempdima<.1pt\relax
+ \global\text@fitsyes
+ \Tmessage[out]{Page accepted.}
+ \else \global\text@fitsno
+ \Tmessage[out]{Text does not fit. (vsize=\the\vsize)}
+ \global\vsize=\text@height
+ \fi}}
+
+% Multicolumn stuff
+%
+% every PageGrid macro installs \n@cols, but the user
+% can specify a different number with \NumberOfColumns:x
+% This sets \user@n@cols which is usually -1
+%
+\newcount\n@cols \n@cols\@ne
+\newcount\@colnum
+\newcount\user@n@cols \user@n@cols\m@ne
+\Distance:GutterWidth=1cm
+\def\NumberOfColumns:#1
+ {\user@n@cols=\w@w{#1}\relax
+ \Tmessage[out]{Switch to \the\user@n@cols\@space columns}
+ \hsize\page@width
+ \tempdima\GutterWidth \multiply\tempdima\user@n@cols
+ \advance\tempdima-\GutterWidth
+ \advance\hsize-\tempdima \divide\hsize\user@n@cols
+ \Tmessage[out]{New hsize: \the\hsize}}
+\add@user@override{\ifnum\user@n@cols=\m@ne\else
+ \csarg\let{\output@routine @body}\trivial@body
+ \n@cols\user@n@cols
+ \Tmessage[out]{User override: \the\n@cols\@space columns.}%
+ \fi}
+
+\def\trivial@body{\Tmessage[out]{Trivial multicolumn (\the\n@cols) setup}
+ \@colnum\@ne \splittopskip\topskip
+ \setbox\page@body@box\hbox{\text@column}
+ \@colnum\tw@
+ \ifnum\n@cols>\@ne
+ \loop \setbox\page@body@box\hbox{\unhbox\page@body@box
+ \kern\GutterWidth \text@column}
+ \advance\@colnum\@ne
+ \ifnum\@colnum>\n@cols\else\repeat
+ \fi}
+\def\real@text@column{\begingroup\vbadness\@M
+ \setbox\z@
+ \ifnum\n@cols=\@ne
+ \vbox to \vsize{\boxmaxdepth\maxdepth
+ \ifvoid\topins\else\unvbox\topins \fi
+ \unvbox\@cclv % open up \box255
+ \ifvoid\footins\else % footnote info is present
+ \vskip\skip\footins
+ \footnoterule
+ \unvbox\footins \fi}%
+ \Tmessage[out]{Column: \the\ht\z@+\the\dp\z@}%
+ \else
+ \vsplit\@cclv to \text@height
+ \Tmessage[out]{Column \the\@colnum: \the\ht\z@+\the\dp\z@}%
+ \fi \ifnum\badness=\@M\Wmessage{Underfull textcolumn}\fi
+ \box\z@ \endgroup}
+
+\def\CurrentShipout{\shipout\box\WholePage}
+\let\OriginalShipout\CurrentShipout
+\newif\ifCountSheets \CountSheetsyes
+\def\finish@off@page{\Tmessage[out]{Whole page:
+ \the\ht\WholePage+\the\dp\WholePage}
+ {\def\protect{\noexpand\protect\noexpand}
+ \def\cprotect{\expandafter\string}
+ \normalesc
+ \ifsink@pages
+ \message{Page sunk [\the\sheet@counter.\csarg\the
+ {\counter@name{Page}}]}
+ \deadcycles\z@
+ \else \CurrentShipout
+ \ifCountSheets\global\advance\sheet@counter\@ne\fi
+ \fi
+ }
+ \global\step@counter{Page}
+ }
+\def\shipout@and@unbox@remainder{
+ \iftext@fits \make@page \finish@off@page \fi
+ \ifvoid\@cclv \Tmessage[out]{Shipped out whole page}
+ \else \Tmessage[out]{Part of page not shipped: \the\ht\@cclv}
+ \unvbox\@cclv
+ \ifnum\outputpenalty=\@M\else\penalty\outputpenalty\fi
+ \fi
+ \iftext@fits \ifother@grid\install@next@page@grid
+ \else\Tmessage[out]{Same grid once again.}\fi
+ \fi}
+
+\newif\ifsink@pages
+\sink@pagesno
+\let\NoPages\sink@pagesyes \let\PagesOut\sink@pagesno
+
+% this is a mess. clear up please.
+\newtoks\page@options
+\def\options@to@pagepart
+ {\append@toks@cs@to@list{page@\page@part @toks}\page@options
+ \page@options={}}
+\add@PageGrid@default{\csarg\newtoks{\@name @routine}
+ \def\@current@options@list{page@options}
+ \def\page@part{head}\page@options{}
+ }
+
+\def\install@output@routine#1{{\globaldefs\@ne
+ \output=\xp{\csname#1@routine\endcsname}%
+ \def\output@routine{#1}%
+ \Tmessage[out]{Install output: #1 ---}%
+ \@pagegrid@installedyes
+ \csname#1@install@parameters\endcsname
+ }}
+
+\newdimen\text@height
+
+% During the load of this file we build up a list of
+% defaults and test. These are then turned into PageGrid@default
+% at the end of this file.
+\newtoks\otr@settings \newtoks\otr@conditions
+\def\add@otr@setting#1{\append@to@list{otr@settings}{#1}}
+\def\del@otr@setting#1{\del@tok@from@list{otr@settings}#1}
+\def\add@otr@condition#1{\append@to@list{otr@conditions}{#1}}
+\def\set@otr@stuff{\def\cs@e##1{
+ \edef\cs@f{\nxp\adds@PageGrid@default{\global##1={\the##1}}}
+ \cs@f}
+ \cs@e\otr@settings \cs@e\otr@conditions}
+%\showthe\otr@settings \showthe\otr@conditions
+%\showthe\PageGrid@defaults}
+
+\def\@DefinePageGrid{\options@to@pagepart \finish@part@routines
+ \csarg\edef{\@name @install@parameters}{%
+ \vsize\the\height@toks\relax \set@topskip
+ \multiply\vsize
+ \nxp\ifnum\user@n@cols>\@ne\user@n@cols\relax
+ \nxp\else\the\n@cols\relax\nxp\fi
+ \hsize\the\width@toks\relax
+ \def\CSname{\@name @page@width}%
+ {\the\width@toks\relax}%
+ \nxp\Tmessage[out]{Initial hsize: \nxp\the\hsize}%
+ \ifwidth@of@text
+ \else \nxp\hsize@from@page@width
+ \ifnum\the\n@cols>1
+ \divide\hsize\the\n@cols\relax\fi
+ \fi
+ \nxp\Tmessage[out]{Installed hsize: \nxp\the\hsize}%
+ }
+ \csarg\edef{\@name @otr@parameters}{%
+ \the\otr@settings
+ \xp\@empty\the\otr@conditions
+ \CSname{height@of@text\ifheight@of@text yes\else no\fi}%
+ \text@height\the\height@toks\relax
+ \CSname{width@of@text\ifwidth@of@text yes\else no\fi}%
+ \n@cols\the\n@cols\relax}
+ \csarg\edef{\@name @head@foot}{\the\page@head@toks
+ \the\page@foot@toks
+ \ifheight@of@text\else
+ \advance\text@height-\head@height
+ \advance\text@height-\foot@height
+ \fi}
+ \csarg\edef{\@command @body}{\the\page@body@toks}
+ \csarg\edef{\@command}{%
+ \nxp\EjectPage
+ \nxp\install@output@routine{\@name}%
+ %\global\hsize= \ifseen@text \CSname{\@name @text@width}%
+ % \else \CSname{\next@page@grid @text@width}%
+ % \fi
+ \outer@start@commands \after@indent
+ }
+ \csarg\edef{\@name @routine}{
+ \nxp\Tmessage[out]{======== Output routine: \@name\@space ==========}
+ \nxp\output@setup
+ \CSname{\@name @otr@parameters}
+ \nxp\the\user@overrides
+ \CSname{\@name @head@foot}
+ \nxp\goal@height@trace
+ \ifnum\n@cols=\z@ %% no text, trivial case.
+ \setbox\page@body@box\voidb@x
+ \nxp\text@fitsyes
+ \else \nxp\ifragged@bottom\nxp\text@fitsyes
+ \nxp\else\nxp\see@if@text@fits\nxp\fi
+ \nxp\iftext@fits
+ \let\nxp\text@column\nxp\real@text@column
+ \tempcounta\hbadness\hbadness\@M\CSname{\@name @body}
+ \nxp\ifnum\badness>\tempcounta
+ \nxp\Wmessage{Underfull page body}\nxp\fi
+ \hbadness\tempcounta\nxp\report@body@measurement
+ \nxp\fi
+ \fi
+ \nxp\shipout@and@unbox@remainder
+ \nxp\Tmessage[out]{==========}%
+ }
+ \xp\install@output@routine\xp{\@name}
+ }
+
+% not operative yet.
+\new@dimen{user@page@height}{\m@ne sp}
+\new@dimen{user@text@height}{\m@ne sp}
+\def\Height:#1=#2
+ {\switch {\if\EqualString{#1}}
+ {Page} {\user@page@height\w@w{#2}}
+ {Text} {\user@text@height\w@w{#2}}
+ {default} {\Wmessage{Unknown option: `Height:#1=#2'}}
+ \endswitch}
+
+%-- height of page/text
+%
+% the \ifheight@of@text conditional is also used
+% during run time.
+%
+\newif\ifheight@of@text
+\newtoks\height@toks \newdimen\page@height
+\add@PageGrid@default{\height@of@textyes\height@toks{20cm}}
+\add@PageGrid@default{\let\text@lines\relax}
+\@PageGridOption{height}{
+ \switch {\if\EqualString{#1}}
+ {page} {\height@of@textno}
+ {text} {\height@of@textyes}
+ {lines} {\height@of@textyes
+ \edef\cs@e{\def\nxp\text@lines{\@w@w{#2}}}\cs@e}
+ {default} {\Wmessage{Strange modifier: `height:#1=#2'}}
+ \endswitch
+ \edef\cs@e{\nxp\height@toks={\@w@w{#2}}}\cs@e
+ }
+% Make sure that the \Height command is not used!
+\@PageGridNOOP{Height}
+
+%%%%
+%
+% Width handling
+%
+\newif\ifwidth@of@text
+\newtoks\width@toks \newdimen\page@width
+\@PageGridOption{width}{
+ \switch {\if\EqualString{#1}}
+ {page} {\width@of@textno}
+ {text} {\width@of@textyes}
+ {default} {\Wmessage{Strange modifier: `width:#1=#2'}}
+ \endswitch
+ \edef\cs@e{\nxp\width@toks={\@w@w{#2}}}\cs@e
+ }
+
+% Make sure that the \Width command is not used!
+\@PageGridNOOP{Width}
+
+% At installation of the output routine, calculate the hsize
+% if the page width is given.
+%
+\def\hsize@from@page@width
+ {\def\text@column{\hskip\z@\relax}%
+ \everyhbox{}\everyvbox{}%
+ \let\maybe@to@page@width\relax
+ \the\page@body@toks
+%\ifdim\wd\page@body@box>0pt \showthe\page@body@toks \fi
+ \Tmessage[out]{Width page body minus text: \the\wd\page@body@box}%
+ \global\advance\hsize-\wd\page@body@box}
+
+% At the start of the output routine, calculate the page width
+% from the hsize (which may have been tinkered with), or set to
+% routine-specific page width (which may also have been changed).
+%
+\def\output@set@page@width
+ {\ifwidth@of@text
+ \edef\text@column{\hskip\the\wd\@cclv\relax\hskip\z@\relax}%
+ \let\maybe@to@page@width\relax
+ \csn\output@routine @body\ecs
+ \page@width\wd\page@body@box
+ \Tmessage[out]{Deduced page width: \the\page@width}
+ \else \def\maybe@to@page@width{ to \page@width}
+ \page@width\csn\output@routine @page@width\ecs\relax
+ \fi}
+
+%%%% Topskip
+% initially the outer topskip is picked up, unless
+% the option 'topskip' is given.
+%
+\add@PageGrid@default
+ {\edef\set@topskip
+ {\topskip\the\topskip\relax\splittopskip\topskip}}
+\@PageGridOption{topskip}{
+ \edef\cs@e
+ {\def\nxp\set@topskip{\topskip\@w@w{#1}\relax
+ \splittopskip\topskip}}
+ \cs@e
+ }
+% ragged bottom the way it's done in plain TeX.
+\newif\ifragged@bottom
+\add@otr@setting{\ragged@bottomno}
+\@PageGridOption{raggedbottom}{
+ \del@otr@setting{\ragged@bottomno}
+ \add@otr@setting{\ragged@bottomyes}
+ \if\IsEmptyList{#1}\@add@toks{\var@topskip{60pt}}
+ \else\edef\cs@e{\nxp\@add@toks{\nxp\var@topskip{\@w@w{#1}}}}
+ \cs@e
+ \fi}
+\def\var@topskip#1{\tempdima\topskip\tempskipa\z@ plus #1\relax
+ \topskip\tempdima \advance\topskip\tempskipa
+ \splittopskip\topskip}
+
+%-- textband
+\newif\ifin@textband \add@PageGrid@default{\in@textbandno}
+\@PageGridOption{textband}{
+ \switch {\if\EqualString{#1}}
+ {start} {\start@textband}
+ {stop} {\stop@textband}
+ {default} {\Wmessage{Strange modifier `textband:#1'}}
+ \endswitch}
+\newdimen\text@width
+\def\start@textband
+ {\options@to@pagepart
+ \b@group[textband]\@hmodeyes\in@textbandyes
+ \@add@toks{\hbox \maybe@to@page@width\bgroup}
+ }
+\def\stop@textband
+ {\@add@toks{\egroup} \e@group[textband]
+ \ifseen@text \before@textno
+ \def\page@part{body} \options@to@pagepart
+ \def\page@part{foot}
+ \fi}
+
+%-- band
+\newif\ifabut@foot \newif\ifabut@head
+\add@otr@setting{\abut@footno \abut@headno}
+\@PageGridOption{band}{
+ \switch {\if\EqualString{#1}}
+ {start} {\@add@toks{\hbox to \page@width\bgroup}
+ \b@group[band]\@hmodeyes
+ \def\block@closing{\@add@toks{\hfil\egroup}
+ \e@group[band]}}
+ {invisible} {\@add@toks{\setbox\tempboxa
+ \hbox to \page@width\bgroup}
+ \b@group[band]\@hmodeyes
+ \def\block@closing{\@add@toks{\hfil\egroup}
+ \ifbefore@text
+ \@add@toks{\vtop to\z@{\kern\z@\box\tempboxa\vss}
+ \nointerlineskip}
+ \del@otr@setting{\abut@headno}
+ \add@otr@setting{\abut@headyes}
+ %\global\abut@headyes
+ \else \@add@toks{\nointerlineskip
+ \vbox to\z@{\vss\box\tempboxa}}
+ \del@otr@setting{\abut@footno}
+ \add@otr@setting{\abut@footyes}
+ %\global\abut@footyes
+ \fi\e@group[band]}}
+ {stop} {\block@closing}
+ {default} {\Wmessage{Strange modifier `band:#1'}}
+ \endswitch}
+
+
+%-- next page grid
+\newif\ifother@grid
+\add@PageGrid@default{\other@gridno}
+\add@otr@setting{\other@gridno}
+\add@otr@condition{\ifother@grid
+ \def\nxp\install@next@page@grid
+ {\nxp\install@output@routine{\next@page@grid}}%
+ \fi}
+\@PageGridOption{NextPageGrid}{\other@gridyes
+ \del@otr@setting{\other@gridno}
+ \add@otr@setting{\other@gridyes}
+ \def\next@page@grid{#1}
+ }
+
+%-- text
+\add@PageGrid@default{\n@cols\z@}
+\newif\ifbefore@text
+\newif\ifseen@text %this one is also used by 'external'
+\add@PageGrid@default{\before@textyes \seen@textno}
+\@PageGridOption{text}{\global\seen@textyes
+ \ifin@textband\else\Emessage{'text' has to be in 'textband'}\fi
+ \global\advance\n@cols\@ne
+ \@add@toks{\text@column}}
+
+%%%%%%%%%%%%%%%%%%%%%%% user commands
+
+\def\leegbladinvoegen{\@g@stapteller{Page}}
+\def\EjectPage{\vfil\eject}
+\def\ToRecto{\csarg\ifodd{\counter@name{Page}}\else\step@counter{Page}\fi}
+\def\ToVerso{\csarg\ifodd{\counter@name{Page}}\step@counter{Page}\fi}
+
+% less useful user command (mostly for formatting the manual :-)
+%
+\newbox\saved@page@box \newdimen\saved@hsize \newcount\saved@pageno
+\newtoks\saved@mark@items
+\def\SuspendOutput{\xdef\saved@output@routine{\output@routine}%
+ \let\saved@shipout\CurrentShipout
+ \global\saved@hsize\hsize \global\saved@mark@items\mark@items
+ \global\saved@pageno\cs@counter@name{Page}%
+ \output{\global\setbox\saved@page@box\box\@cclv
+ \Tmessage[out]{Suspend output @\the\saved@pageno;
+ saved (\the\ht\saved@page@box+\the\dp\saved@page@box)
+ x \the\wd\saved@page@box}%
+ \global\output{\Emessage{You should not call output now!}%
+ \OriginalShipout\box\@cclv}}%
+ \eject
+ }
+\def\ResumeOutput
+ {\xp\install@output@routine\xp{\saved@output@routine}%
+ \let\CurrentShipout\saved@shipout
+ \global\hsize\saved@hsize \global\mark@items\saved@mark@items
+ \global\cs@counter@name{Page}\saved@pageno
+ \unvbox\saved@page@box
+ \Tmessage[out]{Resume output}%
+ }
+
+%%%%%%%%%%%%%%%% Marks
+%%%%
+\NewTrace:mark
+\def\FirstPlaced:#1
+ {\Tmessage[mark]{First Placed #1 from \firstmark}%
+ \xp\get@placed\xp{\firstmark}{#1}}
+\def\PreviousPlaced:#1
+ {\Tmessage[mark]{Previous Placed #1 from \topmark}%
+ \xp\get@placed\xp{\topmark}{#1}}
+\def\LastPlaced:#1
+ {\Tmessage[mark]{Last Placed #1 from \botmark}%
+ \xp\get@placed\xp{\botmark}{#1}}
+\def\get@placed#1#2{%
+ \get@@placed{#2}#1{SM}{}$}% SM: StopMarker
+\def\get@@placed#1#2#3{\if\EqualStringX{#2}{SM}\xp\take@to@dollar
+ \else\if\EqualStringX{#1}{#2}%
+ \maybe@uppercase{#3}\xp\xp\xp\take@to@dollar
+ \else\xp\xp\xp\get@@placed\fi
+ \fi{#1}}
+\ifini{\newtoks\mark@items}
+ % \newtoks\mark@toks % is this one used?
+
+\newif\ifhas@marks
+\add@generic@default{\has@marksno}
+ % only yes in heading and output routine.
+ % it seems that you can have page breaks at marks...
+\@GenericOption{nomarks}{\has@marksno}
+\def\add@mark@item#1{\csarg\newtoks{mark@toks@#1}%
+ \Tmessage[mark]{Adding mark item #1}%
+ \global\mark@items\xp{\the\mark@items{#1}}}
+\def\refresh@mark@item#1#2{\csarg\global{mark@toks@#1}{#2}}
+\def\get@mark@items#1{\if\EqualStringX{#1}{SM}%
+ \else{#1}{\csarg\the{mark@toks@#1}}\xp\get@mark@items
+ \fi}
+\def\place@mark{\mark{\xp\get@mark@items\the\mark@items{SM}}}
+
+% this one should be defined in document.tex
+\add@mark@item{first@page}
+
+% Page wide rule
+
+\@PageGridOption{pagerule}{
+ \@add@toks{\hrule width\page@width\relax\nobreak}}
+
+% Set default otr@settings and otr@conditions
+\set@otr@stuff
+
+\endinput
+
+92/10/24 raggedbottom in progress
+92/11/04 splittopskip made equal to topskip
+92/11/14 messed with otr@xyz token lists
+92/11/15 warning on underfull text column;
+ ragged bottom still not working properly
+93/01/17 box \WholePage, new definition of \CurrentShipout
+
+
+%%%%%%%%%%%%%%%%%%%%%% Old Stuff; maybe useful, maybe not
+
+\newskip\@topS \newskip\@botS
+{\noeol
+\othercr
+\gdef\topillustratie{\bgroup\othercr \@topill}
+\gdef\@topill:#1=#2^^M{\edef\cs@e{\gdef\CSname{@topS#1}{#2}}
+ \cs@e \global\advance\@topS #2\egroup}
+\gdef\botillustratie{\bgroup\othercr \@botill}
+\gdef\@botill:#1=#2^^M{\edef\cs@e{\gdef\CSname{@botS#1}{#2}}
+ \cs@e \global\advance\@botS #2\egroup}}
+
+\def\@wisill{\global\@topS\z@ \global\@botS\z@
+ \csarg\gdef{@topS1}{\z@}\csarg\gdef{@botS1}{\z@}
+ \csarg\gdef{@topS2}{\z@}\csarg\gdef{@botS2}{\z@}
+ \csarg\gdef{@topS3}{\z@}\csarg\gdef{@botS3}{\z@}
+ }
+\@wisill
+
+\newtoks\@stramienlijst
+\def\invoerpad{}
+\def\opmaak: #1\par{\@stramienlijst={}
+ \def\cs@a##1 {\eqstring{##1}{klaar}{}%
+ {\append@to@list{@stramienlijst}{\@probeerstramien ##1;}
+ \cs@a}}
+ \cs@a #1klaar }%% let op de significante spaties!!
+ %% en de spatie achter het laatste stramien komt van de ^^M
+\def\invoer: #1 {
+ \def\@probeerstramien ##1;{\csn ##1\ecs
+ \message{Ik probeer het met opmaak: ##1}
+ \@installeertellers{##1}
+ \input \invoerpad#1.tex
+ \vfill\eject
+ \@bewaartellers{##1}
+ }
+ \the\@stramienlijst}
+
+%% uitloop van vorige output routine
+% iftempf: als pagina geen uitloop gebruikt, direct eventuele
+% uitloop leeg gooien.
+% laatste pagina: tempboxa <- vbox{unvcopy255}
+% er wordt een pagina uitgeworpen:
+% - 255 is void: invoer is op, dus uitlopen
+% als dit de laatste pagina was
+% - 255 non-void: er is iets terug te werpen; dit was kennelijk niet
+% de laatste pagina, dus geen uitloop.
+
+\newbox\@uitloop \newbox\@tempuitloop \newif\ifisereenuitloop
+ \Tmessage[out]{Aangetroffen uitloop: \the\ht\@uitloop+\the\dp\@uitloop}
+
+%-- uitloop
+% mag alleen in kop of voet voorkomen.
+\setbox\@tempuitloop=
+ \vbox{\ifvoid\topins\else\unvcopy\topins\fi
+ \unvcopy\@cclv\kern\z@}
+\setbox\@tempuitloop=\hbox{}
+\@PageGridOption{uitloop}{\tempfyes
+ \@add@toks{\Tmessage[out]{Uitloop wordt verwerkt.}%
+ \copy\@uitloop
+ }}
+
+ \iftempd
+ \iftempc \Tmessage[out]{Eerste pagina, derhalve:}
+ \@loopnietuit \else \@loopuit \fi
+ \else \Tmessage[out]{Niet de laatste pagina, derhalve:}
+ \@loopnietuit \fi
+
+ \iftempf \else \nxp\@uitloopwegwerpen \fi %geheugenbesparing.
+
+\def\@loopuit{\global\isereenuitloopyes
+ \global\setbox\@uitloop=\box\@tempuitloop
+ \Tmessage[out]{Uitloop: \the\ht\@uitloop+\the\dp\@uitloop}}
+\def\@loopnietuit{\global\isereenuitloopno \@uitloopwegwerpen}
+\def\@uitloopwegwerpen{
+ \Tmessage[out]{Uitloop weggegooid: \the\ht\@uitloop+\the\dp\@uitloop}
+ \global\setbox\@uitloop=\hbox{}}
+
+%-- veld %% is deze nog nodig nu we 'tekstblok' generisch hebben?
+\@PageGridOption{veld}{
+ \eqstring{#1}{stop}%
+ {\@add@toks{\egroup}}%
+ {\@add@toks{\vtop\bgroup\kern0cm}
+ \eqstring{#1}{uitvullen}{}%
+ {\@add@toks{\hsize=\w@w{#1}}
+ \iftempc\advance\text@width-\w@w{#1}\fi}
+ }}
+%-- parallel Nog eens goed over nadenken.
+\@PageGridOption{parallel}{
+ \eqstring{#1}{stop}%
+ {\@add@toks{\vfil\egroup\egroup}}%
+ {\@add@toks{\vtop\bgroup\kern0cm
+ \vbox to \vsize\bgroup}% dit is fout.
+ \eqstring{#1}{uitvullen}{}%
+ {\iftempc\advance\text@width-\w@w{#1}\relax\fi
+ \@add@toks{\hsize=\w@w{#1}}}
+ }}
+%-- kolommenbalanceren
+% heeft alleen zin voor meerkoloms uitvoer,
+% werkt alleen op laatste pagina
+\@PageGridOption{kolommenbalanceren}{
+ \eqstring{#1}{}{\tempgyes}{\csn tempg#1\ecs}}
+
+\endinput
+
+% 2016/04/14 Added \footnoterule to \real@text@column \ No newline at end of file
diff --git a/macros/lollipop/tex/lollipop-plain.tex b/macros/lollipop/tex/lollipop-plain.tex
new file mode 100644
index 0000000000..96a3ed703d
--- /dev/null
+++ b/macros/lollipop/tex/lollipop-plain.tex
@@ -0,0 +1,1249 @@
+% This is lollipop-plain.tex, the version of plain.tex adapted to the
+% Lollipop format of Victor Eijkhout and Vafa Khalighi.
+% copyright 1991/92 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+\catcode`\{=1 % left brace is begin-group character
+\catcode`\}=2 % right brace is end-group character
+\catcode`\$=3 % dollar sign is math shift
+\catcode`\&=4 % ampersand is alignment tab
+\catcode`\#=6 % hash mark is macro parameter character
+\catcode`\^=7 \catcode`\^^K=7 % circumflex and uparrow are for superscripts
+\catcode`\_=8 \catcode`\^^A=8 % underline and downarrow are for subscripts
+\catcode`\^^I=10 % ascii tab is a blank space
+\chardef\active=13 \catcode`\~=\active % tilde is active
+\chardef\ignored=9 \chardef\other=12
+\catcode`\^^L=\active \outer\def^^L{\par} % ascii form-feed is "\outer\par"
+
+% We had to define the \catcodes right away, before the message line,
+% since \message uses the { and } characters.
+% When INITEX (the TeX initializer) starts up,
+% it has defined the following \catcode values:
+% \catcode`\^^@=9 % ascii null is ignored
+% \catcode`\^^M=5 % ascii return is end-line
+% \catcode`\\=0 % backslash is TeX escape character
+% \catcode`\%=14 % percent sign is comment character
+% \catcode`\ =10 % ascii space is blank space
+% \catcode`\^^?=15 % ascii delete is invalid
+% \catcode`\A=11 ... \catcode`\Z=11 % uppercase letters
+% \catcode`\a=11 ... \catcode`\z=11 % lowercase letters
+% all others are type 12 (other)
+
+% INITEX sets up \mathcode x=x, for x=0..127, except that
+% \mathcode x=x+"7100, for x = `A to `Z and `a to `z;
+% \mathcode x=x+"7000, for x = `0 to `9.
+% The following changes define internal codes as recommended
+% in Appendix C of The TeXbook:
+\mathcode`\^^@="2201 % \cdot
+\mathcode`\^^A="3223 % \downarrow
+\mathcode`\^^B="010B % \alpha
+\mathcode`\^^C="010C % \beta
+\mathcode`\^^D="225E % \land
+\mathcode`\^^E="023A % \lnot
+\mathcode`\^^F="3232 % \in
+\mathcode`\^^G="0119 % \pi
+\mathcode`\^^H="0115 % \lambda
+\mathcode`\^^I="010D % \gamma
+\mathcode`\^^J="010E % \delta
+\mathcode`\^^K="3222 % \uparrow
+\mathcode`\^^L="2206 % \pm
+\mathcode`\^^M="2208 % \oplus
+\mathcode`\^^N="0231 % \infty
+\mathcode`\^^O="0140 % \partial
+\mathcode`\^^P="321A % \subset
+\mathcode`\^^Q="321B % \supset
+\mathcode`\^^R="225C % \cap
+\mathcode`\^^S="225B % \cup
+\mathcode`\^^T="0238 % \forall
+\mathcode`\^^U="0239 % \exists
+\mathcode`\^^V="220A % \otimes
+\mathcode`\^^W="3224 % \leftrightarrow
+\mathcode`\^^X="3220 % \leftarrow
+\mathcode`\^^Y="3221 % \rightarrow
+\mathcode`\^^Z="8000 % \ne
+\mathcode`\^^[="2205 % \diamond
+\mathcode`\^^\="3214 % \le
+\mathcode`\^^]="3215 % \ge
+\mathcode`\^^^="3211 % \equiv
+\mathcode`\^^_="225F % \lor
+\mathcode`\ ="8000 % \space
+\mathcode`\!="5021
+\mathcode`\'="8000 % ^\prime
+\mathcode`\(="4028
+\mathcode`\)="5029
+\mathcode`\*="2203 % \ast
+\mathcode`\+="202B
+\mathcode`\,="613B
+\mathcode`\-="2200
+\mathcode`\.="013A
+\mathcode`\/="013D
+\mathcode`\:="303A
+\mathcode`\;="603B
+\mathcode`\<="313C
+\mathcode`\=="303D
+\mathcode`\>="313E
+\mathcode`\?="503F
+\mathcode`\[="405B
+\mathcode`\\="026E % \backslash
+\mathcode`\]="505D
+\mathcode`\_="8000 % \_
+\mathcode`\{="4266
+\mathcode`\|="026A
+\mathcode`\}="5267
+\mathcode`\^^?="1273 % \smallint
+
+% INITEX sets \uccode`x=`X and \uccode `X=`X for all letters x,
+% and \lccode`x=`x, \lccode`X=`x; all other values are zero.
+% No changes to those tables are needed in plain TeX format.
+
+% INITEX sets \sfcode x=1000 for all x, except that \sfcode`X=999
+% for uppercase letters. The following changes are needed:
+\sfcode`\)=0 \sfcode`\'=0 \sfcode`\]=0
+% The \nonfrenchspacing macro will make further changes to \sfcode values.
+
+% Finally, INITEX sets all \delcode values to -1, except \delcode`.=0
+\delcode`\(="028300
+\delcode`\)="029301
+\delcode`\[="05B302
+\delcode`\]="05D303
+\delcode`\<="26830A
+\delcode`\>="26930B
+\delcode`\/="02F30E
+\delcode`\|="26A30C
+\delcode`\\="26E30F
+% N.B. { and } should NOT get delcodes; otherwise parameter grouping fails!
+
+% To make the plain macros more efficient in time and space,
+% several constant values are declared here as control sequences.
+% If they were changed, anything could happen; so they are private symbols.
+\chardef\@ne=1
+\chardef\tw@=2
+\chardef\thr@@=3
+\chardef\sixt@@n=16
+\chardef\@cclv=255
+\mathchardef\@cclvi=256
+\mathchardef\@m=1000
+\mathchardef\@M=10000
+\mathchardef\@MM=20000
+
+% Allocation of registers
+
+% Here are macros for the automatic allocation of \count, \box, \dimen,
+% \skip, \muskip, and \toks registers, as well as \read and \write
+% stream numbers, \fam codes, \language codes, and \insert numbers.
+
+% When a register is used only temporarily, it need not be allocated;
+% grouping can be used, making the value previously in the register return
+% after the close of the group. The main use of these macros is for
+% registers that are defined by one macro and used by others, possibly at
+% different nesting levels. All such registers should be defined through
+% these macros; otherwise conflicts may occur, especially when two or more
+% macro packages are being used at once.
+
+% The following counters are reserved:
+% 0 to 9 page numbering
+% 10 count allocation
+% 11 dimen allocation
+% 12 skip allocation
+% 13 muskip allocation
+% 14 box allocation
+% 15 toks allocation
+% 16 read file allocation
+% 17 write file allocation
+% 18 math family allocation
+% 19 language allocation
+% 20 insert allocation
+% 21 the most recently allocated number
+% 22 constant -1
+% New counters are allocated starting with 23, 24, etc. Other registers are
+% allocated starting with 10. This leaves 0 through 9 for the user to play
+% with safely, except that counts 0 to 9 are considered to be the page and
+% subpage numbers (since they are displayed during output). In this scheme,
+% \count 10 always contains the number of the highest-numbered counter that
+% has been allocated, \count 14 the highest-numbered box, etc.
+% Inserts are given numbers 254, 253, etc., since they require a \count,
+% \dimen, \skip, and \box all with the same number; \count 20 contains the
+% lowest-numbered insert that has been allocated. Of course, \box255 is
+% reserved for \output; \count255, \dimen255, and \skip255 can be used freely.
+
+% It is recommended that macro designers always use
+% \global assignments with respect to registers numbered 1, 3, 5, 7, 9, and
+% always non-\global assignments with respect to registers 0, 2, 4, 6, 8, 255.
+% This will prevent ``save stack buildup'' that might otherwise occur.
+
+\count10=22 % allocates \count registers 23, 24, ...
+\count11=9 % allocates \dimen registers 10, 11, ...
+\count12=9 % allocates \skip registers 10, 11, ...
+\count13=9 % allocates \muskip registers 10, 11, ...
+\count14=9 % allocates \box registers 10, 11, ...
+\count15=9 % allocates \toks registers 10, 11, ...
+\count16=-1 % allocates input streams 0, 1, ...
+\count17=-1 % allocates output streams 0, 1, ...
+\count18=3 % allocates math families 4, 5, ...
+\count19=0 % allocates \language codes 1, 2, ...
+\count20=255 % allocates insertions 254, 253, ...
+\countdef\insc@unt=20 % the insertion counter
+\countdef\allocationnumber=21 % the most recent allocation
+\countdef\m@ne=22 \m@ne=-1 % a handy constant
+\def\wlog{\immediate\write\m@ne} % write on log file (only)
+
+% Here are abbreviations for the names of scratch registers
+% that don't need to be allocated.
+
+\countdef\count@=255
+\dimendef\dimen@=0
+\dimendef\dimen@i=1 % global only
+\dimendef\dimen@ii=2
+\skipdef\skip@=0
+\toksdef\toks@=0
+
+% Now, we define \newcount, \newbox, etc. so that you can say \newcount\foo
+% and \foo will be defined (with \countdef) to be the next counter.
+% To find out which counter \foo is, you can look at \allocationnumber.
+% Since there's no \boxdef command, \chardef is used to define a \newbox,
+% \newinsert, \newfam, and so on.
+
+% Be able to save the allocation state. Write streams are
+% excepted from this.
+\def\SaveAlloc{\xdef\RestoreAlloc
+ {\begingroup\globaldefs=1
+ \count10=\the\count10 \count11=\the\count11 \count12=\the\count12
+ \count13=\the\count13 \count14=\the\count14 \count15=\the\count15
+ \count16=\the\count16 %\count17=\the\count17
+ \count18=\the\count18
+ \endgroup}}
+%LP no longer outer; switch off trace in these macros
+\def\@@newcount{\alloc@0\count\countdef\insc@unt}
+\def\@@newdimen{\alloc@1\dimen\dimendef\insc@unt}
+\def\@@newskip{\alloc@2\skip\skipdef\insc@unt}
+\def\@@newmuskip{\alloc@3\muskip\muskipdef\@cclvi}
+\def\@@newbox{\alloc@4\box\chardef\insc@unt}
+\let\newtoks\relax
+\let\@@newtoks=\relax % we do this to allow plain.tex to be read in twice
+\def\@@newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}}
+\def\@@newtoks{\alloc@5\toks\toksdef\@cclvi}
+\def\@@newread{\alloc@6\read\chardef\sixt@@n}
+\def\@@newwrite{\alloc@7\write\chardef\sixt@@n}
+\def\@@newfam{\alloc@8\fam\chardef\sixt@@n}
+\def\@@newlanguage{\alloc@9\language\chardef\@cclvi}
+
+\def\newcount#1{\@TM@s\@@newcount#1\@TM@r}
+\def\newdimen#1{\@TM@s\@@newdimen#1\@TM@r}
+\def\newskip#1{\@TM@s\@@newskip#1\@TM@r}
+\def\newmuskip#1{\@TM@s\@@newmuskip#1\@TM@r}
+\def\newbox#1{\@TM@s\@@newbox#1\@TM@r}
+\let\newtoks=\relax % we do this to allow plain.tex to be read in twice
+\def\newhelp#1#2{\@TM@s\@@newhelp#1{#2}\@TM@r}
+\def\newtoks#1{\@TM@s\@@newtoks#1\@TM@r}
+\def\newread#1{\@TM@s\@@newread#1\@TM@r}
+\def\newwrite#1{\@TM@s\@@newwrite#1\@TM@r}
+\def\newfam#1{\@TM@s\@@newfam#1\@TM@r}
+\def\newlanguage#1{\@TM@s\@@newlanguage#1\@TM@r}
+\def\alloc@#1#2#3#4#5{\global\advance\count1#1by\@ne
+ \ch@ck#1#4#2% make sure there's still room
+ \allocationnumber=\count1#1%
+ \global#3#5=\allocationnumber
+ \wlog{\string#5=\string#2\the\allocationnumber}}
+\def\newinsert#1{\global\advance\insc@unt by\m@ne
+ \ch@ck0\insc@unt\count
+ \ch@ck1\insc@unt\dimen
+ \ch@ck2\insc@unt\skip
+ \ch@ck4\insc@unt\box
+ \allocationnumber=\insc@unt
+ \global\chardef#1=\allocationnumber
+ \wlog{\string#1=\string\insert\the\allocationnumber}}
+\def\ch@ck#1#2#3{\ifnum\count1#1<#2%
+ \else\errmessage{No room for a new #3}\fi}
+
+%% trace
+{\def\newcount{\alloc@0\count\countdef\insc@unt}
+ \def\newdimen{\alloc@1\dimen\dimendef\insc@unt}
+\newcount\@TM@c \newcount\@TC@c
+\newdimen\z@ \global\z@=0pt}
+\def\@TM@s{\@TC@c\tracingcommands \tracingcommands\z@
+ \@TM@c\tracingmacros \tracingmacros\z@
+ \relax}
+\def\@TM@r{\tracingmacros\@TM@c \tracingcommands\@TC@c}
+\let\x@TM@s\@TM@s \let\x@TM@r\@TM@r
+
+% Here are some examples of allocation.
+\newdimen\maxdimen \maxdimen=16383.99999pt % the largest legal <dimen>
+\newskip\hideskip \hideskip=-1000pt plus 1fill % negative but can grow
+\newskip\centering \centering=0pt plus 1000pt minus 1000pt
+\newdimen\p@ \p@=1pt % this saves macro space and time
+%V \newdimen\z@ \z@=0pt % defined above
+\newskip\z@skip \z@skip=0pt plus0pt minus0pt
+\newbox\voidb@x % permanently void box register
+
+% And here's a different sort of allocation:
+% For example, \newif\iffoo creates \footrue, \foofalse to go with \iffoo.
+\def\newif#1{%\@TM@s
+ \count@\escapechar \escapechar\m@ne
+ \expandafter\expandafter\expandafter
+ \xdef\@if#1{yes}{\let\noexpand#1=\noexpand\iftrue}%
+ \expandafter\expandafter\expandafter
+ \xdef\@if#1{true}{\let\noexpand#1=\noexpand\iftrue}%
+ \expandafter\expandafter\expandafter
+ \xdef\@if#1{no}{\let\noexpand#1=\noexpand\iffalse}%
+ \expandafter\expandafter\expandafter
+ \xdef\@if#1{false}{\let\noexpand#1=\noexpand\iffalse}%
+ \global\@if#1{no}% the condition starts out false
+ \escapechar\count@
+% \@TM@r
+}
+\def\@if#1#2{\csname\expandafter\if@\string#1#2\endcsname}
+{\uccode`1=`i \uccode`2=`f \uppercase{\gdef\if@12{}}} % `if' is required
+
+
+% Assign initial values to TeX's parameters
+
+% All of TeX's numeric parameters are listed here,
+% but the code is commented out if no special value needs to be set.
+% INITEX makes all parameters zero except where noted.
+
+\pretolerance=100
+\tolerance=200 % INITEX sets this to 10000
+\hbadness=1000
+\vbadness=1000
+\linepenalty=10
+\hyphenpenalty=50
+\exhyphenpenalty=50
+\binoppenalty=700
+\relpenalty=500
+\clubpenalty=150
+\widowpenalty=150
+\displaywidowpenalty=50
+\brokenpenalty=100
+\predisplaypenalty=10000
+% \postdisplaypenalty=0
+% \interlinepenalty=0
+% \floatingpenalty=0, set during \insert
+% \outputpenalty=0, set before TeX enters \output
+\doublehyphendemerits=10000
+\finalhyphendemerits=5000
+\adjdemerits=10000
+% \looseness=0, cleared by TeX after each paragraph
+% \pausing=0
+% \holdinginserts=0
+% \tracingonline=0
+% \tracingmacros=0
+% \tracingstats=0
+% \tracingparagraphs=0
+% \tracingpages=0
+% \tracingoutput=0
+\tracinglostchars=1
+% \tracingcommands=0
+% \tracingrestores=0
+% \language=0
+\uchyph=1
+% \lefthyphenmin=2 \righthyphenmin=3 set below
+% \globaldefs=0
+% \maxdeadcycles=25 % INITEX does this
+% \hangafter=1 % INITEX does this, also TeX after each paragraph
+% \fam=0
+% \mag=1000 % INITEX does this
+% \escapechar=`\\ % INITEX does this
+\defaulthyphenchar=`\-
+\defaultskewchar=-1
+% \endlinechar=`\^^M % INITEX does this
+\newlinechar=-1
+\delimiterfactor=901
+% \time=now % TeX does this at beginning of job
+% \day=now % TeX does this at beginning of job
+% \month=now % TeX does this at beginning of job
+% \year=now % TeX does this at beginning of job
+\showboxbreadth=5
+\showboxdepth=3
+\errorcontextlines=5
+
+\hfuzz=0.1pt
+\vfuzz=0.1pt
+\overfullrule=5pt
+\hsize=6.5in
+\vsize=8.9in
+\maxdepth=4pt
+\splitmaxdepth=\maxdimen
+\boxmaxdepth=\maxdimen
+% \lineskiplimit=0pt, changed by \normalbaselines
+\delimitershortfall=5pt
+\nulldelimiterspace=1.2pt
+\scriptspace=0.5pt
+% \mathsurround=0pt
+% \predisplaysize=0pt, set before TeX enters $$
+% \displaywidth=0pt, set before TeX enters $$
+% \displayindent=0pt, set before TeX enters $$
+\parindent=20pt
+% \hangindent=0pt, zeroed by TeX after each paragraph
+% \hoffset=0pt
+% \voffset=0pt
+
+% \baselineskip=0pt, changed by \normalbaselines
+% \lineskip=0pt, changed by \normalbaselines
+\parskip=0pt plus 1pt
+\abovedisplayskip=12pt plus 3pt minus 9pt
+\abovedisplayshortskip=0pt plus 3pt
+\belowdisplayskip=12pt plus 3pt minus 9pt
+\belowdisplayshortskip=7pt plus 3pt minus 4pt
+% \leftskip=0pt
+% \rightskip=0pt
+\topskip=10pt
+\splittopskip=10pt
+% \tabskip=0pt
+% \spaceskip=0pt
+% \xspaceskip=0pt
+\parfillskip=0pt plus 1fil
+
+\thinmuskip=3mu
+\medmuskip=4mu plus 2mu minus 4mu
+\thickmuskip=5mu plus 5mu
+
+% We also define special registers that function like parameters:
+\newskip\smallskipamount \smallskipamount=3pt plus 1pt minus 1pt
+\newskip\medskipamount \medskipamount=6pt plus 2pt minus 2pt
+\newskip\bigskipamount \bigskipamount=12pt plus 4pt minus 4pt
+\newskip\normalbaselineskip \normalbaselineskip=12pt
+\newskip\normallineskip \normallineskip=1pt
+\newdimen\normallineskiplimit \normallineskiplimit=0pt
+\newdimen\jot \jot=3pt
+\newcount\interdisplaylinepenalty \interdisplaylinepenalty=100
+\newcount\interfootnotelinepenalty \interfootnotelinepenalty=100
+
+% Definitions for preloaded fonts
+
+\def\magstephalf{1095 }
+\def\magstep#1{\ifcase#1 \@m\or 1200\or 1440\or 1728\or 2074\or 2488\fi\relax}
+
+% Fonts assigned to \preloaded are not part of "plain TeX",
+% but they are preloaded so that other format packages can use them.
+% For example, if another set of macros says "\font\ninerm=cmr9",
+% TeX will not have to reload the font metric information for cmr9.
+
+%\font\tenrm=cmr10 % roman text
+%\font\preloaded=cmr9
+%\font\preloaded=cmr8
+%\font\sevenrm=cmr7
+%\font\preloaded=cmr6
+%\font\fiverm=cmr5
+
+%\font\teni=cmmi10 % math italic %LP in lollipop-fonts.tex
+%\font\preloaded=cmmi9
+%\font\preloaded=cmmi8
+%\font\seveni=cmmi7
+%\font\preloaded=cmmi6
+%\font\fivei=cmmi5
+
+%\font\tensy=cmsy10 % math symbols %LP in lollipop-fonts.tex
+%\font\preloaded=cmsy9
+%\font\preloaded=cmsy8
+%\font\sevensy=cmsy7
+%\font\preloaded=cmsy6
+%\font\fivesy=cmsy5
+
+\font\tenex=cmex10 % math extension (This seems to be necessary here)
+
+%\font\preloaded=cmss10 % sans serif
+%\font\preloaded=cmssq8
+
+%\font\preloaded=cmssi10 % sans serif italic
+%\font\preloaded=cmssqi8
+
+%%\font\tenbf=cmbx10 % boldface extended
+%\font\preloaded=cmbx9
+%\font\preloaded=cmbx8
+%%\font\sevenbf=cmbx7
+%\font\preloaded=cmbx6
+%%\font\fivebf=cmbx5
+
+\font\tentt=cmtt10 % typewriter
+%\font\preloaded=cmtt9
+%\font\preloaded=cmtt8
+
+%\font\preloaded=cmsltt10 % slanted typewriter
+
+%%\font\tensl=cmsl10 % slanted roman
+%\font\preloaded=cmsl9
+%\font\preloaded=cmsl8
+
+%%\font\tenit=cmti10 % text italic
+%\font\preloaded=cmti9
+%\font\preloaded=cmti8
+%\font\preloaded=cmti7
+
+
+\let\preloaded=\undefined % preloaded fonts must be declared anew later.
+
+%LP \skewchar moved to lollipop-fonts.tex
+%\skewchar\teni='177 \skewchar\seveni='177 \skewchar\fivei='177
+%\skewchar\tensy='60 \skewchar\sevensy='60 \skewchar\fivesy='60
+
+% Macros for setting ordinary text
+
+\def\frenchspacing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m
+ \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
+\def\nonfrenchspacing{\sfcode`\.3000\sfcode`\?3000\sfcode`\!3000%
+ \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 }
+
+
+% VK define \normalbaselines
+\def\normalbaselines{\lineskip\normallineskip
+ \baselineskip\normalbaselineskip \lineskiplimit\normallineskiplimit}
+
+\def\^^M{\ } % control <return> = control <space>
+\def\^^I{\ } % same for <tab>
+
+\def\lq{`} \def\rq{'}
+\def\lbrack{[} \def\rbrack{]}
+
+\let\endgraf=\par \let\endline=\cr
+
+%LP In case we redefine \par, here is the original
+\let\@par=\par
+
+\def\space{ }
+\def\empty{}
+\def\null{\hbox{}}
+
+\let\bgroup={ \let\egroup=}
+
+%%%%%%%%%%%%%%%% Catcode alterations
+
+%%%% Dospecials
+%
+% (not counting ascii null, tab, linefeed, formfeed, return, delete)
+% Each symbol in the list is preceded by \do, which can be defined
+% if you want to do something to every item in the list.
+%
+% " added wrt plain definition
+%
+\def\dospecials{\@TM@s\do\ \do\\\do\{\do\}\do\$\do\&%
+ \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~\do\"\@TM@r}
+
+% handy abbrevs
+%
+\def\makeother#1{\catcode`#1\other}
+\def\othercr{\makeother\^^M\relax}
+\def\normalcr{\catcode`\^^M=5\relax}
+\def\activecr{\catcode`\^^M\active}
+\def\noeol{\endlinechar\m@ne}\def\normaleol{\endlinechar`\^^M\relax}
+\def\noesc{\escapechar\m@ne}\def\normalesc{\escapechar`\\\relax}
+
+% obeylines
+%
+% In \obeylines, we say `\let^^M=\par' instead of `\def^^M{\par}'
+% since this allows, for example, `\let\par=\cr \obeylines \halign{...'
+%
+% addition for empty lines
+%
+{\activecr % these lines must end with %
+ \gdef\obeylines{\activecr \def^^M{\@par\leavevmode\hbox{}}}%
+ \global\let^^M\@par} % this is in case ^^M appears in a \write
+
+% obeyspaces
+%
+% plain: {\obeyspaces\global\let =\space}
+% extended for initial spaces on a line
+%
+{\catcode`\ \active
+\gdef\obeyspaces{\catcode`\ \active\let =\@ospace}}
+\def\@ospace{\leavevmode{} }
+
+%LP minimal improvement over the original \loop macro
+\long\def\loop#1\repeat{\long\def\body{#1}\iterate}
+\def\iterate{\let\loopnext\relax \body \let\loopnext\iterate \fi
+ \loopnext}
+\let\repeat=\fi % this makes \loop...\if...\repeat skippable
+
+\def\thinspace{\kern .16667em }
+\def\negthinspace{\kern-.16667em }
+\def\enspace{\kern.5em }
+
+\def\enskip{\hskip.5em\relax}
+\def\quad{\hskip1em\relax}
+\def\qquad{\hskip2em\relax}
+
+\def\smallskip{\vskip\smallskipamount}
+\def\medskip{\vskip\medskipamount}
+\def\bigskip{\vskip\bigskipamount}
+
+\def\nointerlineskip{\prevdepth-1000\p@}
+\def\offinterlineskip{\baselineskip-1000\p@
+ \lineskip\z@ \lineskiplimit\maxdimen}
+
+\def\topglue{\nointerlineskip\vglue-\topskip\vglue} % for top of page
+\def\vglue{\afterassignment\vgl@\skip@=}
+\def\vgl@{\par \dimen@\prevdepth \hrule height\z@
+ \nobreak\vskip\skip@ \prevdepth\dimen@}
+\def\hglue{\afterassignment\hgl@\skip@=}
+\def\hgl@{\leavevmode \count@\spacefactor \vrule width\z@
+ \nobreak\hskip\skip@ \spacefactor\count@}
+
+\def~{\penalty\@M \ } % tie
+\def\slash{/\penalty\exhyphenpenalty} % a `/' that acts like a `-'
+
+\def\break{\penalty-\@M}
+\def\nobreak{\penalty \@M}
+\def\allowbreak{\penalty \z@}
+
+\def\filbreak{\par\vfil\penalty-200\vfilneg}
+\def\goodbreak{\par\penalty-500 }
+\def\eject{\par\break}
+\def\supereject{\par\penalty-\@MM}
+
+\def\removelastskip{\ifdim\lastskip=\z@\else\vskip-\lastskip\fi}
+\def\smallbreak{\par\ifdim\lastskip<\smallskipamount
+ \removelastskip\penalty-50\smallskip\fi}
+\def\medbreak{\par\ifdim\lastskip<\medskipamount
+ \removelastskip\penalty-100\medskip\fi}
+\def\bigbreak{\par\ifdim\lastskip<\bigskipamount
+ \removelastskip\penalty-200\bigskip\fi}
+
+\def\line{\hbox to\hsize}
+\def\leftline#1{\line{#1\hss}}
+\def\rightline#1{\line{\hss#1}}
+\def\centerline#1{\line{\hss#1\hss}}
+
+\def\rlap#1{\hbox to\z@{#1\hss}}
+\def\llap#1{\hbox to\z@{\hss#1}}
+
+\def\m@th{\mathsurround\z@}
+\def\underbar#1{$\setbox\z@\hbox{#1}\dp\z@\z@
+ \m@th \underline{\box\z@}$}
+
+\newbox\strutbox
+\setbox\strutbox=\hbox{\vrule height8.5pt depth3.5pt width\z@}
+\def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}
+
+\def\hidewidth{\hskip\hideskip} % for alignment entries that can stick out
+\def\ialign{\everycr{}\tabskip\z@skip\halign} % initialized \halign
+\newcount\mscount
+\def\multispan#1{\omit \mscount#1\relax
+ \loop\ifnum\mscount>\@ne \sp@n\repeat}
+\def\sp@n{\span\omit\advance\mscount\m@ne}
+
+%LP We keep the old tabbing macros
+\newif\ifus@ \newif\if@cr
+\newbox\tabs \newbox\tabsyet \newbox\tabsdone
+
+\def\cleartabs{\global\setbox\tabsyet\null \setbox\tabs\null}
+\def\settabs{\setbox\tabs\null \futurelet\next\sett@b}
+\let\+=\relax % in case this file is being read in twice
+\def\sett@b{\ifx\next\+\def\nxt{\afterassignment\s@tt@b\let\nxt}%
+ \else\let\nxt\s@tcols\fi \let\next\relax \nxt}
+\def\s@tt@b{\let\nxt\relax \us@false\m@ketabbox}
+\def\tabalign{\us@true\m@ketabbox} % non-\outer version of \+
+\outer\def\+{\tabalign}
+\def\s@tcols#1\columns{\count@#1\dimen@\hsize
+ \loop\ifnum\count@>\z@ \@nother \repeat}
+\def\@nother{\dimen@ii\dimen@ \divide\dimen@ii\count@
+ \setbox\tabs\hbox{\hbox to\dimen@ii{}\unhbox\tabs}%
+ \advance\dimen@-\dimen@ii \advance\count@\m@ne}
+
+\def\m@ketabbox{\begingroup
+ \global\setbox\tabsyet\copy\tabs
+ \global\setbox\tabsdone\null
+ \def\cr{\@crtrue\crcr\egroup\egroup
+ \ifus@\unvbox\z@\lastbox\fi\endgroup
+ \setbox\tabs\hbox{\unhbox\tabsyet\unhbox\tabsdone}}%
+ \setbox\z@\vbox\bgroup\@crfalse
+ \ialign\bgroup&\t@bbox##\t@bb@x\crcr}
+
+\def\t@bbox{\setbox\z@\hbox\bgroup}
+\def\t@bb@x{\if@cr\egroup % now \box\z@ holds the column
+ \else\hss\egroup \global\setbox\tabsyet\hbox{\unhbox\tabsyet
+ \global\setbox\@ne\lastbox}% now \box\@ne holds its size
+ \ifvoid\@ne\global\setbox\@ne\hbox to\wd\z@{}%
+ \else\setbox\z@\hbox to\wd\@ne{\unhbox\z@}\fi
+ \global\setbox\tabsdone\hbox{\box\@ne\unhbox\tabsdone}\fi
+ \box\z@}
+
+\chardef\%=`\%
+\chardef\&=`\&
+\chardef\#=`\#
+\chardef\$=`\$
+\chardef\ss="19
+\chardef\ae="1A
+\chardef\oe="1B
+\chardef\o="1C
+\chardef\AE="1D
+\chardef\OE="1E
+\chardef\O="1F
+\chardef\i="10 \chardef\j="11 % dotless letters
+\def\aa{\accent23a}
+\def\l{\char32l}
+\def\L{\leavevmode\setbox0\hbox{L}\hbox to\wd0{\hss\char32L}}
+
+\def\leavevmode{\unhbox\voidb@x} % begins a paragraph, if necessary
+\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em}}
+\def\AA{\leavevmode\setbox0\hbox{!}\dimen@\ht0\advance\dimen@-1ex%
+ \rlap{\raise.67\dimen@\hbox{\char'27}}A}
+
+\def\mathhexbox#1#2#3{\leavevmode
+ \hbox{$\m@th \mathchar"#1#2#3$}}
+\def\dag{\mathhexbox279}
+\def\ddag{\mathhexbox27A}
+\def\S{\mathhexbox278}
+\def\P{\mathhexbox27B}
+\def\Orb{\mathhexbox20D}
+
+\def\oalign#1{\leavevmode\vtop{\baselineskip\z@skip \lineskip.25ex%
+ \ialign{##\crcr#1\crcr}}} % put characters over each other
+\def\o@lign{\lineskiplimit\z@ \oalign}
+\def\ooalign{\lineskiplimit-\maxdimen \oalign}
+{\catcode`p=12 \catcode`t=12 \gdef\\#1pt{#1}} \let\getf@ctor=\\
+\def\sh@ft#1{\dimen@#1\kern\expandafter\getf@ctor\the\fontdimen1\font
+ \dimen@} % kern by #1 times the current slant
+\def\d#1{{\o@lign{\relax#1\crcr\hidewidth\sh@ft{-1ex}.\hidewidth}}}
+\def\b#1{{\o@lign{\relax#1\crcr\hidewidth\sh@ft{-3ex}%
+ \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}}}
+\def\c#1{{\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent24 #1%
+ \else\ooalign{\unhbox\z@\crcr\hidewidth\char24\hidewidth}\fi}}
+\def\copyright{{\ooalign{\hfil\raise.07ex\hbox{c}\hfil\crcr\Orb}}}
+
+\def\dots{\relax\ifmmode\ldots\else$\m@th\ldots\,$\fi}
+\def\TeX{\protect\@TeX}
+\def\@TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX}
+
+\def\`#1{{\accent18 #1}}
+\def\'#1{{\accent19 #1}}
+\def\v#1{{\accent20 #1}} \let\^^_=\v
+\def\u#1{{\accent21 #1}} \let\^^S=\u
+\def\=#1{{\accent22 #1}}
+\def\^#1{{\accent94 #1}} \let\^^D=\^
+\def\.#1{{\accent95 #1}}
+\def\H#1{{\accent"7D #1}}
+\def\~#1{{\accent"7E #1}}
+\def\"#1{{\accent"7F #1}}
+\def\t#1{{\edef\next{\the\font}\the\textfont1\accent"7F\next#1}}
+
+\def\hrulefill{\leaders\hrule\hfill}
+\def\dotfill{\cleaders\hbox{$\m@th \mkern1.5mu.\mkern1.5mu$}\hfill}
+\def\rightarrowfill{$\m@th\smash-\mkern-7mu%
+ \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
+ \mkern-7mu\mathord\rightarrow$}
+\def\leftarrowfill{$\m@th\mathord\leftarrow\mkern-7mu%
+ \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
+ \mkern-7mu\smash-$}
+\mathchardef\braceld="37A \mathchardef\bracerd="37B
+\mathchardef\bracelu="37C \mathchardef\braceru="37D
+\def\downbracefill{$\m@th \setbox\z@\hbox{$\braceld$}%
+ \braceld\leaders\vrule height\ht\z@ depth\z@\hfill\braceru
+ \bracelu\leaders\vrule height\ht\z@ depth\z@\hfill\bracerd$}
+\def\upbracefill{$\m@th \setbox\z@\hbox{$\braceld$}%
+ \bracelu\leaders\vrule height\ht\z@ depth\z@\hfill\bracerd
+ \braceld\leaders\vrule height\ht\z@ depth\z@\hfill\braceru$}
+
+%\outer\def\bye{\par\vfill\supereject\end}
+
+% Macros for math setting
+
+\let\sp=^ \let\sb=_
+\def\,{\mskip\thinmuskip}
+\def\>{\mskip\medmuskip}
+\def\;{\mskip\thickmuskip}
+\def\!{\mskip-\thinmuskip}
+\def\*{\discretionary{\thinspace\the\textfont2\char2}{}{}}
+{\catcode`\'=\active \gdef'{^\bgroup\prim@s}}
+\def\prim@s{\prime\futurelet\next\pr@m@s}
+\def\pr@m@s{\ifx'\next\let\nxt\pr@@@s \else\ifx^\next\let\nxt\pr@@@t
+ \else\let\nxt\egroup\fi\fi \nxt}
+\def\pr@@@s#1{\prim@s} \def\pr@@@t#1#2{#2\egroup}
+{\catcode`\^^Z=\active \gdef^^Z{\not=}} % ^^Z is like \ne in math
+{\catcode`\_=\active \global\let_=\_} % _ in math is either subscript or \_
+
+\mathchardef\alpha="010B
+\mathchardef\beta="010C
+\mathchardef\gamma="010D
+\mathchardef\delta="010E
+\mathchardef\epsilon="010F
+\mathchardef\zeta="0110
+\mathchardef\eta="0111
+\mathchardef\theta="0112
+\mathchardef\iota="0113
+\mathchardef\kappa="0114
+\mathchardef\lambda="0115
+\mathchardef\mu="0116
+\mathchardef\nu="0117
+\mathchardef\xi="0118
+\mathchardef\pi="0119
+\mathchardef\rho="011A
+\mathchardef\sigma="011B
+\mathchardef\tau="011C
+\mathchardef\upsilon="011D
+\mathchardef\phi="011E
+\mathchardef\chi="011F
+\mathchardef\psi="0120
+\mathchardef\omega="0121
+\mathchardef\varepsilon="0122
+\mathchardef\vartheta="0123
+\mathchardef\varpi="0124
+\mathchardef\varrho="0125
+\mathchardef\varsigma="0126
+\mathchardef\varphi="0127
+\mathchardef\Gamma="7000
+\mathchardef\Delta="7001
+\mathchardef\Theta="7002
+\mathchardef\Lambda="7003
+\mathchardef\Xi="7004
+\mathchardef\Pi="7005
+\mathchardef\Sigma="7006
+\mathchardef\Upsilon="7007
+\mathchardef\Phi="7008
+\mathchardef\Psi="7009
+\mathchardef\Omega="700A
+
+\mathchardef\aleph="0240
+\def\hbar{{\mathchar'26\mkern-9muh}}
+\mathchardef\imath="017B
+\mathchardef\jmath="017C
+\mathchardef\ell="0160
+\mathchardef\wp="017D
+\mathchardef\Re="023C
+\mathchardef\Im="023D
+\mathchardef\partial="0140
+\mathchardef\infty="0231
+\mathchardef\prime="0230
+\mathchardef\emptyset="023B
+\mathchardef\nabla="0272
+\def\surd{{\mathchar"1270}}
+\mathchardef\top="023E
+\mathchardef\bot="023F
+\def\angle{{\vbox{\ialign{$\m@th\scriptstyle##$\crcr
+ \not\mathrel{\mkern14mu}\crcr
+ \noalign{\nointerlineskip}
+ \mkern2.5mu\leaders\hrule height.34pt\hfill\mkern2.5mu\crcr}}}}
+\mathchardef\triangle="0234
+\mathchardef\forall="0238
+\mathchardef\exists="0239
+\mathchardef\neg="023A \let\lnot=\neg
+\mathchardef\flat="015B
+\mathchardef\natural="015C
+\mathchardef\sharp="015D
+\mathchardef\clubsuit="027C
+\mathchardef\diamondsuit="027D
+\mathchardef\heartsuit="027E
+\mathchardef\spadesuit="027F
+
+\mathchardef\coprod="1360
+\mathchardef\bigvee="1357
+\mathchardef\bigwedge="1356
+\mathchardef\biguplus="1355
+\mathchardef\bigcap="1354
+\mathchardef\bigcup="1353
+\mathchardef\intop="1352 \def\int{\intop\nolimits}
+\mathchardef\prod="1351
+\mathchardef\sum="1350
+\mathchardef\bigotimes="134E
+\mathchardef\bigoplus="134C
+\mathchardef\bigodot="134A
+\mathchardef\ointop="1348 \def\oint{\ointop\nolimits}
+\mathchardef\bigsqcup="1346
+\mathchardef\smallint="1273
+
+\mathchardef\triangleleft="212F
+\mathchardef\triangleright="212E
+\mathchardef\bigtriangleup="2234
+\mathchardef\bigtriangledown="2235
+\mathchardef\wedge="225E \let\land=\wedge
+\mathchardef\vee="225F \let\lor=\vee
+\mathchardef\cap="225C
+\mathchardef\cup="225B
+\mathchardef\ddagger="227A
+\mathchardef\dagger="2279
+\mathchardef\sqcap="2275
+\mathchardef\sqcup="2274
+\mathchardef\uplus="225D
+\mathchardef\amalg="2271
+\mathchardef\diamond="2205
+\mathchardef\bullet="220F
+\mathchardef\wr="226F
+\mathchardef\div="2204
+\mathchardef\odot="220C
+\mathchardef\oslash="220B
+\mathchardef\otimes="220A
+\mathchardef\ominus="2209
+\mathchardef\oplus="2208
+\mathchardef\mp="2207
+\mathchardef\pm="2206
+\mathchardef\circ="220E
+\mathchardef\bigcirc="220D
+\mathchardef\setminus="226E % for set difference A\setminus B
+\mathchardef\cdot="2201
+\mathchardef\ast="2203
+\mathchardef\times="2202
+\mathchardef\star="213F
+
+\mathchardef\propto="322F
+\mathchardef\sqsubseteq="3276
+\mathchardef\sqsupseteq="3277
+\mathchardef\parallel="326B
+\mathchardef\mid="326A
+\mathchardef\dashv="3261
+\mathchardef\vdash="3260
+\mathchardef\nearrow="3225
+\mathchardef\searrow="3226
+\mathchardef\nwarrow="322D
+\mathchardef\swarrow="322E
+\mathchardef\Leftrightarrow="322C
+\mathchardef\Leftarrow="3228
+\mathchardef\Rightarrow="3229
+\def\neq{\not=} \let\ne=\neq
+\mathchardef\leq="3214 \let\le=\leq
+\mathchardef\geq="3215 \let\ge=\geq
+\mathchardef\succ="321F
+\mathchardef\prec="321E
+\mathchardef\approx="3219
+\mathchardef\succeq="3217
+\mathchardef\preceq="3216
+\mathchardef\supset="321B
+\mathchardef\subset="321A
+\mathchardef\supseteq="3213
+\mathchardef\subseteq="3212
+\mathchardef\in="3232
+\mathchardef\ni="3233 \let\owns=\ni
+\mathchardef\gg="321D
+\mathchardef\ll="321C
+\mathchardef\not="3236
+\mathchardef\leftrightarrow="3224
+\mathchardef\leftarrow="3220 \let\gets=\leftarrow
+\mathchardef\rightarrow="3221 \let\to=\rightarrow
+\mathchardef\mapstochar="3237 \def\mapsto{\mapstochar\rightarrow}
+\mathchardef\sim="3218
+\mathchardef\simeq="3227
+\mathchardef\perp="323F
+\mathchardef\equiv="3211
+\mathchardef\asymp="3210
+\mathchardef\smile="315E
+\mathchardef\frown="315F
+\mathchardef\leftharpoonup="3128
+\mathchardef\leftharpoondown="3129
+\mathchardef\rightharpoonup="312A
+\mathchardef\rightharpoondown="312B
+
+\def\joinrel{\mathrel{\mkern-3mu}}
+\def\relbar{\mathrel{\smash-}} % \smash, because - has the same height as +
+\def\Relbar{\mathrel=}
+\mathchardef\lhook="312C \def\hookrightarrow{\lhook\joinrel\rightarrow}
+\mathchardef\rhook="312D \def\hookleftarrow{\leftarrow\joinrel\rhook}
+\def\bowtie{\mathrel\triangleright\joinrel\mathrel\triangleleft}
+\def\models{\mathrel|\joinrel=}
+\def\Longrightarrow{\Relbar\joinrel\Rightarrow}
+\def\longrightarrow{\relbar\joinrel\rightarrow}
+\def\longleftarrow{\leftarrow\joinrel\relbar}
+\def\Longleftarrow{\Leftarrow\joinrel\Relbar}
+\def\longmapsto{\mapstochar\longrightarrow}
+\def\longleftrightarrow{\leftarrow\joinrel\rightarrow}
+\def\Longleftrightarrow{\Leftarrow\joinrel\Rightarrow}
+\def\iff{\;\Longleftrightarrow\;}
+
+\mathchardef\ldotp="613A % ldot as a punctuation mark
+\mathchardef\cdotp="6201 % cdot as a punctuation mark
+\mathchardef\colon="603A % colon as a punctuation mark
+\def\ldots{\mathinner{\ldotp\ldotp\ldotp}}
+\def\cdots{\mathinner{\cdotp\cdotp\cdotp}}
+\def\vdots{\vbox{\baselineskip4\p@ \lineskiplimit\z@
+ \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
+\def\ddots{\mathinner{\mkern1mu\raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu
+ \raise4\p@\hbox{.}\mkern2mu\raise\p@\hbox{.}\mkern1mu}}
+
+\def\acute{\mathaccent"7013 }
+\def\grave{\mathaccent"7012 }
+\def\ddot{\mathaccent"707F }
+\def\tilde{\mathaccent"707E }
+\def\bar{\mathaccent"7016 }
+\def\breve{\mathaccent"7015 }
+\def\check{\mathaccent"7014 }
+\def\hat{\mathaccent"705E }
+\def\vec{\mathaccent"017E }
+\def\dot{\mathaccent"705F }
+\def\widetilde{\mathaccent"0365 }
+\def\widehat{\mathaccent"0362 }
+\def\overrightarrow#1{\vbox{\m@th\ialign{##\crcr
+ \rightarrowfill\crcr\noalign{\kern-\p@\nointerlineskip}
+ $\hfil\displaystyle{#1}\hfil$\crcr}}}
+\def\overleftarrow#1{\vbox{\m@th\ialign{##\crcr
+ \leftarrowfill\crcr\noalign{\kern-\p@\nointerlineskip}
+ $\hfil\displaystyle{#1}\hfil$\crcr}}}
+\def\overbrace#1{\mathop{\vbox{\m@th\ialign{##\crcr\noalign{\kern3\p@}
+ \downbracefill\crcr\noalign{\kern3\p@\nointerlineskip}
+ $\hfil\displaystyle{#1}\hfil$\crcr}}}\limits}
+\def\underbrace#1{\mathop{\vtop{\m@th\ialign{##\crcr
+ $\hfil\displaystyle{#1}\hfil$\crcr\noalign{\kern3\p@\nointerlineskip}
+ \upbracefill\crcr\noalign{\kern3\p@}}}}\limits}
+\def\skew#1#2#3{{\muskip\z@#1mu\divide\muskip\z@\tw@ \mkern\muskip\z@
+ #2{\mkern-\muskip\z@{#3}\mkern\muskip\z@}\mkern-\muskip\z@}{}}
+
+\def\lmoustache{\delimiter"437A340 } % top from (, bottom from )
+\def\rmoustache{\delimiter"537B341 } % top from ), bottom from (
+\def\lgroup{\delimiter"462833A } % extensible ( with sharper tips
+\def\rgroup{\delimiter"562933B } % extensible ) with sharper tips
+\def\arrowvert{\delimiter"26A33C } % arrow without arrowheads
+\def\Arrowvert{\delimiter"26B33D } % double arrow without arrowheads
+\def\bracevert{\delimiter"77C33E } % the vertical bar that extends braces
+\def\Vert{\delimiter"26B30D } \let\|=\Vert
+\def\vert{\delimiter"26A30C }
+\def\uparrow{\delimiter"3222378 }
+\def\downarrow{\delimiter"3223379 }
+\def\updownarrow{\delimiter"326C33F }
+\def\Uparrow{\delimiter"322A37E }
+\def\Downarrow{\delimiter"322B37F }
+\def\Updownarrow{\delimiter"326D377 }
+\def\backslash{\delimiter"26E30F } % for double coset G\backslash H
+\def\rangle{\delimiter"526930B }
+\def\langle{\delimiter"426830A }
+\def\rbrace{\delimiter"5267309 } \let\}=\rbrace
+\def\lbrace{\delimiter"4266308 } \let\{=\lbrace
+\def\rceil{\delimiter"5265307 }
+\def\lceil{\delimiter"4264306 }
+\def\rfloor{\delimiter"5263305 }
+\def\lfloor{\delimiter"4262304 }
+
+\def\bigl{\mathopen\big}
+\def\bigm{\mathrel\big}
+\def\bigr{\mathclose\big}
+\def\Bigl{\mathopen\Big}
+\def\Bigm{\mathrel\Big}
+\def\Bigr{\mathclose\Big}
+\def\biggl{\mathopen\bigg}
+\def\biggm{\mathrel\bigg}
+\def\biggr{\mathclose\bigg}
+\def\Biggl{\mathopen\Bigg}
+\def\Biggm{\mathrel\Bigg}
+\def\Biggr{\mathclose\Bigg}
+\def\big#1{{\hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}}}
+\def\Big#1{{\hbox{$\left#1\vbox to11.5\p@{}\right.\n@space$}}}
+\def\bigg#1{{\hbox{$\left#1\vbox to14.5\p@{}\right.\n@space$}}}
+\def\Bigg#1{{\hbox{$\left#1\vbox to17.5\p@{}\right.\n@space$}}}
+\def\n@space{\nulldelimiterspace\z@ \m@th}
+
+\def\choose{\atopwithdelims()}
+\def\brack{\atopwithdelims[]}
+\def\brace{\atopwithdelims\{\}}
+
+\def\sqrt{\radical"270370 }
+
+\def\mathpalette#1#2{\mathchoice{#1\displaystyle{#2}}%
+ {#1\textstyle{#2}}{#1\scriptstyle{#2}}{#1\scriptscriptstyle{#2}}}
+\newbox\rootbox
+\def\root#1\of{\setbox\rootbox
+ \hbox{$\m@th\scriptscriptstyle{#1}$}\mathpalette\r@@t}
+\def\r@@t#1#2{\setbox\z@\hbox{$\m@th#1\sqrt{#2}$}\dimen@\ht\z@
+ \advance\dimen@-\dp\z@
+ \mkern5mu\raise.6\dimen@\copy\rootbox \mkern-10mu\box\z@}
+\newif\ifv@ \newif\ifh@
+%% LP
+\let\v@true=\v@yes \let\v@false=\v@no
+\let\h@true=\h@yes \let\h@false=\h@no
+\def\vphantom{\v@true\h@false\ph@nt}
+\def\hphantom{\v@false\h@true\ph@nt}
+\def\phantom{\v@true\h@true\ph@nt}
+\def\ph@nt{\ifmmode\def\next{\mathpalette\mathph@nt}%
+ \else\let\next\makeph@nt\fi\next}
+\def\makeph@nt#1{\setbox\z@\hbox{#1}\finph@nt}
+\def\mathph@nt#1#2{\setbox\z@\hbox{$\m@th#1{#2}$}\finph@nt}
+\def\finph@nt{\setbox\tw@\null
+ \ifv@ \ht\tw@\ht\z@ \dp\tw@\dp\z@\fi
+ \ifh@ \wd\tw@\wd\z@\fi \box\tw@}
+\def\mathstrut{\vphantom(}
+\def\smash{\relax % \relax, in case this comes first in \halign
+ \ifmmode\def\next{\mathpalette\mathsm@sh}\else\let\next\makesm@sh
+ \fi\next}
+\def\makesm@sh#1{\setbox\z@\hbox{#1}\finsm@sh}
+\def\mathsm@sh#1#2{\setbox\z@\hbox{$\m@th#1{#2}$}\finsm@sh}
+\def\finsm@sh{\ht\z@\z@ \dp\z@\z@ \box\z@}
+
+\def\cong{\mathrel{\mathpalette\@vereq\sim}} % congruence sign
+\def\@vereq#1#2{\lower.5\p@\vbox{\lineskiplimit\maxdimen\lineskip-.5\p@
+ \ialign{$\m@th#1\hfil##\hfil$\crcr#2\crcr=\crcr}}}
+\def\notin{\mathrel{\mathpalette\c@ncel\in}}
+\def\c@ncel#1#2{\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}}
+\def\rightleftharpoons{\mathrel{\mathpalette\rlh@{}}}
+\def\rlh@#1{\vcenter{\m@th\hbox{\ooalign{\raise2pt
+ \hbox{$#1\rightharpoonup$}\crcr
+ $#1\leftharpoondown$}}}}
+\def\buildrel#1\over#2{\mathrel{\mathop{\kern\z@#2}\limits^{#1}}}
+\def\doteq{\buildrel\textstyle.\over=}
+
+\def\log{\mathop{\rm log}\nolimits}
+\def\lg{\mathop{\rm lg}\nolimits}
+\def\ln{\mathop{\rm ln}\nolimits}
+\def\lim{\mathop{\rm lim}}
+\def\limsup{\mathop{\rm lim\,sup}}
+\def\liminf{\mathop{\rm lim\,inf}}
+\def\sin{\mathop{\rm sin}\nolimits}
+\def\arcsin{\mathop{\rm arcsin}\nolimits}
+\def\sinh{\mathop{\rm sinh}\nolimits}
+\def\cos{\mathop{\rm cos}\nolimits}
+\def\arccos{\mathop{\rm arccos}\nolimits}
+\def\cosh{\mathop{\rm cosh}\nolimits}
+\def\tan{\mathop{\rm tan}\nolimits}
+\def\arctan{\mathop{\rm arctan}\nolimits}
+\def\tanh{\mathop{\rm tanh}\nolimits}
+\def\cot{\mathop{\rm cot}\nolimits}
+\def\coth{\mathop{\rm coth}\nolimits}
+\def\sec{\mathop{\rm sec}\nolimits}
+\def\csc{\mathop{\rm csc}\nolimits}
+\def\max{\mathop{\rm max}}
+\def\min{\mathop{\rm min}}
+\def\sup{\mathop{\rm sup}}
+\def\inf{\mathop{\rm inf}}
+\def\arg{\mathop{\rm arg}\nolimits}
+\def\ker{\mathop{\rm ker}\nolimits}
+\def\dim{\mathop{\rm dim}\nolimits}
+\def\hom{\mathop{\rm hom}\nolimits}
+\def\det{\mathop{\rm det}}
+\def\exp{\mathop{\rm exp}\nolimits}
+\def\Pr{\mathop{\rm Pr}}
+\def\gcd{\mathop{\rm gcd}}
+\def\deg{\mathop{\rm deg}\nolimits}
+
+\def\bmod{\nonscript\mskip-\medmuskip\mkern5mu
+ \mathbin{\rm mod}\penalty900\mkern5mu\nonscript\mskip-\medmuskip}
+\def\pmod#1{\allowbreak\mkern18mu({\rm mod}\,\,#1)}
+
+\def\cases#1{\left\{\,\vcenter{\normalbaselines\m@th
+ \ialign{$##\hfil$&\quad##\hfil\crcr#1\crcr}}\right.}
+\def\matrix#1{\null\,\vcenter{\normalbaselines\m@th
+ \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr
+ \mathstrut\crcr\noalign{\kern-\baselineskip}
+ #1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}\,}
+\def\pmatrix#1{\left(\matrix{#1}\right)}
+\newdimen\p@renwd
+\setbox0=\hbox{\tenex B} \p@renwd=\wd0 % width of the big left (
+\def\bordermatrix#1{\begingroup \m@th
+ \setbox\z@\vbox{\def\cr{\crcr\noalign{\kern2\p@\global\let\cr\endline}}%
+ \ialign{$##$\hfil\kern2\p@\kern\p@renwd&\thinspace\hfil$##$\hfil
+ &&\quad\hfil$##$\hfil\crcr
+ \omit\strut\hfil\crcr\noalign{\kern-\baselineskip}%
+ #1\crcr\omit\strut\cr}}%
+ \setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}%
+ \setbox\tw@\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
+ \setbox\tw@\hbox{$\kern\wd\@ne\kern-\p@renwd\left(\kern-\wd\@ne
+ \global\setbox\@ne\vbox{\box\@ne\kern2\p@}%
+ \vcenter{\kern-\ht\@ne\unvbox\z@\kern-\baselineskip}\,\right)$}%
+ \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}
+
+\def\openup{\afterassignment\@penup\dimen@=}
+\def\@penup{\advance\lineskip\dimen@
+ \advance\baselineskip\dimen@
+ \advance\lineskiplimit\dimen@}
+\def\eqalign#1{\null\,\vcenter{\openup\jot\m@th
+ \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$\hfil
+ \crcr#1\crcr}}\,}
+\newif\ifdt@p
+\let\dt@ptrue=\dt@pyes \let\dt@pfalse=\dt@pno %%LP
+\def\displ@y{\global\dt@ptrue\openup\jot\m@th
+ \everycr{\noalign{\ifdt@p \global\dt@pfalse \ifdim\prevdepth>-1000\p@
+ \vskip-\lineskiplimit \vskip\normallineskiplimit \fi
+ \else \penalty\interdisplaylinepenalty \fi}}}
+\def\@lign{\tabskip\z@skip\everycr{}} % restore inside \displ@y
+\def\displaylines#1{\displ@y \tabskip\z@skip
+ \halign{\hbox to\displaywidth{$\@lign\hfil\displaystyle##\hfil$}\crcr
+ #1\crcr}}
+\def\eqalignno#1{\displ@y \tabskip\centering
+ \halign to\displaywidth{\hfil$\@lign\displaystyle{##}$\tabskip\z@skip
+ &$\@lign\displaystyle{{}##}$\hfil\tabskip\centering
+ &\llap{$\@lign##$}\tabskip\z@skip\crcr
+ #1\crcr}}
+\def\leqalignno#1{\displ@y \tabskip\centering
+ \halign to\displaywidth{\hfil$\@lign\displaystyle{##}$\tabskip\z@skip
+ &$\@lign\displaystyle{{}##}$\hfil\tabskip\centering
+ &\kern-\displaywidth\rlap{$\@lign##$}\tabskip\displaywidth\crcr
+ #1\crcr}}
+
+% Definitions related to output
+
+%LP Voorlopig even laten staat voor een default output routine
+
+\countdef\pageno=0 \pageno=1 % first page is number 1
+
+\def\textindent#1{\indent\llap{#1\enspace}\ignorespaces}
+\newinsert\footins
+\def\footnote#1{\let\@sf\empty % parameter #2 (the text) is read later
+ \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
+ #1\@sf\vfootnote{#1}}
+\def\vfootnote#1{\insert\footins\bgroup
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\ht\strutbox % top baseline for broken footnotes
+ \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
+ \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
+ \textindent{#1}\footstrut\futurelet\next\fo@t}
+\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
+ \else\let\next\f@t\fi \next}
+\def\f@@t{\bgroup\aftergroup\@foot\let\next}
+\def\f@t#1{#1\@foot}
+\def\@foot{\strut\egroup}
+\def\footstrut{\vbox to\splittopskip{}}
+\skip\footins=\bigskipamount % space added when footnote is present
+\count\footins=1000 % footnote magnification factor (1 to 1)
+\dimen\footins=8in % maximum footnotes per page
+
+\newinsert\topins
+\newif\ifp@ge \newif\if@mid
+\let\p@getrue=\p@geyes \let\p@gefalse=\p@geno
+\let\@midtrue=\@midyes \let\@midfalse=\@midno
+\def\topinsert{\@midfalse\p@gefalse\@ins}
+\def\midinsert{\@midtrue\@ins}
+\def\pageinsert{\@midfalse\p@getrue\@ins}
+\skip\topins=\z@skip % no space added when a topinsert is present
+\count\topins=1000 % magnification factor (1 to 1)
+\dimen\topins=\maxdimen % no limit per page
+\def\@ins{\par\begingroup\setbox\z@\vbox\bgroup} % start a \vbox
+\def\endinsert{\egroup % finish the \vbox
+ \if@mid \dimen@\ht\z@ \advance\dimen@\dp\z@ \advance\dimen@12\p@
+ \advance\dimen@\pagetotal \advance\dimen@-\pageshrink
+ \ifdim\dimen@>\pagegoal\@midfalse\p@gefalse\fi\fi
+ \if@mid \bigskip\box\z@\bigbreak
+ \else\insert\topins{\penalty100 % floating insertion
+ \splittopskip\z@skip
+ \splitmaxdepth\maxdimen \floatingpenalty\z@
+ \ifp@ge \dimen@\dp\z@
+ \vbox to\vsize{\unvbox\z@\kern-\dimen@}% depth is zero
+ \else \box\z@\nobreak\bigskip\fi}\fi\endgroup}
+
+
+\def\footnoterule{\kern-3\p@
+ \hrule width 2truein \kern 2.6\p@} % the \hrule is .4pt high
+
+% Hyphenation, miscellaneous macros, and initial values for standard layout
+
+\lefthyphenmin=2 \righthyphenmin=3 % disallow x- or -xx breaks
+\input hyphen
+
+\def\magnification{\afterassignment\m@g\count@}
+\def\m@g{\mag\count@
+ \hsize6.5truein\vsize8.9truein\dimen\footins8truein}
+
+\def\loggingall{\tracingcommands\tw@\tracingstats\tw@
+ \tracingpages\@ne\tracingoutput\@ne\tracinglostchars\@ne
+ \tracingmacros\tw@\tracingparagraphs\@ne\tracingrestores\@ne
+ \showboxbreadth\maxdimen\showboxdepth\maxdimen\errorstopmode}
+\def\tracingall{\tracingonline\@ne\loggingall}
+
+\font\tenrm=cmr10 % aw hell.
+\def\showhyphens#1{\setbox0\vbox{\parfillskip\z@skip\hsize\maxdimen\tenrm
+ \pretolerance\m@ne\tolerance\m@ne\hbadness0\showboxdepth0\ #1}}
+
+
+\normalbaselines
+
+
+\endinput
+
+% 2016/04/16 Fixed the error caused by \newhelp
+% 2014/04/11 brought up to date with plain.tex for 3.141592653
+% 92/11/03 brought up to date with plain.tex for 3.0 \ No newline at end of file
diff --git a/macros/lollipop/tex/lollipop-text.tex b/macros/lollipop/tex/lollipop-text.tex
new file mode 100644
index 0000000000..d90c0a16b8
--- /dev/null
+++ b/macros/lollipop/tex/lollipop-text.tex
@@ -0,0 +1,553 @@
+% lollipop-text.tex copyright 1992 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%% Text Blocks
+
+\@GenericConstruct{TextBlock}
+
+% commands can be before and after text
+% store in two token lists
+% switch from one to other by option 'text'
+% this may also be used by ParagraphShape
+%
+\add@TextBlock@default{
+ \def\@current@options@list{before@coms}
+ \def\switch@lists{\at@breakpointyes
+ \def\@current@options@list{after@coms}}
+ }
+\@TextBlockOption{text}{\switch@lists}
+
+\def\@DefineTextBlock{
+ \csarg\edef{\@name}{\@gen@open
+ \the\before@coms
+ }
+ \@DefineStopCommand{\the\after@coms \@gen@close}
+ }
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%% A L I N E A V O R M E N
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% via \everypar:
+% \everypar={\@everyeverypar { ...locaal spul...
+% \def\par{... \@par\egroup}
+\@GenericConstruct{ParagraphShape}
+
+%%%%!!!!!!!!!!!!!!!!
+% not functioning.
+% note: \@defaulteverypar is installed now
+% as a start@command!
+
+%% anonieme namen
+% \iftempa : moet dit inspringen
+% \iftempb : speciale behandeling staart?
+
+\def\@ParagraphShapeverstekwaardes{
+ \tempano \tempbno
+ \temptoksb={} \temptoksc={}
+ \def\cs@d{b}\def\@current@options@list{temptoks\cs@d}
+ }
+\def\@DefineParagraphShape{
+ \csarg{\edef}{\@name}{%
+ \CSname{AltijdInspringen\iftempa yes\else no\fi}%
+ \nxp\everypar={\nxp\@everyeverypar
+ \iftempb \bgroup \fi
+ \the\temptoksb
+ \iftempb \parfillskip\z@
+ \else \if@erislinkswit \parfillskip\z@ \fi\fi
+ \relax
+ \iftempb \def\nxp\par{\nxp\unskip\nxp\nobreak\the\temptoksc
+ \hbox{}\nxp\@par\egroup}\fi
+ }} }
+
+\@ParagraphShapeNOOP{verticaal}
+
+%-- inspringen
+\@ParagraphShapeOption{inspringen}{
+ \if\EqualString{#1}{no}\else\tempayes\fi}
+
+%-- tekst
+\@ParagraphShapeOption{tekst}{\tempbyes\def\cs@d{c}}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%% U T I L I T I E S
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%% Space, white space
+%
+% unit space \@@space is set by switching font style
+%
+\newdimen\@@space \@@space=.5em
+\def\Spaces:#1 {\hskip#1\@@space}
+
+% handig voor bibliografieen
+\def\lax{\tolerance\@m \hfuzz\p@}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%
+% White space
+%
+\NewTrace:skip
+
+\def\hwhite:#1 {\@hwhite{#1}}
+\def\@hwhite#1{\ifhmode\unskip\fi\relax
+ \if\EqualString{#1}{fillup}\hfill\else\hskip\@ww{#1}\relax\fi}
+
+% Vertical
+% subtle: argument should be placed even if
+% size is equal: stretch may be different,
+% probably more. (cf \par\vwit{0pt plus 1fil} )
+%
+\def\vwhite:#1 {\@vwhite{#1}}
+\@GenericOption{vwhite}{\protect@breakpoint
+ \@add@toks{\@vwhite{#1}}\at@breakpointno}
+\def\@vwhite#1{\tempskipa=\@ww{#1}\relax \tempskipb\lastskip
+ \Tmessage[skip]{Considering vskip \the\tempskipa}%
+ \ifvmode \ifdim\tempskipb>\tempskipa
+ \Tmessage[skip]{Ignored. (lastskip=\the\tempskipb)}%
+ \else \Tmessage[skip]{Backvspacing \the\tempskipb}%
+ \vskip-\tempskipb
+ \Tmessage[skip]{Vskip \the\tempskipa}%
+ \vskip\tempskipa \fi
+ \else \if\EqualString{#1}{fillup}\hfill
+ \else\vskip\tempskipa \fi
+ \fi}
+
+% advance skip by literal or name of control sequence
+\def\advance@skip#1#2{\advance#1\@ww{#2}\relax}
+
+% only backspace the previous;
+% in this case prevent creating a breakpoint
+% if there was no glue
+%
+\def\v@buffer#1{\tempskipa=\@ww{#1}\relax \tempskipb\lastskip
+ \Tmessage[skip]{Clearing for vskip \the\tempskipa}%
+ \ifvmode \ifdim\tempskipb>\tempskipa
+ \else \ifdim\tempskipb=\z@
+ \else \vskip-\tempskipb\relax
+ \Tmessage[skip]{Backspaced}\fi
+ \fi \fi}
+\def\unhskip{\ifhmode\unskip\fi}
+\def\leavehmode{\unvbox\voidb@x}
+\def\novbreak{\leavehmode\nobreak}
+
+\def\white:#1 {\@white{#1}}
+\@GenericOption{white}{\protect@breakpoint
+ \@add@toks{\@white{#1}}\at@breakpointyes}
+\def\@white#1{\ifhmode\@hwhite{#1}\else
+ \ifvmode\@vwhite{#1}\fi\fi}
+\def\fillup{\@white{0pt plus1fill}}
+
+\def\@@distance#1{\csarg\newskip{#1}}
+\def\Distance:#1=#2
+ {\if\UndefinedCS{#1}\@@distance{#1}\fi
+ \edef\cs@e{\global\noexpand\set@value{#1}%
+ \if\UndefinedCS{#2}{#2}%
+ \else \CSname{#2}\fi}
+ \cs@e}
+\def\AdaptiveDistance:#1=#2 {\Distance:#1=#2
+ \adds@stop@command
+ {\ifWriteExtern\immediate\write\aux@file
+ {\string\Distance:#1={\xp\the\csn#1\ecs}}\fi
+ }}
+
+\Distance:filler={0pt plus 1fil}
+\parindent=30pt
+\parskip=0pt
+\parfillskip=0cm plus 1 fil
+\baselineskip=12pt
+
+%%%%%%%%%%%%%%%% Rules
+\@GenericOption{rule}{
+ \if\EqualString{#1}{h}\protect@breakpoint
+ \@add@toks{\hrule#2\relax}
+ \at@breakpointyes
+ \else\if\EqualString{#1}{v}\@add@toks{\vrule#2\relax}
+ \else\Wmessage{Strange option: <rule:#1=#2>}
+ \fi \fi}
+\@GenericOption{hrule}{\protect@breakpoint
+ \@add@toks{\hrule}\at@breakpointyes}
+\@GenericOption{vrule}{\@add@toks{\vrule}}
+
+%%%%%%%%%%%%%%%% Indentation Control
+% default value for all paragraphs set by AlwaysIndent
+% this one is set by by the user,
+% or by 'indentinside' option of paragraph shapes
+%
+\DefineTest:AlwaysIndent
+\AlwaysIndent:yes
+
+% override by Indent
+% can be set by the user,
+% or by start/end of text constructs
+%
+\DefineTest:Indent %forceer/onderdruk inspringen
+
+% Remove indentation
+% this is executed by \every@everypar
+%
+\def\controlled@indentation
+ {\ifAlwaysIndent
+ \ifIndent \else \remove@indent \Indent:yes \fi
+ \else \ifIndent \Indent:no \else \remove@indent \fi
+ \fi}
+\def\remove@indent{{\setbox0=\lastbox}}
+
+\def\noindentation{\AlwaysIndentno \Indentno}
+
+% Indentation control in Universal Block
+% control sequences \first@indent \inside@indent \after@indent
+% are called (in \edef context) in general open/close macros
+% for universal environments
+
+% Indent after this block
+% \global because the block may be in a further group
+%
+\add@generic@default{\def\after@indent{\global\nxp\Indent:no }}
+\@GenericOption{indentafter}{
+ \def\after@indent{\global\nxp\Indent:#1 }}
+
+% Indent in this block
+\add@generic@default{\def\inside@indent{}}
+\@GenericOption{indentinside}{
+ \def\inside@indent{\nxp\AlwaysIndent:#1 }}
+
+% Indent first in this block
+\add@generic@default{\def\first@indent{\nxp\Indent:no }}
+\@GenericOption{indentfirst}{
+ \def\first@indent{\nxp\Indent:#1 }}
+
+%%%% Level dependent indentation
+%
+\NewTrace:indent
+
+% Lots of commands and parameters
+%
+% \levelindent is the indentation that will be taken
+% on the current level, jumping to the next
+%
+\newdimen\levelindent
+
+% \previousindent is the indentation that got us to this level
+% list item labels have to outdent over this amount
+%
+\newdimen\previousindent \previousindent\z@
+
+% indentlevel counter: used to generate automatic indentation,
+% for instance \levelindentvi for level vi
+%
+\new@@counter{indentlevel}
+\set@counter{indentlevel}1
+
+% \set@level@indent : set \levelindent to automatically
+% generated indentation; if \levelindentiii is defined take it,
+% otherwise use \@@level@indent{3}, which uses fraction
+% of a \basicindent
+%
+\def\set@level@indent{\levelindent=
+ \level@indent{\cs@counter@name{indentlevel}}}
+\def\level@indent
+ #1{\if\UndefinedCS{\@level@indent{#1}}\@@level@indent{#1}%
+ \else \csname \@level@indent{#1}\endcsname \fi}
+\def\@level@indent#1{levelindent\romannumeral#1}
+\def\@@level@indent#1{\ifcase#1\z@\or
+ \basicindent \or .75\basicindent \else .5\basicindent \fi}
+
+\DefineTest:BasicIndentIsSet
+% the following lines appear as the last command in \Start,
+% so that the user can tinker with \parindent
+% through adaptive distances or in the style
+%\ifBasicIndentIsSet\else\Distance:basicindent=parindent\fi
+%\set@level@indent
+
+% \SetLevelIndent : set exact amount of indentation for
+% specific level
+%
+\def\LevelIndent:#1=#2 {\csarg\edef{\@level@indent{#1}}{\@ww{#2}}}
+
+% Push/Pop indentlevels
+%
+\def\PushLeftIndentLevel
+ {\Tmessage[indent]{Old left indent: \the\leftskip}%
+ \advance\leftskip\levelindent
+ \previousindent=\levelindent
+ \step@counter{indentlevel}\set@level@indent
+ \Tmessage[indent]{New left indent: \the\leftskip,
+ at level \the\cs@counter@name{indentlevel}}%
+ }
+
+\let\PushIndentLevel\PushLeftIndentLevel % for backwards compatibility
+
+% Popping an indent level requires two pops: one for the \levelindent
+% and one for the \previousindent. This last one then has to be
+% pushed again.
+%
+\def\PopLeftIndentLevel
+ {\ifnum\cs@counter@name{indentlevel}=\@ne
+ \Emessage{Pop left indent level attempted at outer level}
+ \else \back@step@counter{indentlevel}%
+ \back@step@counter{indentlevel}%
+ \set@level@indent \previousindent\levelindent
+ \step@counter{indentlevel}%
+ \set@level@indent\advance\leftskip-\levelindent
+ \fi}
+
+\let\PopIndentLevel\PopLeftIndentLevel % for backwards compatibility
+
+\def\PushRightIndentLevel
+ {\Tmessage[indent]{Old right indent: \the\rightskip}%
+ \advance\rightskip\levelindent
+ \previousindent=\levelindent
+ \step@counter{indentlevel}\set@level@indent
+ \Tmessage[indent]{New right indent: \the\rightskip,
+ at level \the\cs@counter@name{indentlevel}}%
+ }
+
+\def\PopRightIndentLevel
+ {\ifnum\cs@counter@name{indentlevel}=\@ne
+ \Emessage{Pop right indent level attempted at outer level}
+ \else \back@step@counter{indentlevel}%
+ \back@step@counter{indentlevel}%
+ \set@level@indent \previousindent\levelindent
+ \step@counter{indentlevel}%
+ \set@level@indent\advance\rightskip-\levelindent
+ \fi}
+
+\def\PushLeftRightIndentLevels
+ {\Tmessage[indent]{Old left indent: \the\leftskip}%
+ \Tmessage[indent]{Old right indent: \the\rightskip}%
+ \advance\leftskip\levelindent
+ \advance\rightskip\levelindent
+ \previousindent=\levelindent
+ \step@counter{indentlevel}\set@level@indent
+ \Tmessage[indent]{New left indent: \the\leftskip,
+ at level \the\cs@counter@name{indentlevel}}%
+ \Tmessage[indent]{New right indent: \the\rightskip,
+ at level \the\cs@counter@name{indentlevel}}%
+ }
+
+\def\PopLeftRightIndentLevels
+ {\ifnum\cs@counter@name{indentlevel}=\@ne
+ \Emessage{Pop left and right indents level attempted at outer level}
+ \else \back@step@counter{indentlevel}%
+ \back@step@counter{indentlevel}%
+ \set@level@indent \previousindent\levelindent
+ \step@counter{indentlevel}%
+ \set@level@indent\advance\rightskip-\levelindent
+ \advance\leftskip-\levelindent
+ \fi}
+
+%%%%%%%%%%%%%%%% Paragraph Skip control
+% parskip is stored and set to zero at the start and end
+% of environments
+\newskip\@restoreparskip
+
+% it is recorded if a parskip has been stored
+%
+\newif\if@parskipsaved \@parskipsavedno
+
+% Do no parskip
+% used at start of environment
+%
+\def\hold@parskip
+ {\@restoreparskip\parskip \parskip\z@ \@parskipsavedyes}
+
+% Hold off parskip
+% used at end of environment
+%
+\def\dono@parskip{\if@parskipsaved \else \hold@parskip \fi}
+
+% Reestablish the parskip
+% this is executed in \every@everypar
+%
+\def\controlled@parskip
+ {\if@parskipsaved \@parskipsavedno
+ \parskip\@restoreparskip
+ \fi}
+
+\def\noparskip{\parskip\z@ \@restoreparskip\z@}
+
+%%%%%%%%%%%%%%%% Every Paragraph
+% \everypar is supposed to contain \every@everypar
+% as its first element.
+%
+\newtoks\EveryParagraph
+\def\every@everypar{\controlled@indentation \controlled@parskip
+ \one@shot@coms \@headedno}
+\def\default@everypar{\everypar={\every@everypar\the\EveryParagraph}}
+\add@start@command{\default@everypar}
+\everypar{\Emessage{You forgot to give the \nxp\Start\@space command.}}
+
+% Execute once
+%
+\newtoks\one@shot@toks
+\def\one@shot@coms{\temptoksa\one@shot@toks
+ \global\one@shot@toks={}\the\temptoksa\temptoksa{}}
+\def\next@paragraph#1{\append@to@list{one@shot@toks}{#1}}
+
+%%%%%%%%%%%%%%%% Every Math
+% just like \everypar.
+%
+\newtoks\EveryMath
+\newtoks\EveryDisplay
+\newtoks\every@everymath \newcount\high@fam
+\every@everymath{\high@fam\count18\relax
+ %\MainFace
+ \xp\math@setsize\style@sizes}
+\everymath{\the\every@everymath\the\EveryMath}
+\everydisplay{\the\every@everymath\the\EveryDisplay}
+
+% Flush margins
+%
+\Distance:rightmarginstretch={0pt plus 6cm}
+\Distance:leftmarginstretch={0pt plus 6cm}
+\def\FlushLeft:#1 {\switch {\if\EqualString{#1}}
+ {yes} {\leftskip=1\leftskip}
+ {default} {\leftskip=1\leftskip
+ \advance\leftskip\leftmarginstretch}
+ \endswitch \relax}
+\FlushLeft:yes
+\def\FlushRight:#1 {\switch {\if\EqualString{#1}}
+ {yes} {\rightskip=1\rightskip}
+ {default} {\rightskip=1\rightskip
+ \advance\rightskip\rightmarginstretch}
+ \endswitch \relax}
+\FlushRight:yes
+
+
+% French Spacing
+%
+\def\FrenchSpacing:#1 {\switch {\if\EqualString{#1}}
+ {yes} {\frenchspacing}
+ {no} {\nonfrenchspacing}
+ \endswitch \relax}
+\FrenchSpacing:no
+
+%%%%%%% lijn
+% #1 : hoogte; #2 : lengte; #3 : elevatie
+% parameters kunnen van achter af aan weggelaten worden;
+% #4 is dummy, kan niet door de gebruiker gespecificeerd worden.
+% NNNNNNNNNBBBBBBBBBBBBB: #2 werkt nog niet!!!!!!!!!!!!
+\newtoks\@lijntoks
+\@lijntoks={}
+
+% Lijn. Hier moet ik nog eens naar kijken.
+\@GenericOption{lijn}{
+ \edef\cs@e{\nxp\lijnanalyse:#1:\@restarg::::;}\cs@e
+ \edef\cs@e{\nxp\@add@toks{\nxp\leavevmode\the\@lijntoks}}
+ \cs@e}
+
+\def\lijnanalyse:#1:#2:#3:#4;{\@lijntoks={}
+ \eqstring{#1}{}{}{\achteraanlijst{@lijntoks}{height #1 }}
+ \eqstring{#2}{}{\vooraanlijst{@lijntoks}{\leaders\hrule depth 0cm }
+ \achteraanlijst{@lijntoks}{\hfill}}%
+ {\eqstring{#2}{uitvullen}%
+ {\vooraanlijst{@lijntoks}{\leaders\hrule depth 0cm }
+ \achteraanlijst{@lijntoks}{\hfill}}%
+ {\achteraanlijst{@lijntoks}{width \w@w{#2} }%
+ \vooraanlijst{@lijntoks}{\vrule depth 0cm }}
+% \eqstring{#3}{}{}{\vooraanlijst{@lijntoks}{\raise #3\hbox\bgroup}
+% \achteraanlijst{@lijntoks}{\egroup}}
+ }
+ \achteraanlijst{@lijntoks}{\hbox{}} % \par doet \unskip!!!
+ }
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%% accenten
+\gdef\allowhyphens{\penalty\@M \hskip\z@\relax}
+
+%{\catcode`\"=12 \gdef\hex{"}}
+
+%\catcode`\"=13
+%\def "#1{\ifx#1i\discretionary{-}{i}{{\accent'177 \i}}%
+\def\"#1{\ifx#1i\discretionary{-}{i}{{\accent'177 \i}}%
+ \else\ifx#1-\allowhyphens-\penalty\z@\allowhyphens
+ \else\ifx#1"\hskip\z@\relax
+% \else\ifx#1!\hex
+ \else\ifx#1!"
+ \else\ifx#1|\allowhyphens
+ \else {\accent'177 #1}\fi\fi\fi\fi\fi}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%% C A S E
+%%
+\def\UpperCase#1{\edef\cs@a{\uppercase{#1}}\cs@a}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%% L E T T E R S P A C I N G
+%%
+\def\LetterSpace
+ {\ifnextchar[\@LetterSpace %] <- to fool emacs
+ {\@LetterSpace[0ptplus1fil]}}
+\def\@LetterSpace[#1]#2{\def\@LS{\hskip#1\relax}%
+ \edef\cs@e{#2}\xp\@@LS\cs@e&}
+\def\@@LS#1#2&{#1\if\IsEmptyList{#2}\xp\take@one\else\@LS\xp\@@LS\fi#2&}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%% Interdictions
+%%
+\def\NoHyphenation{\hyphenpenalty\@M \exhyphenpenalty\@M}
+\def\NoWidows{\widowpenalty\@M}
+\def\NoOrphans{\clubpenalty\@M}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%% V E R B A T I M
+%%
+
+\def\setupverbatim{\let\do=\makeother \dospecials}
+
+%% inline verbatim
+\def\ver{\leavevmode\begingroup \setupverbatim \obeyspaces\tt \@ver}
+\def\@ver#1{\def\@@ver##1#1{##1\endgroup}\@@ver}
+
+%% display verbatim
+{\activecr %
+ \gdef\vVer>{\setupverbatim \obeyspaces %
+ \tt \parindent\z@ \noparskip \obeylines %
+ \ifnextchar
+ \@@Ver\@Ver}\noeol %
+ \gdef\@Ver#1<Rev{#1\VerStop}%
+ \gdef\@@Ver
+ #1<Rev{#1\VerStop}}
+
+%% verbatim files
+\def\verbatimfile#1{\begingroup
+ \setupverbatim \obeyspaces \parindent\z@ \noparskip \obeylines %
+ \tt \input#1\relax
+ \endgroup}
+
+\endinput
+
+% 2016/05/14 defined \FrenchSpacing
+% 2016/04/14 defined \PushLeftIndentLevel, \PopLeftIndentLevel,
+% \PushRightIndentLevel, \PopRightIndentLevel,
+% \PushLeftRightIndentLevels, and \PopLeftRightIndentLevels
+% commands. \PushIndentLevel is now a synonym for
+% \PushLeftIndentLevel and \PopIndentLevel is a synonym
+% for \PopLeftIndentLevel
+% 2014/04/13 defined \EveryParagraph, \EveryMath, and \EveryDisplay
+% 2014/04/12 changed "#1 cs to \"#1 cs to be compatible with plain;
+% also we can not make " active since it is used by xetex for font selection
+% 92/11/08 white options created;
+% breakpoint protection in white options
+% 92/11/18 AdaptiveDistance implemented
+% 92/11/20 \set@counter calls updated for \w@w use
+% 92/12/14 default flush right
diff --git a/macros/lollipop/tex/lollipop-tools.tex b/macros/lollipop/tex/lollipop-tools.tex
new file mode 100644
index 0000000000..f7b11454b5
--- /dev/null
+++ b/macros/lollipop/tex/lollipop-tools.tex
@@ -0,0 +1,1509 @@
+% lollipop-tools.tex copyright 1992/3 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+%% anonymous control sequences
+\newif\iftempa \newif\iftempb \newif\iftempc \newif\iftempd
+
+\newdimen\tempdima \newdimen\tempdimb \newdimen\tempdimc
+
+\newskip\tempskipa \newskip\tempskipb \newskip\tempskipc
+
+\newcount\tempcounta \newcount\tempcountb \newcount\tempcountc
+
+\newbox\tempboxa \newbox\tempboxb \newbox\tempboxc \newbox\tempboxd
+
+\newtoks\temptoksa \newtoks\temptoksb \newtoks\temptoksc
+%\newtoks\temptoksd \newtoks\temptokse \newtoks\temptoksf
+
+%% auxiliaries
+\def\@meld#1{{\immediate\write16{\trace@prefix #1}}}
+\def\Dmessage#1{\ifDiagnose \@meld{#1}\fi}
+\def\Wmessage#1{\@meld{--- Warning: #1}}
+\def\Emessage#1{{\errorcontextlines\m@ne
+ \errmessage{<><><><><><><><> #1 <><><><><><><><>}}}
+
+\showboxdepth=7 \showboxbreadth=20
+\newlinechar=`\^^J %nodig?
+
+\chardef\busje`\\
+\def\cs#1{{\tt\char\busje#1}}
+
+\let\xp\expandafter \let\nxp\noexpand
+\let\csn\csname \let\ecs\endcsname
+
+% Remove or select tokens
+% is used in several places
+%
+\long\def\id@#1{#1}
+\long\def\take@former#1#2{#1} \long\def\take@latter#1#2{#2}
+\long\def\take@one#1{} \long\def\take@two#1#2{}
+\long\def\take@three#1#2#3{}
+\long\def\keep@one#1{#1} \long\def\take@to@dollar#1${}
+\def\Xignorespaces#1{#1}
+
+{\noesc
+\xp\xp\xp\gdef\xp\xp\xp\meaning@take@zero
+ \xp\string\csn macro:\xp\xp\xp\xp\xp\xp\xp\ecs
+ \xp\xp\xp\xp\xp\xp\xp#\xp\xp\xp1\xp\string\csn->\ecs{}
+}\def\real@meaning{\xp\meaning@take@zero\meaning}
+
+\def\first@of@three#1#2#3{#1}
+\def\second@of@three#1#2#3{#2}
+\def\third@of@three#1#2#3{#3}
+\def\first@two@of@three#1#2#3{{#1}{#2}}
+
+
+% Check if this file is being loaded from IniTeX, or
+% by \input'ting on top of an already existing format.
+% This is to avoid double definitions and major accidents.
+%
+\def\lollipop@name{Lollipop}
+\expandafter\ifx\csname fmtname\endcsname\lollipop@name
+ \let\ifini\take@one
+ \let\ifnin\keep@one
+ \message{! Loading Lollipop on top of format !}
+\else
+ \let\ifini\keep@one %iniTeX run or on top of plain TeX
+ \let\ifnin\take@one
+ \everyjob{\let\ifini\take@one\let\ifnin\keep@one}
+\fi
+
+%%%%%%%%%%%%%%%% forward definitions
+\def\new@@counter#1{\csarg\newcount{\counter@name{#1}}}
+\def\counter@name#1{#1@C}
+
+%%%%%%%%%%%%%%%% Special characters
+
+% At sign
+%
+
+\def\makeatletter{\catcode`\@=11\relax}
+\def\makeatother{\catcode`\@=12\relax}
+
+% Catcode (re)storing
+%
+\def\storecat#1%
+ {\noesc
+ \csarg\edef{restorecat\string#1}%
+ {\catcode`\string#1=
+ \the\catcode\expandafter`\string#1}%
+ \catcode\expandafter`\string#1=12\relax
+ \normalesc}
+\def\restorecat#1%
+ {\noesc
+ \csname restorecat\string#1\endcsname
+ \normalesc}
+
+% save writing.
+
+\def\@space{ }\def\@empty{} \newtoks\empty@toks \empty@toks{}
+\def\sc@led{scaled}
+\def\nl{\hfil\break}
+\def\IniTeX{Ini\TeX}
+\def\LaTeX{L\kern-.3em\raise.35ex\hbox{\script A}\kern-.1em\TeX}
+\def\AmsTeX{$\cal A_MS$-\TeX}
+%my old def
+%\def\LamsTeX{L\kern-.2em\raise.4ex\hbox
+% {$\scriptstyle\cal A$}\kern-.2em$\cal_M$\kern-.2em$\cal S\,$\TeX}
+%Spivak's old def
+%\def\LamSTeX{L\kern-.4em\raise.3ex\hbox{$\ssize\Cal A$}\kern-.25em
+% \lower.4ex\hbox{\eightsy M}\kern-.1em{$\Cal S$}-\TeX}
+\def\LamsTeX{L\kern-.4em\raise.3ex\hbox{\script$\cal A$}\kern-.25em
+ \lower.4ex\hbox{\script$\cal M$}\kern-.1em{$\cal S$}-\TeX}
+
+\def\CorporateLogo{\TeX\kern-.15em \raise.5ex\hbox{T}\kern-.25em
+ ECHNIQUE}
+
+
+\hsize=15cm
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%% T O O L S %%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% Construct a control sequence inside \edef
+%
+\def\CSname#1{\expandafter\noexpand\csname#1\endcsname}
+
+% Construct a control sequence out of #2, and give it to #1
+%
+\def\csarg#1#2{\expandafter#1\csname#2\endcsname}
+
+% Pick an escapecharacter
+% this presumes that its argument is a character.
+%
+\def\pickescape#1{\ifnum`#1=\escapechar\else#1\fi}
+
+% Equality of strings.
+% the fast approach: does not work in expansion-only environment.
+%
+\def\EqualString#1#2{00\fi\def\eqs@a{#1}\def\eqs@b{#2}%
+ \ifx\eqs@a\eqs@b}
+
+% Test by expansion only
+%
+\def\EqualStringX#1#2{00\fi
+ \csname if\@EqualStringX#1&$#2&$\endcsname}
+\def\@EqualStringX#1#2$#3#4${\ifx#1#3%
+ \ifx#1&true\else\hop@ES\@EqualStringX#2$#4$\fi
+ \else false\fi}
+\def\hop@ES#1\fi#2\fi{\fi\fi#1}
+
+% Lexicographic ordering
+% note the use of \def
+% also note the characters 0,127,255 that are used,
+% these are not supposed to appear in the strings
+%
+{\catcode0=12 \catcode255=12 \catcode127=12
+\gdef\StringBeforeNC#1#2{\00\fi
+ \CharsBefore#1^^@^^?#2^^ff^^?}
+\gdef\CharsBeforeNC#1#2^^?#3#4^^?{%
+ \ifcat#1\relax\def\next{\CharsBefore#2^^@^^?#3#4^^ff^^?}%
+ \else\ifcat#3\relax\def\next{\CharsBefore#1#2^^@^^?#4^^ff^^?}%
+ \else\ifnum\lccode`#1<\lccode`#3
+ \def\next{\csname iftrue\endcsname}%
+ \else\ifnum\lccode`#1>\lccode`#3
+ \def\next{\csname iffalse\endcsname}%
+ \else\def\next{\CharsBefore#2^^?#4^^?}%
+ \fi \fi \fi \fi
+ \next}
+\gdef\StringBefore#1#2{\00\fi
+ \CharsBefore#1^^@^^?#2^^ff^^?}
+\gdef\CharsBefore#1#2^^?#3#4^^?{%
+ \ifnum`#1<`#3
+ \def\next{\csname iftrue\endcsname}%
+ \else\ifnum`#1>`#3
+ \def\next{\csname iffalse\endcsname}%
+ \else\def\next{\CharsBefore#2^^?#4^^?}%
+ \fi\fi
+ \next}
+}
+
+
+% Null argument test
+%
+\def\ifempty#1{00\fi\xp\ifx\csname#1null\endcsname\null}
+\def\ifEmptyX#1{\xp\ifx\csname#1null\endcsname\null}
+%\def\ifEmpty#1{\def\cs@a{#1}\ifx\cs@a\empty}
+\def\IsEmptyList#1{00\fi\def\cs@a{#1}\ifx\cs@a\empty}
+
+% Next character test
+%
+\def\NextChar#1#2#3{00\fi
+ \let\nxt@ch#1\def\nxt@a{#2}\def\nxt@b{#3}%
+ \futurelet\nxt@c\@ifnxtc}
+\def\ifNextChar#1#2#3{%
+ \let\nxt@ch#1\def\nxt@a{#2}\def\nxt@b{#3}%
+ \futurelet\nxt@c\@ifnxtc}
+\let\ifnextchar\ifNextChar
+\def\@ifnxtc{\ifx\nxt@ch\nxt@c \expandafter\nxt@a
+ \else \expandafter\nxt@b \fi}
+
+% Test for defined-ness of string as control sequence.
+% works inside \edef
+%
+%outdated: \def\ifnotdefined#1{\csarg\ifx{#1}\relax}
+\def\UndefinedCS#1{00\fi\csarg\ifx{#1}\relax}
+
+% Define uniquely defined dummy macros,
+% usually to serve as bumper blocks at the end of a list
+%
+\newcount\dummies
+\def\NewDummy#1{
+ \if\UndefinedCS{#1}\csarg\edef{#1}{dum\the\dummies}
+ \advance\dummies\@ne
+ \else
+ \ifini{\Wmessage{Attempt at second definition of `#1'}}
+ \fi}
+
+% string case statement
+% use: \switch \iftest{...} in:
+% item1 action1
+% ...
+% itemn actionn
+% default defaultaction [optional]
+% \endswitch
+% inspired by Jonathan Fine: Some Basic Control Macros
+% Tugboat 12 #4
+%
+\let\@fi\fi \let\endswitch\relax \NewDummy{default}
+\def\switch@exit #1 \@fi #2 \endswitch {\fi #1}
+\def\switch #1#2#3{\csarg\ifx{#2}\default\switch@exit #3 \@fi
+ #1{#2}\switch@exit #3 \@fi
+ \switch {#1}
+}
+% this version puts the test object in {}
+\def\oswitch #1 in: #2 #3; {\csarg\ifx{#2}\default\switch@exit #3 \@fi
+ #1{#2}\switch@exit #3 \@fi
+ \switch #1 in:
+}
+% this version assumes that the test object is just one character
+\def\cswitch #1 in: #2 #3; {\csarg\ifx{#2}\default\switch@exit #3 \@fi
+ #1#2\switch@exit #3 \@fi
+ \cswitch #1 in:
+}
+% this version assumes that the test object can have an optional space
+\def\bswitch #1 in: #2 #3; {\csarg\ifx{#2}\default\switch@exit #3 \@fi
+ #1#2 \switch@exit #3 \@fi
+ \bswitch #1 in:
+}
+% this version can cope with significant spaces at the start of #3;
+% #2 is macro argument
+\def\mswitch #1 in: #2:#3; {\csarg\ifx{#2}\default\switch@exit #3 \@fi
+ #1{#2}\switch@exit #3 \@fi
+ \mswitch #1 in:
+}
+% idem; #2 does not have to be enclosed in braces
+\def\fswitch #1 in: #2:#3; {\csarg\ifx{#2}\default\switch@exit #3 \@fi
+ #1#2 \switch@exit #3 \@fi
+ \fswitch #1 in:
+}
+
+% Routines for taking the value of a string:
+% if the string is defined as control sequence
+% take the value of that, otherwise take the string itself
+
+% String or value of control sequence
+%
+\def\w@w#1{\if\UndefinedCS{#1}#1\else \the\csname#1\endcsname\fi}
+
+% String or control sequence
+%
+\def\@ww#1{\if\UndefinedCS{#1}#1\else \csname#1\endcsname \fi}
+
+% String or \noexpand-ed control sequence;
+% for use in \edef
+%
+\def\@w@w#1{\if\UndefinedCS{#1}#1\else
+ \ifin@label\noexpand\protect\fi \CSname{#1}\fi}
+\newtoks\are@these@correct
+\def\t@w@w#1{%
+ \if\UndefinedCS{#1}#1%
+ \ifdefining\append@to@list\are@these@correct{#1 }\fi
+ \else
+ \ifin@label\noexpand\protect\fi \CSname{#1}\fi}
+% see below what happens to \are@these@correct
+
+% Allocation
+%
+\def\new@count#1#2{\csarg\newcount{#1}\global\set@value{#1}{#2}}
+\def\new@skip#1#2{\csarg\newskip{#1}\global\set@value{#1}{#2}}
+\def\new@dimen#1#2{\csarg\newdimen{#1}\global\set@value{#1}{#2}}
+
+% Assignment of Values
+%
+\def\set@value#1#2{\csname#1\endcsname #2\relax}
+\def\increase@value#1#2{\advance\csname#1\endcsname #2\relax}
+\def\decrease@value#1#2{\advance\csname#1\endcsname -#2\relax}
+
+% Hex
+%
+\def\hexdigit#1{\ifcase#10\or 1\or 2\or 3\or 4\or
+ 5\or 6\or 7\or 8\or 9\or A\or B\or C\or D\or E\or F\fi}
+
+% Log 10
+%
+\def\LogTen#1{\switch{\ifnum#1<}
+ {10 }{1} {100 }{2} {1000 }{3} {10000 }{4} {default}{5}
+ \endswitch}
+
+% List Manipulation ................
+% this assumes that #1 is a list of tokens, #2 is the name of a list
+%
+% Names of lists (and of items to pop into) are given as strings;
+% not as control sequences.
+%
+\newtoks\toks@lista \newtoks\toks@listb
+% basic append/prepend macro
+\long\def\@append@to@cslist#1#2#3{\begingroup\toks@lista=#2{#3}%
+ \global#1=\xp\xp\xp{\xp\the\xp#1\the\toks@lista}\endgroup}
+\long\def\@prepend@to@cslist#1#2#3{\begingroup\toks@lista=#2{#3}%
+ \global#1=\xp\xp\xp{\xp\the\xp\toks@lista\the#1}\endgroup}
+\def\@append@to@list{\csarg\@append@to@cslist}
+% variations:
+\long\def\append@to@list#1#2{\@append@to@list{#1}{}{#2}}
+\def\append@list@to@list#1#2{%
+ \@append@to@list{#1}{\xp\xp\xp}{\xp\the\csn#2\ecs}}
+\def\append@cslist@to@cslist#1#2{%
+ \@append@to@cslist{#1}\xp{\the#2}}
+\def\append@toks@cs@to@list#1#2{\@append@to@list{#1}\xp{\the#2}}
+
+% A few list macros for the user
+\def\NewList:#1 {\csarg\newtoks{#1}\global\csn#1\ecs{}}
+\def\EmptyList:#1 {\global\csn#1\ecs{}}
+\long\def\AppendToList:#1=#2 {\@append@to@list{#1}{}{#2}}
+\def\TheList:#1 {\let\oldwbuskip\willbeunhskip \let\willbeunhskip\@empty
+ \if\UndefinedCS{#1}\message{List <#1> undefined}
+ \else\csarg\the{#1}\fi
+ \let\willbeunhskip\oldwbuskip}
+
+\def\del@tok@from@list#1#2{\begingroup
+ \long\def\cs@liste##1#2##2\tok@SM
+ {\toks@lista{##1}\toks@listb{##2}%
+ \edef\cs@listb{\global\CSname{#1}=
+ {\the\toks@lista\the\toks@listb}}%
+ \cs@listb}%
+ \edef\cs@lista{\nxp\cs@liste{}\xp\the\csn#1\ecs\nxp\tok@SM}%
+ \cs@lista \endgroup}
+\def\in@front@of@list#1{\csarg{\let\xp\cs@lista}{#1}%
+ \in@front@of@cslist\cs@lista}
+\long\def\in@front@of@cslist#1#2{\begingroup\toks@lista={#2}%
+ \global#1=\xp\xp\xp{\xp\the\xp\toks@lista \the#1}%
+ \endgroup}
+\long\def\local@in@front@of@list#1#2{\toks@lista={#2}%
+ \csname#1\endcsname\xp\xp\xp\xp\xp\xp\xp
+ {\xp\xp\xp\the\xp\xp\xp\toks@lista
+ \xp\the\csname#1\endcsname}%
+ }
+\def\set@list#1{\csarg{\let\xp\cs@lista}{#1}%
+ \set@cslist\cs@lista}
+\long\def\set@cslist#1#2{\begingroup\toks@lista={#2}%
+ \global#1=\xp{\the\toks@lista}\endgroup}
+
+%%%%%%%%%%%%%%%% Stack macros
+%
+% push in terms of prepending of lists
+\def\push@cs@onto@cs#1#2{\@prepend@to@cslist#1\xp{\xp\\\xp{\the#2}}}
+\def\push@onto#1{\csarg\push@onto@cs{#1}}
+\def\push@onto@cs#1#2{\@prepend@to@cslist#1{}{\\{#2}}}
+\def\local@push@onto#1#2{\let\\=\relax
+ \local@in@front@of@list{#1}{\\{#2}}}
+% pop via auxiliary macro: #1 is result, #2 is stack
+% two cs arguments
+\def\pop@cs@into#1#2{\edef\cs@e
+ {\nxp\@@popinto\nxp#1\nxp#2\the#2\nxp\@@pop}\cs@e}
+% two string arguments
+\def\pop@into#1#2{\edef\cs@e
+ {\nxp\@@popinto\CSname{#1}\CSname{#2}\csarg\the{#2}\nxp\@@pop}\cs@e}
+\long\def\@@popinto#1#2\\#3#4\@@pop{#1{#3}#2{#4}}
+\def\copy@stacktop#1#2{%
+ \edef\cs@e{\noexpand\@copy@stacktop
+ {#1}\csarg\the{#2}\noexpand\@@pop}%
+ \cs@e}
+\def\@copy@stacktop#1\\#2#3\@@pop{\csname#1\endcsname#2\relax}
+\newcount\stack@length \newtoks\empty@stack \empty@stack{\\{}}
+\def\length@of@stack#1{\csarg\length@of@csstack{#1}}
+\def\length@of@csstack#1{\def\\##1{\advance\stack@length\@ne}%
+ \stack@length\m@ne \the#1}
+% turn a stack upside down
+\def\invert@csstack#1{\length@of@csstack{#1}%
+ \tempcountb\z@ \temptoksa\empty@stack
+ \loop\ifnum\tempcountb<\stack@length
+ \pop@cs@into\temptoksb#1\advance\stack@length\m@ne
+ \push@cs@onto@cs\temptoksa\temptoksb
+% \append@cslist@to@cslist\temptoksb\temptoksa% append a to b
+% \temptoksa\temptoksb
+ \repeat% copy b to a
+ #1\temptoksa \temptoksa\empty@toks}
+% invert a stack into a list
+\def\x@stack@to@list#1{\length@of@stack{#1}%
+ \tempcountb\z@ \temptoksa\empty@toks
+ \loop\ifnum\tempcountb<\stack@length
+ \pop@into{temptoksb}{#1}\advance\stack@length\m@ne
+ \append@list@to@list{temptoksb}{temptoksa}\repeat
+ \csn#1\ecs\temptoksa \temptoksa\empty@toks}
+
+
+% Bookkeeping and Householding lists................
+% Generic Defaults
+% to be executed each time a definition starts
+%
+\ifini{\newtoks\generic@defaults}
+\def\adds@generic@default#1{
+ \append@to@list{generic@defaults}{#1}}
+\def\add@generic@default#1{\ifini
+ {\append@to@list{generic@defaults}{#1}}}
+
+% Document Start Commands
+% to be executed by \Start
+%
+\ifini{\newtoks\start@commands}
+\def\add@start@command#1{\ifini
+ {\append@to@list{start@commands}{#1}}}
+\def\adds@start@command#1{%
+ \append@to@list{start@commands}{#1}}
+
+% Document Stop Commands
+% to be executed by \Stop
+%
+\ifini{\newtoks\stop@commands}
+\def\add@stop@command#1{\ifini
+ {\append@to@list{stop@commands}{#1}}}
+\def\adds@stop@command#1{%
+ \append@to@list{stop@commands}{#1}}
+
+% Style Start Commands
+% to be executed by \StyleDefinition
+%
+\ifini{\newtoks\style@start@commands}
+\def\add@style@start@command#1{\ifini
+ {\append@to@list{style@start@commands}{#1}}}
+
+% Style Stop Commands
+% to be executed by \StyleDefinitionStop
+%
+\ifini{\newtoks\style@stop@commands}
+\def\add@style@stop@command#1{\ifini
+ {\append@to@list{style@stop@commands}{#1}}}
+\add@style@stop@command{\style@stop@commands{}
+ \style@start@commands{}}
+
+\def\check@existence#1{\Wmessage{Used \nxp\check@existence. Check}}
+% \add@style@stop@command{\if\UndefinedCS{#1}\Wmessage
+% {Some trouble involving #1; check definitions carefully!}\fi}
+
+%\add@style@start@command{\are@these@correct{}}
+%\add@style@stop@command{\if\IsEmptyList{\the\are@these@correct}\else
+% \Wmessage{Check if the following are literals: \the\are@these@correct}
+% \fi}
+
+% Tracing
+%
+% if trace@all=0 and \trace@foo is >0, every \Tmessage[foo] is written.
+% if \Trace:no, then all trace is disabled through \trace@all=-1
+% if \Trace:yes then all traces are written through \trace@all=1
+% by default: \trace@all=0
+%
+\def\Tmessage{\ifnum\trace@all>\m@ne\xp\t@message\else\xp\del@message\fi}
+\def\del@message[#1]#2{}\let\trace@prefix\@empty
+\def\t@message[#1]#2{%
+ \ifnum\trace@all>\z@ \def\trace@prefix{[T]}\@meld{#2}%
+ \else\csarg\ifnum{trace@#1}>\z@
+ \def\trace@prefix{[T:#1]}\@meld{#2}\fi
+ \fi\global\let\trace@prefix\@empty}
+
+\def\Trace:#1 {\switch{\if\EqualString{#1}}
+ {yes} {\trace@all\@ne\message{Switching ON all tracing}}
+ {no} {\trace@all\m@ne\message{Switching OFF all tracing}}
+ {default} {\if\UndefinedCS{trace@#1}\Wmessage{Strange trace: #1}\else
+ \csname trace@#1\endcsname\@ne \trace@all\z@ \fi}
+ \endswitch}
+\def\NewTrace:#1 {\new@count{trace@#1}\m@ne}
+\new@count{trace@all}\z@
+\NewTrace:gen % traces everything in this file
+\NewTrace:def % definitions of constructs etc
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%% Generic Constructs %%%%%%%%%%%%%%%%%%%%%
+
+% \@GenericConstruct{Foo} =
+% \newtoks\Foo@defaults
+% \Foo@defaults={}
+% \def\add@Foo@default#1{...}
+% \def\DefineFoo#1 =
+% \@FooDefaults % has to be defined explicitly
+% \the\Foo@defaults % constructed cumulatively
+% \@GenericDefaults % constructed cumulatively
+% \@GetOptions
+% \@DefineFoo % has to be defined explicitly
+% \def\@FooOption ... % same syntax as \@GenericOption
+%
+% Options are either generic (the ones below)
+% defined by \@GenericOption,
+% or specific for some construct,
+% defined by \@FooOption
+%
+\ifini{\newtoks\@gencons}
+\newif\ifdefining@a@construct
+\def\@GenericConstruct#1{
+ \ifini{\append@to@list{@gencons}{\\#1;}
+ \csarg\newtoks{#1@defaults}
+ \csn #1@defaults\ecs{}}
+ \csarg\def{add@#1@default}##1{\ifini
+ {\append@to@list{#1@defaults}{##1}}}
+ \csarg\def{adds@#1@default}##1{\append@to@list{#1@defaults}{##1}}
+ \Install@Noops{#1}
+ \csarg\def{Define#1}:##1 {\defining@a@constructyes
+ \def\@name{##1}\def\@class{#1}
+ \Tmessage[def]{Defining a #1: ##1}
+ \the\generic@defaults
+ \csarg\the{#1@defaults}
+ \Get@Items}
+ \csarg\def{@#1Option}##1{\csarg\def{#1@##1}####1####2}
+ }
+\add@generic@default{\let\pre@fix\@empty}
+\def\@command{\ifx\pre@fix\@empty\else\pre@fix @\fi\@name}
+\def\stop@command@suffix{Stop}
+\def\stop@command{\@command\stop@command@suffix}
+\def\@DefineStopCommand{\csarg\edef{\stop@command}}
+
+%%%% Abbreviated Closing:
+% every group defines its own \default@stop@command;
+% on the outer level this is an error msg.
+% \> closes whatever is open, \>] closes everything that is open.
+\def\outer@stop@command{\Emessage{Vacuous group closing}}
+\let\default@stop@command\outer@stop@command
+\def\>{\default@stop@command%[fool the editor
+ \ifNextChar]{\ifx\default@stop@command\outer@stop@command
+ \xp\take@one
+ \else \xp\>\fi}{}}
+\newif\if@implicitclose
+\add@generic@default{\@implicitcloseyes}
+% the next line replicated below
+%\@GenericOption{noimplicitclose}{\@implicitcloseno}
+\def\install@stop{\if@implicitclose
+ \def\nxp\default@stop@command{\CSname{\stop@command}}%
+ \else \let\nxp\default@stop@command\nxp\outer@stop@command
+ \fi}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%% Here is the main
+%%%%%%%%%%%%%%%% I T E M A N A L Y S I S
+%%%%%%%%%%%%%%%% loop
+%%%%
+
+% This macro is recursive, but with some detours.
+% first filter out empty arguments
+%
+\def\Get@Items#1 {\if\IsEmptyList{#1}\let\get@next@item\Get@Items
+ \else\def\get@next@item{\@Get@Items#1 }\fi
+ \get@next@item}
+
+% Check if the argument is `Stop', in which case you
+% have reached the end of a generic definition.
+% Otherwise filter the special case of a colon, and process an item
+%
+\NewDummy{Stop}
+\def\@Get@Items#1 {\let\get@next@item=\Get@Items
+ \csarg\ifx{#1}\Stop
+ \the\generic@stop@defaults
+ \let\get@next@item=\relax
+ \else \if\EqualString{#1}{:}\@add@toks{:}
+ \else \Item@or@Macro#1::. \fi
+ \fi \get@next@item}
+
+% Default actions to be executed when GetItems has finished
+%
+\def\add@generic@stop@default#1{\ifini
+ {\append@to@list{generic@stop@defaults}{#1}}}
+\ifini{\newtoks\generic@stop@defaults}
+\add@generic@stop@default{\csname @Define\@class\endcsname}
+
+% Now check successive possibilities:
+% first it can be a macro.
+%
+\def\OptionsMacro:#1=#2Stop {\global\csarg\def{opt@mac@#1}{#2}}
+\def\split@at@is#1=#2=#3.{{#1}{#2}}
+\def\Item@or@Macro#1:#2:#3.{
+ \switch {\if\EqualString{#1}}
+ {macro} {\if\UndefinedCS{opt@mac@#2}
+ \Wmessage{Unknown macro: `#2'}
+ \else \edef\get@next@item{\nxp\Get@Items \csn opt@mac@#2\ecs }
+ \fi}
+ {default} {\edef\cs@e{\nxp\Option@Item{#1}\split@at@is#2==.}
+ \cs@e}
+ \endswitch}
+
+% The option #1 is not a Lollipop style macro. It can be
+% - a specific option
+% - a generic option
+% - a character
+% - a defined control sequence
+%
+% Is it an option of some sort?
+%
+\def\Option@Item#1#2#3{
+ \if\UndefinedCS{\@class @#1}
+ \if\UndefinedCS{\gen@option@name{#1}}
+ \Character@CS@Item{#1}{#2}{#3}
+ \else \if\EqualString{#2}{title}
+ \edef\cs@e{\CSname{\gen@option@name{#1}}\CSname{#3Title}}
+ \cs@e
+ \else \csn \gen@option@name{#1}\ecs{#2}{#3}
+ \fi
+ \Tmessage[gen]{Generic option `#1' for `\@class':
+ `#2' = `#3'}
+ \fi
+ \else \if\EqualString{#2}{title}
+ \edef\cs@e{\CSname{\@class @#1}\CSname{#3Title}}
+ \cs@e
+ \else \csn \@class @#1\ecs{#2}{#3}
+ \fi
+ \Tmessage[gen]{Specific option `#1' for `\@class': `#2'}
+ \fi}
+
+% If it is not an option, is it a character or control sequence?
+%
+% Commands are either `\Command', `\Command:arg', `\Command:arg1=arg2'
+% See what arguments are nonempty in order to attach them;
+% in case 2 and 3 append space token.
+%
+\def\Character@CS@Item#1#2#3{
+ \def\cs@b{#1}\def\cs@c##1##2<<<{\def\cs@c{##1}}\cs@c#1<<<
+ \ifx\cs@b\cs@c \@add@toks{#1}
+ \Tmessage[gen]{Single character `#1' for `\@class'}
+ \else
+ \if\UndefinedCS{#1}
+ \Wmessage{Unknown option for `\@class': `#1' in `\@name'.}
+ \@add@toks{\csn#1\ecs}
+ \else
+ \cs@in@ref@protect{#1}%
+ \edef\cs@e{\nxp\@add@toks{\CSname{#1}}}\cs@e
+ \fi
+ \if\IsEmptyList{#2}
+ \else \if\IsEmptyList{#3}\@add@toks{:#2 }
+ \else
+ \if\EqualString{#2}{title}
+ \edef\cs@e{\nxp\@add@toks{:\CSname{#3Title} }}
+ \cs@e
+ \else \@add@toks{:#2={#3} }
+ \fi
+ \fi
+ \fi
+ \Tmessage[gen]{Command `#1' (#2,#3)}
+ \fi}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% G E N E R I C O P T I O N S
+%%%%
+%
+% All generic constructs get these options.
+% They are at liberty to redefine them.
+%
+\newtoks\@GenericOptions
+\def\gen@option@name#1{Option@#1}
+\def\@GenericOption#1{
+ \append@to@list{@GenericOptions}{\\#1;}
+ \csarg\def{\gen@option@name{#1}}##1##2}
+\def\Noop@Error#1#2{\Emessage{Option #2 is not allowed for class #1}}
+
+\def\Install@Noops#1{
+ \csarg\def{@#1NOOP}##1{\csarg\def{#1@##1}{\Noop@Error{#1}{##1}}}
+ }
+\newtoks\@main@options@list
+\newtoks\before@coms \newtoks\after@coms
+\add@generic@default
+ {\def\@current@options@list{@main@options@list}%
+ \@main@options@list{}
+ \before@coms{} \after@coms{}}
+\long\def\@add@toks#1{\append@to@list{\@current@options@list}{#1}}
+\def\toks@add@toks#1{
+ \edef\cs@e{\nxp\append@to@list
+ {\nxp\@current@options@list}{\xp\the\csn#1\ecs}}
+ \cs@e \let\cs@e\relax}
+\def\switch@to@options@list#1{\def\@current@options@list{#1}}
+\def\temp@options@list#1{
+ \xdef\saved@options@list{\@current@options@list}
+ \def\@current@options@list{#1}}
+\def\revert@options@list{
+ \xdef\@current@options@list{\saved@options@list}
+ \global\let\saved@options@list\@empty}
+
+\newtoks\z@toks \z@toks={0pt}
+
+% the next line should be higher,
+% but \@GenericOption wasn't defined yet there
+\@GenericOption{noimplicitclose}{\@implicitcloseno}
+
+%%%%%%%%%%%%%%%% Universal textblock
+%
+% These macros will only be used inside an \edef.
+% They are meant for text blocks, but the \outer@start@commands
+% are also necessary for output routines, hence the test
+% if this is a text-like construct.
+%
+\newif\iftext@construct
+\add@generic@default{\text@constructyes}
+
+% Level of nesting
+%
+\newcount\nest@depth
+
+% Open command
+%
+\def\@gen@open{\outer@start@commands
+ \begingroup \inner@start@commands}
+
+\def\outer@start@commands{%
+ \iftext@construct
+ \ifleft@embedded@construct \install@h@before@penalty
+ \else \nxp\leavehmode \nxp\v@buffer{\the\@whitebefore}%
+ % backspace previous white space while it's visible
+ \nxp\if@headed\nxp\else\install@v@before@penalty
+ \nxp\fi
+ \fi \fi
+ \ifhas@counter \nxp\StepCounter:\expandafter\@name\@space
+ % This sets the \current@label by default
+ \ifhas@marks
+ \edef\nxp\cs@e{\nxp\nxp\nxp\refresh@mark@item
+ {\@name Counter}{\CSname{\@name Counter}}}%
+ \nxp\cs@e
+ \fi
+ \fi
+ \iflabel@defined
+ \global\current@label={\the\@labelcoms}\fi
+ \ifhas@title \install@title@code
+ % subtle: the title has to be installed after any page break
+ % otherwise footlines may contain the wrong title.
+ % also the title has to be global.
+ \fi
+ \ifhas@marks\nxp\ifnin{\nxp\place@mark}\fi
+ %otherwise IniTeX'ing Lollipop will output a page
+ \nxp\xx@label\the\extern@toks\penalty\@M
+ % also subtle: if this white space would be higher, it would
+ % be invisible because of marks et cetera.
+ % insert nobreak after marks/writes to prevent page breaks.
+ \iftext@construct
+ \ifleft@embedded@construct
+ \else \nxp\@vwhite{\the\@whitebefore}\fi
+ \fi
+ }
+\def\inner@start@commands{%
+ \nxp\Open@Group\CSname{\@class}\CSname{\@name}%
+ \install@stop
+ \ifleft@embedded@construct
+ \else \nxp\hold@parskip
+ \nxp\default@everypar
+ \ifwhiteleft@defined
+ \advance@skip\leftskip{\the\@whiteleft}\fi
+ \ifwhiteright@defined
+ \advance@skip\rightskip{\the\@whiteright}\fi
+ \nxp\let\nxp\par=\nxp\@par %explain to me again why this is necessary...
+ \inside@indent \first@indent
+ \fi
+ \advance\nest@depth\@ne
+ }
+
+\def\@gen@close{\inner@end@commands \endgroup \outer@end@commands}
+\def\inner@end@commands{%
+ \nxp\Close@Group\CSname{\@class}\CSname{\@name}%
+ \the\late@extern@toks
+ \ifright@embedded@construct \install@h@after@penalty
+ \else \nxp\leavehmode \install@v@after@penalty
+ \nxp\@vwhite{\the\@whiteafter}\fi
+ }
+\def\outer@end@commands{%
+ \the\after@toks
+ \ifright@embedded@construct \nxp\@headedno
+ \else \after@indent \nxp\dono@parskip
+ \fi}
+\let\esp@hack\relax
+\def\bsp@hack{\let\esp@hack\relax
+ \ifhmode\ifdim\lastskip>\z@\let\esp@hack\ignorespaces\fi\fi}
+
+%%%%%%%%%%%%%%%% Breaking
+
+% Constructs such as 'line' or 'rule' introduce breakpoints.
+% Here's how we deal with that. The \ifat@breakpoint test is set
+% by options such as 'line' or 'vwhite'. Similarly, these options
+% test for this condition and if necessary protect.
+% After 'text' in a text block the condition is set too.
+\newif\ifat@breakpoint
+\add@generic@default{\at@breakpointno}
+\def\protect@breakpoint{\ifat@breakpoint\@add@toks{\nobreak}\fi}
+
+% Break Before
+% user specifies yes/no, numeric value, or name of value
+% yes also does a fill
+% default: place zero penalty
+%
+\newif\ifdefault@break@before
+\adds@generic@default{\default@break@beforeyes}
+\@GenericOption{breakbefore}{\default@break@beforeno
+ \switch {\if\EqualString{#1}}
+ {no} {\def\@beforepenalty{\penalty\@M }}
+ {yes} {\def\@beforepenalty{\CSname{\h@or@v fil}\penalty-\@M}}
+ {0} {\def\@beforepenalty{}}
+ {default}
+ {\edef\cs@e{\def\nxp\@beforepenalty
+ {\penalty\@w@w{#1}\relax}}
+ \cs@e}
+ \endswitch}
+\def\install@v@before@penalty
+ {\ifdefault@break@before\penalty\z@
+ \else\nxp\ifnum\lastpenalty=\z@\@beforepenalty\nxp\fi
+ \fi}
+\def\install@h@before@penalty
+ {\ifdefault@break@before
+ \else\nxp\ifnum\lastpenalty=\z@\@beforepenalty\nxp\fi
+ \fi}
+
+% Break After
+% same story
+%
+\newif\ifdefault@break@after
+\adds@generic@default{\default@break@afteryes}% Heading overrides
+\@GenericOption{breakafter}{\default@break@afterno
+ \switch {\if\EqualString{#1}}
+ {no} {\def\@afterpenalty{\penalty\@M }}
+ {yes} {\def\@afterpenalty{\CSname{\h@or@v fil}\penalty-\@M}}
+ {0} {\def\@afterpenalty{}}
+ {default}
+ {\edef\cs@e{\def\nxp\@afterpenalty
+ {\penalty\@w@w{#1}\relax}}
+ \cs@e}
+ \endswitch}
+\def\install@v@after@penalty
+ {\ifdefault@break@after\penalty\z@ \else\@afterpenalty \fi}
+\def\install@h@after@penalty
+ {\ifdefault@break@after \else\@afterpenalty \fi}
+
+%%%%%%%%%%%%%%%% Surrounding White Space
+% WhiteBefore
+% amount is put in token list \@whitebefore,
+% the \@define... macro uses this to its own discretion
+% For the three text construct this happens in the general macros
+% In ExternalItem a different default is used
+%
+\ifini{\newtoks\@whitebefore \newskip\whitebefore}
+\add@generic@default{\@whitebefore={whitebefore}}
+\whitebefore=6pt plus 6pt\relax
+\@GenericOption{whitebefore}{
+% \edef\cs@e{\@whitebefore={\@w@w{#1}}}\cs@e}
+ \@whitebefore={#1}}
+
+% WhiteAfter
+% same story with \@whiteafter
+%
+\ifini{\newtoks\@whiteafter \newskip\whiteafter}
+\add@generic@default{\@whiteafter={whiteafter}}
+\whiteafter=6pt\relax
+\@GenericOption{whiteafter}{
+% \edef\cs@e{\@whiteafter={\@w@w{#1}}}\cs@e}
+ \@whiteafter={#1}}
+
+% WhiteLeft
+% same story with \@whiteleft
+%
+\ifini{\newtoks\@whiteleft}
+\newif\ifwhiteleft@defined
+\add@generic@default{\@whiteleft\z@toks \whiteleft@definedno}
+\@GenericOption{whiteleft}{
+% \edef\cs@e{\nxp\@whiteleft={\@w@w{#1}}}\cs@e
+ \@whiteleft={#1}
+ \whiteleft@definedyes}
+
+% WhiteRight
+% same story with \@whiteright
+%
+\ifini{\newtoks\@whiteright}
+\newif\ifwhiteright@defined
+\add@generic@default{\@whiteright\z@toks \whiteright@definedno}
+\@GenericOption{whiteright}{
+ \edef\cs@e{\nxp\@whiteright={\@w@w{#1}}}\cs@e
+ \whiteright@definedyes}
+
+%%%%%%%%%%%%%%%% Group Bookkeeping
+\def\@@nulklasse{????}\def\@@nulnaam{????}
+\let\@@groepklasse=\@@nulklasse \let\@Group@Name=\@@nulnaam
+
+% Grouping level during definition
+%
+\new@@counter{group}
+\add@generic@default{\start@counter{group}}
+\add@generic@stop@default{\if\TestCounter:group >0
+ \Emessage{There are groups open in <\@name>}\fi}
+
+\add@generic@default{\def\current@def@group{>>OUTER LEVEL<<}}
+\def\b@group{\edef\@outer@options@list{\@current@options@list}
+ \bgroup\step@counter{group}
+ \ifnextchar[\def@def@group{}%]
+ }
+\def\def@def@group[#1]{\def\current@def@group{#1}}
+\def\e@group{\ifnextchar[\test@def@group\egroup%]
+ }
+\def\test@def@group[#1]{\def\current@test@group{#1}
+ \ifx\current@def@group\current@test@group\egroup
+ \else\Emessage{Closing `\current@def@group' with `\current@test@group'
+ in \@class: \@name}
+ \fi}
+
+
+% Grouping during execution
+%
+\def\@@testklasse{OUTER}\def\@@testnaam{OUTER}
+\def\@DEFgroepsluit{\nxp\Close@Group{\@class}{\@name}}
+\def\@groepERR#1#2{\Wmessage{Unexpected close of
+ <\expandafter\string#1; expected: \expandafter\string#2.}}
+\newcount\group@open@lineno
+\def\Open@Group#1#2{\def\@@groepklasse{#1}\def\@Group@Name{#2}%
+ \Tmessage[gen]{Open \string#1\@space \string#2 @ \the\inputlineno}
+ \group@open@lineno\inputlineno}
+\def\Close@Group#1#2{\def\@@testklasse{#1}\def\@@testnaam{#2}%
+ \ifx\@@testnaam\@Group@Name
+ \Tmessage[gen]{Close \string#1\@space \string#2}%
+ \else \@groepERR{\@@testnaam}{\@Group@Name}\fi}
+\def\Close@all@groups
+ {\ifx\@Group@Name\@@nulnaam
+ \else \Wmessage{Group not closed: \expandafter\string\@Group@Name;
+ start @\the\group@open@lineno}
+ \endgroup
+ \Close@all@groups
+ \fi}
+
+\def\@groeptester{\ifx\@Group@Name\@@nulnaam
+ \else \Wmessage{Group still open: \expandafter\string\@Group@Name}\fi}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%% Counters
+
+% Counter name
+% has been abstracted.
+% this may be removed later for efficiency.
+%
+%\def\counter@name#1{#1@C}%defined above
+\def\cs@counter@name#1{\csn#1@C\ecs}
+\def\counter@@name#1{\CSname{#1@C}}
+\def\counter@value#1{\xp\the\csn#1@C\ecs}
+
+%
+% \NewCounter:COUNTER
+% \newcount\COUNTER@C
+% \CounterRepresentation:COUNTER=1 ; print arabic numeral
+% \StartCounter:COUNTER ; set to 0
+% \COUNTER@RL={} ; create reset list
+%
+% \CounterRepresentation:THING=W
+% if W is another counter, make synonym, otherwise
+% \THING@R <- representation command
+% \THINGCounter = \THING@R \THING@C
+% #1 = naam van een nieuw te definieren teller;
+% #2 = telwijze of naam van teller waar de nieuwe teller synoniem
+% mee moet worden.
+%
+\def\NewCounter:#1 {\new@counter{#1}}
+\def\new@counter#1{
+ \new@@counter{#1}\csarg\edef{#1Value}{\counter@@name{#1}}
+ \CounterRepresentation:{#1}=1
+ \StartCounter:{#1}
+ }
+% given above
+%\def\new@@counter#1{\csarg\newcount{\counter@name{#1}}}
+\def\AdaptiveCounter:#1
+ {\if\UndefinedCS{\counter@name{#1}}\new@counter{#1}\fi
+ \adds@stop@command
+ {\ifWriteExtern\immediate\write\aux@file
+ {\string\SetCounter:#1={\counter@value{#1}}} \fi
+ }}
+
+% Counter allocation in the generic constructs
+% counter:x
+% indicates the mode of representation of the counter
+% of the construct being defined. The counter is first allocated.
+% A switch is thrown that will generate automatic step instructions.
+%
+\newif\ifhas@counter
+\@GenericOption{HasCounter}{
+ \switch {\if\EqualString{#1}}
+ {yes} {\has@counteryes\has@labelyes
+ \if\IsEmptyList{#2}\else\def\this@counter@repr{#2}\fi}
+ {no} {\has@counterno}
+ {default} {\has@counteryes}
+ \endswitch}
+\@GenericOption{counter}{
+ \ifin@label \edef\cs@e{\nxp\@add@toks{\CSname{\@name Counter}}}
+ \cs@e
+ \else\has@counteryes\has@labelyes \def\this@counter@repr{#1}
+ \fi}
+\def\install@counter#1{\new@counter{\@name}%
+ \ifhas@marks\xp\add@mark@item\xp{\@name Counter}\fi
+ \if\IsEmptyList{#1}\else\CounterRepresentation:\@name=#1 \fi
+ }
+
+% Counter-related defaults: initially there is no counter,
+% if a counter starts it counts Arabic unless otherwise indicated,
+% and the countername associated with this construct is
+% made available as an option;
+% later it will be a command, and the option is removed again.
+%
+\add@generic@default{\has@counterno\has@labelno
+ \def\this@counter@repr{1}
+ \csarg\def{\gen@option@name{\@name Counter}}{%
+ \edef\cs@e{\nxp\@add@toks{%\nxp\cprotect
+ \CSname{\@name Counter}}}\cs@e
+ \global\has@counteryes\global\has@labelyes}}
+\add@generic@stop@default
+ {\csarg\let{\gen@option@name{\@name Counter}}\relax}
+\add@generic@stop@default{\ifhas@counter
+ \xp\install@counter\xp{\this@counter@repr}\fi}
+
+%titles are handled below but the actions have to be
+%in this order.
+\add@generic@stop@default
+ {\ifhas@title \ifshort@title \@sTitelize\@command
+ \else \@Titelize{\@command}
+ \fi\fi}
+\add@generic@stop@default{\ifhas@label \@Labelize{\@command}\fi}
+
+
+%%%%%%%%%%%%%%%% Counter Representaton
+% main use: indicate representation of numerical value of counter
+% control sequence \FooCounter <- Foo@R\Foo@C
+% two-step approach necessary because of symbolic reference:
+% not all representations work purely by expansion.
+%
+
+% 1 arabic, i lowercase roman, I uppercase roman
+% a lowercase character, A uppercase Character
+%
+\def\@arabic#1{\number#1 }
+\def\@lcascii#1{{\tempcounta=#1\relax \advance\tempcounta by 96
+ \char\tempcounta\relax}}
+\def\@ucascii#1{{\tempcounta=#1\relax \advance\tempcounta by 64
+ \char\tempcounta\relax}}
+\def\@roman#1{\romannumeral#1 }
+\def\@Roman#1{\uppercase\expandafter{\romannumeral#1}}
+
+% Representation has been abstracted
+%
+\def\counter@repr#1{#1@R}
+
+% Give the representing control sequence (@roman, ...)
+% inside an \edef
+%
+\def\counter@@repr#1{\xp\xp\xp\string\csname#1@R\endcsname}
+
+% Counter Representation (user command)
+% decides if this is a real representation command,
+% or a synonym declaration
+%
+\def\CounterRepresentation:#1=#2 {
+ \if\UndefinedCS{\counter@name{#2}}%is this counter a synonym?
+ \represent@counter{#1}{#2}
+ \else \@SynonymCounter{#1}{#2}
+ \fi}
+\def\represent@counter#1#2{
+ \edef\cs@e{@\if#2iroman\else
+ \if#2IRoman\else \if#2alcascii\else
+ \if#2Aucascii\else arabic\fi\fi\fi\fi}
+% \csarg\xdef{\counter@repr{#1}}{\CSname{\cs@e}}
+ \csarg\edef{\counter@repr{#1}}{\CSname{\cs@e}}
+ \csarg\xdef{#1Counter}{\nxp\cprotect %\xp\string when writing label out
+ \CSname{\counter@repr{#1}}{\nxp\number\counter@@name{#1}}}
+ }
+\def\cprotect{}
+
+\def\PrintCounter:#1 {\csn#1Counter\ecs}
+
+% Synonym Counters
+% share the \FooCounter command, internal name, and reset list
+%
+\def\@SynonymCounter#1#2{
+ \edef\cs@b{\nxp\let\counter@@name{#1}=\counter@@name{#2}
+ \nxp\let\CSname{#1Counter}=\CSname{#2Counter}
+ \nxp\let\CSname{#1@RL}=\CSname{#2@RL}}
+ \cs@b
+ }
+
+% Synonym as generic option
+% sharecounter:xyz
+% Don't allocate a counter, but share the counter of the
+% 'xyz' construct.
+%
+\@GenericOption{sharecounter}{\CounterRepresentation:\@name=#1 }
+
+% Governing counters
+% If a counter governs another counter, the other is reset
+% whenever the first is altered.
+%
+\def\GoverningCounter:#1=#2 {\tempano
+ \if\UndefinedCS{\counter@name{#1}}
+ \Wmessage{No such counter <#1>}
+ \else\if\UndefinedCS{\counter@name{#2}}
+ \Wmessage{No such counter <#2>}
+ \else\tempayes
+ \fi\fi
+ \iftempa\if\UndefinedCS{#2@RL}\csarg\newtoks{#2@RL}
+ \csn #2@RL\ecs={}\fi
+ \append@to@list{#2@RL}{\\#1;}
+ \fi}
+\def\reset@subordinates#1{\if\UndefinedCS{#1@RL}\else
+ \def\\##1;{\start@counter{##1}}%
+ \the\csname #1@RL\endcsname \let\\=\relax
+ \fi}
+
+% User counter manipulation
+% should be global, and should reset subordinate counters
+% and define references.
+%
+\def\StartCounter:#1 {\handle@user@counter{#1}{start}{}}
+\let\ResetCounter\StartCounter
+\def\StepCounter:#1 {\handle@user@counter{#1}{step}{}}
+\def\AddToCounter:#1=#2 {\handle@user@counter{#1}{addto}{#2}}
+\def\BackStepCounter:#1 {\handle@user@counter{#1}{back@step}{}}
+\def\SetCounter:#1=#2 {\handle@user@counter{#1}{set}{#2}}
+\def\handle@user@counter#1#2#3{\if\UndefinedCS{\counter@name{#1}}
+ \Wmessage{Unknown counter: #1}
+ \else \begingroup\globaldefs\@ne
+ \csn#2@counter\ecs{#1}{#3}%
+ \reset@subordinates{#1}\define@reference{#1}%
+ \endgroup
+ \fi}
+
+% Numeric manipulation
+%
+\def\CounterValue:#1 {%
+ \if\UndefinedCS{\counter@name{#1}}0
+ \else \cs@counter@name{#1}\fi
+ }
+\def\TestCounter:#1 {00\fi\ifnum\cs@counter@name{#1}}
+
+% Internal counter manipulation
+% is local and has no side effects
+%
+\def\step@counter#1{\increase@value{\counter@name{#1}}\@ne}
+\def\addto@counter#1#2{\edef\cs@e
+ {\nxp\increase@value{\nxp\counter@name{#1}}{\w@w{#2}}}\cs@e}
+\def\back@step@counter#1{\increase@value{\counter@name{#1}}\m@ne}
+\def\start@counter#1{\set@value{\counter@name{#1}}\z@}
+\def\set@counter#1#2{\edef\cs@e
+ {\nxp\set@value{\nxp\counter@name{#1}}{\w@w{#2}}}\cs@e}
+
+
+%%%%%%%%%%%%%%%% Title
+%
+% All constructs can have titles.
+% By using the option 'title' the user indicates that
+% this particular option has a title.
+% A control sequence \constructTitle is defined.
+%
+% In case the \constructTitle is only used in a macro,
+% the user has to set HasTitle:yes as an option.
+%
+\def\@@@title#1{#1Title}\def\@@title{\@@@title\@name}
+\newif\ifhas@title\add@generic@default{\has@titleno}
+\newif\ifshort@title\add@generic@default{\short@titleno}
+\add@generic@stop@default % we cannot use @@title here!
+ {\ifhas@marks\ifhas@title\xp\add@mark@item\xp{\@name Title}\fi\fi}
+\def\give@title{\global\has@titleyes
+ \global\csarg\let\@@title\@space
+ %to define it until first call
+ }
+\@GenericOption{title}{\give@title
+ \ifin@external \if\IsEmptyList{#1}
+ \external@handle@title{\@name}
+ \else \external@handle@title{#1}\fi
+ \else \if\IsEmptyList{#1}
+ \edef\cs@e{\nxp\@add@toks{\CSname{\@@title}}}\cs@e
+ \else\Wmessage{Parametrized titles only in external}\fi
+ \fi
+ }
+\@GenericOption{HasTitle}{
+ \switch {\if\EqualString{#1}}
+ {yes} {\give@title}
+ {no} {\global\has@titleno}
+ {short} {\give@title \global\short@titleyes}
+ {default} {\give@title}
+ \endswitch
+ }
+
+% this code appears in \outer@start@commands;
+% it will be executed in an \edef
+%
+\newtoks\title@toks
+\def\install@title@code
+ {%\nxp\xp\gdef\nxp\xp\CSname{\@name Title}\nxp\xp{%
+ % \nxp\xp\nxp\maybe@uppercase\nxp\xp{\nxp\the\title@toks}}%
+ \nxp\xp\gdef\nxp\xp\CSname{\@name Title}\nxp\xp
+ {\nxp\the\title@toks}%
+ \ifhas@marks
+ \edef\nxp\cs@e{\nxp\nxp\nxp\refresh@mark@item
+ {\@name Title}{\nxp\the\title@toks}}%
+ \nxp\cs@e
+ \fi}
+
+% Give a macro a title
+%
+%\add@generic@stop@default{\ifhas@title \@Titelize{\@name}\fi} %above!
+%
+\newcount\extra@args \add@generic@default{\extra@args\z@}
+\def\ttl@name#1{ttl@#1}
+\def\@Titelize#1{\edef\cs@e{\let\CSname{\ttl@name{#1}}=\CSname{#1}}\cs@e
+ \ifcase\extra@args %0:
+ \csarg\edef{#1}##1\par
+ {\title@toks\nxp\xp{\nxp\id@##1\nxp\willbeunhskip}%
+% {\title@toks{##1\nxp\protect\nxp\unhskip}%
+ \CSname{\ttl@name{#1}}}
+ \or %1:
+ \csarg\edef{#1}##1##2\par
+ {\title@toks\nxp\xp{\nxp\id@##2\nxp\willbeunhskip}%
+% {\title@toks{##2\nxp\protect\nxp\unhskip}%
+ \CSname{\ttl@name{#1}}{##1}}
+ \or %2:
+ \csarg\edef{#1}##1##2##3\par
+ {\title@toks\nxp\xp{\nxp\id@##3\nxp\willbeunhskip}%
+% {\title@toks{##3\nxp\protect\nxp\unhskip}%
+ \CSname{\ttl@name{#1}}{##1}{##2}}
+ \else \Wmessage{Sorry, too many extra arguments %
+ for `\@class' : `\@name'}
+ \fi}
+\begingroup\catcode`\^^M\active \endlinechar-1\relax%
+% trick: with an active ^^M we can let it expand to \@space
+% not a 100\% solution, true.
+\gdef\@sTitelize#1{
+ \edef\cs@e{\let\CSname{x@\ttl@name{#1}}=\CSname{#1}}\cs@e
+ \csarg\edef{#1}{\begingroup\endlinechar`\nxp\^^M
+ \catcode\endlinechar\active\CSname{\ttl@name{#1}}}
+% short titles can have no unwanted trailing space
+ \ifcase\extra@args %0:
+ \csarg\edef{\ttl@name{#1}}##1^^M
+ {\endgroup\let\nxp^^M\nxp\@space
+ \title@toks\nxp\xp{\nxp\id@##1}%
+% \title@toks{##1\nxp\protect\nxp\unhskip}%
+ \CSname{x@\ttl@name{#1}}}
+ \or %1:
+ \csarg\edef{\ttl@name{#1}}##1##2^^M
+ {\endgroup\let\nxp^^M\nxp\@space
+ \title@toks\nxp\xp{\nxp\id@##2}%
+% \title@toks{##2\nxp\protect\nxp\unhskip}%
+ \CSname{x@\ttl@name{#1}}{##1}}
+ \or %2:
+ \csarg\edef{\ttl@name{#1}}##1##2##3^^M
+ {\endgroup\let\nxp^^M\nxp\@space
+ \title@toks\nxp\xp{\nxp\id@##3}%
+% \title@toks{##3\nxp\protect\nxp\unhskip}%
+ \CSname{x@\ttl@name{#1}}{##1}{##2}}
+ \else \Wmessage{Sorry, too many extra arguments %
+ for `\@class' : `\@name'}
+ \fi}
+\endgroup
+
+% Uppercase titles are a big problem
+% after \MakeUpperCase
+% any appearing title (including when it comes out of a mark)
+% is uppercased
+%
+\newif\ifUpperCasing \def\MakeUpperCase{\UpperCasingyes}
+\def\maybe@uppercase{\ifUpperCasing\uppercase\xp\fi}
+
+%%%%%%%%%%%%%%%% M O D E S
+%
+% controls whether a construct can start/end as part of a paragraph.
+% chooses between a lot of horizontal/vertical commands.
+%
+% this should appear as one of the first options.
+% maybe generate an error msg if it doesn't
+%
+\newif\ifleft@embedded@construct
+\newif\ifright@embedded@construct
+\add@generic@default{\left@embedded@constructno\right@embedded@constructno}
+\newif\if@hmode \newif\if@vmode
+\add@generic@default{\@hmodeno\@vmodeyes}
+\@GenericOption{embedded}{\switch {\if\EqualString{#1}}
+ {yes} {\left@embedded@constructyes\right@embedded@constructyes}
+ {no} {\left@embedded@constructno \right@embedded@constructno}
+ {left} {\left@embedded@constructyes\right@embedded@constructno}
+ {right} {\left@embedded@constructno \right@embedded@constructyes}
+ {default} {\Wmessage{Strange modifier: `embedded:#1'}}
+ \endswitch
+ \ifleft@embedded@construct \@hmodeyes \@vmodeno \fi}
+
+% Mode dependent
+%
+\def\h@or@v{\ifleft@embedded@construct h\else v\fi}
+\def\append@no@hv@break
+ {\edef\cs@e{\nxp\@add@toks{%\if@hmode \if@vmode\else\nxp\leavevmode\fi\fi
+ %\if@vmode \if@hmode\else\nxp\leavehmode\fi\fi
+ \nxp\nobreak}}
+ \cs@e}
+
+%%%%%%%%%%%%%%%% Boxes
+%
+% Line
+% is a \hbox to \hsize
+% mainly used to determine the width of stuff inside it.
+%
+\newif\ifin@line
+\add@generic@default{\in@lineno}
+\newcount\text@in@line \newtoks\line@toks \newbox\line@box
+\def\rm@to@end@of@box{\everyvbox{}%
+ \setbox\tempboxa\vbox\bgroup
+ \aftergroup\rm@tmp@box}
+\def\rm@tmp@box{\setbox\tempboxa\box\voidb@x\egroup}
+\def\definitely@to@hsize{\def\maybe@to@hsize{ to\hsize}}
+\@GenericOption{line}{
+ \switch {\if\EqualString{#1}}
+ {start} {\protect@breakpoint
+ \b@group[line]\in@lineyes\line@toks{}
+ \temp@options@list{line@toks}
+ \@add@toks{\hbox \maybe@to@hsize\bgroup}\text@in@line\z@
+ }
+ {stop} {\@add@toks{\hfil\egroup}\revert@options@list
+ \ifnum\text@in@line>\z@
+ \edef\cs@e{\nxp\@add@toks
+ {\line@toks={\the\line@toks}}}\cs@e
+ \@add@toks{\begingroup\everyvbox{\rm@to@end@of@box}%
+ \let\maybe@to@hsize\relax
+ \setbox\line@box\the\line@toks
+ \tempdima\hsize\advance\tempdima-\wd\line@box
+ \everyvbox{}\definitely@to@hsize
+ \everyvbox{\hsize\tempdima}\the\line@toks
+ \endgroup}
+ \else \@add@toks{\definitely@to@hsize}
+ \toks@add@toks{line@toks}
+ \fi
+ \e@group[line]\at@breakpointyes}
+ {default} {\Wmessage{Strange modifier: `line:#1'}}
+ \endswitch}
+
+% Tekstkolom. Is een \vbox of \vtop.
+% Openen met 'begin' 'ophangen', 'topregel' of 'voetregel',
+% start,topregel : \vtop
+% voetregel : \vbox
+% ophangen : \vtop{\kern\z@
+% Eindigen met 'stop'
+\@GenericOption{textcolumn}{
+ \switch {\if\EqualString{#1}}
+ {stop} {\@add@toks{\egroup}\global\BlockWidth\hsize
+ \e@group[textcolumn]\at@breakpointyes}
+ {start} {\open@text@column\vtop{}}
+ {topline} {\open@text@column\vtop{}}
+ {hang} {\open@text@column\vtop{\kern\z@}}
+ {footline} {\open@text@column\vbox{}}
+ {default} {\Wmessage{Strange modifier: `textcolumn:#1=#2'}}
+ \endswitch}
+\def\open@text@column#1#2%
+ {\ifin@line\advance\text@in@line\@ne\else\protect@breakpoint\fi
+ \@add@toks{#1\bgroup#2\leftskip\z@ \Indent:no \leavevmode}
+ \b@group[textcolumn]
+ \ifin@line\else\aftergroup\at@breakpointyes\fi
+ }
+
+% Depth strut: for use in line
+\@GenericOption{depth}{
+ \edef\cs@e{\nxp\@add@toks{\vrule width\z@ height\z@ depth \@w@w{#1}}}
+ \cs@e}
+
+% Block
+% is an hbox
+% opening
+% 1/ blok:start --> \setbox\block@box=\hbox{
+% and \block@closing = }
+% 2/ blok:hang --> \setbox\block@box=\hbox{\vtop{\kern\z@\hbox{
+% and \block@closing = }}}
+% closing
+% 1/ blok:stop --> \block@closing \box\block@box
+% 2/ stickout:left/right --> \block@closing \l/rlap{\box\block@box}
+% 3/ fillupto:foo --> \block@closing
+% \hbox to \foo{\unhbox\block@box\hfil}
+%
+\newbox\block@box \newif\ifin@box
+\add@generic@default{\in@boxno
+ \def\block@closing{\ifin@box\else
+ \Wmessage{Closing `block', but not opened. This is serious!}\fi}
+ }
+\def\block@closing{}
+\newdimen\BlockWidth
+\def\Measure@Block{\global\BlockWidth\wd\block@box}
+\@GenericOption{block}{
+ \switch {\if\EqualString{#1}}
+ {stop} {\stop@block}
+ {hang} {\start@block
+ {\vtop\bgroup\kern\z@\hbox\bgroup}
+ {\egroup\egroup}}
+ {start} {\start@block{}{}}
+ {default} {\Wmessage{Strange option: `block:#1'}}
+ \endswitch}
+\def\start@block#1#2{
+ \ifin@line\else\protect@breakpoint\fi
+ \@add@toks{\setbox\block@box=\hbox\bgroup#1}
+ \b@group[block]
+ \ifin@line\else\aftergroup\at@breakpointyes\fi
+ \def\block@closing{\@add@toks{#2\egroup\Measure@Block}}
+ }
+\def\stop@block{\block@closing
+ \ifin@box \@add@toks{\advance\hsize by -\wd\block@box} \fi
+ \@add@toks{\box\block@box}
+ \e@group[block]}
+
+\@GenericOption{fillupto}{
+ \block@closing \e@group[block]
+ \edef\cs@e{\nxp\@add@toks{\hbox to \@w@w{#1}{\unhbox\block@box\hfil}}}
+ \cs@e
+ \ifin@line \edef\cs@e{\nxp\@add@toks{\advance\hsize by -\@w@w{#1}}}
+ \cs@e \fi
+ }
+\@GenericOption{stickout}{
+ \block@closing \e@group[block]
+ \switch {\if\EqualString{#1}}
+ {right} {\stickout@right{#2}}
+ {left} {\stickout@left{#2}}
+ {default} {\Wmessage{Unknown qualifier (stickout:) `#1'}}
+ \endswitch
+ }
+\def\stickout@left#1{
+ \@add@toks{\llap}
+ \if\IsEmptyList{#1}
+ \@add@toks{{\box\block@box}}
+ \else \edef\cs@e{\nxp\@add@toks{{\hbox to \@w@w{#1}
+ {\box\block@box\hss}}}}
+ \cs@e
+ \fi}
+\def\stickout@right#1{
+ \@add@toks{\rlap}
+ \if\IsEmptyList{#1}
+ \@add@toks{{\box\block@box}}
+ \else \edef\cs@e{\nxp\@add@toks{{\hbox to \@w@w{#1}
+ {\hss\box\block@box}}}}
+ \cs@e
+ \fi}
+
+%%%%%%%%%%%%%%%% Tidbits
+
+% Commands
+%
+\@GenericOption{command}{
+ \ifin@external \external@handle@expandable{#1}{\csn#1\ecs}{<#1>}
+ \else
+ \if\UndefinedCS{#1}\Wmessage{Undefined command: <#1>}\fi
+ \edef\cs@e{\nxp\@add@toks{\CSname{#1}}}\cs@e
+ \fi}
+\@GenericOption{CSname}{
+ \edef\cs@e{\nxp\@add@toks{\CSname{#1}}}\cs@e}
+
+% Literal text.
+% only problem if this is a colon.
+%
+\@GenericOption{literal}{\@add@toks{#1}}
+
+% Arguments.
+%
+\@GenericOption{arg}{\edef\cs@e
+ {\nxp\@add@toks{\iftrue{\else}\fi#1\iffalse{\else}\fi}}
+ \cs@e}
+\@GenericOption{OpenBrace}{\edef\cs@e
+ {\nxp\@add@toks{\iftrue{\else}\fi}}
+ \cs@e}
+\@GenericOption{CloseBrace}{\edef\cs@e
+ {\nxp\@add@toks{\iffalse{\else}\fi}}
+ \cs@e}
+% Extra Commands before and after
+%
+\newtoks\before@toks \add@generic@default{\before@toks{}}
+\@GenericOption{commandbefore}{
+ \edef\cs@e{\nxp\append@to@list{before@toks}{\CSname{#1}}}
+ \cs@e}
+\newtoks\after@toks \add@generic@default{\after@toks{}}
+\def\add@after@command#1{\append@to@list{after@toks}{#1}}
+\@GenericOption{commandafter}{
+ \edef\cs@e{\nxp\add@after@command{\CSname{#1}}}
+ \cs@e}
+
+\endinput
+
+% 2016/04/13 Chnaged \lolli@name to \lollipop@name
+% 2014/04/18 Fixed the wrong numbering of nested enumerate lists
+% 92/11/03 Improved penalty handling for embedded environments
+% \ifini test extended to make loading on top of plain possible
+% 92/11/08 Breakpoint protection into line/block/textcolumn
+% 92/11/14 Resetlist generation made conditional
+% 92/11/21 option 'arg'
+% 92/12/12 \sTitelize, \give@title
+% 93/07/30 late@after@toks, inputlineno in group errmsg \ No newline at end of file
diff --git a/macros/lollipop/tex/lollipop.tex b/macros/lollipop/tex/lollipop.tex
new file mode 100644
index 0000000000..5b77aabd78
--- /dev/null
+++ b/macros/lollipop/tex/lollipop.tex
@@ -0,0 +1,141 @@
+% lollipop.tex; master file for the Lollipop tex format.
+% This file and all input files and all files for the manual
+% (with the exception of hyphen.tex and btxmac.tex)
+% copyright 1992/3 Victor Eijkhout
+% copyright 2014--2016 Vafa Khalighi
+%
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%% L O L L I P O P T E X %%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% o
+% L O L L I P O P
+% | |
+%
+\catcode`\@=11
+
+\input lollipop-plain
+
+\input lollipop-tools
+
+\input lollipop-define
+
+\input lollipop-fonts
+\input lollipop-fontdefs
+
+\input lollipop-text
+
+\input lollipop-document
+
+\input lollipop-heading
+
+\input lollipop-output
+
+\input lollipop-float
+
+\input lollipop-lists
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\showboxdepth=7 \showboxbreadth=300
+\errorcontextlines=\maxdimen
+
+\let\willbeunhskip\unhskip
+
+\Typeface:ComputerModern
+\Pointsize:10
+\Style:bold \Style:slant \Style:italic \Style:roman
+
+\Distance:verbatimwhiteleft=levelindent
+\Distance:verbatimwhitebefore={0pt plus 1pt}
+\Distance:verbatimwhiteafter={0pt plus 1pt}
+
+%\tracingmacros=2\tracingcommands\tracingmacros
+\DefineTextBlock:Ver
+ whitebefore:verbatimwhitebefore whiteafter:verbatimwhiteafter
+ breakbefore:200 breakafter:-100
+ whiteleft:verbatimwhiteleft
+ command:vVer text Stop
+
+\DefinePageGrid:RightPage height:page=8in width:page=5in
+ textband:start text textband:stop
+ vwhite:12pt
+ band:start PageCounter band:stop
+ Stop
+\RightPage
+
+\hyphenation{Eijk-hout dis-cre-tio-na-ry al-ign-ment met-hod
+ met-hods}
+
+% v0.9 First public release October 1992
+% v0.91 TeX3 based lolplain, penalties in embedded constructs,
+% splittopskip
+% v0.92 Copyright notices added, math family setting,
+% bugs in penalties corrected
+% v0.93 Nobreaks in constructs, synonym counters, start floats
+% v0.94 Adaptive distances and counters
+% v0.95 BibTeX, short titles, improved external handling,
+% \CurrentOutput changed
+% v0.96 repair: counters, ToExternal, option:title=Smthng,
+% changed copyright status! fontdefs file, late externals
+% EmptyList -> IsEmp...
+%
+% v0.97 Update and organized files and generated various
+% formats for Lollipop.
+%
+% v0.98 Changed filenames; the new filename has now
+% "lollipop-" prefix, and fixed typewriter font.
+%
+% v0.99 Improved ini files, and the error in address.tex
+% example fixed.
+%
+% v1.00 Updated lollipop-plain.tex.
+%
+% v1.01 Updated lollipop-text.tex (changed "#1 cs to \"#1 cs
+% to be compatible with plain
+%
+% v1.02 Updated lollipop-text.tex (defined \EveryParagraph,
+% \EveryMath, and \EveryDisplay), defined
+% \PointSizeScriptSizes:12
+%
+% v1.03 Fixed the wrong numbering of nested enumerate lists
+%
+% v1.04 Updated version number and date of the format in \fmtversion
+%
+% v1.05 Changed \lolli@name to \lollipop@name
+% added \footnoterule to output routine
+% defined \PushLeftIndentLevel, \PopLeftIndentLevel,
+% \PushRightIndentLevel, \PopRightIndentLevel,
+% \PushLeftRightIndentLevels, and \PopLeftRightIndentLevels
+% commands. \PushIndentLevel is now a synonym for
+% \PushLeftIndentLevel and \PopIndentLevel is a synonym
+% for \PopLeftIndentLevel
+% fixed the error caused by \newhelp
+%
+% v1.06 Defined \FrenchSpacing
+%
+\edef\fmtname{\lollipop@name}%defined in Tools
+\def\fmtversion{v1.07, 21 May 2016}
+\append@to@list{everyjob}{\message{
+>>>> This is Lollipop TeX (\fmtversion) <<<<}}
+
+\makeatother
+\errorstopmode
+\endinput