\tracingpages=1 % TEMPORARY!
% Macros for `Concrete Mathematics'
\ifx\gkpmac\fmtversion\endinput\else\let\gkpmac=\fmtversion\fi
% Fonts for regular text
\font\textrm=ccr10 % roman
\font\textit=ccti10 % italic (emphasis)
\font\textsl=ccsl10 % slanted (titles)
\font\textbf=cmbx10 % bold
\font\textcsc=cccsc10 % caps and small caps
\font\oldsty=ccmi10 % equation numbers
\font\twelvett=cmtt12
% Fonts for regular math
% I'm setting \fontdimen2 to zero because AMS forgot to do it;
% they may have fixed the problem in the meantime, but no harm is done
\font\chapfont=cmbxcd10 scaled 8000
\font\title=cmbx10 scaled \magstep5
\font\subtitle=cmbx10 scaled 1315 % that's magstep 1.5
\font\subsubtitle=cmbxsl10
\font\runhead=cmbx9
\font\foliofont=cmr9
\font\gtfont=cmmi9 % for the \t accent
\font\ninesl=ccsl9 % used in the index only
% Normal text conventions
\catcode`@=11 % borrow the private macros of PLAIN (with care)
\def\wlog#1{} % don't put allocation info into the log
\textfont\euexfam=\matheuex
\scriptfont\euexfam=\mathsubsym % this is OK since I don't use all characters
% of euex in subscripts/superscripts; otherwise I'd have to make euex7 and euex6
\scriptscriptfont\euexfam=\mathsubsym % only for \mathchoice, not really chosen
\mathcode`+="292B
\mathcode`-="292D
\mathcode`!="0921
\mathcode`(="4928 \delcode`(="928300
\mathcode`)="5929 \delcode`)="929301
\mathcode`[="495B \delcode`[="95B302
\mathcode`]="595D \delcode`]="95D303
\mathcode`=="393D
\mathchardef\Relbar="3B3D % we need the old = to match \Arrows
\mathchardef\Gamma="7100
\mathchardef\Delta="7101
\mathchardef\Theta="7102
\mathchardef\Lambda="7103
\mathchardef\Xi="7104
\mathchardef\Pi="7105
\mathchardef\Sigma="7106
\mathchardef\Upsilon="7107
\mathchardef\Phi="7108
\mathchardef\Psi="7109
\mathchardef\Omega="710A
\let\varsigma=\sigma \let\varrho=\rho % Euler doesn't have these
\mathchardef\aleph="0840
\def\rbrace{\delimiter"5867A09 } \let\}=\rbrace
\def\lbrace{\delimiter"4866A08 } \let\{=\lbrace
%\mathchardef\equiv="3811 \let\cong=\equiv % lowres bars weren't spaced right
\mathchardef\leq="3814 \let\le=\leq
\mathchardef\geq="3815 \let\ge=\geq
\mathchardef\Re="083C
\mathchardef\Im="083D
\def\vert{\delimiter"86A30C }
\def\backslash{\delimiter"86E30F }
\newmuskip\normalthick \normalthick=5mu plus 5mu
\newmuskip\normalmedmu \normalmedmu=\medmuskip
\newmuskip\displaythick \displaythick=10mu minus 3mu
\everymath{\thickmuskip=\normalthick}
\abovedisplayskip=8pt plus 3pt minus 2pt % there's 2pt more (opened up)
\belowdisplayskip=10pt plus 3pt minus 2pt
% displays not centered; all have capability of \eqalign
\outer\def\begindisplay{\obeylines\startdisplay}
{\obeylines\gdef\startdisplay#1
{\catcode`\^^M=5$$%
\advance\displayindent\parindent\advance\displaywidth-\parindent%
\openup2pt #1\halign\bgroup\span\preamble\cr}}
\outer\def\enddisplay{\crcr\egroup$$}
\jot=\z@ % we do our own opening up
\def\displaymath{$\thickmuskip=\displaythick\displaystyle}
\def\preamble{\hfil\displaymath{##}$&&\displaymath{{}##}$\hfil}
\def\tablepreamble{\bigstrut\hfil$##$\hfil\ &\vrule##&&\quad\hfil$##$\hfil}
\def\xbox{\qquad\hbox} % for third column of explanation
\newcount\eqcount
\def\equ(#1.#2){{\rm({\oldsty#1}.{\oldsty#2})}}
\def\eq(#1){\equ(\chapno.#1)}
\def\thiseq{\xdef\next{(\chapno.\number\eqcount)}\expandafter\equ\next}
\def\eqno{\global\advance\eqcount 1 \global\everycr{\makeeqno\thiseq}}
\newdimen\backup
\def\makeeqno#1{\noalign{\global\everycr{}%
\advance\displaywidth\displayindent
\setbox0=\hbox to\displaywidth{\hfil#1}%
\backup=\prevdepth \advance\backup\ht0
\setbox0=\vbox{\kern-\backup\box0}\ht0=\z@ \dp0=\z@
\setbox0=\vbox{\box0}\unvbox0}} % that puts equation number on prev line!
\newif\iftitle
\newskip\chaptopspace \chaptopspace=1in minus 5pt
\def\beginchapter#1 #2 \par{ % we should be at top of a page
\titletrue \eqcount=0
\ifodd\pageno
\rightline{\chapfont#1\kern-.05em}
\vskip\chaptopspace
\rightline{\title#2}
\moveleft7pc % this applies to the \vbox after the \fi
\else % left-hand page
\leftline{\kern-.05em\chapfont#1}
\vskip\chaptopspace
\leftline{\title#2} \fi
\vbox{\hrule width 35pc}
\def\chapno{#1} \edef\chaptitle{#2}
\mark{#1\enspace #2}
\smallskip\noindent}
\def\beginsection#1 #2 \par{ % should not be first in the chapter
\backup=\lastskip % but should come on first or second page of chapter
\mark{#1\enspace #2} % because the mark gives running head on right page
\nobreak\vskip-\backup\penalty-200
{\subtitle\baselineskip=34pt
\noindent\hbox to2\parindent{#1\hfil}\uppercase{\kern-.05em#2}\par}
\nobreak\vskip5pt\noindent\hbox to2\parindent{}}
\def\dash---{\thinspace---\hskip.16667em\relax}
\def\qback{\kern-.15em} % between , or . and ''
\def\undertext#1{$\underline{\smash{\hbox{#1}}}$}
\def\newline{\hfil\break}
\def\Hint:{{\it Hint:\/}}
\let\macron=\= % we will use \= for congruence relation
\def\t#1{{\edef\next{\the\font}\tfont\accent"7F\next#1}}
% Here's a definition that was corrected in plain.tex version 3.14159;
% I'm keeping the old version here, because I had already been compensating
% for its deficiencies in script and scriptscript styles; without this
% buggy version, it would be hard for me to match the old pages precisely
\def\bmod{\mskip-\medmuskip\mkern5mu
\mathbin{\rm mod}\penalty900\mkern5mu\mskip-\medmuskip}
% Graffiti macros
\chardef\other=12
\newread\grfi \openin\grfi=\jobname.grf
%\newwrite\grfo \immediate\openout\grfo=\jobname.grf % let's hope no conflict
%% Hmmm...; that doesn't work on Unix.
%% Here's my first solution, a kludge where I alternated between .grf and .gr
%\newif\ifgrf \newwrite\grfo \newwrite\grfempty
%\ifeof\grfi \grffalse
%\else\read\grfi to\grfitest \ifeof\grfi \grffalse \else \grftrue \fi\fi
%\ifgrf\else \openin\grfi=\jobname.gr
% \ifeof\grfi\else\read\grfi to\grfitest \fi\fi
%\immediate\openout\grfo=\jobname.gr\ifgrf\else f\fi
%\immediate\write\grfo{} % an empty line will start a nonempty file (Unix only)
%% and then at the end I said
% \immediate\openout\grfempty=\jobname.gr\ifgrf f\fi % clear the input file
%% That solution worked with the following original macros
%\def\testnextgrf{{\def\do##1{\catcode`##1=\other}\dospecials
% \global\read\grfi to\next}\expandafter\testgrf\meaning\next\testgrf}
%\expandafter\def\expandafter\testgrf\meaning\empty#1 #2\testgrf{%
% \setup#2!!!!!$\ifx\thisone\thatone\if#1R\Rtrue\else\Rfalse\fi\else\Rguess\fi}
%% Anyway, here's my second approach to Unix: (order n^2 algorithm)
\def\\{{\def\do##1{\catcode`##1=\other}\dospecials \endlinechar=-1 \let\eol=0
\gdef\grfmem{}
\expandafter\def\expandafter\gbbl\meaning\empty{}
\def\appgrf{\read\grfi to\g
\ifx\g\empty\else\xdef\grfmem{\grfmem\expandafter\gbbl\meaning\g\eol}\fi}
\def\next{\ifeof\grfi\let\next\relax\else\appgrf\fi\next}\next}}
\\ % now \grfmem is "L aaaaa\eol R bbbbb\eol ... R zzzzz\eol".
\def\testnextgrf#1 #2\eol#3\\{\gdef\grfmem{#3}\setup#2!!!!!$%
\ifx\thisone\thatone\if#1R\Rtrue\else\Rfalse\fi\else\Rguess\fi}
\newwrite\grfo \immediate\openout\grfo=\jobname.grf % no conflict now
\def\graffiti{% set up graffiti style
\hsize=6pc
\baselineskip=10pt \lineskip=0pt \lineskiplimit=0pt
\parindent=0pt
\mathsurround=1pt
\textfont0=\gmathtext
\scriptfont0=\gmathsubtext
\scriptscriptfont0=\gmathsubsubtext
\textfont1=\gmathlet \let\tfont=\gtfont
\scriptfont1=\gmathsublet
\scriptscriptfont1=\gmathsubsublet
\textfont2=\gmathsym
\scriptfont2=\gmathsubsym
\scriptscriptfont2=\gmathsubsubsym
\textfont3=\gmathext
\scriptfont3=\gmathsubext
\scriptscriptfont3=\gmathsubsubext
\textfont\scrfam=\gmathscr
\scriptfont\scrfam=\gmathsubscr
\scriptscriptfont\scrfam=\gmathsubsubscr
\textfont\frfam=\gmathfr
\scriptfont\frfam=\gmathsubfr
\scriptscriptfont\frfam=\gmathsubsubfr
\textfont\euexfam=\gmatheuex
\scriptfont\euexfam=\gmathsubsym % OK since I don't use all chars in this size
\textfont\eqfam=\nineeq
\def\rm{\fam\z@\gtext}%
\let\oldsty=\goldstyle
\let\big=\ninebig
\setbox\strutbox=\hbox{\vrule height7.25pt depth2.75pt width\z@}%
\gtext
\rightskip=\z@ plus2em % ragged right
\tolerance=2000
\hyphenpenalty=300
\exhyphenpenalty=300
\doublehyphendemerits=100000
\finalhyphendemerits=\doublehyphendemerits
}
\def\ninebig#1{{\hbox{$\textfont0=\tenrm\textfont2=\tensy
\left#1\vbox to7.25pt{}\right.\n@space$}}}
\def\grafctr{\hbox to4.5pc{\hfil##\hfil}}
\newif\ifR % does this entry go on a right-hand page?
\def\Rguess{\def\ifR{\ifodd\pageno}}
\long\def\g#1\g{\def\next{#1!!!!!}\expandafter\writegrf\meaning\next$%
\ifx\grfmem\empty\Rguess\else\expandafter\testnextgrf\grfmem\\\fi
% pre-Unix, that line was \ifeof\grfi\Rguess\else\testnextgrf\fi
\setbox0=\vtop{\graffiti#1%
\write\m@ne\ifR{\Rcheck}\else{\Lcheck}\fi}% log file records successes
\ifvmode\kern-\prevdepth\kern-\ht0\dp0=\z@\nointerlineskip\bgroup
\else\dp0=\dp\strutbox\strut\vadjust{\kern-\dp\strutbox\kern-\ht0\fi
\ifR\moveleft7\else\moveright29\fi pc\box0}}
\expandafter\def\expandafter\writegrf\meaning\empty#1#2#3#4#5#6${%
\write\grfo{\LorR #1#2#3#4#5}\def\thisone{#1#2#3#4#5}}
\def\setup#1#2#3#4#5#6${\def\thatone{#1#2#3#4#5}}
\def\LorR{\ifodd\pageno R \else L \fi}
\def\Lcheck{\ifodd\pageno Bad guess!\fi}
\def\Rcheck{\ifodd\pageno\else Bad guess!\fi}
% Page layout
\newif\ifpreprint \preprinttrue % should be false when making the final copy
\newdimen\pageheight \pageheight=\vsize
\newdimen\totheight \totheight=49.5pc
\newdimen\folioht \setbox0=\hbox{\foliofont0} \folioht=\ht0
\def\leftheadline{\hbox to35pc{\vbox to 10pt{}% strut to position the baseline
\llap{\kern-2pc\iftitle\leftcorner\else\foliofont\folio\fi\hfil}%
\iftitle\hfil\copyrite\else\runhead\uppercase\expandafter{\chaptitle}\hfil\fi}}
\def\rightheadline{\hbox to35pc{\iftitle\copyrite\fi\hfil
\vbox to 10pt{}% strut to position the baseline
\iftitle\else\runhead\uppercase\expandafter{\topmark}\fi
\rlap{\hfil\iftitle\rightcorner\else\foliofont\folio\fi\kern-2pc}}}
\def\leftcorner{\iffinal\else\vrule\vbox to\folioht{\hrule width9pt\vfil}\fi}
\def\rightcorner{\iffinal\else\vbox to\folioht{\hrule width9pt\vfil}\vrule\fi}
\def\copyrite{\ifpreprint{\textfont2=\sevensy\sevenrm\copyright\ 1988
Addison-Wesley Publishing Company; all rights reserved}\fi}
\newif\iffinal % are we making the final copy? (pages.tex says "999")
\def\onepageout#1{\escapechar=-1 % for writing \tabrefs
\shipout % here we define one page of output
\iffinal % add the trim marks
\hbox to\htrimsize{\copy\trimmarks
\ifodd\pageno\hss\else \hskip\outermargin\fi
\vbox to\vtrimsize{\kern\topmargin\fi
\vbox to\totheight{
\offinterlineskip % butt the boxes together
\vskip2.5pt % adjustment at the top (10 Jan 2011)
\vbox to 2pc{ % this part goes on top of the regular pages
\ifodd\pageno \rightheadline\else\leftheadline\fi
\vfill} % this completes the \vbox to 2pc
\ifodd\pageno\moveright7pc\fi #1
\vfill
\iftitle \global\titlefalse % reset the titlepage switch
\ifodd\pageno \hbox to35pc{\hfil\foliofont\folio}
\else\hbox{\foliofont\folio}\fi\fi
\ifpreprint\ifinxmode\makeinxfooter\fi\fi
\iffinal % finish the trimmed page
}\vfill}\ifodd\pageno\hskip\outermargin\else\hss\fi
\rlap{\smash{\lower30pt\hbox to.35in{\hss\twelvett\number\pageno}}}\fi
}
\advancepageno}
\output{\onepageout{\pagebody}}
\newbox\inxfootbanner
\def\hours{\count0=\time \divide\count0 by60 % find the o'clock
\multiply\count0 by40 \advance\count0\time % convert to hhmm
\advance\count0 10000 \expandafter\gobbleone\number\count0\relax}
\def\gobbleone1{}
\setbox\inxfootbanner=\rlap{\hbox to 6.5in{\hrulefill\sevenrm\quad
Author's page proof produced by \TeX\ at
\hours\space on \ifcase\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space\number\day}}
\def\makeinxfooter{\vbox to0pt{\kern10pt\copy\inxfootbanner\kern4pt
\rlap{\vbadness=\maxdimen \inxcolumns}\vss}}
\def\inxcolumns{\ifvoid\inxbox\let\next\relax\else\let\next\contribcol\fi\next}
\def\contribcol{\setbox0=\vsplit\inxbox to54pt
\vtop{\unvbox0}\kern20pt \inxcolumns}
\def\inxstyle{\vrule height6pt depth2pt width\z@ \sevenrm}
\splittopskip=6pt
% Cross references
% \ref{value}|name| gives value to |name|
% \eqref|name| gives \eqcount to |name|
% \exref|name| gives \excount to |name|
% \tabref|name| gives appropriate page number to |name|
% \refin foo inputs references from job foo (other than this job)
% \showmissestrue if you want to see missing references
\catcode`\|=\active
\expandafter\def\expandafter\dospecials\expandafter{\dospecials\do\|}
\newcount\defcount % number of old definitions not yet repeated
\newcount\changecount % number of new definitions that are changed
\newcount\miscount % number of unknown references
\outer\def\bye{
\ifnum\miscount>0
\message{(\the\miscount\space undefined references were present)}\fi
\ifnum\changecount>0
\message{(\the\changecount\space new references written on \jobname.ref)}\fi
\ifnum\defcount>0
\message{(\the\defcount\space old references dropped from \jobname.ref)}\fi
\par\vfill\supereject
\end}
\def\vector(#1,#2)#3{\@line(#1,#2){#3}%
\ifnum\@xarg=0 \@vvector \else\ifnum\@yarg=0 \@hvector \else\@svector\fi\fi}
\def\@hvector{\ifneg\rlap{\linefont\char27}\else
\smash{\llap{\linefont\char45}}\fi} % we have to smash because of font bug
\def\@vvector{\ifnum\@yarg<0 \raise-\@len\rlap{\linefont\char63}%
\else\setbox\@picbox=\rlap{\linefont\char54}\advance\@len-\ht\@picbox
\raise\@len\box\@picbox\fi}
% Squines (quadratic splines)
% example of use: to plot f(x) between x0 and x1, you can say
% \put(0,0){\squine(x0,xm,x1,y0,ym,y1)}, where y0=f(x0), y1=f(x1)
% xm=(y0-y1+s1x1-s0x0)/(s1-s0), ym=(s0(s1x1-y1)-s1(s0x0-y0))/(s1-s0),
% s0=f'(x0), and s1=f'(x1).
\newbox\Sqbox % for sum of squares
\setbox\Sqbox=\vbox{\tenrm\hrule height.6pt\kern-.6pt
\hbox to1.5ex{\vrule height1.5ex width.6pt\hss\vrule width.6pt}\kern-.6pt
\hrule height.3pt depth.3pt}
\def\Sq{\mskip1.5mu\copy\Sqbox\mskip1.5mu}
% primitive index macros
% "stuff for index" will go into a file for sorting and into normal text
% "!stuff for index" will go into the file only
\expandafter\def\expandafter\dospecials\expandafter{\dospecials\do\"}
\def\hexcode{"} \catcode`\"=\active
\preprintfalse % WE ARE MAKING THE REAL BOOK!
\inxmodetrue % WE ARE PREPARING A ROUGH INDEX
\showmissestrue % THE REFERENCES SHOULD ALL BE READY NOW
\ifinxmode\immediate\openout\inx=\jobname.inx \fi % file for index reminders
\ifinxmode\immediate\openout\bnx=\jobname.bnx \fi % file for bib reminders
% To make the book:
% First TeX BIB, to get BIB.REF correct. (Must have \cite entries.)
% Then TeX CHAP1..CHAP9, PREF, ANS, CRED, FRONT, CONT.
% Then make BNX file from individual *.BNX files including BIB.BNX.
% Then reTeX BIB.
% *.INX files are raw data only. Index and Contents are prepared by hand.
% To produce only a subset of pages, put the page numbers on separate
% lines in a file called pages.tex, ended by 999
% WARNING: This will screw up the .grf file! Save it, then restore it.
% WARNING: This may screw up the .ref file (if there are \tabrefs). Ditto.
\let\Shipout=\shipout
\newread\pages \newcount\nxtpg \openin\pages=pages
\def\getnxtpg{\ifeof\pages\else
{\endlinechar=-1\read\pages to\next
\ifx\next\empty % in this case we should have eof now
\else\global\nxtpg=\next\fi}\fi}
\ifeof\pages\finalfalse\else\finaltrue
\getnxtpg
\ifnum\nxtpg=999
\message{OK, I'm making final copy with trim marks!}
\hoffset=-.5in
\getnxtpg % this should ensure eof on the \pages file
\else\message{OK, I'll ship only the requested pages!}
\hoffset=-.5in\fi\fi
\def\shipout{\ifeof\pages\let\next=\Shipout
\else\ifnum\pageno=\nxtpg\getnxtpg\let\next=\Shipout
\else\let\next=\Tosspage\fi\fi \next}
\newbox\garbage \def\Tosspage{\deadcycles=0\setbox\garbage=}