\hyphenchar\tentt=-1 % inhibit hyphenation in typewriter type
\hyphenchar\ninett=-1
\hyphenchar\eighttt=-1
\font\ninesl=cmsl9
\font\eightsl=cmsl8
\font\nineit=cmti9
\font\eightit=cmti8
\font\tenu=cmu10 % unslanted text italic
\font\magnifiedfiverm=cmr5 at 10pt
\font\manual=manfnt % font used for the METAFONT logo, etc.
\font\cmman=cmman % font used for miscellaneous Computer Modern variations
\def\tenmath{\tenpoint\fam-1 } % use after $ in ninepoint sections
\def\tenbig#1{{\hbox{$\left#1\vbox to8.5pt{}\right.\n@space$}}}
\def\ninebig#1{{\hbox{$\textfont0=\tenrm\textfont2=\tensy
\left#1\vbox to7.25pt{}\right.\n@space$}}}
\def\eightbig#1{{\hbox{$\textfont0=\ninerm\textfont2=\ninesy
\left#1\vbox to6.5pt{}\right.\n@space$}}}
% Page layout
\newdimen\pagewidth \newdimen\pageheight \newdimen\ruleht
\hsize=29pc \vsize=44pc \maxdepth=2.2pt \parindent=3pc
\pagewidth=\hsize \pageheight=\vsize \ruleht=.5pt
\abovedisplayskip=6pt plus 3pt minus 1pt
\belowdisplayskip=6pt plus 3pt minus 1pt
\abovedisplayshortskip=0pt plus 3pt
\belowdisplayshortskip=4pt plus 3pt
%\newinsert\footins
\def\footnote#1{\edef\@sf{\spacefactor\the\spacefactor}#1\@sf
\insert\footins\bgroup\eightpoint
\interlinepenalty100 \let\par=\endgraf
\leftskip=\z@skip \rightskip=\z@skip
\splittopskip=10pt plus 1pt minus 1pt \floatingpenalty=20000
\smallskip\item{#1}\bgroup\strut\aftergroup\@foot\let\next}
\skip\footins=12pt plus 2pt minus 4pt % space added when footnote is present
%\count\footins=1000 % footnote magnification factor (1 to 1)
\dimen\footins=30pc % maximum footnotes per page
\newinsert\margin
\dimen\margin=\maxdimen
%\count\margin=0 \skip\margin=0pt % marginal inserts take up no space
\newif\iftitle
\def\titlepage{\global\titletrue} % for pages without headlines
\def\rhead{} % \rhead contains the running headline
\def\leftheadline{\hbox to \pagewidth{\spaceskip=0pt
\vbox to 10pt{}% strut to position the baseline
\llap{\tenbf\folio\kern1pc}% folio to left of text
\tenit\rhead\hfil% running head flush left
}}
\def\rightheadline{\hbox to \pagewidth{\spaceskip=0pt
\vbox to 10pt{}% strut to position the baseline
\hfil\tenit\rhead\/% running head flush right
\rlap{\kern1pc\tenbf\folio}% folio to right of text
}}
\def\onepageout#1{\shipout\vbox{ % here we define one page of output
\offinterlineskip % butt the boxes together
\vbox to 3pc{ % this part goes on top of the 44pc pages
\iftitle % the next is used for title pages
\global\titlefalse % reset the titlepage switch
\setcornerrules % for camera alignment
\else\ifodd\pageno \rightheadline\else\leftheadline\fi\fi
\vfill} % this completes the \vbox to 3pc
\vbox to \pageheight{
\ifvoid\margin\else % marginal info is present
\rlap{\kern31pc\vbox to\z@{\kern4pt\box\margin \vss}}\fi
#1 % now insert the main information
\ifvoid\footins\else % footnote info is present
\vskip\skip\footins \kern-3pt
\hrule height\ruleht width\pagewidth \kern-\ruleht \kern3pt
\unvbox\footins\fi
\boxmaxdepth=\maxdepth
} % this completes the \vbox to \pageheight
}
\advancepageno}
% To produce only a subset of pages, put the page numbers on separate
% lines in a file called pages.tex
\let\Shipout=\shipout
\newread\pages \newcount\nextpage \openin\pages=pages
\def\getnextpage{\ifeof\pages\else
{\endlinechar=-1\read\pages to\next
\ifx\next\empty % in this case we should have eof now
\else\global\nextpage=\next\fi}\fi}
\ifeof\pages\else\message{OK, I'll ship only the requested pages!}
\getnextpage\fi
\def\shipout{\ifeof\pages\let\next=\Shipout
\else\ifnum\pageno=\nextpage\getnextpage\let\next=\Shipout
\else\let\next=\Tosspage\fi\fi \next}
\newbox\garbage \def\Tosspage{\deadcycles=0\setbox\garbage=}
% Chapter formatting
% The preface and table of contents are formatted in place, not here
\newcount\exno % for the number of exercises in the current chapter
\newcount\subsecno % for the number of subsections in the current chapter
\def\beginchapter#1 #2#3. #4\par{\global\exno=0
\subsecno=0
\def\chapno{#2#3}
\ifodd\pageno
\errmessage{You had too much text on that last page; I'm backing up}
\advance\pageno by-1 \fi
\titlepage
\def\\{ } % \\'s in the title will be treated as spaces
\message{#1 #2#3:} % show the chapter title on the terminal
\def\MF{{\manual 89:;<=>:}} % slant the logo
\xdef\rhead{#1 #2#3: #4\unskip}
{\def\TeX{T\kern-.2em\lower.5ex\hbox{E}\kern-.06em X}
\def\MF{{\vbox to30pt{}\manual ()*+,-.*}}
\def\\{#3} \advance\hsize by -18mm
\ifx\empty\\ \rightline{\inchhigh #2\kern-.04em}
\else\rightline{\inchhigh #2\kern-.06em#3\kern-.04em}\fi
\vskip 1.75pc
\baselineskip 36pt \lineskiplimit \titlelsl \lineskip 12pt
\let\\=\cr % now the \\'s are line dividers
\halign{\line{\titlefont\hss##}\\#4\unskip\\}
\vfill\eject} % output the chapter title page
\tenpoint
\noindent\ignorespaces} % the first paragraph of a chapter is not indented
\newdimen\titlelsl \titlelsl=1pt
\outer\def\endchapter{\ifodd\pageno \else\vfill\eject\null\fi
\begingroup\bigskip\vfill % beginning of the quotes
\def\eject{\endgroup\eject}
\def\par{\ifhmode\/\endgraf\fi}\obeylines
\def\TeX{T\kern-.2em\lower.5ex\hbox{E}\kern-.000em X}
\def\MF{{\manual opqr}\-{\manual stuq}}
\eightpoint \let\tt=\ninett
\baselineskip 10pt
\parfillskip \z@
\interlinepenalty 10000
\leftskip \z@ plus 40pc minus \parindent
\let\rm=\eightss \let\sl=\eightssi
\everypar{\sl}}
\def\author#1(#2){\smallskip\noindent\rm--- #1\unskip\enspace(#2)}
\def\pt{\,{\rm pt}} % units of points, in math formulas
\def\em{\,{\rm em}} % units of ems, in math formulas
\def\<#1>{\leavevmode\hbox{$\langle$#1\/$\rangle$}} % syntactic quantity
\def\oct#1{\hbox{\rm\'{}\kern-.2em\it#1\/\kern.05em}} % octal constant
\def\hex#1{\hbox{\rm\H{}\tt#1}} % hexadecimal constant
\def\cstok#1{\leavevmode\thinspace\hbox{\vrule\vtop{\vbox{\hrule\kern1pt
\hbox{\vphantom{\tt/}\thinspace{\tt#1}\thinspace}}
\kern1pt\hrule}\vrule}\thinspace} % control sequence token
% macros for 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$$}
% (the following \begin...\end-type macros do not appear in Appendix E)
% macros for demonstrating math constructions
\outer\def\beginmathdemo{$$\advance\baselineskip by2pt
\halign\bgroup\indent\hbox to 160pt{##\hfil}&$##$\hfil\cr\noalign{\vskip-2pt}}
\outer\def\begindisplaymathdemo {$$\advance\baselineskip by15pt
\halign\bgroup\indent\hbox to 160pt{##\hfil}&$\displaystyle{##}$\hfil\cr
\noalign{\vskip-15pt}}
\outer\def\beginlongmathdemo{$$\advance\baselineskip by2pt
\halign\bgroup\indent\hbox to 210pt{##\hfil}&$##$\hfil\cr\noalign{\vskip-2pt}}
\outer\def\beginlongdisplaymathdemo {$$\advance\baselineskip by15pt
\halign\bgroup\indent\hbox to 210pt{##\hfil}&$\displaystyle{##}$\hfil\cr
\noalign{\vskip-15pt}}
\outer\def\endmathdemo{\egroup$$}
\outer\def\begintt{$$\let\par=\endgraf \ttverbatim \parskip=\z@
\catcode`\|=0 \rightskip-5pc \ttfinish}
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
|obeylines % end of line is active
|gdef|ttfinish#1^^M#2\endtt{#1|vbox{#2}|endgroup$$}}
% f |\ and f ^|\ => insert \/ [e.g., if\/ |\hbox|...]
% appendi => check for \null [e.g., Appendix~B\null.]
% ly- => the hyphen is probably omittable
% ''. and '', => transpose to .'' and ,''
% dgement => dgment
% in MFbook: f@' and \MF, and \MF.
% Macros for drawing figures (not in Appendix E)
\def\hidehrule#1#2{\kern-#1\hrule height#1 depth#2 \kern-#2 }
\def\hidevrule#1#2{\kern-#1{\dimen0=#1
\advance\dimen0 by#2\vrule width\dimen0}\kern-#2 }
% \makeblankbox puts rules at the edges of a blank box
% whose dimensions are those of \box0 (assuming nonnegative wd,ht,dp)
% #1 is rule thickness outside, #2 is rule thickness inside
\def\makeblankbox#1#2{\hbox{\lower\dp0\vbox{\hidehrule{#1}{#2}%
\kern-#1% overlap the rules at the corners
\hbox to\wd0{\hidevrule{#1}{#2}%
\raise\ht0\vbox to #1{}% set the vrule height
\lower\dp0\vtop to #1{}% set the vrule depth
\hfil\hidevrule{#2}{#1}}%
\kern-#1\hidehrule{#2}{#1}}}}
\def\maketypebox{\makeblankbox{0pt}{1pt}}
\def\makelightbox{\makeblankbox{.2pt}{.2pt}}
% \box\bigdot is a null box with a bullet at its reference point
\newbox\bigdot \newbox\smalldot
\setbox0=\hbox{$\vcenter{}$} % \ht0 is the axis height
\setbox1=\hbox to\z@{$\hss\bullet\hss$} % bullet is centered on the axis
\setbox\bigdot=\vbox to\z@{\kern-\ht1 \kern\ht0 \box1 \vss}
\setbox1=\hbox to\z@{$\hss\cdot\hss$} % cdot is centered on the axis
\setbox\smalldot=\vbox to\z@{\kern-\ht1 \kern\ht0 \box1 \vss}
% \arrows makes things like <--- text --->
\def\arrows#1#2{% #1=width, #2=text
{\setbox0=\hbox{$\mkern-2mu\mathord-\mkern-2mu$}
\hbox to #1{\kern-.055556em$\leftarrow\mkern-6mu$%
\cleaders\copy0\hfil
\kern.4em #2\kern.4em
\cleaders\copy0\hfil
$\mkern-6mu\rightarrow$\kern-.055556em}}}
% \samplebox makes the outline of a box, with big dot at reference point
\def\samplebox#1#2#3#4{% #1=ht, #2=dp, #3=wd, #4=text
{\setbox0=\vtop{\vbox to #1{\hbox to #3{}\vss}
\nointerlineskip
\vbox to #2{}}% now \box0 has the desired ht, dp, and wd
\hbox{\copy\bigdot
\vrule height.2pt depth.2pt width#3%
\kern-#3%
\makelightbox
\kern-#3%
\raise#1\vbox{\hbox to #3{\hss#4\hss}
\kern 3pt}}}}
% \sampleglue makes glue between sample boxes
\newdimen\varunit
\varunit=\hsize \advance\varunit by-2\parindent
\divide\varunit by 58 % illustrations in Chapter 12
\def\sampleglue#1#2{% #1=width, #2=text
\vtop{\hbox to #1{\xleaders\hbox to .5\varunit{\hss\copy\smalldot\hss}\hfil}
\kern3pt
\tabskip \z@ plus 1fil
\halign to #1{\hfil##\cr#2\cr}}}
% Indexing macros
\newif\ifproofmode
\proofmodetrue % this should be false when making camera-ready copy
\newwrite\inx
\immediate\openout\inx=index % file for index reminders
\newif\ifsilent
\def\specialhat{\ifmmode\def\next{^}\else\let\next=\beginxref\fi\next}
\def\beginxref{\futurelet\next\beginxrefswitch}
\def\beginxrefswitch{\ifx\next\specialhat\let\next=\silentxref
\else\silentfalse\let\next=\xref\fi \next}
\catcode`\^=\active \let ^=\specialhat
\def\silentxref^{\silenttrue\xref}
\chardef\bslash=`\\
\def\xref{\futurelet\next\xrefswitch}
\def\xrefswitch{\begingroup
\ifx\next|\aftergroup\vxref % case 1 or 2, |arg| or |\arg|
\else\ifx\next\<\aftergroup\anglexref % case 3, "\<arg>" means angle brackets
\else\aftergroup\normalxref \fi\fi\endgroup} % case 0, "{arg}"
\def\vxref|{\catcode`\\=\active \futurelet\next\vxrefswitch}
\def\vxrefswitch#1|{\catcode`\\=0
\ifx\next\empty\def\xreftype{2}%
\def\next{{\tt\bslash\text}}% type 2, |\arg|
\else\def\xreftype{1}\def\next{{\tt\text}}\fi % type 1, |arg|
\edef\text{#1}\makexref}
{\catcode`\|=0 \catcode`\\=\active |gdef\{}}
\def\anglexref\<#1>{\def\xreftype{3}\def\text{#1}%
\def\next{\<\text>}\makexref}
\def\normalxref#1{\def\xreftype{0}\def\text{#1}\let\next=\text\makexref}
\def\makexref{\ifproofmode\insert\margin{\hbox{\marginstyle\text}}%
\xdef\writeit{\write\inx{\text\space!\xreftype\space
\noexpand\number\pageno.}}\writeit
\else\ifhmode\kern\z@\fi\fi
\ifsilent\ignorespaces\else\next\fi}
% the \insert (which is done in proofmode only) suppresses hyphenation,
% so the \kern\z@ is put in to give the same effect in non-proofmode.
% Internal cross references that may change
\def\sesame{61} % page number for Sesame Street quote
\def\bmiexno{20} % exercise number for bold math italic
\def\punishexno{1} % exercise number for `punishment'
\def\fracexno{6} % exercise number for `\frac'
\def\vshippage{31} % error message from `\vship'
\def\storypage{24} % listing of story.tex
\def\metaT{4} % exercise number for T of METAFONT
\def\xwhat{2} % exercise number for x3:=whatever
\def\Xwhat{2} % exercise number for whatever itself
\def\checkequals#1#2{\ifnum#1=#2\else
\errmessage{Redefine \string#1 to be \the#2}\fi}
% Things for The METAFONTbook only
\ifx\MFmanual\!\else\endinput\fi
\outer\def\displayfig #1 (#2){$$\advance\abovedisplayskip by 3pt
\leftline{\indent\figbox{#1}{3in}{#2}\vbox}$$}
\def\rightfig #1 (#2 x #3) ^#4 {% #2 wide and #3 deep, raised #4
\strut\vadjust{\setbox0=\vbox to 0pt{\vss
\hbox to\pagewidth{\hfil
\raise #4\figbox{#1}{#2}{#3}\vtop \quad}}
\dp0=0pt \box0}}
\def\figbox#1#2#3#4{#4to#3{ % makes a box #2 wide and #3 deep
\ifproofmode\kern0pt\hrule\vfill
\hsize=#2 \baselineskip 6pt \fiverm\noindent\raggedright
(Figure #1 will be inserted here; too bad you can't see it now.)
\endgraf\vfill\hrule
\else\vfill\hbox to#2{}\fi}}
\chardef\hexa=1 % first hex
\chardef\hexb=2 % top and bot adjusted
\chardef\hexc=3 % same, bold
\chardef\hexd=4 % same, confined to box
\chardef\hexe=5 % penstroked hex
\chardef\Aa=6 % stick-figure A, golden ratio
\def\sevenAs{\char7\char8\char9\char10\char11\char12\char13} % same, variants
\chardef\Az=14 % same, with crooked bar
\chardef\Ab=15 % \Aa with rectilinear elliptical pen
\chardef\Ac=16 % same, with the ellipse tilted
\chardef\beana=17 % kidney bean, default pen
\chardef\beanb=18 % same, twice as bold
\chardef\beanc=19 % same, rectilinear elliptical pen
\chardef\beand=20 % same, with the ellipse tilted
\chardef\niba=21 % 10x rectilinear ellipse
\chardef\nibb=22 % same, with the ellipse tilted
\chardef\nibc=23 % same, 90 degrees titled
\chardef\IOT=24 % Ionian T
\chardef\IOS=25 % Ionian S
\chardef\IOO=26 % Ionian O
\chardef\IOI=27 % Ionian I
\chardef\cubea=28 % possible cube
\chardef\cubeb=29 % impossible cube
\chardef\bicentennial=30 % star with overlapping strokes
\chardef\oneu=31 % 1/4 of uuuu ornament
\chardef\circa=32 % quartercircle
\chardef\circb=33 % filled quartercircle
\chardef\circc=34 % rotated quartercircle
\chardef\circd=35 % cone
\chardef\circe=36 % concentric circles
\chardef\circf=37 % concentric diamonds
\chardef\fouru=38 % uuuu ornament
\chardef\fourc=39 % same, rotated
\chardef\seventh='140 % 1/7, to go with cmssqi8
\newdimen\apspix
\apspix=31448sp % 8 APS pixels = 52413.64sp, and I'm taking 60% of this
% to crude approximation, there are about 2\apspix per pt
\newdimen\blankpix \newdimen\Blankpix
\setbox0=\hbox{\manual P} \blankpix=\wd0 % approximately 1pt blank pixel
\setbox0=\hbox{\manual R} \Blankpix=\wd0 % approximately 3pt blank pixel
\def\leftheadline{\hbox to \pagewidth{%
\vbox to 10pt{}% strut to position the baseline
\llap{\tenbf\folio\kern1pc}% folio to left of text
\def\MF{{\manual 89:;<=>:}}% slanted 10pt
\tenit\rhead\hfil% running head flush left
}}
\def\rightheadline{\hbox to \pagewidth{%
\vbox to 10pt{}% strut to position the baseline
\def\MF{{\manual 89:;<=>:}}% slanted 10pt
\hfil\tenit\rhead\/% running head flush right
\rlap{\kern1pc\tenbf\folio}% folio to right of text
}}
\def\ttok#1{\leavevmode\thinspace\hbox{\vrule\vtop{\vbox{\hrule\kern1pt
\hbox{\vphantom{\tt(j}\thinspace{\tt#1}\thinspace}}
\kern1pt\hrule}\vrule}\thinspace} % token