\ProvidesPackage{ametsoc}
% AMS Latex Style File Version 2.0
% 
% LaTeX style file for American Meteorological Society publications
% (not including BAMS).
%
%************************************************************************
%********************** DO NOT MODIFY THIS FILE!!! **********************
%************************************************************************
%* ANY CHANGES MADE WILL BE LOST UPON UPLOADING YOUR MANUSCRIPT.        *
%* THIS STYLE FILE IS KEPT ON THE UPLOAD SYSTEM AND IS USED TO          *
%* CREATE YOUR MANUSCRIPT.  ANY STYLE FILE YOU UPLOAD WILL NOT BE USED  *
%************************************************************************
%
% Developed by Brian Papa - American Meteorological Society
%
% Based on the initial style file from Lakshmanan, 
% National Severe Storms Laboratory with modifications to follow 
% all AMS formatting style.
%
% Questions/feedback should be addressed to latex@ametsoc.org
%
% 12/29/06
% Added top documentation block and adjusted indentation for
% subsubsections and subsubsubsections (paragraph) to 4mm to follow
% AMS style. Set version number to 1.0 for initial release in Jan
% 2007.
%
% April 2007
% -Switched from the epsfig to the graphicx package
% -Switched from obsolete times package to mathptmx package for times
% fonts in text and math.
% -Added amsmath, fonts, symbols, and boldface packages
% -Rewrote code for appendices to allow for unlimited appendices using
% a single appendix command with an optional 1 letter argument.
% -Redid the page layout using the geometry package
% -Removed extraneous blank spaces to avoid unpredictable formatting
%
% July 2007
% -Set Reference and Abstract headings to all caps.
% -Added use of the setspace package
% -Updated to new doublespacing method
%
% August 2007
% -Updated amspaper.tex with new instructions, added references template information.
%
\usepackage{graphicx}
%
% Seup the page layout using the geometry package
%%%\usepackage[margin=2.54cm,centering]{geometry}
\usepackage[letterpaper,textwidth=16.5cm,textheight=22.9cm]{geometry}
%
% ametsoc.bst is built on top of natbib
\RequirePackage{natbib}

% Use times font in text and math
%\usepackage{mathptmx}
\usepackage{url}

% Provide the amsmath, fonts, symbol, and boldface math packages for use
\usepackage{amsmath,amsfonts,amssymb,bm}

%Use the indent first package to ensure the first paragraph after each
%section is indented.
\usepackage{indentfirst}

%Use setspace to set the spacing to allow double spacing to be defined in the document
\usepackage{setspace}

%If then options
\RequirePackage{ifthen} 

\ProcessOptions

% All the figures and tables should be at the end
\usepackage[nomarkers]{endfloat}%
\renewcommand{\processdelayedfloats}{{%  Change of the original endfloat
   \let\figure\@bfig
   \let\table\@btab
   \processdelayedfloats@hook
   \if@tablesfirst \processtables\processfigures
   \else \processfigures\processtables \fi
   \processotherdelayedfloats}}

%Page numbers.
\pagestyle{plain}

% Article's default is to provide arabic numerals for everything.
% Change the formatting of section and lower to follow AMS style.
\renewcommand{\@seccntformat}[1]{{\csname the#1\endcsname}.~~}%1

%section definitions
\renewcommand{\section}{%
\renewcommand{\@seccntformat}[1]{{\csname the##1\endcsname}.~~}%1
\@startsection
{section}%
{1}% 1 is the level for subsection
{0mm}% NO indent, starts immediately
{-\baselineskip}% skips 1 baseline after end of previous subsection
{0.5\baselineskip}% half baseline and the first paragraph starts
{\Large\bf}%the style, Large and boldface
}
\renewcommand{\thesection}{\arabic{section}} % numbers

% subsection definitions
\renewcommand{\subsection}{%
\renewcommand{\@seccntformat}[1]{{\csname the##1\endcsname}.~~}%1
\@startsection
{subsection}%
{2}% 2 is the level for subsection
{0mm}% NO indent, starts immediately
{-\baselineskip}% skips 1 baseline after end of previous subsection
{0.5\baselineskip}% half baseline and the first paragraph starts
{\normalfont\normalsize\itshape}%the style, all italics
}
\renewcommand{\thesubsection}{\alph{subsection}} % letters

% subsubsection definitions
\renewcommand{\subsubsection}{%
\renewcommand{\@seccntformat}[1]{{\csname the##1\endcsname})~~}%1
\@startsection
{subsubsection}%
{3}% 3 is the level for subsubsection
{5mm}% Indent subsubsections
{-\baselineskip}% skips 1 baseline after end of previous subsubsection
{0.5\baselineskip}% half baseline and the first paragraph starts
{\normalfont\normalsize\sc}%
}
\renewcommand{\thesubsubsection}{\arabic{subsubsection}}

% paragraph (subsubsubsection) definitions
\renewcommand{\paragraph}{%
\renewcommand{\@seccntformat}[1]{({\csname the##1\endcsname})~~}%1
\@startsection
{paragraph}%
{4}% 4 is the level for subsubsubsection (paragraph)
{5mm}% indent paragraph/subsubsubsections the same as subsubsections
{-\baselineskip}% skips 1 baseline after end of previous subsubsection
{0.5\baselineskip}% half baseline and the first paragraph starts
{\normalfont\normalsize\itshape}%
}
\renewcommand{\theparagraph}{\roman{paragraph}}

% Acknowlegments is defined as an unnumbered section.
\newenvironment{acknowledgment}
{\subsubsection*{\textit{Acknowledgments.}}}
{}

\renewenvironment{appendix}[1][1]%
{\ifthenelse{\equal{#1}{1}}%
{\renewcommand{\theequation}{A\arabic{equation}}%
\setcounter{equation}{0}% reset counter
\setcounter{subsection}{0}% reset counter
\begin{center}%
\section*{\textnormal{APPENDIX}}%
\end{center}}%
{\renewcommand{\theequation}{{#1}\arabic{equation}}%
\setcounter{equation}{0}% reset counter
\setcounter{subsection}{0}% reset counter
\begin{center}%
\section*{\textnormal{APPENDIX {#1}}}%
\end{center}}}%

% Legacy Appendix code for backwards compatibility---TO BE DELETED.

% The Appendix is handled as a special section...provide five
% appendices for authors.  The folowing block of code can be cut &
% paste if further appendices are needed.  Dont forget to updated the
% letter at the end of the command and at the beginning of redefining
% the equation counter
%
\newenvironment{appendix1}
{
% redefine the command that creates the equation no.
\renewcommand{\theequation}{A\arabic{equation}}
\setcounter{equation}{0}% reset counter
\setcounter{subsection}{0}% reset counter
\begin{center}
\section*{\textnormal{APPENDIX}}
\end{center}
}

\newenvironment{appendixA}
{
\renewcommand{\theequation}{A\arabic{equation}}
\setcounter{equation}{0}% reset counter
\setcounter{subsection}{0}% reset counter
\begin{center}
\section*{\textnormal{APPENDIX A}}
\end{center}
}

\newenvironment{appendixB}
{
\renewcommand{\theequation}{B\arabic{equation}}
\setcounter{equation}{0}% reset counter
\setcounter{subsection}{0}% reset counter
\begin{center}
\section*{\textnormal{APPENDIX B}}
\end{center}
}

\newenvironment{appendixC}
{
\renewcommand{\theequation}{C\arabic{equation}}
\setcounter{equation}{0}% reset counter
\setcounter{subsection}{0}% reset counter
\begin{center}
\section*{\textnormal{APPENDIX C}}
\end{center}
}

\newenvironment{appendixD}
{
\renewcommand{\theequation}{D\arabic{equation}}
\setcounter{equation}{0}% reset counter
\setcounter{subsection}{0}% reset counter
\begin{center}
\section*{\textnormal{APPENDIX D}}
\end{center}
}

\newenvironment{appendixE}
{
\renewcommand{\theequation}{E\arabic{equation}}
\setcounter{equation}{0}% reset counter
\setcounter{subsection}{0}% reset counter
\begin{center}
\section*{\textnormal{APPENDIX E}}
\end{center}
}

%
% Remove colon in \caption, AMS style is to have a period after the
% figure number
\long\def\@makecaption#1#2{%
% Create the proper style for the figure and table captions.
\renewcommand{\figurename}{\textsc{Fig.}}
\renewcommand{\tablename}{\textsc{Table}}
\renewcommand{\thefigure}{\arabic{figure}.}
\renewcommand{\thetable}{\arabic{table}.}
\vskip\abovecaptionskip
\sbox\@tempboxa{#1~~#2}%
\ifdim \wd\@tempboxa >\hsize
#1~~#2\par%
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
%
% Make sure Abstract heading is uppercase
\renewcommand{\abstractname}{\uppercase{Abstract}}%
%
\if@titlepage
  \renewenvironment{abstract}{%
      \titlepage
      \null\vfil
      \@beginparpenalty\@lowpenalty
      \begin{center}%
        \abstractname
        \@endparpenalty\@M
      \end{center}}%
     {\par\vfil\null\endtitlepage}
\else
  \renewenvironment{abstract}{%
      \if@twocolumn
        \section*{\abstractname}%
      \else
%        \small
        \begin{center}%
          {\abstractname\vspace{-.5em}\vspace{\z@}}%
%	  \newpage
        \end{center}%
        \quotation
%	\newpage
      \fi}
      {\if@twocolumn
       \else
          \endquotation
	  \newpage
       \fi}
\fi

% Define the amstitle
\newcommand{\amstitle}{
   \date{}% No date
   \maketitle%Make the title
   \thispagestyle{empty}% title page doesn't have page number
   \newpage%Title page is separate from rest of article
   \pagenumbering{arabic}%Start pagination from this point
   \newpage%Title page is separate from rest of article
}

%Citations should be of the form ``author year''  not ``author, year''
\bibpunct{(}{)}{;}{a}{}{,}
%
% Center the References section title
\renewcommand{\refname}{\begin{center}\uppercase{References}\end{center}}