% My standard setups and macro definitions.
%
% History of changes
%
%   Originally written June 1992
%		Mon 02/15/1993 -- Added eqnarray abbreviations.
%		Fri 06/30/1995 -- Minor cleanup.
%		Fri 07/07/1995 -- Added derivative abbreviations.
%		Fri 10/19/2007 -- Added float adjustment block and cleanup.
%		Fri 05/23/2008 -- Added material stolen from jeep.sty.
%
%	What's in here...
%		- Reset standard page dimensions for letter-size paper (8.5 x 11)
%		- A few custom shorthand mark-ups that save me typing
%		- Bits and pieces stolen from jeep.sty that do specific things for me
%			- Chapter and section headings
%			- Outline environment
%			- Head and foot macros
%			- Underhead rule
%			- Tight table of contents (for articles that need a TOC)
%		- Adjustments for better float placement
%		- Jon Lee's fossils (for a couple of reports we worked on together)
%			These should probably be moved to the preamble of the appropriate text...
%			Someday/sometime
%		- Footnote-indent adjustment
%		- Milestone (Gantt-like) charts

\typeout{Dave's standard definitions Friday, July 7, 1995...}
\typeout{Dave's standards updated Friday 23 May 2008...}

% My standard page dimensions.

\setlength{\topmargin}{0in}
\setlength{\textheight}{8.25in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textwidth}{6.5in}
\setlength{\parindent}{0pt}
\setlength{\parskip}{8pt}
\raggedbottom
\newcommand{\cl}[1]{\centerline{#1}}
\newcommand{\bfg}{\begin{figure}}
\newcommand{\efg}{\end{figure}}
\newcommand{\EGL}{{\em EGL}}
\newcommand{\HGL}{{\em HGL}}

% Some of my own markups. These are now fossils because I no longer use them but 
%  I'm hanging on to them to make my default style backwards-compatible.

\newcommand{\mhead}[1]{\vspace{0pt}{\large \sf #1}\nopagebreak}
\newcommand{\dspace}{\renewcommand{\baselinestretch}{1.5}\tiny\normalsize}
\newcommand{\sspace}{\renewcommand{\baselinestretch}{1}\tiny\normalsize}
\newcommand{\degree}{\ensuremath{^\circ}}

% The following stolen unabashedly from jeep.sty... DBT 23 May 2008
% Outline is a new list style--the same as enumerate with
% less space between the items.

\def\outline{\ifnum \@enumdepth >3 \@toodeep\else
      \advance\@enumdepth \@ne 
      \edef\@enumctr{enum\romannumeral\the\@enumdepth}\list
      {\csname label\@enumctr\endcsname}{\usecounter
        {\@enumctr}\def\makelabel##1{\hss\llap{##1}}
         \parsep \z@ \itemsep \z@ 
         \ifnum \@enumdepth > 1 \topsep \z@ \fi}\fi}

\let\endoutline =\endlist

% Three part head and foot macros by
% Lance Berc
% Olivetti Research Center
% 2882 Sand Hill Road
% Menlo Park, California 94025
% (415) 496-6200
% lance@orc.olivetti.com
%
% Modified 4/91 by G. W. Stewart to provide additional
% even headings for books and the like.

%\def\lhead#1{\gdef\@lhead{#1}\gdef\@erhead{#1}}
%\def\lfoot#1{\gdef\@lfoot{#1}\gdef\@erfoot{#1}}
%\def\chead#1{\gdef\@chead{#1}\gdef\@echead{#1}}
%\def\cfoot#1{\gdef\@cfoot{#1}\gdef\@ecfoot{#1}}
%\def\rhead#1{\gdef\@rhead{#1}\gdef\@elhead{#1}}
%\def\rfoot#1{\gdef\@rfoot{#1}\gdef\@elfoot{#1}}

%\def\@lhead{} \def\@lfoot{}
%\def\@chead{} \def\@cfoot{}
%\def\@rhead{} \def\@rfoot{}

%\def\elhead#1{\gdef\@elhead{#1}} \def\elfoot#1{\gdef\@elfoot{#1}}
%\def\echead#1{\gdef\@echead{#1}} \def\ecfoot#1{\gdef\@ecfoot{#1}}
%\def\erhead#1{\gdef\@erhead{#1}} \def\erfoot#1{\gdef\@erfoot{#1}}

%\def\@elhead{} \def\@elfoot{}
%\def\@echead{} \def\@ecfoot{}
%\def\@erhead{} \def\@erfoot{}

%\def\@threepart#1#2#3{\rlap{#1} \hfil {#2} \hfil \llap{#3}}

%\def\ps@threepartheadings
%    {
%    \def\@oddhead{\@threepart{\@lhead}{\@chead}{\@rhead}}
%    \def\@oddfoot{\@threepart{\@lfoot}{\@cfoot}{\@rfoot}}

%    \if@twoside
%	\def\@evenhead{\@threepart{\@elhead}{\@echead}{\@erhead}}
%	\def\@evenfoot{\@threepart{\@elfoot}{\@ecfoot}{\@erfoot}}
%    \else
%	\def\@evenhead{\@threepart{\@lhead}{\@chead}{\@rhead}}
%	\def\@evenfoot{\@threepart{\@lfoot}{\@cfoot}{\@rfoot}}
%    \fi
%    }

%\ps@threepartheadings

% Define \underhead to put a rule under the headers.  \nounderhead
% suppresses \underhead on the current page.  The space between
% the text and the rule is \underheadsep.

%\def\underhead{
% \addtolength{\headheight}{\underheadsep}
% \def\@outputpage{\begingroup\catcode`\ =10 \if@specialpage 
%     \global\@specialpagefalse\@nameuse{ps@\@specialstyle}\fi
%     \if@twoside 
%       \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
%            \let\@themargin\oddsidemargin
%          \else \let\@thehead\@evenhead
%          \let\@thefoot\@evenfoot \let\@themargin\evensidemargin
%     \fi\fi
%     \shipout
%     \vbox{\normalsize \baselineskip\z@ \lineskip\z@
%           \vskip \topmargin \moveright\@themargin
%           \vbox{\setbox\@tempboxa
%                   \vbox to\headheight{\vfil \hbox to\textwidth{\@thehead}
%                         \vskip \underheadsep
%                          \if@nounderhead\global\@nounderheadfalse
%                                 \hbox to\textwidth{}
%                          \else  \hbox to\textwidth{\hrulefill}\fi}
%                 \dp\@tempboxa\z@
%                 \box\@tempboxa
%                 \vskip \headsep
%                 \box\@outputbox
%                 \baselineskip\footskip
%                 \hbox to\textwidth{\@thefoot}}}\global\@colht\textheight
%           \endgroup\stepcounter{page}\let\firstmark\botmark}

%}
%\def\ps@empty{\@nounderheadtrue
%              \let\@mkboth\@gobbletwo\def\@oddhead{}\def\@oddfoot{}%
%\def\@evenhead{}\def\@evenfoot{}}

%\def\ps@plain{\@nounderheadtrue
%     \let\@mkboth\@gobbletwo
%     \def\@oddhead{}\def\@oddfoot{\rm\hfil\thepage
%     \hfil}\def\@evenhead{}\let\@evenfoot\@oddfoot}

%
%\newif\if@nounderhead \@nounderheadfalse
%\def\nounderhead{\@nounderheadtrue}

%\newlength{\underheadsep}
%\setlength{\underheadsep}{.5ex}

% Define \tighttoc to alter table of contents entry so that
% sections are treated like subsections, subsubsections, etc.

\def\tighttoc{\def\l@section{\@dottedtocline{1}{0em}{1.4em}}}

% Define the command \mychapter{<head1>}{<head2>}.  <head1>
% is the text to put in the chapter head if there is a
% chapter number; <head2>, if not.

\def\@chapapp{Chapter}
\def\chapapp{\@chapapp}

\def\mychapter#1#2{
   \def\@chaphead##1{#1}
   \def\@schaphead##1{#2}
}

\def\@makechapterhead#1{ \vspace*{\chaptopsep} { \parindent 0pt \raggedright
 \ifnum \c@secnumdepth >\m@ne \@chaphead{#1} \else \@schaphead{#1} \fi
 \par \nobreak \vskip \chapaftersep } }

\def\@makeschapterhead#1{ \vspace*{\chaptopsep} { \parindent 0pt \raggedright
 \@schaphead{#1}\par
 \nobreak \vskip \chapaftersep } }

% \chaptopsep is the space between the top of the text page and the
% chapter head.  \chapaftersep is the space between the chapter
% head and the text.

\newlength{\chaptopsep}
\setlength{\chaptopsep}{.5in}
\newlength{\chapaftersep}
\setlength{\chapaftersep}{.5in}

% Default chapter headings.

\mychapter{\LARGE \sc \thechapter. #1}{\LARGE \sc #1}

% Define the command \mysection{<sec>}{<style>}{<prefix>}.
% <sec> is the section level--section, subsection, etc.  <style>
% is the style in which the section head is to be set; e.g.,
% \large\bf.  <prefix> is what proceeds the head text, usually
% \the<sec> followed by some putctuation.


\def\@startsection#1#2#3#4#5#6{\if@noskipsec \leavevmode \fi
   \par \@tempskipa #4\relax
   \@afterindenttrue
   \ifdim \@tempskipa <\z@ \@tempskipa -\@tempskipa \@afterindentfalse\fi
   \if@nobreak \everypar{}\else
     \addpenalty{\@secpenalty}\addvspace{\@tempskipa}\fi \@ifstar
     {\@ssect{#3}{#4}{#5}{#1}}{\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}


\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
     \def\@svsec{}\else 
     \refstepcounter{#1}
     \edef\@svsec{\expandafter\relax\csname @pre#1\endcsname}\fi
     \@tempskipa #5\relax
      \ifdim \@tempskipa>\z@ 
        \begingroup \expandafter\relax\csname @#1style\endcsname\relax
          \@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty \@M #8\par}
        \endgroup
       \csname #1mark\endcsname{#7}\addcontentsline
         {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                      \protect\numberline{\csname the#1\endcsname}\fi
                    #7}\else
        \def\@svsechd{%
            \expandafter\relax\csname @#1style\endcsname\relax
            \hskip #3\@svsec #8\csname #1mark\endcsname
                      {#7}\addcontentsline
                           {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                             \protect\numberline{\csname the#1\endcsname}\fi
                       #7}}\fi
     \@xsect{#5}}


\def\@ssect#1#2#3#4#5{\@tempskipa #3\relax
   \ifdim \@tempskipa>\z@
     \begingroup \expandafter\relax\csname @#4style\endcsname\relax
     \@hangfrom{\hskip #1}{\interlinepenalty \@M #5\par}\endgroup
   \else \def\@svsechd{#4\hskip #1\relax #5}\fi
    \@xsect{#3}}

\def\mysection#1#2#3{
     \expandafter\def\csname @#1style\endcsname{#2}
     \expandafter\def\csname @pre#1\endcsname{#3}
}

% Default section heads.

\mysection{section}{\large\bf}{\thesection.~}
\mysection{subsection}{\normalsize\bf}{\thesubsection.~}
\mysection{subsubsection}{\normalsize\bf}{\thesubsubsection.~}
\mysection{paragraph}{\normalsize\bf}{\theparagraph.}
\mysection{subparagraph}{\normalsize\bf}{\thesubparagraph.}

% Redefine theorem environment macros to put \theoremcounterend
% (default ".") after the "theorem" head.

\def\@begintheorem#1#2{\sl \trivlist
   \item[\hskip \labelsep{\bf #1\ #2\thmcounterend}]}
\def\@opargbegintheorem#1#2#3{\sl \trivlist
      \item[\hskip \labelsep{\bf #1\ #2\ (#3)\thmcounterend}]}
\def\thmcounterend{.}

% Define \numberbysection to number figures, table, equations, and
% theorems within sections.  Similarly for \numberbysubsection.  Any
% theorem-like environment numbered with theorem inherits this
% numbering (however, be sure to define the.  theorem environment
% before invoking \numberbysection or \numberbysubsection).

\def\numberbysection{\renewcommand{\thesection}{\arabic{section}}
                     \renewcommand{\theequation}{\thesection.\arabic{equation}}
                     \@addtoreset{equation}{section}
                     \renewcommand{\thetheorem}{\thesection.\arabic{theorem}}
                     \@addtoreset{theorem}{section}
                     \renewcommand{\thefigure}{\thesection.\arabic{figure}}
                     \@addtoreset{figure}{section}
                     \renewcommand{\thetable}{\thesection.\arabic{table}}
                     \@addtoreset{table}{section}}

\def\numberbysubsection{\renewcommand{\thesection}{\arabic{section}}
              \renewcommand{\thesubsection}{\arabic{subsection}}
              \renewcommand{\theequation}{\thesubsection.\arabic{equation}}
              \@addtoreset{equation}{subsection}
              \renewcommand{\thetheorem}{\thesubsection.\arabic{theorem}}
              \@addtoreset{theorem}{subsection}
              \renewcommand{\thefigure}{\thesubsection.\arabic{figure}}
              \@addtoreset{figure}{subsection}
              \renewcommand{\thetable}{\thesubsection.\arabic{table}}
              \@addtoreset{table}{subsection}}

\@definecounter{theorem}

% End of jeep.sty steal...

\typeout{Alter some LaTeX defaults for better treatment of figures...}
% See p.105 of "TeX Unbound" for suggested values.
% See pp. 199-200 of Lamport's "LaTeX" book for details.
% General parameters, for ALL pages:
\renewcommand{\topfraction}{0.9}		% max fraction of floats at top
\renewcommand{\bottomfraction}{0.8}	% max fraction of floats at bottom
% Parameters for TEXT pages (not float pages):
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4}     		% 2 may work better
\setcounter{dbltopnumber}{2}    		% for 2-column pages
\renewcommand{\dbltopfraction}{0.9}	% fit big float above 2-col. text
\renewcommand{\textfraction}{0.07}	% allow minimal text w. figs
% Parameters for FLOAT pages (not text pages):
\renewcommand{\floatpagefraction}{0.7}	% require fuller float pages
% N.B.: floatpagefraction MUST be less than topfraction !!
\renewcommand{\dblfloatpagefraction}{0.7}	% require fuller float pages
% remember to use [htp] or [htpb] for placement
% Previous unabashedly stolen from 
%	http://mintaka.sdsu.edu/GF/bibliog/latex/floats.html

% Equation definitions (courtesy Jon Lee). Again, fossils...

\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\bea}{\begin{eqnarray}}
\newcommand{\eea}{\end{eqnarray}}
\newcommand{\nn}{\nonumber}
\newcommand{\pard}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\vrsb}[2]{#1_{#2}}
\newcommand{\vrss}[3]{#1_{#2}^{#3}}
\newcommand{\xz}{\vrsb{x}{0}}
\newcommand{\xone}{\vrsb{x}{1}}
\newcommand{\xtwo}{\vrsb{x}{2}}
\newcommand{\tz}{\vrsb{t}{0}}
\newcommand{\tone}{\vrsb{t}{1}}
\newcommand{\ttwo}{\vrsb{t}{2}}
\newcommand{\xint}{\vrss{\int}{\xone}{\xtwo}}
\newcommand{\tint}{\vrss{\int}{\tone}{\ttwo}}
\newcommand{\ddx}{\pard{}{x}}
\newcommand{\ddt}{\pard{}{t}}
\newcommand{\dhdx}{\pard{h}{x}}
\newcommand{\dhdt}{\pard{h}{t}}
\newcommand{\dcdx}{\pard{c}{x}}
\newcommand{\dcdt}{\pard{c}{t}}
\newcommand{\dzdx}{\pard{z}{x}}
\newcommand{\dzdt}{\pard{z}{t}}
\newcommand{\dAdx}{\pard{A}{x}}
\newcommand{\dAdt}{\pard{A}{t}}
\newcommand{\dAdh}{\pard{A}{h}}
\newcommand{\dKdx}{\pard{K}{x}}
\newcommand{\dKdt}{\pard{K}{t}}
\newcommand{\dKdh}{\pard{K}{h}}
\newcommand{\dudx}{\pard{u}{x}}
\newcommand{\dudt}{\pard{u}{t}}
\newcommand{\dQdx}{\pard{Q}{x}}
\newcommand{\dQdt}{\pard{Q}{t}}
\newcommand{\barh}{\right|_{h\mbox{\scriptsize{ constant}}}}
\newcommand{\Sz}{\vrsb{S}{0}}
\newcommand{\Sf}{\vrsb{S}{f}}
\newcommand{\nf}{\frac{1.49}{n}}
\newcommand{\Rp}{R^{2/3}}
\newcommand{\Szp}{\Sz^{1/2}}
\newcommand{\Sfp}{\Sf^{1/2}}
\newcommand{\sumiN}{\sum_{i=1}^{N}}
\newcommand{\Ai}{A_{i}}
\newcommand{\Ki}{K_{i}}
\newcommand{\ui}{u_{i}}
\newcommand{\Qi}{Q_{i}}
\newcommand{\Fb}{\mbox{$\bf{F}$}}
\newcommand{\sptwo}{\mbox{\ \ }}
\newcommand{\xP}{\vrsb{x}{P}}
\newcommand{\tP}{\vrsb{t}{P}}
\newcommand{\cP}{\vrsb{c}{P}}
\newcommand{\uP}{\vrsb{u}{P}}
\newcommand{\xL}{\vrsb{x}{L}}
\newcommand{\tL}{\vrsb{t}{L}}
\newcommand{\cL}{\vrsb{c}{L}}
\newcommand{\uL}{\vrsb{u}{L}}
\newcommand{\xR}{\vrsb{x}{R}}
\newcommand{\tR}{\vrsb{t}{R}}
\newcommand{\cR}{\vrsb{c}{R}}
\newcommand{\uR}{\vrsb{u}{R}}
\newcommand{\xj}{\vrsb{x}{j}}
\newcommand{\xjp}{\vrsb{x}{j+1}}
\newcommand{\xjh}{\vrsb{x}{j+1/2}}
\newcommand{\tn}{\vrsb{t}{n}}
\newcommand{\tnp}{\vrsb{t}{n+1}}
\newcommand{\tnh}{\vrsb{t}{n+1/2}}
\newcommand{\tnm}{\vrsb{t}{n-1}}
\newcommand{\fj}{\vrsb{f}{j}}
\newcommand{\fjp}{\vrsb{f}{j+1}}
\newcommand{\fjh}{\vrsb{f}{j+1/2}}
\newcommand{\yn}{\vrss{y}{}{n}}
\newcommand{\ynm}{\vrss{y}{}{n-1}}
\newcommand{\fjn}{\vrss{f}{j}{n}}
\newcommand{\hj}{\vrsb{h}{j}}
\newcommand{\hjp}{\vrsb{h}{j+1}}
\newcommand{\hn}{\vrss{h}{}{n}}
\newcommand{\hnp}{\vrss{h}{}{n+1}}
\newcommand{\hjn}{\vrss{h}{j}{n}}
\newcommand{\hjpn}{\vrss{h}{j+1}{n}}
\newcommand{\hjnp}{\vrss{h}{j}{n+1}}
\newcommand{\hjpnp}{\vrss{h}{j+1}{n+1}}
\newcommand{\hjs}{\vrss{h}{j}{*}}
\newcommand{\hjps}{\vrss{h}{j+1}{*}}
\newcommand{\qn}{\vrss{q}{}{n}}
\newcommand{\qnp}{\vrss{q}{}{n+1}}
\newcommand{\xjint}{\vrss{\int}{\xj}{\xjp}}
\newcommand{\tnint}{\vrss{\int}{\tn}{\tnp}}
\newcommand{\Dx}{\Delta x}
\newcommand{\Dt}{\Delta t}
\newcommand{\sump}{\vrss{\sum}{p=1}{P}}
\newcommand{\mc}[2]{\multicolumn{1}{#1}{#2}}

% End of Jon's stuff... Boy I miss him!

\hyphenation{cli-ma-tol-ogy}

\typeout{.....dbt changed footnote indentation}
%
% From "article.doc" as of 14 Janvier 1992 for LaTeX 2.09
%
%        The following macro indents all lines of the footnote by 10pt,
%        and indents the first line of a new paragraph by 1em.  To
%        change these dimensions, just substitute the desired value for
%        '10pt' [in both places] or '1em'.  The mark is flushright
%        against the footnote.
%
% Changed this to NO indentation for the first line, ie parindent0pt
%
\long\def\@makefntext#1{\@setpar{\@@par\@tempdima \hsize
     \advance\@tempdima-10pt\parshape \@ne 10pt \@tempdima}\par
     \parindent0pt %% <-----------------changed here from 1em indentation
     \noindent
     \hbox to \z@{\hss$\m@th^{\@thefnmark}$}#1}

\typeout{.....dbt changed labels to arabic}
% The following Stolen unabashedly from jeep.sty
% Change the labels of enumerate and outline to arabic numbers.

% \def\labelenumi{\arabic{enumi}.}
% \def\theenumi{\arabic{enumi}}
% \def\labelenumii{\arabic{enumii}.}
% \def\theenumii{\arabic{enumii}}
% \def\p@enumii{\theenumi.}
% \def\labelenumiii{\arabic{enumiii}.}
% \def\theenumiii{\arabic{enumiii}}
% \def\p@enumiii{\theenumi.\theenumii.}
% \def\labelenumiv{\arabic{enumiv}.}
% \def\theenumiv{\arabic{enumiv}}
% \def\p@enumiv{\p@enumiii.\theenumiii}
%
% % Outline is a new list style--the same as enumerate with
% % less space between the items.
%
% \def\outline{\ifnum \@enumdepth >3 \@toodeep\else
%       \advance\@enumdepth \@ne
%       \edef\@enumctr{enum\romannumeral\the\@enumdepth}\list
%       {\csname label\@enumctr\endcsname}{\usecounter
%         {\@enumctr}\def\makelabel##1{\hss\llap{##1}}
%          \parsep \z@ \itemsep \z@
%          \ifnum \@enumdepth > 1 \topsep \z@ \fi}\fi}
%
% \let\endoutline =\endlist

\typeout{.....dbt included milestone charts}
% Used to make milestone charts
% Usage:
%       \begin{milestone}[width,offset]{startmonth-endmonth,tickmonth}
%       \task number (name) \duration start-end \deliverables num num num.
%               ...
%       \end{milestone}
% e.g.
% \begin{milestone}[\hsize,1.3in]{1-36,6}
% \task 1 (Test Bed) \duration 10-22 \deliverables 22.
% \task 2 (PolyAnna) \duration 1-9 \deliverables 9.
% \task 3 (Apply PolyAnna) \duration 10-27 \deliverables 15 21 27.
% \task 4 (Formal) \duration 10-24 \deliverables 13 24.
% \task 5 (Software) \duration 12-36 \deliverables 35 37.
% \end{milestone}
%
% width and offset are optional

\newcount\mile@i
\newcount\mile@j
\newcount\mile@startmonth
\newcount\mile@endmonth
\newcount\mile@major
\newdimen\mile@month
\newdimen\mile@width
\newdimen\mile@shift
\newdimen\mile@trheight
\newdimen\mile@trdepth
% axis height is \fontdimen22\textfont2
\edef\mile@axisheight{\fontdimen22\textfont2}
%\mile@trheight1ex\mile@trheight=0.5\mile@trheight\mile@trdepth-\mile@trheight
%\mile@trheight\mile@axisheight\mile@trdepth-\mile@trheight
\advance\mile@trheight0.7pt\advance\mile@trdepth0.7pt

\def\mile@tick#1{\vrule height #1pt depth #1pt}
\def\mile@smalltick#1{\vrule width .2pt height 0pt depth #1pt}
%
\def\mile@segment{\mile@j=1\hbox
to\mile@major\mile@month{\loop\ifnum\mile@j<\mile@major\advance\mile@j
        by 1\hrulefill\mile@smalltick4\repeat\hrulefill\mile@tick4}}
%
\def\mile@toprule{\message{Top Rule...}
    \mile@i=\mile@startmonth
        \hbox{\hskip\mile@shift
            \hbox to\mile@offset{\hss {\sc Month\ }\hskip1\mile@month}%
            \strut
            \loop
                \llap{\hbox to \mile@month{\hss\the\mile@i\hss}}%
            \ifnum\mile@i<\mile@endmonth
                \advance\mile@i by\mile@major \hskip\mile@major\mile@month
\repeat}%
        \mile@i=\mile@startmonth
        \hbox{\hskip\mile@shift\hskip\mile@offset\mile@tick4%
            \loop\ifnum\mile@i<\mile@endmonth
                \advance\mile@i by\mile@major\hbox
to\mile@major\mile@month{\mile@segment}\repeat}\vskip\baselineskip
}

\def\mile@taskrule#1-#2.{\hbox to 0pt{\count255=#1\advance\count255-1%
    \hskip\count255\mile@month
    \count255-\count255\advance\count255by#2%
    \vrule height\mile@trheight depth\mile@trdepth width
\count255\mile@month\hss}}
%
\def\mile@deliver#1{\hbox to 0pt{\hskip#1\mile@month\mile@pointer\hss}}
%
\def\mile@pointer{\setbox0=\hbox to 0pt{\hss\hskip1pt$\triangle$\hss}%
    \dimen0=\ht0\advance\dimen0 by\mile@trdepth
    \advance\dimen0by2pt\lower\dimen0\box0}

% Lists begin with ! end with space and are separated by spaces
\def\mile@lop#1\to#2{\expandafter\mile@lopoff#1\mile@lopoff#1#2}
\long\def\mile@lopoff!#1 #2\mile@lopoff#3#4{\def#4{#1}\def#3{!#2}%
    \ifx\mile@bang#3\let#3=\mile@emptylist\fi}
\def\mile@emptylist{! }\def\mile@bang{!}

\newif\ifmile@full % Tells whether a list has anything in it

\def\mile@centerspace{\leftskip=0pt plus4em%
    \rightskip=\leftskip\parindent=0pt\parfillskip=0pt}

\def\task #1 (#2) \duration #3 \deliverables #4.{
    \message{Task #1...}
    \def\mile@durations{!#3 }\def\mile@deliverables{!#4 }
    \hbox{\hskip\mile@shift
    \hbox to\mile@offset{\hss$\vcenter{\hsize=\mile@offset\let\\=\break
        \mile@centerspace {\bf Task #1}\break (#2)\par}$\hss}%
    \loop
    \ifx\mile@durations\mile@emptylist\mile@fullfalse\else\mile@fulltrue\fi
        \ifmile@full\mile@lop\mile@durations\to\mile@duration
        \expandafter\mile@taskrule\mile@duration.\repeat
    \loop
\ifx\mile@deliverables\mile@emptylist\mile@fullfalse\else\mile@fulltrue\fi
        \ifmile@full
\mile@lop\mile@deliverables\to\mile@deliverable
        \mile@deliver{\mile@deliverable}\repeat
    }\vskip\baselineskip
}

\def\@milestone[#1,#2]#3{\mile@setmonths#3\mile@width=#1\def\mile@offset{#2}
    \mile@shift=\hsize\advance\mile@shift by-\mile@width
    \mile@shift=0.5\mile@shift
    \advance\mile@width by -\mile@offset
    \count255=\mile@endmonth\advance\count255-\mile@startmonth
    \mile@month=\mile@width \divide\mile@month by\count255
    \vskip\baselineskip
    \mile@toprule}
\def\endmilestone{\par The triangles ($\triangle$) indicate when
deliverables are due.\par\vskip\baselineskip}
\def\mile@setmonths#1-#2,#3{\mile@startmonth=#1\advance\mile@startmonth-1
   \mile@endmonth=#2\mile@major=#3}
\def\milestone{\@ifnextchar [{\@milestone}{\@milestone[6.2in,1.4in]}}

% End milestone charts...

%***** eof *****
