\ProvidesPackage{ametsoc}
% AMS Latex Style File Version 3.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.
%
% 9/12/2007
% -Removed use of \doublespace and replaced with baselinstretch and removed setspace package
% so captions and text would be double spaced
% -Added dvips option to geometry to guarantee page layout info is passed to the dvi file
%
% August 12, 2008 -- Sarah Cooley, AMS
% - Shortened endfloat commands 
% - Moved \setcounter command here from .tex
% - Removed legacy appendix code for app's A-E
%	- Made captions in list of figures/tables double spaced, cap's under figs/tables single sp.
%	- Removed dotted line from list of figures/tables
%
% August, 2008 -- Brian Papa, AMS
% - Cretaed separate style file for single space double column draft for author use
% - Added doublespacing boolean 
% - Created header for first page to indicate use of Official AMS LaTeX template
% - Corrected usepackage commands to Requirepackage
%
\RequirePackage{graphicx}
%
% Seup the page layout using the geometry package
\RequirePackage[dvips,letterpaper,textwidth=16.5cm,textheight=22.9cm]{geometry}
%
% ametsoc.bst is built on top of natbib
\RequirePackage{natbib}

% Use times font in URLs
\RequirePackage{url}

% Define a light gray color for use in the title page header
\RequirePackage{color}
\definecolor{lightgray}{gray}{0.75}
\RequirePackage{fancyhdr}

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

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

%If then options
\RequirePackage{ifthen} 
\newboolean{dc}
\setboolean{dc}{false}

%Ensure both text and captions are double spaced following AMS requirements
\ifthenelse{\boolean{dc}}
{}
{\renewcommand{\baselinestretch}{2.0}}

\renewcommand{\labelenumi}{\roman{enumi}.}
% All the figures and tables should be at the end on their own pages
\RequirePackage[nomarkers, tablesfirst]{endfloat}%
\AtBeginDelayedFloats{\clearpage}
%\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}

\setcounter{secnumdepth}{4}
% 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}}

% Acknowledgments 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}}}%

%
% 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}
%
\renewcommand{\abstractname}{\uppercase{Abstract}}%
%
\renewenvironment{abstract}{
\normalfont% Used under normal template conditions
\begin{center}%
{\abstractname\vspace{-.5em}\vspace{\z@}}%
\end{center}
}

% Define the amstitle
\newcommand{\amstitle}{
   \date{}% No date
   \maketitle%Make the title
   \thispagestyle{fancy}% title page doesn't have page number
   \lhead{\textcolor{lightgray}{\footnotesize{Generated using version 3.0 of the official AMS \LaTeX\ template}}}
   \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}{}{,}
%
% Adjust the spacing for two column papers
\ifthenelse{\boolean{dc}}
{\setlength{\columnsep}{.25in}}
{}
% Center the References section title
\renewcommand{\refname}{\begin{center}\uppercase{References}\end{center}}

%Change the way the list of figures and tables operates
\renewcommand\listoffigures{
    \section*{\listfigurename}%
    \renewcommand{\baselinestretch}{2.0}
    \small\normalsize
    \@starttoc{lof}%
}
%
\renewcommand*\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
\renewcommand{\@dotsep}{1000}

\renewcommand\listoftables{
    \section*{\listtablename}%
    \renewcommand{\baselinestretch}{2.0}
    \small\normalsize
    \@starttoc{lot} \renewcommand*\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
\renewcommand{\@dotsep}{1000}
}