%%% File: header.tex
%%% A part of mfpic 0.6 2002/09/12
%%%
\def\mfpicversion{0.6 beta}
\def\mfpicdate{2002/09/12}
% Thomas Leathrum, Geoffrey Tobin ((?) G.Tobin@latrobe.edu.au),
% and Daniel Luecking (luecking@uark.edu).
% Macros for MFpic documentation.

% headings
\parskip0pt plus 2pt
\newskip\myskip
\newskip\beforeskip
\newskip\afterskip
  \myskip=5pt plus 3pt minus 1pt
  \afterskip=\myskip
  \beforeskip=6.5pt plus 3pt\relax
\def\pf{\bf}  % part font
\def\hf{\sc}  % heading font
\def\shf{\it} % subheading
\newif\ifstartsection
\newcount\partnum
\newcount\headnum
\newcount\subheadnum
\def\part#1{\advance\partnum1 \headnum0 \subheadnum0
  \vskip0pt plus.2\vsize\penalty-250
    \vskip0pt plus-.2\vsize
  \vskip\beforeskip\vskip\parskip
  \edef\xxx{\romannumeral\partnum}%
  \noindent{\pf\expandafter\uppercase\expandafter{\xxx}.\quad #1}%
  \startsectiontrue\everypar{\setbox0=\lastbox\global\startsectionfalse\global\everypar{}}%
  \par\nobreak\vskip\afterskip}
\def\head#1{\advance\headnum1 \subheadnum0
  \ifstartsection
    \removelastskip
  \else
    \vskip0pt plus.1\vsize\penalty-250
    \vskip0pt plus-.1\vsize
  \fi
  \vskip\beforeskip\vskip\parskip
  \noindent{\rm\the\headnum.\quad \hf#1}%
  \startsectiontrue\everypar{\setbox0=\lastbox\global\startsectionfalse\global\everypar{}}%
  \par\nobreak\vskip\afterskip}
\def\subhead#1{\advance\subheadnum 1
  \ifdim\lastskip>\myskip
  \else
    \removelastskip \vskip\myskip
  \fi
  \noindent\indent{\rm \the\headnum.\the\subheadnum\quad \shf#1}%
  \startsectiontrue\everypar{\setbox0=\lastbox\global\startsectionfalse\global\everypar{}}%
  \par\nobreak\vskip\afterskip}

% describing commands:
\def\bcd{%
  \ifdim\lastskip>\myskip
  \else\removelastskip
    \ifstartsection
    \else
      \penalty -100\vskip0pt plus2pt\relax
    \fi
    \vskip\myskip
  \fi
  \vtop\bgroup\parindent0pt\def\\{\brk}%
  \def\ {\leavevmode\null\quad}} % small space at beginning of line
\def\ecd{\strut\par\egroup\nobreak % no empty line before \ecd
    \everypar{\strut\everypar{}}}

% displaying examples:
\def\bex{\bcd\leftskip20pt\relax}
\def\eex{\par\egroup\vskip\myskip
    \everypar{\setbox0=\lastbox\everypar{}}}

\font\sc=cmcsc10
% prefer logo10 or manfnt, but these sometimes lack `P' or `S'.
\newif\iflogofont
\newif\ifmanfnt
\logofontfalse % make true if your logo10 has `P' and `S'
\manfntfalse % make true if your manfnt has `P' and `S'
\def\xx{%
  \def\MF{{\manual META}\-{\manual FONT}\null}
  \def\MP{{\manual META}\-{\manual POST}\null}
}
\iflogofont
  \font\manual=logo10
  \xx
\else\ifmanfnt
  \font\manual=manfnt
  \xx
\else
  \def\MF{{\sc meta\-font}}
  \def\MP{{\sc meta\-post}}
\fi\fi
\font\sf=cmss10
% abbreviations:
\def\TeX{{\rm T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX}\null}
\def\LaTeX{{\rm \setbox0=\hbox{T}L\kern-.36em
    \vbox to\ht0{\hbox{\sc a}\vss}\kern-.15em}\TeX}
\def\LaTeXe{\LaTeX$2_{\textstyle\varepsilon}$}
\def\pdfTeX{{\rm pdf\kern.04em}\TeX}
\def\pdfLaTeX{{\rm pdf\kern.06em}\LaTeX}
\def\ConTeXt{{\rm Con\kern-.16em \TeX \kern-0.06em t}}
\def\eTeX{{\rm e\kern-.10em \TeX}}
\def\AmSTeX{$\cal A$\kern-.1667em\lower.5ex
    \hbox{$\cal M$}\kern-.125em$\cal S$-\TeX}
\def\PiCTeX{%
    {\rm P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC\kern-.11em}\TeX}

\def\MFbook{{\it The \MF{}\-book\/}}

\def\PS{{\sc Post}\-{\sc Script}}
\def\GS{{\sc Ghost}\-{\sc script}}
\def\EPS{{\sc EPS}\null}

% metacode macros
\def\<{\relax\ifmmode\langle\else$\langle$\fi\bgroup\it}
\def\>{\egroup\ifmmode\rangle\else\/$\rangle$\fi}
% shorthand for greek theta for mathematics
\def\TH{\relax\ifmmode\theta\else$\theta$\fi}

% macro to typeset macros
% e.g. \mac{name}[?arg1][arg2] gives
% \name[arg1]{arg2}
\def\dooptparam?#1]{{\tt[#1]}\futurelet\nchr\domacro}
\def\dofixparam#1]{{\tt\string{#1\string}}\futurelet\nchr\domacro}
\def\doparamswap{\if?\nchr\expandafter\dooptparam
  \else\expandafter\dofixparam\fi}
\def\doparam[{\futurelet\nchr\doparamswap}
\def\domacro{\if[\nchr\expandafter\doparam\fi}
\def\bsl{{\tt\char\escapechar}}
\def\mac#1{\bsl{\tt#1}\futurelet\nchr\domacro}
\let\macro\mac

% logical markup to typeset filenames, program names, etc.
\def\file#1{{\tt #1}}
\def\prog#1{{\sc #1}}
\def\mfc#1{{\def\_{\char`\_}\tt #1}} % MF code
\def\opt#1{{\sf #1}} % LaTeX2e option names
\let\gbc=\mfc        % grafbase code
\def\env#1{{\tt #1}} % LaTeX environments
\def\mail#1{{\tt #1}}
\def\emph#1{{\it #1\/}}
\def\dim#1{{\tt #1}}

% Force a clean linebreak.
\def\brk{\hfil\break}

% Typewriter type braces
\def\{{{\tt \char`\{}}
\def\}{{\tt \char`\}}}

\def\uncatcodespecials{\def\do##1{\catcode`##1=12 }\dospecials}
{\obeyspaces\global\let =\ }

% Semi-verbatim text :
% A very simple verbatim.
% Usage:
%  \myverbatim{;}
%    \stuff
%    \more{stuff} ; a comment
%  @endmyverbatim
% Note: no "@" or instances of #1 allowed.
\def\myverbatim#1{\begingroup\par
  % So the eol after this command won't start a new line:
  \def\par{\endgraf\def\par{\leavevmode\endgraf}}%
  % leave with @endmyverbatim:
  \catcode`@=0
  \uncatcodespecials
  \obeylines\obeyspaces
  % specify a comment character (I use ; or #):
  \catcode`#1=14\tt}
\let\endmyverbatim\endgroup

% Test for pdftex:
\newif\ifpdf
\begingroup
  \edef\x{\endgroup\expandafter
  \ifx\csname pdfoutput\endcsname\relax
  \else
    \ifcase\pdfoutput\else\noexpand\pdftrue\fi
  \fi}
\x

% to support different paper sizes:
\newdimen\paperheight
\newdimen\paperwidth

% #1 = paper width, #2 = height:
\def\setpapersize#1#2{%
\paperwidth  #1\relax
\paperheight #2\relax
\ifpdf
  \pdfpageheight\paperheight
  \pdfpagewidth\paperwidth
\fi
}
% #1 = text width, #2 = height:
\def\setpagegeometry#1#2{%
  \hsize #1\relax
  \vsize #2\relax
  \voffset=\paperheight
  \advance \voffset -\vsize
  \divide \voffset by 2
  \advance \voffset -1 truein
  \hoffset\paperwidth
  \advance \hoffset -\hsize
  \divide \hoffset by 2
  \advance \hoffset -1 truein
  \def\makefootline{\baselineskip30pt
    \lineskiplimit0pt\line{\the\footline}}
}
%Defaults
\setpapersize{8.5truein}{11 truein}
\setpagegeometry{5.4167 in}{7.4166 in}

% don't hyphenate in \tt
{\tt\global\hyphenchar\font=-1}

\frenchspacing
\endinput
