% GBMacros.tex of January 9, 1984 6:25 pm --- Stolfi
% TEX macros for computational geometry book formats
% General comments
% To be used in conjunction with BasicMacros and a Font package.
% User also has to define a bunch of
% dimensional parameters (\textwidth, \itemindent, etc) required by
% those macros, as exemplified in TR10WideFormat, etc.
% Things to fix
% Check correct value for \setcount after \chapcont
% TITLES
% Begin new file
\def\begfile#1{\gdef\filestamp{#1}\gdef\newfile{T}}
% Chapter and section titles
% Usage:
% \title{CHAPTER}{\Ch1}{The Symmetric Diagonalization of Puffles}
% \shorttitle{Puffle diagonalization} % for page headers
% \section{\Ch1.\Sec1. Histery} (note: 1 argument only!)
% \subsection{\Ch1.\Sbsec{\Sec1.3}. Before the Big Bang}
% If a file contains more than one \title, precede each new one
% by an \eject (for headers' sake).
% If a piece (other than the beginning) of a chapter
% is TEXed separately, it should be preceded by
% \continues{\Ch1}{The Symmetric ...} instead of \chapter,
% \shorttitle{Puffle diagonalization} again, and
% \setcount0 N where N is the number of pages that came before.
% \chapter{1}{Bla bla} and \appendix{A}{Bla bla} are abbreviations of
% \title{CHAPTER}{1}{Bla bla}. and \title{APPENDIX}{A}{Bla bla}
\def\chapter#1#2{\title{CHAPTER}{#1}{#2}}
\def\appendix#1#2{\title{APPENDIX}{#1}{#2}}
\def\title#1#2#3{
\null
\vskip20pt plus10pt minus10pt
{\titlefont\baselineskip 2.0ex\lineskip0.1ex
\lftpar\pagewidth pt{\hfil #1 #2\quad\quad\hfilneg}
\vskip20pt
\lftpar\pagewidth pt{\hfil \uppercase{#3}\quad\quad\hfilneg}}
\continues{#2}{#3}
\gdef\newchap{T}
\setcount 0 1
\penalty 1000\vskip 30pt plus 10pt minus10pt}
\def\shorttitle#1{\gdef\chtitle{#1}}
\def\continues#1#2{\gdef\chnum{#1}\gdef\chtitle{#2}}
\def\section#1{
\vskip 3ex plus 2ex minus 0.5ex\penalty-900
\hbox{{\secfont #1}}
\penalty 1000\vskip 1ex}
\def\subsection#1{
\vskip 2ex plus 1.5ex minus 0.5ex\penalty-600
\hbox{{\subsecfont #1}}
\penalty 1000\vskip 1ex}
% EXERCISES
% Problems at end of chapter, section, etc.
% Usage:
% \prob{\Prob{\Sbsec{\Sec1.7}.4}}{Show that $P=NP$.
% \hint Show that $N=1$. \caveat This may be harder than
% what you think. \answer Obviously, $N-1=0$,
% which implies $N=1$.}
\def\prob#1#2{{\bf #1}. #2}
\def\answer{{\it Ans.}:\ }
\def\hint{{\it Hint\/}:\ }
\def\caveat{{\it Caveat\/}:\ }
% Foot problems (See Dr. Schnoll's paper).
% Usage as \prob, but
% will appear boxed at bottom of current page.
\def\footprob#1#2{
\botinsert{\ctrpar\pagewidth pt{\framebox{\small
\hbox par \footprobwidth pt{{\bf Exercise #1}: #2}}} }}
% MARGINAL FIGURES (by Aragones?)
% Usage: \mfig3 <a paragraph at most 3cm high> \endmfig
\def\mfig#1cm{\keep#1cm \defmfigwidths \hsize\textwidth pt \par}
\def\endmfig{\par \defnormalwidths \hsize\textwidth pt \par}
% MISCELLANEOUS OPTIONS AND PARAMETERS
% (dimensions in points unless otherwise indicated)
% References
\def\refindent{8} % indentation of reference body (in em)
\def\refremindent{9} % indentation of reference remarks (in em)
\def\refvskip{3} % vskip between references (in ex)
% Algorithms
\def\algthickness{0.6} % thickness of block brackets
\def\alglevelindent{20} % extra indent. per level (incl. \algthickness)
\def\algstepindent{18} % indent. of \step text rel. to innermost bracket
\def\algcommindent{18} % indent. of \comm text rel. to innermost bracket
\def\algcontindent{8} % extra indentation of continuation lines
\def\algstepnoskip{3} % space between step number and step text
% Programs
\def\progthickness{0.6} % thickness of block brackets
\def\proglevelindent{12} % extra indent. per level (incl. \progthickness)
\def\progstepindent{4} % indent. of \step text rel. to innermost bracket
\def\progcommindent{4} % indent. of \comm text rel. to innermost bracket
\def\progcontindent{8} % extra indentation of continuation lines
% Proofs
\def\begproofmark{{\bf Proof: }}
\def\endproofmark{\lower0.15ex\hbox{\hskip0.2em{\mal \char'061}}} % square
% Figures
\def\figmark{} % change to, say, \hbox{>>==>} for PressEdit and such
% File stamp
\def\printfilestamp{T} % put \filestamp on 1st page
% OUTPUT ROUTINE
% Global flags and variables (internal)
\def\fpage{T} % T on first page of output.
\def\newfile{F} % T on first page of a new file.
\def\newchap{F} % T on first page of a new chapter.
\setcount0 1 % just in case; also set by \chapter.
% Page header and footer formats
\def\pageheaderbox{
\vbox to 0pt{
\vskip0pt minus1000pt
\hbox to \pagewidth pt
{\headerfont \if T\newchap{} \else{\chtitle\hfil\chnum.\count0}}
\vskip 4 pt
\hrule
\vskip 3 pt
\hrule
\vskip 10pt}}
\def\pagefooterbox{
\gdef\putfoot{F} % internal flag
\if T\fpage {\gdef\putfoot{T}}\else{} % because of copyright note
\if T\newchap {\gdef\putfoot{T}}\else{} % idem
\if T\newfile {\gdef\putfoot{T}}\else{} % because of filestamp
\vbox{
\if T\putfoot{
\vskip 25pt
\hbox to \pagewidth pt{
{\bf $\copyright$ 1983 Leo Guibas and Jorge Stolfi}
\hfil
\if T\printfilestamp {{\small\it \filestamp}}\else{}}}
\else {}}}
% Page format
\output{
\baselineskip -1pt \lineskip 0pt
\hbox{\hskip \leftskip pt
\vbox{\pageheaderbox \page \pagefooterbox}}
\advcount0
\gdef\newfile{F}
\gdef\newchap{F}
\gdef\fpage{F}
}
% INITIALIZATION
\defnormalwidths
\hsize\textwidth pt
\vsize\textheight pt
\standardsize