\input CgTBasic
% CgNHdr.tex of September 6, 1983 9:45 pm --- Stolfi

% Header file for computational geometry notes - CS445 Win'83

% DESIRABLE CHANGES

% FONT DEFINITIONS

\font <=TimesRomanb at 12truebp % for running header and page numbers

\font O=Helveticab at 12truebp  % for section titles
\font H=Helveticab at 10 truebp % for subsection titles

\def\headerfont{\: <} % font used for headers and page no.s
\def\chapfont{\: O} % font used for chapter title
\def\secfont{\: O} % font for section headers
\def\subsecfont{\: H} % font for subsection headers

% Begin new file.

\def\printfilestamp{T} % put \filestamp on 1st page
\def\newfile{F} % (internal) T on first page of a new file. 

\def\begfile#1{\gdef\filestamp{#1}\gdef\newfile{T}}

% Dummy macros to facilitate searches and substitutes on item numbers
%  (i.e., theorems, algorithms, sections and subsections, equations, figures) 
%  References to items in the same chapter should have the form
%    \Th5 or \Th{17}. References to items in other chapters must
%    have the form ``theorem \Th{\Ch5.17}'' (NOT \Ch5.\Th{17} or
%    ``theorem \Th{17} of chapter \Ch5''!!!).
%  Same rule applies to section numbers. For subsections, use
%   \Sbsec{\Sec3.5} if it is in the current chapter, or
%   \Sbsec{\Sec{\Ch8.3}.5} if it is in another chapter.
%  In section or subsection headers, use \Ch8.\Sec3 and
%    \Ch8.\Sbsec{\Sec3.5}, as in local references.
% 
\def\Prob#1{{#1}} % problem number
\def\Th#1{{#1}} % theorem or lemma number
\def\Fig#1{{#1}} % figure number
\def\Def#1{{#1}} % definition number
\def\Sec#1{{#1}} % section number
\def\Sbsec#1{{#1}} % subsection number
\def\Eq#1{{#1}} % equation number
\def\Ch#1{{#1}} % chapter number
\def\Alg#1{{#1}} % algorithm number
\def\Step#1{{#1}} % step number

% Chapter and section titles.
%   Usage: \chapter{\Ch1}{Introduction}
%   Usage: \section{\Ch1.\Sec1. Histerical remarks} (note: 1 argument only!)
%   Usage: \subsection{\Ch1.\Sbsec{\Sec1.3}. Before the Big Bang}
%   If a file contains more than one chapter, terminate each by an \eject
%     (for headers' sake).
%   If a piece (other than the beginning) of a chapter is TEXed separately,
%     continues a previous chapter, it should be preceded by
%     \chapcont{\Ch1}{Introduction} instead of \chapter, and
%     \setcount0 to the number of pages that came before.

\def\chapter#1#2{
  \vskip30pt plus20pt minus15pt
  \hbox{{\chapfont #1. #2}}
  \chapcont{#1}{#2}
  \penalty 1000\vskip 6pt plus 3pt}

\def\chapcont#1#2{
  \gdef\newchap{T} % (internal) T on 1st page of chap. or paper
  \gdef\chnum{#1}
  \gdef\chtitle{#2}}

\def\section#1{
  \vskip 20pt plus 10 pt minus 3pt\penalty-600
  \hbox{{\secfont #1}}
  \penalty 1000\vskip 6pt plus 3pt}

\def\subsection#1{
    \vskip 20pt plus 10 pt minus 3pt\penalty-600
    \hbox{{\subsecfont #1}}
    \penalty 1000\vskip 6pt plus 3pt}

% Foot problems (See Dr. Schnoll's paper).
%   Will appear boxed at bottom of current page.
%   Usage: \footprob{\Prob{\Sbsec{\Sec1.7}.4}}{Show that $P=NP$
%             {\it Hint\/}: Show that $N=1$. {\it Ans.}: Obviously,
%             $N-1=0$, which implies $N=1$.}

\def\footprob#1#2{\botinsert{\vskip20pt
  \ctrline{\boxit{\small \hbox par \footprobwidth pt{
    {\bf Exercise #1}: #2}}}
  }}

% Default page headers for CS445 Notes (Winter 83)

\def\fpfoot{{\bf $\copyright$ 1983  Leo Guibas and Jorge Stolfi}}

\def\header{\chtitle\hfil\chnum.\count0}

\def\printfpheader{T} % put \fpheader on first page of chapter

\def\fpheader{CS445 - Winter 83\hfil\chnum. \chtitle}  % idem


% DIMENSIONAL PARAMETERS
%   (in points unless otherwise indicated)

% Dimensions related to page width

\def\defnormalwidths{
  \def\pagewidth{400} % page width
  \def\textwidth{400} % text width
  \def\progwidth{380} % program width
  \def\algwidth{380} % width of algorithms - max: page width
 }

% Reduced dimensions in effect during \mfigs

\def\defmfigwidths{
  \def\pagewidth{260} % page width
  \def\textwidth{260} % text width
  \def\progwidth{260} % program width
  \def\algwidth{260} % width of algorithms - max: page width
 }

\def\theowidth{\textwidth} % width of theorems
\def\textheight{590} % total page height available for text

\def\ftfigwidth{300} % width of text in footnotes with figures
\def\figcapwidth{320} % width of figure captions
\def\refbodywidth{330} % width of body of bibl. reference
\def\refremwidth{300} % width of bibl. reference remarks
\def\footprobwidth{392} % width of text in foot problems

% Text, titles and footnotes

\def\textindent{20} % indentation for paragraphs in text

\def\stdparindent{0} % standard indentation for paragraphs
\def\stdparskip{6} % extra skip between paragraphs
\def\stdbaselineskip{12} % normal distance betweeen baselines
\def\stdboxparskip{18} % \stdparskip+\stdbaselineskip (for use in \bp)

\def\smallparindent{0} % indentation for paragraphs in \small
\def\smallparskip{4} % extra skip between paragraphs in \small
\def\smallbaselineskip{9} % distance between baselines in \small
\def\smallboxparskip{13} % \stdparskip+\stdbaselineskip (for \bp in \small)

% References

\def\refindent{70} % indentation of reference body in points
\def\refvskip{10} % vskip between references

% Algorithms format

\def\stepindent{20} % in points - extra indent. per level
\def\contindent{11} % in points - extra indent. of cont. lines
\def\algindent{1} % in points - indentation of outermost bracket
\def\snoindent{4} % in points - ind. of \sno rel. innermost bracket
\def\commindent{15} % in points - ind. of comments rel. inn. bra.

% Theorem, lemma and definitions format

\def\theostatindent{20} % indentation of them. statements
\def\proofindent{10} % indentation of proofs

\def\begproofmark{$\rpike$\hskip4pt{\it Proof:}\hskip4pt}
\def\endproofmark{\hskip4pt $\lpike$}

% MARGINAL FIGURES (by Aragones?)

%  Usage: \mfig3  <a paragraph at most 3cm high> \endmfig

\def\mfig#1{
  \keep{#1} \defmfigwidths \hsize\pagewidth pt \par}

\def\endmfig{
  \par \defnormalwidths \hsize\pagewidth pt \par}

% Additional math operators

\def\hull{\mathop{\char h\char u\char l\char l}}
\def\sdist{\mathop{\char s\char d\char i\char s\char t}}
\def\bound#1{\partial {#1}} % boundary
\def\clos#1{\bar{#1}} % closure

% Quad-edge operators (in math formulas)

\def\thin{\hskip0.7pt}
\def\sym{\thin\hbox{\it Sym\/}}
\def\flip{\thin\hbox{\it Flip\/}}
\def\rot{\thin\hbox{\it Rot\/}}
\def\onext{\thin\hbox{\it Onext\/}}
\def\oprev{\thin\hbox{\it Oprev\/}}
\def\dnext{\thin\hbox{\it Dnext\/}}
\def\dprev{\thin\hbox{\it Dprev\/}}
\def\lnext{\thin\hbox{\it Lnext\/}}
\def\lprev{\thin\hbox{\it Lprev\/}}
\def\rnext{\thin\hbox{\it Rnext\/}}
\def\rprev{\thin\hbox{\it Rprev\/}}
\def\lef{\thin\hbox{\it Left\/}}
\def\rif{\thin\hbox{\it Right\/}}
\def\org{\thin\hbox{\it Org\/}}
\def\dest{\thin\hbox{\it Dest\/}}
\def\dual{\thin\hbox{\it Dual\/}}

% Quad-edge operators (in programs)

\def\psym{\hbox{\fx .Sym}}
\def\pflip{\hbox{\fx .Flip}}
\def\prot{\hbox{\fx .Rot}}
\def\ponext{\hbox{\fx .Onext}}
\def\poprev{\hbox{\fx .Oprev}}
\def\pdnext{\hbox{\fx .Dnext}}
\def\pdprev{\hbox{\fx .Dprev}}
\def\plnext{\hbox{\fx .Lnext}}
\def\plprev{\hbox{\fx .Lprev}}
\def\prnext{\hbox{\fx .Rnext}}
\def\prprev{\hbox{\fx .Rprev}}
\def\plef{\hbox{\fx .Left}}
\def\prif{\hbox{\fx .Right}}
\def\pnext{\hbox{\fx .Next}}
\def\pdata{\hbox{\fx .Data}}
\def\porg{\hbox{\fx .Org}}
\def\pdest{\hbox{\fx .Dest}}

% Obsolete macros (kept for backwards compatibility only)

\def\uo{{\cmr\"\rm o}} % umlaut o in roman
\def\uu{{\cmr\"\rm u}} % umlaut u
\def\ua{{\cmr\"\rm a}} % umlaut a
\def\arc{\mathop{\char a\char r\char c}}
\def\seg{\overline} % same as \bar
\def\ety{\emptyset} % same as \empty
\def\un{\mathbin{\char'533}} % infix union operator; same as \uni
\def\span{\,\,\,} % same as  \sp
\def\blug{\hskip 3pt\blackslug}

\chcode'174←4  % "|" as alignment tab

\def\det#1{\left\char'550614\,\, #1\,\, \right\char'550614} % determinant

\def\prob{\problem{\count1} \advcount1}
\def\problem#1{$\rpike$\ {\bf #1}.\ }
\def\caveat{\vskip 4 pt plus 2 pt \it}

\def\bxpar{\bp}
\def\ftpar{\bp}

% OUTPUT ROUTINE.

\def\fpage{T} % (internal) T on very first page

\def\headbox#1{
  \vbox to 0pt{
      \vskip-0.54truein
      \hbox to \pagewidth pt{\headerfont #1}
      \vskip 4 pt
      \hrule
      \vskip 3 pt
      \hrule
      \vskip 0.33truein plus 6 in minus 6 in}}

\output{
  \gdef\puthd{T}\gdef\putft{F} % internal flags
  \if T\newchap{
    \gdef\puthd{\printfpheader}
    \gdef\putft{T}}\else{}
  \if T\newfile{\gdef\putft{T}}\else{}

  \baselineskip 0pt \lineskip 0pt
  \if T\puthd{\hbox{\hskip 20pt
    \if T\newchap{\headbox{\fpheader}}
    \else {\headbox{\header}}}}
  \else{}
  \hbox{\hskip 20pt\vbox{\page}}
  \advcount0
  \if T\putft{
     \vskip 15pt
     \hbox{\hskip20pt\hbox to \pagewidth pt
      {\if T\newchap{\fpfoot}\else{}
         \hfil
         \if T\newfile
           {\if T\printfilestamp{\small \filestamp}\else{}}\else{}
       }}
     }\else {}
  \gdef\newfile{F}
  \gdef\newchap{F}
  \gdef\fpage{F}
}

\defnormalwidths
\setcount0 1
\hsize\textwidth pt
\vsize\textheight pt
\standardsize