diff options
Diffstat (limited to 'web/tweb')
-rw-r--r-- | web/tweb/bin/unprimit | 166 | ||||
-rw-r--r-- | web/tweb/bin/web2tex | 133 | ||||
-rw-r--r-- | web/tweb/idxsty/chn.ist | 9 | ||||
-rw-r--r-- | web/tweb/idxsty/dnd.ist | 10 | ||||
-rw-r--r-- | web/tweb/idxsty/und.ist | 10 | ||||
-rw-r--r-- | web/tweb/makefile | 83 | ||||
-rw-r--r-- | web/tweb/rcs/plain.tw% | 2606 | ||||
-rw-r--r-- | web/tweb/rcs/tweb.tw% | 835 | ||||
-rw-r--r-- | web/tweb/texinput/slidelib.sty | 152 | ||||
-rw-r--r-- | web/tweb/texinput/verbatim.tex | 252 | ||||
-rw-r--r-- | web/tweb/tug95/doc/paper.pdf | bin | 0 -> 62294 bytes | |||
-rw-r--r-- | web/tweb/tug95/doc/plain.pdf | bin | 0 -> 396058 bytes | |||
-rw-r--r-- | web/tweb/tug95/doc/slides.pdf | bin | 0 -> 18354 bytes | |||
-rw-r--r-- | web/tweb/tug95/doc/tweb.pdf | bin | 0 -> 124893 bytes | |||
-rw-r--r-- | web/tweb/tug95/paper.tex | 419 | ||||
-rw-r--r-- | web/tweb/tug95/slides.tex | 60 | ||||
-rw-r--r-- | web/tweb/tweb.sty | 663 | ||||
-rw-r--r-- | web/tweb/vc.mnu | 24 |
18 files changed, 5422 insertions, 0 deletions
diff --git a/web/tweb/bin/unprimit b/web/tweb/bin/unprimit new file mode 100644 index 0000000000..b77df7e85b --- /dev/null +++ b/web/tweb/bin/unprimit @@ -0,0 +1,166 @@ +#!/usr/bin/perl + +@index = <>; + +# >> A << + +$primitives = '{above@|' . '{abovedisplayshortskip@|' . + '{abovedisplayskip@|' . '{accent@|' . '{adjdemerits@|' . + '{advance@|' . '{afterassignment@|' . '{aftergroup@|' . + '{atop@|' . '{atopwithdelims@' ; + +@index = grep( !/$primitives/, @index); + +# >> B << + +$primitives = '{badness@|' . '{baselineskip@|' . '{batchmode@|' . + '{begingroup@|' . '{belowdisplayshortskip@|' . '{belowdisplayskip@|' . + '{binoppenalty@|' . '{botmark@|' . '{box@|' . '{boxmaxdepth@|' . + '{brokenpenalty@' ; + +@index = grep( !/$primitives/, @index); + +# >> C << + +$primitives = '{catcode@|' . '{char@|' . '{chardef@|' . '{cleaders@|' . + '{closein@|' . '{closeout@|' . '{clubpenalty@|' . '{copy@|' . + '{count@|' . '{countdef@|' . '{cr@|' . '{crcr@|' . + '{csname@' ; + +@index = grep( !/$primitives/, @index); + +# >> D << + +$primitives = '{day@|' . '{deadcycles@|' . '{def@|' . + '{defaulthyphenchar@|' . '{defaultskewchar@|' . + '{delcode@|' . '{delimiter@|' . '{delimiterfactor@|' . + '{delimitershortfall@|' . '{dimen@|' . '{dimendef@|' . + '{discretionary@|' . '{displayindent@|' . '{displaylimits@|' . + '{displaystyle@|' . '{displaywidowpenalty@|' . '{displaywidth@|' . + '{divide@|' . '{doublehyphendemerits@|' . '{dp@|' . + '{dump@' ; + +@index = grep( !/$primitives/, @index); + +# >> E << + +$primitives = '{edef@|' . '{else@|' . '{emergencystretch@|' . + '{end@|' . '{endcsname@|' . '{endgroup@|' . '{endinput@|' . + '{endlinechar@|' . '{eqno@|' . '{errhelp@|' . '{errmessage@|' . + '{errorcontextlines@|' . '{errorstopmode@|' . + '{escapechar@|' . '{everycr@|' . '{everydisplay@|' . + '{everyhbox@|' . '{everyjob@|' . '{everymath@|' . '{everypar@|' . + '{everyvbox@|' . '{exhyphenpenalty@|' . '{expandafter@' ; + +@index = grep( !/$primitives/, @index); + +# >> F--G << + +$primitives = '{fam@|' . '{fi@|' . '{finalhyphendemerits@|' . + '{firstmark@|' . '{floatingpenalty@|' . '{font@|' . + '{fontdimen@|' . '{fontname@|' . '{futurelet@|' . + '{gdef@|' . '{global@|' . '{globaldefs@' ; + +@index = grep( !/$primitives/, @index); + +# >> H << + +$primitives = '{halign@|' . '{hangafter@|' . '{hangindent@|' . + '{hbadness@|' . '{hbox@|' . '{hfil@|' . '{hfill@|' . + '{hfuzz@|' . '{hoffset@|' . '{holdinginserts@|' . '{hrule@|' . + '{hsize@|' . '{hskip@|' . '{hss@|' . '{ht@|' . '{hyphenation@|' . + '{hyphenchar@|' . '{hyphenpenalty@' ; + +@index = grep( !/$primitives/, @index); + +# >> I--K << + +$primitives = '{if@|' . '{ifcase@|' . '{ifcat@|' . '{ifdim@|' . + '{ifeof@|' . '{ifffalse@|' . '{ifhbox@|' . '{ifhmode@|' . + '{ifinner@|' . '{ifmmode@|' . '{ifnum@|' . '{ifodd@|' . + '{iftrue@|' . '{ifvbox@|' . '{iifvmode@|' . '{ifvoid@|' . '{ifx@|' . + '{ignorespaces@|' . + '{immediate@|' . '{indent@|' . '{input@|' . '{inputlineno@|' . + '{insert@|' . '{insertpenalties@|' . '{interlinepenalty@|' . + '{jobname@|' . + '{kern@' ; + +@index = grep( !/$primitives/, @index); + +# >> L--M << + +$primitives = '{language@|' . '{lastbox@|' . '{lastkern@|' . + '{lastpenalty@|' . '{lastskip@|' . '{lccode@|' . '{leaders@|' . + '{left@|' . '{lefthyphenmin@|' . '{leftskip@|' . '{leqno@|' . '{let@|' . + '{limits@|' . '{linepenalty@|' . '{lineskip@|' . '{lineskiplimit@|' . + '{long@|' . '{looseness@|' . '{lower@|' . '{lowercase@|' . + '{mag@|' . '{mark@|' . '{mathaccent@|' . '{mathbin@|' . + '{mathchar@|' . '{mathchardef@|' . '{mathchoice@|' . + '{mathclose@|' . '{mathcode@|' . '{mathinner@|' . '{mathop@|' . + '{mathopen@|' . '{mathord@|' . '{mathpunct@|' . '{mathrel@|' . + '{mathsurround@|' . '{maxdeadcycles@|' . '{maxdepth@|' . + '{meaning@|' . '{medmuskip@|' . '{message@|' . '{mkern@|' . + '{month@|' . '{moveleft@|' . '{moveright@|' . '{mskip@|' . + '{multiply@|' . '{muskip@|' . '{muskipdef@' ; + +@index = grep( !/$primitives/, @index); + +# >> N--P << + +$primitives = '{newlinechar@|' . '{noalign@|' . '{noboundary@|' . + '{noexpand@|' . '{noindent@|' . '{nolimits@|' . '{nonscript@|' . + '{nonstopmode@|' . + '{nulldelimiterspace@|' . '{nullfont@|' . '{number@|' . + '{omit@|' . '{openin@|' . '{openout@|' . '{or@|' . '{outer@|' . + '{output@|' . '{outputpenalty@|' . '{over@|' . '{overfullrule@|' . + '{overline@|' . '{overwithdelims@|' . + '{pagedepth@|' . '{pagefilllstretch@|' . '{pagefillstretch@|' . + '{pagefilstretch@|' . '{pagegoal@|' . '{pageshrink@|' . + '{pagestretch@|' . '{pagetotal@|' . '{par@|' . '{parparfillskip@|' . + '{parindent@|' . '{parshape@|' . '{parskip@|' . '{patterns@|' . + '{pausing@|' . '{penalty@|' . '{postdisplaypenalty@|' . + '{predisplaypenalty@|' . '{predisplaysize@|' . '{pretolerance@|' . + '{prevdepth@|' . '{prevgraf@' ; + +@index = grep( !/$primitives/, @index); + +# >> R--S << + +$primitives = '{radical@|' . '{raise@|' . '{read@|' . '{relax@|' . + '{relpenalty@|' . '{right@|' . '{righthyphenmin@|' . + '{rightskip@|' . '{romannumeral@|' . '{scriptfont@|' . + '{scriptscriptfont@|' . '{scriptscriptstyle@|' . + '{scriptspace@|' . '{scriptstyle@|' . '{scrollmode@|' . + '{setbox@|' . '{setlanguage@|' . '{sfcode@|' . '{shipout@|' . + '{show@|' . '{showbox@|' . '{showboxbreadth@|' . + '{showboxdepth@|' . '{showlists@|' . '{showthe@|' . + '{skewchar@|' . '{skip@|' . '{skipdef@|' . '{spacefactor@|' . + '{spaceskip@|' . '{span@|' . '{special@|' . '{splitbotmark@|' . + '{splitfirstmark@|' . '{splitmaxdepth@|' . '{splittopskip@|' . + '{string@' ; + +@index = grep( !/$primitives/, @index); + +# >> T--Z << + +$primitives = '{tabskip@|' . '{textfont@|' . '{textstyle@|' . + '{the@|' . '{thickmuskip@|' . '{thinmuskip{' . '{time@|' . + '{toks@|' . '{toksdef@|' . '{tolerance@|' . '{topmark@|' . + '{topskip@|' . '{tracingcommands@|' . '{tracinglostchars@|' . + '{tracingmacros@|' . '{tracingonline@|' . '{tracingoutput@|' . + '{tracingpages@|' . '{tracingparagraphs@|' . '{tracingrestores@|' . + '{tracingstats@|' . + '{uccode@|' . '{uchyph@|' . '{underline@|' . '{unhbox@|' . + '{unhcopy@|' . '{unkern@|' . '{unpenalty@|' . '{unskip@|' . + '{unvbox@|' . '{unvcopy@|' . '{uppercase@|' . + '{vadjust@|' . '{valign@|' . '{vbadness@|' . '{vbox@|' . '{vcenter@|' . + '{vfil@|' . '{vfill@|' . '{vfilneg@|' . '{vfuzz@|' . + '{voffset@|' . '{vrule@|' . '{vsize@|' . '{vskip@|' . + '{vsplit@|' . '{vss@|' . '{vtop@|' . + '{wd@|' . '{widowpenalty@|' . '{write@|' . + '{xdef@|' . '{xleaders@|' . '{xspaceskip@|' . + '{year@'; + +@index = grep( !/$primitives/, @index); + +print " @index\n"; diff --git a/web/tweb/bin/web2tex b/web/tweb/bin/web2tex new file mode 100644 index 0000000000..78b2994b8c --- /dev/null +++ b/web/tweb/bin/web2tex @@ -0,0 +1,133 @@ +BEGIN { code = 0
+ codeno = 0
+ codechunkno = 1
+
+ definitions = ":def:|:edef:|:xdef:|:gdef:"\
+ ":let:|"\
+ ":chardef:|:mathchardef:|"\
+ ":newcount:|:countdef:|"\
+ ":newdimen:|:dimendef:|"\
+ ":newskip:|:skipdef:|"\
+ ":newtoks:|:toksdef:|"\
+ ":muskipdef:|"\
+ ":newif:|"\
+ ":newbox:|"\
+ ":read:"\
+ ":font:"
+
+ print "\\input tweb.sty\n\n"\
+ "{\\catcode`\\| = 0 |catcode`|\\ = 12 %\n"\
+ "|obeylines |gdef|ttfinish#1\\EDOC{|gobblespace#1|endgroup}}\n\n"\
+ "\\makeindexes\n"
+}
+
+END { print "\n"\
+ "\\printuserleveldefs\n"\
+ "\\printdefs\n"\
+ "\\printchunks\n"\
+ "\\bye"
+}
+
+
+/^@text %%% *version *= *"/ \
+{
+ gsub(/^@text %%% *version *= *"/, "")
+ gsub(/",/, "")
+ printf "\\gdef \\RCSversion {%s}\n", $0
+ next
+}
+
+/^@file / { printf "\\def\\filename{%s}\n", substr($0,7) ; next }
+
+/^@quote$/ { printf "\|" ; next }
+/^@endquote$/ { printf "\|" ; next }
+
+/^@begin code/ {
+ print "\\BEGINCODE"
+ code = 1
+ codeno = $3
+ next
+ }
+/^@end code/ {
+ print "\\ENDCODE"
+ code = 0
+ next
+ }
+
+/^@begin docs/ {
+ printf "\\BEGINDOC\n"
+ next
+ }
+/^@end docs/ { printf "\\ENDDOC\n" ; next }
+
+/^@defn / {
+ gsub(/\[\[/, "\\CODE "); gsub(/]]/, "\\EDOC")
+ name = substr($0,7)
+ defs[name] += 1
+ printf "\\noindent\\LA %s\\RA", name
+
+ if (defs[name] > 1)
+ printf "$+\\!\\!\\equiv$"
+ else
+ printf "$\\equiv$"
+
+ gsub("@", "\"@", name)
+ printf "\%\n\\chk{\\LA %s\\RA}"\
+ "\n\\nobreak\\medskip", name
+
+ next
+ }
+/^@use / {
+ gsub(/\[\[/, "\\CODE "); gsub(/]]/, "\\EDOC")
+ name = substr($0,6)
+ used[name] = codeno
+ printf "\\LA %s\\RA", name
+ gsub("@", "\"@", name)
+ printf "\%\n\\chk{\\LA %s\\RA}", name, name
+
+ getline
+ next
+ }
+
+/^@literal / { printf "%s", substr($0, 10) ; next }
+
+/^@nl$/ { printf "\n" ; next }
+
+/^@text / { line = junk = substr($0,7)
+ indexed = ""
+ found = ""
+
+ if (code)
+ {
+ while (match(junk, /\\[a-zA-Z@]+/)>0\
+ && substr(junk, 1, RSTART) !~ /%/)
+ {
+ prefix = "\\ddx{"
+
+ found = substr(junk, RSTART+1, RLENGTH-1)
+ junk = substr(junk, RSTART+RLENGTH)
+
+ if ( ":" found ":" ~ definitions )
+ {
+ prefix = "\\udx{"
+ match(junk, /\\[a-zA-Z@]+|\\[^a-zA-Z@]/)
+ found = substr(junk, RSTART+1, RLENGTH-1)
+ junk = substr(junk, RSTART+RLENGTH)
+ }
+
+ if (found != "" && found !~ /[^a-zA-Z@]/)
+ {
+ gsub("@", "\"@", found)
+ indexed = "\%\n"\
+ prefix found\
+ "@\\\\" found "\|N{"\
+ codechunkno "}}" indexed
+ }
+ }
+ printf "\\NO{%d}\\CODE %s\\EDOC%s",\
+ codechunkno++, line, indexed
+ }
+ else
+ printf "%s", line
+ }
+
diff --git a/web/tweb/idxsty/chn.ist b/web/tweb/idxsty/chn.ist new file mode 100644 index 0000000000..5c953851d8 --- /dev/null +++ b/web/tweb/idxsty/chn.ist @@ -0,0 +1,9 @@ +keyword +"\\E" +preamble +"\n\n\\beginchunks\n" +postamble +"\n\n\\endindex\n\n" +delim_0 +"\\qquad" + diff --git a/web/tweb/idxsty/dnd.ist b/web/tweb/idxsty/dnd.ist new file mode 100644 index 0000000000..038c84b8a8 --- /dev/null +++ b/web/tweb/idxsty/dnd.ist @@ -0,0 +1,10 @@ +keyword +"\\E" +preamble +"\n\n\\begindefs\n" +postamble +"\n\n\\endindex\n\n" +delim_0 +"\\quad" +delim_r +"-" diff --git a/web/tweb/idxsty/und.ist b/web/tweb/idxsty/und.ist new file mode 100644 index 0000000000..eeb135c40b --- /dev/null +++ b/web/tweb/idxsty/und.ist @@ -0,0 +1,10 @@ +keyword +"\\E" +preamble +"\n\n\\beginuserleveldefs\n" +postamble +"\n\n\\endindex\n\n" +delim_0 +"\\quad" +delim_r +"-" diff --git a/web/tweb/makefile b/web/tweb/makefile new file mode 100644 index 0000000000..5f0fbf9022 --- /dev/null +++ b/web/tweb/makefile @@ -0,0 +1,83 @@ +#--------------------------------------------------------
+# $Id: Makefile,v 1.9 1995/07/12 22:25:36 web Exp web $
+#
+# Unix Makefile for TWEB
+#
+#--------------------------------------------------------
+# !!! put first tweb.sty in the tex search path
+
+# place for web2awk and other scripts
+SCRIPTDIR = BIN
+
+# place for index styles
+INDEXDIR = IDXSTY
+
+# name of makeindex program
+MAKEINDEX = makeindex
+
+#========================================================
+
+.SUFFIXES: .dvi .tex .sty .tw
+
+.tex.dvi:
+ tex $*.tex
+ $(MAKEINDEX) -s $(INDEXDIR)/dnd.ist -o $*.dnd $*.ddx
+ $(MAKEINDEX) -s $(INDEXDIR)/und.ist -o $*.und $*.udx
+ $(MAKEINDEX) -s $(INDEXDIR)/chn.ist -o $*.chn $*.chk
+ tex $*.tex
+ touch $*.tex
+
+.tw.tex:
+ $(SCRIPTDIR)/web2tex $*.tw > $*.tex
+
+.tw.sty:
+ markup $*.tw | nt > $*.sty
+
+.tw.dvi:
+ make $*.tex
+ make $*.dvi
+
+#----------------------------------------------------
+
+.PHONY: help clean veryclean archive unprimitivize
+
+help:
+ @ echo
+ @ echo Usage: for only one TWEB file
+ @ echo =======================================================
+ @ echo " Weaving: make `basename *.tw .tw`.tex"
+ @ echo " Tangling: make `basename *.tw .tw`.sty"
+ @ echo " Texing: make `basename *.tw .tw`.dvi"
+ @ echo "Making archive: make archive"
+ @ echo " Cleaning: make clean (or veryclean)"
+ @ echo =======================================================
+ @ echo
+
+clean:
+ - rm -f *.log *.tex\
+ *.ilg *.chk *.chn *.ddx *.dnd *.udx *.und *.DDX *.UDX\
+ *.toc *.ref
+
+veryclean:
+ - rm -f *.dvi *.log *.tex\
+ *.ilg *.chk *.chn *.ddx *.dnd *.udx *.und *.DDX *.UDX\
+ *.toc *.ref
+
+archive:
+ - cd .. ; rm $(notdir $(shell pwd)).zip
+ cd .. ; zip -r $(notdir $(shell pwd)) $(notdir $(shell pwd))/*
+
+unprimitivize:
+ @ echo
+ @ echo Be patient...
+ @ echo
+ - $(foreach var, $(basename $(wildcard *.tw)),\
+ $(SCRIPTDIR)/unprimitivize $(var).ddx > $(var).DDX;\
+ mv $(var).DDX $(var).ddx;)
+ - $(foreach var, $(basename $(wildcard *.tw)),\
+ $(SCRIPTDIR)/unprimitivize $(var).udx > $(var).UDX;\
+ mv $(var).UDX $(var).udx;)
+ - $(foreach var, $(basename $(wildcard *.tw)),\
+ $(MAKEINDEX) -s $(INDEXDIR)/dnd.ist -o $(var).dnd $(var).ddx;\
+ $(MAKEINDEX) -s $(INDEXDIR)/und.ist -o $(var).und $(var).udx;\
+ tex $(var).tex)
diff --git a/web/tweb/rcs/plain.tw% b/web/tweb/rcs/plain.tw% new file mode 100644 index 0000000000..9f7064aa43 --- /dev/null +++ b/web/tweb/rcs/plain.tw% @@ -0,0 +1,2606 @@ +head 1.1;
+access;
+symbols;
+locks;
+comment @# @;
+
+
+1.1
+date 95.07.12.22.05.45; author WB; state Exp;
+branches;
+next ;
+
+
+desc
+@@
+
+
+1.1
+log
+@Initial revision
+@
+text
+@%%%-*- compile-command: "notangle plain.tw > plain.sty" -*-
+%%%=====================================================================
+%%% @@Noweb-file{
+%%% author = "W\l{}odek Bzyl",
+%%% version = "$Id: plain.tw,v 4.12 1995/07/10 21:32:25 web Exp $",
+%%% date = "25 April 1995",
+%%% time = "22:05:47 MET",
+%%% filename = "plain.tw",
+%%% checksum = "45702 2586 10926 101053",
+%%% address = "Instytut Matematyki,
+%%% Uniwersytet Gda\'nski
+%%% Wita Stwosza 57
+%%% 80--952 Gda\'nsk, Poland",
+%%% email = "matwb@@halina.univ.gda.pl (Internet)",
+%%% abstract = "",
+%%% }
+%%%=====================================================================
+
+\title{PLAIN.TW}{W\l{}odek Bzyl\hfil matwb@@halina.univ.gda.pl}
+
+\printcontents
+
+@@
+\chapter{Introduction}
+
+{\it However, we will not include a verbatim description, because some
+parts of that file are too boring, and because the actual macros have
+been ``optimized'' with respect to memory space and running time.}
+\hfill {\sl D.E.~Knuth about\/ [[plain.tex]] format.}
+\bigskip
+\bigskip
+\noindent
+What follows is devoted to the details of the plain \TeX\ format.
+This file serves two purposes:
+\medskip
+
+\item{(1)} As a documentation of the [[plain.tex]] format.
+Weaving and texing this document should produce a handy reference.
+
+\item{(2)}
+The division of this web source into `chunks' should ease
+creation of other formats tailored to particular applications.
+Chunks could be easily modified, removed, added, or replaced.
+
+\medskip
+\noindent The change file mechanism
+is not needed in case of \TeX\ language.
+Change files are used to incorporate system
+dependent code into source file, but \TeX\ code is already
+system independent. \TeX\ code could be only `format dependent'
+and here change files could be used.
+ Another feature of format file is that it evolves with time, yet some
+intermediate versions are used for preparation of books, articles etc.
+All these versions and configurations must be kept well organized,
+otherwise you are lost.
+The Revision Control System is the tool that assists with these tasks.
+ With the RCS it is possible, with small overhead,
+ to preserve \stress{all revisions}
+ which evolved from given text document,
+ merge changes made by others,
+ compare different versions,
+ keep log of changes.
+
+This document consists mainly of excerpts from the
+{\sl \TeX Book}, but it is organised around the macros as they
+appear in the [[plain.tex]] rather than around the
+topics as in a user manual. Therefore this document
+is not a \stress{user manual}, although many definitions
+are contained here.
+@@
+\chapter{The layout of the format}
+
+<<*>>=
+<<Establish standard category code values>>
+\catcode`@@ = 11
+<<Define commonly used constants>>
+<<Provide programming constructs>>
+<<Allocate registers>>
+<<Assign initial values to parameters>>
+<<Set up text fonts>>
+<<Set up math fonts>>
+<<Provide macros for text formatting>>
+<<Provide macros for math formatting>>
+<<Prepare page for output>>
+<<Read hyphenation patterns>>
+<<Initialize the layout>>
+\catcode`@@ = 12
+<<Identify the format>>
+@@
+There are 256 characters that \TeX\ might encounter at each step, in
+a file or in a line of text typed directly on your terminal. These
+256~characters are classified into 16 categories numbered 0 to 15:
+\begindisplay \def\\{\hfill}
+\hfil\hidewidth\it Category\hidewidth&\it \qquad Meaning\hidewidth&%
+\it Default\hfil\cr
+\noalign{\smallskip}
+\\0&Escape character&[[\]]\cr
+\\1&Beginning of group&[[{]]\cr
+\\2&End of group&[[}]]\cr
+\\3&Math shift&[[$]]\cr
+\\4&Alignment tab&[[&]]\cr
+\\5&End of line&\<return>\cr
+\\6&Parameter&[[#]]\cr
+\\7&Superscript&[[^]]\cr
+\\8&Subscript&[[_]]\cr
+\\9&Ignored character&\<null>\cr
+10&Space&\ttt{\char"20}\cr
+11&Letter&[[A]], \dots, [[Z]] and [[a]], \dots, [[z]]\cr
+12&Other character&none of the above or below\cr
+13&Active character&[[~]]\cr
+14&Comment character&[[%]]\cr
+15&Invalid character&\<delete>\cr
+\enddisplay
+
+When [[INITEX]] begins, category 12 (other) has been assigned to all~256
+possible characters, except that the 52~letters
+[[A...Z]] and [[a...z]] are
+category~11 (letter), and assignments equivalent to the
+following have been made:
+\begindisplay \def\\{\hfill}
+[[\catcode `\\ = 0]]&\cr
+[[\catcode `\^^M = 5]]&\cr
+[[\catcode `\^^@@ = 9]]&\cr
+[[\catcode `\ = 10]]&\cr
+[[\catcode `\% = 14]]&\cr
+[[\catcode `\^^? = 15]]&\cr
+\enddisplay
+Thus `[[\]]' is already an escape character,
+`[[\char"20]]' is a space,
+and `[[%]]' is available for comments on the first line of the file;
+ASCII \<null> is ignored, ASCII \<return> is an end-of-line character,
+and ASCII \<delete> is invalid.
+\medskip
+Furthermore \<tab> is given category space, \<formfeed>
+becomes an active character that will detect runaways on files that
+have been divided into ``file pages'' by \<formfeed>
+characters. Finally the control sequence [[\active]] is defined to
+yield the constant~13.
+
+To re-catcode these special characters---not counting ASCII
+\begindisplay \def\\{\hfill}
+\\\<null>& [[^^@@]]\cr
+\\\<tab>& [[^^I]]\cr
+\\\<linefeed>& [[^^J]]\cr
+\\\<formfeed>& [[^^L]]\cr
+\\\<return>& [[^^M]]\cr
+\\\<delete>& [[^^?]]\cr
+\enddisplay
+---use the control sequence [[\dospecials]]
+that lists all the characters whose catcodes should
+probably be changed to~12 (other) when copying things verbatim.
+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.
+
+<<Establish standard category code values>>=
+\catcode`\{=1
+\catcode`\}=2
+\catcode`\$=3
+\catcode`\&=4
+\catcode`\#=6
+\catcode`\^=7 \catcode`\^^K=7 % uparrow is for superscripts
+\catcode`\_=8 \catcode`\^^A=8 % downarrow are for subscripts
+\catcode`\^^I=10
+
+\chardef\active=13 \catcode`\~=\active % tilde is active
+\catcode`\^^L=\active \outer\def^^L{\par} % ascii form-feed is "\outer\par"
+
+\def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
+ \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}
+@@
+To make the plain macros more efficient in time and space, several
+constant values are declared as control sequences.
+\stress{If they were changed, anything could happen.}
+So be careful!
+
+<<Define commonly used constants>>=
+\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
+@@
+\section{Text fonts}
+
+<<Set up text fonts>>=
+<<Provide support for font scaling>>
+<<Define text fonts>>
+<<Encode special characters, and characters not available on the keyboard>>
+<<Provide support for accented characters>>
+<<Assign uppercase and lowercase code values>>
+<<Assign space factor codes>>
+@@
+Fonts assigned to [[\preloaded]] are not part of the format,
+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]].
+
+<<Define text fonts>>=
+\font\tenrm=cmr10 % roman text
+\font\preloaded=cmr9
+\font\preloaded=cmr8
+\font\sevenrm=cmr7
+\font\preloaded=cmr6
+\font\fiverm=cmr5
+
+\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
+
+\font\preloaded=cmu10 % unslanted text italic
+
+\font\preloaded=cmcsc10 % caps and small caps
+
+\font\preloaded=cmssbx10 % sans serif bold extended
+
+\font\preloaded=cmdunh10 % Dunhill style
+
+\font\preloaded=cmr7 scaled \magstep4 % for titles
+\font\preloaded=cmtt10 scaled \magstep2
+\font\preloaded=cmssbx10 scaled \magstep2
+
+\font\preloaded=manfnt % METAFONT logo and dragon curve and special symbols
+@@
+Additional [[\preloaded]] fonts can be specified here.
+(And those that were [[\preloaded]] above can be eliminated.)
+
+<<Define text fonts>>=
+\let\preloaded=\undefined % preloaded fonts must be declared anew later.
+@@
+<<Provide support for font scaling>>=
+\def\magstephalf{1095 }
+\def\magstep#1{\ifcase#1 \@@m\or 1200\or 1440\or 1728\or 2074\or 2488\fi\relax}
+\def\magnification{\afterassignment\m@@g\count@@}
+\def\m@@g{\mag\count@@
+ \hsize6.5truein\vsize8.9truein\dimen\footins8truein}
+@@
+\subsection{Font encoding}
+
+We usually think of text files as containing characters. It doesn't
+cause any problems most of the time when we use plain ASCII
+characters---letters A--Z, a--z, the numerals 0--9 and some
+of punctuation characters. This illusion is broken down when we
+start using characters that do not belong to this limited set, for
+example, accented characters / mathematical symbols. Then what we
+see on screen may not match what we key in. What gets printed may
+not match what we see on screen. Moreover, what gets shown on screen
+and what gets printed depends on what machine we are on and how the
+fonts that we are using are set up.
+In reality text files contain just numeric codes (in range 0--255)
+stored in 8-bit bytes, and the mapping between `character' and numeric
+code is quite arbitrary. This is because there are very many more
+characters than the 256 numeric codes possible with 8-bits.
+Consequently, there will be a need for more than one possible mapping
+or `font encoding', or in other words, there would not be a `standard'
+encoding that suits all purposes.
+\medskip
+When a symbol is built up by forming a box, the [[\leavevmode]] macro
+is called first; this starts a new paragraph, if \TeX\ is in vertical
+mode, but does nothing if \TeX\ is in horizontal mode or math mode.
+[[\chardef]] positions are taken from the fonts [[cmr10]] and [[cmsy10]].
+
+<<Encode special characters, and characters not available on the keyboard>>=
+\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{h}\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}
+@@
+The accent positions are taken from Computer Modern font family. We
+are about to `hard-wire' CM accent encoding into the format. Different
+encoding will be necessary if other styles of type are used.
+
+Three alternative control-symbol accents are defined,
+suitable for keyboards with extended character sets:
+[[\let\^^_=\v]], [[\let\^^S=\u]], [[\let\^^D=\^]].
+
+<<Provide support for accented characters>>=
+\def\oalign#1{\leavevmode\vtop{\baselineskip\z@@skip \lineskip.25ex%
+ \ialign{##\crcr#1\crcr}}} \def\o@@lign{\lineskiplimit\z@@ \oalign}
+\def\ooalign{\lineskiplimit-\maxdimen \oalign} % chars over each other
+\def\sh@@ft#1{\dimen\z@@.00#1ex\multiply\dimen\z@@\fontdimen1\font
+ \kern-.0156\dimen\z@@} % compensate for slant in lowered accents
+\def\d#1{{\o@@lign{\relax#1\crcr\hidewidth\sh@@ft{10}.\hidewidth}}}
+\def\b#1{{\o@@lign{\relax#1\crcr\hidewidth\sh@@ft{29}%
+ \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\mathhexbox20D}}}
+
+\def\dots{\relax\ifmmode\ldots\else$\m@@th\ldots\,$\fi}
+\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}}
+@@
+[[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.
+
+<<Assign uppercase and lowercase code values>>=
+%%% Thats all for English language.
+@@
+Space factor code affects setting of interword glue.
+The space factor is normally 1000, which means that the interword glue
+should not be modified. If the space factor $f$ is different from
+1000, the interword glue is computed as follows: Take the normal space
+glue for the current font, and add the extra space if $f\ge2000$.
+Then the stretch component is multiplied by $f/1000$, while the shrink
+component is multiplied by $1000/f$.
+(Look up the Appendix for the values of normal space, normal stretch,
+normal shrink, and extra space for some of CM fonts.)
+
+[[INITEX]] sets space factor codes:
+[[\sfcode]]$\,x=1000$ for all $x$,
+except that [[\sfcode]]$\,`X=999$ for uppercase letters.
+
+The characters
+`[[)]]', `[[']]', and `[[]]]'
+does not change space factor.
+
+<<Assign space factor codes>>=
+\sfcode`\)=0 \sfcode`\'=0 \sfcode`\]=0
+@@
+\section{Math fonts}
+
+<<Set up math fonts>>=
+<<Define math fonts>>
+<<Encode math accents>>
+<<Establish spacing around mathematical objects>>
+<<Assign math codes>>
+<<Assign delimiter codes>>
+<<Define font families>>
+@@
+As was said earlier, the font metric information about preloaded font
+will be build into the format. But, if another set of macros says
+[[\font\fiftyfiverm = cmr9 at 55pt]], \TeX\ will \stress{have to
+reload again} the font metric information for [[cmr9]].
+
+<<Define math fonts>>=
+\font\teni=cmmi10 % math italic
+\font\preloaded=cmmi9
+\font\preloaded=cmmi8
+\font\seveni=cmmi7
+\font\preloaded=cmmi6
+\font\fivei=cmmi5
+
+\font\tensy=cmsy10 % math symbols
+\font\preloaded=cmsy9
+\font\preloaded=cmsy8
+\font\sevensy=cmsy7
+\font\preloaded=cmsy6
+\font\fivesy=cmsy5
+
+\font\tenex=cmex10 % math extension
+
+\font\preloaded=cmmib10 % bold math italic
+\font\preloaded=cmbsy10 % bold math symbols
+@@
+\subsection{Mathematical spacing}
+
+Spacing around mathematical object is measured in
+[[mu]]---`math units.'
+[[1mu]] is equal to $1/18\,$th part of [[\fontdimen 6]] of
+the font in family 2.
+
+[[\quad]] spacing does not change with the style of formula, nor does it
+depend on the math font families that are being used.
+But thin spaces, medium spaces, and thick spaces do get bigger and
+smaller as the size of type gets bigger and smaller; this is because
+they are defined in terms of \<muglue>.
+
+According to these specifications, thin spaces in plain
+\TeX\ do not stretch or shrink; medium spaces can stretch a little, and
+they can shrink to zero; thick spaces can stretch a lot, but they never shrink.
+
+\medskip
+
+The following table gives the complete definition of muglue between
+mathematical objects. A formula is converted to a math list, and the
+math list consists chiefly of ``atoms'' of eight basic types:
+Ord~(ordinary), Op~(large operator), Bin~(binary operation),
+Rel~(relation), Open~(opening), Close~(closing), Punct~(punctuation),
+and Inner~(a delimited subformula). Other kinds of atoms, which arise
+from commands like [[\overline]] or [[\mathaccent]] or [[\vcenter]],
+etc., are all treated as type~Ord; fractions are treated as
+type~Inner. The following (non-symmetric) table is used to determine
+the spacing between pairs of adjacent atoms:
+\medbreak
+$$\baselineskip0pt\lineskip0pt
+\halign to\hsize
+ {\strut\hbox to1.5\parindent{\it#\hfil}& % for the legend "Left atom"
+ #\hfil\quad& % for the row labels
+ #\hfil\tabskip 0pt plus 20pt& % for the rule at the left
+ \hbox to 25pt{\tt\hss#\hss}& % for column 1
+ \hbox to 25pt{\tt\hss#\hss}& % for column 2
+ \hbox to 25pt{\tt\hss#\hss}& % for column 3
+ \hbox to 25pt{\tt\hss#\hss}& % for column 4
+ \hbox to 25pt{\tt\hss#\hss}& % for column 5
+ \hbox to 25pt{\tt\hss#\hss}& % for column 6
+ \hbox to 25pt{\tt\hss#\hss}& % for column 7
+ \hbox to 25pt{\tt\hss#\hss}& % for column 8
+ #\hfil\tabskip0pt\cr % for the rule at the right
+\noalign{\vskip-6pt} % it just happens that there's extra white space
+&&&&\multispan7\hss\it Right atom\hss\cr \noalign{\vskip3pt} &&&\rm
+Ord&\rm Op&\rm Bin&\rm Rel&\rm Open&\rm Close&\rm Punct&\rm Inner\cr
+\noalign{\vskip2pt} \omit&&\multispan{10}\leaders\hrule\hfil\cr
+\omit\vbox to 2pt{}&&\vrule&&&&&&&&&\vrule\cr
+&Ord&\vrule&0&1&(2)&(3)&0&0&0&(1)&\vrule\cr
+&Op&\vrule&1&1&*&(3)&0&0&0&(1)&\vrule\cr
+&Bin&\vrule&(2)&(2)&*&*&(2)&*&*&(2)&\vrule\cr
+Left&Rel&\vrule&(3)&(3)&*&0&(3)&0&0&(3)&\vrule\cr
+atom&Open&\vrule&0&0&*&0&0&0&0&0&\vrule\cr
+&Close&\vrule&0&1&(2)&(3)&0&0&0&(1)&\vrule\cr
+&Punct&\vrule&(1)&(1)&*&(1)&(1)&(1)&(1)&(1)&\vrule\cr
+&Inner&\vrule&(1)&1&(2)&(3)&(1)&0&(1)&(1)&\vrule\cr \omit\vbox to
+2pt{}&&\vrule&&&&&&&&&\vrule\cr
+\omit&&\multispan{10}\leaders\hrule\hfil\cr}$$
+\medbreak
+Here [[0]], [[1]], [[2]], and [[3]] stand for
+no space, thin space, medium space, and thick space,
+respectively.
+Thin space, medium space, and thin space are equal to
+values of [[\thinmuskim]], [[\medmuskip]], [[\thickmuskip]]
+parameters, respectively.
+The table entry is parenthesized if the space is to be
+inserted only in display and text styles, not in script and
+scriptscript styles. For example, many of the entries in the Rel row
+and the Rel column are `{\tt(3)}'; this means that thick spaces are
+normally inserted before and after relational symbols like `=', but
+not in subscripts. Some of the entries in the table are `{\tt*}'; such
+cases never arise, because Bin atoms must be preceded and followed by
+atoms compatible with the nature of binary operations.
+The conversion of math lists to horizontal lists is done
+whenever \TeX\ is about to leave math mode, and the inter-atomic
+spacing is inserted at that time.
+
+<<Establish spacing around mathematical objects>>=
+\thinmuskip=3mu
+\medmuskip=4mu plus 2mu minus 4mu
+\thickmuskip=5mu plus 5mu
+@@
+For the positioning of accents over single character the width of
+[[\skewchar]] is used. For most of fonts the default value of
+[[\skewchar]] is [[-1]]; but the math italic (family 1)
+and math symbol fonts (family 2) have
+special [[\skewchar]] values equal to [['177]] and [['60]],
+respectively. These are characters
+`{\teni\char'177\/}' and `{\tensy\char'60}'.
+
+<<Encode math accents>>=
+\skewchar\teni='177 \skewchar\seveni='177 \skewchar\fivei='177
+\skewchar\tensy='60 \skewchar\sevensy='60 \skewchar\fivesy='60
+@@
+A math code is relevant only when the corresponding category code is
+11 or~12. When processing in math mode characters of categories~11 and~12,
+[[\char]] and [[\chardef]] characters are replaced by their math code.
+
+If we denote 15-bit number by [["uvwz]], then math codes are assigned by
+\medskip
+[[\mathcode]] \<8-bit number> = [["uvwz]],\quad where
+\medskip
+\itemitem{[[u]]} --- the class code (see below for the list)
+\itemitem{[[v]]} --- the font family number (see the font tables at the
+ end of this document)
+\itemitem{[[wz]]} --- the position of the character in the font
+$$\halign{\indent#\hfil&\quad#\hfil&\quad#\hfil&
+\hskip4em#\hfil&\quad#\hfil&\quad#\hfil\cr
+\it \kern-2pt Class&\it Meaning&\kern-2pt\it Example&
+\it \kern-2pt Class&\it Meaning&\kern-2pt\it Example\cr
+\noalign{\vskip2pt}
+0&Ordinary&[[/]]&
+4&Opening&[[(]]\cr
+1&Large operator&[[\sum]]&
+5&Closing&[[)]]\cr
+2&Binary operation&[[+]]&
+6&Punctuation&[[,]]\cr
+3&Relation&[[=]]&
+7&Variable family&[[x]]\cr
+}$$
+
+A [[\mathcode]] can also have the special value \hex{8000}, which
+causes the character to behave as if it has catcode~13 (active). This
+feature makes [[']] apostrophe expand to [[\prime]]. The mathcode of
+[[']] does not interfere with the use of [[']] in octal constants.
+The mathcode of [["8000]] is also assigned to space and underscore.
+
+[[INITEX]] sets up
+[[\mathcode]]$\,x=x$ for $x=0..255$, except that
+[[\mathcode]]$\,x=x+\hex{7000}$
+for each of the ten digits $x={}$[[`0]] to [[`9]];
+[[\mathcode]]$\,x=x+\hex{7100}$ for each of the 52~letters.
+\TeX\ looks at the mathcode only when it is typesetting a character whose
+catcode is 11~(letter) or 12~(other), or when it encounters a character that
+is given explicitly as [[\char]]\<number>.
+
+Class 7 is a special case that allows math symbols to change families.
+It behaves exactly like class~0, except that the specified family is
+replaced by the current value of an integer parameter called [[\fam]],
+provided that [[\fam]] is a legal family number (i.e., if it lies between
+0 and~15). \TeX\ automatically sets [[\fam=-1]] whenever math mode is entered;
+therefore class~7 and class~0 are equivalent unless [[\fam]] has been
+given a new value. Plain \TeX\ changes [[\fam]] to~0 when the user
+types `[[\rm]]'; this makes it convenient to get roman letters in formulas,
+since letters belong to class~7.
+The control sequence [[\rm]] is an abbreviation for `[[\fam=0 \tenrm]]';
+thus, [[\rm]] causes [[\fam]] to become zero, and it makes
+[[\tenrm]] the ``current font.'' In horizontal mode, the [[\fam]]
+value is irrelevant and the current font governs the typesetting of
+letters; but in math mode, the current font is irrelevant and the
+[[\fam]] value governs the letters. The current font affects math mode
+only if control space ([[\ ]]) is used or if dimensions are given in
+[[ex]] or [[em]] units; it also has an effect if an [[\hbox]] appears
+inside a formula, since the contents of an hbox are typeset in
+horizontal mode.
+
+<<Assign math codes>>=
+\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
+
+@@
+Delimiter codes are used after [[\left]] and [[\right]] commands,
+when \TeX\ is looking for a delimiter.
+
+If we denote 24-bit number by [["qrstuv]], then
+delimiter codes are assigned by
+\medskip
+[[\delcode]] \<8-bit number> = [["qrstuv]],\quad where
+\medskip
+\itemitem{[[q]]} --- the font family number of
+\itemitem{[[rs]]} --- the position of the the small variant of the delimiter
+\itemitem{[[t]]} --- the font family number of
+\itemitem{[[uv]]} --- the position of the the large variant of the delimiter
+\medskip
+%%% Assigning delimiters codes to characters completes coding.
+%%% The full list consists of:
+%%% [[\catcode]], [[\lccode]], [[\uccode]], [[\mathcode]], [[\delcode]].
+
+[[INITEX]] sets all [[\delcode]] values to [[-1]],
+which means that no characters are recognized as delimiters
+in math formulas,
+except [[\delcode]]$\,`.=0$, so that `[[.]]' stands for
+``null delimiter''.
+[[{]] and [[}]] should \stress{not get} delcodes;
+otherwise parameter grouping fails!
+
+<<Assign delimiter codes>>=
+\delcode`\(="028300
+\delcode`\)="029301
+\delcode`\[="05B302
+\delcode`\]="05D303
+\delcode`\<="26830A
+\delcode`\>="26930B
+\delcode`\/="02F30E
+\delcode`\|="26A30C
+\delcode`\\="26E30F
+@@
+All characters that are typeset in math mode belong to one of sixteen
+{\sl families} of fonts, numbered internally from 0 to~15. Each of
+these families consists of three fonts: one for text size, one for
+script size, and one for scriptscriptsize. The commands [[\textfont]],
+[[\scriptfont]], and [[\scriptscriptfont]] are used to specify the
+members of each family. Since there are up to 256~characters per
+font, and 3~fonts per family, and 16~families, \TeX\ can access up to
+12,288 characters in any one formula (4096 in~each of the three
+sizes).
+
+The [[plain.tex]] format uses family~1 for math italic letters, family~2 for
+ordinary math symbols, and family~3 for large symbols.
+Text italic is put in family~4, slanted roman in family~5, bold roman
+in family~6, and typewriter type in family~7.
+A macro [[\newfam]] will assign symbolic names to families that aren't
+already used.
+
+[[INITEX]] initializes the mathcodes of all letters [[A]] to~[[Z]] and
+[[a]] to~[[z]] so that they are symbols of class~7 and family~1; that's
+why it is natural to use family~1 for math italics. Similarly, the
+digits [[0]] to~[[9]] are class~7 and family~0. None of the other
+families is treated in any special way by \TeX.
+
+\TeX\ doesn't check to see if the families are sensibly organized.
+The only constraint is that the fonts in
+families 2 and~3 have special [[\fontdimen]] parameters, which govern
+mathematical spacing (see Appendix).
+In Computer Modern only [[cmsy]] and [[cmex]] have these
+parameters, so their assignment to families 2 and~3 is almost
+mandatory.
+
+During the time that a math formula is being read,
+\TeX\ remembers each symbol as being ``character position so-and-so in
+family number such-and-such,'' but it does not take note of what fonts
+are actually in the families until reaching the end of the formula.
+
+<<Define font families>>=
+\textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm
+\def\rm{\fam\z@@\tenrm}
+\textfont1=\teni \scriptfont1=\seveni \scriptscriptfont1=\fivei
+\def\mit{\fam\@@ne} \def\oldstyle{\fam\@@ne\teni}
+\textfont2=\tensy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy
+\def\cal{\fam\tw@@}
+\textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
+\newfam\itfam \def\it{\fam\itfam\tenit} % \it is family 4
+\textfont\itfam=\tenit
+\newfam\slfam \def\sl{\fam\slfam\tensl} % \sl is family 5
+\textfont\slfam=\tensl
+\newfam\bffam \def\bf{\fam\bffam\tenbf} % \bf is family 6
+\textfont\bffam=\tenbf \scriptfont\bffam=\sevenbf
+\scriptscriptfont\bffam=\fivebf
+\newfam\ttfam \def\tt{\fam\ttfam\tentt} % \tt is family 7
+\textfont\ttfam=\tentt
+@@
+\section{Registers allocation}
+
+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.
+
+The main use of these macros is for registers that are defined by one
+macro and used by others, possibly at different nesting levels.
+
+The following counters are reserved:
+\begindisplay
+ 0--9& page numbering\cr
+ 10& count allocation\cr
+ 11& dimen allocation\cr
+ 12& skip allocation\cr
+ 13& muskip allocation\cr
+ 14& box allocation\cr
+ 15& toks allocation\cr
+ 16& read file allocation\cr
+ 17& write file allocation\cr
+ 18& math family allocation\cr
+ 19& language allocation\cr
+ 20& insert allocation\cr
+ 21& the most recently allocated number\cr
+ 22& constant -1\cr
+\enddisplay
+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.
+[[\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.
+
+<<Allocate registers>>=
+\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)
+<<Allocate scratch registers>>
+<<Provide user-level register allocation macros>>
+<<Define implementation-level register allocation macros>>
+<<Initialize register constants>>
+@@
+Here are abbreviations for the names of scratch registers
+that don't need to be allocated.
+
+<<Allocate scratch registers>>=
+\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.
+
+<<Provide user-level register allocation macros>>=
+\outer\def\newcount{\alloc@@0\count\countdef\insc@@unt}
+\outer\def\newdimen{\alloc@@1\dimen\dimendef\insc@@unt}
+\outer\def\newskip{\alloc@@2\skip\skipdef\insc@@unt}
+\outer\def\newmuskip{\alloc@@3\muskip\muskipdef\@@cclvi}
+\outer\def\newbox{\alloc@@4\box\chardef\insc@@unt}
+\let\newtoks=\relax % we do this to allow plain.tex to be read in twice
+\outer\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}}
+\outer\def\newtoks{\alloc@@5\toks\toksdef\@@cclvi}
+\outer\def\newread{\alloc@@6\read\chardef\sixt@@@@n}
+\outer\def\newwrite{\alloc@@7\write\chardef\sixt@@@@n}
+\outer\def\newfam{\alloc@@8\fam\chardef\sixt@@@@n}
+\outer\def\newlanguage{\alloc@@9\language\chardef\@@cclvi}
+@@
+<<Define implementation-level register allocation macros>>=
+\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}}
+\outer\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}
+@@
+We finish with the initalization of some constants.
+<<Initialize register constants>>=
+\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
+\newdimen\z@@ \z@@=0pt % can be used both for 0pt and 0
+\newskip\z@@skip \z@@skip=0pt plus0pt minus0pt
+\newbox\voidb@@x % permanently void box register
+@@
+\section{Parameters}
+
+Let's turn now to \TeX's parameters, which the previous chapters have
+introduced one at a time; it will be convenient to assemble them
+all together.
+\bigskip
+An \<integer parameter> is one of the following tokens:
+\begindisplay\belowdisplayskip=3pt plus 6pt \abovedisplayskip=3pt plus 1pt%
+\openup.15pt
+[[\pretolerance]]\qquad badness tolerance before hyphenation\cr
+[[\tolerance]]\qquad badness tolerance after hyphenation\cr
+[[\hbadness]]\qquad badness above which bad hboxes will be shown\cr
+[[\vbadness]]\qquad badness above which bad vboxes will be shown\cr
+[[\linepenalty]]\qquad amount added to badness of every line in a paragraph\cr
+[[\hyphenpenalty]]\qquad penalty for line break after discretionary hyphen\cr
+[[\exhyphenpenalty]]\qquad penalty for line break after explicit hyphen\cr
+[[\binoppenalty]]\qquad penalty for line break after binary operation\cr
+[[\relpenalty]]\qquad penalty for line break after math relation\cr
+[[\clubpenalty]]\qquad penalty for creating a club line at bottom of page\cr
+[[\widowpenalty]]\qquad penalty for creating a widow line at top of page\cr
+[[\displaywidowpenalty]]\qquad ditto, before a display\cr
+[[\brokenpenalty]]\qquad penalty for page break after a hyphenated line\cr
+[[\predisplaypenalty]]\qquad penalty for page break just before a display\cr
+[[\postdisplaypenalty]]\qquad penalty for page break just after a display\cr
+[[\interlinepenalty]]\qquad additional penalty for page break between lines\cr
+[[\floatingpenalty]]\qquad penalty for insertions that are split\cr
+[[\outputpenalty]]\qquad penalty at the current page break\cr
+[[\doublehyphendemerits]]\qquad demerits for consecutive broken lines\cr
+[[\finalhyphendemerits]]\qquad demerits for a penultimate broken line\cr
+[[\adjdemerits]]\qquad demerits for adjacent incompatible lines\cr
+[[\looseness]]\qquad change to the number of lines in a paragraph\cr
+[[\pausing]]\qquad positive if pausing after each line is read from a file\cr
+[[\holdinginserts]]\qquad positive if insertions
+ remain dormant in output box\cr
+[[\tracingonline]]\qquad positive if showing diagnostic info on the terminal\cr
+[[\tracingmacros]]\qquad positive if showing macros as they are expanded\cr
+[[\tracingstats]]\qquad positive if showing statistics about memory usage\cr
+[[\tracingparagraphs]]\qquad positive if showing line-break calculations\cr
+[[\tracingpages]]\qquad positive if showing page-break calculations\cr
+[[\tracingoutput]]\qquad positive if showing boxes that are shipped out\cr
+[[\tracinglostchars]]\qquad positive if showing characters not in the font\cr
+[[\tracingcommands]]\qquad positive if showing commands
+ before they are executed\cr
+[[\tracingrestores]]\qquad positive if showing deassignments when groups end\cr
+[[\language]]\qquad the current set of hyphenation rules\cr
+[[\uchyph]]\qquad positive if hyphenating words
+ beginning with capital letters\cr
+[[\lefthyphenmin]]\qquad smallest fragment at beginning of hyphenated word\cr
+[[\righthyphenmin]]\qquad smallest fragment at end of hyphenated word\cr
+[[\globaldefs]]\qquad nonzero if overriding [[\global]] specifications\cr
+[[\defaulthyphenchar]]\qquad [[\hyphenchar]] value when a font is loaded\cr
+[[\defaultskewchar]]\qquad [[\skewchar]] value when a font is loaded\cr
+[[\escapechar]]\qquad escape character in the output of
+ control sequence tokens\cr
+[[\endlinechar]]\qquad character placed at the right end of an input line\cr
+[[\newlinechar]]\qquad character that starts a new output line\cr
+[[\maxdeadcycles]]\qquad upper bound on [[\deadcycles]]\cr
+[[\hangafter]]\qquad hanging indentation changes after this many lines\cr
+[[\fam]]\qquad the current family number\cr
+[[\mag]]\qquad magnification ratio, times 1000\cr
+[[\delimiterfactor]]\qquad ratio for variable delimiters, times 1000\cr
+[[\time]]\qquad current time of day in minutes since midnight\cr
+[[\day]]\qquad current day of the month\cr
+[[\month]]\qquad current month of the year\cr
+[[\year]]\qquad current year of our Lord\cr
+[[\showboxbreadth]]\qquad maximum items per level when boxes are shown\cr
+[[\showboxdepth]]\qquad maximum level when boxes are shown\cr
+[[\errorcontextlines]]\qquad maximum extra context shown when errors occur\cr
+\enddisplay
+The first few of these parameters have values in units of ``badness'' and
+``penalties'' that affect line breaking and page breaking. Then come
+demerit-oriented parameters; demerits are essentially given in units of
+``badness squared,'' so those parameters tend to have larger values.
+By contrast, the next few parameters ([[\looseness]], [[\pausing]], etc.)\
+generally have quite small values (either $-1$ or 0 or 1 or~2).
+Miscellaneous parameters complete the set.
+\bigskip
+A \<dimen parameter> is one of the following:
+\begindisplay\openup.15pt
+[[\hfuzz]]\qquad maximum overrun before overfull hbox messages occur\cr
+[[\vfuzz]]\qquad maximum overrun before overfull vbox messages occur\cr
+[[\overfullrule]]\qquad width of rules appended to overfull boxes\cr
+[[\emergencystretch]]\qquad reduces badnesses on final pass of line-breaking\cr
+[[\hsize]]\qquad line width in horizontal mode\cr
+[[\vsize]]\qquad page height in vertical mode\cr
+[[\maxdepth]]\qquad maximum depth of boxes on main pages\cr
+[[\splitmaxdepth]]\qquad maximum depth of boxes on split pages\cr
+[[\boxmaxdepth]]\qquad maximum depth of boxes on explicit pages\cr
+[[\lineskiplimit]]\qquad threshold where [[\baselineskip]] changes
+ to [[\lineskip]]\cr
+[[\delimitershortfall]]\qquad maximum space not covered by a delimiter\cr
+[[\nulldelimiterspace]]\qquad width of a null delimiter\cr
+[[\scriptspace]]\qquad extra space after subscript or superscript\cr
+[[\mathsurround]]\qquad kerning before and after math in text\cr
+[[\predisplaysize]]\qquad length of text preceding a display\cr
+[[\displaywidth]]\qquad length of line for displayed equation\cr
+[[\displayindent]]\qquad indentation of line for displayed equation\cr
+[[\parindent]]\qquad width of\/ [[\indent]]\cr
+[[\hangindent]]\qquad amount of hanging indentation\cr
+[[\hoffset]]\qquad horizontal offset in [[\shipout]]\cr
+[[\voffset]]\qquad vertical offset in [[\shipout]]\cr
+\enddisplay
+
+Before typesetting a delimiter \TeX\ determines the size $f$ of the
+formula to be covered as twice the maximum of the height and the depth
+of the formula. The size $d$ of the delimiter should be
+$$
+\min\big\{ f - \hbox{[[\delimitershortfall]]},\>
+ \hbox{[[\delimiterfactor]]} \cdot {f \over 1000} \big\}
+\leq d
+$$
+\medskip
+And the possibilities for \<glue parameter> are:
+\begindisplay\openup.15pt
+[[\baselineskip]]\qquad desired glue between baselines\cr
+[[\lineskip]]\qquad interline glue if\/ [[\baselineskip]] isn't feasible\cr
+[[\parskip]]\qquad extra glue just above paragraphs\cr
+[[\abovedisplayskip]]\qquad extra glue just above displays\cr
+[[\abovedisplayshortskip]]\qquad ditto, following short lines\cr
+[[\belowdisplayskip]]\qquad extra glue just below displays\cr
+[[\belowdisplayshortskip]]\qquad ditto, following short lines\cr
+[[\leftskip]]\qquad glue at left of justified lines\cr
+[[\rightskip]]\qquad glue at right of justified lines\cr
+[[\topskip]]\qquad glue at top of main pages\cr
+[[\splittopskip]]\qquad glue at top of split pages\cr
+[[\tabskip]]\qquad glue between aligned entries\cr
+[[\spaceskip]]\qquad glue between words, if nonzero\cr
+[[\xspaceskip]]\qquad glue between sentences, if nonzero\cr
+[[\parfillskip]]\qquad additional [[\rightskip]] at end of paragraphs\cr
+\enddisplay
+
+To above parameters (except [[\parfillskip]]) are assigned values
+appropriate for CM family typeset at 12$\,$pt baseline.
+
+\medskip
+Finally, there are three permissible \<muglue parameter> tokens:
+\begindisplay\openup.15pt
+[[\thinmuskip]]\qquad thin space in math formulas\cr
+[[\medmuskip]]\qquad medium space in math formulas\cr
+[[\thickmuskip]]\qquad thick space in math formulas\cr
+\enddisplay
+\bigskip
+\TeX\ also has parameters that are token lists. Such parameters do not
+enter into the definitions of \<number> and such things.
+A \<token parameter> is any of:
+\begindisplay\openup.15pt
+[[\output]]\qquad the user's output routine\cr
+[[\everypar]]\qquad tokens to insert when a paragraph begins\cr
+[[\everymath]]\qquad tokens to insert when math in text begins\cr
+[[\everydisplay]]\qquad tokens to insert when display math begins\cr
+[[\everyhbox]]\qquad tokens to insert when an hbox begins\cr
+[[\everyvbox]]\qquad tokens to insert when a vbox begins\cr
+[[\everyjob]]\qquad tokens to insert when the job begins\cr
+[[\everycr]]\qquad tokens
+ to insert after every [[\cr]] or nonredundant [[\crcr]]\cr
+[[\errhelp]]\qquad tokens that supplement an [[\errmessage]]\cr
+\enddisplay
+\bigskip
+All of numeric parameters are listed below,
+but the code is commented out if no special value needs to be set.
+[[INITEX]] makes all parameters zero except where noted.
+
+<<Assign initial values to parameters>>=
+<<Assign values to integer parameters>>
+<<Assign values to dimen parameters>>
+<<Assign values to glue parameters>>
+<<Assign values to special registers>>
+@@
+<<Assign values to integer parameters>>=
+\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
+@@
+<<Assign values to dimen parameters>>=
+\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
+@@
+<<Assign values to glue parameters>>=
+% \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
+@@
+We also define special registers that function like parameters:
+<<Assign values to special registers>>=
+\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
+\def\normalbaselines{\lineskip\normallineskip
+ \baselineskip\normalbaselineskip \lineskiplimit\normallineskiplimit}
+@@
+\section{Macros for text}
+
+Here we introduce macros that are used for basic formatting
+unrelated to mathematics.
+
+<<Provide macros for text formatting>>=
+<<Supply basic macros for text formatting>>
+<<Define space macros>>
+<<Supply various paragraph shapes>>
+<<Define sectioning macros>>
+<<Supply ragged setting>>
+<<Supply `boxing' macros>>
+<<Supply strut>>
+<<Provide alignment macros>>
+<<Establish spacing after punctuation characters>>
+<<Supply various ways to fill space>>
+<<Define [[\showhyphens]] macro>>
+<<Completing the job>>
+@@
+[[\]]\<tab> and [[\]]\<return> are defined so that they
+expand to [[\]]\<space>; this helps to prevent confusion, since all three
+cases look identical when displayed on most computer terminals.
+
+<<Supply basic macros for text formatting>>=
+\def\^^M{\ } % control <return> = control <space>
+\def\^^I{\ } % same for <tab>
+@@
+The control sequences [[\endgraf]] and [[\endline]] are made equivalent
+to \TeX's primitive [[\par]] and~[[\cr]] operations, since it is often
+useful to redefine the meanings of [[\par]] and~[[\cr]] themselves. Then
+come the definitions of [[\space]] (a blank space), [[\empty]] (a~list
+of no tokens), and [[\null]] (an~empty hbox).
+
+[[\bgroup]] and [[\egroup]] are made to provide ``implicit'' grouping
+characters that turn out to be especially useful in macro definitions.
+
+<<Supply basic macros for text formatting>>=
+\let\endgraf=\par \let\endline=\cr
+
+\def\space{ }
+\def\empty{}
+\def\null{\hbox{}}
+
+\let\bgroup={ \let\egroup=}
+@@
+The [[\obeylines]] macro says `[[\let^^M=\par]]'
+instead of `[[\def^^M{\par}]]' because the [[\let]]
+technique allows constructions such as
+`[[\let\par=\cr]] [[\obeylines]] [[\halign||{...}]]'
+in which [[\cr]]'s need not be given within the alignment.
+
+<<Supply basic macros for text formatting>>=
+{\catcode`\^^M=\active % these lines must end with %
+ \gdef\obeylines{\catcode`\^^M\active \let^^M\par}%
+ \global\let^^M\par} % this is in case ^^M appears in a \write
+\def\obeyspaces{\catcode`\ \active}
+{\obeyspaces\global\let =\space}
+@@
+The macros [[\lq]], [[\rq]], [[\lbrack]], and [[\rbrack]] are defined,
+for people who have difficulty typing quotation marks and/or brackets.
+
+<<Supply basic macros for text formatting>>=
+\def\lq{`} \def\rq{'}
+\def\lbrack{[} \def\rbrack{]}
+@@
+The macros [[\enskip]], [[\quad]], and [[\qquad]]
+provide spaces that are legitimate breakpoints within a paragraph;
+[[\enspace]], [[\thinspace]], and [[\negthinspace]] produce space that cannot
+cause a break (although the space will disappear if it occurs just
+next to certain kinds of breaks). All six of these spaces are relative
+to the current font.
+
+You can get horizontal space that
+never disappears by saying `[[\hglue]]\<glue>'; this space is able to
+stretch or shrink. Similarly, there's a vertical analog,
+`[[\vglue]]\<glue>'.
+
+The [[\nointerlineskip]] macro suppresses interline glue that would
+ordinarily be inserted before the next box in vertical mode; this is a
+``one shot'' macro, but [[\offinterlineskip]] is more drastic---it sets
+things up so that future interline glue will be present, but zero.
+There also are macros for potentially breakable vertical spaces:
+[[\smallskip]], [[\medskip]], and [[\bigskip]].
+
+<<Define space macros>>=
+\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@@}
+@@
+The following macros introduce penalty markers
+that make breaking less, or more, desirable. The [[\break]], [[\nobreak]],
+and [[\allowbreak]] macros are intended for use in any mode; the [[~]]~(tie)
+and [[\slash]] (hyphen-like~`/') macros are intended for horizontal mode.
+The others are intended only for vertical mode, i.e., between paragraphs,
+so they begin with [[\par]].
+
+<<Define space macros>>=
+\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}
+@@
+[[\line]], [[\leftline]], [[\rightline]], and [[\centerline]]
+produce boxes of the full line width, while [[\llap]] and [[\rlap]] make
+boxes whose effective width is zero. The [[\underbar]] macro puts its
+argument into an hbox with a straight line at a fixed distance under it.
+
+[[\underbar]] uses math mode to do its job, although the
+operation is essentially non-mathematical in nature. A few of the other
+macros below use math mode in similar ways; thus, \TeX's mathematical
+abilities prove to be useful even when no mathematical typesetting
+is actually being done. A special control sequence [[\m@@th]] is
+used to ``turn off'' [[\mathsurround]] when such constructions are
+being performed.)
+
+<<Supply `boxing' macros>>=
+\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@@}$}
+@@
+A [[\strut]] is implemented here as a rule of width zero.
+The `[[\relax]]' in this macro and in others below is necessary in case
+|\strut| appears first in an alignment entry, because \TeX\ is in a
+somewhat unpredictable mode at such times.
+
+<<Supply strut>>=
+\newbox\strutbox
+\setbox\strutbox=\hbox{\vrule height8.5pt depth3.5pt width\z@@}
+\def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}
+@@
+The [[\ialign]] macro provides for alignments when it is necessary to
+be sure that [[\tabskip]] is initially zero. The [[\hidewidth]] macro can be
+used essentially as [[\hfill]] in alignment entries that are permitted to
+``stick out'' of their column. There's also [[\multispan]], which permits
+alignment entries to span one or more columns.
+
+<<Provide alignment macros>>=
+\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}
+@@
+Now we get to the ``tabbing'' macros.
+They keep track of the tab positions by
+maintaining boxes full of empty boxes having the specified widths.
+
+The macro [[\+]] has been declared `[[\outer]]' here, so that \TeX\ will
+be better able to detect runaway arguments and definitions.
+A non-[[\outer]] version, called [[\tabalign]], has also been provided
+in case it is necessary to use [[\+]] in some ``inner'' place.
+You can use [[\tabalign]] just like [[\+]], except after [[\settabs]].
+
+<<Provide alignment 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@@}
+@@
+Paragraph shapes of a limited but important kind are provided by
+[[\item]], [[\itemitem]], and [[\narrower]].
+A macro [[\hang]] causes hanging indentation by the normal
+amount of [[\parindent]], after the first line;
+thus, the entire paragraph will be indented by the same amount
+(unless it began with [[\noindent]]).
+[[\textindent]][[{stuff}]] is like [[\indent]],
+but it puts the `[[stuff]]' into the indentation,
+flush right except for an en~space;
+it also removes spaces that might
+follow the right brace in `[[{stuff}]]'.
+
+<<Supply various paragraph shapes>>=
+\def\hang{\hangindent\parindent}
+\def\textindent#1{\indent\llap{#1\enspace}\ignorespaces}
+\def\item{\par\hang\textindent}
+\def\itemitem{\par\indent \hangindent2\parindent \textindent}
+\def\narrower{\advance\leftskip\parindent
+ \advance\rightskip\parindent}
+@@
+The [[\beginsection]] macro is intended to mark the beginning of a
+new major subdivision in a document; to use it, you say
+`[[\beginsection]]\<section title>' followed by a blank line (or~[[\par]]).
+The macro first emits glue and penalties, designed to start a new page
+if the present page is nearly full; then it makes a [[\bigskip]] and
+puts the section title flush left on a line by itself, in boldface type.
+The section title is also displayed on the terminal.
+After a [[\smallskip]], with page break prohibited, a [[\noindent]]
+command is given; this suppresses indentation in the next paragraph,
+i.e., in the first paragraph of the new section.
+(However, the next ``paragraph'' will be empty if vertical mode
+material immediately follows the [[\beginsection]] command.)
+
+Special statements in a mathematical paper are often called theorems,
+lemmas, definitions, axioms, postulates, remarks, corollaries, algorithms,
+facts, conjectures, or some such things, and they generally are
+given special typographic treatment. The [[\proclaim]] macro
+puts the title of the proclamation in boldface, then sets the rest
+of the paragraph in slanted type. The paragraph is followed by
+something similar to [[\medbreak]], except that the amount of penalty
+is different so that page breaks are discouraged:
+
+<<Define sectioning macros>>=
+\outer\def\beginsection#1\par{\vskip\z@@ plus.3\vsize\penalty-250
+ \vskip\z@@ plus-.3\vsize\bigskip\vskip\parskip
+ \message{#1}\leftline{\bf#1}\nobreak\smallskip\noindent}
+\outer\def\proclaim #1. #2\par{\medbreak
+ \noindent{\bf#1.\enspace}{\sl#2\par}%
+ \ifdim\lastskip<\medskipamount \removelastskip\penalty55\medskip\fi}
+@@
+Ragged-right setting is initiated by restricting the spaces between
+words to have a fixed width, and by putting variable space at the
+right of each line.
+You should not call [[\raggedright]] until your
+text font has already been specified.
+
+It is assumed that the ragged-right material will not be in a variety
+of different sizes. If this assumption is not valid, a different
+approach should be used: [[\fontdimen]] parameters 3 and~4 of the
+fonts you will be using should be set to zero, by saying, e.g.,
+`[[\fontdimen3\tenrm=0pt]]'. These parameters specify the
+stretchability and shrinkability of interword spaces. A special macro
+[[\ttraggedright]] should be used for ragged-right setting in
+[[typewriter type]], since the spaces between words are generally
+bigger in that style. (Spaces are already unstretchable and
+unshrinkable in font~|cmtt|.)
+
+<<Supply ragged setting>>=
+\def\raggedright
+ {\rightskip\z@@ plus2em \spaceskip.3333em \xspaceskip.5em\relax}
+\def\ttraggedright
+ {\tt\rightskip\z@@ plus2em\relax} % for use with \tt only
+@@
+The [[\nonfrenchspacing]] macro is be used to change the default
+sfcodes (set by [[INITEX]]) of punctuation marks. This macro,
+when called, affects spacing after punctuation marks.
+
+<<Establish spacing after punctuation characters>>=
+\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 }
+@@
+[[\rightarrowfill]] and [[\leftarrowfill]] macros use
+[[\cleaders]] with a repeatable box consisting of the middle 10 units
+of a minus sign, where one unit
+is ${1\over18}\em$. The leaders are preceded and followed by $-$ and~$\to$;
+there's enough backspacing to compensate for up to 5~units of extra space,
+fore and aft, that |\cleaders| might leave blank. In this way a macro is
+obtained such that
+[[\hbox to 100pt{\rightarrowfill}]]
+yields `\hbox to 100pt{\rightarrowfill}'.
+
+The [[\overbrace]] and [[\underbrace]] macros of plain \TeX\ are
+constructed by combining characters with rules. Font [[cmex10]]
+contains four symbols $\bracelu\;\braceld\;\bracerd\;\braceru$, each
+of which has depth zero and height equal to the thickness of a rule
+that joins them properly.
+Therefore it's easy to define [[\upbracefill]] and [[\downbracefill]]
+macros so that you can obtain, e.g.,
+\begindisplay
+\vbox{\kern4pt
+ \hbox to 100pt{\downbracefill}\hbox to 50pt{\upbracefill}
+ }
+\enddisplay
+by saying `[[\hbox to 100pt{\downbracefill}\hbox to 50pt{\upbracefill}]]'
+in vertical mode.
+
+<<Supply various ways to fill space>>=
+\def\hrulefill{\leaders\hrule\hfill}
+\def\dotfill{\cleaders\hbox{$\m@@th \mkern1.5mu.\mkern1.5mu$}\hfill}
+\def\rightarrowfill{$\m@@th\smash-\mkern-6mu%
+ \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
+ \mkern-6mu\mathord\rightarrow$}
+\def\leftarrowfill{$\m@@th\mathord\leftarrow\mkern-6mu%
+ \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
+ \mkern-6mu\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$}
+@@
+If you want to see all of the hyphens that plain \TeX\ will find in some
+random text, you can say `[[\showhyphens{]]\<random text>[[}]]' and the
+results will appear on your terminal (and in the log file).
+The [[\showhyphens]] macro creates an hbox that is intentionally
+underfull.
+
+<<Define [[\showhyphens]] macro>>=
+\def\showhyphens#1{\setbox0\vbox{\parfillskip\z@@skip\hsize\maxdimen\tenrm
+ \pretolerance\m@@ne\tolerance\m@@ne\hbadness0\showboxdepth0\ #1}}
+@@
+At the end of a \TeX\ manuscript it's usually best to finish
+everything off by typing `[[\bye]]'. The `[[\vfill\supereject]]' gets
+\TeX\ to flush out all remaining insertions, with blank space filling
+the bottom of incomplete pages, and `[[\end]]' sends the computer into
+its endgame routine.
+
+<<Completing the job>>=
+\outer\def\bye{\par\vfill\supereject\end}
+@@
+\section{Macros for math}
+
+Most of this section consists of long listings of special symbols
+together with their font locations.
+
+<<Provide macros for math formatting>>=
+<<Define math space macros>>
+<<Define Greek letters>>
+<<Define math symbols>>
+<<Encode large operators>>
+<<Encode binary operations>>
+<<Encode relations>>
+<<Supply vertical and diagonal dots>>
+<<Supply variable-width math accents>>
+<<Supply extensible delimiters>>
+<<Provide access to delimiters of various sizes>>
+<<Supply common math functions>>
+<<Provide [[\cases]] and [[\matrix]] macros>>
+<<Provide support to typeset displayed equations>>
+@@
+\TeX\ does automatic spacing of math formulas so that they look right,
+and this is almost true. But occasionally you must give \TeX\ some
+help. The number of possible math formulas is vast, and \TeX's spacing
+rules are rather simple, so it is natural that exceptions should
+arise. The basic elements of space that \TeX\ puts into formulas are
+called: thin spaces, medium spaces, thick spaces.
+The normal space between words of a paragraph is approximately equal
+to two thin spaces.
+\bigskip
+\noindent You can add your own spacing whenever you want to,
+by using the control sequences
+$$\halign{\indent#\hfil&\quad#\hfil\cr
+|\,|&thin space \ (normally 1/6 of a quad);\cr
+|\>|&medium space \ (normally 2/9 of a quad);\cr
+|\;|&thick space \ (normally 5/18 of a quad);\cr
+|\!|&negative thin space \ (normally $-1/6$ of a quad).\cr}$$
+
+<<Define math space macros>>=
+\def\,{\mskip\thinmuskip}
+\def\>{\mskip\medmuskip}
+\def\;{\mskip\thickmuskip}
+\def\!{\mskip-\thinmuskip}
+@@
+The next job is to define Greek letters and other symbols of type Ord.
+Uppercase Greek letters are assigned hexadecimal codes of the form \hex{7xxx},
+so that they will change families when [[\fam]] changes.
+
+[[\mathchardef]] defines a control sequence to be a synonym for a math
+character (check [[\mathchar]] for the meaning of hex number).
+
+<<Define Greek letters>>=
+\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
+@@
+<<Define math symbols>>=
+\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
+@@
+Integral signs get special treatment so that their limits won't be set
+above and below.
+
+<<Encode large operators>>=
+\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
+@@
+<<Encode binary operations>>=
+\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
+@@
+Relations are also fairly straightforward, except for the ones that are
+constructed from other characters. The [[\mapstochar]] is a character
+`$\mapstochar\mskip5mu$' of width zero that is quite useless by itself,
+but it combines with right arrows to make [[\mapsto]] `$\mapsto$' and
+[[\longmapsto]] `$\longmapsto$'. Similarly, [[\not]] is a relation character of
+width zero that puts a slash over the character that follows. When two
+relations are adjacent in a math formula, \TeX\ puts no space between them.
+
+<<Encode relations>>=
+\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\;}
+@@
+After defining characters [[\ldotp]] and [[\cdotp]] that act as math
+punctuation, [[\ldots]] and [[\cdots]] macros are defined that
+give the proper spacing in most circumstances. Vertical and diagonal
+dots ([[\vdots]] and [[\ddots]]) are also provided here:
+
+<<Supply vertical and diagonal dots>>=
+\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}}
+@@
+Most of the math accents are handled entirely by the [[\mathaccent]]
+primitive, but a few of the variable-width ones are constructed the
+hard way.
+
+<<Supply variable-width math accents>>=
+\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@@}{}}
+@@
+Now we come to 24 delimiters that can change their size.
+These are denoted explicitly by a \<27-bit number>.
+
+If we denote 27-bit number by [["cqrstuv]], then
+delimiter codes are assigned by
+\medskip
+[[\delimiter "cqrstuv]],\quad where
+\medskip
+\itemitem{[[c]]} --- the class
+\itemitem{[[q]]} --- the font family number of
+\itemitem{[[rs]]} --- the position of the the small variant of the delimiter
+\itemitem{[[t]]} --- the font family number of
+\itemitem{[[uv]]} --- the position of the the large variant of the delimiter
+\medskip
+After [[\left]] and [[\right]] commands the class digit is ignored.
+When \TeX\ is not looking for a delimiter the righmost three
+digits [[tuv]] are ignored, and the remaining four [[cqrs]]
+are treated as a [[\mathchar]].
+
+<<Supply extensible delimiters>>=
+\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 }
+@@
+In the [[plain.tex]] format and in the Computer Modern math fonts
+there is only one radical---the square root. The meaning of
+[[\radical]] is analogous to the [[\delimiter]] commands. Only the
+class number is dropped. Joining the radical character and the
+horizontal rule is done by leeting the radical character have a large
+depth, and the height which is equal to the rule thickness. The rule
+is placed on the baseline and the radical character is placed
+below. Then the whole is centered around math axis.
+
+<<Supply extensible delimiters>>=
+\def\choose{\atopwithdelims()}
+\def\brack{\atopwithdelims[]}
+\def\brace{\atopwithdelims\{\}}
+
+\def\sqrt{\radical"270370 }
+@@
+These macros depend on actual sizes of delimiters.
+
+<<Provide access to delimiters of various sizes>>=
+\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}
+@@
+The [[\mathpalette]] operation constructs a formula in all four
+styles; it is applied here in the implementation of [[\phantom]],
+[[\smash]], [[\root]], and other operations. (Actually [[\phantom]]
+and [[\smash]] are not perfect: They assume that the current style is
+uncramped.)
+
+These definitions illustrate how other built-up
+symbol combinations could be defined to work in all four styles.
+
+The control sequences [[\sp]] and [[\sb]]
+are provided for people who can't easily type [[^]] and [[_]];
+a ``discretionary times sign'' [[\*]] is defined.
+
+<<Provide macros for math formatting>>=
+\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@@
+\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=}
+
+\let\sp=^ \let\sb=_
+\def\*{\discretionary{\thinspace\the\textfont2\char2}{}{}}
+@@
+The 32 common functions whose names generally appear in roman letters.
+
+<<Supply common math functions>>=
+\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)}
+@@
+The definition of [[\matrix]] goes to some pains to ensure that two
+$n$-rowed matrices will have the same height and the same depth, unless
+at least one of their rows is unusually big. The definition of
+[[\bordermatrix]] is even more complicated, but it seems to work
+reasonably well; it uses a constant [[\p@@renwd]] that represents the
+width of a big extensible left parenthesis.
+
+<<Provide [[\cases]] and [[\matrix]] macros>>=
+\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}
+@@
+The value of [[\lineskiplimit]] is assumed to be [[\normallineskiplimit]]
+plus the accumulated amount of ``opening up.'' Thus, the [[\vskip]]
+instructions in [[\displ@@y]] will compensate for the fact that the
+first baseline of an alignment is separated by an opened-up baselineskip
+from the last line preceding the display.
+
+<<Provide support to typeset displayed equations>>=
+\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
+\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}}
+@@
+Below we have an interesting set of
+macros that convert [[f''']] into [[f^{\prime\prime\prime}]].
+
+<<Supply common math functions>>=
+{\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 \_
+@@
+\section{Macros for output}
+
+<<Prepare page for output>>=
+<<Supply headers and footers>>
+<<Supply footnotes>>
+<<Supply floating insertions>>
+<<Supply raggedbottom setting>>
+<<Set up the output routine>>
+@@
+The [[\makeheadline]] macro constructs a vbox of height and depth
+zero. The magic constant $-22.5\pt$ is equal to
+$$
+\hbox{[[\topskip]]}
+ -\hbox{\<height of strut>}-2\,\hbox{[[\baselineskip]]}
+$$
+i.e., $10\pt-8.5\pt-24\pt$
+(assuming default values of [[\topskip]] and the height of the strut);
+this places the reference point of the headline exactly $24\pt$ above the
+reference point of the top line on the page, unless the headline or
+the top line are excessively large.
+
+The [[\advancepageno]] macro normally advances [[\pageno]]
+by~$+1$; but if [[\pageno]] is negative (for roman numerals), the advance is
+by~$-1$. The new value of [[\pageno]] will be appropriate for the next time
+the output routine is called into action.
+
+<<Supply headers and footers>>=
+\countdef\pageno=0 \pageno=1 % first page is number 1
+\newtoks\headline \headline={\hfil} % headline is normally blank
+\newtoks\footline \footline={\hss\tenrm\folio\hss}
+% footline is normally a centered page number in font \tenrm
+%
+\def\makeheadline{\vbox to\z@@{\vskip-22.5\p@@
+ \line{\vbox to8.5\p@@{}\the\headline}\vss}\nointerlineskip}
+\def\makefootline{\baselineskip24\p@@\line{\the\footline}}
+%
+\def\folio{\ifnum\pageno<\z@@ \romannumeral-\pageno \else\number\pageno \fi}
+\def\nopagenumbers{\footline{\hfil}} % blank out the footline
+\def\advancepageno{\ifnum\pageno<\z@@ \global\advance\pageno\m@@ne
+ \else\global\advance\pageno\@@ne \fi} % increase |pageno|
+@@
+Ragged-bottom setting is achieved by inserting
+infinite glue, which overpowers the stretchability of [[\topskip]].
+This macros assume that [[\topskip = 10pt]]
+
+<<Supply raggedbottom setting>>=
+\newif\ifr@@ggedbottom
+\def\raggedbottom{\topskip 10\p@@ plus60\p@@ \r@@ggedbottomtrue}
+\def\normalbottom{\topskip 10\p@@ \r@@ggedbottomfalse} % undoes \raggedbottom
+@@
+There are 255 classes of insertions, [[\insert0]] to [[\insert254]], and
+they are tied to other registers of the same number. For example,
+[[\insert100]] is connected with [[\count100]], [[\dimen100]],
+[[\skip100]], and [[\box100]].
+
+\def\n{\thinspace$n$}
+For our purposes let's consider a particular class of insertions
+called class $n$; we will then be dealing with \TeX's primitive command
+\begindisplay
+[[\insert]]\n[[{]]\<vertical mode material>[[}]]
+\enddisplay
+which puts an insertion
+item into a horizontal or vertical list. For this class of insertions
+\begindisplay
+[[\box]]\n\qquad is where the material appears when a page is output;\cr
+[[\count]]\n\qquad is the magnification factor for page breaking;\cr
+[[\dimen]]\n\qquad is the maximum insertion size per page;\cr
+[[\skip]]\n\qquad is the extra space to allocate on a page.\cr
+\enddisplay
+For example, material inserted with [[\insert100]] will
+eventually appear in [[\box100]].
+@@
+[[\footnote]] macro depends on the value of [[\bigskipamount]], and
+[[\parindent]].
+Because the value of [[\vsize]] ($8.9\in$)
+is greater than [[\dimen\footins]] ($8\in$),
+footnotes never fill up the whole page.
+
+<<Supply footnotes>>=
+\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
+
+\def\footnoterule{\kern-3\p@@
+ \hrule width 2truein \kern 2.6\p@@} % the \hrule is .4pt high
+@@
+Here the constant [[12\p@@ = 12pt]] is hard coded into the format.
+
+<<Supply floating insertions>>=
+\newinsert\topins
+\newif\ifp@@ge \newif\if@@mid
+\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}
+@@
+The value of [[\boxmaxdepth]] is set to [[\maxdepth]] so that the vbox
+will be constructed under the assumptions that \TeX's page builder has
+used to set up [[\box255]].
+
+The [[\pagecontents]] macro produces a vertical list for
+everything that belongs on the main body of the page, namely the contents
+of [[\box255]] together with illustrations (inserted at the top)
+and footnotes (inserted at the bottom).
+[[\topins]] and [[\footins]] are the insertion class numbers for
+the two kinds of insertions used in plain \TeX; if more classes of
+insertions are added, [[\pagecontents]] should be changed accordingly.
+Notice that the boxes are unboxed so that the glue coming from
+insertions can help out the glue on the main page. The [[\footnoterule]]
+macro places a dividing line between the page and its
+footnotes; it makes a net contribution of $0\pt$ to the height of
+the vertical list.
+
+The [[\dosupereject]] macro is designed to clear out any insertions
+that have been held over, whether they are illustrations or footnotes
+or both. The negative [[\kern]] here cancels out the natural space of
+the [[\topskip]] glue that goes above the empty [[\line]]; that empty
+line box prevents the [[\vfill]] from disappearing into a page break.
+The vertical list that results from [[\dosupereject]] is placed on
+\TeX's list of things to put out next, just after the straggling
+insertions have been reconsidered. Hence another super-eject will
+occur, and the process will continue until no insertions remain.
+
+<<Set up the output routine>>=
+\output{\plainoutput}
+\def\plainoutput{\shipout\vbox{\makeheadline\pagebody\makefootline}%
+ \advancepageno
+ \ifnum\outputpenalty>-\@@MM \else\dosupereject\fi}
+
+\def\pagebody{\vbox to\vsize{\boxmaxdepth\maxdepth \pagecontents}}
+
+\def\dosupereject{\ifnum\insertpenalties>\z@@ % something is being held over
+ \line{}\kern-\topskip\nobreak\vfill\supereject\fi}
+
+\def\pagecontents{\ifvoid\topins\else\unvbox\topins\fi
+ \dimen@@=\dp\@@cclv \unvbox\@@cclv % open up \box255
+ \ifvoid\footins\else % footnote info is present
+ \vskip\skip\footins
+ \footnoterule
+ \unvbox\footins\fi
+ \ifr@@ggedbottom \kern-\dimen@@ \vfil \fi}
+@@
+\section{Hyphenation}
+
+A discretionary break consists of three sequences of characters
+called the {\sl pre-break}, {\sl post-break}, and {\sl no-break\/}
+texts. The idea is that if a line break occurs here, the pre-break text
+will appear at the end of the current line and the post-break text will
+occur at the beginning of the next line; but if no break occurs, the
+no-break text will appear in the current line.
+The discretionary are specified by writing
+\begindisplay
+|\discretionary{|\<pre-break text>|}{|\<post-break text>|}{|\<no-break text>|}|
+\enddisplay
+where the three texts consist entirely of characters, boxes, and kerns.
+If a word contains discretionary breaks \TeX\ will not hyphenate it.
+
+Hyphenation exceptions are specified with the statements like
+\begindisplay
+[[\hyphenation{gal-axy iso-peri-met-ric}]]
+\enddisplay
+which gives to \TeX\ locations where these words may be hyphenated.
+
+The default values of [[\hyphenchar]] is [[`-]].
+
+Sometimes the typewriter fonts are given
+[[\hyphenchar]]\<font name>[[=-1]] which value inhibits hyphenation.
+
+<<Read hyphenation patterns>>=
+\lefthyphenmin=2 \righthyphenmin=3 % disallow x- or -xx breaks
+\input hyphen
+@@
+\section{Initalization}
+
+<<Initialize the layout>>=
+\normalbaselines\rm % select roman font
+\nonfrenchspacing % punctuation affects the spacing
+@@
+\section{Programming support}
+
+<<Provide programming constructs>>=
+<<Supply loops and conditionals>>
+<<Define [[\tracingall]] macro>>
+@@
+The [[\loop...\repeat]] macro provides for iterative operations.
+In this macro and several others, the control sequence `[[\next]]' is
+given a temporary value that is not going to be needed later; thus,
+[[\next]] acts like a ``scratch control sequence.''
+
+The macro [[\newif]] to be used for definitions of new conditionals.
+For example, [[\newif\iffoo]] creates [[\footrue]], [[\foofalse]] to
+go with [[\iffoo]].
+
+<<Supply loops and conditionals>>=
+\def\loop#1\repeat{\def\body{#1}\iterate}
+\def\iterate{\body \let\next\iterate \else\let\next\relax\fi \next}
+\let\repeat=\fi % this makes \loop...\if...\repeat skippable
+
+\outer\def\newif#1{\count@@\escapechar \escapechar\m@@ne
+ \expandafter\expandafter\expandafter
+ \edef\@@if#1{true}{\let\noexpand#1=\noexpand\iftrue}%
+ \expandafter\expandafter\expandafter
+ \edef\@@if#1{false}{\let\noexpand#1=\noexpand\iffalse}%
+ \@@if#1{false}\escapechar\count@@} % the condition starts out false
+\def\@@if#1#2{\csname\expandafter\if@@\string#1#2\endcsname}
+{\uccode`1=`i \uccode`2=`f \uppercase{\gdef\if@@12{}}} % `if' is required
+@@
+<<Define [[\tracingall]] macro>>=
+\def\tracingall{\tracingonline\@@ne\tracingcommands\tw@@\tracingstats\tw@@
+ \tracingpages\@@ne\tracingoutput\@@ne\tracinglostchars\@@ne
+ \tracingmacros\tw@@\tracingparagraphs\@@ne\tracingrestores\@@ne
+ \showboxbreadth\maxdimen\showboxdepth\maxdimen\errorstopmode}
+@@
+The format name and version number are recorded in control sequences,
+in order to help the people who might have to explain why something
+doesn't work.
+
+<<Identify the format>>=
+\def\fmtname{plain+W}\def\fmtversion{3.14159+W}
+@@
+\chapter{Appendices}
+
+\section{Efficiency and memory-space considerations}
+
+One difficulty with large sets of macros is that they take up space.
+It would be nice to preload every macro that every \TeX\ user has ever
+dreamed up; but there might not be enough room,
+because \TeX's memory capacity is finite. You might find it necessary
+to hold back and to load only the macros that are really needed.
+\medskip
+How much memory space does a macro require?
+\medskip
+\noindent There are four kinds of memory involved: token memory,
+name memory, string memory, and character memory. (If any of these
+becomes too full, it will be necessary to increase what \TeX\ calls the
+macro memory size, the hash size, the number of strings, and/or the
+pool size, respectively. The token memory is
+most important; a macro takes one cell of token memory for each token
+in its definition, including the `|{|' and the `|}|'. For example,
+the comparatively short definition
+\medskip
+[[\def\example#1\two{\four}]]
+\medskip
+\noindent takes five tokens: |#1|, [[\two]], |{|$_1$, [[\four]], and |}|$_2$.
+Each control sequence also takes up one cell of name memory, one cell
+of string memory, and as many cells of character memory as there are
+characters in the name (seven in the case of |\example|). Character
+memory is comparatively cheap; four characters, or in some cases five,
+will fit in the same number of bits as a single cell of token memory,
+inside the machine. Therefore you don't save much by choosing short
+macro names.
+
+\TeX\ will tell you how close you come to exceeding its current
+memory capacity if you say [[\tracingstats=1]].
+\TeX\ governs fourteen kinds of memory:
+\begindisplay
+|number of strings|\qquad(names of control sequences and files)\cr
+|pool size|\qquad(the characters in such names)\cr
+|main memory size|\qquad(boxes, glue, breakpoints, token lists,
+ characters, etc.)\cr
+|hash size|\qquad(control sequence names)\cr
+|font memory|\qquad(font metric data)\cr
+|exception dictionary|\qquad(hyphenation exceptions)\cr
+|input stack size|\qquad(simultaneous input sources)\cr
+|semantic nest size|\qquad(unfinished lists being constructed)\cr
+|parameter stack size|\qquad(macro parameters)\cr
+|buffer size|\qquad(characters in lines being read from files)\cr
+|save size|\qquad(values to restore at group ends)\cr
+|text input levels|\qquad(|\input| files and error insertions)\cr
+|grouping levels|\qquad(unfinished groups)\cr
+|pattern memory|\qquad(hyphenation pattern data)\cr
+\enddisplay
+The current amount of memory available will also be shown.
+
+One obvious way to keep from loading too many macros is to keep
+the macro files short and to |\input| only the ones that you need.
+
+\section{Extensible delimiters}
+
+\TeX\ builds large delimiters by using ``extensible'' characters,
+which are specified by giving top, midle, bottom, and repeatable
+characters in an \bold{extensible} command.
+For example, the extensible left parentheses in [[cmex10]] are
+defined by (see Figure~4)
+\medskip
+[[extensible oct"060": oct"060", 0, oct"100", oct"102";]]
+\medskip
+\noindent this says that character code [[oct"060"]] specifies
+an extensible delimiter constructed from itself as the top piece,
+from character number [[oct"100"]] as the bottom piece,
+and from character number [[oct"102"]] as the piece which
+should be repeated as often as necessary to reach a desired size.
+In this particular example there is no middle piece,
+but characters like curly braces have a middle piece as well.
+A zero value in the top, middle, or bottom position means that
+no character should be used in that part of the construction;
+but a zero value in the final position means that character
+number zero is the repeater. The width of an extensible
+character is taken to be the width of the repeater.
+
+Also several characters of various sizes can be linked together
+in a series by means of a \bold{charlist} command.
+For example (see Figure~4),
+\medskip
+[[charlist oct"000": oct"020": oct"022": oct"040";]]
+\medskip
+\noindent is used in the font [[cmex10]] to specify the left
+parentheses that \TeX\ uses in displayed math formulas.
+\TeX\ follows charlist to make variable-size delimiters
+and variable-size accents, as well to link
+[[\textstyle]] and the [[\displaystyle]] operators.
+
+
+\section{Font dimensions}
+
+The main information about font consists of the dimensions of the characters.
+These numbers \TeX\ finds in the font metric files.
+Except character dimensions, font metric files contain:
+values for [[\fontdimen]]
+parameters, italic correction of characters, ligature and kerning
+programs for characters.
+We change the fontdimen parameters with the (global) assignment:
+\begindisplay
+[[\fontdimen]]\<number>\<font>\<equals>\<dimen>,
+\enddisplay
+for example, the assignment
+[[\fontdimen8\tenex = 0.6pt]]
+changes width of the fraction bar from default $0.4\pt$ to $0.6\pt$.
+\bigskip
+\noindent The first seven fontdimen parameters have the following meaning:
+\medskip
+\item{1.} the slant per point
+\item{2.} the interword space; that is used unless [[\spaceskip]]
+ is specified
+\item{3.} interword stretch
+\item{4.} interword shrink
+\item{5.} the x-height
+\item{6.} the quad width (for the font in family 2,
+ $1/18\,$th quad width is equal to $1\,$mu)
+\item{7.} the extra space; that value is added to the interword space
+ used whenever [[\spacefactor]]${}\geq 2000$,
+ unless [[\xspaceskip]] is specified.
+\bigskip
+\noindent For the font in family 2 attributes 8--19 specify positioning
+of fractions, subscripts, superscripts.
+\medskip
+\noindent \stress{fraction numerator attributes: minimum shift up,
+from the main baseline, of the baseline of the numerator of
+a generalized fraction}
+\medskip
+\item{8.} num1: for display style
+\item{9.} num2: for text style or smaller if a fraction
+ bar is present
+\item{10.} num3: for text style or smaller if no a fraction
+ bar is present
+\medskip
+\noindent
+\stress{fraction denominator attributes: minimum shift down, from the main
+baseline, of the baseline of the denominator of a generalized fraction}
+\medskip
+\item{11.} denom1: for display style
+\item{12.} denom2: for text style or smaller
+\medskip
+\noindent
+\stress{superscript attributes: minimum shift up, from the main baseline,
+of the baseline of the superscript}
+\medskip
+\item{13.} sup1: for display style
+\item{14.} sup2: for text style or smaller, non-cramped
+\item{15.} sup3: for text style or smaller, cramped
+\medskip
+\noindent
+\stress{subscript attributes: minimum shift down, from the main baseline,
+of the baseline of a subscript}
+\medskip
+\item{16.} sub1: when no superscript is present
+\item{17.} sub2: when superscript is present
+\medskip
+\noindent
+\stress{script adjustment attributes: for use only with non-glyph,
+that is, composite objects}
+\medskip
+\item{18.} sup\_drop: maximum distance of superscript baseline below
+ top of nucleus
+\item{19.} sub\_drop: minimum distance of subscript baseline below
+ bottom of nucleus
+\medskip
+\noindent
+Delimiter span attributes: height plus depth of delimiter
+enclosing a generalized fraction.
+\medskip
+\item{20.} delim1: in display style
+\item{21.} delim2: in text style or smaller
+\medskip
+\noindent
+The last parameter, the height of the math axis, specifies the height
+above the baseline of the fraction bar, and the centre of large
+delimiters and most operators and relations. This position is used in
+vertical centering.
+\medskip
+\item{22.} axis\_height.
+\bigbreak
+\noindent For the font in family 3 attributes 9--12 determine
+extra space added when limits are attached to operators.
+The attribute 8 specifies thickness of the rule used for
+overlines, underlines, radical extenders, and fraction bars.
+From that dimension are derived `clearances' around
+fraction bar.
+The attribute 13 specifies extra space added above and below
+attached limits.
+\medskip
+\item{8.} default\_rule\_thickness
+\item{9.} big\_op\_spacing1
+\item{10.} big\_op\_spacing2
+\item{11.} big\_op\_spacing3
+\item{12.} big\_op\_spacing4
+\item{13.} big\_op\_spacing5
+\medskip
+\noindent We have:
+big\_op\_spacing1(2) $\leq$ space between upper (lower)
+limit and top (bottom) of large operator $\leq$ big\_op\_spacing3(4)
+\bigskip
+\begingroup
+\def \loop #1\repeat%
+ {\global\def\body{#1}\iterate}
+
+\newcount \dno
+
+\def \?#1%
+ {\ifdim\the\fontdimen\dno#1<10pt \hphantom{0}\fi%
+ \the\fontdimen\dno#1}
+
+\ialign{\global\advance \dno by 1\relax#&
+ \hfil\number\dno.#\quad&&
+ \quad\tentt#\cr
+\omit&\omit\tensl fontdimen&cmsy10&cmex10&cmtt10&cmr10&cmti10&cmbx10
+ \cr\noalign{\bigskip}
+\loop&&
+\?\tensy&
+\?\tenex&
+\?\tentt&
+\?\tenrm&
+\?\tenit&
+\?\tenbf&\cr
+\ifnum\dno<7\repeat\cr}
+
+\advance \dno by -1
+\vskip-\baselineskip
+
+\ialign{\global\advance \dno by 1\relax#&
+ \hfil\number\dno.#\quad&&
+ \quad\tentt#\cr
+\omit&\omit\hphantom{\tensl fontdimen}&\cr
+\loop&&
+\?\tensy&
+\?\tenex&\cr
+\ifnum\dno<13\repeat\cr}
+
+\advance \dno by -1
+\vskip-\baselineskip
+
+\ialign{\global\advance \dno by 1\relax#&
+ \hfil\number\dno.#\quad&&
+ \quad\tentt#\cr
+\omit&\omit\hphantom{\tensl fontdimen}&\cr
+\loop&&
+\?\tensy&\cr
+\ifnum\dno<22\repeat\cr}
+\endgroup
+@@
+\section{Font tables}
+
+\noindent {\bf Figure 1.\enspace}[[cmr10]]---family 0
+\beginchart\tenrm
+\normalchart
+\endchart
+
+\medskip\vfill
+\noindent {\bf Figure 2.\enspace}[[cmmi10]]---family 1
+\beginchart\teni
+\normalchart
+\endchart
+
+\medskip\vfill
+\noindent {\bf Figure 3.\enspace}[[cmsy10]]---family 2
+\beginchart\tensy
+\normalchart
+\endchart
+
+\medskip\vfill
+\noindent {\bf Figure 4.\enspace}[[cmex10]]---family 3
+\beginchart\tenex
+\normalchart
+\endchart
+@
diff --git a/web/tweb/rcs/tweb.tw% b/web/tweb/rcs/tweb.tw% new file mode 100644 index 0000000000..3ddeec9f2b --- /dev/null +++ b/web/tweb/rcs/tweb.tw% @@ -0,0 +1,835 @@ +head 1.2;
+access;
+symbols;
+locks
+ WB:1.2;
+comment @# @;
+
+
+1.2
+date 95.07.12.22.44.09; author WB; state Exp;
+branches;
+next 1.1;
+
+1.1
+date 95.07.12.22.05.55; author WB; state Exp;
+branches;
+next ;
+
+
+desc
+@@
+
+
+1.2
+log
+@*** empty log message ***
+@
+text
+@%%%-*-diff-switches:"-U 0"; compile-command:"notangle tweb.tw>tweb.sty"-*-
+%%%=====================================================================
+%%% @@Noweb-file{
+%%% author = "W\l{}odzimierz Bzyl",
+%%% version = "1.1",
+%%% date = "11 July 1995",
+%%% filename = "tweb.tw",
+%%% address = "Instytut Matematyki,
+%%% Uniwersytet Gda\'nski,
+%%% Wita Stwosza 57,
+%%% 80--952 Gda\'nsk, Poland",
+%%% email = "matwb@@halina.univ.gda.pl (Internet)",
+%%% abstract = "",
+%%% }
+%%%=====================================================================
+
+\title{TWEB.TW}{W\l{}odek Bzyl\hfil matwb@@halina.univ.gda.pl}
+
+%%%\printcontents
+
+@@
+<<*>>=
+\newlinechar `^^J
+
+\def \savecat #1%
+ {\expandafter\xdef\csname\string#1savedcat\endcsname{\the\catcode`#1}}
+\def \restorecat #1%
+ {\catcode`#1=\csname\string#1savedcat\endcsname}
+\savecat\@@
+
+\catcode`\@@ = 11
+
+<<Web source formatting macros>>
+<<Setting layout of web source>>
+<<Macros written by [[web2tex]] script>>
+<<Multicolumn environment for indexes>>
+<<Index macros>>
+<<Cross-reference macros>>
+<<Initialize the layout>>
+
+\restorecat\@@
+@@
+\section{Layout of a web source}
+
+<<Setting layout of web source>>=
+<<Fonts for typeseting headings, chapter names, etc.>>
+<<Page dimensions>>
+<<Headlines>>
+<<Table of contents>>
+<<Title, chapter, section... macros>>
+@@
+<<Fonts for typeseting headings, chapter names, etc.>>=
+\font \chapterfont = cmbx10 at 20pt
+\font \titlefont = cmssbx10 at 17pt
+\font \authorfont = cmssbx10 at 12pt
+\font \sectionfont = cmbx10 at 12pt
+\font \tocfont = cmssbx10 at 12pt
+
+\font \tenbxit = cmbxti10 \def \bfit {\tenbxit}
+\font \tenss = cmss10
+\font \tenssbf = cmssbx10
+\font \ninerm = cmr9
+\font \sevenrm = cmr7
+\font \ninebf = cmbx9
+\font \nineit = cmti9
+\font \ninebxit = cmbxti10 at 8.5pt
+\font \ninett = cmtt9
+\font \ninei = cmmi9
+\font \seveni = cmmi7
+\font \ninesy = cmsy9
+\font \nineex = cmex9
+@@
+<<Page dimensions>>=
+\hoffset = 0.5in % extra space used to print code line numbers
+\hsize = 6.0in % less 0.5 than plain.tex value
+\vsize = 8.9in % default value
+<<Round [[\vsize]] to the nearest multiple of [[\baselineskip]]>>
+@@
+<<Headlines>>=
+\def \RCS {\relax} \def \RCSversion {Experimental}
+
+\newdimen\textsize \textsize=\hsize
+
+\def \pagenumber
+ {\folio}
+
+\headline =
+ {\hbox to \textsize{\strut%
+ \ifnum\pageno>1
+ \tenss\filename\hfil Version \RCSversion%
+ \hbox to 4em{\hfil\pagenumber}%
+ \else
+ \hfil\tenss\RCS%
+ \fi}\hss}
+
+\footline = {\hfil}
+@@
+<<Table of contents>>=
+\def \tocline #1#2%
+ {\line{{\ignorespaces#1}\leaders\hbox to 3pt{.\hfil}\hfil
+ \hbox to 15pt{\hss#2}}}
+
+\def \settocparms #1%
+ {\count@@=#1
+ \ifnum\count@@<1
+ \def\tocskip
+ {\vskip 3pt plus 1in
+ \penalty-100
+ \vskip 0pt plus -1in^^J}
+ \def\tocstyle{\tenssbf}
+ \def\tocindent{\z@@}
+ \else
+ \def\tocskip{}
+ \def\tocstyle{\tenss}
+ \dimen@@=20pt \advance\count@@ by \m@@ne \dimen@@=\count@@\dimen@@
+ \edef\tocindent{\the\dimen@@}
+ \fi}
+
+\def \topofcontents
+ {\vskip2\baselineskip
+ \leftline{\tocfont Contents}
+ \vskip2ex
+ \begingroup\rm}
+
+\def \botofcontents
+ {\endgroup
+ \semifilbreak{0.9}
+ \vskip3\baselineskip}
+
+\def \printcontents
+ {\topofcontents
+ \Input{\jobname.toc}
+ \botofcontents}
+@@
+[[\startsection{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE}{HEADING}]]\par
+\leavevmode%
+[[ #1 #2 #3 #4 #5 #6]]\par
+\medskip
+[[#1 LEVEL: ]] depth; e.g. chapter=0 sectino=1...\par
+[[#2 INDENT: ]] indentation of heading from left margin\par
+[[#3 BEFORESKIP: ]] skip before header\par
+[[#4 AFTERSKIP: ]] skip after header\par
+[[#5 STYLE: ]] style of heading; e.g. [[\bf]]\par
+[[#6 HEADING ]]
+@@
+<<Title, chapter, section... macros>>=
+\def \title #1#2%
+ {\vglue4\baselineskip
+ \noindent{\rightskip = 0in plus 4em
+ \hyphenpenalty = 10000 \exhyphenpenalty = 10000
+ \baselineskip = 20pt
+ \titlefont#1\par}
+ \vskip 0.5\baselineskip
+ \hrule height 2pt width \hsize
+ \vskip 0.5\baselineskip
+ \noindent
+ \line{\authorfont #2}
+ \vskip2\baselineskip}
+
+\def \startsection#1#2#3#4#5#6%
+ {\ifnum#1<2
+ \semifilbreak{0.8}
+ \fi
+ \vskip #3
+ \def\titl@@{#6}
+ \edef\themodtitle{\sanitize\titl@@}
+ \message{[\themodtitle]}
+ \settocparms{#1}
+ {\edef\next
+ {\noexpand\write\cont{\tocskip\string\tocline%
+ {\hskip\tocindent\tocstyle\space\sanitize\themodtitle}%
+ {\noexpand\the\pageno}}}%
+ \next}% write to toc
+ \vbox{\leftskip=#2
+ \rightskip=0.5true in plus 4em minus 0.5 true in
+ \hyphenpenalty=9999 \exhyphenpenalty=9999
+ \noindent#5#6}%
+ \nobreak
+ \vskip#4}
+
+\def \gobblemeaning#1:->{}
+\def \sanitize {\expandafter\gobblemeaning\meaning}
+
+\def \chapter#1%
+ {\vfil\eject\startsection{0}{\z@@}{\z@@}{6ex}{\chapterfont}{#1}}
+\def \section#1%
+ {\startsection{1}{\z@@}{4ex}{2ex}{\sectionfont}{#1}}
+\def \subsection#1%
+ {\startsection{2}{\z@@}{2ex}{1ex}{\tenbf}{#1}}
+\def \subsubsection#1%
+ {\startsection{3}{\z@@}{1ex}{0ex}{\tenit}{#1}}
+\def \paragraph#1%
+ {\startsection{4}{\z@@}{1.5ex}{0ex}{\tenit}{#1}}
+@@
+\section{Indexes}
+
+The user sets the pagenumber style with the [[\pagenumbering{FOO}]]
+command, which sets the page counter to 1 and defines [[\thepage]]
+to be [[\FOO]]. For example, [[\pagenumbering{roman}]] causes pages
+to be numbered i, ii, etc.
+
+<<Index macros>>=
+\def \newwrite
+ {\alloc@@7\write\chardef\sixt@@@@n} % remove \outer
+
+\def \@@nameuse#1%
+ {\csname #1\endcsname}
+
+\def \arabic#1{\@@arabic{\@@nameuse{c@@#1}}}
+\def \roman#1{\@@roman{\@@nameuse{c@@#1}}}
+\def \Roman#1{\@@Roman{\@@nameuse{c@@#1}}}
+\def \alph#1{\@@alph{\@@nameuse{c@@#1}}}
+\def \Alph#1{\@@Alph{\@@nameuse{c@@#1}}}
+
+\def \@@arabic#1{\ifnum #1>0 \number #1\fi}
+\def \@@roman#1{\romannumeral #1}
+\def \@@Roman#1{\expandafter\uppercase\expandafter{\romannumeral #1}}
+\def \@@alph#1{\ifcase#1\or a\or b\or c\or d\else\@@ialph{#1}\fi}
+\def \@@ialph#1%
+ {\ifcase#1\or \or \or \or \or e\or f\or g\or h\or i\or j\or k\or l\or
+ m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or
+ z\else\@@ctrerr\fi}
+\def \@@Alph#1{\ifcase#1\or A\or B\or C\or D\else\@@Ialph{#1}\fi}
+\def \@@Ialph#1%
+ {\ifcase#1\or \or \or \or \or E\or F\or G\or H\or I\or J\or K\or L\or
+ M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or
+ Z\else\@@ctrerr\fi}
+
+\def \pagenumbering#1%
+ {\global\pageno \@@ne \gdef\thepage{\csname @@#1\endcsname\pageno}}
+
+\pagenumbering {arabic}
+@@
+Environment [[\@@bsphack ... \@@esphack]] is
+used by macros such as [[\index]] that want to be invisible i.e.,
+not leave any extra space when used in the middle of text. Such
+a macro should begin with [[\@@bsphack]] and end with [[\@@esphack]].
+The macro in question should not create any text, nor change the mode.
+
+<<Index macros>>=
+\newdimen \@@savsk
+\newcount \@@savsf
+
+\def \@@bsphack
+ {\@@savsk\lastskip\ifhmode\@@savsf\spacefactor\fi}
+
+\def \@@esphack
+ {\relax%
+ \ifhmode\spacefactor\@@savsf
+ {}\ifdim \@@savsk >\z@@ \ignorespaces\fi
+ \fi}
+
+@@
+The command [[\@@sanitize]] changes the catcode of all special characters
+except for braces to `other'. It can be used for commands like
+[[\index]] that want to write their arguments verbatim.
+
+<<Index macros>>=
+\def \makeother #1{\catcode`#1=12\relax}
+
+\def \@@sanitize
+ {\makeother\ \makeother\\\makeother\$%
+ \makeother\&\makeother\#\makeother\^%
+ \makeother\_\makeother\%\makeother\~\relax}
+@@
+Default command name [[\indexentry]] is shortened to [[\E]].
+This change will make input files for [[makeindex]] shorter.
+This would allow to process some indexes on MSDOS
+(there is no `big' version of [[makeindx.exe]]).
+Above change must be told to [[makeindex]] via style files,
+where the following line should be added:
+\begindisplay
+[[keyword "\\E"]]&\cr
+\enddisplay
+<<Index macros>>=
+\def \makeindex
+ {\newwrite\@@indexfile
+ \immediate\openout \@@indexfile = \jobname.idx
+ \def\index {\@@bsphack\begingroup\@@sanitize\@@wrindex\@@indexfile}
+ \message{^^J--> Writing index file \jobname.idx }}
+\def \@@wrindex#1#2%
+ {\let \thepage = \relax%
+ \xdef\gtempa
+ {\write#1{\string\E{#2}{\thepage}}}%
+ \endgroup\gtempa\@@esphack}
+\def \index
+ {\@@bsphack\begingroup\@@sanitize\@@index}
+\def \@@index#1%
+ {\endgroup\@@esphack}
+
+\def \makeglossary
+ {\newwrite\@@glossaryfile
+ \immediate\openout\@@glossaryfile=\jobname.glo
+ \def\glossary{\@@bsphack\begingroup\@@sanitize\@@wrindex\@@glossaryfile}
+ \message{Writing glossary file \jobname.glo }\fi}
+\def \glossary {\@@bsphack\begingroup\@@sanitize\index}
+
+\def \@@idxitem {\par\hangindent 20pt }
+\def \subitem {\par\hangindent 20pt \hskip 20pt }
+\def \subsubitem {\par\hangindent 20pt \hskip 30pt }
+
+\def \seeterm{see}
+\def \see#1#2%
+ {{\it \seeterm\/} #1}
+
+<<Macros for printing web indexes>>
+@@
+<<Macros for printing web indexes>>=
+\def \Input#1%
+ {\openin1 #1
+ \ifeof1
+ \message{^^J--- I cannot find file #1 }
+ \else
+ \closein1
+ \input #1
+ \message{^^J<-- Reading file #1 }
+ \fi}
+
+\def \indexspace
+ {\relax}
+
+\def \printuserleveldefs
+ {\singlecolumn
+ \vfill\eject
+ \Input{\jobname.und}}
+\def \printdefs
+ {\singlecolumn
+ \vfill\eject
+ \Input{\jobname.dnd}}
+\def \printchunks
+ {\singlecolumn
+ \vfill\eject
+ \let \pagenumber = \relax
+ \Input{\jobname.chn}}
+
+\def \beginuserleveldefs
+ {\begingroup
+ <<Ninepoint environment for printing indexes>>
+ \section{User-level definitions}
+ \let\item\@@idxitem
+ \triplecolumns \tt}
+\def \begindefs
+ {\begingroup
+ <<Ninepoint environment for printing indexes>>
+ \section{Definitions}
+ \let\item\@@idxitem
+ \triplecolumns \tt}
+\def \beginchunks
+ {\begingroup
+ <<Ninepoint environment for printing indexes>>
+ \parskip = 2\p@@ plus 2\p@@
+ \let\item\@@idxitem
+ \section{Chunks}
+ \bf}
+
+\def \endindex
+ {\endgroup}
+
+\def \makeindexes
+ {\par
+ \newwrite\@@userleveldefsfile
+ \immediate\openout\@@userleveldefsfile=\jobname.udx
+ \def\udx{\@@bsphack\begingroup\@@sanitize\@@wrindex\@@userleveldefsfile}
+ \message{^^J--> Writing index file \jobname.udx }
+ \newwrite\@@defsfile
+ \immediate\openout\@@defsfile=\jobname.ddx
+ \def\ddx{\@@bsphack\begingroup\@@sanitize\@@wrindex\@@defsfile}
+ \message{^^J--> Writing index file \jobname.ddx }
+ \newwrite\@@chunkfile
+ \immediate\openout\@@chunkfile=\jobname.chk
+ \def\chk{\@@bsphack\begingroup\@@sanitize\@@wrindex\@@chunkfile}
+ \message{^^J--> Writing index file \jobname.chk }}
+@@
+<<Ninepoint environment for printing indexes>>=
+\textfont0 = \ninerm \scriptfont0 = \sevenrm%
+\textfont1 = \ninei \scriptfont1 = \seveni%
+\textfont2 = \sevensy%
+\textfont3 = \nineex%
+\def \rm {\fam0\ninerm} \rm%
+\def \it {\nineit}%
+\def \bfit {\ninebxit}%
+\def \bf {\ninebf}%
+\def \tt {\ninett}%
+\def \oldstyle {\fam\@@ne\ninei}%
+\chardef\\ = "5C%
+\parindent = \z@@ \parskip = \z@@%
+\hfuzz = \hsize % index pages are wider
+\baselineskip = 11pt \topskip = \baselineskip%
+<<Round [[\vsize]] to the nearest multiple of [[\baselineskip]]>>
+@@
+<<Round [[\vsize]] to the nearest multiple of [[\baselineskip]]>>=
+\advance \vsize by 0.5\baselineskip
+\divide \vsize by \baselineskip
+\multiply \vsize by \baselineskip
+@@
+\section{Multicolumn environment for index formatting}
+
+<<Multicolumn environment for indexes>>=
+\def \gobble#1{}
+\let \wlog = \gobble
+
+\newskip\abovecolumnskip \abovecolumnskip = \bigskipamount
+\newskip\belowcolumnskip \belowcolumnskip = \bigskipamount
+\newdimen \gutter \gutter = 2pc
+\newdimen \c@@lumnhsize
+\newdimen \pagegoal@@limit
+\newdimen \htp@@rtialpage
+\newtoks \previousoutput
+\newcount \number@@fcolumns
+\newbox \@@partialpage
+\newdimen \singlec@@lumnhsize
+\newdimen \singlec@@lumnvsize
+\newtoks \previousoutput
+\let \@@ndcolumns = \relax
+@@
+We have a few synonymous ways to refer to multiple column modes.
+
+<<Multicolumn environment for indexes>>=
+\def \doublecolumns {\@@columns2}
+\def \triplecolumns {\@@columns3}
+\def \quadcolumns {\@@columns4}
+
+\def \singlecolumn
+ {\@@ndcolumns\vskip\belowcolumnskip\nointerlineskip}
+
+\let \endcolumns = \singlecolumn
+
+\def \@@columns #1%
+ {\@@ndcolumns%
+ \begingroup
+ \global\let\@@ndcolumns=\@@@@endcolumns
+ \par % Shouldn't start in horizontal mode.
+ \global\previousoutput = \expandafter{\the\output}
+ \pagegoal@@limit = \pagegoal
+ \advance \pagegoal@@limit by -5\baselineskip
+ \ifdim\pagetotal > \pagegoal@@limit
+ \vfill\eject
+ \else
+ \global\output =
+ {\global\setbox\@@partialpage =
+ \vbox{\unvbox255\vskip\abovecolumnskip}}
+ \pagegoal = \pagetotal
+ \eject % now expand the \output just above.
+ \fi
+ \global\number@@fcolumns=#1
+ \global\c@@lumnhsize = \hsize % if \hsize changed, get the new value.
+ \global\advance\c@@lumnhsize by -#1\gutter
+ \global\divide\c@@lumnhsize by #1
+ \global\output = {\c@@lumnoutput}
+ \global\singlec@@lumnhsize = \hsize
+ \global\singlec@@lumnvsize = \vsize
+ \hsize = \c@@lumnhsize
+ \htp@@rtialpage = \ht\@@partialpage
+ \advance \htp@@rtialpage by 0.5\baselineskip
+ \divide \htp@@rtialpage by \baselineskip
+ \multiply \htp@@rtialpage by \baselineskip
+ \ht\@@partialpage = \htp@@rtialpage
+ \global\advance\vsize by -\htp@@rtialpage
+ \global\vsize = #1\vsize }
+@@
+When this is invoked [[\box 255]] should contain just the right amount of
+material, whether triggered by an output routine or a change in the
+number of columns. Because columns have to contain a whole number of
+lines of type, we take a bit of care with balancing the heights of the
+columns to prevent either losing material or having a very short last
+column.
+
+{\it Note:} when a page ends due to [[\bye]] or [[\eject]],
+[[\box255]] will contain lots of white space, so the columns will not look
+balanced. To fix this use [[\singlecolumn]] before ending the page.
+
+<<Multicolumn environment for indexes>>=
+\def \@@columnsplit
+ {<<Balance columns>>
+ \global\setbox255 = \vbox{% see the last line on p.417 (wb)
+ \unvbox\@@partialpage
+ \ifnum\number@@fcolumns>0%
+ \setbox1 = \vbox to \dimen0{\dimen2=\dp1 \unvbox1\kern-\dimen2\vfil}
+ \ifnum\number@@fcolumns=1%
+ \hbox to \singlec@@lumnhsize{\box1}
+ \fi
+ \fi
+ \ifnum\number@@fcolumns>1%
+ \setbox3 = \vbox to \dimen0{\dimen2=\dp3 \unvbox3\kern-\dimen2\vfil}
+ \ifnum\number@@fcolumns=1%
+ \hbox to \singlec@@lumnhsize{\box1\hfil\box3}
+ \fi
+ \fi
+ \ifnum\number@@fcolumns>2%
+ \setbox5 = \vbox to \dimen0{\dimen2=\dp5 \unvbox5\kern-\dimen2\vfil}
+ \ifnum\number@@fcolumns=3%
+ \hbox to\singlec@@lumnhsize{\box1\hfil\box3\hfil\box5}
+ \fi
+ \fi
+ \ifnum\number@@fcolumns>3%
+ \setbox7 = \vbox to \dimen0{\dimen2=\dp7 \unvbox7\kern-\dimen2\vfil}
+ \ifnum\number@@fcolumns=4%
+ \hbox to\singlec@@lumnhsize{\box1\hfil\box3\hfil\box5\hfil\box7}
+ \fi
+ \fi}}
+
+\def \c@@lumnoutput
+ {\@@columnsplit
+ \hsize = \singlec@@lumnhsize % local to the \output group
+ \vsize = \singlec@@lumnvsize
+ \the\previousoutput
+ \global\vsize=\number@@fcolumns\singlec@@lumnvsize}
+
+\def \@@@@endcolumns
+ {\global\let\@@ndcolumns=\relax%
+ \par % Shouldn't start in horizontal mode.
+ \global\output = {\global\setbox1 = \box255}%
+ \pagegoal = \pagetotal
+ \eject
+ \global\setbox255 = \box1
+ \@@columnsplit
+ \global\vsize = \singlec@@lumnvsize
+ \global\output = \expandafter{\the\previousoutput}%
+ \endgroup
+ \unvbox255}
+@@
+<<Balance columns>>=
+\dimen0 = \ht255
+\advance \dimen0 by \topskip
+\advance \dimen0 by -\baselineskip
+\divide\dimen0 by \number@@fcolumns
+\splittopskip = \topskip
+\begingroup
+ \vbadness = 10000
+ \loop
+ \setbox8=\copy255
+ \global\setbox1 = \vsplit8 to \dimen0
+ \global\setbox3 = \vsplit8 to \dimen0
+ \ifnum\number@@fcolumns>2%
+ \global\setbox5 = \vsplit8 to \dimen0
+ \fi
+ \ifnum\number@@fcolumns>3%
+ \global\setbox7 = \vsplit8 to \dimen0
+ \fi
+ \ifdim\ht8>\z@@ \global\advance\dimen0 by 1pt
+ \repeat
+\endgroup
+@@
+\section{Cross references}
+
+[[\ref{value}{name}]] gives value to [[name]]\par
+[[\pageref{name}]] writes [[\ref{]]\stress{page number}[[}{name}]] to [[.ref]] file \par
+[[\refpage{name}]] prints page number referenced by [[name]] \par
+[[\showmissestrue]] if you want to see missing references
+
+<<Cross-reference macros>>=
+\newcount\miscount % number of unknown references
+\newif\ifshowmisses
+
+\def \ref #1#2%
+ {\xdef\temp{#1}
+ \expandafter\dordef\csname#2\endcsname}
+\def \dordef #1%
+ {\global\let#1\temp}
+
+\Input{\jobname.ref}
+\newwrite\refo \immediate\openout\refo=\jobname.ref
+
+\def \pageref #1%
+ {\write\refo{\string\ref{\number\pageno}{#1}}}
+\def \refpage #1%
+ {\expandafter\usedef\csname#1\endcsname}
+
+\def \usedef #1%
+ {\ifx#1\relax%
+ \ifshowmisses\showmiss #1 \fi%
+ \global\advance\miscount by 1 ???%
+ \else%
+ #1%
+ \fi}
+
+\def \showmiss #1%
+ {{\escapechar=-1%
+ \message{^^J*** WARNING: Undefined reference > #1<}}}
+
+\outer \def \bye
+ {\write \cont {\string\restorecat\string\@@}
+ \closeout\cont
+ \ifnum\miscount>0
+ \message{^^J!!! \the\miscount\space %
+ undefined reference(s) were present }%
+ \fi
+ \par\vfill\supereject
+ \end}
+@@
+\section{Web2tex macros}
+
+<<Macros written by [[web2tex]] script>>=
+{\obeyspaces\global\let = \ } % from texbook, p.381
+
+{\catcode`\`=\active \gdef`{\relax\lq}}
+{\catcode`\^^I=\active \gdef^^I{\ \ \ }}
+
+{\obeyspaces\global\def\gobblespace#1{\ifx#1 \else#1\fi}}
+
+\def \setupmodname
+ {\catcode`\$=3 \catcode`\&=4%
+ \catcode`\#=6 \catcode`\%=14%
+ \catcode`\~=13 \catcode`\_=8%
+ \catcode`\^=7 \catcode`\ =10%
+ \catcode`\^^M=5\relax}
+
+\def \LA {\begingroup\setupmodname$\langle\,$\bfit}
+\def \RA {\/$\,\rangle$\endgroup}
+
+\gdef \ttverbatim
+ {\begingroup%
+ \makeother\\\makeother\{\makeother\}\makeother\$%
+ \makeother\&\makeother\#\makeother\%\makeother\~%
+ \makeother\_\makeother\^\makeother\"%
+ \obeyspaces\obeylines\tt}
+
+\newskip\ttglue
+\ttglue=.5em plus.25em minus.15em
+
+{\catcode`\|=\active
+ \obeylines \gdef|{\ttverbatim \spaceskip\ttglue \let^^M=\ \let|=\endgroup}}
+
+\def \CODE%
+ {\ttverbatim%
+ \let\par=\endgraf%
+ \parskip=\z@@%
+ \leavevmode%
+ \ttfinish}% written by web2tex script itself
+
+%%% {\catcode`\| = 0 |catcode`|\ = 12 %
+%%% |obeylines |gdef|ttfinish#1<EDOC>{|gobblespace#1|endgroup}}
+
+\def \NO #1% line numbers which appear in the margin
+ {\noindent\llap{\ninei #1\qquad}\kern\parindent}
+
+\def \N #1#2% page number -- line number (indexes)
+ {$#2_{\oldstyle#1}$}
+
+\def \BEGINCODE
+ {\semifilbreak{0.9}
+ \bigskip
+ \begingroup
+ \obeylines}
+\def \ENDCODE
+ {\endgroup
+ \semifilbreak{0.9}}
+
+\def \BEGINDOC
+ {\bigskip
+ \begingroup
+ \catcode`\|=\active}
+\def \ENDDOC
+ {\endgroup}
+
+\newif \iffullpages
+
+\newdimen \upperbound
+
+\def \semifilbreak #1%
+ {\par
+ \upperbound = #1\vsize %% 0.1\vsize \approx 5\baselineskip
+ \ifdim\pagetotal > \pagegoal %% page already overfull;
+ %% left to page builder
+ \else
+ \ifdim\pagetotal > \upperbound
+ \vfill\eject
+ \fi
+ \fi}
+@@
+\section{Macros used for web source formatting}
+
+<<Web source formatting macros>>=
+<<Changing font>>
+<<Typeseting font tables>>
+<<Non-centered displays>>
+<<Typeseting units of measure and syntactic quantities>>
+@@
+<<Typeseting font tables>>=
+\def \oct#1{\hbox{\rm\'{}\kern-.2em\it#1\/\kern.05em}} % octal constant
+\def \hex#1{\hbox{\rm\H{}\tt#1}} % hexadecimal constant
+
+\def \oddline#1%
+ {\cr
+ \noalign{\nointerlineskip}
+ \multispan{19}\hrulefill&
+ \setbox0=\hbox{\lower 2.3pt\hbox{\hex{#1x}}}\smash{\box0}\cr
+ \noalign{\nointerlineskip}}
+
+\def \evenline {\cr\noalign{\hrule}}
+
+\def \chartstrut {\lower4.5pt\vbox to14pt{}}
+
+\def \beginchart#1%
+ {$$\postdisplaypenalty=-10000 \global\count@@=0 #1
+ \halign to\hsize\bgroup
+ \chartstrut##\tabskip0pt plus10pt&
+ &\hfil##\hfil&\vrule##\cr
+ \lower6.5pt\null
+ &&&\oct0&&\oct1&&\oct2&&\oct3&&\oct4&&\oct5&&\oct6&&\oct7&\evenline}
+
+\def \endchart
+ {\raise11.5pt\null&&&\hex 8&&\hex 9&&\hex A&&\hex B&
+ &\hex C&&\hex D&&\hex E&&\hex F&\cr\egroup$$}
+
+\def \:{\setbox0=\hbox{\char\count@@}%
+ \ifdim\ht0>7.5pt\reposition
+ \else\ifdim\dp0>2.5pt\reposition\fi\fi
+ \box0\global\advance\count@@ by1 }
+
+\def \reposition {\setbox0=\hbox{$\vcenter{\kern2pt\box0\kern2pt}$}}
+
+\def \normalchart
+ {&\oct{00x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline0
+ &\oct{01x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{02x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline1
+ &\oct{03x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{04x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline2
+ &\oct{05x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{06x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline3
+ &\oct{07x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{10x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline4
+ &\oct{11x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{12x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline5
+ &\oct{13x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{14x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline6
+ &\oct{15x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{16x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline7
+ &\oct{17x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline}
+
+@@
+<<Non-centered displays>>=
+\outer\def \begindisplay
+ {\obeylines\startdisplay}
+
+{\obeylines\gdef\startdisplay#1
+ {\catcode`\^^M=5$$#1\halign\bgroup\indent##\hfil&&\qquad##\hfil\cr}}
+
+\outer\def\enddisplay{\crcr\egroup$$}
+@@
+<<Changing font>>=
+\def \bold#{\bgroup\bf\let\next = }
+
+\def \ttt#{\bgroup\tt\let\next = }% typewriter
+
+\def \stress #1%
+ {\begingroup
+ \def \next
+ {\def \next
+ {\setbox 0 = \hbox {\nexttoken}%
+ \ifdim \ht 0< \fontdimen 5 \font
+ \it #1%
+ \else
+ \it #1\/%
+ \fi}%
+ \ifcat A\noexpand \nexttoken
+ \next
+ \else
+ \ifcat 0\noexpand \nexttoken
+ \next
+ \else
+ \ifcat \space \noexpand \nexttoken
+ \else
+ %%% \message {?: \meaning \nexttoken}%
+ \fi
+ \it #1\/%
+ \fi
+ \fi
+ \endgroup}%
+ \futurelet \nexttoken \next }
+@@
+<<Typeseting units of measure and syntactic quantities>>=
+\def \<#1>{\leavevmode\hbox{$\langle$#1\/$\rangle$}}
+
+\def \pt {\,{\rm pt}} % units of points, in math formulas
+\def \in {\,{\rm in}} % units of inches, in math formulas
+\def \em {\,{\rm em}} % units of em, in math formulas
+@@
+<<Initialize the layout>>=
+\raggedbottom
+\frenchspacing
+\fullpagesfalse
+\newwrite \cont
+\openout \cont = \jobname.toc
+\write \cont {\string\savecat\string\@@}
+\write \cont {\string\catcode`\string\@@=11}
+@
+
+
+1.1
+log
+@Initial revision
+@
+text
+@d5 2
+a6 3
+%%% version = "$Id: tweb.tw,v 2.74 1995/07/05 10:38:39 web Exp $",
+%%% date = "13 June 1995",
+%%% time = "17:34:59 MET",
+a7 1
+%%% checksum = "11515 801 2110 24084",
+a11 1
+%%% checksum = "61084 897 2387 27063",
+d80 1
+a80 1
+\def \RCS {\jobname.tw} \def \RCSversion {Experimental}
+@
diff --git a/web/tweb/texinput/slidelib.sty b/web/tweb/texinput/slidelib.sty new file mode 100644 index 0000000000..44a6db7a69 --- /dev/null +++ b/web/tweb/texinput/slidelib.sty @@ -0,0 +1,152 @@ +\input verbatim
+\shewembeddedspacesfalse
+\let \canonicalverbatim = \verbatim
+\let \canonicalmitabrev = \mitabrev
+\def \verbatim
+ {\begingroup \vskip \parskip \everypar = {}\canonicalverbatim}
+\def \mitabrev {\canonicalmitabrev \endgroup}
+
+%--------------
+\hsize = 210 mm
+\vsize = 297 mm
+\hoffset = 2 cm
+\voffset = 2 cm
+\advance \hsize by -2 \hoffset
+\advance \vsize by -2 \voffset
+%--------------
+
+\newif \iffinalrun
+
+\def \finalrun
+ {\finalruntrue
+ \font \Textfont = cmss17
+ \font \smc = cmtcsc10 at 17pt
+ \baselineskip = 20pt
+ \medskipamount = 5pt
+ \font \inlineverbatimfont = cmtt12 at 17pt
+ \font \displayverbatimfont = cmtt12 at 15pt
+ \font \footlinefont = cmvtt10
+ \font \msam = msam10 at 8pt
+ \Textfont}
+
+\def \checkrun
+ {\finalrunfalse
+ \font \Textfont = cmss10
+ \font \smc = cmtcsc10 at 10pt
+ \baselineskip = 12pt
+ \medskipamount = 3pt
+ \font \inlineverbatimfont = cmtt10
+ \font \displayverbatimfont = cmtt8
+ \font \footlinefont = cmvtt10
+ \font \msam = msam10 at 6pt
+ \Textfont}
+
+\def \square {\raise 0,2ex\hbox{\msam\char'4}}
+
+\let \FilBreak = \filbreak
+\def \filbreak {\nobreak \line {}\FilBreak}
+
+\newtoks \runningfootline
+\footline = {\rightline {\footlinefont \the \runningfootline}}
+
+\def \eg {e.g., \ignorespaces}
+\def \ie {i.e., \ignorespaces}
+\def \cm {\unskip \thinspace cm}
+\def \stress #1{#1\/}
+
+\let \canonicalshipout = \shipout
+\def \shipout
+ {\advance \hoffset by -0.75 true in
+ \advance \voffset by -1.5 true in
+ \canonicalshipout}
+
+\newbox \linebox
+\newbox \slidebox
+\def \slide {\afterassignment \setslide \setbox \slidebox = \hbox}
+\def \setslide
+ {\aftergroup \reallysetslide
+ \iffinalrun
+ \font \thisfont = cmssbx10 at 15pt
+ \font \inlineverbatimfont = cmtt12 at 15pt%
+ \else
+ \font \thisfont = cmssbx10
+ \font \inlineverbatimfont = cmtt10%
+ \fi
+ \thisfont}
+\def \reallysetslide
+ {\filbreak
+ \line {}
+ \vfill
+ \vskip -\baselineskip
+ {\offinterlineskip
+ \everypar = {}\noindent
+ \copy \slidebox
+ \vskip -0.5ex
+ \noindent
+ \leaders \hrule depth 0.125ex height 0pt\hskip \wd\slidebox\hbox{}
+ \iffinalrun
+ \vskip -0.625ex
+ \else
+ \vskip -1ex
+ \fi
+ \noindent\kern0.5in
+ \leaders \hrule height 0.5ex\hskip 2in\hbox{}
+ \medskip}
+ }
+
+\parindent = 0pt
+\parskip = 1ex
+
+\everypar = {\hangindent = 1em
+ \hangafter = 1
+ \pretolerance = 9999
+ \rightskip = 0pt plus 0.2\hsize
+ \parfillskip = 0pt plus 0.8\hsize
+ \linepenalty = 10000
+ \hbox to \hangindent {\square\hfil}%
+ }
+
+%%% defs
+
+\def \TuG {{\smc TUG}\spacefactor = 1000 }
+\def \gust
+ {{\smc GUST}\spacefactor = 1000 }
+
+%%% now active punctuation is defined
+
+\catcode `\^^M = \active %
+\def ^^M{ }
+\def \next {\let \spacechar = }
+{\aftergroup \next} %
+
+\def \activepunctuation #1%
+ {\catcode `#1 = \active
+ \lccode `\^^M = `#1
+ \long \def \analysenextchar %
+ {\afterassignment \analysechar \let \nextchar = }
+ \lowercase {\global \def ^^M}{#1\analysenextchar}
+ \def \analysechar %
+ {\ifx \nextchar \spacechar %
+ \def \next { \analysenextchar}%
+ \else \ifx \nextchar ^^M%
+ \let \next = \par %
+ \else %
+ \let \next = \nextchar %
+ \fi %
+ \fi %
+ \next %
+ }
+ }
+
+\activepunctuation :
+\activepunctuation ;
+\activepunctuation .
+\activepunctuation ?
+\activepunctuation !
+
+\def \LP {L\kern-0,1emP}
+\runningfootline {TUG\thinspace '95 / \folio}
+
+\endinput
+
+
diff --git a/web/tweb/texinput/verbatim.tex b/web/tweb/texinput/verbatim.tex new file mode 100644 index 0000000000..d38be9e915 --- /dev/null +++ b/web/tweb/texinput/verbatim.tex @@ -0,0 +1,252 @@ +%%% Most recent mods: 19-MAY-1994 15:26:00
+%%% Improved use of \displayverbatimfont and \inlineverbatimfont
+
+\catcode `\@ = 11 %%% we use commercial-at as a letter throughout;
+\chardef \l@tter = 11 %%% and introduce synonyms for the \catcodes for
+\chardef \@ther = 12 %%% <letter> and <other>;
+\newcount \c@unt %%% a loop-counter;
+\newcount \ch@rcode %%% this will hold the character-code of the
+ %%% escape character;
+\newif \ifd@bugging %%% set <true> if you want to watch the
+ %%% finite-state automaton at work;
+\newif \ifshewleadingspaces %%% set <true> if you want to see leading spaces
+ %%% shewn as inverted square cup (explicit);
+\newif \ifshewembeddedspaces %%% set <false> if you want to see embedded
+\shewembeddedspacestrue %%% spaces shewn as white space (implicit);
+\ifd@bugging %%% if <debugging>,
+ \let \m@ssage = \message %%% \m@ssage is synonymous with \message
+\else %%% otherwise
+ \def \m@ssage #1{}% %%% it simply throws its parameter away;
+\fi
+%
+\def \verbatim %%% the \verbatim macro takes no parameter
+ {\begingroup %%% and immediately starts a nested group
+ \def \n@sted %%% within which \n@sted is defined
+ {\begingroup %%% to start a further group within which
+ \let \n@sted %%% \n@sted becomes a synonym for \endgroup
+ = \endgroup
+ \@nvironment %%% and the environment is restored to that
+ %%% which obtained two levels of nesting out;
+ \ignorespaces %%% for tidyness, we ignore any <lwsp>
+ }% %%% which follows the escape character;
+ \edef \@nvironment %%% we initialise \@nvironment
+ {\the \font %%% who forgot this ?????
+ \parindent = %%% to prepare to restore \parindent
+ \the \parindent
+ \parskip = %%% and \parskip;
+ \the \parskip
+ \space %%% and ensure that the value to be assigned to
+ }% %%% \parskip is properly terminated;
+ \displayverbatimfont %%% we don't assume Knuth's font-selectors;
+ %%% select the `large typewriter' font;
+ \parskip = 0 pt %%% we then set \parindent and
+ \parindent = 0 pt %%% \parskip to 0 pt;
+ \c@unt = 0 %%% and initialise \count to 0;
+ \loop %%% this loop checks the \catcode of each
+ %%% character code in the range 0 .. 127
+ %%% (or 0 .. 255 for TeX V3) and if it
+ %%% is other than <letter> or <other>, as
+ %%% appropriate, saves the current value in
+ %%% \@nvironment for subsequent restoration
+ %%% within an inner group; it then sets the
+ %%% \catcode to either <letter> or <other>;
+ \ifnum \c@unt < `\A
+ \s@ve \catcode \c@unt = \@ther
+ \else \ifnum \c@unt > `\z
+ \s@ve \catcode \c@unt = \@ther
+ \else \ifnum \c@unt > `\Z
+ \ifnum \c@unt < `\a
+ \s@ve \catcode \c@unt = \@ther
+ \else \s@ve \catcode \c@unt = \l@tter
+ \fi
+ \else \s@ve \catcode \c@unt = \l@tter
+ \fi
+ \fi
+ \fi
+ \advance \c@unt by 1
+ \ifnum \c@unt < 256 % or 128 for the V2 sites ...
+ \repeat
+ \v@rbatim
+ }
+%
+\def \v@rbatim #1% %%%
+ {\if #1 %%%
+ \let \n@xt = \v@rb@tim %%%
+ \else %%%
+ \def \n@xt %%%
+ {\v@rb@tim #1}% %%%
+ \fi %%%
+ \n@xt %%%
+ } %%%
+%
+\def \v@rb@tim #1%
+ {\ch@rcode = `#1 %%%
+ \edef \@nvironment %%% and append code to \@nvironment
+ {\@nvironment %%% to make the escape character active;
+ \catcode \the \ch@rcode
+ = \active
+ \space %%% <space> separates list items in \@nvironment
+ }%
+ \catcode \ch@rcode %%% the escape character is made active;
+ = \active
+ \uccode `\^^M = \ch@rcode %%% and the upper-case code of <return> is made
+ %%% equal to the character-code of the escape
+ %%% character; this is necessary because only
+ %%% <return> can be guaranteed to be active at
+ %%% this point, and we need an active character
+ %%% to form the primary operand of \def;
+ %%% the \@x's below are \expandafter's,
+ %%% and the effect is to upper-case <return>
+ %%% (yielding the escape character), then \def
+ %%% (an active instance of) this character as
+ %%% \n@sted, which has been defined above;
+%
+ \@x \uppercase \@x {\@x \def \r@turn {\n@sted}}%
+%
+ \uccode `\^^M = 0 %%% the upper-case code of <return> is then re-
+ %%% instated (not strictly true; it is set to 0,
+ %%% which is assumed to be its previous value
+ %%% --- could be improved here);
+ \@ctivecr %%% <return> is made active;
+ \@ctivespace %%% and so is <space> (to avoid space-elision);
+ %%% finally, the finite-state automaton which
+ }% %%% processes <space>s is set to <????>;
+ %%% this ends the definition of \verbatim.
+%
+\def \s@ve #1#2=#3% %%% \s@ve minimises the \catcode restoration
+ {\ifnum #1#2 = #3% %%% work of \@nvironment by saving only the
+ %%% \catcode of characters whose \catcode
+ %%% is to be changed; it then changes the
+ %%% \catcode of those characters.
+ \else \edef \@nvironment
+ {\@nvironment #1\the #2=\the #1#2 }%
+ #1#2 = #3%
+ \fi
+ }%
+ %%% the code which follows implements the finite
+ %%% state automaton which determines whether
+ %%% <space>s are ignored, shewn explicitly or
+ %%% implied, and which ensures that blank
+ %%% lines are reproduced correctly.
+%
+\def \v@id {\futurelet \n@xt \v@idifspace}%
+\def \l@ad {\l@adingspace \futurelet \n@xt \l@adifspace}%
+\def \sk@p {\vskip \baselineskip \futurelet \n@xt \l@adifspace}%
+\def \emb@d {\emb@ddedspace}%
+\def \sh@wspace {\char 32\relax}%
+\def \h@despace {\leavevmode \kern \fontdimen 2 \font}%
+\def \l@adingspace {\ifshewleadingspaces \sh@wspace \else \h@despace \fi}%
+\def \emb@ddedspace {\ifshewembeddedspaces \sh@wspace \else \h@despace \fi}%
+\def \v@idifspace {\testn@xt {\afterassignment \v@id}}%
+\def \l@adifspace {\testn@xt {\afterassignment \sk@p}}%
+%
+ %%% \testn@xt provides a common look-ahead for
+ %%% \v@idifspace and \l@adifspace, and also
+\def \testn@xt #1% %%% implements some essential debugging hooks.
+ {\ifx \n@xt \sp@c@
+ \m@ssage {Next character is a space}%
+ \let \n@xt = \relax
+ \else \ifx \n@xt \r@t@rn
+ \m@ssage {Next character is a return}%
+ \def \n@xt {#1\let \n@xt = }%
+ \else \m@ssage {Next character is \meaning \n@xt}%
+ \let \n@xt = \relax
+ \@x \let \sp@ce = \emb@d
+ \fi
+ \fi
+ \n@xt
+ }%
+%
+ %%% We next tamper with the \catcode of <space>
+ %%% and <return>, while defining macros and
+ %%% synonyms which require them to be active;
+ %%% the \catcode is then restored to its default
+ %%% (not necessarily the previous value ---
+ %%% could be improved). \@ctivespace makes
+ %%% <space> active, then defines <space> as
+\catcode `\ = \active% %%% \v@id with a synonym \sp@c@. This code is
+\def\sp@ce{ }% %%% used by the finite-state automaton.
+\def\@ctivespace%
+{\catcode`\ =\active\def {\v@id}\let\sp@c@= }\catcode`\ =10\relax%
+\catcode`\ =10\relax%
+%
+\catcode `\^^M = \active % %%% <return> is made active;
+\def \r@turn {^^M}% %%% \r@turn defined as an active <return>;
+\let \r@t@rn = ^^M% %%% \r@t@rn is made a synonym;
+\def \@ctivecr % %%% and \@ctivecr is defined to
+ {\catcode `\^^M = \active % %%% make <return> active, then
+ \def ^^M% %%% define <return> to manipulate the
+ %%% finite-state automaton and ...
+ {\@x \def \sp@ce {\l@ad}%
+ \@x \let \@x \sp@c@ \@x =\sp@ce %
+%
+ \endgraf % %%% insert a \par primitive (for blank lines).
+%
+ \futurelet \n@xt \l@adifspace %
+ }%
+ \let \r@t@rn = ^^M% %%% \r@t@rn is synonymous with active <return>
+ }%
+\catcode `\^^M = 5 % %%% finally, the \catcode of <return> is
+ %%% restored to its normal value;
+%
+ %%% the \AfterGroup macro is intended for
+ %%% use within a nested normal environment,
+ %%% and causes (a concealed macro defined as)
+ %%% its parameter text to be inserted into
+ %%% TeX's input stream when the nested normal
+ %%% group terminates.
+%
+\def \AfterGroup #1{\global \def \@ftergroup {#1}\aftergroup \@ftergroup}%
+%
+\let \@x = \expandafter %%% \@x is a brief synonym for \expandafter;
+%
+\catcode `\@ = \@ther %%% commercial-at is restored to its normal
+ %%% <other> catcode (not necessarily the
+ %%% previous value --- could be improved);
+%
+\def \mitabrev %%% and \mitabrev defined as the closure for
+ {\endgroup \endgroup}% %%% \verbatim; any other name could be used,
+ %%% as the code performs no look-ahead for
+ %%% any particular string.
+%
+ %%% Finally we announce to the world that we
+ %%% have been loaded, and gives some clues as
+ %%% to the usage.
+%
+\message {Verbatim environment loaded;}%
+%\message {usage: ``\noexpand \verbatim \noexpand <char\noexpand > ... \noexpand
+% <char\noexpand > \noexpand \mitabrev''}%
+%
+\ifx \tt \undefined
+ \font \displayverbatimfont = cmtt10
+ \font \inlineverbatimfont = cmtt10
+\else
+ \let \displayverbatimfont = \tt
+ \let \inlineverbatimfont = \tt
+\fi
+%
+%%% ======================================================================== %%%
+%
+\begingroup
+\catcode `\@ = 11
+\global \catcode `\| = \active
+\global \def |{\begingroup \p@ssivate \s@lidus} %%% for | ... |
+\global \def \s@lidus #1|{\inlineverbatimfont #1\endgroup}
+\global \def \p@ssivate
+ {\count 255 = 0
+ \loop
+ \ifnum \catcode \count 255 = 11 {}%
+ \else \ifnum \catcode \count 255 = 12 {}%
+ \else \catcode \count 255 = 12
+ \fi
+ \fi
+ \ifnum
+ \count 255 < 255
+ \advance \count 255 by 1
+ \repeat
+ \catcode `\| = \active
+ \catcode `\ = \active
+ }
+\endgroup
+%
+% {\catcode `\ = \active\global\def {\leavevmode\kern\fontdimen2\font}}
diff --git a/web/tweb/tug95/doc/paper.pdf b/web/tweb/tug95/doc/paper.pdf Binary files differnew file mode 100644 index 0000000000..75b8574dec --- /dev/null +++ b/web/tweb/tug95/doc/paper.pdf diff --git a/web/tweb/tug95/doc/plain.pdf b/web/tweb/tug95/doc/plain.pdf Binary files differnew file mode 100644 index 0000000000..680bfa7868 --- /dev/null +++ b/web/tweb/tug95/doc/plain.pdf diff --git a/web/tweb/tug95/doc/slides.pdf b/web/tweb/tug95/doc/slides.pdf Binary files differnew file mode 100644 index 0000000000..2fb5dd67a5 --- /dev/null +++ b/web/tweb/tug95/doc/slides.pdf diff --git a/web/tweb/tug95/doc/tweb.pdf b/web/tweb/tug95/doc/tweb.pdf Binary files differnew file mode 100644 index 0000000000..fa77c10061 --- /dev/null +++ b/web/tweb/tug95/doc/tweb.pdf diff --git a/web/tweb/tug95/paper.tex b/web/tweb/tug95/paper.tex new file mode 100644 index 0000000000..bccd4aab9a --- /dev/null +++ b/web/tweb/tug95/paper.tex @@ -0,0 +1,419 @@ +%%% ==================================================================== +%%% @TeX-file{ +%%% author = "W\l{}odek Bzyl", +%%% version = "1.03", +%%% date = "10 July 1995", +%%% time = "23:30:58 MET", +%%% filename = "Bzyl.tex", +%%% checksum = "14630 396 2096 14305", +%%% address = "Instytut Matematyki, +%%% Uniwersytet Gda\'nski +%%% Wita Stwosza 57 +%%% 80--952 Gda\'nsk, Poland", +%%% email = "matwb@halina.univ.gda.pl (Internet)", +%%% abstract = "Paper for TUG '95 meeting", +%%% } +%%% ==================================================================== +%%% +%%% TeXing this file requires the following files: +%%% -------------------------------------------------------------------- +%%% TUGPROC.STY +%%% TUGBOAT.STY +%%% TUGBOAT.CMN +%%% -------------------------------------------------------------------- + +\input tugproc.sty + +%%% +%%% Local macros: +%%% + +\def \footnoterule% footnote rule was to close to main text + {\kern-2pt + \hrule width 5pc \kern 1.6pt } + +\def \nl {\hfill\break} + +\let \mc=\ninerm +\font \xivss = cmss10 at 14pt + +\def\UNIX{{\smc u\kern-.05em nix}\spacefactor1000 } +\def\MSDOS{{\smc MSDOS}\spacefactor1000 } + +\def \CWEB {{\smc cweb}\spacefactor1000 } +\def \FWEB {{\smc fweb}\spacefactor1000 } +\def \NOWEB {{\tt noweb}\spacefactor1000 } +\def \TANGLE {{\tt T\kern-.025em ANGLE}\spacefactor1000 } +\def \WEAVE {{\tt WEA\kern-.05em VE}\spacefactor1000 } +\def \TWEB {{\tt \TeX-WEB}\spacefactor1000 } + +\def \AWK {{\smc awk}\spacefactor1000 } +\def \C {{\smc c}\spacefactor1000 } +\def \flex {{\smc flex}\spacefactor1000 } +\def \Fortran {{\smc fortran}\spacefactor1000 } +\def \icon {{\smc icon}\spacefactor1000 } +\def \perl {{\smc perl}\spacefactor1000 } +\def \plain {{\tt plain}\spacefactor1000 } +\def \RCS {{\smc rcs}\spacefactor1000 } + +\let \( = ( +\let \) = ) + +{\makeactive\( +\gdef \enablemetacode + {\AddToSpecialsGetOther{\catcode`\(=\other}% + \makeactive\(% + \def(##1)% + {{\it\makeCtrlMspace\makespacespace##1\/}}}} +\enablemetacode +\everyverbatim = {\makeescape\!\enablemetacode\parindent=0pt} + +\frenchspacing +\normalbottom +\nopunctuation +\def\mtgyear{1995} + +%%%-------------------------------------------------------------------- + +\title * Literate plain source is available! * + +\author * W\l{}odek Bzyl * +\netaddress * matwb@halina.univ.gda.pl * + +\abstract +When introduced, literate programming was synonymous +with \WEB, a system for writing literate Pascal programs. +Since then many different \WEB's, +aimed on particular programming language, were created. +Each \WEB\ is constructed of two separate parts. +One is called \TANGLE, the other \WEAVE. +Typically each part consists of just one program +performing many tasks---expands macros, +prettyprints code, generates and sorts an index etc. +This makes adaptation of the existing \WEB\ to another +language extremely difficult. + +Other approach to literate programming is presented by +Norman Ramsey, the author of \NOWEB. He designed and +realized \TANGLE/\WEAVE\ pair as \UNIX\ pipes. +By extending and/or replacing parts of pipes with programs, +written in \AWK, \icon, \flex, \perl, \C, \TeX, \mf, +new tool could be created with relatively small effort. +%%%new profession: plumber +%%%see also: plume +For example, with \NOWEB, it was possible to create simple +\TWEB\ system by writing \AWK\ script and new \TeX\ format. +New system was applied for creation +of literate \plain\ source. Although the resulted file +is principally {\tt plain.tex} code interleaved with +documentation, borrowed mainly from \TB, it presents the +whole code from the different perspective. The documentation is +organized around the macros as they appear in the {\tt plain.tex} +rather than around the topics as in \TB. +This means that \WEB\ source is {\it not\/} a +user manual, even though many notions are explained there. +\endabstract + + +\article + +\head * WEB for everyone? * + +\subhead * \WEB\ is a powerful tool. * + +\nl The strength of literate programs lies in their ability to +produce high-quality typeset documentation. The strength of +literate programming lies in allowing you to write code +where you are telling to humans what computer should do, +instead of telling to computer what should be +done. Obviously we are more efficient and precise when +communicate with humans than computers. Thus literate +programs are more easily written and maintained than +ordinary ones. +%%% \TeX/\mf/and friends were ported to every possible +%%% platform + +\subhead * \WEB\ is a complex tool. * + +\nl A literate program consists of pieces of documentation and +named chunks containing code and references to other chunks. +The pieces are arranged in order +which helps to explain \(and understand\) the program as a whole. + \WEB\ consists of two processors: \TANGLE\ and \WEAVE. +\TANGLE\ is used for extracting a program by replacing one +named chunk by its definition. The process of replacement is +recursive. It continues until no named chunks remain. From +one \WEB\ source many programs could be extracted \(this is +achieved by presenting \TANGLE\ with different chunks\). + \WEAVE\ is used for converting \WEB\ markup into \TeX\ +markup as described and coded in a separate format +file which handles numerous typographical details of typeset +documentation and provide support for typical tasks as +cross-referencing, preparation of indexes, bibliography. +Formats for long and short documents will be different. +To typeset converted file you will need \TeX\ running on +your system. Errors can creep in \TeX\ code. +To get \TeX\ code working with other formats +could end with a short trip into \TeX\ language +\(this will be needed if you plan your literate program to +form a part of article, report, or book\). + + +\bigskip + +We learn by reading. Why not to read `literate books'. +There are a few such books already and more will appear. +We learn by writing too. Why not to try one of finished tools. +\C/\C++/\Fortran\ programmer could try \CWEB\ or \FWEB. +Programmers which write in other languages +could check {\tt CTAN:/tex-archive/web} directory. +If your language is not on the list, or you are not able to +express yourself with the style offered then +you are welcome in the province of those who build their +own tools. This territory is growing fast due to efforts of +Norman Ramsey who established a base for creating simple and +extensible literate tools. + + +\head * Presenting a new tool \TeX-WEB * + +N.~Ramsey was the first who attempted to create generic +--- not aimed for particular language --- literate tool. +Such a tool would be useless because its generality. +Key to usefulness of \NOWEB\ lies in extendibility. +The tasks for \TANGLE/\WEAVE\ were divided among stand-alone +programs. +To simplify tangling and weaving a front end was introduced. +It performs a kind of lexical analysis of the source, +task previously performed by both processors separately. + The front end provided with \NOWEB\ is called {\tt markup} +because it marks each line of source as line of text, as +beginning/end of code/documentation, as definition/use of +named chunks, etc.%%% +\footnote{$^1$}{%%%----------------------------------------- + There is {\tt unmarkup} which works in opposite way. + I borrowed from \NOWEB\ two more programs: + {\tt nt} \(tangle\) and + {\tt mnt} \(multiple tangle\).} + + +\subhead * \WEAVE * + +\verbatim +markup foo.tw | web2tex > foo.tex +markup foo.tw | awk -f web2tex > foo.tex +\endverbatim +where the second command line is used on \MSDOS\ systems. + With {\tt markup} as front end, \WEAVE\ was build as \AWK\ +script {\tt web2tex}%%% +\footnote{$^2$}{%%%---------------------------------------- + To allow tangling many files at once {\tt web2tex} is + actually shell wrapper for the \AWK\ script.} +which reads marked source line by line +and performs actions attached to line type. +Most of the time it inserts a bunch of \TeX\ macros. + +The format |tweb.sty| provides support for cross +references, indexes, and multicolumn output. +There you find macros |\chapter|, |\[sub[sub]]section|, +|\paragraph|,%%% +\footnote{$^3$}{%%%--------------------------------------- +These macros should not be overused. +Usually the chunk name alone is a better choice.} +|\printcontents|, |\title|. + +Index macros are inserted by |web2tex|. + +\subhead * \TANGLE * + +\verbatim +markup foo.tw | nt > foo.sty +markup foo.tw | nt -R'Chunk B' > foo.sty +markup foo.tw | mnt 'Chunk B' 'Chunk A' +\endverbatim +Here we have several possibilities. We can extract code +beginning from the chunk named `|<<*>>|', or +from the `|Chunk A|' \(see template file below\). +Finally, `|Chunk A|' and `|Chunk B|' could be simultaneously +extracted to the files with the same names. + +\subhead * \tt\TeX * + +\verbatim +tex foo.tex +makeindex -s dnd.ist -o foo.dnd foo.ddx +makeindex -s und.ist -o foo.und foo.udx +makeindex -s chn.ist -o foo.chn foo.chk +tex foo.tex +\endverbatim +Indexes are sorted by |makeindex|. Three very short style +files are provided due to different formatting of indexes. +\MSDOS\ |makeindx| breaks on large indexes. + +\subhead * Sample {\tt Makefile} * + +\nl To ease work with tools a simple |Makefile| is provided. +Write |make| on the command line, press {\tt Enter} key, and, +assuming that only one \TWEB\ file named |foo.tw| resides in +the current directory, the following lines will appear on a +terminal + +\verbatim[\ruled] + Weaving: make foo.tex + Tangling: make foo.sty + Texing: make foo.dvi + Making archive: make archive + Cleaning: make clean or veryclean +\endverbatim +Many different conventions are used where to store files in +a file system. In the |Makefile| three variables are defined: + |SCRIPTDIR| -- place for |web2awk| and other scripts + \(defaults to |BIN|\), + |INDEXDIR| -- place for index styles + \(defaults to |IDXSTY|\), + |MAKEINDEX| -- the name of makeindex program + \(defaults to |makeindex|\). + + +\subhead * Template of \TWEB\ source * + +\nl The structure of \TWEB\ file will be shown on the example. +\medskip +\noindent File name: {\tt foo.tw} +\verbatim[\ruled] +\title{foo.tw -- template file} +\printcontents % if you want TOC +@ +The skeleton of the file foo.tw +<<*>>= +<<Chunk A>> +<<Chunk B>> +@ +Documentation for Chunk A. +<<Chunk A>>= +(!TeX! code / references to other chunks) +@ +Documentation for Chunk B. +<<Chunk B>>= +(!TeX! code / references to other chunks) +\endverbatim + + Documentation chunks begin with the line that +starts with |@| followed by space or newline. + Code chunks begin with |<<|Chunk name|>>=| on a line by itself. + Chunks are terminated by the beginning of another chunk or +end of file. + +\subhead * Making changes/updates * + +\nl The change file mechanism is not needed in case of \TeX\ +language. Change files are used to incorporate system +dependent code into source file, but \TeX\ code is already +system independent. \TeX\ code could be only `format +dependent'. + Another feature of format file is that it evolves with +time, yet some intermediate versions are used for +preparation of books, articles etc. All these versions and +configurations must be kept well organized, otherwise you +are bound to be lost. The Revision Control System is the tool that +assists with these tasks. + With the \RCS\ it is possible, with small overhead, + to preserve {\it all revisions} + which evolved from given text document, + merge changes made by others, + compare different versions, + keep log of changes. + + +\subhead * \RCS * + +\verbatim +ci foo.tw !hfill (check-in last version!kern 1.25em) +co foo.tw !hfill (check-out last version!kern 1.25em) +co -r(rev) foo.tw +rlog foo.tw +rcsdiff -r(rev) foo.tw +rcsmerge -r(later!_rev) -r(earlier!_rev) foo.tw +\endverbatim +\medskip +\noindent When the first command is executed |foo.tw| is stored in +a {\it group file\/} \(with default name |foo.tw,v| on \UNIX\ +machines, or |foo.tw%| on \MSDOS\) as new revision. + For each deposited revision |ci| prompts for log +message. The file |foo.tw| is deleted unless you say +|ci -l foo.tw|. The message |ci error: no lock set by (login)| +means that \RCS\ was configured with `strict locking feature' +enabled. Locking prevents overlapping modifications +if several users are working on the same file. This feature +is disabled with |rcs -U foo.tw|; it is unnecessary if only +owner of the file is expected to deposit revisions into it. + +The next two commands are used to extract the latest, or the +specified revision from the group file. +|rlog| is used to print log messages. + With |rcsdiff| different revisions are compared. +|rcs foo.tw| compares the latest revision with the contents +of the working file. Differences between files are found by +the program |diff|; +if you do not like the |diff| default output, change it by +passing appropriate switches to |rscdiff|. +The last command undoes the changes between revisions; the +file |foo.tw| will be overwritten. |rcsmerge| +incorporates changes between two revisions into the +working file. + Similar effect could be achieved +with a stand-alone program called |merge|. +If files to compare are |mine|, |older|, |yours| +then with the command +\verbatim +merge mine older yours +\endverbatim +|merge| tries to add to |main| the result of subtracting |older| from +|yours|; if overlap occurs i.e. both files |mine| +and |yours| have changes to the same segment of lines in +|older| then |merge| delimits the alternatives with +\verbatim +<<<<<<< mine +(lines in) mine +======= +(lines in) yours +>>>>>>> yours +\endverbatim +and writes above to |mine|. Now is up to you wich set of +changes you adopt. |merge -p ... | sends the result of +merging to the standard output. + +To keep working directory uncluttered, all \RCS\ files are +usually stored in the subdirectory with the name |RCS|. +\RCS\ commands look first into this directory when searching +for files. + + +%%%\subhead * Errors * + +%%%|\inputlineno = (number)| +%%%does not work in horizontal nor vertical mode. + +\head * Concluding remarks * + +It seems that \TeX\ language constitutes a good starting +point for exploring the idea of literate programming. The +system is simple, because many features present in other +\WEB's are not needed. The system is extensible, which means +that it possible to try different styles and features. + And finally, programs written in \TeX\ are not too long --- +{\tt plain.tex} is about 1000 lines of code --- which means +that you can print the documentation of real programs +yourself and share it with others. + +For those who are convinced by the analysis above +I included literate source of {\tt plain.tex} -- a basic set of +macros for \TeX. Please read and enjoy. + + +\endarticle + +Local Variables: *** +mode: text *** +fill-column: 60 *** +End: *** diff --git a/web/tweb/tug95/slides.tex b/web/tweb/tug95/slides.tex new file mode 100644 index 0000000000..f12ed86122 --- /dev/null +++ b/web/tweb/tug95/slides.tex @@ -0,0 +1,60 @@ +\input slidelib.sty
+\checkrun
+%\finalrun
+
+\slide {CAUGHT BY WEB}
+learned about \LP\ from a friend;
+did adaptation of TUGBoat styles for GUST bulletin
+(had played with the experimental \TeX\ mode of FWEB);
+since then have been exploring the idea of \LP;
+
+
+\slide {THREE FACES OF WEB}
+%% as opposed to OOP
+\LP\ programs are `human oriented'
+ -- documentation is a part of \LP\ program;
+in code part you are telling to humans what computer
+ should do, instead of telling to computer what should be done;
+works well when writing programs directly from the keyboard;
+
+
+\slide {UTILITARY BENEFITS OF WEB}
+\LP\ programs have unique style; typeset \LP\ programs are
+ easy to read and comprehend;
+code part could be read in a `stratified' way which is
+ quick and efficient way learning structure of programs;
+indexes (automatically generated), cross-references, bibliography --
+ everything typeset by \TeX\ adds to readability and understanding;
+blends well with existing tools
+ (RCS, AWK, PERL, DIFF, PATCH, MERGE...);
+
+
+\slide {CREATING YOUR OWN \LP\ TOOLS WITH NOWEB}
+TANGLE already done;
+WEAVE modify existing scripts;
+adapt existing format to work with macros
+ inserted by the script;
+extend tools;
+
+
+\slide {WHAT I HAVE NOT SUCCEEDED TO TELL...}
+more about \LP\ tools;
+details of \TeX-WEB system;
+another approach for making changes / updates to \LP\ sources;
+
+\end
+
+
+\slide {Feature or flaw? |\csname u n d e f \endcsname = \relax|}
+If used in uncontrolled manner, can conceal flaws in coding;
+but if used only an a tightly controlled manner, can lead to
+ far more elegant and less verbose code.
+
+\slide {Context sensitivity through nested |\if|s}
+If the set of possible entities is small, conditionals may suffice:
+\verbatim !
+ \ifx \precedingentity \sectionhead
+ \fi
+ \fi
+! \mitabrev
+
diff --git a/web/tweb/tweb.sty b/web/tweb/tweb.sty new file mode 100644 index 0000000000..de6eafa54f --- /dev/null +++ b/web/tweb/tweb.sty @@ -0,0 +1,663 @@ +\newlinechar `^^J
+
+\def \savecat #1%
+ {\expandafter\xdef\csname\string#1savedcat\endcsname{\the\catcode`#1}}
+\def \restorecat #1%
+ {\catcode`#1=\csname\string#1savedcat\endcsname}
+\savecat\@
+
+\catcode`\@ = 11
+
+\def \bold#{\bgroup\bf\let\next = }
+
+\def \ttt#{\bgroup\tt\let\next = }% typewriter
+
+\def \stress #1%
+ {\begingroup
+ \def \next
+ {\def \next
+ {\setbox 0 = \hbox {\nexttoken}%
+ \ifdim \ht 0< \fontdimen 5 \font
+ \it #1%
+ \else
+ \it #1\/%
+ \fi}%
+ \ifcat A\noexpand \nexttoken
+ \next
+ \else
+ \ifcat 0\noexpand \nexttoken
+ \next
+ \else
+ \ifcat \space \noexpand \nexttoken
+ \else
+ %%% \message {?: \meaning \nexttoken}%
+ \fi
+ \it #1\/%
+ \fi
+ \fi
+ \endgroup}%
+ \futurelet \nexttoken \next }
+\def \oct#1{\hbox{\rm\'{}\kern-.2em\it#1\/\kern.05em}} % octal constant
+\def \hex#1{\hbox{\rm\H{}\tt#1}} % hexadecimal constant
+
+\def \oddline#1%
+ {\cr
+ \noalign{\nointerlineskip}
+ \multispan{19}\hrulefill&
+ \setbox0=\hbox{\lower 2.3pt\hbox{\hex{#1x}}}\smash{\box0}\cr
+ \noalign{\nointerlineskip}}
+
+\def \evenline {\cr\noalign{\hrule}}
+
+\def \chartstrut {\lower4.5pt\vbox to14pt{}}
+
+\def \beginchart#1%
+ {$$\postdisplaypenalty=-10000 \global\count@=0 #1
+ \halign to\hsize\bgroup
+ \chartstrut##\tabskip0pt plus10pt&
+ &\hfil##\hfil&\vrule##\cr
+ \lower6.5pt\null
+ &&&\oct0&&\oct1&&\oct2&&\oct3&&\oct4&&\oct5&&\oct6&&\oct7&\evenline}
+
+\def \endchart
+ {\raise11.5pt\null&&&\hex 8&&\hex 9&&\hex A&&\hex B&
+ &\hex C&&\hex D&&\hex E&&\hex F&\cr\egroup$$}
+
+\def \:{\setbox0=\hbox{\char\count@}%
+ \ifdim\ht0>7.5pt\reposition
+ \else\ifdim\dp0>2.5pt\reposition\fi\fi
+ \box0\global\advance\count@ by1 }
+
+\def \reposition {\setbox0=\hbox{$\vcenter{\kern2pt\box0\kern2pt}$}}
+
+\def \normalchart
+ {&\oct{00x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline0
+ &\oct{01x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{02x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline1
+ &\oct{03x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{04x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline2
+ &\oct{05x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{06x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline3
+ &\oct{07x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{10x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline4
+ &\oct{11x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{12x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline5
+ &\oct{13x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{14x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline6
+ &\oct{15x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline
+ &\oct{16x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\oddline7
+ &\oct{17x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&\evenline}
+
+\outer\def \begindisplay
+ {\obeylines\startdisplay}
+
+{\obeylines\gdef\startdisplay#1
+ {\catcode`\^^M=5$$#1\halign\bgroup\indent##\hfil&&\qquad##\hfil\cr}}
+
+\outer\def\enddisplay{\crcr\egroup$$}
+\def \<#1>{\leavevmode\hbox{$\langle$#1\/$\rangle$}}
+
+\def \pt {\,{\rm pt}} % units of points, in math formulas
+\def \in {\,{\rm in}} % units of inches, in math formulas
+\def \em {\,{\rm em}} % units of em, in math formulas
+\font \chapterfont = cmbx10 at 20pt
+\font \titlefont = cmssbx10 at 17pt
+\font \authorfont = cmssbx10 at 12pt
+\font \sectionfont = cmbx10 at 12pt
+\font \tocfont = cmssbx10 at 12pt
+
+\font \tenbxit = cmbxti10 \def \bfit {\tenbxit}
+\font \tenss = cmss10
+\font \tenssbf = cmssbx10
+\font \ninerm = cmr9
+\font \sevenrm = cmr7
+\font \ninebf = cmbx9
+\font \nineit = cmti9
+\font \ninebxit = cmbxti10 at 8.5pt
+\font \ninett = cmtt9
+\font \ninei = cmmi9
+\font \seveni = cmmi7
+\font \ninesy = cmsy9
+\font \nineex = cmex9
+\hoffset = 0.5in % extra space used to print code line numbers
+\hsize = 6.0in % less 0.5 than plain.tex value
+\vsize = 8.9in % default value
+\advance \vsize by 0.5\baselineskip
+\divide \vsize by \baselineskip
+\multiply \vsize by \baselineskip
+\def \RCS {\relax} \def \RCSversion {Experimental}
+
+\newdimen\textsize \textsize=\hsize
+
+\def \pagenumber
+ {\folio}
+
+\headline =
+ {\hbox to \textsize{\strut%
+ \ifnum\pageno>1
+ \tenss\filename\hfil Version \RCSversion%
+ \hbox to 4em{\hfil\pagenumber}%
+ \else
+ \hfil\tenss\RCS%
+ \fi}\hss}
+
+\footline = {\hfil}
+\def \tocline #1#2%
+ {\line{{\ignorespaces#1}\leaders\hbox to 3pt{.\hfil}\hfil
+ \hbox to 15pt{\hss#2}}}
+
+\def \settocparms #1%
+ {\count@=#1
+ \ifnum\count@<1
+ \def\tocskip
+ {\vskip 3pt plus 1in
+ \penalty-100
+ \vskip 0pt plus -1in^^J}
+ \def\tocstyle{\tenssbf}
+ \def\tocindent{\z@}
+ \else
+ \def\tocskip{}
+ \def\tocstyle{\tenss}
+ \dimen@=20pt \advance\count@ by \m@ne \dimen@=\count@\dimen@
+ \edef\tocindent{\the\dimen@}
+ \fi}
+
+\def \topofcontents
+ {\vskip2\baselineskip
+ \leftline{\tocfont Contents}
+ \vskip2ex
+ \begingroup\rm}
+
+\def \botofcontents
+ {\endgroup
+ \semifilbreak{0.9}
+ \vskip3\baselineskip}
+
+\def \printcontents
+ {\topofcontents
+ \Input{\jobname.toc}
+ \botofcontents}
+\def \title #1#2%
+ {\vglue4\baselineskip
+ \noindent{\rightskip = 0in plus 4em
+ \hyphenpenalty = 10000 \exhyphenpenalty = 10000
+ \baselineskip = 20pt
+ \titlefont#1\par}
+ \vskip 0.5\baselineskip
+ \hrule height 2pt width \hsize
+ \vskip 0.5\baselineskip
+ \noindent
+ \line{\authorfont #2}
+ \vskip2\baselineskip}
+
+\def \startsection#1#2#3#4#5#6%
+ {\ifnum#1<2
+ \semifilbreak{0.8}
+ \fi
+ \vskip #3
+ \def\titl@{#6}
+ \edef\themodtitle{\sanitize\titl@}
+ \message{[\themodtitle]}
+ \settocparms{#1}
+ {\edef\next
+ {\noexpand\write\cont{\tocskip\string\tocline%
+ {\hskip\tocindent\tocstyle\space\sanitize\themodtitle}%
+ {\noexpand\the\pageno}}}%
+ \next}% write to toc
+ \vbox{\leftskip=#2
+ \rightskip=0.5true in plus 4em minus 0.5 true in
+ \hyphenpenalty=9999 \exhyphenpenalty=9999
+ \noindent#5#6}%
+ \nobreak
+ \vskip#4}
+
+\def \gobblemeaning#1:->{}
+\def \sanitize {\expandafter\gobblemeaning\meaning}
+
+\def \chapter#1%
+ {\vfil\eject\startsection{0}{\z@}{\z@}{6ex}{\chapterfont}{#1}}
+\def \section#1%
+ {\startsection{1}{\z@}{4ex}{2ex}{\sectionfont}{#1}}
+\def \subsection#1%
+ {\startsection{2}{\z@}{2ex}{1ex}{\tenbf}{#1}}
+\def \subsubsection#1%
+ {\startsection{3}{\z@}{1ex}{0ex}{\tenit}{#1}}
+\def \paragraph#1%
+ {\startsection{4}{\z@}{1.5ex}{0ex}{\tenit}{#1}}
+{\obeyspaces\global\let = \ } % from texbook, p.381
+
+{\catcode`\`=\active \gdef`{\relax\lq}}
+{\catcode`\^^I=\active \gdef^^I{\ \ \ }}
+
+{\obeyspaces\global\def\gobblespace#1{\ifx#1 \else#1\fi}}
+
+\def \setupmodname
+ {\catcode`\$=3 \catcode`\&=4%
+ \catcode`\#=6 \catcode`\%=14%
+ \catcode`\~=13 \catcode`\_=8%
+ \catcode`\^=7 \catcode`\ =10%
+ \catcode`\^^M=5\relax}
+
+\def \LA {\begingroup\setupmodname$\langle\,$\bfit}
+\def \RA {\/$\,\rangle$\endgroup}
+
+\gdef \ttverbatim
+ {\begingroup%
+ \makeother\\\makeother\{\makeother\}\makeother\$%
+ \makeother\&\makeother\#\makeother\%\makeother\~%
+ \makeother\_\makeother\^\makeother\"%
+ \obeyspaces\obeylines\tt}
+
+\newskip\ttglue
+\ttglue=.5em plus.25em minus.15em
+
+{\catcode`\|=\active
+ \obeylines \gdef|{\ttverbatim \spaceskip\ttglue \let^^M=\ \let|=\endgroup}}
+
+\def \CODE%
+ {\ttverbatim%
+ \let\par=\endgraf%
+ \parskip=\z@%
+ \leavevmode%
+ \ttfinish}% written by web2tex script itself
+
+%%% {\catcode`\| = 0 |catcode`|\ = 12 %
+%%% |obeylines |gdef|ttfinish#1<EDOC>{|gobblespace#1|endgroup}}
+
+\def \NO #1% line numbers which appear in the margin
+ {\noindent\llap{\ninei #1\qquad}\kern\parindent}
+
+\def \N #1#2% page number -- line number (indexes)
+ {$#2_{\oldstyle#1}$}
+
+\def \BEGINCODE
+ {\semifilbreak{0.9}
+ \bigskip
+ \begingroup
+ \obeylines}
+\def \ENDCODE
+ {\endgroup
+ \semifilbreak{0.9}}
+
+\def \BEGINDOC
+ {\bigskip
+ \begingroup
+ \catcode`\|=\active}
+\def \ENDDOC
+ {\endgroup}
+
+\newif \iffullpages
+
+\newdimen \upperbound
+
+\def \semifilbreak #1%
+ {\par
+ \upperbound = #1\vsize %% 0.1\vsize \approx 5\baselineskip
+ \ifdim\pagetotal > \pagegoal %% page already overfull;
+ %% left to page builder
+ \else
+ \ifdim\pagetotal > \upperbound
+ \vfill\eject
+ \fi
+ \fi}
+\def \gobble#1{}
+\let \wlog = \gobble
+
+\newskip\abovecolumnskip \abovecolumnskip = \bigskipamount
+\newskip\belowcolumnskip \belowcolumnskip = \bigskipamount
+\newdimen \gutter \gutter = 2pc
+\newdimen \c@lumnhsize
+\newdimen \pagegoal@limit
+\newdimen \htp@rtialpage
+\newtoks \previousoutput
+\newcount \number@fcolumns
+\newbox \@partialpage
+\newdimen \singlec@lumnhsize
+\newdimen \singlec@lumnvsize
+\newtoks \previousoutput
+\let \@ndcolumns = \relax
+\def \doublecolumns {\@columns2}
+\def \triplecolumns {\@columns3}
+\def \quadcolumns {\@columns4}
+
+\def \singlecolumn
+ {\@ndcolumns\vskip\belowcolumnskip\nointerlineskip}
+
+\let \endcolumns = \singlecolumn
+
+\def \@columns #1%
+ {\@ndcolumns%
+ \begingroup
+ \global\let\@ndcolumns=\@@endcolumns
+ \par % Shouldn't start in horizontal mode.
+ \global\previousoutput = \expandafter{\the\output}
+ \pagegoal@limit = \pagegoal
+ \advance \pagegoal@limit by -5\baselineskip
+ \ifdim\pagetotal > \pagegoal@limit
+ \vfill\eject
+ \else
+ \global\output =
+ {\global\setbox\@partialpage =
+ \vbox{\unvbox255\vskip\abovecolumnskip}}
+ \pagegoal = \pagetotal
+ \eject % now expand the \output just above.
+ \fi
+ \global\number@fcolumns=#1
+ \global\c@lumnhsize = \hsize % if \hsize changed, get the new value.
+ \global\advance\c@lumnhsize by -#1\gutter
+ \global\divide\c@lumnhsize by #1
+ \global\output = {\c@lumnoutput}
+ \global\singlec@lumnhsize = \hsize
+ \global\singlec@lumnvsize = \vsize
+ \hsize = \c@lumnhsize
+ \htp@rtialpage = \ht\@partialpage
+ \advance \htp@rtialpage by 0.5\baselineskip
+ \divide \htp@rtialpage by \baselineskip
+ \multiply \htp@rtialpage by \baselineskip
+ \ht\@partialpage = \htp@rtialpage
+ \global\advance\vsize by -\htp@rtialpage
+ \global\vsize = #1\vsize }
+\def \@columnsplit
+ {\dimen0 = \ht255
+ \advance \dimen0 by \topskip
+ \advance \dimen0 by -\baselineskip
+ \divide\dimen0 by \number@fcolumns
+ \splittopskip = \topskip
+ \begingroup
+ \vbadness = 10000
+ \loop
+ \setbox8=\copy255
+ \global\setbox1 = \vsplit8 to \dimen0
+ \global\setbox3 = \vsplit8 to \dimen0
+ \ifnum\number@fcolumns>2%
+ \global\setbox5 = \vsplit8 to \dimen0
+ \fi
+ \ifnum\number@fcolumns>3%
+ \global\setbox7 = \vsplit8 to \dimen0
+ \fi
+ \ifdim\ht8>\z@ \global\advance\dimen0 by 1pt
+ \repeat
+ \endgroup
+ \global\setbox255 = \vbox{% see the last line on p.417 (wb)
+ \unvbox\@partialpage
+ \ifnum\number@fcolumns>0%
+ \setbox1 = \vbox to \dimen0{\dimen2=\dp1 \unvbox1\kern-\dimen2\vfil}
+ \ifnum\number@fcolumns=1%
+ \hbox to \singlec@lumnhsize{\box1}
+ \fi
+ \fi
+ \ifnum\number@fcolumns>1%
+ \setbox3 = \vbox to \dimen0{\dimen2=\dp3 \unvbox3\kern-\dimen2\vfil}
+ \ifnum\number@fcolumns=1%
+ \hbox to \singlec@lumnhsize{\box1\hfil\box3}
+ \fi
+ \fi
+ \ifnum\number@fcolumns>2%
+ \setbox5 = \vbox to \dimen0{\dimen2=\dp5 \unvbox5\kern-\dimen2\vfil}
+ \ifnum\number@fcolumns=3%
+ \hbox to\singlec@lumnhsize{\box1\hfil\box3\hfil\box5}
+ \fi
+ \fi
+ \ifnum\number@fcolumns>3%
+ \setbox7 = \vbox to \dimen0{\dimen2=\dp7 \unvbox7\kern-\dimen2\vfil}
+ \ifnum\number@fcolumns=4%
+ \hbox to\singlec@lumnhsize{\box1\hfil\box3\hfil\box5\hfil\box7}
+ \fi
+ \fi}}
+
+\def \c@lumnoutput
+ {\@columnsplit
+ \hsize = \singlec@lumnhsize % local to the \output group
+ \vsize = \singlec@lumnvsize
+ \the\previousoutput
+ \global\vsize=\number@fcolumns\singlec@lumnvsize}
+
+\def \@@endcolumns
+ {\global\let\@ndcolumns=\relax%
+ \par % Shouldn't start in horizontal mode.
+ \global\output = {\global\setbox1 = \box255}%
+ \pagegoal = \pagetotal
+ \eject
+ \global\setbox255 = \box1
+ \@columnsplit
+ \global\vsize = \singlec@lumnvsize
+ \global\output = \expandafter{\the\previousoutput}%
+ \endgroup
+ \unvbox255}
+\def \newwrite
+ {\alloc@7\write\chardef\sixt@@n} % remove \outer
+
+\def \@nameuse#1%
+ {\csname #1\endcsname}
+
+\def \arabic#1{\@arabic{\@nameuse{c@#1}}}
+\def \roman#1{\@roman{\@nameuse{c@#1}}}
+\def \Roman#1{\@Roman{\@nameuse{c@#1}}}
+\def \alph#1{\@alph{\@nameuse{c@#1}}}
+\def \Alph#1{\@Alph{\@nameuse{c@#1}}}
+
+\def \@arabic#1{\ifnum #1>0 \number #1\fi}
+\def \@roman#1{\romannumeral #1}
+\def \@Roman#1{\expandafter\uppercase\expandafter{\romannumeral #1}}
+\def \@alph#1{\ifcase#1\or a\or b\or c\or d\else\@ialph{#1}\fi}
+\def \@ialph#1%
+ {\ifcase#1\or \or \or \or \or e\or f\or g\or h\or i\or j\or k\or l\or
+ m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or
+ z\else\@ctrerr\fi}
+\def \@Alph#1{\ifcase#1\or A\or B\or C\or D\else\@Ialph{#1}\fi}
+\def \@Ialph#1%
+ {\ifcase#1\or \or \or \or \or E\or F\or G\or H\or I\or J\or K\or L\or
+ M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or
+ Z\else\@ctrerr\fi}
+
+\def \pagenumbering#1%
+ {\global\pageno \@ne \gdef\thepage{\csname @#1\endcsname\pageno}}
+
+\pagenumbering {arabic}
+\newdimen \@savsk
+\newcount \@savsf
+
+\def \@bsphack
+ {\@savsk\lastskip\ifhmode\@savsf\spacefactor\fi}
+
+\def \@esphack
+ {\relax%
+ \ifhmode\spacefactor\@savsf
+ {}\ifdim \@savsk >\z@ \ignorespaces\fi
+ \fi}
+
+\def \makeother #1{\catcode`#1=12\relax}
+
+\def \@sanitize
+ {\makeother\ \makeother\\\makeother\$%
+ \makeother\&\makeother\#\makeother\^%
+ \makeother\_\makeother\%\makeother\~\relax}
+\def \makeindex
+ {\newwrite\@indexfile
+ \immediate\openout \@indexfile = \jobname.idx
+ \def\index {\@bsphack\begingroup\@sanitize\@wrindex\@indexfile}
+ \message{^^J--> Writing index file \jobname.idx }}
+\def \@wrindex#1#2%
+ {\let \thepage = \relax%
+ \xdef\gtempa
+ {\write#1{\string\E{#2}{\thepage}}}%
+ \endgroup\gtempa\@esphack}
+\def \index
+ {\@bsphack\begingroup\@sanitize\@index}
+\def \@index#1%
+ {\endgroup\@esphack}
+
+\def \makeglossary
+ {\newwrite\@glossaryfile
+ \immediate\openout\@glossaryfile=\jobname.glo
+ \def\glossary{\@bsphack\begingroup\@sanitize\@wrindex\@glossaryfile}
+ \message{Writing glossary file \jobname.glo }\fi}
+\def \glossary {\@bsphack\begingroup\@sanitize\index}
+
+\def \@idxitem {\par\hangindent 20pt }
+\def \subitem {\par\hangindent 20pt \hskip 20pt }
+\def \subsubitem {\par\hangindent 20pt \hskip 30pt }
+
+\def \seeterm{see}
+\def \see#1#2%
+ {{\it \seeterm\/} #1}
+
+\def \Input#1%
+ {\openin1 #1
+ \ifeof1
+ \message{^^J--- I cannot find file #1 }
+ \else
+ \closein1
+ \input #1
+ \message{^^J<-- Reading file #1 }
+ \fi}
+
+\def \indexspace
+ {\relax}
+
+\def \printuserleveldefs
+ {\singlecolumn
+ \vfill\eject
+ \Input{\jobname.und}}
+\def \printdefs
+ {\singlecolumn
+ \vfill\eject
+ \Input{\jobname.dnd}}
+\def \printchunks
+ {\singlecolumn
+ \vfill\eject
+ \let \pagenumber = \relax
+ \Input{\jobname.chn}}
+
+\def \beginuserleveldefs
+ {\begingroup
+ \textfont0 = \ninerm \scriptfont0 = \sevenrm%
+ \textfont1 = \ninei \scriptfont1 = \seveni%
+ \textfont2 = \sevensy%
+ \textfont3 = \nineex%
+ \def \rm {\fam0\ninerm} \rm%
+ \def \it {\nineit}%
+ \def \bfit {\ninebxit}%
+ \def \bf {\ninebf}%
+ \def \tt {\ninett}%
+ \def \oldstyle {\fam\@ne\ninei}%
+ \chardef\\ = "5C%
+ \parindent = \z@ \parskip = \z@%
+ \hfuzz = \hsize % index pages are wider
+ \baselineskip = 11pt \topskip = \baselineskip%
+\advance \vsize by 0.5\baselineskip
+\divide \vsize by \baselineskip
+\multiply \vsize by \baselineskip
+ \section{User-level definitions}
+ \let\item\@idxitem
+ \triplecolumns \tt}
+\def \begindefs
+ {\begingroup
+ \textfont0 = \ninerm \scriptfont0 = \sevenrm%
+ \textfont1 = \ninei \scriptfont1 = \seveni%
+ \textfont2 = \sevensy%
+ \textfont3 = \nineex%
+ \def \rm {\fam0\ninerm} \rm%
+ \def \it {\nineit}%
+ \def \bfit {\ninebxit}%
+ \def \bf {\ninebf}%
+ \def \tt {\ninett}%
+ \def \oldstyle {\fam\@ne\ninei}%
+ \chardef\\ = "5C%
+ \parindent = \z@ \parskip = \z@%
+ \hfuzz = \hsize % index pages are wider
+ \baselineskip = 11pt \topskip = \baselineskip%
+\advance \vsize by 0.5\baselineskip
+\divide \vsize by \baselineskip
+\multiply \vsize by \baselineskip
+ \section{Definitions}
+ \let\item\@idxitem
+ \triplecolumns \tt}
+\def \beginchunks
+ {\begingroup
+ \textfont0 = \ninerm \scriptfont0 = \sevenrm%
+ \textfont1 = \ninei \scriptfont1 = \seveni%
+ \textfont2 = \sevensy%
+ \textfont3 = \nineex%
+ \def \rm {\fam0\ninerm} \rm%
+ \def \it {\nineit}%
+ \def \bfit {\ninebxit}%
+ \def \bf {\ninebf}%
+ \def \tt {\ninett}%
+ \def \oldstyle {\fam\@ne\ninei}%
+ \chardef\\ = "5C%
+ \parindent = \z@ \parskip = \z@%
+ \hfuzz = \hsize % index pages are wider
+ \baselineskip = 11pt \topskip = \baselineskip%
+\advance \vsize by 0.5\baselineskip
+\divide \vsize by \baselineskip
+\multiply \vsize by \baselineskip
+ \parskip = 2\p@ plus 2\p@
+ \let\item\@idxitem
+ \section{Chunks}
+ \bf}
+
+\def \endindex
+ {\endgroup}
+
+\def \makeindexes
+ {\par
+ \newwrite\@userleveldefsfile
+ \immediate\openout\@userleveldefsfile=\jobname.udx
+ \def\udx{\@bsphack\begingroup\@sanitize\@wrindex\@userleveldefsfile}
+ \message{^^J--> Writing index file \jobname.udx }
+ \newwrite\@defsfile
+ \immediate\openout\@defsfile=\jobname.ddx
+ \def\ddx{\@bsphack\begingroup\@sanitize\@wrindex\@defsfile}
+ \message{^^J--> Writing index file \jobname.ddx }
+ \newwrite\@chunkfile
+ \immediate\openout\@chunkfile=\jobname.chk
+ \def\chk{\@bsphack\begingroup\@sanitize\@wrindex\@chunkfile}
+ \message{^^J--> Writing index file \jobname.chk }}
+\newcount\miscount % number of unknown references
+\newif\ifshowmisses
+
+\def \ref #1#2%
+ {\xdef\temp{#1}
+ \expandafter\dordef\csname#2\endcsname}
+\def \dordef #1%
+ {\global\let#1\temp}
+
+\Input{\jobname.ref}
+\newwrite\refo \immediate\openout\refo=\jobname.ref
+
+\def \pageref #1%
+ {\write\refo{\string\ref{\number\pageno}{#1}}}
+\def \refpage #1%
+ {\expandafter\usedef\csname#1\endcsname}
+
+\def \usedef #1%
+ {\ifx#1\relax%
+ \ifshowmisses\showmiss #1 \fi%
+ \global\advance\miscount by 1 ???%
+ \else%
+ #1%
+ \fi}
+
+\def \showmiss #1%
+ {{\escapechar=-1%
+ \message{^^J*** WARNING: Undefined reference > #1<}}}
+
+\outer \def \bye
+ {\write \cont {\string\restorecat\string\@}
+ \closeout\cont
+ \ifnum\miscount>0
+ \message{^^J!!! \the\miscount\space %
+ undefined reference(s) were present }%
+ \fi
+ \par\vfill\supereject
+ \end}
+\raggedbottom
+\frenchspacing
+\fullpagesfalse
+\newwrite \cont
+\openout \cont = \jobname.toc
+\write \cont {\string\savecat\string\@}
+\write \cont {\string\catcode`\string\@=11}
+
+\restorecat\@
diff --git a/web/tweb/vc.mnu b/web/tweb/vc.mnu new file mode 100644 index 0000000000..7ce18fd227 --- /dev/null +++ b/web/tweb/vc.mnu @@ -0,0 +1,24 @@ +F1: Tangle
+ exe\markup !.! | exe\nt > !.sty
+F2: Weave
+ exe\markup !.! | exe\gawk-emx -f bin\web2tex > !.tex
+F3: TeXing
+ tex386 &plain !.tex
+ makeindx -s idxsty\dnd.ist -o !.dnd !.ddx
+ makeindx -s idxsty\und.ist -o !.und !.udx
+ makeindx -s idxsty\chn.ist -o !.chn !.chk
+ tex386 &plain !.tex
+F4: Clean
+ del *.log
+ del *.dvi
+ del *.toc
+ del *.ref
+ del *.ddx
+ del *.udx
+ del *.chk
+ del *.dnd
+ del *.und
+ del *.chn
+ del *.ilg
+
+
|