%==================================================================================
%
%  eso22.sty                         Version June 2010 (R. Gredel)
%
%  LaTeX Style File for applications of observing time at ESO/MPG 2.2m-telescope
%
%==================================================================================
%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
%
 \typeout{}
 \typeout{}
 \typeout{------------------------------------------------------------}
 \typeout{------------------------------------------------------------}
 \typeout{--------> ESO 2.2m Application Sheet (June 2010) <----------}
 \typeout{------------------------------------------------------------}
 \typeout{------------------------------------------------------------}
 \typeout{}
 \typeout{}
%
\newcommand{\dsazVersion}{ESO22_June07}
%
% Defintion of page format
%
%\textheight 27.5cm \textwidth 17.0cm
\textheight 25.5cm \textwidth 17.0cm
\oddsidemargin 0pt \evensidemargin 0pt
%
\setlength{\hoffset}{-0.5cm} \setlength{\voffset}{-1.5cm} \topsep
0pt \partopsep 0pt \topmargin 0cm \headheight 0cm \headsep 0cm
\setlength{\footskip}{0.7cm}
%
\renewcommand{\topfraction}{1.0}
\renewcommand{\bottomfraction}{1.0}
\renewcommand{\dbltopfraction}{1.0}
\renewcommand{\textfraction}{0.0}
\renewcommand{\floatpagefraction}{0.0}
\renewcommand{\dblfloatpagefraction}{0.0}
%
\newcounter{dsaz}
\newcounter{Mond}
%
%==========================================================================
%               S y m b o l s           HJR     15-Dez-95
%==========================================================================
%
\newcommand{\etal}{\emph{et al.}}
\newcommand{\privcom}{\emph{priv.comm.}}
\newcommand{\eg}{{\it e.g.\/}}
\newcommand{\ie}{{\it i.e.\/}}
\newcommand{\ibidem}{\quad{\it ibidem\/} }
\newcommand{\dito}{\vrule width 0.8cm height 2.5pt depth -2.2pt $\,$}
%-----------------------------------
% units for math-mode (in rm-font !)
%___________________________________
%
\newcommand{\GHz}{{\rm\,GHz}}
\newcommand{\MHz}{{\rm\,MHz}}
\newcommand{\Hz}{{\rm\,Hz}}
%
\newcommand{\pc}{{\rm\,pc}}
\newcommand{\kpc}{{\rm\,kpc}}
\newcommand{\Mpc}{{\rm\,Mpc}}
%
\newcommand{\cm}{{\rm\,cm}}
\newcommand{\second}{{\rm\,sec}}
\newcommand{\Kelvin}{{\rm\,K}}
%
\newcommand{\Jy}{{\rm\,Jy}}
\newcommand{\mJy}{{\rm\,mJy}}
\newcommand{\microJy}{{\rm\,\mu Jy}}
%
%==================
%  special symbols
%==================
%
\newcommand{\sqbullet}{\vrule height .9ex width .8ex depth -.1ex }  % square bullet
\newcommand{\square}{\mathchoice\sqr34\sqr34\sqr{2.1}3\sqr{1.5}3}
\newcommand{\sqr}[2]{{\vcenter{\vbox{\hrule height.#2pt\hbox{\vrule width.#2pt
        height#1pt \kern#1pt\vrule width.#2pt}\hrule height.#2pt}}}}
%
%==========================================================
%   Symbols for degree, arcminute, arcsecond etc.
%              as well as their decimal fractions
%==========================================================
\newcommand{\degree}{\hbox{$^\circ$$$}}
\newcommand{\decdeg}{\hbox{$.\!\!^\circ$}}
\newcommand{\arcmin}{\hbox{$^\prime$}}
\newcommand{\darcmin}{\hbox{$.\mkern-4mu^\prime$}}
\newcommand{\arcsec}{\hbox{$^{\prime\prime}$}}
\newcommand{\darcsec}{\hbox{$.\!\!^{\prime\prime}$}}
\newcommand{\hour}{\hbox{$^{\rm h}$}}
\newcommand{\dech}{\hbox{$.\!\!^{\rm h}$}}
\newcommand{\minute}{\hbox{$^{\rm m}$}}
\newcommand{\decmin}{\hbox{$.\!\!^{\rm m}$}}
\newcommand{\secnd}{\hbox{$^{\rm s}$}}
\newcommand{\decsec}{\hbox{$.\!\!^{\rm s}$}}
%===========================================================================
%
% Definitions for this style-file
%
\newcommand{\RA}[4]{#1\hour&#2\minute&#3\decsec&#4}            % alpha
\newcommand{\DEC}[3]{$#1$\degree&$#2$\arcmin&$#3$\arcsec}      % delta
\newcommand{\bobbl}[2]{\put(#1,#2){\framebox(5,5){\put(2.5,0.0){\circle*{3}}}}}
\newcommand{\bobblh}[2]{\put(#1,#2){\framebox(5,10){\put(2.5,0.0){\circle*{3}}}}}
%
%
\newcommand{\BLANK}{\hskip 2em}
\newcommand{\filledblank}[2]{\underbar{\parbox{#1}{\raisebox{3pt}{\centerline{\rm #2}}}}}
\newcommand{\BOX}[1]{\unitlength1.0cm
           \begin{picture}(0.5,0.5)\put(0.1,-0.1){\framebox(0.5,0.5){#1}}
           \end{picture}}
\newcommand{\DBOX}[1]{\unitlength1.0cm
           \begin{picture}(0.5,0.5)\put(0.1,-0.1){\framebox(1.0,0.5){#1}}
           \end{picture}}
%
\newcommand{\stichw}{}
\newcommand{\kateg}{}
\newcommand{\KeyWord}[1]{\renewcommand{\stichw}{\stepcounter{ExistStich}#1}}
\newcommand{\Category}[1]{\renewcommand{\kateg}{\stepcounter{ExistKat}#1}}
\newcommand{\StatusOfProjects}[1]{\hline
  \multicolumn{6}{|p{15.7cm}|}{\rule[0mm]{0cm}{4mm}{\rm #1}}\\}
\newcommand{\HeadLine}{\centerline{magnitude in}\newline
                       \centerline{spectral range}\newline
                       \centerline{to be observed}}
\newcommand{\Group}{}
\newcommand{\MPIAapplication}{\stepcounter{ExistGroup}
\renewcommand{\Group}{from \ \ \BOX{X}\ \ MPIA\ \ \ \BOX{}\ \ MPG institute\ \ \BOX{}\ \ other}}
\newcommand{\MPGapplication}{\stepcounter{ExistGroup}
\renewcommand{\Group}{from \ \ \BOX{}\ \ MPIA \ \BOX{X}\ \ MPG institute\ \ \BOX{}\ \ other}}
\newcommand{\OTHER}{\stepcounter{ExistGroup}
\renewcommand{\Group}{from \ \ \BOX{}\ \ MPIA\ \ \  \BOX{}\ \ MPG institute\ \ \BOX{X}\ \ other}}
%
% Praeample
%
\newcommand{\AntragNr}{}
\newcommand{\Eingang}{}
\def\TestFlag{nein}\def\test{ja}
\newcommand{\TestRun}{%
\typeout{=======================================================}%
\typeout{=====.............................................=====}%
\typeout{=====..... THIS IS A TEST RUN ONLY !!! ...........=====}%
\typeout{=====.............................................=====}%
\typeout{=====..... NO RECORDS KEPT AT MPIA !!! ...........=====}%
\typeout{=====.............................................=====}%
\typeout{=====....... DE-ACTIVATE TestLauf FOR ............=====}%
\typeout{=====...... SUBMISSION OF PROPOSAL !! ............=====}%
\typeout{=====.............................................=====}%
\typeout{=======================================================}%
\def\TestFlag{ja}}
%
\newcommand{\Service}{}
\newcommand{\ServiceMode}{\stepcounter{ExistService}\renewcommand{\Service}{Service}}
\newcommand{\PartlyServiceMode}{\stepcounter{ExistService}\renewcommand{\Service}{Partly Service}}
\newcommand{\noServiceMode}{\stepcounter{ExistService}\renewcommand{\Service}{ }}
%
%
% Macro prueft, ob eingegebener 1. Parameter eine Zahl ist
% (d.h. nur die Ziffern 0...9 und den Dezimalpunkt oder ein
% Dezimalkomma enthaelt).
%   Parameter 2 = betroffenes Package
%   Parameter 3 = Fehlertext
%   Parameter 4 = Hilfetext
%
%    Siehe N. Schwarz: S. 120
%
\def\SoweitOkay{\relax}
\def\PruefeAufZahl#1#2#3#4{\def\betrPack{#2}\def\betrFehler{#3}\def\betrHilfe{#4}\PruefeZahl#1\Endlist}
\def\Endlist{\Endlist}
\def\PruefeZahl{\afterassignment\TuNichts\let\next= }
\def\TuNichts{%
   \ifx
      \next\Endlist\let\next\relax
   \else
      \if\next 0{\SoweitOkay}%
      \else\if\next 1{\SoweitOkay}%
      \else\if\next 2{\SoweitOkay}%
      \else\if\next 3{\SoweitOkay}%
      \else\if\next 4{\SoweitOkay}%
      \else\if\next 5{\SoweitOkay}%
      \else\if\next 6{\SoweitOkay}%
      \else\if\next 7{\SoweitOkay}%
      \else\if\next 8{\SoweitOkay}%
      \else\if\next 9{\SoweitOkay}%
      \else\if\next .{\SoweitOkay}%
      \else\if\next ,{\SoweitOkay}%
      \else\if\next :{\SoweitOkay}%
      \else\PackageError{\betrPack}{\betrFehler}{\betrHilfe}\next
      \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
        \let\next\PruefeZahl
   \fi\next}
%
% Macro pr{\"u}ft die verschiedenen Flags der Antragstypen und setzt entsprechende Z{\"a}hler
%
\def\PruefeAufTyp#1#2#3#4{\def\betrAPack{#2}\def\betrAFehler{#3}\def\betrAHilfe{#4}\PruefeTyp#1\EndAlist}
\newcounter{TypM}
\newcounter{TypP}
\newcounter{TypL}
\newcounter{TypW}
\newcounter{TypT}
\newcounter{TypC}
\newcounter{TypR}
\newcounter{TypI}
\newcounter{TypG}
\def\EndAlist{\EndAlist}
\def\PruefeTyp{\afterassignment\TuANichts\let\next= }
\def\TuANichts{%
   \ifx
      \next\EndAlist\let\next\relax
   \else
      \if\next 0{\SoweitOkay}%
      \else\if\next M{\setcounter{TypM}{1}}%
      \else\if\next P{\setcounter{TypP}{1}}%
      \else\if\next L{\setcounter{TypL}{1}}%
      \else\if\next W{\setcounter{TypW}{1}}%
      \else\if\next T{\setcounter{TypT}{1}}%
      \else\if\next C{\setcounter{TypC}{1}}%
      \else\if\next R{\setcounter{TypR}{1}}%
      \else\if\next I{\setcounter{TypI}{1}}%
      \else\if\next G{\setcounter{TypG}{1}}%
      \else\PackageError{\betrAPack}{\betrAFehler}{\betrAHilfe}\next
      \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
        \let\next\PruefeTyp
   \fi\next}
%
% ---------------- Z{\"a}hler zur Kontrolle der Kommandos --------------
%
\newcounter{ExistService}
\newcounter{ExistCollab}
\newcounter{ExistObs}
\newcounter{ExistKat}
\newcounter{ExistStich}
\newcounter{ExistTitle}
\newcounter{ExistAbstract}
\newcounter{ExistMethod}
\newcounter{ExistFlux}
\newcounter{ExistNacht}
\newcounter{ExistZeit}
\newcounter{ExistLST}
\newcounter{ExistLogistik}
\newcounter{ExistObj}
\newcounter{ExistBegruend}
\newcounter{ExistRand}
\newcounter{ExistErfahr}
\newcounter{ExistPub}
\newcounter{ExistBiblio}
\newcounter{ExistDFG}
\newcounter{ExistMinReq}
\newcounter{ExistInstr}
\newcounter{ExistGroup}
\newcounter{CheckInstrument}
%
\newcommand{\EndOfApplication}{
        \ifthenelse{\value{ExistGroup}= 0}
        {\PackageError{\dsazVersion}{No user group specified!}{Please make
        sure to use one of the commands MPIA, MPG or OTHER!}}{}
        \ifthenelse{\value{ExistGroup} > 1}
        {\PackageError{\dsazVersion}{More than one user group specified!}{Please
        use only one of the commands MPIA, MPG or OTHER!}}{}
%        \ifthenelse{\value{ExistService}= 0}
%        {\PackageError{\dsazVersion}{No observing mode selected!}{Please
%        make sure to use one of the ServiceModus commands!}}{}
        \ifthenelse{\value{ExistCollab}= 0}
        {\PackageError{\dsazVersion}{Missing command: Collaborators}{Please
        make sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistObs}= 0}
        {\PackageError{\dsazVersion}{Missing command: Observers}{Please make
        sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistInstr}= 0}
        {\PackageError{\dsazVersion}{Missing / wrong command: Instrument}{Please
        make sure the command exists in your application!}}{}
%        \ifthenelse{\value{ExistStich}= 0}
%        {\PackageError{\dsazVersion}{Missing command: KeyWord}{Please make
%        sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistTitle}= 0}
        {\PackageError{\dsazVersion}{Missing command: Title}{Please make
        sure the command exists in your application!}}{}
%        \ifthenelse{\value{ExistKat}= 0}
%        {\PackageError{\dsazVersion}{Missing command: Category}{Please make
%        sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistAbstract}= 0}
        {\PackageError{\dsazVersion}{Missing command: Abstract}{Please make
        sure the command exists in your application!}}{}
%        \ifthenelse{\value{ExistMethod}= 0}
%        {\PackageError{\dsazVersion}{Missing command: Method}{Please make
%        sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistFlux}= 0}
        {\PackageError{\dsazVersion}{Missing command: FluxLevel}{Please
        make sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistNacht}= 0}
        {\PackageError{\dsazVersion}{Missing command: Nights}{Please make sure
        the command exists in your application!}}{}
        \ifthenelse{\value{ExistZeit}= 0}
        {\PackageError{\dsazVersion}{Missing command: ObsTimeRange}{Please make
        sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistLST}= 0}
        {\PackageError{\dsazVersion}{Missing command: LST}{Please make sure
        the command exists in your application!}}{}
        \ifthenelse{\value{TypP}=1}
            {\ifthenelse{\value{ExistLogistik}= 0}
            {\PackageError{\dsazVersion}{Missing command: Logistics}{P (PhD thesis) type
            applications require a logistics page!}}{}}{}
        \ifthenelse{\value{TypL}=1}
            {\ifthenelse{\value{ExistLogistik}= 0}
            {\PackageError{\dsazVersion}{Missing command: Logistics}{L (long term) type
            applications require a logistics page!}}{}}{}
        \ifthenelse{\value{ExistObj}= 0}
        {\PackageError{\dsazVersion}{Missing command: Targets}{Please make
        sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistBegruend}= 0}
        {\PackageError{\dsazVersion}{Missing command: Justification}{Please
        make sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistRand}= 0}
        {\PackageError{\dsazVersion}{Missing command: BoundaryConditions}{Please
        make sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistErfahr}= 0}
        {\PackageError{\dsazVersion}{Missing command: Experience}{Please
        make sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistPub}= 0}
        {\PackageError{\dsazVersion}{Missing command: Publications}{Please make
        sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistBiblio}= 0}
        {\PackageError{\dsazVersion}{Missing command: BibliographyLists}{Please make
        sure the command exists in your application!}}{}
%        \ifthenelse{\value{ExistDFG}= 0}
%        {\PackageError{\dsazVersion}{Missing command: noTravelFunding / TravelFunding}{Please
%        make sure the command exists in your application!}}{}
        \ifthenelse{\value{ExistMinReq}= 0}
        {\PackageError{\dsazVersion}{Missing command: MinimumObservingRequirements}{Please
        make sure the command exists in your application!}}{}
\end{document}}
%
%----------------------- HEADER ------------------------------------
%
\newcommand{\Header}[2]{\thispagestyle{empty}\setcounter{dsaz}{1}
            \tt \noindent
  \begin{tabular}{p{9.1cm}@{\hspace*{1.0cm}}p{6.3cm}}
    \begin{tabular}[t]{l}
                                           \\
      Time Allocation Committee for \\
      MPG time at the ESO 2.2m-telescope\\[0.5ex]
      c/o MPI f{\"u}r Astronomie\\
      K{\"o}nigstuhl 17\\
      D-69117 Heidelberg / Germany\\[3ex]
      \begin{bfseries}\noindent{\large
      APPLICATION FOR OBSERVING TIME
      }\end{bfseries}\\[2ex]
      \Group \\
      \end{tabular} &
   {\large
      \begin{tabular}[t]{|p{5.8cm}|}
        \hline
        {\normalsize
        Application No.}\\
        \hspace*{\fill}\ifx\test\TestFlag {\LARGE\bf TEST}\else\AntragNr\fi\\
        \hline
        {\normalsize Observing period
        \hspace{\fill} #2\,#1}\\
        \hline
        {\normalsize
               Received}              \\
                                      \\
              \hspace*{\fill}\Eingang \\
                                      \\
        \hline\\[-2.0ex]
        \multicolumn{1}{|c|}{\large\bf {\Service}}\\
        \hline
      \end{tabular}}
   \end{tabular}

\vspace*{0.5cm}
}
%
%--------------------- SPRING- OR AUTUMN-PERIOD ---------------------------
%
\newcommand{\ApplicationPeriod}[1]{\Header{}{#1}}

%\newcommand{\Periode}[2]{\noindent
%   \begin{tabular}{llll}
%      \BOX{#1} &  Autumn period
%               &  beginning of July - end of December,
%               &  acceptance till March 15.\\[1ex]
%      \BOX{#2} & Spring period
%               & beginning of January - end of June,
%               & acceptance till September 15.\\[2ex]
%   \end{tabular}
%
%\vspace*{0.5cm}}
%
%\newcommand{\AutumnApplication}[1]{\Header{#1}{H}\Periode{X}{\BLANK}}
%\newcommand{\SpringApplication}[1]{\Header{#1}{F}\Periode{\BLANK}{X}}
%
%------------------------------ TELESCOPE ---------------------------------
%
\newcommand{\Teleskope}[5]{

   \noindent
   1.\ \    Telescope:
%                    {\hskip 0.4cm} 1.23-m \ \BOX{#1}
                    {\hskip 0.4cm} 2.2-m  \ \BOX{#2}
%                    {\hskip 0.4cm} 3.5-m  \ \BOX{#3}
                    {\hspace{\fill}
            \def\argu{#4}%
            \ifx\argu\empty % nichts besonderes
                  \else
                     #5 \DBOX{\large\bf #4}  % Antragstyp + Referenz
                     \PruefeAufTyp{#4}{\dsazVersion}{Command Telescope 1. parameter}{Illegal Flag: only M,P,L,W,T,C,R,I,G allowed (no blanks)!}

                  \fi}

\vspace*{1.0cm}}
%
%\newcommand{\TelOnePointTwo}[2]{   \Teleskope{\bf X}{\BLANK}{\BLANK}{#1}{#2} \gdef\usetele{teleinszwei}}
\newcommand{\TelTwoPointTwo}[2]{   \Teleskope{\BLANK}{\bf X}{\BLANK}{#1}{#2} \gdef\usetele{telzweizwei}}
%\newcommand{\TelThreePointFive}[2]{\Teleskope{\BLANK}{\BLANK}{\bf X}{#1}{#2} \gdef\usetele{teldreifuenf}}
%
%-------------------- APPLICANTS & OBSERVER --------------------------
%
\newcommand{\Applicant}[9]{\gdef\PI{#3}\noindent
  \begin{tabular}{lcc}
                      \hspace*{-1.0em}
2.1  Applicant\ \ \ \
                  & \filledblank{6.3cm}{\ #1 #2 {\large\bf #3}}
                  & \filledblank{6.3cm}{\ #4}      \\
                  & {\footnotesize\tt Name}
                  & {\footnotesize\tt Institute}\\[1ex]
                  & \filledblank{6.3cm}{\ #5}
                  & \filledblank{6.3cm}{\ #6 #7}   \\
                  & {\footnotesize\tt street}
                  & {\footnotesize\tt ZIP code - city}\\[1ex]
                  & \filledblank{6.3cm}{\ #8}
                  & \filledblank{6.3cm}{\tt \ #9}  \\
                  & {\footnotesize\tt ESO User Portal username}
                  & {\footnotesize\tt e-mail}      \\[2ex]
  \end{tabular}}

\newcommand{\Collaborators}[4]{\stepcounter{ExistCollab}

  \noindent
  \begin{tabular}{lcc}
                      \hspace*{-1.0em}
2.2  Collaborators
                & \filledblank{6.1cm}{\ #1}
                & \filledblank{6.3cm}{\ #2}       \\
                & {\footnotesize\tt name(s)}
                & {\footnotesize\tt institute(s)}\\[1ex]
                & \filledblank{6.1cm}{\ #3}
                & \filledblank{6.3cm}{\ #4}       \\
                & {\footnotesize\tt  name(s)}
                & {\footnotesize\tt institute(s)}\\[2ex]
  \end{tabular}}
%
\newcommand{\Observers}[2]{\stepcounter{ExistObs}

  \noindent
  \begin{tabular}{lcc}
                      \hspace*{-1.0em}
2.3  Observers \ \ \
                   & \filledblank{6.3cm}{\ #1}
                   & \filledblank{6.3cm}{\ #2} \\
                   & {\footnotesize\tt  name}
                   & {\footnotesize\tt  name}\\[2ex]
  \end{tabular}

}
%
%--------------------- TITLE & ABSTRACT ---------------------------------
%
\newcommand{\Title}[1]{\stepcounter{ExistTitle}

   \noindent
    By specifying the names under item 2.3 it is obligatory to also send
    out these observers to \\La Silla, if required. Correspondence on the
    rating of this application will be sent to the \\
    applicant (P.I.) as quoted under 2.1 above.\\[3ex]
   \noindent
   3.\ \   Observing programme:\hspace{9.5cm}
           Category:\BOX{\kateg}\\[2ex]\gdef\proptitle{#1}
   \parbox[b]{2.6cm}{\ \ \ \ Title\ \ \ \ :\hspace{\fill}}
   \parbox[t]{14.cm}{\begin{rmfamily}\begin{bfseries}{\large
            \ifthenelse{\equal{#1}{}}{\ }{#1}}
            \end{bfseries}\end{rmfamily}}

   \vspace*{1ex}}
%
\newcommand{\Abstract}[1]{\stepcounter{ExistAbstract}\noindent
   \parbox[b]{2.6cm}{\ \ \ \ Abstract :}\hspace{\fill}
   \parbox[t]{14.cm}{\begin{rmfamily}
                       \ifthenelse{\equal{#1}{}}{\ \vspace*{1.0cm}}{#1}
                     \end{rmfamily}}

   \vspace*{\fill}}
%
\newcommand{\Instrument}[1]{\noindent
4.\ \   Instrument:\quad
%\filledblank{4.4cm}{#1}\\[3ex]
\ifthenelse{\equal{#1}{WFI}}{\stepcounter{ExistInstr}\BOX{X}\quad WFI \quad\BOX{}\quad FEROS\quad\BOX{}\quad GROND}{}
\ifthenelse{\equal{#1}{FEROS}}{\stepcounter{ExistInstr}\BOX{}\quad WFI \quad\BOX{X}\quad FEROS\quad\BOX{}\quad GROND}{}
\ifthenelse{\equal{#1}{GROND}}{\stepcounter{ExistInstr}\BOX{}\quad WFI \quad\BOX{}\quad FEROS\quad\BOX{X}\quad GROND}{}
\\[3ex]}
%
%------------------------- FLUX LEVEL ----------------------------------
%
\newcommand{\FluxLevel}[3]{\stepcounter{ExistFlux}\noindent
   5.\ \   Brightness range of objects to be observed:
           from \filledblank{2.0cm}{#1}
           to \filledblank{2.0cm}{#2} {#3}\\[3ex]}
%
%------------------------- NUMBER OF NIGHTS ----------------------------
%
\newcommand{\Hours}[5]{\stepcounter{ExistNacht}\noindent
%
% Pruefung, ob Zahl eingegeben wurde
%
        \PruefeAufZahl{#1}{\dsazVersion}{Command Nights 1. parameter}{Only numbers (real, integer, no blanks) allowed!}
        \PruefeAufZahl{#2}{\dsazVersion}{Command Nights 2. parameter}{Only numbers (real, integer, no blanks) allowed!}
        \PruefeAufZahl{#3}{\dsazVersion}{Command Nights 3. parameter}{Only numbers (real, integer, no blanks) allowed!}
        \PruefeAufZahl{#4}{\dsazVersion}{Command Nights 4. parameter}{Only numbers (real, integer, no blanks) allowed!}
        \PruefeAufZahl{#5}{\dsazVersion}{Command Nights 5. parameter}{Only numbers (real, integer, no blanks) allowed!}
%
% Pruefung, auf Anzahl Eingaben
%
        \setcounter{Mond}{0}
        \ifx#1\empty \else \stepcounter{Mond}\fi
        \ifx#2\empty \else \stepcounter{Mond}\fi
        \ifx#3\empty \else \stepcounter{Mond}\fi
        \ifthenelse{\value{Mond}> 1}
        {\PackageError{\dsazVersion}{Input error in command Nights}{Please specify only one moon phase!}}{}
%
   6.\ \  Number of hours:\hspace*{\fill}
      \begin{tabular}[t]{|c|c|c|cc}
        \cline{1-5}
        \multicolumn{3}{|c|}{\rule[-1mm]{0mm}{5mm}applied for} &
        \multicolumn{1}{|c|}{already awarded} &
        \multicolumn{1}{|c|}{still needed}\\
        \cline{1-5}
        {\rule[-2mm]{0mm}{7mm}\rm #1} & {\rm #2} & {\rm #3} &
        \multicolumn{1}{|c|}{\ifthenelse{\equal{#4}{}}{none}{#4}} &
        \multicolumn{1}{|c|}{\ifthenelse{\equal{#5}{}}{none}{#5}}\\
        \cline{1-5}
        \ {\footnotesize\tt \rule[-0.5mm]{0mm}{4mm}no restriction} &
        \ {\footnotesize\tt grey} &
        \ {\footnotesize\tt dark} & &\\
        \cline{1-3}
      \end{tabular}

\vspace*{0.7cm}}
%
%---------------------- OBSERVING RANGE ----------------------------
%
\newcommand{\ObsTimeRange}[2]{\stepcounter{ExistZeit}
%
        \PruefeAufZahl{#1}{\dsazVersion}{Command Zeitraum 1. parameter}{Only date in format dd.mm.yyyy (no blanks) allowed!}
        \PruefeAufZahl{#2}{\dsazVersion}{Command Zeitraum 2. parameter}{Only date in format dd.mm.yyyy (no blanks) allowed!}
%
\noindent
7.\ \  Optimum date range for the observations: \dotfill
            \begin{rmfamily} #1 -- #2 \end{rmfamily}

         }
\newcommand{\LST}[2]{\stepcounter{ExistLST}
%
        \PruefeAufZahl{#1}{\dsazVersion}{Command LST 1. parameter}{Only time in format hh:mm (no blanks) allowed!}
        \PruefeAufZahl{#2}{\dsazVersion}{Command LST 2. parameter}{Only time in format hh:mm (no blanks) allowed!}
%
\noindent
\hspace*{4ex}
Usable range in local sideral time LST: \dotfill
            \begin{rmfamily} #1h -- #2h \end{rmfamily}
\newpage}
%
%------------------------- BESCHREIBUNG ----------------------------------
%
\newenvironment{ObservingProgram}
  {\twocolumn[8a.  Description of the observing programme\vspace*{0.5cm}]
  \begin{rmfamily}\sloppy%\vspace*{-0.8cm}
%
  \addtocounter{dsaz}{1}
  \ifthenelse{\value{page}>\value{dsaz}}
            {\PackageError{\dsazVersion}{The title page is too long!\MessageBreak
                                         Description must begin on page \arabic{dsaz}!}
                                        {Shorten text, most likely the abstract! To see where the problem is
                                         enter batch mode by giving "q" !.}}{}
%
  }{\end{rmfamily} \tt \newpage \onecolumn}
%
%------------------------- FIGURES + TABLES  --------------------------
%
\newenvironment{SupportingMaterial}
 {\twocolumn[8b. Figures and tables\vspace*{0.5cm}]
 \begin{rmfamily}\sloppy%\vspace*{-0.8cm}
%
  \addtocounter{dsaz}{1}
  \ifthenelse{\value{page}>\value{dsaz}}
                {\PackageError{\dsazVersion}{The page Description is too long!\MessageBreak
                                            Figures must begin on page \arabic{dsaz}!}
                                            {Shorten text of the description! To see where the problem is
                                             enter batch mode by giving "q" !.}}{}
%
 }{\end{rmfamily} \tt \newpage \onecolumn}
%
%------------------------- BACKUP PROGRAM -------------------------------
%
\newenvironment{BackupProgramm}
 {\twocolumn[8c. Description of the backup programme\vspace*{0.5cm}]
 \begin{rmfamily}\sloppy%\vspace*{-0.8cm}
%
  \addtocounter{dsaz}{1}
  \ifthenelse{\value{page}>\value{dsaz}}
                {\PackageError{\dsazVersion}{The page with figures is too long!\MessageBreak
                                            Backup Programme must begin on page \arabic{dsaz}}
                                            {Scale down figures and/or shorten figure captions!
                                            To see where the problem is enter batch mode by giving "q" !.}}{}
%
 }{\end{rmfamily} \tt \newpage \onecolumn}
%
%--------------- FIGURES FOR BACKUP PROGRAM ------------------------
%
\newenvironment{BackupSupportingMaterial}
 {\twocolumn[8d. Figures and tables for backup programme\vspace*{0.5cm}]
 \begin{rmfamily}\sloppy%\vspace*{-0.8cm}
%
  \addtocounter{dsaz}{1}
  \ifthenelse{\value{page}>\value{dsaz}}
                {\PackageError{\dsazVersion}{The description of the backup programme is too long!\MessageBreak
                                            Figures for Backup Programme must begin on page \arabic{dsaz}}
                                            {Shorten text for backup programme!
                                            To see where the problem is enter batch mode by giving "q" !.}}{}
%
 }{\end{rmfamily} \tt \newpage \onecolumn}
%
%------------------------- LOGISTICS -------------------------------
%
\newenvironment{Logistics}
 {\twocolumn[8e. Current logistics of PhD thesis/long term programme\vspace*{0.5cm}]
 \begin{rmfamily}\sloppy\stepcounter{ExistLogistik}
%
  \addtocounter{dsaz}{1}
  \ifthenelse{\value{page}>\value{dsaz}}
                {\PackageError{\dsazVersion}{The Scientific Justification/Backup Programme pages are too long!\MessageBreak
                                            Logistic must begin on page \arabic{dsaz}}
                                            {Shorten text and/or scale down figures!
                                            To see where the problem is enter batch mode by giving "q" !.}}{}
%
 }{\end{rmfamily} \tt \newpage \onecolumn}
%
%------------------------------- TARGETS ---------------------------------
%
\newenvironment{Targets}{\stepcounter{ExistObj}
%
  \addtocounter{dsaz}{1}
  \ifthenelse{\value{page}>\value{dsaz}}
                {\PackageError{\dsazVersion}{The preceeding page is too long!\MessageBreak
                                            Object list must begin on page \arabic{dsaz}!}
                                            {Shorten text!
                                            To see where the problem is enter batch mode by giving "q" !.}}{}
%
    \noindent 9.\ \
    Objects to be observed \hfill\\[2ex]
    \hspace*{4ex}(Objects to be observed with high priority should
                                        be marked in last column)\\[6ex]
    \begin{minipage}[t]{16.0cm}
    \renewcommand{\footnoterule}{\rule{3cm}{0pt}}
%
        \begin{center}
        \normalsize
        \begin{tabular}{|l|r@{\,}r@{\,}r@{}l|r@{\,}r@{\,}r|c|c|}
        \hline
        \multicolumn{1}{|c|}{\normalsize Designation} &
        \multicolumn{4}{|c|}{\normalsize $\alpha$ (2000)} &
        \multicolumn{3}{|c|}{\normalsize $\delta$ (2000)} &
        \multicolumn{1}{|c|}{\parbox{3.0cm}{\begin{center}
                \rule{0cm}{3ex}\normalsize
                \HeadLine
                \rule[-2ex]{0cm}{1ex}\end{center}}}&
        \multicolumn{1}{|c|}{\normalsize priority}\\
        \hline
        &&&& &&& & & \\
        }{
        &&&& &&& & & \\
        \hline
        \end{tabular}
        \end{center}
    \end{minipage}
\normalsize\newpage}
%
%------------------------ TIME JUSTIFICATION ---------------------------------
%
\newcommand{\TimeJustification}[1]{\stepcounter{ExistBegruend}
  \addtocounter{dsaz}{1}
  \ifthenelse{\value{page}>\value{dsaz}}
                {\PackageError{\dsazVersion}{The target list is too long!\MessageBreak
                                            Justification must begin on page \arabic{dsaz}}
                                            {Remove some objects from the list!
                                            To see where the problem is enter batch mode by giving "q" !.}}{}
%
\noindent
     10.\  Justification of the amount of observing time requested:\\[2ex]
        \hspace*{2em}\hfill\parbox[t]{16.2cm}{\rm
            {\ifthenelse{\equal{#1}{}}{\ \vspace*{6.0cm} }{#1}}}

        \vspace*{2ex}}
%
% ----------------------- SCHEDULING CONSTRAINTS -----------------------------
%
\newcommand{\SchedulingConstraints}[1]{\stepcounter{ExistRand}\noindent
     11.\  Constraints for scheduling observations for this application:\\[2ex]
        \hspace*{2em}\hfill\parbox[t]{16.2cm}{\rm
            {\ifthenelse{\equal{#1}{}}{\ \vspace*{3.0cm} }{#1}}}

        \vspace*{2ex}}
%
%--------------------------- OBSERVING EXPERIENCE -------------------------
%
\newcommand{\ObsExperience}[1]{\stepcounter{ExistErfahr}\noindent
    12.\  Observational experience of observer(s) named under 2.3:\\
    \phantom{12.\  }(at least one observer must have sufficient experience)\\[1ex]
    \hspace*{2em}\hspace{\fill}\parbox[t]{16.2cm}{\rm
            {\ifthenelse{\equal{#1}{}}{\ \vspace*{3.0cm} }{#1}}}

        \vspace*{2ex}}
%
%-------------------------- PUBLICATIONS ---------------------------
%
%
\newenvironment{Publications}{\stepcounter{ExistPub}\noindent
    13.\  Observing runs at the ESO 2.2m-telscope (preferably during the last 3 years)\\
    \hspace*{5ex}and publications resulting from these\\[1ex]
    \noindent\hspace*{0.5cm}
\begin{minipage}[t]{16.25cm}
\renewcommand{\footnoterule}{\rule{3cm}{0pt}}
    \normalsize
    \begin{center}
    \begin{tabular}{|c|c|c|c|c|c|}
    \hline
    Telescope & instrument & date & hours & success rate & publications\rule[-1mm]{0cm}{3ex}\\
    \hline
    }{
    \hline
        \end{tabular}
    \end{center}
\end{minipage}
\normalsize\newpage}

\newcommand{\BibliographyLists}[3]{
  \addtocounter{dsaz}{1}\stepcounter{ExistBiblio}
  \ifthenelse{\value{page}>\value{dsaz}}
                {\PackageError{\dsazVersion}{The preceeding page is too long!\MessageBreak
                                            References must begin on page \arabic{dsaz}}
                                            {Shorten one or several entries on preceeding page!
                                            To see where the problem is enter batch mode by giving "q" !.}}{}
%
     \noindent 14.\  References for items 8 and 13:

     {\rm \medskip
        \ifthenelse{\equal{#1}{manuell}}
             {\hspace*{1ex}         % manual entry of references
              \begin{minipage}[t]{16.0cm}
        #2

        \hrulefill

        \medskip
        #3
              \end{minipage}}
%
        {\renewcommand{\refname}{ }\vspace*{-1.5cm} % automatic formating
        \begin{thebibliography}{000}
        #2
        \setcounter{enumiv}{99}
        #3
        \end{thebibliography}}}
\newpage}
%
%
%====================== min requirements =================================
%

\newcommand{\MinimumObservingRequirements}[6]{
  \addtocounter{dsaz}{1}\stepcounter{ExistMinReq}
  \ifthenelse{\value{page}>\value{dsaz}}
  {\PackageError{\dsazVersion}{The preceding page (items 15./16.) is too long!\MessageBreak
                                Instrumentation must begin on page \arabic{dsaz}}
                                {Shorten text for Item 15./16.!
                                To see where the problem is enter batch mode by giving "q" !.}}{}
\noindent {\rm\large\bf Tolerance limits for planned observations:}\\[2ex]
\setlength{\footskip}{0pt}
\setlength{\textheight}{280mm}
\setlength{\textwidth}{180mm}
\parindent 0pt
%
\thispagestyle{empty}
\unitlength1.0mm
\linethickness{0.5mm}
\begin{picture}(180,20)
\put(0,0){\framebox(180,20){}}
\linethickness{0.1mm}
\put(   0, 10){\framebox(55,10)[l]{{\rm\bf\ maximum seeing:}
             \hspace{\fill}#1\arcsec\ }}
\put(  55, 10){\framebox(65,10)[l]{{\rm\bf\ minimum transparency:}
            \hspace{\fill}#2\%\ }}
\put( 120, 10){\framebox(60,10)[l]{{\rm\bf\ maximum airmass:}
            \hspace{\fill}#3\ }}
\put(   0,  0){\framebox(55,10)[l]{{\rm\bf\ photometric conditions:}
            \hspace{\fill}#4\ }}
\put(  55,  0){\framebox(65,10)[l]{{\rm\bf\ moon: max. phase / $\angle$ :}
            \hspace{\fill}#5\degree\ }}
\put( 120,  0){\framebox(60,10)[l]{{\rm\bf\ min. / max. lag:}
            \hspace{\fill}#6 nights\ }}
\end{picture}}

