%   phase1.sty      (Be sure to use this name when saving the file!)
%
%   Style file for HST Phase One proposals.
%
%   This version is for Cycle 11, June 11, 2001 Version 01..
%
%   There are two main types of proposals:  observing proposals
%   and archival research proposals.  This style file is for
%   both types since there is a large amount of overlap between
%   the two.  Only observing proposals refer to orbit requests,
%   and have a tabular summary of observations.  Only archival
%   proposals have budget related information and require
%   signatures.

%   The output consists of:
%
%        1. A header page containing the proposal title, identifying
%           the PI, proposal and scientific categories, a total
%           budget figure for archival proposals or a table of
%           orbit requests by cycle for observing proposals, and
%           the abstract.  The instructions say that the size of
%           the abstract is limited by the constraint that it fit
%           on the first page.
%
%   Page 2. A tabular list of all of the investigators on the 
%           proposal, and a tabular summary of the observations
%           for observing proposals, or budget related stuff
%           for archival proposals (authorizing officer, signature
%           spaces, and stuff like that).
%
%   Page 3. The "General Questions" responses.  Scientific
%           justification and so on.  Allowed to spill over onto
%           a Page 4.

%   Harry Payne                       
%   Space Telescope Science Institute
%   3700 San Martin Drive
%   Baltimore, MD 21218 USA
%
%    Internet: payne@stsci.edu
%        SPAN: STSCIC::PAYNE (6559::PAYNE)
%       Phone: (410) 338-4539
%        ICBM: 76 37' 30"W  39 20' 00"N
%
%   Version 1.32		Wed May 16 12:54:09 EDT 2001

%   VERSION CONTROL
%
%   Version control (ha!).  In theory, just change the cycle
%   counter.  Actually, there is stuff in the templates that
%   will have to change, but nothing else here.
%
\newcounter{cycle}
\setcounter{cycle}{11}% <== Current cycle goes here.
%
\newcounter{nextcycle}
    \setcounter{nextcycle}{1}
    \addtocounter{nextcycle}{\value{cycle}}
\newcounter{afternext}
    \setcounter{afternext}{2}
    \addtocounter{afternext}{\value{cycle}}
\def\@thiscycle{\alph{cyclecounter}}
\def\@nextcycle{\alph{nextcyclecounter}}
\def\@afternext{\alph{afternextcounter}}

%   INPUT OTHER STYLES
%
%   supertabular.sty allows a long observation summary table
%   to be split across several pages.  The entire style file
%   has been included here, to simplify the distribution.
%
%\input supertabular.sty\relax
%%% ============================================================
%%%  @LaTeX-style-file{
%%%     author-1        = "Braams J.L.",
%%%     author-2        = "Jurriens, T.",
%%%     version         = "3.7b",
%%%     date            = "16 May 1994",
%%%     time            = "16:11:07 MET",
%%%     filename        = "supertabular.sty",
%%%     shortfilename   = "supertab.sty"
%%%     address-1       = "PTT Research
%%%                        St. Paulusstraat 4
%%%                        2264 XZ Leidschendam
%%%                        The Netherlands",
%%%     address-2       = "Rijksuniversiteit Groningen
%%%                        P.O. Box 800
%%%                        9700 AV Groningen
%%%                        The Netherlands",
%%%     telephone       = "(70) 3325051",
%%%     FAX             = "(70) 3326477",
%%%     checksum        = "53924 541 2505 23783",
%%%     email           = "J.L.Braams@research.ptt.nl (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "",
%%%     supported       = "yes",
%%%     abstract        = "A style optioin that implements multi-page
%%%                        tables. The tables have their natural
%%%                        widths on the subsequent pages.",
%%%     docstring       = "The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility.",
%%%  }
%%% ====================================================================
%
% ===> This file can NOT YET be run through LaTeX with the doc option <==
%
% supertabular sty
% original idea:  Theo Jurriens 1988
%                 jurriens@fwn.rug.nl P.O Box 800, 9700 AV Groningen
%
% revised by:     Johannes Braams
%                 J.L.Braams@research.ptt.nl   
%                 PTT Research Leidschendam (NL)
% \def\fileversion{3.7a}
% \def\filename{supertabular sty}
% \def\filedate{1994/05/16}
%
% \changes{v3.7b}{1994/05/16}{Rewrote the page break deciding
%    algorithm again}
% \changes{v3.7b}{1994/05/16}{Started to convert to dtx format}
%
% 05.04.93  - Supertabular didn't work correctly in twocolumn mode.
% V 3.7a      Rewrote the mechanism for establishing the amount of
%             space that supertabular can use. This still needs further
%             thought. The algorithm to compute the places to break
%             the table is still a bit fragile, especially when p{}
%             columns are used.
% 10.07.92  - Still a problem in the combination of supertabular 
% V 3.6h      with array.sty. I overlooked the fact that array doesn't 
%             use \@tabulacr anymore and it behaves differently with 
%             respect to \@startparbox.
% 03.07.92  - A problem in the combination of supertabular with 
% V 3.6g      array.sty. It can be solved by removing the \string from 
%             \def\tableformat and passing \tableformat expanded 
%             to \tabular.
% 11.02.92  - Bug found by Michael Heissmeier when p{...} is used.
% V 3.6f      A change in LaTeX.tex didn't find its way into 
%             supertabular.
% 01.08.91  - Take height of tabletail into account when computing the
% V 3.6e      maximum tableheight; add tolerance on first (partial) 
%             page of the supertabular.
% 27.06.91  - Cured bug that made the first part of the table one line
% V 3.6d      shorter than the others. Appeared when supertabular was
%             used in a twocolumn environment.
% 26.06.91  - Made \@process@tablecaption a global macro. Previous 
% V 3.6c      caption turned up on a table without one.
% 27.05.91  - Replaced \clearpage with \newpage to make supertabulars 
% V 3.6b      work in a twocolumn environment. This also prevents all 
%             floats from being printed.
% 15.02.91  - Because of the check for the use of tablefirsthead the
% V 3.6a      combination of an \hline in the head and an \hline as 
%             the first thing in the data went wrong. The \futurelet 
%             in the definition of \hline found \fi instead of \hline, 
%             so no \doublerulesep was added. Also had to modify the 
%             way the environments were defined. The blank space (from 
%             the CR after the argument of \supertabular) has to be 
%             gobbled. This can only be done using a construction
%             like \def\command#1 {...}. So removed the use of 
%             \newenvironment
% 04.02.91  - Added the commands \topcaption, \bottomcaption and 
% V 3.6       \tablecaption to include a caption within the supertabular 
%             environment. The default behaviour is to put the caption 
%             before the actual start of the table.
%           - Also added \tablefirsthead and \tablelasttail to let 
%             the user specify a different head for the first page 
%             of the table and for consecutive pages as well as 
%             different tails for first pages and the last one. If 
%             these commands are not used, the default behaviour will 
%             be to use the value of \tablehead end \tabletail
%           - Removed need for the \noalign{\global\let\\=\@stabularcr}
%             commands by storing and resetting \@stabularcr
%
% 16.10.90  Added the supertabular* environment that was in an earlier
% V 3.5     version (2.0) by the original author
%           Reintroduced the version numbering
%
% revised by:     Gabriele Kruljac
%                 kruljac@ds0mpi11   Max-Planck-Institute Stuttgart
%
%
% 06.06.89  Correction: now care is taken of probably existing onecolumn
%           head (title or tables ...) in twocolumn sty.
%
% 10.05.89  Correction: the new \\ definition has been added to the
%           begin of each `sub'-tabular
%           Added: algorithm to produce the tabulars in twocolumn style
%
% 06.04.89  Correction: put \global statement in \end{supertabular}
%           into \noalign
%
% 22.02.89  Correction: restore the original meaning of \\ with
%           \end{supertabular}
%
% (Feb 89) The whole algorithm has been changed, so that I can use
%          the most features of a normal tabular:
%          \\  for new line, including  \\[#1]
%          p{...} in the preamble ...
%          Account is taken to \baselinestretch and \arraystretch
%         -I'm not counting the lines because of too much rounding errors
%          but instead I add the (estimated) used space in pt.
%         -The tablehead is taken into this algorithm of proofing, so
%          I really know how much space the head uses.
%         -When no p-arg is given I add a variable \midlineheight to
%          calculate the used space. To calculate \midlineheight I
%          take the \baselineskip, which is active when the supertabular
%          starts (\baselineskip includes the \value of \baselinestretch)
%          and multiply it with \arraystretch.
%         -When a p-arg is given the text will be stored in a box. So
%          I know the height I have to add. Also I reduce the maximum
%          pagesize, so that the last parbox on a page can get up to
%          max 4 lines without producing an overfull vbox.
%         -To do so I had to make some additions to LaTeX's tabular
%          commands. These new commands got a leading `s'.
%
%          Weak points:
%          -When the material of a normal entry (not a p-arg) becomes
%           larger than the estimated \midlineheight, overfull vboxes
%           will be produced at all.
%          -When the last p-arg on a page gets more than 4 lines
%           (probably even more than 3 lines) it will result in an
%           overfull vbox.
%           Also some combinations of \baselinestretch \arraystretch and
%           a large font may lead to one line too much.
%          -if accidentally the last line of the tabular produces
%           a newpage, on the next page the tabletail will be written
%           immediately after the tablehead. Depending on the contents
%           this may result in an error message regarding misplaced
%           \noalign.
%
%           A quick but not very elegant solution: shrink \maxsize by
%           \noalign{\global\maxsize=...pt} after the first \\ of the
%           supertabular.
%
%---------------------------------------------------------------------
% \begin{macro}{\topcaption}
% \begin{macro}{\bottomcaption}
%    The user-commands |\topcaption| and |\bottomcaption| set the
%    boolean  |@topcaption| to determine where to put the
%    tablecaption. The default  is to put the caption on the top of
%    the table 
%    \begin{macrocode}
%    \begin{macrocode}
\newif\if@topcaption \@topcaptiontrue
\def\topcaption{\@topcaptiontrue\tablecaption}
\def\bottomcaption{\@topcaptionfalse\tablecaption}
%    \end{macrocode}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\tablecaption}
%    This command has to function exactly like |\caption| does except
%    it has to store its argument (and the optional argument) for
%    later processing \emph{within} the supertabular environment. 
%
%    \begin{macrocode}
\long\def\tablecaption{%
  \refstepcounter{table} \@dblarg{\@xtablecaption}}
\long\def\@xtablecaption[#1]#2{%
  \long\gdef\@process@tablecaption{\@stcaption{table}[#1]{#2}}}
\global\let\@process@tablecaption\relax
%    \end{macrocode}
% \end{macro}
%
% This is a redefinition of LaTeX's \@caption, \@makecaption is
% called within a group so as not to return to \normalsize globally.
% also a fix is made for the `feature' of the \@makecaption of 
% article.sty and friends that a caption ALWAYS gets a \vskip 10pt 
% at the top and NONE at the bottom. If a user wants to precede his 
% table with a caption this results in a collision.
%
%    \begin{macrocode}
\long\def\@stcaption#1[#2]#3{\par%
  \addcontentsline{\csname ext@#1\endcsname}{#1}%
                  {\protect\numberline{%
                      \csname the#1\endcsname}{\ignorespaces #2}}
  \begingroup
    \@parboxrestore
    \normalsize
    \if@topcaption \vskip -10pt \fi
    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
    \if@topcaption \vskip 10pt \fi
  \endgroup}
%    \end{macrocode}
%
%    |\tablehead| activates the new tabular |\cr| commands.
%    \begin{macrocode}
\newcommand\tablehead[1]{\gdef\@tablehead{#1}}
\tablehead{}
\newcommand\tablefirsthead[1]{\gdef\@table@first@head{#1}}
%    \end{macrocode}
%
%
%    If the user uses an extra amount of tabular-data (like
%    \|multicolumn|) in |\tabletail| \TeX\ starts looping because of
%    the definition of |\nextline|. So make |\\| act like just a |\cr|
%    inside this tail to prevent the loop.  Save and restore the value
%    of |\\|
%
%    \begin{macrocode}
\newcommand\tabletail[1]{%
  \gdef\@tabletail{%
    \noalign{%
      \global\let\@savcr=\\
      \global\let\\=\cr}%
    #1%
    \noalign{\global\let\\=\@savcr}}}
\tabletail{}
\newcommand\tablelasttail[1]{\gdef\@table@last@tail{#1}}
%    \end{macrocode}
%
%  \begin{macro}{\sttraceon}
% \changes{v3.7b}{1994/05/16}{Added macro}
%  \begin{macro}{\sttraceoff}
% \changes{v3.7b}{1994/05/16}{Added macro}
%    There now is a possiblity to follow the decisions supertabular
%    makes about breaking the tabular. This has to be enabled when
%    converting this file with \texttt{docstrip} to a \texttt{.sty}
%    file. 
%    \begin{macrocode}
%<tracing>\newif\if@st@trace
%<tracing>\newcommand\sttraceon{\@st@tracetrue}
%<tracing>\newcommand\sttraceoff{\@st@tracefalse}
%<tracing>\newif\if@st@trace
%    \end{macrocode}
%    The default is to turn tracing off
%    \begin{macrocode}
%<tracing>\sttraceoff
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\@sttrace}
%    A macro that gets the trace message as its argument
%    \begin{macrocode}
%<tracing>\newcommand\@sttrace[1]{\if@st@trace\typeout{ST trace: #1}\fi}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\page@left}
% \changes{v3.7b}{1994/05/16}{Renamed from \cmd\maxsize}
%    This register holds the estimate of the amount of space left over
%    on the current page. This is used in the decision when to start a
%    new page.
%    \begin{macrocode}
\newdimen\page@left
%    \end{macrocode}
%  \end{macro}
%
%    \begin{macrocode}
\newdimen\actsize            % actual pagesize
\newdimen\@tailht            % height of table tail (if any)
\newdimen\parboxheight       % height plus depth of a parbox-argument
\newdimen\addspace           % stores the value of \\[#1]
\newdimen\midlineheight      % estimated size of a normal line
\newdimen\pargcorrection     % to set page height tolerance if p-arg
\newdimen\computedimens      % computation variable
\newbox\tabparbox
%    \end{macrocode}
%
%  \begin{macro}{\@stabularcr}
%  \begin{macro}{\@sxtabularcr}
%    These are redefinitions of |\@tabularcr| and |\@xtabularcr|. This
%    is needed to include |\nextline| in the definition of
%    |\@xtabularcr|. 
%
%    All redefined macros have names that are similar to the original
%    names, except with a leading 's'
%    \begin{macrocode}
\def\@stabularcr{{\ifnum0=`}\fi\@ifstar{\@sxtabularcr}{\@sxtabularcr}}
\def\@sxtabularcr{%
  \@ifnextchar[{\@sargtabularcr}{\ifnum0=`{\fi}\cr\nextline}}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%    \begin{macrocode}
\def\@sargtabularcr[#1]{%
  \ifnum0=`{\fi}%
  \ifdim #1>\z@
    \unskip\@sxargarraycr{#1}
  \else 
    \@syargarraycr{#1}%
  \fi}
%    \end{macrocode}
%
%    In this case we need to copy the value of the optional argument
%    of |\\| in our private register |\addspace|.
%    \begin{macrocode}
\def\@sxargarraycr#1{%
  \@tempdima #1\advance\@tempdima \dp \@arstrutbox
  \vrule \@height\z@ \@depth\@tempdima \@width\z@ \cr
  \noalign{\global\addspace=#1}\nextline}
%    \end{macrocode}
%
%    Here we need to insert |\nextline|
%    \begin{macrocode}
\def\@syargarraycr#1{\cr\noalign{\vskip #1\global\addspace=#1}\nextline}
%    \end{macrocode}
%
%    The macros that deal with parbox columns need to be redefined,
%    because we need to know the size of the parbox. Also the maximum
%    size of the tabular on this page is shrunk somewhat.
%    \begin{macrocode}
\def\@sstartpbox#1{%
  \global\advance\page@left by -\pargcorrection
  \global\pargcorrection=0pt
%    \end{macrocode}
%    To achieve our goal we need to save the text in box.
%    \begin{macrocode}
  \setbox\tabparbox\vtop\bgroup\hsize#1\@arrayparboxrestore}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@sastartpbox#1{%
  \bgroup\hsize#1%
  \global\advance\page@left by -\pargcorrection
  \global\pargcorrection=0pt
  \setbox\tabparbox\vtop\bgroup\hsize#1\@arrayparboxrestore}
%    \end{macrocode}
%
% 11/03/92 JB: The following change didn't find its way into the
%              \@sendpbox command. This caused a difference in 
%              linespacing between a supertabular and a normal 
%              tabular.
% \def\@endpbox{\unskip\strut\par\egroup\hfil}
% % 14 Jan 89: Def of \@endpbox changed from
% %    \def\@endpbox{\par\vskip\dp\@arstrutbox\egroup\hfil}
% % so vertical spacing works out right if the last line of a `p' 
% % entry has a descender.
%    \begin{macrocode}
\def\@sendpbox{%
  \unskip\strut\par\egroup
  \computedimens=\ht\tabparbox
  \advance\computedimens by \dp\tabparbox
  \ifnum\parboxheight<\computedimens
    \global\parboxheight=\computedimens
  \fi
  \computedimens=\z@
  \box\tabparbox\hfil}
\def\@saendpbox{%
  \unskip\strut\par\egroup
  \computedimens=\ht\tabparbox
  \advance\computedimens by \dp\tabparbox
  \ifnum\parboxheight<\computedimens
    \global\parboxheight=\computedimens
  \fi
  \computedimens=\z@
  \unvbox\tabparbox\egroup}
%    \end{macrocode}
%
%         %%%%  Here start really new supertabular commands   %%%%
%
% \begin{macro}{\calmidlineheight}
%    Estimates the height of normal line taking |\arraystretch| into
%    account.
%    \begin{macrocode}
\def\calmidlineheight{%
  \midlineheight=\arraystretch \baslineskp
  \global\advance\midlineheight by 1\p@
%<tracing>  \@sttrace{Average line height:\the\midlineheight}%
  \global\pargcorrection=4\midlineheight
%<tracing>  \@sttrace{Correction for p columns: \the\pargcorrection}%
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@calfirstpageht}
% \changes{v3.7a}{1993/04/05}{Renamed from \cmd\calpage}
%    Estimates the space left on the current page and decides whether
%    the tabular can be started on this page or on a new page.
%    \begin{macrocode}
\def\@calfirstpageht{%
%<tracing>  \@sttrace{Calculating height of tabular on first page}
%    \end{macrocode}
%    The \TeX\ register |\pagetotal| contains the height of the page
%    sofar, the \LaTeX\ register |\@colroom| contains the height of
%    the column.
%    \begin{macrocode}
  \global\actsize\pagetotal
  \global\page@left\@colroom
%<tracing>  \@sttrace{pagetotal = \the\pagetotal; 
%<tracing>            page@left = \the\page@left}%
%    \end{macrocode}
%    When we are in twocolumn mode \TeX\ may still be collecting
%    material for the first column although there seems to be no space
%    left. In this case we have to check against two times |\page@left|.
%    \begin{macrocode}
  \if@twocolumn
%<tracing>    \@sttrace{two column mode}%
    \if@firstcolumn
%<tracing>     \@sttrace{First column}%
      \ifnum\actsize > \page@left 
        \global\maxsize=2\page@left
        \ifnum\actsize > \page@left
          \newpage\@calnextpageht
%<tracing>          \@sttrace{starting new page}%
        \else
%    \end{macrocode}
%    In this case we're in the second column, so we have to compensate
%    for the material in the first column.
%    \begin{macrocode}
%<tracing>     \@sttrace{Second column}%
          \global\advance\page@left -\actsize
          \global\advance\page@left -\@colroom
        \fi
      \fi
    \fi
  \else
%    \end{macrocode}
%    In one column mode there is a simple decision.
%    \begin{macrocode}
%<tracing>    \@sttrace{one column mode}%
    \ifnum\actsize > \page@left
%<tracing>      \@sttrace{starting new page}%
      \newpage\@calnextpageht
%    \end{macrocode}
%    When we are not starting a new page subtract the size of the
%    material already on it from the available space.
%    \begin{macrocode}
    \else
      \global\advance\page@left by -\actsize
      \global\actsize\z@
    \fi
  \fi
%    \end{macrocode}
%    To decide when to start a new page, we need to know the vertical
%    size of the tail of the table.
%    \begin{macrocode}
  \ifx\empty\@tabletail
    \@tailht=\z@
  \else
    \setbox\@tempboxa=\vbox{\@arrayparboxrestore%
      \expandafter\tabular\expandafter{\tableformat}
        \@tabletail\endtabular}
    \@tailht=\ht\@tempboxa\advance\@tailht\dp\@tempboxa
  \fi
%    \end{macrocode}
%    We add the average height of a line to this because when we
%    decide to continue the tabular we need to have enough space left
%    for one line an the tail.
%    \begin{macrocode}
  \advance\@tailht by \midlineheight
%<tracing>  \@sttrace{Height of tail: \the\@tailht}
%<tracing>  \@sttrace{Maximum height of tabular: \the\page@left}
}
                             % Here is the definition of supertabular
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@calnextpageht}
% \changes{v3.7a}{1993/04/05}{Macro added}
%    This calculates the maximum height of the tabular on all
%    subsequent pages of the supertabular environment. The correction
%    for parbox columns is somewhat smaller then on the first page of
%    the environment
%    \begin{macrocode}
\def\@calnextpageht{%
%<tracing>  \@sttrace{Calculating height of tabular on next page}
  \global\page@left\@colroom
  \global\pargcorrection=2\midlineheight
%<tracing>  \@sttrace{Correction for p columns: \the\pargcorrection}%
  \global\actsize=\z@
%<tracing>  \@sttrace{Maximum height of tabular: \the\page@left}
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\supertabular}
%    We start by saving the preamble of the tabular in a macro.
%    \begin{macrocode}
\def\supertabular#1 {%
  \def\tableformat{#1}
%<tracing>  \@sttrace{Starting a new supertabular}
%    \end{macrocode}
%    Then remember that this is not a \textsf{supertabular*}
%    environment.
%    \begin{macrocode}
  \global\starfalse
%    \end{macrocode}
%    If the caption should come at the top we insert it here.
%    \begin{macrocode}
  \if@topcaption \@process@tablecaption \fi
%    \end{macrocode}
%    Save the original definition of |\\|.
%    \begin{macrocode}
  \global\let\@oldcr=\\
%    \end{macrocode}
%    Save the current value of |\baselineskip|, as we need it in the
%    calculation of the average height of a line. 
%    \begin{macrocode}
  \def\baslineskp{\baselineskip}%
  \calmidlineheight
  \@calfirstpageht
%    \end{macrocode}
%    We have to check whether \texttt{array.sty} was loaded, because
%    some of the internal macros have different names.
%    \begin{macrocode}
  \ifx\undefined\@classix
%    \end{macrocode}
%    Save old |\@tabularcr| and insert the definition of
%    |\@stabularcr|. 
%    \begin{macrocode}
      \let\@@tabularcr\@tabularcr
      \let\@tabularcr\@stabularcr
%    \end{macrocode}
%    Activate the new parbox algorithm.
%    \begin{macrocode}
      \let\@@startpbox=\@sstartpbox
      \let\@@endpbox=\@sendpbox
  \else
%    \end{macrocode}
%    When \texttt{array.sty} was loaded things are a bit different.
%    \begin{macrocode}
      \let\@@tabularcr\@arraycr
      \let\@arraycr\@stabularcr
      \let\org@startpbox=\@startpbox
      \let\org@endpbox=\@endpbox
      \let\@startpbox=\@sastartpbox
      \let\@endpbox=\@saendpbox
  \fi
%    \end{macrocode}
%
%    Moved the check for the use of \tablefirsthead to befor the 
%    start of the tabular environment in order to make the \futurelet 
%    inside \hline do its work correctly (15.02.91)
%
%    Check if the head of the table should be different for the first
%    and subsequent pages.
%    \begin{macrocode}
    \ifx\@table@first@head\undefined
        \let\@@tablehead=\@tablehead
    \else
        \let\@@tablehead=\@table@first@head
    \fi
%    \end{macrocode}
%    Finally start a normal \textsf{tabular} environment.
%    \begin{macrocode}
    \expandafter\tabular\expandafter{\tableformat}
    \@@tablehead}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endsupertabular}
%    This closes the environment.
%    \begin{macrocode}
\def\endsupertabular{%
  \ifx\@table@last@tail\undefined
    \@tabletail
  \else
    \@table@last@tail
  \fi
  \endtabular
%    \end{macrocode}
%    Restore the original definition of |\@tabularcr|
%    \begin{macrocode}
  \ifx\undefined\@classix
    \let\@tabularcr\@@tabularcr
  \else
    \let\@arraycr\@@tabularcr
    \let\@startpbox=\org@startpbox
    \let\@endpbox=\org@endpbox
  \fi
%    \end{macrocode}
%    Check if we have to insert a caption and restore to default
%    behaviour of putting captions at the top.
%    \begin{macrocode}
  \if@topcaption
  \else
    \@process@tablecaption
    \@topcaptiontrue
  \fi
%    \end{macrocode}
%
%    Restore the meaning of |\\| to the one it had before the start
%    of this environment. Also re-initialize some control-sequences
%
%    \begin{macrocode}
  \global\let\\=\@oldcr
  \let\@table@first@head\undefined
  \let\@table@last@tail\undefined
  \global\let\@process@tablecaption\relax
%<tracing>  \@sttrace{Ended a supertabular}
  }
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\ifstar}
%    This switch is used in the internal macros to remember which
%    kind of environment was started.
%    \begin{macrocode}
\newif\ifstar
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\tabularwidth}
%    For the \textsf{supertabular*} environment it is necessary to
%    store the intended width of the tabular.
%    \begin{macrocode}
\newdimen\tabularwidth
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\supertabular*}
%    We start by saving the intended width and the preamble of the
%    \textsf{tabular*}.
%    \begin{macrocode}
\@namedef{supertabular*}#1#2 {%
%<tracing>  \@sttrace{Starting a new supertabular*}
  \def\tableformat{#2}
  \tabularwidth=#1
  \global\startrue
%    \end{macrocode}
%    If the caption should come at the top we insert it here.
%    \begin{macrocode}
    \if@topcaption\@process@tablecaption\fi
%    \end{macrocode}
%    Save the original definition of |\\|.
%    \begin{macrocode}
  \global\let\@oldcr=\\
%    \end{macrocode}
%    Save the current value of |\baselineskip|, as we need it in the
%    calculation of the average height of a line. 
%    \begin{macrocode}
    \def\baslineskp{\baselineskip}%
    \calmidlineheight
    \@calfirstpageht
%    \end{macrocode}
%    We have to check whether \texttt{array.sty} was loaded, because
%    some of the internal macros have different names.
%    \begin{macrocode}
    \ifx\undefined\@classix
%    \end{macrocode}
%    Save old |\@tabularcr| and insert the definition of
%    |\@stabularcr|. 
%    \begin{macrocode}
      \let\@@tabularcr\@tabularcr
      \let\@tabularcr\@stabularcr
%    \end{macrocode}
%    Activate the new parbox algorithm
%    \begin{macrocode}
      \let\@@startpbox=\@sstartpbox
      \let\@@endpbox=\@sendpbox
    \else
%    \end{macrocode}
%    When \texttt{array.sty} was loaded things are a bit different.
%    \begin{macrocode}
      \let\@@tabularcr\@arraycr
      \let\@arraycr\@stabularcr
      \let\org@startpbox=\@startpbox
      \let\org@endpbox=\@endpbox
      \let\@startpbox=\@sastartpbox
      \let\@endpbox=\@saendpbox
    \fi
%    \end{macrocode}
%
%    Check if the head of the table should be different for the first
%    and subsequent pages.
%    \begin{macrocode}
    \ifx\@table@first@head\undefined
        \let\@@tablehead\@tablehead
    \else
        \let\@@tablehead\@table@first@head
    \fi
%    \end{macrocode}
%    Finally start a normal \textsf{tabular*} environment.
%    \begin{macrocode}
    \expandafter\csname tabular*\expandafter\endcsname
    \expandafter{\expandafter\tabularwidth\expandafter}%
    \expandafter{\tableformat}%
    \@@tablehead}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endsupertabular*}
%    This closes the environment.
%    \begin{macrocode}
\@namedef{endsupertabular*}{%
  \ifx\@table@last@tail\undefined
    \@tabletail
  \else
    \@table@last@tail
  \fi
  \csname endtabular*\endcsname
%    \end{macrocode}
%    Restore the old definition of |\@tabularcr|.
%    \begin{macrocode}
  \ifx\undefined\@classix
    \let\@tabularcr\@@tabularcr
  \else
    \let\@arraycr\@@tabularcr
    \let\@startpbox=\org@startpbox
    \let\@endpbox=\org@endpbox
  \fi
%    \end{macrocode}
%    Check if we have to insert a caption and restore to default
%    behaviour of putting captions at the top.
%    \begin{macrocode}
  \if@topcaption
  \else
    \@process@tablecaption
    \@topcaptiontrue
  \fi
%    \end{macrocode}
%
%    Restore the meaning of |\\| to the one it had before the start
%    of this environment. Also re-initialize some control-sequences
%
%    \begin{macrocode}
  \global\let\\=\@oldcr
  \let\@table@first@head\undefined
  \let\@table@last@tail\undefined
  \global\let\@process@tablecaption\relax
%<tracing>  \@sttrace{Ended a supertabular*}
    }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\nextline}
%    This macro is called by each |\\| inside the tabular environment.
%    It updates the estimate of the amount of space left on the
%    current page and starts a new page if necessary.
%    \begin{macrocode}
\def\nextline{%
  \noalign{%
    \ifnum\parboxheight<\midlineheight
%    \end{macrocode}
%    If there is a non-empty line, but an empty parbox, then
%    |\parboxheight| might be non-zero, but too small thereby breaking
%    the algorithm. Therefore we estimate the height of the line to be
%    |\midlineheight| in this case.
%    \begin{macrocode}
      \global\advance\page@left -\midlineheight
%    \end{macrocode}
%    |\addspace| is the value of the optional argument of |\\|.
%    \begin{macrocode}
      \global\advance\page@left -\addspace
    \else
%    \end{macrocode}
%    When the parbox was not empty we take into account its height
%    (plus a bit extra).
%    \begin{macrocode}
%<tracing>     \@sttrace{Added par box with height \the\parboxheight}%
      \global\advance\page@left -\parboxheight
      \global\advance\page@left -0.1\parboxheight
      \global\parboxheight\z@
    \fi
    \global\addspace=\z@
%<tracing>    \@sttrace{Space left for tabular: \the\page@left}
  }
%    \end{macrocode}
%    When there is not enough space left we start a new page.
%    \begin{macrocode}
  \ifnum\page@left<\@tailht
    \st@newpage
  \else
%    \end{macrocode}
%    
%    This line is necessary because the tablehead has to be inserted
%    *after* the |\if\else\fi|-clause. For this purpose |\st@next| is
%    used. In the middle of tableprocessing it shoud be an *empty*
%    macro (*not* |\relax|).  (15.2.91)
%    \begin{macrocode}
    \noalign{\global\let\st@next\@empty}%
  \fi\st@next}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\st@newpage}
% \changes{v3.7b}{1994/05/16}{Added macro, split off from
%    \cmd\nextline}
%    This macro performs the actions necessary to start a new page.
%    \begin{macrocode}
\def\st@newpage{%
%<tracing>  \noalign{\@sttrace{Starting new page, writing tail}}
%    \end{macrocode}
%    Output |\tabletail|, close the tabular environment, output all
%    material and start a fresh new page.
%    \begin{macrocode}
  \@tabletail
  \ifstar
    \csname endtabular*\endcsname
  \else
    \endtabular
  \fi
%  \if@twocolumn
%    \if@firstcolumn
%      \newpage\@calnextpageht
%      \global\actsize=\z@
%    \else
%      \newpage\@calnextpageht
%    \fi
%  \else
    \newpage\@calnextpageht
%  \fi
  \let\st@next\@tablehead
%<tracing>  \@sttrace{writing head}
  \ifstar
    \expandafter\csname tabular*\expandafter\endcsname
    \expandafter{\expandafter\tabularwidth\expandafter}%
    \expandafter{\tableformat}%
  \else
    \expandafter\tabular\expandafter{\tableformat}%
  \fi}
%    \end{macrocode}
%
%   end of supertabular.sty

%   EPS FIGURE SUPPORT
%
%   We will support the incorporation of PostScript figures in
%   the manner of AASTeX.  This means we will assume the presence
%   of the Rokicki dvips package, and use specials with that
%   syntax.  So, taken from aaspp.sty:
%
% Include Rokicki's epsf.sty file explicitly.
% 
\@ifundefined{epsfbox}{\input{epsf.sty}}{\relax}
% 
% Simplified EPS inclusion macros so we can see how
% this goes...  These are layered on Rokicki's dvips
% material, and are dependent on the author's use of
% that DVI driver.
% 
%    \plotone{EPSFILE} \plottwo{EPSFILE}{EPSFILE}
%    \plotfiddle{EPSFILE}{VSIZE}{ROT}{HSF}{VSF}{HTRANS}{VTRANS}
% 
% \plotone inserts the plot in a space that is
% \columnwidth wide; the plot is scaled so the
% horizontal dimension fits in the text width, and the
% vertical dimension is scaled to maintain the aspect
% ratio.  \plottwo inserts two plots next to each other
% in one \columnwidth, sort of like "two-up" mode.
% 
%    EPSFILE    name of file with EPS
% 
% The following arguments are for the \plotfiddle macro
% which formats the \special itself, prepares vspace,
% etc.  This completely bypasses Rokicki's macros that
% attempt to rationalize the EPS BoundingBox with the
% LaTeX page dimensions.
% 
%
%    VSIZE      vertical white space to allow for plot
%    ROT        rotation angle
%    HSF        horiz scale factor
%    VSF        vert scale factor
%    HTRANS     horiz translation
%    VTRANS     vert translation
% 
%\epsfverbosetrue
% 
% From Jeannette, to be in AASTeX version 4.0
% 
\def\eps@scaling{.95}
\def\epsscale#1{\gdef\eps@scaling{#1}}
\def\plotone#1{\centering \leavevmode
    \epsfxsize=\eps@scaling\columnwidth \epsfbox{#1}}
\def\plottwo#1#2{\centering \leavevmode
    \epsfxsize=.45\columnwidth \hbox{\epsfbox{#1}} \hfil
    \epsfxsize=.45\columnwidth \epsfbox{#2}}
\def\plotfiddle#1#2#3#4#5#6#7{\centering \leavevmode
    \vbox to#2{\rule{0pt}{#2}}
    \special{psfile=#1 voffset=#7 hoffset=#6 vscale=#5 hscale=#4 angle=#3}}

%   PAGE LAYOUT
%
%   Hopefully, everything will fit on an A4
%   page, although the right margin may be a bit cramped.
%
\headheight 40pt
\headsep 30pt
\oddsidemargin 0pt
\parindent 2em
\topmargin -33pt
\textwidth 6.5in
\textheight 8.5in
\raggedbottom

%   TABLE JUSTIFICATION
%
%   Here is the magic code from Chris Biemesderfer allowing p boxes 
%   in tables NOT be right justified.  The difference from the
%   definition of @arrayparboxrestore in latex.tex is changing
%   \rightskip and \@rightskip from zero to \@flushglue.
%
\def\@arrayparboxrestore{\let\par\@@par
    \let\-\@dischyph \let\'\@acci \let\`\@accii \let\=\@acciii
    \parindent\z@ \parskip\z@ \everypar{}\linewidth\hsize
    \@totalleftmargin\z@ \leftskip\z@
    \rightskip\@flushglue \@rightskip\@flushglue
    \parfillskip\@flushglue \lineskip\normallineskip
    \baselineskip\normalbaselineskip\sloppy}

%   PAGE HEADINGS
%
%   Page headings slightly altered from the myheadings page style
%   to allow the PI and title to be stacked in a \vbox.  The first
%   page has it's own page style, identifying the proposal
%   category, and without a page number.
%
\def\ps@hstfirst{%
    \let\@mkboth\@gobbletwo
    \def\@oddhead{\hbox to \textwidth{Hubble Space Telescope\hfil%
        Cycle \thecycle~\@propcat~Proposal}}
    \let\@evenhead\@oddhead
    \def\@oddfoot{}
    \def\@evenfoot{}
    \def\sectionmark##1{}
    \def\subsectionmark##1{}}
\def\ps@hstheadings{%
    \let\@mkboth\@gobbletwo
    \def\@oddhead{\hbox to \textwidth{\hfil%
        \llap{\parbox[b]{\textwidth}{\raggedleft\@PIhonorific\@PIfirstname~
            \@PIlastname\@PIsuffix
        \\\@title}}}}
    \let\@evenhead\@oddhead
    \def\@oddfoot{\hfil\rm\thepage\hfil}
    \let\@evenfoot\@oddfoot
    \def\sectionmark##1{}
    \def\subsectionmark##1{}}
\pagestyle{hstheadings}
\thispagestyle{hstfirst}

%   FOOTNOTES
%
%   Changes for footnotes.  The observation summary and 
%   investigator list tables are set within minipages to keep 
%   the footnotes close to the table, if they are used.  Set 
%   \footins to 0pt to keep them REALLY close.
%
\def\thefootnote{\arabic{footnote}}
\def\thempfootnote{\arabic{mpfootnote}}
\let\footnotesize\small
\let\footnoterule\relax
\skip\@mpfootins 0pt plus 4pt minus 2pt

%   CAPTIONS
%
%   There was a request that captions be in a smaller size than
%   the running text.  Here, it is set to \small.
%
\long\def\@makecaption#1#2{%
  \vskip 10pt
  \sbox\@tempboxa{\small #1: #2}%
  \ifdim \wd\@tempboxa >\hsize
    \small #1: #2\par
  \else
    \global \@minipagefalse
    \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip 10pt}

%   SECTIONING COMMANDS
%
%   It would be nice to allow proposers to use sectioning commands
%   when composing long replies---in the scientific justification,
%   for example.  Make sure they are less conspicuous than the
%   headers for each question.
%
\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus 
 -.2ex}{2.3ex plus .2ex}{\normalsize\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus 
 -.2ex}{1.5ex plus .2ex}{\normalsize\it}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus
 -1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize}}

%   COUNTERS
%
%   Used in macros whose arguments are treated as numbers,
%   so we can do arithmetic with them.  An empty argument list
%   is usually taken as supplying a zero.
%
%       \@afternextparallel     parallel orbits, cycle after next
%       \@afternextprimary      primary orbits, cycle after next
%       \@ESAcount              total # of ESA investigators
%       \@grandtotal            total orbits, all cycles
%       \@nextcycleparallel     parallel orbits this cycle
%       \@nextcycleprimary      primary orbits this cycle
%       \@proprietaryperiod     proprietary period: 0,3,6, or 12
%       \@runningtotal          total orbit request in obs summary
%       \@sumofparallel         total parallel orbits, all cycles
%       \@sumofprimary          total primary orbits, all cycles
%       \@thiscycleparallel     parallel orbits this cycle
%       \@thiscycleprimary      primary orbits this cycle
%       \@totalcount            total # of investigators
%       \@totalorbits           total orbits for one source
%       \@totaltargets          total # targets for SNAP
%
\newcount\@afternextparallel    \@afternextparallel=0
\newcount\@afternextprimary     \@afternextprimary=0
\newcount\@ESAcount             \@ESAcount=0
\newcount\@grandtotal           \@grandtotal=0
\newcount\@nextcycleparallel    \@nextcycleparallel=0
\newcount\@nextcycleprimary     \@nextcycleprimary=0
\newcount\@proprietaryperiod    \@proprietaryperiod=-1
\newcount\@runningtotal         \@runningtotal=0
\newcount\@sumofparallel        \@sumofparallel=0
\newcount\@sumofprimary         \@sumofprimary=0
\newcount\@thiscycleparallel    \@thiscycleparallel=0
\newcount\@thiscycleprimary     \@thiscycleprimary=0
\newcount\@totalorbits          \@totalorbits=0
\newcount\@totaltargets         \@totaltargets=0
\newcount\@totalcount           \@totalcount=0

%   MACROS
%
%   Define a whole bunch of string macros, that stuff their
%   arguments away for later use.  Many of the strings hidden 
%   under these macros have highly visible defaults, when typeset, 
%   to remind the preparer to supply a value.
%
%   The arguments of the \aperture, \flags, \instrument, \mode, 
%   \spectralelements, and \target macros are forced into
%   upper case.
%
%       \address{}      Obsolete as of version 1.6
%       \AdminUSPI      yes or no value to identify a US CoI of a 
%                       foreign PI, but which is requesting funding.
%       \AOfirstname{}	AO=Authorizing Official
%       \AOlastname{}
%       \aperture{}     STIS aperture
%	\chandrakiloseconds{}	Requires coordination with Chandra, 
%			 value is Chandra request in kiloseconds.
%       \CoIemail       text field for email address of CoI
%	\CoIfirstname{}
%       \CoIlastname{}  Note that \AOlastname, \CoIlastname and 
%                        \PIlastname use the same hidden string:
%                        \@lastname.
%       \configuration{}
%       \country{}
%       \dec{}          Declination 
%       \email{}        E-mail address, set in \tt font
%       \ESAmember{}    ESA member?  yes or no values
%       \flags{}
%       \formattedsubmission{}
%                       To help with matching the electronic
%                        with formatteded submission
%       \honorific{}    Title, e.g., Dr., Prof., etc.
%       \institution{}  Supposed to fit on one line
%       \instrument{}   Allows building up a list of instruments
%                        by calling repeatedly.
%       \magnitude{}
%       \mode{}
%	\noaonights{}	Special proposal flag indicating coordination
%			 with NOAO, value is NOAO nights requested.
%       \phaseoneZID{}
%       \PIfirstname{}  Principal Investigator
%       \PIlastname{}
%       \postalcode{}   Postal (or zip) code. Example: DK 2740
%       \proposalcategory{}
%                       Must be "AR" to be recognized as an
%                        archival research proposal, "GO" to be 
%                        recognized as a GO proposal, and so on
%                        for SNAP.  EPO for education/public
%                        outreach.
%       \Proprietaryperiod{}
%                       integer value of 0, 3, 6 or 12
%       \pscontactemail Option allows Postscript Contact info to
%                        be passed to us instead of via email to
%                        help desk.  Doesn't need to appear in
%                        formatted version
%       \ra{}           Right ascension 
%       \sciencekeyword{}
%                       Supply science keyword from prescribed
%                       list.  Should be called 1--5 times.
%                       Print an error message if called 0 or >5
%                       times.
%       \sciencepropid{}
%                       Proposal ID for accepted science proposal
%                        corresponding to submitted EPO proposal.
%       \scientificcategory{}
%                       Scientific category, basically to select
%                        the right panel.
%       \spectralelements{}
%                       Usually (?) a list.  Should be comma
%                        separated, with spaces, for best
%                        results.
%       \street{}       Example: 4321 University Avenue
%       \suffix{}       Text field for Jr., Sr., III, etc.
%       \sundries{}     Only if needed (office, location code, etc.
%       \telephone{}
%       \town{}         Example: Anytown
%       \totalbudgetamount{}
%                       For archival research proposals only.
%                        Don't add the dollar sign to the
%                        argument---it gets added for you.
%       \USstate{}      Gets used only if country is "USA"

\def\address#1{\gdef\@address{#1}}
    \gdef\@address{{\bf Please supply a postal address!}}
\def\adduporbits{% 
    %   Compute the sum of all the orbit requests
    \global\advance\@sumofprimary by\@thiscycleprimary
    \global\advance\@sumofprimary by\@nextcycleprimary
    \global\advance\@sumofprimary by\@afternextprimary
    \global\advance\@sumofparallel by\@thiscycleparallel
    \global\advance\@sumofparallel by\@nextcycleparallel
    \global\advance\@sumofparallel by\@afternextparallel
    \global\advance\@grandtotal by \@thiscycleprimary
    \global\advance\@grandtotal by \@thiscycleparallel
    \global\advance\@grandtotal by \@nextcycleprimary
    \global\advance\@grandtotal by \@nextcycleparallel
    \global\advance\@grandtotal by \@afternextprimary
    \global\advance\@grandtotal by \@afternextparallel}
\let\AdminUSPI\@gobble      % Used in database, but not printed
\def\AOfirstname#1{\gdef\@firstname{#1}}
\def\AOlastname#1{\gdef\@lastname{#1}}
\def\ARlegacy#1{%
    \lowercase{\gdef\answer{#1}}
    \ifx\answer\@empty
        \gdef\@ARlegacy{No}
    \else
        \ifx\@yes\answer
            \gdef\@ARlegacy{Yes}
            \gdef\@specialprop{Yes}
        \else
            \gdef\@ARlegacy{No}
        \fi
    \fi}
  \gdef\@ARlegacy{No}
  \gdef\@specialprop{No}
\def\calibprop#1{%
    \lowercase{\gdef\answer{#1}}
    \ifx\answer\@empty
        \gdef\@calibprop{No}
    \else
        \ifx\@yes\answer
            \gdef\@calibprop{Yes}
            \gdef\@specialprop{Yes}
        \else
            \gdef\@calibprop{No}
        \fi
    \fi}
  \gdef\@calibprop{No}
\def\chandrakiloseconds#1{%
    \ifx\empty#1
    \else
        \gdef\@chandrakiloseconds{#1}
    \fi}
    \gdef\@chandrakiloseconds{0}
    \gdef\@jointZero{0}
\let\CoIemail\@gobble       % Used in database, but not printed
\def\CoIfirstname#1{%
    \gdef\@PIorCoI{CoI:}\gdef\@firstname{#1}}
\def\CoIlastname#1{\gdef\@lastname{#1}}
\def\configuration#1{\gdef\@configuration{#1}}
    \gdef\@configuration{{\bf Please supply a configuration!}}
\def\coronoapertures#1{\uppercase{\gdef\@coronoapertures{#1}}}
    \gdef\@coronoapertures{}
\def\country#1{\gdef\@country{#1}\xdef\@countrystate{#1}}
    \def\@countrystate{{\bf Please supply a country!}}
\def\dec#1{\gdef\@dec{#1}}
    \gdef\@dec{Unknown}
\def\email#1{\gdef\@email{#1}}
    \gdef\@email{}
\def\ESAmember#1{%
%   Keep a count of ESA members among the proposers.  If the
%   argument list is empty, take that as a "no".  If the
%   argument list, when lowercased is "yes", then increment
%   the @ESAcount counter.
%   Thanks to Timothy Larkin (tsl1@cornell.edu) for explaining
%   how to make the \lowercase stuff work.
    \lowercase{\gdef\answer{#1}}
    \ifx\answer\@empty
        \xdef\@ESAmember{No}
        \xdef\@ESAflag{}
    \else
        \ifx\answer\@yes
            \global\advance\@ESAcount by1\gdef\@ESAmember{Yes}
            \gdef\@ESAflag{\mbox{$^*$}}
        \else
            \gdef\@ESAmember{No}
            \gdef\@ESAflag{}
        \fi
    \fi}
  \gdef\@yes{yes}
  \gdef\@Yes{Yes}
  \gdef\@ESAmember{No}
  \gdef\@ESAflag{}
\def\flags#1{\uppercase{\gdef\@flags{#1}}}
    \gdef\@flags{}
\def\formattedsubmission#1{\uppercase{\gdef\@formattedsubmission{#1}}}
    \gdef\@formattedsubmission{}
    \gdef\@formatplease{Please select one of the choices for 
        {\tt formattedsubmission}}
\def\honorific#1{%
    \if@doinginvlist%
     \ifx\empty\@lastname\else%
        \invline\\$     % Add a line to the investigator table
        \global\advance\@totalcount by1
     \fi%
    \fi%
    %Note trailing hard space
    \ifx\empty#1\else\gdef\@honorific{#1~}\fi}
    \gdef\@honorific{}
    \gdef\@PIhonorific{}
\def\innovative#1{%
    \lowercase{\gdef\answer{#1}}
    \ifx\answer\@empty
        \gdef\@innovative{No}
    \else
        \ifx\@yes\answer
            \gdef\@innovative{Yes}
            \gdef\@specialprop{Yes}
        \else
            \gdef\@innovative{No}
        \fi
    \fi}
  \gdef\@innovative{No}
\def\institution#1{\gdef\@institution{#1}}
    \gdef\@institution{{\bf Please supply an institution!}}
\def\instrument#1{%
%   \instrument is a little tricky, since we want to allow several
%   calls, and have all of the individual arguments concatenated,
%   with commas in between.  We need to see if one instrument has
%   already been specified, to see whether a comma needs to be 
%   inserted.
    \if@oneinstrumentalready
        \xdef\@itemp{\@instruments}     % Evaluate current value
        \uppercase{\gdef\@instruments{\@itemp, #1}}
    \else
        \@oneinstrumentalreadytrue
        \uppercase{\gdef\@instruments{#1}}
    \fi}
  \def\@instruments{}
  \newif\if@oneinstrumentalready
    \@oneinstrumentalreadyfalse
\def\magnitude#1{\gdef\@magnitude{#1}}
    \gdef\@magnitude{Unknown}
\def\mode#1{\uppercase{\gdef\@mode{#1}}}
    \gdef\@mode{Unknown}
\def\noaonights#1{%
    \ifx\empty#1
    \else
        \gdef\@noaonights{#1}
    \fi}
    \gdef\@noaonights{0}
\def\phaseoneZID#1{\gdef\@ZID{#1}}
    \gdef\@ZID{}
\def\PIfirstname#1{\advance\@totalcount by1%
    \gdef\@PIorCoI{PI:}\gdef\@firstname{#1}\gdef\@PIfirstname{#1}}
    \def\@PIorCoI{Unknown!}
    \def\@PIfirstname{}
\def\PIlastname#1{\gdef\@lastname{#1}\gdef\@PIlastname{#1}}
    \gdef\@lastname{Unknown}
    \gdef\@PIlastname{Unknown}
\def\postalcode#1{\gdef\@postalcode{#1}}
    \gdef\@postalcode{}
\def\proposalcategory#1{%
    \uppercase{\gdef\answer{#1}}
    \ifx\answer\@archival 
        \gdef\@propcat{Archival Research} 
        \@archivaltrue
    \fi
    \ifx\answer\@go
        \gdef\@propcat{General Observer}
        \@gotrue
    \fi
    \ifx\answer\@snap
        \gdef\@propcat{Snapshot Observing} 
        \@gotrue
        \@snaptrue
    \fi
    \ifx\answer\@epo
        \gdef\@propcat{Education and Public Outreach}
        \@epotrue
    \fi
    \ifx\answer\@dd \gdef\@propcat{{\bf Director's Discretionary
        proposals no longer use this template!}} \fi
    }
    \def\@propcat{{\bf Please supply a proposal category!}}
    \newif\if@archival
        \@archivalfalse
    \newif\if@epo
        \@epofalse
    \newif\if@go
        \@gofalse
    \newif\if@snap
        \@snapfalse
    \def\@archival{AR}
    \def\@dd{DD}
    \def\@epo{EPO}
    \def\@go{GO}
    \def\@snap{SNAP}
\def\Proprietaryperiod#1{%
    \ifx\empty#1\else
        \@proprietaryperiod=#1
    \fi}
\let\pscontactemail\@gobble     % Used in database, but not printed
\def\ra#1{\gdef\@ra{#1}}
    \gdef\@ra{Unknown}
\def\sciencekeyword#1{%
%   \sciencekeyword is a bit like the \instrument macro in
%   that it can be called multiple times.  The difference is
%   that there is an upper limit on the number of calls (5).  
%   The default string reminds the users that there is also a
%   lower limit of 1 call.
    \ifx\empty#1\else
      \if@onekeywordalready
        \ifnum\@keywordcount>4
             \immediate\write16{Ignoring sciencekeyword after fifth one}
        \else
            \ifx\empty#1\else
                \xdef\@keytemp{\@keywords}      % Evaluate current value
                \uppercase{\gdef\@keywords{\@keytemp, #1}}
                \global\advance\@keywordcount by 1
            \fi
        \fi
      \else
        \ifx\empty#1\else
            \@keywordcount=1
            \@onekeywordalreadytrue
            \uppercase{\gdef\@keywords{#1}}
        \fi
      \fi
    \fi}
  \def\@keywords{AT LEAST 1 KEYWORD, PLEASE}
  \newcount\@keywordcount       \@keywordcount=0
  \newif\if@onekeywordalready
    \@onekeywordalreadyfalse
\def\sciencepropid#1{\def\@scipropid{#1}}
    \def\@scipropid{{\bf Please supply a science proposal ID!}}
\def\scientificcategory#1{\def\@scicat{#1}}
    \def\@scicat{{\bf Please supply a scientific category!}}
\newif\if@specialpropflagalready
    \@specialpropflagalreadyfalse
\def\spectralelements#1{\uppercase{\gdef\@spectralelements{#1}}}
    \gdef\@spectralelements{Unknown}
\def\street#1{\gdef\@street{#1}}
    \gdef\@street{}
\def\suffix#1{%
    \ifx\empty#1\else\gdef\@suffix{ #1} %Note leading space
    \fi}
    \gdef\@suffix{}
    \gdef\@PIsuffix{}
\def\sundries#1{\gdef\@sundries{#1}}
    \gdef\@sundries{}
\def\theory#1{%
    \lowercase{\gdef\answer{#1}}
    \ifx\answer\@empty
        \gdef\@theory{No}
    \else
        \ifx\answer\@yes
            \gdef\@theory{Yes}
            \gdef\@specialprop{Yes}
        \else
            \gdef\@theory{No}
        \fi
    \fi}
  \gdef\@theory{No}
\def\treasury#1{%
    \lowercase{\gdef\answer{#1}}
    \ifx\answer\@empty
        \gdef\@treasury{No}
    \else
        \ifx\answer\@yes
            \gdef\@treasury{Yes}
            \gdef\@specialprop{Yes}
        \else
            \gdef\@treasury{No}
        \fi
    \fi}
  \gdef\@treasury{No}
\def\telephone#1{\def\@telephone{#1}}
    \def\@telephone{}
\def\town#1{\gdef\@town{#1}}
    \gdef\@town{}
\def\totalbudgetamount#1{\gdef\@totalbudget{\$ #1}}
    \def\@totalbudget{{\bf Please supply a US dollar amount!}}
\def\USstate#1{\gdef\@USstate{#1}
    \ifx\USA\@country
        \xdef\@countrystate{USA/#1}
    \fi}
    \def\@USstate{}
  \def\USA{USA}

%   ORBIT ARITHMETIC
%
%   Orbit macros.  In addition to keeping track of the numbers,
%   we want to keep track of the cycles being proposed for.  We
%   want the table of orbit requests to show only as much info
%   as is really there.  That is, if entries are zero, we would
%   like not to show them.
%
\newif\if@thiscycleonly
    \@thiscycleonlytrue
\newif\if@orbitsnextcycle
    \@orbitsnextcyclefalse
\newif\if@orbitsafternext
    \@orbitsafternextfalse
\def\thiscycleprimary#1{% 
    \ifx\empty#1\else
        \@thiscycleprimary=#1
    \fi}
\def\thiscycleparallel#1{% 
    \ifx\empty#1\else
        \@thiscycleparallel=#1
    \fi}
\def\nextcycleprimary#1{% 
    \ifx\empty#1\else
        \@nextcycleprimary=#1
        \ifnum\@nextcycleprimary>0
            \@thiscycleonlyfalse
            \@orbitsnextcycletrue
        \fi
    \fi}
\def\nextcycleparallel#1{% 
    \ifx\empty#1\else
        \@nextcycleparallel=#1
        \ifnum\@nextcycleparallel>0
            \@thiscycleonlyfalse
            \@orbitsnextcycletrue
        \fi
    \fi}
\def\afternextprimary#1{% 
    \ifx\empty#1\else
        \@afternextprimary=#1
        \ifnum\@afternextprimary>0
            \@thiscycleonlyfalse
            \@orbitsafternexttrue
        \fi
    \fi}
\def\afternextparallel#1{% 
    \ifx\empty#1\else
        \@afternextparallel=#1
        \ifnum\@afternextparallel>0
            \@thiscycleonlyfalse
            \@orbitsafternexttrue
        \fi
    \fi}
\def\totalorbits#1{% Total orbit request for a given target
    \ifx\empty#1\else\global\@totalorbits=#1\fi}
\def\totaltargets#1{% Total number of targets for a SNAP proposals
    \ifx\empty#1\else\global\@totaltargets=#1\fi}
%   
%   Let's start doing something.
%   
%   THE PROPOSAL SUMMARY
%   
%   The printed form starts off with some boilerplate, the
%   proposal title, and some general info, identifies the
%   PI, and makes a table of orbit requests for observing
%   proposals.  Put the PI and title into the page header
%   with a \markright command.  Everything else comes in
%   a big 4 column table.  This summary might be invoked
%   from a number of places, but make sure it only gets
%   done once.
%   
%   We say that the length of the abstract is limited by
%   the constraint that it not run over to the second
%   page.  This is unfair unless we make some effort
%   to insure that the proposal summary takes the same
%   amount of space for almost all proposals.  What we
%   will do is to allow for a title that runs over onto a
%   second line, but not a third, and for a postal address
%   that runs over onto a third line, but not a fourth.
%   Put the title into a vbox to 42pt.  Put everything
%   else into a vbox to 276pt.  NO CHEATING NOW!
%   
\newif\if@didsummary
    \@didsummaryfalse
\def\makesummary{%
    \@didsummarytrue
    %
    %   Save honorific and suffix, which must be for the PI, for
    %   subsequent use in page headers.
    %
    \xdef\@PIhonorific{\@honorific}
    \xdef\@PIsuffix{\@suffix}
    %
    % Compute orbit table
    %
    \adduporbits                
    % 
    % Fixed size vbox's to encourage brevity!
    %
    \vbox to 42pt{\noindent\parbox[b]{\textwidth}{%
        \sloppy\raggedright\Large\bf \@title}\vfil}
    \vskip 12pt
    \hbox to \textwidth{\vbox to 290pt{\lineskip .75em
    \noindent\begin{tabular}[t]{@{}rlp{0.75in}rl}
        \ifx\empty\@formattedsubmission
            \multicolumn{4}{l}{\@formatplease}\\
        \fi
        Principal Investigator:&\multicolumn{4}{l}{%
            \@honorific\@firstname~\@lastname\@suffix}\\ 
        Institution:&\multicolumn{4}{l}{\@institution}\\ 
        \ifx\USA\@country
            &\multicolumn{4}{l}{USA/\@USstate}\\
        \else
            &\multicolumn{4}{l}{\@country}\\
        \fi
        Electronic mail:&\multicolumn{4}{l}{{\@email}}\\
        \ifx\@Yes\@ESAmember
            ESA member:&\multicolumn{4}{l}{\@ESAmember}\\
        \fi
        \if@archival
            \vrule width0pt height3ex depth0ex
            Scientific category:&\multicolumn{4}{l}{\@scicat}\\
            Total budget amount:&\multicolumn{4}{l}{\@totalbudget}\\
            Scientific keywords:&\multicolumn{4}{p{4.5in}}{\@keywords}\\
        \fi
        \if@epo
            \vrule width0pt height3ex depth0ex
            Science Proposal ID:&\multicolumn{4}{l}{\@scipropid}\\
            Educational Category:&\multicolumn{4}{l}{\@scicat}\\
            Total budget amount:&\multicolumn{4}{l}{\@totalbudget}\\
        \fi
        \if@go 
            \vrule width0pt height3ex depth0ex
            Scientific category:&\multicolumn{4}{l}{\@scicat}\\
            Scientific keywords:&\multicolumn{4}{p{4.5in}}{\@keywords}\\
            Instruments:& \multicolumn{2}{l}{\@instruments}&
              Proprietary period:&
              \ifnum\@proprietaryperiod=-1 
                Please specify a proprietary period
              \else
                \ifnum\@proprietaryperiod=0 0
                \else
                  \ifnum\@proprietaryperiod=3 3
                  \else
                    \ifnum\@proprietaryperiod=6 6
                    \else
                      \ifnum\@proprietaryperiod=12 12
                      \else
                         \number\@proprietaryperiod\ is
                         not a valid proprietary period: 0, 3, 6, or 12
                      \fi
                    \fi
                  \fi
                \fi
              \fi\\
            \if@snap
                Number of targets:&\multicolumn{4}{l}{\number
                 \@totaltargets}\\
            \else
                \orbittable
            \fi
            \ifx\@jointZero\@chandrakiloseconds\else
             Joint HST-Chandra:&\multicolumn{4}{l}{%
                 \@chandrakiloseconds\ Chandra ksec requested}\\
            \fi
            \ifx\@jointZero\@noaonights\else
             Joint HST-NOAO:&\multicolumn{4}{l}{%
                 \@noaonights\ NOAO nights requested}\\
            \fi
        \fi
        \ifx\@Yes\@specialprop%
          \vrule width0pt height 3ex depth0ex
          Special Proposal Types:&\multicolumn{4}{p{4.5in}}{\bf%
          \ifx\@Yes\@calibprop%
           Calibration%
           \@specialpropflagalreadytrue%
          \fi%
          \ifx\@Yes\@ARlegacy%
           \if@specialpropflagalready, \fi%
           AR Legacy%
           \@specialpropflagalreadytrue%
          \fi%
          \ifx\@Yes\@theory%
           \if@specialpropflagalready, \fi%
           Theory%
           \@specialpropflagalreadytrue%
          \fi%
          \ifx\@Yes\@innovative
           \if@specialpropflagalready, \fi
           Innovative%
           \@specialpropflagalreadytrue
          \fi
          \ifx\@Yes\@treasury
           \if@specialpropflagalready, \fi
           Treasury%
           \@specialpropflagalreadytrue
          \fi
          }\\
        \fi
    \end{tabular}\vfil}}
    }

%       ORBIT TABLE
%
%       Add the orbit request to the table.  It is assumed that there
%       are non-zero requests for the current cycle (otherwise, what's
%       the point!).  If \if@thiscycleonly is true, then the numbers
%       for the current cycle are all you need.  If false, then the
%       sum of cycles is printed to the right and below the current
%       cycle numbers, along with numbers for the next cycle (below
%       the current cycle) and/or the numbers for after the next
%       cycle (to the right of the current cycle).
%
\def\orbittable{%
    \if@orbitsafternext
      \vrule width0pt height3ex depth0ex%
      Cycle \thecycle{} primary orbits:&\number\@thiscycleprimary &&
        Cycle \theafternext{} primary orbits:&\number\@afternextprimary \\
        \vrule width0pt height0ex depth1.5ex%
          Cycle \thecycle{} parallel orbits:&\number\@thiscycleparallel&&
        Cycle \theafternext{} parallel orbits:&\number\@afternextparallel\\
    \else
      \vrule width0pt height3ex depth0ex%
      Cycle \thecycle{} primary orbits:&\number\@thiscycleprimary \\
      \vrule width0pt height0ex depth2.0ex%
      Cycle \thecycle{} parallel orbits:&\number\@thiscycleparallel\\
    \fi
    \if@thiscycleonly\else
      \if@orbitsnextcycle
        Cycle \thenextcycle{} primary orbits:&
          \number\@nextcycleprimary&
          \multicolumn{2}{r}{Total all cycles primary orbits:}&
          \number\@sumofprimary\\
        \vrule width0pt height0ex depth1.5ex%
        Cycle \thenextcycle{} parallel orbits:&
          \number\@nextcycleparallel&
          \multicolumn{2}{r}{Total all cycles parallel orbits:}&
          \number\@sumofparallel\\
      \else
        Total all cycles primary orbits:&\number\@sumofprimary\\
        \vrule width0pt height0ex depth1.5ex%
        Total all cycles parallel orbits:&\number\@sumofparallel\\
      \fi
    \fi}

%       THE ABSTRACT
%
%       Just make a little heading, make sure that the proposal 
%       summary has been typeset, and provide a non-zero \parindent.
%
\renewenvironment{abstract}{%
    \makesummary
	\noindent{\large\bf Abstract}\par
	\vskip 13pt}{}

%       THE INVESTIGATOR LIST
%
%       The data for the Investigator list table is specified as
%       tagged items.  The trigger for actually typesetting them is
%       the \CoIname macro, which is assumed to be the first macro
%       in the group of specifications for each CoI.  This macro
%       flushes the already defined data items out to the table, in
%       preparation for the next line.  The last line of the table
%       has to be flushed out by the \end{investigors} statement.
%       Of course, you might not have any co-investigators, in which
%       case it would have been nice if you were allowed to get rid 
%       of both the \begin and \end{investigators} statements.  However
%       both must be present.
%
%       Notice the use of math mode.  Right after the two \hline's
%       for the table heading is a dollar sign.  So LaTeX is actually
%       in math mode while reading the tagged data for the table.
%       This allows all of the white space to be ignored, so that the
%       first columns can actually line up.
%
%       In addition, the table is set within a minipage environment, in
%       case the preparer is moved to use footnotes within the table.
%       (Not to say we are encouraging the use of footnotes---we
%       aren't.)  This keeps the footnotes close to the table.
%
%       The table is typeset in \small, with \normalsize restored at
%       the end.
%
\newenvironment{investigators}{%
    \global\@doinginvlisttrue
    \newpage
    \small
    \noindent\begin{minipage}{\textwidth}
    \begin{tabular*}{%
        \textwidth}{%
        @{}l@{\hspace{0.2in}}l@{\extracolsep{\fill}}ll@{}}
    & Investigator& Institution& Country \\\hline\hline$
   }{\finishinvlist}
\newif\if@doinginvlist  \@doinginvlistfalse
\newif\if@finishedinvlist \@finishedinvlistfalse
\def\finishinvlist{%
    \invline\\\hline
    \end{tabular*}\par
    \begin{tabular}{@{}rll}
     Total number of investigators: &\number\@totalcount \\
     \ifnum\@ESAcount>0
     Number of ESA investigators: &\number\@ESAcount &(indicated 
        by $^*$ after name)\\
     \fi
    \end{tabular}
    \end{minipage}%
    \global\@doinginvlistfalse%
    \global\@finishedinvlisttrue%
    \normalsize}
%
%   Add lines to the table of investigators.  
%   If the columns exceed a certain width, 
%   set them in a p box of that width.  
%   Otherwise use the natural width.
%
\newdimen\investwd
\newdimen\investboxwd 
\investboxwd=1.75in     % Width of the "Investigator" column
%
\newdimen\instwd
\newdimen\instboxwd 
\instboxwd=3.0in        % Width of the "Institution" column
%
\newdimen\countrywd
\newdimen\countryboxwd 
\countryboxwd=1.25in    % Width of the "Country" column
%
\def\invline{% 
  \global\setbox0=\hbox{%
        \@honorific\@firstname~\@lastname\@suffix\@ESAflag}
  \global\investwd=\wd0
  \global\setbox0=\hbox{\@institution}
  \global\instwd=\wd0
  \global\setbox0=\hbox{\@countrystate}
  \global\countrywd=\wd0
  $\@PIorCoI&% Note transition FROM math mode.
    \ifdim\investwd>\investboxwd%
      \multicolumn{1}{@{}p{\investboxwd}}{\@honorific\@firstname~
        \@lastname\@suffix\@ESAflag}%
    \else\@honorific\@firstname~\@lastname\@suffix\@ESAflag%
    \fi&%
    \ifdim\instwd>\instboxwd%
      \multicolumn{1}{p{\instboxwd}}{\@institution}
    \else
      \@institution%
    \fi&
    \ifdim\countrywd>\countryboxwd%
      \multicolumn{1}{p{\countryboxwd}}{\@countrystate}
    \else
      \@countrystate%
    \fi
    \gdef\@ESAflag{}
    \gdef\@honorific{}
    \gdef\@lastname{}
    \gdef\@suffix{}}
%   
%   THE OBSERVATION SUMMARY
%   
%   The observations environment produces a tabular
%   summary of the proposed observations.  Unlike the
%   investigators environment, we don't start out with
%   a line of information already, so we have to make
%   sure that no typesetting actually gets done the
%   first time through.  The trigger for spitting out a
%   line of text is the \target macro.  Unlike (?) the
%   table of investigators, we reset most of the fields
%   after each line, trying to make things more robust
%   to re-arranging lines in the table.
%   
%   The trick of getting into math mode between lines
%   of the table doesn't work in this case, since the
%   first column is a p box.  The $ goes into the p box,
%   which messes everything up.  Instead, we use the
%   trick of a zero width p box for the always empty
%   dummy first column.
%   
%   Add up all of the \totalorbits requests to get a
%   grand total in \@runningtotal.  Compare the result
%   to the sum of \@sumofprimary and \@sumofparallel,
%   and print a message if they don't match.
%   
%   We want to make sure that the calls to \instruments
%   for separate observations don't get concatenated,
%   so we reset \if@oneinstrumentalready back to false
%   for each line.
%   
%   The table is typeset in \small, with \normalsize
%   restored at the end.
%   
%   It would be nice if we could get line breaks at commas
%   for the spectral elements, since things would be much
%   more forgiving that way.  However, having fooled with
%   it long enough, I give up.
%   
\tablehead{%
    \multicolumn{4}{@{}l}{\bf Observing Summary:}%
    &\multicolumn{1}{l}{Configuration,mode,aperture}%
    &\multicolumn{1}{c}{Total}&\\%
    Target& RA& DEC& \multicolumn{1}{c}{V}& spectral elements& 
    \multicolumn{1}{c}{orbits}& Flags\\ \hline\hline}
\tabletail{\hline}
\tablelasttail{\@targetline\\\hline
    &&&& Grand total orbit request &
    \number\@runningtotal\\\hline}
\newenvironment{observations}{%
  \small%
  \global\@oneinstrumentalreadyfalse%
  \parindent 0em%
  \vskip 2em%
  \begin{supertabular*}{%
    \textwidth}{@{}p{1.0in}@{\extracolsep{\fill}}rrllrl@{}}
 }{\end{supertabular*}
  \ifnum\@runningtotal=\@grandtotal\else
      {\if@snap\else
      NOTE: This grand total (\number\@runningtotal) 
        does not equal the sum of
        cycle \thecycle~primary 
        (\number\@thiscycleprimary) and
        parallel (\number\@thiscycleparallel) orbits plus
        cycle \thenextcycle~primary 
        (\number\@nextcycleprimary) and
        parallel (\number\@nextcycleparallel) orbits plus
        cycle \theafternext~primary 
        (\number\@afternextprimary) and
        parallel (\number\@afternextparallel) orbits on page 1
      \fi}
  \fi
  \normalsize
  \vskip 3ex
  }
%
%   For each target, flush out the target line already 
%   specified, unless this is the first time through.  
%   In that case, just save everything for next time.
%
\def\target#1{
    \if@firsttarget
        \global\@firsttargetfalse\relax
    \else
        \@targetline\\
    \fi
    \global\@oneinstrumentalreadyfalse 
    \uppercase{\gdef\@target{#1}}}
  \gdef\@target{Unknown}
  \newif\if@firsttarget \global\@firsttargettrue
%
%   There is a problem with the appearance of long spectral
%   elements.  Whatever the solution turns out to be, we don't
%   really want to screw up the cases where everything fits on
%   one line.
%
%   The solution implemented below is to see if everything
%   fits on one line, and if it doesn't to make a table where
%   the configuration and mode are on the first line, and the
%   list of spectralelements begins on the second line, and
%   may continue to subsequent lines.
%
\newdimen\configwd
\newdimen\configboxwd \configboxwd=2.0in
\newdimen\flagwd
\newdimen\flagboxwd \flagboxwd=1.0in
\newdimen\configfil
\newdimen\aperturefil
\newdimen\aperturewd
\newdimen\apspecwd
\newdimen\confaperturewd
\newdimen\confmodewd
\newdimen\labelwd
\newdimen\specwd
\newdimen\minwidth
\newdimen\modefil
\def\@targetline{%  
    % Compute widths of various combinations of stuff
    \global\setbox0=\hbox{Configuration,mode,aperture}
    \global\labelwd=\wd0
    \global\setbox0=\hbox{%
        \@configuration~\@mode~\@coronoapertures~\@spectralelements}
    \global\configwd=\wd0
    \global\setbox0=\hbox{\@configuration~\@mode~\@coronoapertures}
    \global\confaperturewd=\wd0
    \global\setbox0=\hbox{\@configuration~\@mode}
    \global\confmodewd=\wd0
    \global\setbox0=\hbox{\@coronoapertures}
    \global\aperturewd=\wd0
    \global\setbox0=\hbox{\@coronoapertures~\@spectralelements}
    \global\apspecwd=\wd0
    \global\setbox0=\hbox{\@spectralelements}
    \global\specwd=\wd0
    \global\setbox0=\hbox{\@flags}
    \global\flagwd=\wd0
    \global\advance\@runningtotal by\@totalorbits%
    % How narrow can the configuration column be?
    % Does it all fit? 
    \ifdim\configwd<\configboxwd            
        %  yes
        \global\minwidth=\configwd          
    \else                                   
        %  no, but
        % do all but spec fit?
        \ifdim\confaperturewd<\configboxwd  
            \global\minwidth=\confaperturewd
            % Does just spec fit?
            \ifdim\specwd<\configboxwd      
                % If so, is spec>rest?
                \ifdim\specwd>\minwidth     
                    \global\minwidth=\specwd
                \fi
            \else
                \global\minwidth=\configboxwd
            \fi
        \else                                   
            % Does conf+mode fit?
            \ifdim\confmodewd<\configboxwd  
                \global\minwidth=\confmodewd
                % Do ap+spec fit?
                \ifdim\apspecwd<\configboxwd
                    \global\minwidth=\apspecwd  
                \else
                    \global\minwidth=\configboxwd
                \fi
            \fi
        \fi
    \fi
    \ifdim\minwidth<\labelwd
        \global\minwidth=\labelwd
    \fi

    \global\configfil=\minwidth \global\advance\configfil by -\confaperturewd
    \global\modefil=\minwidth \global\advance\modefil by -\confmodewd
    \global\aperturefil=\minwidth \global\advance\aperturefil by -\aperturewd
    \@target& \@ra& \@dec& \@magnitude &%
    \ifdim\configwd<\configboxwd% 
        \multicolumn{1}{p{\configboxwd}}{%
            \@configuration{} \@mode{} \@coronoapertures{} \@spectralelements}
    \else
        \ifdim\confaperturewd<\configboxwd%
            \multicolumn{1}{p{\minwidth}}{%
              \@configuration~\@mode~\@coronoapertures\hbox to\configfil{}
              \@spectralelements}
          \else
            \ifdim\confmodewd<\configboxwd%
              \multicolumn{1}{p{\minwidth}}{%
                \@configuration~\@mode{}\hbox to \modefil{}
                \@coronoapertures{} \@spectralelements}
            \else
              \multicolumn{1}{p{\minwidth}}{%
                \@configuration{} \@mode{} \@coronoapertures{} \@spectralelements}
            \fi
          \fi
        \fi&
        \number\@totalorbits&%
        \ifdim\flagwd>\flagboxwd%
            \multicolumn{1}{p{\flagboxwd}}{\@flags}
        \else
            \@flags
        \fi
  %
  %     Reset strings back to visible defaults
  %
        \gdef\@target{Unknown}%
        \gdef\@ra{Unknown}%
        \gdef\@dec{Unknown}%
        \gdef\@magnitude{Unknown}%
        \gdef\@flags{}%
        \gdef\@configuration{}%
        \gdef\@mode{}%
        \gdef\@coronoapertures{}%
        \gdef\@spectralelements{}%
        \global\@totalorbits=0}

%   AUTHORIZING INSTITUTION OFFICIAL
%
%   An environment for archival proposals, allowing the person
%   with signature authority for the bucks to be identified,
%   with little boxes where he/she and the PI (?) can sign.
%
%   All the action takes place at the end of the environment,
%   except for throwing up a little header.
%
\newenvironment{authorizingofficial}{%
    \vskip 3em%
    \noindent{\large\bf Authorizing Official}\par
    \vskip 1.5em
    \gdef\@firstname{Please supply a name}\gdef\@lastname{}
    }{\lineskip .75em
    \noindent\begin{tabular}[t]{@{}rl}
        Authorizing official:& 
        \@honorific\@firstname~\@lastname\@suffix\\
        Institution:& \@institution\\
        \ifx\empty\@sundries\else
                &{\@sundries}\\
        \fi
        \ifx\empty\@street\else
                &{\@street}\\
        \fi
        \ifx\USA\@country
            &{\@town{} \@USstate{} \@postalcode{}, \@country}\\
        \else
            &{\@postalcode{} \@town, \@country}\\
        \fi
        Telephone:& \@telephone\\
        \ifx\empty\@email\else
            Electronic mail:&\@email
        \fi
    \end{tabular}\par
    \vskip 3em\@sigs
    }
%
%       Supply \underline'ed spaces for signatures and dates.
%
\long\def\@sigs{%
    \vbox{%
        \vskip\medskipamount{\noindent\large\bf%
          Signatures}:\vskip\bigskipamount
        \small
        \hbox to \textwidth{%
        Authorizing Official: \underline{\strut\hbox to 3.14in{\hfill}}
            \hspace{0.2in}\hfil%
            Date: \underline{\strut\hbox to 1.25in{\hfill}}}
        \vskip\medskipamount
        \noindent \hbox to \textwidth{%
        \noindent Principal Investigator:%
            \underline{\strut\hbox to 3.05in{\hfil}}%
            \hspace{0.2in}\hfil%
            Date: \underline{\strut\hbox to 1.25in{\hfil}}}
        \vskip\bigskipamount}
    }

%       GENERAL FORM
%
%       Define macros to print out little section headers for
%       each of the questions that appear in this part of the
%       form.  Each calls \markanswer, which puts a big black
%       box in the left margin.  Reset the section counter,
%       so that if the proposer used sectioning commands in
%       an answer, they start at 1 again in the next answer.
%       As in LaTeX, suppress the indentation of the first
%       paragraph following a header.
%
\def\markanswer#1{%
    \vskip 12pt
    \setcounter{section}{0}
    {\noindent\kern -24pt\vrule width10pt height10pt
     \hskip 12pt\large\bf #1}
    \par\nobreak\vskip 12pt\@afterindentfalse
    \@afterheading}
%
\def\budgetnarrative{%
    \markanswer{Budget Narrative}}
\def\justification{\newpage
    \markanswer{Scientific Justification}}
\def\describeobservations{%
    \markanswer{Description of the Observations}}
\def\describearchival{%
    \markanswer{Analysis Plan}}
\def\specialreq{%
    \markanswer{Special Requirements}}
\def\coordinatedobs{%
    \markanswer{Coordinated Observations}}
\def\previousprograms{%
    \markanswer{Previous HST Programs}}
\def\duplications{%
    \markanswer{Justify Duplications}}
\def\projectdescription{\newpage
    \markanswer{Project Description}}
\def\objectives{%
    \markanswer{Educational Objectives}}
\def\dissemination{%
    \markanswer{Dissemination Plan}}
\def\evaluation{%
    \markanswer{Evaluation Plan}}
\def\budget{%
    \markanswer{Budget Outline}}

%       ABBREVIATIONS
%
%       Special symbols of astronomical interest.  
%
%       These came from Howard Bond, I think, by way 
%       of the STScI preprint style:
%
\def\ang{\AA}               %Angstrom unit
\def\degpoint{\mbox{$^\circ\mskip-7.0mu.\,$}}
\def\halpha{\mbox{H$\alpha$}}
\def\hbeta{\mbox{H$\beta$}}
\def\hgamma{\mbox{H$\gamma$}}
\def\kms{\,km~s$^{-1}$}      % note leading thinspace
\def\lya{\mbox{Ly$\alpha$}}
\def\lyb{\mbox{Ly$\beta$}}
\def\minpoint{\mbox{$'\mskip-4.7mu.\mskip0.8mu$}}
\def\mv{\mbox{$m_{_V}$}}
\def\Mv{\mbox{$M_{_V}$}}
\def\peryr{\mbox{$\>\rm yr^{-1}$}}
\def\secpoint{\mbox{$''\mskip-7.6mu.\,$}}
\def\sqdeg{\mbox{${\rm deg}^2$}}
\def\squig{\sim\!\!}
%\def\subsun{\mbox{$_{\twelvesy\odot}$}}
\def\subsun{\mbox{$_{\normalsize\odot}$}}
%
%   These are from AASTeX, with notes:
%
%   Handy little things everybody works out for themselves
%   anyway.  Many of these come from Springer's A&A
%   package, and some were contributed by Francois
%   Schweizer at DTM.  You can go berserk making these
%   up, especially when you start getting into the
%   composite ones.  We have tried to select a tractable
%   number that were useful, and somewhat difficult to get
%   right because fussy kerning or some such is required.
%   Most can be used in or out of math mode with impunity;
%   \alt and \agt are relations and can only be used in
%   math mode.
% 
\def\deg{\hbox{$^\circ$}}
\def\sun{\hbox{$\odot$}}
\def\earth{\hbox{$\oplus$}}
\def\lesssim{\mathrel{\hbox{\rlap{\hbox{%
 \lower4pt\hbox{$\sim$}}}\hbox{$<$}}}}
\def\gtrsim{\mathrel{\hbox{\rlap{\hbox{%
 \lower4pt\hbox{$\sim$}}}\hbox{$>$}}}}
\def\sq{\hbox{\rlap{$\sqcap$}$\sqcup$}}
\def\arcmin{\hbox{$^\prime$}}
\def\arcsec{\hbox{$^{\prime\prime}$}}
\def\fd{\hbox{$.\!\!^{\rm d}$}}
\def\fh{\hbox{$.\!\!^{\rm h}$}}
\def\fm{\hbox{$.\!\!^{\rm m}$}}
\def\fs{\hbox{$.\!\!^{\rm s}$}}
\def\fdg{\hbox{$.\!\!^\circ$}}
\def\farcm{\hbox{$.\mkern-4mu^\prime$}}
\def\farcs{\hbox{$.\!\!^{\prime\prime}$}}
\def\fp{\hbox{$.\!\!^{\scriptscriptstyle\rm p}$}}
\def\micron{\hbox{$\mu$m}}
% 
% For Springer A&A compliance...
\let\la=\lesssim                
\let\ga=\gtrsim
%
% 
%    Permit author to typeset "case" fractions.  This is
%    sometimes wanted in displayed equations, during which
%    LaTeX will set fractions specified as \frac{x}{y}
%    as "built-up" fractions (numerator and denominator
%    at body text size).
% 
\def\case#1#2{\hbox{$\frac{#1}{#2}$}}
% 
%    Permit author to typeset fractions set with solidus
%    where the size is reduced and the numerals are
%    oriented diagonally.  Note that this is different from
%    a "shilled" fraction, which the author can produce
%    without any special formatting markup.  Define markup
%    shorthands for several common fractions using solidus.
% 
\def\slantfrac#1#2{\hbox{$\,^#1\!/_#2$}}
\def\onehalf{\slantfrac{1}{2}}
\def\onethird{\slantfrac{1}{3}}
\def\twothirds{\slantfrac{2}{3}}
\def\onequarter{\slantfrac{1}{4}}
\def\threequarters{\slantfrac{3}{4}}
% 
\def\ubvr{\hbox{$U\!BV\!R$}}            % UBVR system
\def\ub{\hbox{$U\!-\!B$}}               % U-B
\def\bv{\hbox{$B\!-\!V$}}               % B-V
\def\vr{\hbox{$V\!-\!R$}}               % V-R
\def\ur{\hbox{$U\!-\!R$}}               % U-R
% 
%   Notation for atomic species (ionization levels).  The
%   ionization state is specified as the second argument,
%   and should be given as a numeral.  The macro has to
%   expand the numeric state into the proper notation
%   for the publication (roman, numeric, plus signs, etc.)
%
%    \ion{ELEMENT}{IONIZATION STATE}
% 
\def\ion#1#2{#1$\;${\small\rm\@Roman{#2}}\relax}
% 
%   Centered ellipsis for use in tables (for unknown
%   values).  \nodata is generalized markup for this
%   notion: format of null-valued entries in tables is
%   style-specific.
% 
%\def\cellipsis{\hfill$\cdots$\hfill}
\def\nodata{\multicolumn{1}{c}{$\cdots$}}
%
%       End of stuff from AASTeX

