%			*****	  DEPROC.TeX	*****		5 Nov 85, bb
%
%		*****	WARNING -- UNDER CONSTRUCTION	*****
%		*****	  Beta test -- version 0.9	*****
%
%  This file contains the TeX82 instructions for preparing a document
%  in the proper format for the DECUS Proceedings.  It is based on
%  TUGBOT.STY and on AMSPPT.STY (AMS-TeX82).  It is compatible with,
%  but does not require (or load) AMS-TeX.  It assumes that
%  PLAIN.TEX is preloaded.


\catcode`\@=11		% used, as in PLAIN, in protected control sequences


%  PLAIN items with different values or reiterated for clarity

\def~{\penalty\@M \ } % tie -- this is PLAIN value; it is reset in AMS-TeX

\clubpenalty=10000
\widowpenalty=10000

\normallineskiplimit=1pt


%  Some useful things from AMS-TeX

\def \BlackBoxes{\overfullrule=5pt }
\def \NoBlackBoxes{\overfullrule=0pt }

\def \linebreak{\unskip\break}
\def \newline{\hskip0pt plus\colwd \break}

\output{\output@}
%  This notation is used in case AMS-TeX is ever loaded by this file;
%  otherwise, the output routine defined below will not be used, and
%  there may be other unexpected and unwanted effects.


%  Some TeX primitives must be saved to permit the use of LaTeX-type syntax.

\let\@@par=\par
\let\@@input=\input
\let\@@end=\end

\def\bye{\newpage\@@end}


%  Other changes to PLAIN macros to accommodate LaTeX-type syntax.

\def\item[#1]{\par\hang\textindent{#1}}
\def\itemitem[#1]{\par\indent \hangindent2\parindent \textindent{#1}}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%		*****     utility registers and definitions	*****	      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%  Column identifier (values 1 or 2)
\countdef\xcol=1	\xcol=1


%  Test registers for transient use; paired - internal/external
\newbox\T@stBox 		\newbox\TestBox
\newcount\T@stCount		\newcount\TestCount
\newdimen\T@stDimen		\newdimen\TestDimen


%  Smashes as defined in AMS-TeX; PLAIN implements only full \smash .
\newif\iftop@		\newif\ifbot@
\def\topsmash{\top@true\bot@false\smash@}
\def\botsmash{\top@false\bot@true\smash@}
\def\smash{\top@true\bot@true\smash@}
\def\smash@{\relax\ifmmode\def\next{\mathpalette\mathsm@sh}%
	\else\let\next\makesm@sh\fi \next }
\def\finsm@sh{\iftop@\ht\z@\z@\fi\ifbot@\dp\z@\z@\fi\box\z@}


%  Vertical `laps'; cf. \llap and \rlap
\long\def\ulap#1{\vbox to \z@{\vss#1}}
\long\def\dlap#1{\vbox to \z@{#1\vss}}

%  Horizontal and vertical `laps' that take up no space on either side
\def\hlap#1{\llap{#1\hss}}
\long\def\vlap#1{\ulap{#1\vss}}

%  Vertical spacer (\vskip disappears at top of page)
\def\vspace#1{\par\vbox to#1{\vfil}}

%  Avoid unwanted vertical glue when making up pages.
\def\basezero{\baselineskip\z@ \lineskip\z@}


%  \cs existence test, from TeXbook exercises 7.7 and 7.10, and inspiration
%  from AMS-TeX to protect the user from himself.
\def\gobble#1{}
\def\ifundefined#1{%
	\expandafter\ifx\csname\expandafter\gobble\string#1\endcsname\relax }
\def\define#1{\ifundefined#1\else\errmessage{\string#1 already defined}\fi
		\def#1}


%  Redefine some math symbols for use as item labels.
\let\@bullet=\bullet
\let\@circ=\circ
\def\labelt@st#1{\ifmmode #1\else $#1$\fi}
\def\bullet{\labelt@st\@bullet}
\def\circ{\labelt@st\@circ}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%			***** fonts and friends	*****			      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%  Fonts preloaded but not named in PLAIN .
%  All fonts named in PLAIN are assumed to be available.
%
%  Check this list against the current font library, and change
%  font names from am* to cm* if appropriate.  (cm* fonts are
%  the new Computer Modern, generated by the WEB Metafont, and
%  scheduled to be released about the end of 1985.)

\font\ninerm=amr9
\font\eightrm=amr8
\font\sixrm=amr6

\font\ninei=ammi9 \skewchar\ninei='177
\font\eighti=ammi8 \skewchar\eighti='177
\font\sixi=ammi6 \skewchar\sixi='177

\font\ninesy=amsy9 \skewchar\ninesy='60
\font\eightsy=amsy8 \skewchar\eightsy='60
\font\sixsy=amsy6 \skewchar\sixsy='60

\font\ninebf=ambx9
\font\eightbf=ambx8
\font\sixbf=ambx6

\font\ninesl=amsl9
\font\eightsl=amsl8

\font\nineit=amti9
\font\eightit=amti8
\font\sevenit=amti7

\font\ninett=amtt9
\font\eighttt=amtt8

\font\tenupit=amu10 

\font\tenssrm=amss10
\font\eightssrm=amssq8

\font\tenssit=amssi10
\font\eightssit=amssqi8

\def \mit{\fam\@ne}
\def \cal{\fam\tw@}


%  Fonts added at AMS.

\font\tensmc=amcsc10
%\font\eightsmc=amcsc8			% when available
\let\eightsmc=\tensmc			% temporary expedient


%  For compatibility with LaTeX.

\def\em{\it}


%  Fonts for special purposes.


%  METAFONT logo; use manfnt if available, otherwise sans serif.
\font\tenssbf=amssbx10
% \font\logo=manfnt
\let\logo=\tenssbf


%  Title at top of article; this should be extended to permit math
%  symbols in titles, along the lines of \tenpoint (below).
\font\Tenbf=ambx10 scaled \magstep1
\def \titlefont{\Tenbf\baselineskip=14pt}


%  Font used for page numbers must be small enough to be obscured
%  when the actual page number is pasted over it.
\let\foliofont=\sixrm


%  Possible additions and changes:
%
%  Dynamic loading of fonts, probably in groups according to size
%  Removal of \rm, \bf, etc., from \*point expansions, replacement
%     by generic \rm, \bf, etc. definitions
%  Mechanism for switching neatly between serif and sans-serif


%  Font collections for text
%
%  Two text sizes:
%    \tenpoint for ordinary text
%    \eightpoint for footnotes and references
%
%  Allow text to be a bit stretchier than the built-in setting, to avoid
%  overfull boxes in the relatively narrow columns.  (See the TeXbook,
%  pages 433, 355).  Normal text fonts are \rm and \it, and only these
%  are modified.  If \bf (an "extended" font) is also used for text,
%  appropriate stretch values are:  normal 10pt, 1.9167pt; extra,
%  3 x normal; proportional for other sizes.  Invoke by setting
%  \fontdimen3\tenbf=... (and similarly for other sizes) below.

\newdimen\normaltenptstretch	\normaltenptstretch=1.6667pt
\newdimen\extratenptstretch	\extratenptstretch=5pt
\def\NormalTenPointSpacing{\fontdimen3\tenrm=\normaltenptstretch
		\fontdimen3\tenit=\normaltenptstretch}
\def\StretchyTenPointSpacing{\fontdimen3\tenrm=\extratenptstretch
		\fontdimen3\tenit=\extratenptstretch}

\def \AddToTenPoint{}		% permit external additions to font

\def \tenpoint{\normalbaselineskip=12pt 	% \def\pointsize@AmS{t}
	\abovedisplayskip=3pt plus 3pt minus 1pt
	\belowdisplayskip=3pt plus 3pt minus 1pt
	\abovedisplayshortskip=0pt plus 3pt
	\belowdisplayshortskip=1pt plus 3pt minus 1pt
	\def\rm{\fam\z@\tenrm}%
	\textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm
	\def\oldstyle{\fam\@ne\teni}%
	\textfont1=\teni \scriptfont1=\seveni \scriptscriptfont1=\fivei
	\textfont2=\tensy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy
	\textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
	\def\it{\fam\itfam\tenit}%
	\textfont\itfam=\tenit
	\def\sl{\fam\slfam\tensl}%
	\textfont\slfam=\tensl
	\def\bf{\fam\bffam\tenbf}%
	\textfont\bffam=\tenbf \scriptfont\bffam=\eightbf
		\scriptscriptfont\bffam=\sixbf
	\def\smc{\tensmc}%
	\def\tt{\tentt}%
	\def\upright{\tenupit}%
	\setbox\strutbox=\hbox{\vrule height8.5pt depth3.5pt width\z@}%
	\normalbaselines \AddToTenPoint \rm }


%  Provide a <dimen> for users in terms of number of lines of ordinary
%  10pt text.

\newdimen\lines
{\tenpoint \global\lines=\normalbaselineskip }


\newdimen\normaleightptstretch	\normaleightptstretch=1.333pt
\newdimen\extraeightptstretch	\extraeightptstretch=4pt
\def\NormalEightPointSpacing{\fontdimen3\eightrm=\normaleightptstretch
		\fontdimen3\eightit=\normaleightptstretch}
\def\StretchyEightPointSpacing{\fontdimen3\eightrm=\extraeightptstretch
		\fontdimen3\eightit=\extraeightptstretch}

\def \AddToEightPoint{}

\def \eightpoint{\normalbaselineskip=10pt
	\abovedisplayskip=2pt plus 2pt minus 1pt
	\belowdisplayskip=2pt plus 2pt minus 1pt
	\abovedisplayshortskip=0pt plus 2pt
	\belowdisplayshortskip=1pt plus 2pt minus 1pt
	\def\rm{\fam\z@\eightrm}%
	\textfont0=\eightrm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm
	\def\oldstyle{\fam\@ne\eighti}%
	\textfont1=\eighti \scriptfont1=\sixi \scriptscriptfont1=\fivei
	\textfont2=\eightsy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy
	\def\it{\fam\itfam\eightit}%
	\textfont\itfam=\eightit
	\def\sl{\fam\slfam\eightsl}%
	\textfont\slfam=\eightsl
	\def\bf{\fam\bffam\eightbf}%
	\textfont\bffam=\eightbf \scriptfont\bffam=\sixbf
		\scriptscriptfont\bffam=\sixbf
	\def\smc{\eightsmc}%
	\def\tt{\eighttt}%
	\setbox\strutbox=\hbox{\vrule height 7pt depth 3pt width\z@}%
	\normalbaselines \AddToEightPoint \rm }



%  PLAIN's definition of \raggedright doesn't expand enough at the ends
%  of narrow columns, and results in too many overfull boxes.  For
%  extreme cases, \raggedstretch may be increased (see \title below).
\newdimen\raggedskip		\raggedskip=\z@
\newdimen\raggedstretch 	{\tenrm \global\raggedstretch=5em }
\newskip\raggedparfill		\raggedparfill=\z@ plus 1fil

\def \raggedspaces{\spaceskip=.3333em \xspaceskip=.5em }
%  Some applications may have to add stretch, in order to avoid
%  all overfull boxes.

\def \raggedright{\rightskip=\raggedskip plus\raggedstretch \raggedspaces
		\parfillskip=\raggedparfill }
\def \raggedleft{\leftskip=\raggedskip plus\raggedstretch \raggedspaces 
		\parfillskip=\z@ }
\def \raggedcenter{\leftskip=\raggedskip plus\raggedstretch
		\rightskip=\leftskip \raggedspaces 
		\parindent=\z@ \parfillskip=\z@ }

\def \normalspaces{\spaceskip=.3333em plus.1667em minus.1111em
		\xspaceskip=.4444em plus.5em minus.037em }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%			*****  page dimensions	*****			      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\newdimen\trimlgt	\trimlgt=11in
\newdimen\headmargin	\headmargin=3pc
\newdimen\pagelgt
\newdimen\rheadlgt	\rheadlgt=0pt		% no running heads
\newdimen\toplgt	\toplgt=0pt
\newdimen\normalcollgt	\normalcollgt=58pc
\newdimen\collgt	\collgt=\normalcollgt
\newdimen\Collgt
\maxdepth=2.5pt
\newdimen\botlgt	\botlgt=0pt
\newdimen\rfootlgt	\rfootlgt=3pc	\advance\rfootlgt by-\maxdepth

\newif\ifThisIsFirstPage	\ThisIsFirstPagefalse

\def \resetpagelgt{\pagelgt=\collgt \Collgt=\collgt
	\advance\pagelgt by \rheadlgt
	\ifThisIsFirstPage \advance\Collgt by-\toplgt
			\advance\Collgt by-\botlgt \fi
	\advance\pagelgt by \maxdepth
	\global\advance\pagelgt by \rfootlgt
	\global\vsize=\Collgt }

\resetpagelgt
\raggedbottom

\newdimen\colwd
\newdimen\pagewd	\pagewd=44pc
\newdimen\trimwd	\trimwd=\pagewd

\def \onecol{\colwd=\pagewd		\OneCol }

\newdimen\onenarrowcolwd	\onenarrowcolwd=5in
\def \onenarrow{\colwd=\onenarrowcolwd	\OneCol }

\newdimen\onemediumcolwd	\onemediumcolwd=6in
\def \onemedium{\colwd=\onemediumcolwd	\OneCol }

\newdimen\normalcolwd	\normalcolwd=3.5in
\def \twocol{\colwd=\normalcolwd 	\TwoCol }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%			*****	page headers/footers	*****		      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%  These items are handled as insertions at the output level; cf. footnotes
%  and figures which are insertions at the \pagecontents level.


\def \runfoot{\vbox to \rfootlgt{\hsize=\pagewd \parindent=\z@ \vfil
	\ifnum\xcol=2 \leavevmode \centerline{\strut\foliofont\folio}\fi }}

\def \firsthead{}
\newbox\firsth@@d	\newbox\firsth@ad
\long\def \setfirsthead #1{\global\ThisIsFirstPagetrue
	\ifdim \toplgt=\z@
		\global\setbox\firsth@ad=\vbox{\hsize=\pagewd #1}%
%			assume that \firsth@ad ends with glue, hence no \dp
		\global\toplgt=\ht\firsth@ad \resetpagelgt
	\else \global\setbox\firsth@ad=\vbox to \toplgt{\hsize=\pagewd #1}%
	\fi
	\global\setbox\firsth@@d=\vbox to \toplgt{\vfil}%
	\gdef\firsthead{\ifnum \xcol=2 \box\firsth@ad
			\else \copy\firsth@@d \fi }}

\def \firstfoot{}
\newbox\firstf@@t	\newbox\firstf@ot
\long\def \setfirstfoot #1{\global\ThisIsFirstPagetrue
	\ifdim \botlgt=\z@
		\global\setbox\firstf@ot=\vbox{\hsize=\pagewd #1}%
		\botlgt=\ht\firstf@ot
		\global\advance\botlgt by \dp\firstf@ot \resetpagelgt
	\else \global\setbox\firstf@ot=\vbox to \botlgt{\hsize=\pagewd #1}%
	\fi
	\global\setbox\firstf@@t=\vbox to \botlgt{\vfil}%
	\gdef\firstfoot{\ifnum \xcol=2 \copy\firstf@ot
			\else \copy\firstf@@t \fi }}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%		*****	    more page insertions 	*****		      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%  Footnotes
%
%  Footnotes are based on those in PLAIN, with inspiration from LaTeX.
%
%  Try to prevent "unconnected" footnotes at the beginning of an article
%  (before the first paragraph) from suppressing the \noindent by making
%  footnotes in general not reset the FirstPar switch.


\skip\footins=12pt		% full blank line	% 24pt	
\def\footnoterule{\kern-8pt
        \hrule width 5pc \kern 7.6pt } % the \hrule is .4pt high

\def\footnotemarkssup{\def\footm@rk##1{$^{##1}$}}
\def\footnotemarkstext{\def\footm@rk##1{##1}}
\footnotemarkssup

\def\footnotemark[#1]{\footm@rk{#1}}
\def\footnotetext[#1]{\IgnoreEverypartrue \vfootnote{\footm@rk{#1}}}
\def\footnote[#1]{\let\@sf\empty % parameter #2 (the text) is read later
  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  \footm@rk{#1}\@sf\vfootnote{\footm@rk{#1}}}
\def\vfootnote#1{\insert\footins\bgroup \eightpoint
  \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
  \parindent=\normalparindent
  \item[#1]\bgroup\footstrut\aftergroup\@foot\let\next}
\def\@foot{\strut\egroup}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%		*****	output-device-specific features   *****		      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%  Distinguish between laser printer and phototypesetter output.
%
%  Laser printer output is properly aligned on 8.5x11" paper, assuming
%  the "starting point" to be 1 inch from the left edge of the paper and
%  1 inch from the top edge; phototypesetter output is assumed to be set
%  on continuous media, and registration ("trim") marks are  provided.
%
%  Laser printer output is the default.

\newif\ifLaser	\Lasertrue

%  Proceedings format starts closer to the edges of the printed page than
%  1 inch; calculate the amount of adjustment necessary.

\newdimen\top@djust	\newdimen\left@djust
\def \Adjustxy{%
	\ifLaser \top@djust=1in \global\advance\top@djust by-\headmargin
		\left@djust=8.5in \advance\left@djust by-\pagewd
		\divide\left@djust by-2 \global\advance\left@djust by 1in
	\else \global\left@djust=0pt
	\fi }
\Adjustxy


%  Registration marks: ``T'' marks centered on top and bottom edges of paper

\def \HorzR@gisterRule{\vrule height 0.2pt depth 0pt width 0.5in }
\def \DownShortR@gisterRule{\vrule height 0.2pt depth .5pc width 0.2pt }
\def \UpShortR@gisterRule{\vrule height .5pc depth 0pt width 0.2pt }

\def \topregister{\dlap{%
	\hbox to \trimwd{\HorzR@gisterRule \hfil \HorzR@gisterRule
			 \HorzR@gisterRule \hfil \HorzR@gisterRule}%
	\hbox to \trimwd{\hfil \DownShortR@gisterRule \hfil}}}
\def \botregister{\ulap{%
	\hbox to \trimwd{\hfil \UpShortR@gisterRule \hfil}%
	\hbox to \trimwd{\HorzR@gisterRule \hfil \HorzR@gisterRule
			 \HorzR@gisterRule \hfil \HorzR@gisterRule}}}


%  "Undocumented" hack to make smaller pages in larger print, to be used
%  as a script for the speech at DECUS.

\def\SpeechFormat{\OneCol
	\magnification=\magstep1
	\headmargin=9pc
	\Adjustxy
	\normalcollgt=40pc
	\collgt=\normalcollgt
	\resetpagelgt }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%			*****	    output	*****			      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%  In the absence of automatic column-balancing, provide a mechanism
%  for manually shortening a specified page.

\newif\ifSh@rtPage		\Sh@rtPagefalse
\newif\ifSh@rtPagePending	\Sh@rtPagePendingfalse
\newcount\Sh@rtPageNo
\newdimen\Sh@rtPageLgt

\def\@to{to}			\def\@by{by}
%  #1 = to/by; #2 = \dimen; #3 = <dimen>; #4 = * of Shorten*Page
\def\@toby#1#2#3#4{\def\1{#1}%
	\ifx \1\@to \global #2=#3
	\else \ifx \1\@by \T@stDimen=#3 	% accommodate negative #3
			#2=\normalcollgt \global\advance #2 by -#3
		\else \errmessage{#1 is invalid syntax; \string\Shorten#4Page
				requires "to" or "by"}\fi
	\fi }

\def\@plusno#1#2;{\if +#1\T@stCount=\pageno \advance\T@stCount by #2
			\else \T@stCount=#1#2 \fi }

\def \ShortenPage #1 #2 #3. {\global\Sh@rtPagePendingtrue
%		\global\Sh@rtPageNo=#1
		\@plusno#1;\global\Sh@rtPageNo=\T@stCount
		\@toby{#2}{\Sh@rtPageLgt}{#3}{}}
\def \ShortenThisPage #1 #2. {\global\Sh@rtPagetrue
		\@toby{#1}{\vsize}{#2}{This}}

%  Provide mechanism to leave blank pages for figures.

\newcount\Bl@nkPageCount	\Bl@nkPageCount=0
\newbox\Res@rvedForFigures
\def \reservefigurepages[#1]#2{\global\advance\Bl@nkPageCount by #1
	\global\setbox\Res@rvedForFigures=\hbox{#2}}

\newif\ifN@EndPage		\N@EndPagefalse
\def \DeferSh@rtPageMsg{\errmessage{Short page deferred until after figures}}
\def\Bl@nkPage{\loop \ifnum\Bl@nkPageCount>0
		\global\advance\Bl@nkPageCount by-1
		\N@EndPagetrue \xcol=2
		\shipout\blankfr@me{\centerline{Page reserved for figures}%
				\centerline{\copy\Res@rvedForFigures}}%
		\global\advancepageno \repeat
	\ifnum\T@stCount=0
	\else \T@stCount=2
		\ifSh@rtPage \DeferSh@rtPageMsg \fi
		\ifSh@rtPagePending
		    \ifnum\pageno > \Sh@rtPageNo \global\Sh@rtPageNo=\pageno
				\DeferSh@rtPageMsg \fi
		\fi
	\fi }

%  Three cases to check for resetting page size or number:
%    0 = last page was nonstandard; reset \vsize
%    1 = do not reset \vsize: okay or length already reset
%    2 = pages skipped, check pending pages for possible errors

\def \D@EndPage{\global\advancepageno
	\T@stCount=1
	\ifThisIsFirstPage \T@stCount=0 \global\ThisIsFirstPagefalse
			\global\toplgt=\z@ \global\botlgt=\z@
			\global\collgt=\normalcollgt \fi
	\Bl@nkPage
	\ifSh@rtPage \T@stCount=0 \global\Sh@rtPagefalse \fi
	\ifSh@rtPagePending
		\ifnum\pageno = \Sh@rtPageNo \T@stCount=1
			\global\vsize=\Sh@rtPageLgt
			\global\Sh@rtPagePendingfalse
			\global\Sh@rtPagetrue \fi
	\fi
	\ifcase \T@stCount \resetpagelgt \fi }



%  All pages containing data are formatted by \pagefr@me .

\def \pagefr@me#1{\vbox{\basezero
	\ifLaser \hrule height\z@ depth\z@ width\p@
		\vskip-\top@djust
	\else \vbox to \trimlgt \bgroup
		\topregister
		\vskip \headmargin
	\fi
	\moveleft\left@djust\vbox to \pagelgt{\basezero
		\ifThisIsFirstPage \firsthead \fi
		\hbox to \pagewd{#1}%		% \vsize applied in \pagebody
		\ifThisIsFirstPage \firstfoot \fi
		\vfil		% if no depth, avoid underfull box
		\runfoot }%
	\ifLaser \else \vfill \botregister \egroup \fi }%
	\ifnum\xcol=2 \global\xcol=1
		\ifN@EndPage \else \D@EndPage \fi
	\else \global\xcol=2 \fi }


%  "Reserved" (blank) pages.

\def \blankfr@me#1{\pagefr@me
		{\vbox to \vsize{\hsize=\pagewd
			\baselineskip=3pc \null\vfil#1\vfil}}}


%  Reorganize \pagecontents from PLAIN to put footnotes at very
%  bottom of page, even if \raggedbottom.

\def\pagecontents{\ifvoid\topins\else\unvbox\topins\fi
  \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255
  \ifr@ggedbottom \kern-\dimen@ \vfil \fi
  \ifvoid\footins\else % footnote info is present
    \vskip\skip\footins
    \footnoterule
    \unvbox\footins\fi }


\def \newcol{\par\vfill\eject}

\newif\ifOneColFormat
\newbox\SaveP@geBox

\def \OneCol{\hsize=\colwd
	\gdef\newpage{\par\vfill\eject}%
	\OneColFormattrue
	\gdef\output@{\xcol=2 \shipout\pagefr@me{\hfil\pagebody \hfil}}}

\def \TwoCol{\hsize=\colwd
	\gdef\newpage{\par\vfill\eject
			\ifnum\xcol=2 \null\vfill\eject \fi }%
	\OneColFormatfalse
	\gdef\output@{%
		\ifnum\xcol=1 \global\xcol=2
			\global\setbox\SaveP@geBox=\vbox{\pagebody}%
		\else \shipout\pagefr@me{\box\SaveP@geBox \hfil \pagebody }%
		\fi
		\ifnum\outputpenalty>-\@MM \else \dosupereject \fi }}



%  Set up one-column format for pages of figures produced separately.

\def\figurepages{\ifD@cument \errmessage{\string\figurepages invalid
			within \string\document environment}%
	\else \onenarrow
	\fi }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%		*****	 section headings; text shape	*****		      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\newif\ifNoParIndent		\NoParIndentfalse
\def\NoParIndent{\parindent=\z@ \NoParIndenttrue}

\newdimen\normalparindent	\normalparindent=20pt		% plain = 20pt
\def\NormalParIndent{\global\parindent=\normalparindent
	\global\NoParIndentfalse}
\NormalParIndent


%  "First-paragraph" formatting
%
%  Make the first paragraph after a title start flush left, then reset
%  \parindent; but if all paragraphs should start flush left, or the
%  present instance of \everypar is not really a paragraph, don't reset.

\newif\ifFirstPar		\FirstParfalse
\newif\ifIgnoreEverypar 	\IgnoreEveryparfalse

\everypar{\ifNoParIndent \ifFirstPar \FirstParfalse \fi
	\else \ifIgnoreEverypar \global\IgnoreEveryparfalse
		\else \ifFirstPar \NormalParIndent \FirstParfalse \fi
		\fi
	\fi }


%  Chapter and section headings are based on \beginsection in PLAIN
%  and similar structures in TUGboat.
%
%    \section        bold, centered
%    \Section        bold, numbers flush left, text indented to normal
%                    \parindent; numbers must be input
%    \subsection     bold, flush left
%    \subsubsection  italic, flush left

\def\s@ction#1{\def\par{\endgraf\egroup\nobreak \vskip 6pt
			\parindent=\z@ \FirstPartrue \def\par{\@@par}}%
	\ifFirstPar \nobreak
	\else \vskip\z@ plus 4\baselineskip \penalty-50		% -250 in PLAIN
		\vskip\z@ plus-4\baselineskip \vskip 18pt \vskip\parskip \fi
	#1\bgroup }

\def\section{\s@ction{\noindent}\bf\raggedcenter }

%\def \Section #1 #2\par{\ifFirstPar \nobreak
%	\else \penalty-200 \vskip 8pt \fi
%	\noindent{\bf\hbox to \normalparindent{#1\hfil}#2}\endgraf
%	\nobreak \vskip 4pt \parindent=\z@ \FirstPartrue }

\def\Section #1 {\s@ction{\indent}%
		\llap{\hbox to\normalparindent{#1\hfil}}\bf\ignorespaces }
\def\subsection{\s@ction{\noindent}\bf}
\def\subsubsection{\s@ction{\noindent}\it}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%		*****	  references, bibliography	*****		      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\def\bibref#1{[{\bf#1}]}

\def\bibbrackets#1#2{\def\lbibch@r{#1}\def\rbibch@r{#2}}
\def\omitbibbrackets{\bibbrackets{}{}}
\bibbrackets[]
\def\bibfont#1{\def\bibf@nt{#1}}
\bibfont{\bf}

\def\bibb@xcontents#1{\lbibch@r
		{\bibf@nt\ignorespaces#1\unskip}\rbibch@r\enspace}
\def\setbibb@x#1{\setbox\TestBox=\hbox{\bibb@xcontents{#1}}}

\newdimen\prebibind@nt		\prebibind@nt=\normalparindent
\newdimen\bibind@nt		\bibind@nt=\normalparindent
\def\SetUpBiblio#1{\par\eightpoint
	\def\bibsh@ft{}%
	\T@stCount=0
	\def\test{#1}\def\match{\omit}%
	\ifx \test\match \T@stCount=1
	\else \def\match{\numeric}%
		\ifx \test\match \T@stCount=2 \fi
	\fi
	\ifcase\T@stCount \setbibb@x{#1}\ifdim\wd\TestBox > \normalparindent
		\prebibind@nt=\wd\TestBox \bibind@nt=\prebibind@nt \fi
	\or \omitbibbrackets \prebibind@nt=\z@
	\or \bibfont{\rm}\let\bibsh@ft=\hfill
	    \def\bibb@xcontents##1{{\bibf@nt\ignorespaces##1\unskip.}\enspace}%
	\fi
	\raggedright }

\def\Bibliography{\section References\par \SetUpBiblio }

\def\bibitem[#1]{\noindent \hangindent\bibind@nt
	\ifdim\prebibind@nt > \z@
		\setbibb@x{#1}%
		\ifdim\wd\TestBox > \prebibind@nt \unhbox\TestBox
		\else \hbox to\prebibind@nt{\bibsh@ft\unhbox\TestBox\hfil}\fi
	\fi
	\ignorespaces }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%			*****	  verbatim	*****			      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%  Support verbatim listing of TeX source, as defined in TeXbook, p. 421;
%  lifted from MANMAC.TEX, and modified for narrower columns.  The syntax
%  is different from that used by LaTeX; however, the technique has been
%  tested thoroughly in TUGboat, and is preferable to something less well
%  tested, so it will be used in this preliminary version of DEPROC.

\chardef\other=12
\def\ttverbatim{\begingroup \catcode`\\=\other
  \catcode`\{=\other \catcode`\}=\other \catcode`\$=\other
  \catcode`\&=\other \catcode`\#=\other \catcode`\%=\other
  \catcode`\~=\other \catcode`\_=\other \catcode`\^=\other
  \let\0=\ignorespaces \obeyspaces \obeylines \tt}

\newdimen\ttrightskip
\ttrightskip=1pc			% 5pc in PLAIN
%  This is the amount by which a \tt entry can exceed the right margin.
   
%\outer\def\begintt{$$\let\par=\endgraf \ttverbatim \parskip=\z@
%\def\begintt{$$\def\par{\leavevmode\null\endgraf}\ttverbatim \parskip=\z@
\outer\def\begintt{\ifhmode \unskip\strut \fi
  $$\def\par{\leavevmode\null\endgraf}\ttverbatim \parskip=\z@
  \catcode`\|=0 \rightskip=-\ttrightskip \ttfinish}
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
  |obeylines % end of line is active
  |gdef|ttfinish#1^^M#2\endtt{|strut#1|vbox{#2}|endgroup$$}}

\catcode`\|=\active
{\obeylines \gdef|{\ttverbatim \spaceskip\ttglue \let^^M=\  \let|=\endgroup}}

\newskip\ttglue
{\tentt \global\ttglue=.5em plus .25em minus .15em}
%  This should really be defined separately for each size, and installed
%  in \*point

%  Preserve initial spaces (definition compliments of David Eppstein).
{\obeyspaces\gdef {\ifvmode\indent\fi\space}}

\chardef\bs='134		% backslash for \tt mode
\chardef\SPC='040		% "visible" space

%  Permit math to be embedded within \begintt...\endtt .
\def\MTH{$}
\def\sb{_}
\def\sp{^}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%		*****	   environments, cf. LaTeX	*****		      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%  Implement a structure equivalent to LaTeX's \begin{...} ... \end{...}
%  environment structure.


\def \curr@nvir{}

\def \ch@ckdefined#1{\ifundefined{\csname#1\endcsname}%
			\errmessage{Environment #1 undefined}\fi }

\def \bad@end#1{\errmessage{Bad \string\end\string{#1\string}, %
		current environment is \curr@nvir}}

\def \begin#1{\ch@ckdefined{#1}\begingroup
	\def\curr@nvir{#1}\csname #1\endcsname }
\def \end#1{\def\t@st{#1}%
	\ifx \t@st\curr@nvir \def\result{\csname end#1\endcsname \endgroup}%
	\else \def\result{\bad@end{#1}}%
	\fi \result }


%  Environments needed for the DECUS Proceedings
%
%  Top matter -- Only \abstract is accessed as an environment.

\newbox\titlebox
\newbox\authorbox
\newbox\abstractbox

\def \titl@strut{\ifhmode \unskip\strut\endgraf \fi }

\def \title#1{\setbox\titlebox=\vbox{\hsize=\pagewd \titlefont
	\def\\{\break}\raggedstretch=.4\pagewd \raggedcenter
	\strut\endgraf \ignorespaces#1\titl@strut }}

\def \author#1{\setbox\authorbox=\vbox{\hsize=\pagewd
	\def\\{\break\rm}\def\and{\enspace{\rm and}\enspace}%
	\def\And{\endgraf\vskip\baselineskip\bf}%
	\raggedstretch=.4\pagewd
	\raggedcenter \bf \strut\ignorespaces#1\titl@strut }}

\long\def \abstract{\def\endabstract{\titl@strut\egroup}%
	\global\setbox\abstractbox=\vbox\bgroup \hsize=\pagewd
%		\leftskip=1.6in \rightskip=\leftskip
		\leftskip=1.25in \rightskip=\leftskip
		\centerline{\bf Abstract}%
		\vskip.5\baselineskip
		\noindent\strut\ignorespaces }

\newif\ifD@cument		\D@cumentfalse
\def \document{\def\enddocument{\par\vfill\supereject\endgroup\@@end}%
		\D@cumenttrue }


\def \maketitle{\setfirsthead{\unvbox\titlebox
		\vskip\baselineskip
		\unvbox\authorbox
		\vskip 3\baselineskip
		\unvbox\abstractbox
		\vskip 3\baselineskip }%
	\parindent=\z@ \FirstPartrue }

\def\quote{\def\endquote{\ifhmode \unskip\strut\endgraf \fi
		\egroup\smallskip}%
	\par \bgroup \leftskip=\normalparindent \rightskip=\leftskip
	\parskip=\smallskipamount \parindent=\z@ }

\def\quotation{\def\endquotation{\ifhmode \unskip\strut\endgraf \fi
		\egroup\smallskip}%
	\par \bgroup \leftskip=\normalparindent \rightskip=\leftskip
	\parskip=\smallskipamount \noindent }


%  \midinsert and \topinsert are PLAIN; they have \bigskip's in
%  appropriate places, so no other allowance is made.
%  There is a problem if a top figure starts with text: the baseline
%  will not line up with a regular text baseline, since the insertion
%  is a box. TeX tries to apply \topskip to the baseline of the box,
%  which is clearly too tall, so it is shoved to the top of the page.
%  There is no local \topskip in TeX.
%  Another bit of housekeeping is retention of \ifFirstPar value.

\newdimen\c@ptionwd
\def\c@ption#1{\vskip.5\baselineskip
	\c@ptionwd=\hsize \advance\c@ptionwd by 3\normalparindent
	\setbox\T@stBox=\hbox{\ignorespaces#1\unskip}%
	\ifdim\wd\T@stBox > \c@ptionwd
		{\leftskip=1.5\normalparindent \rightskip=\leftskip
		\noindent \hangindent=\normalparindent
		\unhbox\T@stBox\endgraf }%
	\else \centerline{\unhbox\T@stBox}%
	\fi }

\newif\ifFirstP@r		\FirstP@rfalse
\def\figure{\ifFirstPar \FirstP@rtrue \FirstParfalse \fi
	\def\endfigure{\endinsert
		\ifFirstP@r \global\FirstPartrue \FirstP@rfalse \fi }%
	\let\caption=\c@ption
	\midinsert }
\def\topfigure{\ifFirstPar \FirstP@rtrue \FirstParfalse \fi
	\def\endtopfigure{\endinsert 
		\ifFirstP@r \global\FirstPartrue \FirstP@rfalse \fi }%
	\let\caption=\c@ption
	\topinsert }


%\def \verbatim{...}
%  Verbatim environment is too complicated to get working quickly,
%  at least using \begintt...\endtt ; give up, and require that
%  \begintt...\endtt be used for this first version of DEPROC.



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%			*****	abbreviations	*****			      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\def \careof{\leavevmode\hbox{\raise.75ex\hbox{c}\kern-.15em
		/\kern-.125em\smash{\lower.3ex\hbox{o}}} }  % ends with space
\def \frac#1/#2{\leavevmode\kern.1em
	\raise.5ex\hbox{\the\scriptfont0 #1}\kern-.1em
	/\kern-.15em\lower.25ex\hbox{\the\scriptfont0 #2}}

\def \d@sh#1{\nobreak\thinspace#1\penalty0\thinspace}
\def \dash{\d@sh{--}}
\def \Dash{\d@sh{---}}

\def \DECUS{Digital Equipment Computer Users Society}
\def \TeX{\leavevmode\hbox{T\kern-.1667em\lower.424ex\hbox{E}\kern-.125emX}}
\def \AMSTeX{\leavevmode\hbox{$\cal A\kern-.2em\lower.376ex
	\hbox{$\cal M$}\kern-.2em\cal S$-\TeX}}
\def \LaTeX{\leavevmode L\kern-.36em\raise.3ex\hbox{\smc a}\kern-.15em\TeX}
\def \MF{{\logo META}\-{\logo FONT}}
\def \WEB{{\tt WEB}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%									      %
%			*****	initialization	*****			      %
%									      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\catcode`\@=12
%  @ is an ordinary character again


%  Some hyphenation exceptions:

\hyphenation{man-u-script man-u-scripts}


%  Initialize defaults.

\tenpoint			% type size
\StretchyTenPointSpacing	% permit wider spaces because of narrow columns
\twocol 			% page layout


\endinput

