% AIP (style option to ARTICLE) for American Institute of Physics journals
% AIP DOCUMENT SUBSTYLE -- released 17 January 1989
% Written by Charles Karney (Karney@ccc.nmfecc.gov).

% This document style is designed for manuscripts to be submitted to
% one of the journals published by the Americal Institute of Physics.
% To use this give AIP as an optional argument to \documentstyle.  The
% main style should be ARTICLE.  E.g.,
%     \documentstyle[12pt,aip]{article}
% This provides

% (1) Section numbering for AIP journals (e.g., II.B.2.)

% (2) Superscript reference numbers in citation and bibliography.  You
% should put the references in the logically correct place, e.g., "...  as
% is given by Landau \cite{landau}.  Next sentence ..."  \cite takes care
% of removing the preceding spaces and putting the reference after the
% punctuation (e.g, "...  Landau.$^7$ ...").

% (3) Three or more consecutive reference numbers are represented as a
% range.  Thus 1,3,4,5,6,8,9 is printed as 1,3--6,8,9.  No sorting is
% performed; i.e., 1,3,2 is printed as such.

% (4) \citenum and \citea give you more control over the appearance of
% the citations.  \citenum emits the plain citation number without
% ornament as in "...  as shown in Ref.~\citenum{foo}.".  \citea puts it's
% argument into the ornamentation for citations.  Thus \cite{foo} is
% equivalent to \citea{\citenum{foo}}.

% (5) The \maketitle command puts the "date" at the top.  Typical usage is
%     \begin{document}
%     \date{PPPL--2128 (1984)}
%     \title{Efficiency of Current Drive by Fast Waves}
%     \author{Charles F. F. Karney and Nathaniel J. Fisch\\
%     Plasma Physics Laboratory, Princeton University\\Princeton, NJ 08543}
%     \maketitle
%     \begin{abstract}
%     etc.

% (6) Abstract appears full size.  Abstract is labeled ``Abstract'' unless
% the ``abstract*'' environment is used.  Section I begins on a new page.

% (7) First paragraph of sections, etc., is normally indented.

% (8) In appendices equations are numbered as B2 etc.

% (9) Appendix appears in the section title for appendices.  A period is
% put after the section or appendix number.  E.g., I. Introduction.

% (10) The ``thefigures'' and ``thetables'' environments are defined
% analogously to ``thebibliography''.  This allows you the put the figure
% captions and tables at the end of the document.  The entries are
% preceded by \figitem{<label>} and \tableitem{<label>} respectively.
% (This doesn't interfer with LaTeX's figure and table environments for
% inserting figures within the text.)  ``thefigures'' is used as follows:
%     \begin{thefigures}{99}
%     \figitem{coords}  The coordinate system used in this work.
%     etc.
%     \end{thefigures}
% Figures and tables are refered to by the \ref mechanism.  E.g.,
% Fig.~\ref{coords}.
% The starred versions of these environments, e.g., ``thefigures*'' causes
% the heading to appear in the singular, i.e., ``Figure'' instead of
% ``Figures''.

% (11) The first appendix, the references, figure captions, and tables
% all start on on new pages.

% (12) \appendix* causes the appendices to be unnumbered.  This is normally
% only sensible if you have just one appendix.  It is labeled ``Appendix.''
% instead of ``Appendix A.''  The equation numbered are still labeled A3 etc.

\typeout{Document Substyle 'AIP'.  Released 17 January 1989}

\def\thesection       {\Roman{section}}
\def\thesubsection    {\Alph{subsection}}
\def\thesubsubsection {\arabic{subsubsection}}

\def\thebibliography#1{\par\clearpage\section*{References\@mkboth
  {REFERENCES}{REFERENCES}}\list
  {$\m@th^{\arabic{enumi}}$}{\settowidth\labelwidth{$\m@th^{#1}$}%
    \labelsep0pt\leftmargin\parindent
    \itemindent-\leftmargin\advance\itemindent\labelwidth
    \usecounter{enumi}}
    \def\newblock{\hskip .11em plus .33em minus -.07em}
    \sloppy
    \sfcode`\.=1000\relax}

% Superscript citations -- skip optional arg to \cite
% Move citation after period and comma.
\def\@cite#1#2{\unskip\nobreak\relax
    \def\@tempa{$\m@th^{\hbox{\the\scriptfont0 #1}}$}%
    \futurelet\@tempc\@citexx}
\def\@citexx{\ifx.\@tempc\let\@tempd=\@citepunct\else
    \ifx,\@tempc\let\@tempd=\@citepunct\else
    \let\@tempd=\@tempa\fi\fi\@tempd}
\def\@citepunct{\@tempc\edef\@sf{\spacefactor=\the\spacefactor\relax}\@tempa
    \@sf\@gobble}

% \citenum emits the plain citation number without ornament
% \citea puts it's argument into the ornamentation for citations
% thus \cite{foo} is equivalent to \citea{\citenum{foo}}
\def\citenum#1{{\def\@cite##1##2{##1}\cite{#1}}}
\def\citea#1{\@cite{#1}{}}

% Collapse citation numbers to ranges.  Non-numeric and undefined labels
% are handled.  No sorting is done.  E.g., 1,3,2,3,4,5,foo,1,2,3,?,4,5
% gives 1,3,2-5,foo,1-3,?,4,5
\newcount\@tempcntc
\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \@tempcnta\z@\@tempcntb\m@ne\def\@citea{}\@cite{\@for\@citeb:=#2\do
    {\@ifundefined
       {b@\@citeb}{\@citeo\@tempcntb\m@ne\@citea\def\@citea{,}{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
    {\setbox\z@\hbox{\global\@tempcntc0\csname b@\@citeb\endcsname\relax}%
     \ifnum\@tempcntc=\z@ \@citeo\@tempcntb\m@ne
       \@citea\def\@citea{,}\hbox{\csname b@\@citeb\endcsname}%
     \else
      \advance\@tempcntb\@ne
      \ifnum\@tempcntb=\@tempcntc
      \else\advance\@tempcntb\m@ne\@citeo
      \@tempcnta\@tempcntc\@tempcntb\@tempcntc\fi\fi}}\@citeo}{#1}}
\def\@citeo{\ifnum\@tempcnta>\@tempcntb\else\@citea\def\@citea{,}%
  \ifnum\@tempcnta=\@tempcntb\the\@tempcnta\else
   {\advance\@tempcnta\@ne\ifnum\@tempcnta=\@tempcntb \else \def\@citea{--}\fi
    \advance\@tempcnta\m@ne\the\@tempcnta\@citea\the\@tempcntb}\fi\fi}

% Title page
\def\@maketitle{\newpage
 \null
 \vskip 1em plus 2em minus 1em     % Vertical space before date.
 \ifx\@date\@empty\else
   \begin{flushright}
    {\normalsize \@date}           % Date set in \large size.
   \end{flushright}
   \vskip 2em plus 2em minus 1em   % Vertical space above title.
 \fi
 \begin{center}
  {\Large\bf \@title \par}     % Title set in \Large size. 
  \vskip 1.5em plus 0em minus .5em  % Vertical space after title.
  {\large                        % each author set in \large, in a
   \lineskip .5em plus 0em minus .3em   % tabular environment
   \begin{tabular}[t]{c}\@author 
   \end{tabular}\par}
\end{center}
 \par
 \vskip 1.5em plus .5em minus .5em}     % Vertical space after author.

\newif\if@starvariant \@starvariantfalse

\def\abstract{\if@starvariant\else\section*{Abstract}\fi}
\def\endabstract{\par\clearpage}

\@namedef{abstract*}{\@starvarianttrue\abstract}
\@namedef{endabstract*}{\endabstract}

\parskip 1.5pt plus 1.5pt          % Extra vertical space between paragraphs.
\tabcolsep 12pt			   % Double column separation in tables

\def\section{\@startsection {section}{1}{\z@}{3.5ex plus 1ex minus 
    .2ex}{2.3ex plus .2ex}{\large\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{3.25ex plus 1ex minus 
   .2ex}{1.5ex plus .2ex}{\large\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{3.25ex plus 
1ex minus .2ex}{1.5ex plus .2ex}{\normalsize\bf}}

\newif\if@numbersec \@numbersectrue
\def\appendix{\par\clearpage
  \setcounter{section}{0}
  \setcounter{subsection}{0}
  \@addtoreset{equation}{section}
  \def\theequation{\thesection\arabic{equation}}
  \def\thesection{\Alph{section}}
  \def\thesubsection{\arabic{subsection}}
  \@ifstar{\def\@sectname{Appendix}\@numbersecfalse}
          {\def\@sectname{Appendix~}\@numbersectrue}}

% Figures
\def\thefigures#1{\par\clearpage
 \if@starvariant\section*{Figure\@mkboth
    {FIGURE}{FIGURE}}\else
  \section*{Figures\@mkboth
    {FIGURES}{FIGURES}}\fi
 \list
  {FIG.~\arabic{enumi}.}{\labelwidth\parindent\advance\labelwidth -\labelsep
      \leftmargin\parindent\usecounter{enumi}}}
\def\figitem#1{\item\label{#1}}
\let\endthefigures=\endlist

\@namedef{thefigures*}{\@starvarianttrue\thefigures}
\@namedef{endthefigures*}{\endthefigures}

% Tables
\def\thetables#1{\par\clearpage
 \if@starvariant\section*{Table\@mkboth
    {TABLE}{TABLE}}\else
  \section*{Tables\@mkboth
    {TABLES}{TABLES}}\fi
 \list
  {TABLE~\Roman{enumi}.}{\labelwidth-\labelsep
      \leftmargin0pt\usecounter{enumi}%
      \def\theenumi{\Roman{enumi}}}}
\def\tableitem#1{\item\label{#1}}
\let\endthetables=\endlist

\@namedef{thetables*}{\@starvarianttrue\thetables}
\@namedef{endthetables*}{\endthetables}

% Put period after section number and allow for APPENDIX prefix.
\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
     \def\@svsec{}\else 
     \refstepcounter{#1}\edef\@svsec{\ifnum #2=1 \@sectname
         \if@numbersec\csname the#1\endcsname\fi.\else
         \csname the#1\endcsname.\fi
	\hskip 1em }\fi
     \@tempskipa #5\relax
      \ifdim \@tempskipa>\z@ 
        \begingroup #6\relax
          \@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty \@M #8\par}
        \endgroup
       \csname #1mark\endcsname{#7}\addcontentsline
         {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                      \protect\numberline{\csname the#1\endcsname}\fi
                    #7}\else
        \def\@svsechd{#6\hskip #3\@svsec #8\csname #1mark\endcsname
                      {#7}\addcontentsline
                           {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                             \protect\numberline{\csname the#1\endcsname}\fi
                       #7}}\fi
     \@xsect{#5}}

\def\@sectname{}

\endinput