%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ProvidesClass{catt-solicitud}[01/04/2004 CATT Solicitud de Tiempo de Telescopio]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\LoadClass[10pt,letterpaper,oneside,notitlepage]{article}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RequirePackage[spanish]{babel}
\RequirePackage[latin1]{inputenc}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RequirePackage{graphicx}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% I use plain TeX \if commands, rather than the ifelse
% package, in order to change booleans globally from
% within an environment. See the TeXbook for a summary of
% their usage.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\parindent=0pt
\parskip=\smallskipamount

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%agregado 16-4-04 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\topmargin}{0.0cm}
\setlength{\textheight}{24cm}
\setlength{\oddsidemargin}{-0.5cm}
\setlength{\evensidemargin}{-1.5cm}
\setlength{\textwidth}{17cm}
\parindent=0pc
%
\newcommand{\thickbox}{\setlength{\fboxrule}{0.5mm}}
\newcommand{\thinbox}{\setlength{\fboxrule}{0.3pt}}
\newcommand{\singlespace}{\setlength{\baselineskip}{15pt}}
\newcommand{\doublespace}{\setlength{\baselineskip}{20pt}}
%%%%%%%%%%%%%%%agregado 16-4-04 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\@seccion}[1]{%
 \noindent%
 \parbox{\linewidth}{%
  \centering%
  \large\bfseries\itshape%
  #1%
 }%
 \par%
 \vspace{0.3\baselineskip}%
 \@linea%
}

\newcommand{\@subseccion}[1]{%
 \vspace{0.3\baselineskip}%
 \noindent%
 {\bfseries #1: }%
 \ignorespaces%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\@linea}{%
 \noindent%
 \raisebox{0.7\baselineskip}{\rule{\linewidth}{\fboxrule}}%
 \par%
 \vspace*{-0.65\baselineskip}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\@instrucciones}[1]{
 {%
  \noindent%
  \footnotesize%
  #1
  \par%
 }%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This macro checks that sections appears in order.
%
% The first argument is the name of the current section, the
% second the expected name of the previous sections, and the
% third is the error message that is printed if the actual
% name of the previous section is not the expected name of the
% previous section or the name of the current section.
%
% Initially the actual name of the previous section is empty;
% thus, leaving the second argument empty will check that this
% is the first use of this macro.

\def\@ordenreal{} \def\@ordenesperado{}

\newcommand{\@orden}[3]{%
  \def\@ordenesperado{#2}%
  \ifx\@ordenreal\@ordenesperado%
  \else%
   \def\@ordenesperado{#1}%
   \ifx\@ordenreal\@ordenesperado%
   \else%  
    \@error{#3}%
   \fi%
  \fi%
  \global\def\@ordenreal{#1}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Set an enclosed LR box. If the total height is greater
% than #1, print the message #2

\newsavebox{\@maxheightbox}
\newlength{\@maxheightboxheight}
\newlength{\@maxheightboxdepth}
\newlength{\@maxheightmaxheight}

\newenvironment{@maxheight}[2]{%
 %%%%%%%%%%%%%%%%%%%%
 \setlength{\@maxheightmaxheight}{#1}%
 \def\@maxheightmensaje{#2}%
 %%%%%%%%%%%%%%%%%%%%
 \begin{lrbox}{\@maxheightbox}%
 %%%%%%%%%%%%%%%%%%%%
}{%
 \setlength{\@maxheightmaxheight}{2\baselineskip}%
 \end{lrbox}%
 \usebox{\@maxheightbox}%
 %%%%%%%%%%%%%%%%%%%%
 \settoheight{\@maxheightboxheight}{\usebox{\@maxheightbox}}%
 \settodepth{\@maxheightboxdepth}{\usebox{\@maxheightbox}}%
 \addtolength{\@maxheightboxheight}{\@maxheightboxdepth}
 %%%%%%%%%%%%%%%%%%%%
 \ifdim\the\@maxheightboxheight>\the\@maxheightmaxheight%
  \@error{\@maxheightmensaje}%
 \fi%
 %%%%%%%%%%%%%%%%%%%%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Set an enclosed text. If the total number of pages is greater
% than #1, print the message #2.

\newcounter{@maxpagina}

\newenvironment{@maxpaginas}[2]{%
 \setcounter{@maxpagina}{\value{page}}%
 \addtocounter{@maxpagina}{#1}%
 \def\@maxpaginasmensaje{#2}%
}{%
 \ifnum\arabic{page}>\arabic{@maxpagina}
  \@error{\@maxpaginasmensaje}
 \fi
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This makes \oddsidemargin and \topmargin relative to the edge of
% the paper.

\setlength{\voffset}{-1in}
\setlength{\hoffset}{-1in}

% Set the margins

\setlength{\oddsidemargin}{1.2in}
\setlength{\topmargin}{1.0in}
\setlength{\headheight}{1.5\baselineskip}
\setlength{\headsep}{0.7\baselineskip}
\setlength{\footskip}{1.5\baselineskip}

% This makes the left and right margins identical
\setlength{\textwidth}{8.5in}
\addtolength{\textwidth}{-2\oddsidemargin}

% This makes the top and bottom margins identical
\setlength{\textheight}{11in}
\addtolength{\textheight}{-2\topmargin}
\addtolength{\textheight}{-\headheight}
\addtolength{\textheight}{-\headsep}
\addtolength{\textheight}{-\footskip}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% We cannot include the actual clave in the header because it
% is assigned after the solicitud is submitted. Therefore, we
% include a dummy clave and edit the PS file directly.
%
% The dummy clave needs to include all of the characters we
% intend to use in the real clave, otherwise they are not
% included in the downloaded bit-mapped font.
%
% The dummy clave produces this in the PS file:
%
%   2549 b(012345-6-789) p
%
% (although the first number will change with the name of the
% investigador principal) which we need to replace with
% something like:
%
%   2648 b(2001-1-001) p
%
% i.e., add 99 to the number and change the string

%
% La clave de la solicitud se mete a mano
%
\newcommand{\@clave}{CLAVE-CATT:\hspace*{16mm}}

\renewcommand{\@oddhead}{%
 \parbox{\linewidth}{%
  \rmfamily\bfseries\itshape
  \makebox[0.8\linewidth][l]{\@responsablenombre}%
  \makebox[0.2\linewidth][r]{\@clave}%
  \\[-0.5\baselineskip]
  \rule{\linewidth}{\fboxrule}
 }%
}

\renewcommand{\@oddfoot}{%
 \parbox{\linewidth}{%
  \raisebox{\baselineskip}{\rule{\linewidth}{\fboxrule}}\\[-\baselineskip]
  \makebox[\linewidth][c]{%
   \textrm{\thepage}%
  }%
 }%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\raggedbottom

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\AtBeginDocument{
 %%%%%%%%%%%%%%%%%%%%
 \@seccion{
 \bf \Large{  INAOE \\
 Observatorio Astrof\'{\i}sico Guillermo Haro \\
Solicitud de Tiempo de Telescopio} \\
\vspace{4mm}
\par
\medskip
{\bf \large Semestre 2008~A}

\medskip
   {\rm \small Prepare y env\'{\i}e el archivo PS a: catt@inaoep.mx antes de la fecha l\'{\i}mite \\
   Semestre A: lunes 05/noviembre   -  per\'{\i}odo del 1/enero  al 30/junio \\
   Semestre B: 30/abril -  per\'{\i}odo del 1/julio al 31/diciembre\\}


 }
 \bigskip
 %%%%%%%%%%%%%%%%%%%%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\titulo}[1]{%
 %%%%%%%%%%%%%%%%%%%%
 \@orden{titulo}{}%
  {Favor de poner el titulo al principio.}%
 %%%%%%%%%%%%%%%%%%%%
 {%
  \bfseries\large%
  \noindent%
  \begin{@maxheight}{2\baselineskip}%
   {El titulo puede tener al maximo dos lineas. Favor de acortarlo}%
   \parbox{\linewidth}{%
    \centering
    #1
   }%
  \end{@maxheight}%
 }%
 %%%%%%%%%%%%%%%%%%%%
 \par
 \medskip
 %%%%%%%%%%%%%%%%%%%%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{resumen}
{%
 %%%%%%%%%%%%%%%%%%%%
 \@orden{resumen}{titulo}%
  {Favor de poner el titulo inmediatamente antes del resumen.}%
 %%%%%%%%%%%%%%%%%%%%
 \noindent%
 \begin{@maxheight}{8\baselineskip}%
  {El resumen es demasiado largo. Favor de acortarlo.}%
  \begin{minipage}[b]{\linewidth}%
 %%%%%%%%%%%%%%%%%%%%
}
{%
 %%%%%%%%%%%%%%%%%%%%
  \end{minipage}%
 \end{@maxheight}%
 %%%%%%%%%%%%%%%%%%%%
 \par%
 \bigskip%
 \@linea%
 \medskip%
 %%%%%%%%%%%%%%%%%%%%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\nombre}[1]{%
 \def\@nombre{#1}%
}
\newcommand{\institucion}[1]{%
 \def\@institucion{#1}%
}
\newcommand{\telefono}[1]{%
 \def\@telefono{#1}%
}
\newcommand{\correoelectronico}[1]{%
 \def\@correoelectronico{#1}%
}
\newcommand{\direccion}[1]{%
 \def\@direccion{#1}%
}
\newcommand{\esobservador}{%
 \global\@hayobservadortrue%
 \@esobservadortrue%
}
\newcommand{\essustituto}{%
 \@essustitutotrue%
}

\newif\if@hayobservador

\AtEndDocument{%
 \if@hayobservador%
 \else%
  \@error{No hay un observador. Favor de especificar uno.}%
 \fi%
}

\newif\if@esobservador
\newif\if@esresponsable
\newif\if@essustituto
\@esresponsabletrue

\def\@responsablenombre{}

\newenvironment{investigador}{%
 %%%%%%%%%%%%%%%%%%%%
 \@esobservadorfalse%
 \@essustitutofalse%
 \nombre{}%
 \institucion{}%
 \telefono{}%
 \correoelectronico{}%
 \direccion{}%
 %%%%%%%%%%%%%%%%%%%%
}{%
 %%%%%%%%%%%%%%%%%%%%
 \@orden{investigadores}{resumen}%
  {Favor de poner el resumen inmediatamente antes de los investigadores.}%
 %%%%%%%%%%%%%%%%%%%%
 \ifx\@empty\@nombre%
  \@error{Falta el nombre de un investigador. Favor de darlo.}%
 \else%
  \ifx\@empty\@institucion%
   \@error{Favor de dar la institucion de \@nombre.}%
  \fi%
  \ifx\@empty\@correoelectronico%
   \@error{Favor de dar el correo electronico de \@nombre.}%
  \fi%
  \if@esresponsable%
   \if@essustituto%
    \@error{El investigador responsable no puede ser el investigador sustituto.}%
    \@essustitutofalse%
   \fi%
   \ifx\@empty\@direccion%
    \@error{Favor de dar la direccion del investigador responsable.}%
   \fi%
   \ifx\@empty\@telefono%
    \@error{Favor de dar el numero de telefono del investigador responsable.}%
   \fi%
  \fi%
  \if@essustituto%
   \if@esobservador%
   \else%
    \@error{El investigador sustituto tiene que ser observador.}%
   \fi%
  \fi%
 \fi%
 %%%%%%%%%%%%%%%%%%%%
 \noindent%
 \parbox[t]{0.7\linewidth}{\raggedright\bfseries\itshape \@nombre}%
 \parbox[t]{0.3\linewidth}{\raggedleft \bfseries\itshape%
  \if@esresponsable%
    Responsable%
  \fi
  \if@essustituto%
   Sustituto%
  \fi%
  \if@esobservador%
   \if@esresponsable%
    /%
   \fi
   \if@essustituto%
    /%
   \fi%
   Observador%
  \fi%
 }\\%
 \parbox[t]{1.0\linewidth}{\raggedright\itshape \@institucion}\\%
 %%%%%%%%%%%%%%%%%%%%
 \if@esresponsable%
  \parbox[t]{\linewidth}{\raggedright\itshape \@direccion}%
  \\%
 \fi%
 %%%%%%%%%%%%%%%%%%%%
 \parbox[t]{0.5\linewidth}{\raggedright\itshape \@correoelectronico}%
 \parbox[t]{0.5\linewidth}{\raggedleft\itshape \@telefono}%
 \par%
 \medskip%
 \@linea%
 \medskip%
 %%%%%%%%%%%%%%%%%%%%
 \if@esresponsable%
  \global\let\@responsablenombre=\@nombre%
 \fi%
 \global\@esresponsablefalse%
 %%%%%%%%%%%%%%%%%%%%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\telescopio}[1]{%
  \def\@telescopio{#1}%
}
\newcommand{\instrumento}[1]{%
  \def\@instrumento{#1}%
}
\newcommand{\noches}[1]{%
  \def\@noches{#1}%
}
\newcommand{\fechasideales}[1]{%
  \def\@fechasideales{#1}%
}
\newcommand{\fechasaceptables}[1]{%
  \def\@fechasaceptables{#1}%
}

\newcommand{\cielobrillante}{%
  \def\@cielo{Brillantes}%
}
\newcommand{\cielogris}{%
  \def\@cielo{Grises}%
}
\newcommand{\cielooscuro}{%
  \def\@cielo{Oscuras}%
}

\newif\if@conastronomo
\newcommand{\conastronomo}{%
  \global\@conastronomotrue
}
\newcommand{\sinastronomo}{%
  \global\@conastronomofalse
}

\newif\if@conasistente
\newcommand{\conasistente}{%
  \global\@conasistentetrue
}
\newcommand{\sinasistente}{%
  \global\@conasistentefalse
}

\newenvironment{temporada}{%
 %%%%%%%%%%%%%%%%%%%%
 \@orden{temporadas}{investigadores}%
  {Favor de poner los investigadores inmediatamente antes de las temporadas.}%
 %%%%%%%%%%%%%%%%%%%%
 \telescopio{}%
 \instrumento{}%
 \noches{}%
 \fechasideales{}%
 \fechasaceptables{}%
 \def\@cielo{}%
 \global\@conastronomotrue%
 \global\@conasistentetrue%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \ignorespaces%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}{%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \medskip%
 \noindent%
 \begin{tabular}{%
  @{}%
  p{0.21\linewidth}%
  @{\hspace{0.01\linewidth}}%
  p{0.35\linewidth}%
  @{\hspace{0.01\linewidth}}%
  p{0.26\linewidth}%
  @{\hspace{0.01\linewidth}}%
  p{0.15\linewidth}%
  @{}%
 }%
  {\bfseries Telescopio\hspace{\fill}:}&%
  \@telescopio &%
  {\bfseries Noches\hspace{\fill}:}&
  \@noches\ -- \@cielo \\%
  {\bfseries Instrumento\hspace{\fill}:}&%
  \multicolumn{3}{@{}p{0.76\linewidth}}{\@instrumento}\\%
  {\bfseries Fechas ideales\hspace{\fill}:}&%
  \@fechasideales &
  {\bfseries Asistente de c\'upula\hspace{\fill}:}&%
  \if@conasistente s\'{\i} \else no \fi \\%
  {\bfseries Fechas aceptables\hspace{\fill}:}&%
  \@fechasaceptables &%
  {\bfseries Astr\'onomo residente\hspace{\fill}:}&%
  \if@conastronomo s\'{\i} \else no \fi%
  \end{tabular}%
 \par%
 \medskip
 \@linea
 \medskip
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{requisitos}{
 %%%%%%%%%%%%%%%%%%%%
 \@orden{requisitos}{temporadas}%
  {Favor de poner las temporadas inmediatamente antes de los requisitos especiales.}%
 %%%%%%%%%%%%%%%%%%%%
 \vspace{-\medskipamount}
 \@subseccion{Requisitos especiales}%
 \@instrucciones{%
  Describa brevemente los requisitos especiales que haya en las
  temporadas, por ejemplo, si las temporadas tienen que ser
  simult\'aneas o si instrumentos alternativos no son
  aceptables. Todos los requisitos deben ser ampliamente
  justificados m\'as adelante.
 }
 \medskip%
 %%%%%%%%%%%%%%%%%%%%
 \noindent\ignorespaces%
 %%%%%%%%%%%%%%%%%%%%
}{%
 \par
 \medskip
 \@linea
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{fechasinaceptables}{
 %%%%%%%%%%%%%%%%%%%%
 \@orden{fechasinaceptables}{requisitos}%
  {Favor de poner los requisitos especiales inmediatamente
 antes de las fechas inaceptables.}%
 %%%%%%%%%%%%%%%%%%%%
% \vspace{-\medskipamount}
 \@subseccion{Fechas inaceptables}%
 \@instrucciones{%
  Liste fechas inaceptables con justificaci\'on.
 }
 \medskip%
 %%%%%%%%%%%%%%%%%%%%
 \noindent\ignorespaces%
 %%%%%%%%%%%%%%%%%%%%
}{%
 \par
 \medskip
 \@linea
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{objetivos}{
 %%%%%%%%%%%%%%%%%%%%
 \@orden{objetivos}{fechasinaceptables}%
  {Favor de poner los requisitos especiales inmediatamente antes de los objetivos cient\'{\i}ficos.}%
 %%%%%%%%%%%%%%%%%%%%
 \clearpage%
 \begin{@maxpaginas}{2}{Los objetivos cient\'{\i}ficos son demasiado largos. Favor de acortarlos.}%
 %%%%%%%%%%%%%%%%%%%%
 \@seccion{Objetivos cient\'{\i}ficos}%
 \smallskip%
 \@instrucciones{%
  Explique los antecedentes y el objetivo de esta propuesta.
  Describa su contribuci\'on tanto en su campo como en el contexto
  de la astronom\'{\i}a en general. No incluya pretiros ni
  sobretiros. Se pueden incluir dos p\'aginas de texto y otra
  p\'agina de figuras y referencias.
 }
 \medskip%
 %%%%%%%%%%%%%%%%%%%%
 \noindent\ignorespaces%
 %%%%%%%%%%%%%%%%%%%%
}{%
 %%%%%%%%%%%%%%%%%%%%
 \clearpage%
 \clearpage%
 \end{@maxpaginas}%
 %%%%%%%%%%%%%%%%%%%%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{referencias}{%
 \begin{list}{}{
  \setlength{\leftmargin}{1em}
  \setlength{\rightmargin}{\fill}
  \setlength{\itemindent}{-1em}
  \setlength{\listparindent}{-1em}
  \setlength{\labelwidth}{0pt}
  \setlength{\labelsep}{0pt}
  \setlength{\parsep}{0pt}
  \setlength{\topsep}{0pt}
 }%
 \small%
 \item%
 \ignorespaces%
}{%
 \end{list}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand{\caption}[1]{%
 \addtocounter{figure}{1}%
 \begin{@maxheight}{3\baselineskip}%
  {Una leyenda puede tener al maximo tres lineas. Favor de acortarlo}%
  \begin{minipage}[b]{\linewidth}%
   Figura \thefigure: #1
  \end{minipage}%
 \end{@maxheight}%
 \ignorespaces%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newif\if@haymetodologia

\newenvironment{metodologia}{
 %%%%%%%%%%%%%%%%%%%%
 \@orden{metodologia}{objetivos}%
  {Favor de poner los objetivos cient\'{\i}ficos inmediatamente antes de la metodologia.}%
 %%%%%%%%%%%%%%%%%%%%
 \clearpage%
 \begin{@maxpaginas}{1}{La metodologia es demasiado larga. Favor de acortarla.}%
 %%%%%%%%%%%%%%%%%%%%
 \@seccion{Metodolog\'{\i}a}%
 \smallskip%
 \@instrucciones{%
  Explique detalladamente qu\'e observaciones se proponen
  hacer y describa brevemente c\'omo se analizar\'an y se
  interpretar\'an. Incluya detalles del telescopio,
  instrumento, filtros/rejillas/etc., y las t\'ecnicas
  observacionales. De ser posible, indique la raz\'on de se\~nal
  a ruido requirida y esperada; de no ser posible, explique
  por qu\'e. Describa la muestra, y justifique su selecci\'on y
  tama\~no. Si espera alguna complicaci\'on en las
  observaciones, las reducciones, o el an\'alisis, ind\'{\i}quela y
  diga c\'omo espera solucionarla. Incluya una lista de los
  objetos (o ejemplos de los objetos, si hay m\'as de 10)
  que se proponen observar, con coordenadas y
  magnitudes. Se puede usar una p\'agina.
 }%
 \medskip%
 %%%%%%%%%%%%%%%%%%%%
 \noindent\ignorespaces%
 %%%%%%%%%%%%%%%%%%%%
}{%
 %%%%%%%%%%%%%%%%%%%%
 \clearpage%
 \end{@maxpaginas}%
 %%%%%%%%%%%%%%%%%%%%
}

\newif\if@haylistadeobjetos

\AtEndDocument{%
 \if@haylistadeobjetos%
 \else%
  \@error{No hay una lista de objetos. Favor de darla.}%
 \fi%
}

\newenvironment{listadeobjetos}[2]{%
 \global\@haylistadeobjetostrue%
 %%%%%%%%%%%%%%%%%%%%
 \begin{center}
 {\itshape\bfseries #1}\\
 \medskip
 \begin{tabular}{#2}
 %%%%%%%%%%%%%%%%%%%%
}{
 %%%%%%%%%%%%%%%%%%%%
 \end{tabular}
 \end{center}
 %%%%%%%%%%%%%%%%%%%%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{justificacion}{
 %%%%%%%%%%%%%%%%%%%%
 \@orden{justificacion}{metodologia}%
  {Favor de poner la metodologia inmediatamente antes de la justificacion de factibilidad y tiempo pedido.}%
 %%%%%%%%%%%%%%%%%%%%
 \clearpage%
 \begin{@maxpaginas}{1}{La justificacion de factibilidad y tiempo pedido es demasiado larga. Favor de acortarla.}%
 %%%%%%%%%%%%%%%%%%%%
 \@seccion{Justificaci\'on de factibilidad y tiempo pedido}%
 \smallskip%
 \@instrucciones{%
  Justifique que las observaciones propuestas anteriormente
  son factibles o que probablemente sean factibles. Calcule
  y justifique el tiempo requerido. Las p\'aginas de los
  instrumentos:
  \texttt{http://www.inaoep.mx/~astrofi/cananea/}

son fuentes \'utiles de informaci\'on sobre los
  telescopio e instrumentos. Se puede usar una p\'agina.
 }%
 \medskip%
 %%%%%%%%%%%%%%%%%%%%
 \noindent\ignorespaces%
 %%%%%%%%%%%%%%%%%%%%
}{%
 %%%%%%%%%%%%%%%%%%%%
 \clearpage%
 \end{@maxpaginas}
 %%%%%%%%%%%%%%%%%%%%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{ultimas}{
 %%%%%%%%%%%%%%%%%%%%
 \@orden{ultimas}{justificacion}%
  {Favor de poner la justificacion inmediatamente antes de describir sus ultimas asignaciones.}%
 %%%%%%%%%%%%%%%%%%%%
 \clearpage%
 %%%%%%%%%%%%%%%%%%%%
 \@seccion{Ultimas asignaciones}%
 \smallskip%
 \@instrucciones{%
  Describa brevemente el uso de tiempo del telescopio del OAGH
  durante su \'ultima asignaci\'on (condiciones clim\'aticas,
  estado del equipo, calidad de datos obtenidos, etc). Adem\'as, mencione
  el estado de avance de reducci\'on y an\'alisis de los datos
  obtenidos en el OAGH en sus dos \'ultimas temporadas.
 }
 \medskip%
 %%%%%%%%%%%%%%%%%%%%
 \noindent\ignorespaces%
 %%%%%%%%%%%%%%%%%%%%
}{%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{publicaciones}{%
 %%%%%%%%%%%%%%%%%%%%
 \@orden{publicaciones}{ultimas}%
  {Favor de describir sus \'ultimas asignaciones inmediatamente antes de sus publicaciones.}%
 %%%%%%%%%%%%%%%%%%%%
 \bigskip%
 \@linea%
 \@seccion{Publicaciones}%
 \smallskip
 \@instrucciones{%
  Liste sus publicaciones resultantes con datos del OAGH de los
  \'ultimos tres a\~nos.
 }%
 \medskip%
 %%%%%%%%%%%%%%%%%%%%
 \begin{referencias}%
  \ignorespaces%
 %%%%%%%%%%%%%%%%%%%%
}{%
 %%%%%%%%%%%%%%%%%%%%
 \end{referencias}%
 %%%%%%%%%%%%%%%%%%%%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{largoplazo}{%
 %%%%%%%%%%%%%%%%%%%%
 \@orden{largoplazo}{publicaciones}%
  {Favor de listar sus publicaciones inmediatamente antes de la informaci\'on sobre proyectos de largo plazo.}%
 %%%%%%%%%%%%%%%%%%%%
 \bigskip%
 \@linea%
 \@seccion{Informaci\'on sobre proyectos de largo plazo}%
 \smallskip
 \@instrucciones{%
  Si el proyecto es de largo plazo, describa las temporadas
  previamente asignadas y los resultados obtenidos. Explique
  cu\'antas noches m\'as necesitar\'a.
 }%
 \medskip%
 %%%%%%%%%%%%%%%%%%%%
 \ignorespaces%
 %%%%%%%%%%%%%%%%%%%%
}{%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\AtEndDocument{%
 %%%%%%%%%%%%%%%%%%%%
 \@orden{}{largoplazo}%
  {Favor de poner la informaci\'on sobre proyectos de largo plazo al final.}
 %%%%%%%%%%%%%%%%%%%%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newif\if@hayerrores

\def\@errorseparator{******************************************************************************}

\newcommand{\@error}[1]{%
 \global\@hayerrorestrue%
 \typeout{\@errorseparator}%
 \typeout{* #1}%
 \typeout{\@errorseparator}%
}

\AtEndDocument{%
 %%%%%%%%%%%%%%%%%%%%
 \if@hayerrores%
   \@error{Hay errores. Favor de corregirlos.}%
 \fi%
 %%%%%%%%%%%%%%%%%%%%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Macros taken from aastex.cls (v5)

\let\jnl@style=\rmfamily
\def\ref@jnl#1{{\jnl@style#1}}%
\newcommand\aj{\ref@jnl{AJ}}%
          % Astronomical Journal
\newcommand\araa{\ref@jnl{ARA\&A}}%
          % Annual Review of Astron and Astrophys
\newcommand\apj{\ref@jnl{ApJ}}%
          % Astrophysical Journal
\newcommand\apjl{\ref@jnl{ApJ}}%
          % Astrophysical Journal, Letters
\newcommand\apjs{\ref@jnl{ApJS}}%
          % Astrophysical Journal, Supplement
\newcommand\ao{\ref@jnl{Appl.~Opt.}}%
          % Applied Optics
\newcommand\apss{\ref@jnl{Ap\&SS}}%
          % Astrophysics and Space Science
\newcommand\aap{\ref@jnl{A\&A}}%
          % Astronomy and Astrophysics
\newcommand\aapr{\ref@jnl{A\&A~Rev.}}%
          % Astronomy and Astrophysics Reviews
\newcommand\aaps{\ref@jnl{A\&AS}}%
          % Astronomy and Astrophysics, Supplement
\newcommand\azh{\ref@jnl{AZh}}%
          % Astronomicheskii Zhurnal
\newcommand\baas{\ref@jnl{BAAS}}%
          % Bulletin of the AAS
\newcommand\jrasc{\ref@jnl{JRASC}}%
          % Journal of the RAS of Canada
\newcommand\memras{\ref@jnl{MmRAS}}%
          % Memoirs of the RAS
\newcommand\mnras{\ref@jnl{MNRAS}}%
          % Monthly Notices of the RAS
\newcommand\pra{\ref@jnl{Phys.~Rev.~A}}%
          % Physical Review A: General Physics
\newcommand\prb{\ref@jnl{Phys.~Rev.~B}}%
          % Physical Review B: Solid State
\newcommand\prc{\ref@jnl{Phys.~Rev.~C}}%
          % Physical Review C
\newcommand\prd{\ref@jnl{Phys.~Rev.~D}}%
          % Physical Review D
\newcommand\pre{\ref@jnl{Phys.~Rev.~E}}%
          % Physical Review E
\newcommand\prl{\ref@jnl{Phys.~Rev.~Lett.}}%
          % Physical Review Letters
\newcommand\pasp{\ref@jnl{PASP}}%
          % Publications of the ASP
\newcommand\pasj{\ref@jnl{PASJ}}%
          % Publications of the ASJ
\newcommand\qjras{\ref@jnl{QJRAS}}%
          % Quarterly Journal of the RAS
\newcommand\skytel{\ref@jnl{S\&T}}%
          % Sky and Telescope
\newcommand\solphys{\ref@jnl{Sol.~Phys.}}%
          % Solar Physics
\newcommand\sovast{\ref@jnl{Soviet~Ast.}}%
          % Soviet Astronomy
\newcommand\ssr{\ref@jnl{Space~Sci.~Rev.}}%
          % Space Science Reviews
\newcommand\zap{\ref@jnl{ZAp}}%
          % Zeitschrift fuer Astrophysik
\newcommand\nat{\ref@jnl{Nature}}%
          % Nature
\newcommand\iaucirc{\ref@jnl{IAU~Circ.}}%
          % IAU Cirulars
\newcommand\aplett{\ref@jnl{Astrophys.~Lett.}}%
          % Astrophysics Letters
\newcommand\apspr{\ref@jnl{Astrophys.~Space~Phys.~Res.}}%
          % Astrophysics Space Physics Research
\newcommand\bain{\ref@jnl{Bull.~Astron.~Inst.~Netherlands}}%
          % Bulletin Astronomical Institute of the Netherlands
\newcommand\fcp{\ref@jnl{Fund.~Cosmic~Phys.}}%
          % Fundamental Cosmic Physics
\newcommand\gca{\ref@jnl{Geochim.~Cosmochim.~Acta}}%
          % Geochimica Cosmochimica Acta
\newcommand\grl{\ref@jnl{Geophys.~Res.~Lett.}}%
          % Geophysics Research Letters
\newcommand\jcp{\ref@jnl{J.~Chem.~Phys.}}%
          % Journal of Chemical Physics
\newcommand\jgr{\ref@jnl{J.~Geophys.~Res.}}%
          % Journal of Geophysics Research
\newcommand\jqsrt{\ref@jnl{J.~Quant.~Spec.~Radiat.~Transf.}}%
          % Journal of Quantitiative Spectroscopy and Radiative Trasfer
\newcommand\memsai{\ref@jnl{Mem.~Soc.~Astron.~Italiana}}%
          % Mem. Societa Astronomica Italiana
\newcommand\nphysa{\ref@jnl{Nucl.~Phys.~A}}%
          % Nuclear Physics A
\newcommand\physrep{\ref@jnl{Phys.~Rep.}}%
          % Physics Reports
\newcommand\physscr{\ref@jnl{Phys.~Scr}}%
          % Physica Scripta
\newcommand\planss{\ref@jnl{Planet.~Space~Sci.}}%
          % Planetary Space Science
\newcommand\procspie{\ref@jnl{Proc.~SPIE}}%
          % Proceedings of the SPIE

\let\astap=\aap
\let\apjlett=\apjl
\let\apjsupp=\apjs
\let\applopt=\ao

% Other macros
\newcommand\phn{\phantom{0}}%
\newcommand\phd{\phantom{.}}%
\newcommand\phs{\phantom{$-$}}%
\newcommand\phm[1]{\phantom{#1}}%

\let\la=\lesssim            % For Springer A&A compliance...
\let\ga=\gtrsim

\newcommand\sq{\mbox{\rlap{$\sqcap$}$\sqcup$}}%
\newcommand\arcdeg{\mbox{$^\circ$}}%
\newcommand\arcmin{\mbox{$^\prime$}}%
\newcommand\arcsec{\mbox{$^{\prime\prime}$}}%

\newcommand\fd{\mbox{$.\!\!^{\mathrm d}$}}%
\newcommand\fh{\mbox{$.\!\!^{\mathrm h}$}}%
\newcommand\fm{\mbox{$.\!\!^{\mathrm m}$}}%
\newcommand\fs{\mbox{$.\!\!^{\mathrm s}$}}%
\newcommand\fdg{\mbox{$.\!\!^\circ$}}%
\newcommand\farcm@mss{\mbox{$.\mkern-4mu^\prime$}}%
\let\farcm\farcm@mss
\newcommand\farcs@mss{\mbox{$.\!\!^{\prime\prime}$}}%
\let\farcs\farcs@mss
\newcommand\fp{\mbox{$.\!\!^{\scriptscriptstyle\mathrm p}$}}%
\newcommand\micron{\mbox{$\mu$m}}%
\def\farcm@apj{%
 \mbox{.\kern -0.7ex\raisebox{.9ex}{\scriptsize$\prime$}}%
}%
\def\farcs@apj{%
 \mbox{%
  \kern  0.13ex.%
  \kern -0.95ex\raisebox{.9ex}{\scriptsize$\prime\prime$}%
  \kern -0.1ex%
 }%
}%

\newcommand\case[2]{\mbox{$\frac{#1}{#2}$}}%
\newcommand\slantfrac{\case}%
\newcommand\onehalf{\slantfrac{1}{2}}%
\newcommand\onethird{\slantfrac{1}{3}}%
\newcommand\twothirds{\slantfrac{2}{3}}%
\newcommand\onequarter{\slantfrac{1}{4}}%
\newcommand\threequarters{\slantfrac{3}{4}}%

\newcommand\ubvr{\mbox{$U\!BV\!R$}}%% UBVR system
\newcommand\ub{\mbox{$U\!-\!B$}}%   % U-B
\newcommand\bv{\mbox{$B\!-\!V$}}%   % B-V
\newcommand\vr{\mbox{$V\!-\!R$}}%   % V-R
\newcommand\ur{\mbox{$U\!-\!R$}}%   % U-R
\newcommand\ion[2]{#1$\;${\small\rmfamily\@Roman{#2}}\relax}%
\newcommand\nodata{ ~$\cdots$~ }%
\newcommand\diameter{\ooalign{\hfil/\hfil\crcr\mathhexbox20D}}%
\newcommand\degr{\arcdeg}%
\newcommand\Sun{\sun}%
\newcommand\Sol{\sun}%
\newcommand\sun{\odot}%
%\newcommand\Mercury{\astro{\char1}}% Mercury symbol, "1"
%\newcommand\Venus{\astro{\char2}}% Venus symbol, "2"
\newcommand\Earth{\earth}%
\newcommand\Terra{\earth}%
\newcommand\earth{\oplus}%
%\newcommand\Mars{\astro{\char4}}% Mars symbol, "4"
%\newcommand\Jupiter{\astro{\char5}}% Jupiter symbol, "5"
%\newcommand\Saturn{\astro{\char6}}% Saturn symbol, "6"
%\newcommand\Uranus{\astro{\char7}}% Uranus symbol, "7"
%\newcommand\Neptune{\astro{\char8}}% Neptune symbol, "8"
%\newcommand\Pluto{\astro{\char9}}% Pluo symbol, "9"
%\newcommand\Moon{\astro{\char10}}% Moon symbol, "M"
%\newcommand\Luna{\Moon}%
%\newcommand\Aries{\astro{\char11}}%
%\newcommand\VEq{\Aries}% vernal equinox (Aries)
%\newcommand\Taurus{\astro{\char12}}%
%\newcommand\Gemini{\astro{\char13}}%
%\newcommand\Cancer{\astro{\char14}}%
%\newcommand\Leo{\astro{\char15}}%
%\newcommand\Virgo{\astro{\char16}}%
%\newcommand\Libra{\astro{\char17}}%
%\newcommand\AEq{\Libra}% autumnal equinox (Libra)
%\newcommand\Scorpius{\astro{\char18}}%
%\newcommand\Sagittarius{\astro{\char19}}%
%\newcommand\Capricornus{\astro{\char20}}%
%\newcommand\Aquarius{\astro{\char21}}%
%\newcommand\Pisces{\astro{\char22}}%

\newcommand\sbond{\chem@bnd{\@sbnd}}%
\newcommand\dbond{\chem@bnd{\@dbnd}}%
\newcommand\tbond{\chem@bnd{\@tbnd}}%
\def\chem@bnd#1{%
 {%
  \kern.1em\relax
  \setbox\z@\hbox{M}%
  \dimen@ii.8em\relax
  \p@=.1em\relax
  \dimen@.5\ht\z@\dimen@i-\dimen@
  \advance\dimen@1.5\p@\advance\dimen@i-1.0\p@
  #1%
  \kern.1em\relax
  }%
 }%
\def\@sbnd{%
 \advance\dimen@-1.5\p@\advance\dimen@i1.5\p@
 \vrule\@height\dimen@\@depth\dimen@i\@width\dimen@ii\nobreak
 }%
\def\@dbnd{%
 \advance\dimen@-0.5\p@\advance\dimen@i0.5\p@
 \vrule\@height\dimen@\@depth\dimen@i\@width\dimen@ii\nobreak
 \advance\dimen@-1.5\p@\advance\dimen@i1.5\p@
 \hskip-\dimen@ii
 \vrule\@height\dimen@\@depth\dimen@i\@width\dimen@ii\nobreak
 }%
\def\@tbnd{%
 \vrule\@height\dimen@\@depth\dimen@i\@width\dimen@ii\nobreak
 \advance\dimen@-1.5\p@\advance\dimen@i1.5\p@
 \hskip-\dimen@ii
 \vrule\@height\dimen@\@depth\dimen@i\@width\dimen@ii\nobreak
 \advance\dimen@-1.5\p@\advance\dimen@i1.5\p@
 \hskip-\dimen@ii
 \vrule\@height\dimen@\@depth\dimen@i\@width\dimen@ii\nobreak
 }%

\makeatother
