%-------------------------------------------------------------
% Preamble: environment definition etc.
%-------------------------------------------------------------
\parindent 0pt
\textwidth 6.65in
\textheight 9.7in
\headheight 0.0in
\oddsidemargin -0.0in
\topmargin -0.7in
\parskip 0.5\baselineskip
\raggedbottom

\rm

%-------------------------------------------------------------
% Instruction page header defined in the block below. Some 
% useful macros for the instruction page are also defined.
%-------------------------------------------------------------

\def\InstrHeader{
  \centerline{{\LARGE\sc pennState} \hfill Astronomy \& Astrophysics}
  \hrule
  \vskip -6 pt
  \begin{center}
    \LARGE \bf 
    Hobby-Eberly Telescope Observing Form Instructions
    \medskip
    \Large \bf (Version \Version)
  \end{center}
}

\def\sechead#1{\bigskip\leftline{\large \bf #1}\vskip -\parskip\smallskip}

\def\subsechead#1{\medskip\leftline{\bf #1}\vskip -\parskip\smallskip}

\def\keywd#1{\vskip -\parskip\medskip{{\sc #1}. -- }}

\def\heT{$^H\!\!{}_{\tt E}\!${\large T}}
\def\heTRA{$^H\!\!{}_{\tt E}\!${\large T}$^{\bf R.}_{\bf A.}$}

%-------------------------------------------------------------
% Proposal header defined in the block below. This includes 
% the form title as well as the proposal title, PI and Co-I 
% names, etc.
%-------------------------------------------------------------

\def\boxit#1{\leavevmode\thinspace\hbox{\vrule\vtop{\vbox{\hrule\kern1pt
    \hbox{\thinspace#1\thinspace}}
    \kern1pt\hrule}\vrule}\thinspace}

\def\timestamp{
    \newcount\@minutes \newcount\@hours \newcount\@hrmin
    \global\@minutes=\time
    \global\@hours=\@minutes
    \global\divide\@hours by 60
    \global\@hrmin=\@hours
    \global\multiply\@hrmin by 60
    \global\advance\@minutes by -\@hrmin
    \ifnum\@minutes<10
          \ifnum\@hours<10
                {\bf DATE:} \today, {\bf TIME:} 0\number\@hours :0\number\@minutes
          \else
                {\bf DATE:} \today, {\bf TIME:} \number\@hours :0\number\@minutes
          \fi
    \else
          \ifnum\@hours<10
                {\bf DATE:} \today, {\bf TIME:} 0\number\@hours :\number\@minutes
          \else
                {\bf DATE:} \today, {\bf TIME:} \number\@hours :\number\@minutes
          \fi
    \fi
}
\def\PropHeader{
  \centerline{{\LARGE\sc pennState} \hfill Astronomy \& Astrophysics}
  \hrule
  \bigskip
  \centerline{\LARGE \bf Hobby-Eberly Telescope Observing Time Request}
  \medskip
  \centerline{\Large \bf Regular Program}
  \bigskip
  \vbox{\boxit{\hbox to \textwidth{
        \timestamp
        \hfill
        {\bf PROPOSAL \#:} { \hbox to 0.5in{\hfill} }
  }}}
  \vskip18pt
}

\def\ProposalTitle#1{ 
   {\noindent\large \hbox to 1.81truein{\hfill\bf Proposal Title:}
      \underline{ \hbox to 4.50truein{ {\rm #1} \hfill } } 
   } \par
}
\def\PIfirstname#1{\gdef\@fname{#1}}
\def\PIlastname#1{
   {\noindent\large\hbox to 1.81in{\hfill \bf Principal Investigator:}
      \underline{ \hbox to  4.50in{ {\rm \@fname\ #1} \hfill } } 
   } \par
}
\def\PIemail#1{
   {\noindent\large\hbox to 1.81in{\hfill\bf PI Full Email Address:}
      \underline{ \hbox to  4.50in{ {\rm #1} \hfill } } 
   } \par
}
\def\CoIname#1{
   {\noindent\large\hbox to 1.81in{\hfill\bf Co-I and Institution:}
      \underline{ \hbox to 4.50in{ {\rm #1} \hfill } } 
   } \par
}

%-------------------------------------------------------------
% Long-term title defined in the block below. The rest
% of the header block is the same as above.
%-------------------------------------------------------------

\def\LongTermHeader{
  \centerline{{\LARGE\sc pennState} \hfill Astronomy \& Astrophysics}
  \hrule
  \bigskip
  \centerline{\LARGE \bf Hobby-Eberly Telescope Observing Time Request}
  \medskip
  \centerline{\Large \bf Long-Term Program}
  \bigskip
  \vbox{\boxit{\hbox to \textwidth{
        \timestamp
        \hfill
        {\bf PROPOSAL \#:} { \hbox to 0.5in{\hfill} }
  }}}
  \vskip18pt
}

%-------------------------------------------------------------
% Progress report title defined in the block below. The rest
% of the progress report header block is the same as above.
%-------------------------------------------------------------

\def\ProgRepHeader{
  \centerline{{\LARGE\sc pennState} \hfill Astronomy \& Astrophysics}
  \hrule
  \bigskip
  \centerline{\Large \bf Hobby-Eberly Telescope Long-Term Program Progress Report}
  \bigskip
  \vbox{\boxit{\hbox to \textwidth{
        \timestamp
        \hfill
        {\bf PROPOSAL \#:} { \hbox to 0.5in{\hfill} }
  }}}
  \vskip18pt
}

%-------------------------------------------------------------
% Counters and other accounting variables are defined in the
% next block. 
%-------------------------------------------------------------

\newcount\@exp
\newcount\@nvisit
\newcount\@texp

\newcount\@ntarg   \@ntarg=0
\newcount\@totvis  \@totvis=0
\newcount\@gtexp   \@gtexp=0

\newcount\@overhead \@overhead=10 %%% DEFAULT OVERHEAD PER VISIT IN MINUTES
\newcount\@overtime 
\newcount\@finaltime \@finaltime=\@gtexp  

%-------------------------------------------------------------
% Proposal item entry macros defined below. 
%-------------------------------------------------------------

\def\TotalTime#1{\gdef\@ttime{#1}}
\def\ExpTime#1{\gdef\@etime{#1}}
\def\TotalVisits#1{\gdef\@tvisit{#1}}
\def\TotalObjects#1{\gdef\@tobj{#1}}

\def\TotalTimeA#1{\gdef\@ttimeA{#1}}
\def\ExpTimeA#1{\gdef\@etimeA{#1}}
\def\TotalVisitsA#1{\gdef\@tvisitA{#1}}
\def\TotalObjectsA#1{\gdef\@tobjA{#1}}

\def\TotalTimeB#1{\gdef\@ttimeB{#1}}
\def\ExpTimeB#1{\gdef\@etimeB{#1}}
\def\TotalVisitsB#1{\gdef\@tvisitB{#1}}
\def\TotalObjectsB#1{\gdef\@tobjB{#1}}

\def\TotalTimeC#1{\gdef\@ttimeC{#1}}
\def\ExpTimeC#1{\gdef\@etimeC{#1}}
\def\TotalVisitsC#1{\gdef\@tvisitC{#1}}
\def\TotalObjectsC#1{\gdef\@tobjC{#1}}

\def\TotalTimeTOT#1{\gdef\@ttimeTOT{#1}}
\def\ExpTimeTOT#1{\gdef\@etimeTOT{#1}}
\def\TotalVisitsTOT#1{\gdef\@tvisitTOT{#1}}
\def\TotalObjectsTOT#1{\gdef\@tobjTOT{#1}}

\def\Collaboration#1{\gdef\@collab{#1}}

\gdef\@LRSinstr{LRS}
\gdef\@MRSinstr{MRS}
\gdef\@HRSinstr{HRS}
\def\Instrument#1{\gdef\@instr{#1}
\ifx \@instr\@LRSinstr \global\@overhead=14 \fi %%% SPECIFIC OVERHEAD FOR THE LRS
}

\def\TimeCritical#1{\gdef\@tcrit{#1}}
\def\SplitExposure#1{\gdef\@split{#1}}
\def\TargetofOpportunity#1{\gdef\@toop{#1}}
\def\MovingTarget#1{\gdef\@movtar{#1}}
\def\SynopticProgram#1{\gdef\@synoptic{#1}}
\def\SpecialCalibrations#1{\gdef\@calib{#1}}
\def\SkyBrightness#1{\gdef\@skybright{#1}}
\def\SeeingConstraints#1{\gdef\@seeing{#1}}
\def\SkyTransparency#1{\gdef\@clouds{#1}}
\def\OtherConstraints#1{\gdef\@other{#1}}

\def\ObjName#1{\gdef\@obj{#1}}

\def\NumberofObjects#1{\gdef\@nobs{#1}
    \ifx\empty#1\else
    \global\advance \@ntarg by \@nobs\fi}

\def\ra#1{\gdef\@alpha{#1}}
\def\dec#1{\gdef\@delta{#1}}
\def\magnitude#1{\gdef\@mag{#1}}
\def\Filter#1{\gdef\@filt{#1}}
\def\AcquisitionMethod#1{\gdef\@acq{#1}\objblock@add}


\def\Configuration#1{\gdef\@config{#1}}
\def\SignalToNoise#1{\gdef\@snr{#1}}
\def\WavelengthForSignalToNoise#1{\gdef\@wave{#1}}
\def\MinutesPerVisit#1{
    \ifx\empty#1\else\global\@exp=#1\@texp=#1 
%    \global\advance \@ntarg by 1
    \fi}
\def\NumberOfVisits#1{
    \ifx\empty#1\else\global\@nvisit=#1  \fi
    \global\advance\@totvis by \@nvisit 
    \multiply\@texp by \@nvisit 
    \global\advance\@gtexp by\@texp
    \@overtime=\@overhead \global\multiply\@overtime by\@totvis  
    \@finaltime=\@gtexp   \global\advance\@finaltime by\@overtime
}
\def\Notes#1{\gdef\@comments{#1}\expblock@add}

%-------------------------------------------------------------
% Proposal blocks defined below. The first definition is a 
% macro for making a pretty block title.
%-------------------------------------------------------------

\def\SciJustF{\fbox}
\def\SciJustS{\vbox to 9.3truein}
\def\SciJustHead{
  \boxit{\hbox to \textwidth{\large\bf SCIENTIFIC JUSTIFICATION \hfill 
      {\rm Must fit within the box.}}}
}
\def\SciJustEnv{\parindent 12pt \parskip 0pt \par}

\def\ProgRepS{\vbox to 8truein}
\def\ProgRepHead{
  \boxit{\hbox to \textwidth{\large\bf PROGRESS REPORT \hfill 
      {\rm Must fit within the box.}}}
}

\def\Contingency{
\clearpage
  \boxit{\hbox to \textwidth{\large\bf CONTINGENCY PLAN\hfill 
      {\rm Keep it brief.}}}\medskip
}


\def\LongExpDesign{
\boxit{
\vbox{\hsize=\textwidth
\large\bf EXPERIMENTAL DESIGN \\ AND JUSTIFICATION OF LONG-TERM STATUS REQUEST
}}
\medskip
}

\def\ExpDesign{
\boxit{\hbox to \textwidth{\large\bf EXPERIMENTAL DESIGN\hfill}}\medskip
}

\def\DescribeObs{
\boxit{\hbox to \textwidth{\large\bf DESCRIPTION OF OBSERVATIONS\hfill}}\medskip
}

\def\ObsNotes{
\bigskip\centerline{\large\bf Observing and Target Notes}\medskip
}

\def\PrevTimeF{\fbox}
\def\PrevTimeS{\vbox to 2truein}
\def\PrevTimeHead{
  \bigskip
  \boxit{\hbox to \textwidth{\large\bf RESULTS FROM \heT\ OBSERVATIONS IN THE PAST YEAR\hfill
      {\rm Stay within box.}}}
}

\def\PrevLongTimeF{\fbox}
\def\PrevLongTimeS{\vbox to 3truein}
\def\PrevLongTimeHead{
  \bigskip
  \boxit{\vbox {\hsize=\textwidth \large\bf RESULTS FROM PREVIOUS \heT\ LONG-TERM PROGRAMS \\
                                            OR \heT\ OBSERVATIONS IN THE PAST YEAR\hfill
      {\rm Stay within box.}}}
}

%-------------------------------------------------------------
% Definition of environment for object table. Also included
% are definitions of the table header, the first table row and
% subsequent table rows.
%-------------------------------------------------------------

\newenvironment{objects}{\def\obj@list{}}{
   \renewcommand{\baselinestretch}{1.4}\large\normalsize
   \begin{center} {\large\bf Object Table \vspace{6pt}}\\
   \begin{tabular}{|l|c|c|c|c|c|l|}
   \hline\hline
   \objheader\\ \hline \obj@list \\[0.4ex] \hline
   \end{tabular}\end{center}\vskip24pt}

\def\objheader{
{Object Name} &{\shortstack{No.~of \rule[-1mm]{0mm}{5.5mm} \\Objects}} 
&{$\alpha(2000)$} &{$\delta(2000)$} 
&{\shortstack{Mag.~or \rule[-1mm]{0mm}{5.5mm}\\ Log Flux}} &{\shortstack{Filter \\ or $\lambda$ (\AA)}} 
&{\shortstack{Acquisition \rule[-1mm]{0mm}{5.5mm}\\ Method}}}

\def\objbloc{\@obj &\@nobs &\@alpha &\@delta &\@mag &\@filt &\@acq}

\def\objblock@add{
    \ifx\obj@list\@empty
          \@temptokena=\expandafter{\obj@list}
    \else \@temptokena=\expandafter{\obj@list\\}\fi
    \xdef\obj@list{\the\@temptokena\objbloc}}

%-------------------------------------------------------------
% Definition of environment for exposure table. Also included
% are definitions of the table header, the first table row and
% subsequent table rows.
%-------------------------------------------------------------

\newenvironment{exposures}{\def\exp@list{}}{
   \renewcommand{\baselinestretch}{1.6}\large\normalsize
   \begin{center} {\large\bf Exposure Table \vspace{6pt}}\\
   \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|c|}
   \hline\hline
   \expheader\\ \hline \exp@list \\[0.5ex] \hline
   \end{tabular}\end{center}}

\def\expheader{
{Object Name} 
&{\shortstack{Instrument Configuration \rule[-1mm]{0mm}{5.5mm} \\ (use phase II notation with \\ spaces instead of underscores)}}
&{S/N} &{\shortstack{$\lambda$ of \rule[-1mm]{0mm}{5.5mm} \\ S/N \\ (\AA)}}
&{\shortstack{Exp. Time \\  per visit \\  (minutes) }}
&{\shortstack{No.~of \rule[-1mm]{0mm}{5.5mm} \\ Visits}}
&{\shortstack{Total \rule[-1mm]{0mm}{5.5mm} \\ Minutes}}
&{Notes}
}

\def\expbloc{ \@obj 
    &\vtop {\hsize = 2 truein \baselineskip 12pt \@config}
    &\@snr &\@wave &\number\@exp &\number\@nvisit &\number\@texp &\@comments}

\def\expblock@add{
    \ifx\exp@list\@empty\vspace{2pt}
          \@temptokena=\expandafter{\exp@list}
    \else \@temptokena=\expandafter{\exp@list\\}\fi
    \xdef\exp@list{\the\@temptokena\expbloc}}

%----------------------------------------------------------------------
% Definition of new environment for observing time request summary for
% regular programs. Included is the design of the table of options.
%----------------------------------------------------------------------

\def\prtsummary{
\vfill
\bigskip\boxit{\hbox to \textwidth{\large\bf OBSERVING REQUEST SUMMARY\hfill}}\medskip \\
\begin{tabular}{ll}
\multicolumn{2}{l}{\underline{\bf Time Request}}\\[1ex]
\hbox to 2.57 truein{Exposure Time Requested\dotfill (hours):}         \hs \@etime       \fld  
\hbox to 2.30 truein{Total Time Requested\dotfill  (hours):}           \hs \@ttime       \\
\hbox to 2.57 truein{Total Objects Requested\dotfill :}                \hs \@tobj        \fld 
\hbox to 2.30 truein{Total Visits Requested\dotfill :}                 \hs \@tvisit      \\
\\
{\bf \underline{Collaborative Proposal} (y/n):} \hs \@collab      \fld \\
\\
\underline{\bf Instrument(s) Requested} {\bf (LRS/HRS/MRS)}:  \hs \@instr \fld \\ \\
%
\multicolumn{2}{l}{\underline{\bf Observing Constraints}}\\[1ex]
\hbox to 2.57 truein{Sky Brightness \dotfill (D/G/B/N):}  \hs \@skybright \fld 
\hbox to 2.30 truein{Time Critical Observations? \dotfill (y/n):}      \hs \@tcrit     \\ 
\hbox to 2.57 truein{Maximum Seeing \dotfill ($^{\prime\prime}$):}     \hs \@seeing    \fld 
\hbox to 2.30 truein{Target of Opportunity? \dotfill (y/n):}           \hs \@toop      \\
\hbox to 2.57 truein{Sky Transparency \dotfill(S/P/N):}                \hs \@clouds    \fld 
\hbox to 2.30 truein{Synoptic Program? \dotfill(y/n):}                 \hs \@synoptic  \\
\hbox to 2.57 truein{Split Exposure \dotfill (interval in days):}      \hs \@split     \fld 
\hbox to 2.30 truein{Moving Target? \dotfill (y/n):}                   \hs \@movtar    \\
\hbox to 2.57 truein{Other Constraints \dotfill (y/n):}                \hs \@other     \fld 
\hbox to 2.30 truein{Special Calibrations Needed? \dotfill(y/n):}      \hs \@calib     \\
\end{tabular}
\vfill\eject
}

\newenvironment{summary}{\def\fld{&}\def\hs{\hskip 1em}}{\vfill\prtsummary}

%----------------------------------------------------------------------
% Definition of new environment for observing time request summary for 
% long-term programs. Included is the design of the table of options.
%----------------------------------------------------------------------

\def\prtlongsummary{ \vfill
\bigskip\boxit{\hbox to \textwidth{\large\bf OBSERVING REQUEST SUMMARY\hfill}}\medskip

\def\hb{\hbox to 1em{\hss}}
\begin{tabular}{lrrrr}
\underline{\bf Time Request} & \underline{\bf Trim. 1} & \underline{\bf Trim. 2} & \underline{\bf Trim. 3} & \hs\hs\underline{\bf Total} \\[1ex]
\hbox to 2.57 truein{Exposure Time Requested\dotfill (hours):} & \@etimeA \hb & \@etimeB \hb & \@etimeC \hb & \@etimeTOT \hb \\  
\hbox to 2.57 truein{Total Time Requested\dotfill  (hours):}   & \@ttimeA \hb & \@ttimeB \hb & \@ttimeC \hb & \@ttimeTOT \hb \\
\hbox to 2.57 truein{Total Objects Requested\dotfill :}        & \@tobjA  \hb & \@tobjB  \hb & \@tobjC  \hb & \@tobjTOT  \hb \\ 
\hbox to 2.57 truein{Total Visits Requested\dotfill :}         & \@tvisitA\hb & \@tvisitB\hb & \@tvisitC\hb & \@tvisitTOT\hb \\
\end{tabular}

\begin{tabular}{ll}
{\bf \underline{Collaborative Proposal} (y/n):} \hs \@collab      \fld \\
\\
\underline{\bf Instrument(s) Requested} {\bf (LRS/HRS/MRS)}:  \hs \@instr \fld \\ \\
%
\multicolumn{2}{l}{\underline{\bf Observing Constraints}}\\[1ex]
\hbox to 2.57 truein{Sky Brightness \dotfill (D/G/B/N):}  \hs \@skybright \fld 
\hbox to 2.30 truein{Time Critical Observations? \dotfill (y/n):}      \hs \@tcrit     \\ 
\hbox to 2.57 truein{Maximum Seeing \dotfill ($^{\prime\prime}$):}     \hs \@seeing    \fld 
\hbox to 2.30 truein{Target of Opportunity? \dotfill (y/n):}           \hs \@toop      \\
\hbox to 2.57 truein{Sky Transparency \dotfill(S/P/N):}                \hs \@clouds    \fld 
\hbox to 2.30 truein{Synoptic Program? \dotfill(y/n):}                 \hs \@synoptic  \\
\hbox to 2.57 truein{Split Exposure \dotfill (interval in days):}      \hs \@split     \fld 
\hbox to 2.30 truein{Moving Target? \dotfill (y/n):}                   \hs \@movtar    \\
\hbox to 2.57 truein{Other Constraints \dotfill (y/n):}                \hs \@other     \fld 
\hbox to 2.30 truein{Special Calibrations Needed? \dotfill(y/n):}      \hs \@calib     \\
\end{tabular}
\vfill\eject
}

\newenvironment{longsummary}{\def\fld{&}\def\hs{\hskip 1em}}{\vfill\prtlongsummary}

%-------------------------------------------------------------
% Definition of automatic accounting summary.
%-------------------------------------------------------------

\def\Accounting{\begin{center}
\boxit{\hbox to \textwidth{\large\bf AUTOMATIC ACCOUNTING SUMMARY\hfill}}\medskip \\
\begin{tabular}{lr}
\hbox to 3.5 truein{\bf Total Objects Requested\dotfill :}  & \number\@ntarg \\
\hbox to 3.5 truein{\bf Total Visits Requested\dotfill :} & \number\@totvis \\
\hbox to 3.5 truein{\bf Exposure Time Requested (minutes)\dotfill :} & \number\@gtexp \\
\hbox to 3.5 truein{\bf Overhead per Visit (minutes)\dotfill :} & \number\@overhead \\
 & \hrulefill \\
\hbox to 3.5 truein{\bf GRAND TOTAL TIME REQUEST (minutes)\dotfill :} & \number\@finaltime
\end{tabular}
\end{center}
\bigskip
}

%-------------------------------------------------------------
% Final credits and version number.
%-------------------------------------------------------------

\def\Version{10/04/2008}     % Revision date.
\def\Credits{
  \vfill\scriptsize
  Form version \Version.
  Many features borrowed from the KPNO and HST forms; any resemblance
  to other forms is purely coincidental. Web form and Java applet in
  preparation (do not hold your breath, though).  No graduate students
  or junior faculty were abused in the process testing this form.  All
  responsibility for anything and everything rests with the
  proposer(s).  There is no good excuse for not following the
  instructions. \\
}

