% 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}