%
%  Modifications to article.sty and art12.sty for JASA
%
%  Users should type
%       \documentstyle[12pt,JASA]{article}
%  as the first line of their input file.
%
%  Changed 8 February 1990 by JATC (jatc@emx.utexas.edu)
%  Version 2.1
%
%  Included are some useful things from the AIP style option
%  now on the TeX netservers, released 4 January 1989
%  by Charles Karney (Karney%PPC.MFENET@NMFECC.ARPA)
%  AND also the subequations environment option (authors and
%  documentation below).
%
%  Modifications from version 2.0...
%   (1) \Cite = \citenum.  aip.sty uses \citenum;  they're the same.
%   (2) \appendicies command should be used for more than one appendix
%       Use \appendix command for a single appendix.
%   (3) \JASAabstract = \Abstract; \EndJASAabstract = \EndAbstract
%       It's your choice what to use.  Modifications (2) and (3) are
%       to keep this JASA.sty compatible with the previous versions.
%   (3) fonts loaded by JASA.sty renamed according to LaTeX convention
%
%  This version tweaked for use with LaTeX under teTeX and Linux
%  by Ronald Kumon, 07 Jun 1998 to version 2.2.
%
%  It was further modified to match the latest JASA paper submission 
%  requirements as given in the August 2000 issue of JASA.
%  Modification by Ronald Kumon, 08 Apr 2001, v. 3.0
%
%  It was then modified again to match the latest JASA paper submission 
%  requirements as given in the January 2002 issue of JASA, v. 3.1
%  Modification by Ronald Kumon, February 2002, 3.2
%  Additional modification by Ronald Kumon, September 2002, v. 3.3
%
%  Modifications from version 2.2:
%  (1) In the author command, the entry in square brackets 
%      should only be the first author.  The abbreviation ``JASA''
%      will be added after a comma after the first author's name
%      and then right-justified in the header of each page.
%  (2) Added an option in the /title command to allow the 
%      short title to be put in square brackets between \title
%      and the full title in braces.  The short title is then 
%      listed below the ``Received:'' line.
%  (3) Double spacing of abstract
%  (4) Addition of running title (six words or less)
%  (5) Put abstract on a separate page
%
% Further modified by Ronald Kumon, September 2004 to match 
% the JASA paper submission requirements as given in the July 2004
% issue of JASA:
% (1) Removed ``Received'' and short title on title page.
% (2) Added date on title page.
%
% Modified by Greg Kochanski October 2004 to make internal 
% references to subsections unambiguous: II.A.1 instead of just ``1''.

\typeout{Document Style JASA2e (v3.5), December 2004.}
\typeout{See style file for comments on this release...}
%
%
% ----------------------------------------------------------------------
%                     This LaTeX environment is for
% printing subequations.  To use this environment,include in the
% \documentstyle header a command to load in the  .sty file containing this
% macro. For example:
%     \documentstyle[subeqn]{article}
% IF you  have the  macro in a file subeqn.sty.
%
% JATC note:  The environment seems pretty well-documented in the
%             comments.  You need not worry about typing in the above.
%
% Modified : June 8, 1989.  You can now reference either individual
%            equations in the subequations environment, or all of
%            them.  If you use a \label command immediately after the
%            \begin{subequations} command, then a reference to that
%            label will generate a reference to the equation number
%            without the alphabetic extension.
%
%            Rick Zaccone
%            zaccone@bknlvms.bitnet
%            zaccone@sol.bucknell.edu
% Modified : 16 - january - 1989 by Johannes Braams ( BRAAMS@HLSDNL5)
%            Added \global\@ignoretrue in the definition of
%            \endsubequations in order to prevent a spurious space
%            at the beginning of the next text-line. Also added %'s
%            at the end of each command-line for the same reasons.
%
%
%%%----------------------------------------------------------------
%%%
%%% The subequations environment %%%
%
% Within the subequations environment, the only change is that
% equations are labeled differently.  The number stays the same,
% and lower case letters are appended.  For example, if after doing
% three equations, numbered 1, 2, and 3, you start a subequations
% environmment and do three more equations, they will be numbered
% 4a, 4b, and 4c.  After you end the subequations environment, the
% next equation will be numbered 5.
%
% Both text and equations can be put inside the subequations environment.
%
% If you make any improvements, I'd like to hear about them.
%
% Stephen Gildea
% MIT Earth Resources Lab
% Cambridge, Mass. 02139
% mit-erl!gildea
% gildea@erl.mit.edu
%
\renewcommand{\@seccntformat}[1]{{\csname thehdr#1\endcsname}\hspace{1em}}
\newtoks\@stequation

\def\subequations{\refstepcounter{equation}%
  \edef\@savedequation{\the\c@equation}%
  \@stequation=\expandafter{\theequation}%   %only want \theequation
  \edef\@savedtheequation{\the\@stequation}% %expanded once
  \edef\oldtheequation{\theequation}%
  \setcounter{equation}{0}%
  \def\theequation{\oldtheequation\alph{equation}}}%

\def\endsubequations{%
  \setcounter{equation}{\@savedequation}%
  \@stequation=\expandafter{\@savedtheequation}%
  \edef\theequation{\the\@stequation}\global\@ignoretrue}
%
% ----------------------------------------------------------------------
%
%  Below taken from aip.sty...
% 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}
%
% ----------------------------------------------------------------------
%
%  Here's a fix to boldface page numbers...
\renewcommand{\ps@plain}{\let \@mkboth \@gobbletwo
   \def \@oddhead {}
   \def \@oddfoot {\rm \hfil \textbf{\thepage} \hfil }
   \def \@evenhead {}
   \let \@evenfoot\@oddfoot }
%
% ----------------------------------------------------------------------
%
%  Load some fonts not currently loaded in LaTeX...
%  [JASA2e: These are built-in for LaTeX2e.]
%
%\font\twlrm = cmr12
%\font\twlmi = cmmi12
%\font\twlbf = cmbx12
%\font\frtnbf = TimesB at 15pt             % I like Times font better...
%
%\font\twlsfb = HelveticaB at 11.5pt
%\font\twlsf = Helvetica at 11.5pt
%\font\twlsfb = cmssbx10 \@magscale1      % Use these if you do not have
%\font\twlsf = cmss10 \@magscale1         % access to PostScript fonts...

%  ...and some spacing macros from FDC...
\def\singlespace{
   \baselineskip = 15 pt plus .24 pt
   \parskip = 0 pt plus 2.4 pt minus 1.2 pt
   }
\def\spaceandhalf{
   \baselineskip = 18 pt plus .24 pt
   \parskip = 0 pt plus 2.4 pt minus 1.2 pt
   }
\def\doublespace{
   \baselineskip = 21 pt plus .24 pt
   \parskip = 0 pt plus 2.4 pt minus 1.2 pt
   }
%
% ----------------------------------------------------------------------
%
%  The following section commands have been modified...
\def\section{\@startsection {section}{1}{\z@}{3.5ex plus 1ex minus
 .2ex}{1.5ex plus .2ex}{\normalsize\sffamily\bfseries}}
\def\subsection{\@startsection{subsection}{2}{\z@}{3.25ex plus 1ex minus
 .2ex}{1.5ex plus .2ex}{\normalsize\sffamily\bfseries}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{3.25ex plus
 1ex minus .2ex}{1.5ex plus .2ex}{\normalsize\sffamily\bfseries\slshape}}
\def\paragraph{\@startsection
 {paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}
 {\normalsize\sffamily\bfseries}}
\def\subparagraph{\@startsection
 {subparagraph}{4}{\parindent}{3.25ex plus 1ex minus
 .2ex}{-1em}{\normalsize\sffamily\bfseries}}
%
%   Stuff below is meant to fix the period after section label problem
%   and fixes the aip.sty problems with the Appendix.
%
\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
     \def\@svsec{}\else
     \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname.\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}}
%
%  Make a new appendicies command.  A single appendix does not
%  need a letter but several appendicies do.
\def\appendicies{\par
   \setcounter{section}{0}
   \setcounter{subsection}{0}
   \setcounter{equation}{0}
   \@addtoreset{equation}{section}
   \def\@eqnnum{({\rmfamily\thesectioneqnno}\arabic{equation})}
   \def\thesection{APPENDIX \Alph{section}}
   \def\thesectioneqnno{\hbox{\Alph{section}}}
   \def\theequation{\hbox{\thesectioneqnno}\arabic{equation}}
}
\def\appendix{\par
   \setcounter{section}{0}
   \setcounter{subsection}{0}
   \setcounter{equation}{0}
   \@addtoreset{equation}{section}
   \def\@eqnnum{({\rmfamily\thesectioneqnno}\arabic{equation})}
   \def\thesection{APPENDIX}
   \def\thesectioneqnno{\hbox{\Alph{section}}}
   \def\theequation{\hbox{\thesectioneqnno}\arabic{equation}}
}
%
% ----------------------------------------------------------------------
%
%
%  Redo labelling...
\def\labelenumi{\arabic{enumi}.}
\def\theenumi{\arabic{enumi}}
\def\labelenumii{(\alph{enumii})}
\def\theenumii{\alph{enumii}}
\def\p@enumii{\theenumi}
\def\labelenumiii{\roman{enumiii}.}
\def\theenumiii{\roman{enumiii}}
\def\p@enumiii{\theenumi(\theenumii)}
\def\labelenumiv{\Alph{enumiv}.}
\def\theenumiv{\Alph{enumiv}}
\def\p@enumiv{\p@enumiii\theenumiii}
%  Redo equation modes...
\def\theequation{\arabic{equation}}
%
% ----------------------------------------------------------------------
%
%  I think arraycolsep should be smaller for equations...
\arraycolsep 2pt \tabcolsep 6pt \arrayrulewidth .4pt \doublerulesep 2pt
\tabbingsep \labelsep
%
% ----------------------------------------------------------------------
%
%  Redefine the way article displays its section labels...
\def\thesection {\Roman{section}}
\def\thehdrsection {\Roman{section}}
\def\thesubsection {{\Roman{section}.\Alph{subsection}}}
\def\thehdrsubsection {\Alph{subsection}}
\def\thesubsubsection {{\Roman{section}.\Alph{subsection}.\arabic{subsubsection}}}
\def\thehdrsubsubsection {\arabic{subsubsection}}
\def\thehdrparagraph {\arabic{paragraph}.}
\def\theparagraph {{\Roman{section}.\Alph{subsection}.\arabic{subsubsection}.\arabic{paragraph}}}
\def\thehdrsubparagraph {\arabic{subparagraph}.}
\def\thesubparagraph {{\Roman{section}.\Alph{subsection}.\arabic{subsubsection}.\arabic{paragraph}.\arabic{subparagraph}}}
%
% ----------------------------------------------------------------------
%
\def\@biblabel#1{\hfill{${}^{\mbox{\scriptsize #1}}$}}

\def\thebibliography#1{\section*{REFERENCES\markboth
 {REFERENCES}{REFERENCES}}\setlength{\labelsep}{0.0pt}\list
{$^{\mbox\scriptsize\arabic{enumi}}$}{\settowidth\labelwidth{[#1]}
\leftmargin\labelwidth
 \advance\leftmargin\labelsep
 \usecounter{enumi}}
 \def\newblock{\hskip .11em plus .33em minus -.07em}
 \sloppy
 \sfcode`\.=1000\relax}
\let\endthebibliography=\endlist
%
% ----------------------------------------------------------------------
%
%  Use footnote symbols rather than numbers...
\@addtoreset{footnote}{page}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
%
% ----------------------------------------------------------------------
%
%  Change the way 'article' does captioning...
\def\@makecaption#1#2{
 \vskip 10pt
 \setbox\@tempboxa\hbox{#1. #2}
 \ifdim \wd\@tempboxa >\hsize \unhbox\@tempboxa\par \else \hbox
to\hsize{\hfil\box\@tempboxa\hfil}
 \fi}
\def\fnum@figure{FIG. \thefigure}         %  Modified from 'article'
\def\thetable{\@Roman\c@table}            %  Modified from 'article'
\def\fnum@table{TABLE \thetable}          %  Modified from 'article'
%
% ----------------------------------------------------------------------
%
%  Redo the way article style sets up the title page...
\def\maketitle{\par
 \begingroup
 \def\thefootnote{\alph{footnote})}
 \def\@makefnmark{\hbox to 0pt{$^{\@thefnmark}$\hss}}
 \if@twocolumn
     \twocolumn[\@maketitle]
 \else
    \newpage\global\@topnum\z@ \@maketitle
 \fi
\thispagestyle{plain}\@thanks
 \endgroup
 \setcounter{footnote}{0}
 \let\maketitle\relax
 \let\@maketitle\relax
\gdef\@thanks{}\gdef\@author{}\gdef\@title{}\gdef\@address{}
\let\thanks\relax}

\def\@maketitle{\null
 \renewcommand{\rmdefault}{ptm}
 \vskip 1em {\large \noindent \@title  \par}
 \renewcommand{\rmdefault}{cmr}
 \begin{quotation}
   \vskip 1em {\normalsize \sffamily\noindent\@author \par}
%   \vskip 1em {\normalsize \slshape\noindent\@address \par}
%   \vspace{0.25in} {\normalsize \noindent\received \par}
%   \vspace{0.25in} {\normalsize \noindent\shorttitle \par}
   \vspace{0.5in} {\normalsize \noindent(\@date) \par}
   \vspace{0.5in} {\normalsize \noindent\runningtitle \par}
 \end{quotation}}

%  Set up some commands for the title page...
\renewcommand{\and}{,\space}
\def\author{\@ifnextchar[{\@newauthor}{\@dblarg{\@newauthor}}}
\def\@newauthor[#1]#2{\gdef\@author{#2}\gdef\headerauthor{#1}}
\def\title{\@ifnextchar[{\@newtitle}{\@dblarg{\@newtitle}}}
\def\@newtitle[#1]#2{\gdef\@title{#2}\gdef\headertitle{#1}}
\def\address#1{\gdef\@address{#1}}
\newcommand{\definerunningtitle}[1]{\def\runningtitlename{#1}}

\newcommand{\received}{Received: \ \ \ }
\newcommand{\shorttitle}{Short title: \ \textsf{\headertitle}}
\newcommand{\runningtitle}{Running title: \ \textsf{\runningtitlename}}
%
% ----------------------------------------------------------------------
%
%  define some new abstract commands...
\newcommand{\JASAabstract}{
 \clearpage
 \begin{quotation}
 {\normalsize\sffamily\bfseries\noindent ABSTRACT \par}
 \vspace{0.5\baselineskip}}
\newcommand{\EndJASAabstract}{\end{quotation}\clearpage}
\def\PACS#1{\nopagebreak\vskip 1em \noindent PACS numbers: #1}
\def\endabstract{\clearpage}
%
% ----------------------------------------------------------------------
%
%  Add JASA headings for each page...
\def\ps@JASAheadings{
   \def\@oddhead{\hfil{\small\sl\headerauthor, JASA}}
   \def\@oddfoot{\hfil\rm{\bf\thepage}\hfil}
   \def\@evenhead{\hfil{\small\sl\headerauthor, JASA}}
   \def\@evenfoot{\hfil\rm{\bf\thepage}\hfil}
   \def\sectionmark##1{}\def\subsectionmark##1{}}
%
% ----------------------------------------------------------------------
%
%  The page size setup for JASA margins...
%  Note:  some fudging is necessary since the Laserwriter can't print
%            on the entire page area.
%  Also note that 1 in = 2.54 cm = 72.27 pt
\oddsidemargin  0.3125 in
\evensidemargin 0.3125 in
\topmargin    -0.09375 in
\headheight   12.00000 pt
\headsep       0.34646 in
\textheight     8.2500 in
%\footheight   12.00000 pt
\footskip      0.37500 in
\textwidth     5.96875 in
%
% ----------------------------------------------------------------------
%
%  Change to reasonable default spacing...
\addtolength{\baselineskip}{0.5 \baselineskip}
\ps@plain \pagenumbering{arabic} \onecolumn \if@twoside\else\raggedbottom\fi
%
% ----------------------------------------------------------------------
%
%  Add the registered (circle R) mark needed for Kevlar, Teflon, etc...
\def\registered{{\ooalign
  {\hfil\kern+.05em\raise.12ex
\hbox{\tiny R}\hfil\crcr{\footnotesize\mathhexbox20D}}}}
%
% ----------------------------------------------------------------------
%
\newcommand{\mathbold}[1]{\mbox{\boldmath $\bf#1$}}
%
%  Below were added to maintain compatibility with older
%  versions of JASA.sty
%
\newcommand{\Cite}{\citenum}
\newcommand{\Abstract}{\JASAabstract}
\newcommand{\EndAbstract}{\EndJASAabstract}
