% \iffalse meta-comment
%
% Copyright (C) 2007, 2008 by Elsevier Ltd.
% ----------------------------------------
% 
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.2
% of this license or (at your option) any later version.
% The latest version of this license is in:
%
%    http://www.latex-project.org/lppl.txt
%
% and version 1.2 or later is part of all distributions of LaTeX 
% version 1999/12/01 or later.
%
% \fi
% \CheckSum{1854}
%
% \iffalse
%<*driver>
\documentclass{ltxdoc}
\EnableCrossrefs         
\CodelineIndex
\RecordChanges
\usepackage{comment}
\begin{document}
  \DocInput{elsarticle.dtx}
  \PrintChanges
  \PrintIndex
\end{document}
%</driver>
% \fi
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \changes{v1.1}{2008/09/25}{Initial version}
%
% \GetFileInfo{elsarticle.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment}
% 
%
% \title{The \textsf{elsarticle.cls} -- Implimentation}
% \author{Elsevier Ltd.}
%
% \maketitle
%
% \StopEventually{}
%
% \section{Implementation}
%
%    \begin{macrocode}
%<*class>
%% $Id: elsarticle.cls,v 1.18 2008-08-28 06:03:47 cvr Exp $
%% 
 \def\RCSfile{elsarticle}%
 \def\RCSversion{1.0.1}%
 \def\RCSdate{2008/05/22}%
 \def\@shortjnl{\relax}
 \def\@journal{Elsevier Science} \def\@company{Elsevier Science}
 \def\@issn{000-0000}
 \def\@shortjid{elsarticle}
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{\@shortjid}[\RCSdate, \RCSversion: \@journal]
%
%
\def\ABD{\AtBeginDocument}
\newif\ifpreprint \preprintfalse
\newif\iflongmktitle \longmktitlefalse

\def\@blstr{1}
\newdimen\@bls
\@bls=\baselineskip

\def\@finalWarning{%
  *****************************************************\MessageBreak
   This document is typeset in the CRC style which\MessageBreak
   is not suitable for submission.\MessageBreak
   \MessageBreak
   Please typeset again using 'preprint' option\MessageBreak
   for creating PDF suitable for submission.\MessageBreak
  ******************************************************\MessageBreak
}

    
\DeclareOption{preprint}{\global\preprinttrue
  \gdef\@blstr{1}\xdef\jtype{0}%
   \AtBeginDocument{\@twosidefalse\@mparswitchfalse}}
\DeclareOption{final}{\gdef\@blstr{1}\global\preprintfalse}
\DeclareOption{review}{\global\preprinttrue\gdef\@blstr{1.5}}
\DeclareOption{authoryear}{\xdef\@biboptions{authoryear}}
\DeclareOption{number}{\xdef\@biboptions{square,numbers}}
\DeclareOption{numbers}{\xdef\@biboptions{square,numbers}}
\DeclareOption{longtitle}{\global\longmktitletrue}
\DeclareOption{5p}{\xdef\jtype{5}\global\preprintfalse
  \ExecuteOptions{twocolumn}}
  \def\jtype{0}
\DeclareOption{3p}{\xdef\jtype{3}\global\preprintfalse}
\DeclareOption{1p}{\xdef\jtype{1}\global\preprintfalse
  \AtBeginDocument{\@twocolumnfalse}}
\DeclareOption{times}{\IfFileExists{txfonts.sty}%
  {\AtEndOfClass{\RequirePackage{txfonts}%
  \gdef\ttdefault{cmtt}%
   \let\iint\relax
  \let\iiint\relax
  \let\iiiint\relax
  \let\idotsint\relax
  \let\openbox\relax}}{\RequirePackage{times}}}
\ExecuteOptions{a4paper,10pt,oneside,onecolumn,number,preprint}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
\LoadClass{article}
\RequirePackage{graphicx}
%    \end{macrocode}
% 
% \section{Preamble}
%
%    \begin{macrocode}
\let\comma\@empty
\let\tnotesep\@empty
\def\title#1{\gdef\@title{#1}}
\let\@title\@empty

\def\elsLabel#1{\@bsphack\protected@write\@auxout{}%
         {\string\Newlabel{#1}{\@currentlabel}}\@esphack}
\def\Newlabel#1#2{\expandafter\xdef\csname X@#1\endcsname{#2}}

\def\Ref#1{\@ifundefined{X@#1}{0}{\csname X@#1\endcsname}%
%      \alarm{REF [#1]: \csname X@#1\endcsname}%
}

\def\tnotemark[#1]{\textsuperscript{\@for\@@tmark:=#1\do{%
      \edef\tnotenum{\@ifundefined{X@\@@tmark}{1}{\Ref{\@@tmark}}}%
      \ifcase\tnotenum\or\ding{73}\or,\ding{73}\ding{73}\fi}}%
}
\let\@tnotemark\@empty

\let\@tnotes\@empty
\RequirePackage{pifont}
\newcounter{tnote}
\def\tnotetext[#1]#2{\g@addto@macro\@tnotes{%
  \refstepcounter{tnote}\elsLabel{#1}%
   \def\thefootnote{\ifcase\c@tnote\or\ding{73}\or\ding{73}\ding{73}\fi}%
    \footnotetext{#2}}}

\newcounter{fnote}
\def\fnmark[#1]{\let\comma\@empty
    \def\@fnmark{\@for\@@fnmark:=#1\do{%
    \edef\fnotenum{\@ifundefined{X@\@@fnmark}{1}{\Ref{\@@fnmark}}}%
  \unskip\comma\fnotenum\let\comma,}}%
}

\let\@fnotes\@empty\let\@fnmark\@empty
\def\fntext[#1]#2{\g@addto@macro\@fnotes{%
     \refstepcounter{fnote}\elsLabel{#1}%
   \def\thefootnote{\thefnote}%
   \global\setcounter{footnote}{\thefnote}%
   \footnotetext{#2}}}

\def\cormark[#1]{\edef\cnotenum{\Ref{#1}}\unskip%
   \textsuperscript{\sep\ifcase\cnotenum\or
       $\ast$\or$\ast\ast$\fi\hspace{-1pt}}\let\sep=,}

\let\@cormark\@empty
\let\@cornotes\@empty
\newcounter{cnote}
\def\cortext[#1]#2{\g@addto@macro\@cornotes{%
    \refstepcounter{cnote}\elsLabel{#1}% 
    \def\thefootnote{\ifcase\thecnote\or$\ast$\or
    $\ast\ast$\fi}%
    \footnotetext{#2}}}

\def\corref#1{\cormark[#1]}
\def\fnref#1{\fnmark[#1]}
\def\tnoteref#1{\tnotemark[#1]}

\def\resetTitleCounters{\c@cnote=0
   \c@fnote=0 \c@tnote=0 \c@footnote=0}

\let\eadsep\@empty
\let\@elseads\@empty
\let\@elsuads\@empty
\let\@cormark\@empty
\def\ead{\@ifnextchar[{\@uad}{\@ead}}
\gdef\@ead#1{\bgroup\def\_{\string\_}\def\{{\string\{}%
   \def\}{\string\}}%
   \edef\tmp{\the\@eadauthor}
   \immediate\write\@auxout{\string\emailauthor
     {#1}{\expandafter\strip@prefix\meaning\tmp}}%
  \egroup
}
\newcounter{ead}
\gdef\emailauthor#1#2{\stepcounter{ead}%
     \g@addto@macro\@elseads{\raggedright%
      \let\corref\@gobble 
      \eadsep\texttt{#1} (#2)\def\eadsep{\unskip,\space}}%
}
\gdef\@uad[#1]#2{\bgroup
   \edef\tmp{\the\@eadauthor}
   \immediate\write\@auxout{\string\urlauthor
     {#2}{\expandafter\strip@prefix\meaning\tmp}}%
  \egroup
}
\def\urlauthor#1#2{\g@addto@macro\@elsuads{\let\corref\@gobble%
     \raggedright\eadsep\texttt{#1}\space(#2)%
     \def\eadsep{\unskip,\space}}%
}

\def\elsauthors{}
\def\pprinttitle{}
\let\authorsep\@empty
\let\sep\@empty
\newcounter{author}
\def\author{\@ifnextchar[{\@@author}{\@author}}

\newtoks\@eadauthor
\def\@@author[#1]#2{\g@addto@macro\elsauthors{%
    \def\baselinestretch{1}%
    \authorsep#2\unskip\textsuperscript{%#1%
      \@for\@@affmark:=#1\do{%
       \edef\affnum{\@ifundefined{X@\@@affmark}{1}{\Ref{\@@affmark}}}%
     \unskip\sep\affnum\let\sep=,}%
      \ifx\@fnmark\@empty\else\unskip\sep\@fnmark\let\sep=,\fi}%
    \def\authorsep{\unskip,\space}%
    \global\let\sep\@empty
    \global\let\@fnmark\@empty}%
    \@eadauthor={#2}
}

\def\@author#1{\g@addto@macro\elsauthors{\normalsize%
    \def\baselinestretch{1}%
    \upshape\authorsep#1\unskip\textsuperscript{%
      \ifx\@fnmark\@empty\else\unskip\sep\@fnmark\let\sep=,\fi}%
    \def\authorsep{\unskip,\space}%
    \global\let\@fnmark\@empty
    \global\let\sep\@empty}%
    \@eadauthor={#1}
}

\def\elsaddress{}
\def\addsep{\par\vskip6pt}
\def\address{\@ifnextchar[{\@@address}{\@address}}

\newcounter{affn}
\renewcommand\theaffn{\alph{affn}}

\long\def\@@address[#1]#2{\g@addto@macro\elsaddress{%
    \def\baselinestretch{1}%
     \refstepcounter{affn}\elsLabel{#1}%
    \textsuperscript{\theaffn}#2\par}}

\long\def\@address#1{\g@addto@macro\elsauthors{%
    \def\baselinestretch{1}%
    \addsep\footnotesize\itshape#1\def\addsep{\par\vskip6pt}%
    \def\authorsep{\par\vskip8pt}}}

\newbox\absbox
\renewenvironment{abstract}{\global\setbox\absbox=\vbox\bgroup
  \hsize=\textwidth\def\baselinestretch{1}%
  \noindent\unskip\textbf{Abstract}
 \par\medskip\noindent\unskip\ignorespaces}
 {\egroup}

\newbox\keybox
\def\keyword{%
  \def\sep{\unskip, }%
 \def\MSC{\@ifnextchar[{\@MSC}{\@MSC[2000]}}
  \def\@MSC[##1]{\par\leavevmode\hbox {\it ##1~MSC:\space}}%
  \def\PACS{\par\leavevmode\hbox {\it PACS:\space}}%
  \def\JEL{\par\leavevmode\hbox {\it JEL:\space}}%
  \global\setbox\keybox=\vbox\bgroup\hsize=\textwidth
  \normalsize\normalfont\def\baselinestretch{1}
  \parskip\z@
  \noindent\textit{Key words: }
  \raggedright                         % Keywords are not justified.
  \ignorespaces}
\def\endkeyword{\par \egroup}

\newdimen\Columnwidth
\Columnwidth=\columnwidth

\def\printFirstPageNotes{%
  \iflongmktitle
   \let\columnwidth=\textwidth\fi
  \ifx\@tnotes\@empty\else\@tnotes\fi
  \ifx\@cornotes\@empty\else\@cornotes\fi
  \ifx\@elseads\@empty\relax\else
   \let\thefootnote\relax
   \footnotetext{\ifnum\theead=1\relax
      \textit{Email address:\space}\else
      \textit{Email addresses:\space}\fi
     \@elseads}\fi
  \ifx\@elsuads\@empty\relax\else
   \let\thefootnote\relax
   \footnotetext{\textit{URL:\space}%
     \@elsuads}\fi
  \ifx\@fnotes\@empty\else\@fnotes\fi
  \iflongmktitle\if@twocolumn
   \let\columnwidth=\Columnwidth\fi\fi
} 
 
\long\def\pprintMaketitle{\clearpage
  \iflongmktitle\if@twocolumn\let\columnwidth=\textwidth\fi\fi
  \resetTitleCounters
  \def\baselinestretch{1}%
  \printFirstPageNotes
  \begin{center}%
 \thispagestyle{pprintTitle}%
   \def\baselinestretch{1}%
    \Large\@title\par\vskip18pt
    \normalsize\elsauthors\par\vskip10pt
    \footnotesize\itshape\elsaddress\par\vskip36pt
    \hrule\vskip12pt
    \ifvoid\absbox\else\unvbox\absbox\par\vskip10pt\fi
    \ifvoid\keybox\else\unvbox\keybox\par\vskip10pt\fi
    \hrule\vskip12pt
    \end{center}%
  \gdef\thefootnote{\arabic{footnote}}%
  }

\def\printWarning{%
     \mbox{}\par\vfill\par\bgroup
     \fboxsep12pt\fboxrule1pt
     \hspace*{.18\textwidth}
     \fcolorbox{gray50}{gray10}{\box\warnbox}
     \egroup\par\vfill\thispagestyle{empty}
     \setcounter{page}{0}
     \clearpage}

\long\def\finalMaketitle{%
  \resetTitleCounters
  \def\baselinestretch{1}%
   \MaketitleBox
   \thispagestyle{pprintTitle}%
  \gdef\thefootnote{\arabic{footnote}}%
  }

\long\def\MaketitleBox{%
  \resetTitleCounters
  \def\baselinestretch{1}%
  \begin{center}%
   \def\baselinestretch{1}%
    \Large\@title\par\vskip18pt
    \normalsize\elsauthors\par\vskip10pt
    \footnotesize\itshape\elsaddress\par\vskip36pt
    \hrule\vskip12pt
    \ifvoid\absbox\else\unvbox\absbox\par\vskip10pt\fi
    \ifvoid\keybox\else\unvbox\keybox\par\vskip10pt\fi
    \hrule\vskip12pt
    \end{center}%
  }


\def\FNtext#1{\par\bgroup\footnotesize#1\egroup}
\newdimen\space@left
\def\alarm#1{\typeout{******************************}%
             \typeout{#1}%
             \typeout{******************************}%
}
\long\def\getSpaceLeft{%\global\@twocolumnfalse%
   \global\setbox0=\vbox{\hsize=\textwidth\MaketitleBox}%
   \global\setbox1=\vbox{\hsize=\textwidth 
    \let\footnotetext\FNtext
    \printFirstPageNotes}%
    \xdef\noteheight{\the\ht1}%
    \xdef\titleheight{\the\ht0}%
    \@tempdima=\vsize
    \advance\@tempdima-\noteheight
    \advance\@tempdima-1\baselineskip
%     \alarm{Note height .... \noteheight}%
%     \alarm{Title height .... \titleheight}%
%   \alarm{T-height........ \the\textheight}%
%   \alarm{Goal........ \the\@tempdima}%
}


%\ifpreprint\let\footnoterule\relax\fi
  \skip\footins=24pt

\newbox\els@boxa
\newbox\els@boxb

\ifpreprint
  \def\maketitle{\pprintMaketitle}
  \else
   \ifnum\jtype=1
    \def\maketitle{%
      \iflongmktitle\getSpaceLeft
       \global\setbox\els@boxa=\vsplit0 to \@tempdima
       \box\els@boxa\par\resetTitleCounters
       \thispagestyle{pprintTitle}%
       \printFirstPageNotes
       \box0%
      \else
       \finalMaketitle\printFirstPageNotes
      \fi
    \gdef\thefootnote{\arabic{footnote}}}%
  \else
 \ifnum\jtype=5
    \def\maketitle{%
      \iflongmktitle\getSpaceLeft
       \global\setbox\els@boxa=\vsplit0 to \@tempdima
       \box\els@boxa\par\resetTitleCounters
       \thispagestyle{pprintTitle}%
       \printFirstPageNotes
       \twocolumn[\box0]%\printFirstPageNotes
      \else
       \twocolumn[\finalMaketitle]\printFirstPageNotes
     \fi
     \gdef\thefootnote{\arabic{footnote}}}
  \else
  \if@twocolumn
    \def\maketitle{%
      \iflongmktitle\getSpaceLeft
       \global\setbox\els@boxa=\vsplit0 to \@tempdima
       \box\els@boxa\par\resetTitleCounters
       \thispagestyle{pprintTitle}%
       \printFirstPageNotes
       \twocolumn[\box0]%
      \else
       \twocolumn[\finalMaketitle]\printFirstPageNotes
      \fi
     \gdef\thefootnote{\arabic{footnote}}}%
   \else
    \def\maketitle{%
      \iflongmktitle\getSpaceLeft
       \global\setbox\els@boxa=\vsplit0 to \@tempdima
       \box\els@boxa\par\resetTitleCounters
       \thispagestyle{pprintTitle}%
       \printFirstPageNotes
       \box0%
     \else
       \finalMaketitle\printFirstPageNotes
      \fi
    \gdef\thefootnote{\arabic{footnote}}}%
   \fi
  \fi
 \fi
\fi
%    \end{macrocode}
%    
%\section{Headers/footers}
%
%    \begin{macrocode}
\def\ps@pprintTitle{%
     \let\@oddhead\@empty
     \let\@evenhead\@empty
     \def\@oddfoot{\footnotesize\itshape
       Preprint submitted to \ifx\@journal\@empty Elsevier
       \else\@journal\fi\hfill\today}%
     \let\@evenfoot\@oddfoot}

%    \end{macrocode}
%
% \section{Section headings}
%
%    \begin{macrocode}
\def\@seccntDot{.}
\def\@seccntformat#1{\csname the#1\endcsname\@seccntDot\hskip 0.5em}

\renewcommand\section{\@startsection {section}{1}{\z@}%
           {18\p@ \@plus 6\p@ \@minus 3\p@}%
           {9\p@ \@plus 6\p@ \@minus 3\p@}%
           {\normalsize\bfseries\boldmath}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
           {12\p@ \@plus 6\p@ \@minus 3\p@}%
           {3\p@ \@plus 6\p@ \@minus 3\p@}%
           {\normalfont\normalsize\itshape}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
           {12\p@ \@plus 6\p@ \@minus 3\p@}%
           {\p@}%
           {\normalfont\normalsize\itshape}}

\def\paragraph{\secdef{\els@aparagraph}{\els@bparagraph}}
\def\els@aparagraph[#1]#2{\elsparagraph[#1]{#2.}}
\def\els@bparagraph#1{\elsparagraph*{#1.}}

\newcommand\elsparagraph{\@startsection{paragraph}{4}{0\z@}%
           {10\p@ \@plus 6\p@ \@minus 3\p@}%
           {-6\p@}%
           {\normalfont\itshape}}
%    \end{macrocode}
%
%\section{List environment}
%
%    \begin{macrocode}
\newdimen\leftMargin
\leftMargin=2em
\newtoks\@enLab  %\newtoks\@enfont
\def\@enQmark{?}
\def\@enLabel#1#2{%
  \edef\@enThe{\noexpand#1{\@enumctr}}%
  \@enLab\expandafter{\the\@enLab\csname the\@enumctr\endcsname}%
  \@enloop}
\def\@enSpace{\afterassignment\@enSp@ce\let\@tempa= }
\def\@enSp@ce{\@enLab\expandafter{\the\@enLab\space}\@enloop}
\def\@enGroup#1{\@enLab\expandafter{\the\@enLab{#1}}\@enloop}
\def\@enOther#1{\@enLab\expandafter{\the\@enLab#1}\@enloop}
\def\@enloop{\futurelet\@entemp\@enloop@}
\def\@enloop@{%
  \ifx A\@entemp         \def\@tempa{\@enLabel\Alph  }\else
  \ifx a\@entemp         \def\@tempa{\@enLabel\alph  }\else
  \ifx i\@entemp         \def\@tempa{\@enLabel\roman }\else
  \ifx I\@entemp         \def\@tempa{\@enLabel\Roman }\else
  \ifx 1\@entemp         \def\@tempa{\@enLabel\arabic}\else
  \ifx \@sptoken\@entemp \let\@tempa\@enSpace         \else
  \ifx \bgroup\@entemp   \let\@tempa\@enGroup         \else
  \ifx \@enum@\@entemp   \let\@tempa\@gobble          \else
                         \let\@tempa\@enOther
             \fi\fi\fi\fi\fi\fi\fi\fi
  \@tempa}
\newlength{\@sep} \newlength{\@@sep}
\setlength{\@sep}{.5\baselineskip plus.2\baselineskip
            minus.2\baselineskip}
\setlength{\@@sep}{.1\baselineskip plus.01\baselineskip
            minus.05\baselineskip}
\providecommand{\sfbc}{\rmfamily\upshape}
\providecommand{\sfn}{\rmfamily\upshape}
\def\@enfont{\ifnum \@enumdepth >1\let\@nxt\sfn \else\let\@nxt\sfbc \fi\@nxt}
\def\enumerate{% 
   \ifnum \@enumdepth >3 \@toodeep\else
      \advance\@enumdepth \@ne
      \edef\@enumctr{enum\romannumeral\the\@enumdepth}\fi
   \@ifnextchar[{\@@enum@}{\@enum@}}
\def\@@enum@[#1]{%
  \@enLab{}\let\@enThe\@enQmark
  \@enloop#1\@enum@
  \ifx\@enThe\@enQmark\@warning{The counter will not be printed.%
   ^^J\space\@spaces\@spaces\@spaces The label is: \the\@enLab}\fi
  \expandafter\edef\csname label\@enumctr\endcsname{\the\@enLab}%
  \expandafter\let\csname the\@enumctr\endcsname\@enThe
  \csname c@\@enumctr\endcsname7
  \expandafter\settowidth
            \csname leftmargin\romannumeral\@enumdepth\endcsname
            {\the\@enLab\hskip\labelsep}%
  \@enum@}
\def\@enum@{\list{{\@enfont\csname label\@enumctr\endcsname}}%
           {\usecounter{\@enumctr}\def\makelabel##1{\hss\llap{##1}}%
     \ifnum \@enumdepth>1\setlength{\topsep}{\@@sep}\else
           \setlength{\topsep}{\@sep}\fi
     \ifnum \@enumdepth>1\setlength{\itemsep}{0pt plus1pt minus1pt}%
      \else \setlength{\itemsep}{\@@sep}\fi
     %\setlength\leftmargin{\leftMargin}%%%{1.8em}
     \setlength{\parsep}{0pt plus1pt minus1pt}%
     \setlength{\parskip}{0pt plus1pt minus1pt}
                   }}
     
\def\endenumerate{\par\ifnum \@enumdepth >1\addvspace{\@@sep}\else 
           \addvspace{\@sep}\fi \endlist}

\def\sitem{\@noitemargtrue\@item[\@itemlabel *]}

\def\itemize{\@ifnextchar[{\@Itemize}{\@Itemize[]}}

\def\@Itemize[#1]{\def\next{#1}%
  \ifnum \@itemdepth >\thr@@\@toodeep\else
   \advance\@itemdepth\@ne
  \ifx\next\@empty\else\expandafter\def\csname 
   labelitem\romannumeral\the\@itemdepth\endcsname{#1}\fi%
  \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
  \expandafter\list\csname\@itemitem\endcsname
  {\def\makelabel##1{\hss\llap{##1}}}%
 \fi}
%    \end{macrocode}
%
%\section{Theorem environment}
%
%    \begin{macrocode}
\def\newdefinition#1{%
  \@ifnextchar[{\@odfn{#1}}{\@ndfn{#1}}}%]
\def\@ndfn#1#2{%
  \@ifnextchar[{\@xndfn{#1}{#2}}{\@yndfn{#1}{#2}}}
\def\@xndfn#1#2[#3]{%
  \expandafter\@ifdefinable\csname #1\endcsname
    {\@definecounter{#1}\@newctr{#1}[#3]%
     \expandafter\xdef\csname the#1\endcsname{%
       \expandafter\noexpand\csname the#3\endcsname \@dfncountersep
          \@dfncounter{#1}}%
     \global\@namedef{#1}{\@dfn{#1}{#2}}%
     \global\@namedef{end#1}{\@enddefinition}}}
\def\@yndfn#1#2{%
  \expandafter\@ifdefinable\csname #1\endcsname
    {\@definecounter{#1}%
     \expandafter\xdef\csname the#1\endcsname{\@dfncounter{#1}}%
     \global\@namedef{#1}{\@dfn{#1}{#2}}%
     \global\@namedef{end#1}{\@enddefinition}}}
\def\@odfn#1[#2]#3{%
  \@ifundefined{c@#2}{\@nocounterr{#2}}%
    {\expandafter\@ifdefinable\csname #1\endcsname
    {\global\@namedef{the#1}{\@nameuse{the#2}}
  \global\@namedef{#1}{\@dfn{#2}{#3}}%
  \global\@namedef{end#1}{\@enddefinition}}}}
\def\@dfn#1#2{%
  \refstepcounter{#1}%
  \@ifnextchar[{\@ydfn{#1}{#2}}{\@xdfn{#1}{#2}}}
\def\@xdfn#1#2{%
  \@begindefinition{#2}{\csname the#1\endcsname}\ignorespaces}
\def\@ydfn#1#2[#3]{%
  \@opargbegindefinition{#2}{\csname the#1\endcsname}{#3}\ignorespaces}
\def\@dfncounter#1{\noexpand\arabic{#1}}
\def\@dfncountersep{.}
\def\@begindefinition#1#2{\trivlist
   \item[\hskip\labelsep{\bfseries #1\ #2.}]\upshape}
\def\@opargbegindefinition#1#2#3{\trivlist
      \item[\hskip\labelsep{\bfseries #1\ #2\ (#3).}]\upshape}
\def\@enddefinition{\endtrivlist}

\def\@begintheorem#1#2{\trivlist
  \let\baselinestretch\@blstr
   \item[\hskip \labelsep{\bfseries #1\ #2.}]\itshape}
\def\@opargbegintheorem#1#2#3{\trivlist
  \let\baselinestretch\@blstr
      \item[\hskip \labelsep{\bfseries #1\ #2\ (#3).}]\itshape}

\def\newproof#1{%
  \@ifnextchar[{\@oprf{#1}}{\@nprf{#1}}}
\def\@nprf#1#2{%
  \@ifnextchar[{\@xnprf{#1}{#2}}{\@ynprf{#1}{#2}}}
\def\@xnprf#1#2[#3]{%
  \expandafter\@ifdefinable\csname #1\endcsname
    {\@definecounter{#1}\@newctr{#1}[#3]%
     \expandafter\xdef\csname the#1\endcsname{%
       \expandafter\noexpand\csname the#3\endcsname \@prfcountersep
          \@prfcounter{#1}}%
     \global\@namedef{#1}{\@prf{#1}{#2}}%
     \global\@namedef{end#1}{\@endproof}}}
\def\@ynprf#1#2{%
  \expandafter\@ifdefinable\csname #1\endcsname
    {\@definecounter{#1}%
     \expandafter\xdef\csname the#1\endcsname{\@prfcounter{#1}}%
     \global\@namedef{#1}{\@prf{#1}{#2}}%
     \global\@namedef{end#1}{\@endproof}}}
\def\@oprf#1[#2]#3{%
  \@ifundefined{c@#2}{\@nocounterr{#2}}%
    {\expandafter\@ifdefinable\csname #1\endcsname
    {\global\@namedef{the#1}{\@nameuse{the#2}}%
  \global\@namedef{#1}{\@prf{#2}{#3}}%
  \global\@namedef{end#1}{\@endproof}}}}
\def\@prf#1#2{%
  \refstepcounter{#1}%
  \@ifnextchar[{\@yprf{#1}{#2}}{\@xprf{#1}{#2}}}
\def\@xprf#1#2{%
  \@beginproof{#2}{\csname the#1\endcsname}\ignorespaces}
\def\@yprf#1#2[#3]{%
  \@opargbeginproof{#2}{\csname the#1\endcsname}{#3}\ignorespaces}
\def\@prfcounter#1{\noexpand\arabic{#1}}
\def\@prfcountersep{.}
\def\@beginproof#1#2{\trivlist\let\baselinestretch\@blstr
   \item[\hskip \labelsep{\scshape #1.}]\rmfamily}
\def\@opargbeginproof#1#2#3{\trivlist\let\baselinestretch\@blstr
      \item[\hskip \labelsep{\scshape #1\ (#3).}]\rmfamily}
\def\@endproof{\endtrivlist}
\newcommand*{\qed}{\hbox{}\hfill$\Box$}

\@ifundefined{@biboptions}{\xdef\@biboptions{numbers}}{}
\InputIfFileExists{\jobname.spl}{}{}
\RequirePackage[\@biboptions]{natbib}

\newwrite\splwrite
\immediate\openout\splwrite=\jobname.spl
\def\biboptions#1{\def\next{#1}\immediate\write\splwrite{%
   \string\g@addto@macro\string\@biboptions{%
    ,\expandafter\strip@prefix\meaning\next}}}

\let\baselinestretch=\@blstr

%    \end{macrocode}
%
%\section{Page dimensions and margins for final form}
%
%\subsection{Option 1p}
%
%    \begin{macrocode}
\ifnum\jtype=1
 \RequirePackage{geometry}
 \geometry{twoside,
% top=30mm,
% paperwidth=165mm,
% paperheight=240mm,
  paperwidth=210mm,
  paperheight=297mm,
  textheight=562pt,
  textwidth=384pt,
%  inner=16mm,
%  top=22.1mm,
  centering,
  headheight=50pt,
  headsep=12pt,
  footskip=12pt,
  footnotesep=24pt plus 2pt minus 12pt,
 }
 \global\let\bibfont=\footnotesize
 \global\bibsep=0pt
 \if@twocolumn\global\@twocolumnfalse\fi 
%
%    \end{macrocode}
%
%\subsection{Option '3p'}
%
%    \begin{macrocode}
\else\ifnum\jtype=3
 \RequirePackage{geometry}
 \geometry{twoside,
%  paperwidth=192mm,
%  paperheight=262mm,
  paperwidth=210mm,
  paperheight=297mm,
  textheight=622pt,
  textwidth=468pt,
%  inner=13.1mm,
%  top=22.1mm,
  centering,
 headheight=50pt,
  headsep=12pt,
  footskip=12pt,
  footnotesep=24pt plus 2pt minus 12pt,
  columnsep=2pc
 }
 \global\let\bibfont=\footnotesize
 \global\bibsep=0pt
 \if@twocolumn\input{fleqn.clo}\fi 
%    \end{macrocode}
%
%\subsection{Option '5p'}
%
%    \begin{macrocode}
\else\ifnum\jtype=5
 \RequirePackage{geometry}
 \geometry{twoside,
% top=30mm,
  paperwidth=210mm,
%  paperheight=280mm,
  paperheight=297mm,
  textheight=682pt,
  textwidth=522pt,
%  inner=15mm,
%  top=23.2mm,
  centering,
 headheight=50pt,
  headsep=12pt,
  footskip=18pt,
  footnotesep=24pt plus 2pt minus 12pt,
  columnsep=18pt
 }%
 \global\let\bibfont=\footnotesize
 \global\bibsep=0pt
 \input{fleqn.clo}
 \global\@twocolumntrue
%%
%% End of option '5p'
%%
\fi\fi\fi
%    \end{macrocode}
%
%\section{Other items}
%
%    \begin{macrocode}

\def\journal#1{\gdef\@journal{#1}}
 \let\@journal\@empty
\newenvironment{frontmatter}{}{\maketitle}

\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip\footnotesize
  \sbox\@tempboxa{#1: #2}%
  \ifdim \wd\@tempboxa >\hsize
    #1: #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}

%\RequirePackage[expansion=alltext,stretch=30]{microtype}
\AtBeginDocument{\@ifpackageloaded{hyperref}
  {\def\@linkcolor{blue}
   \def\@anchorcolor{blue}
   \def\@citecolor{blue}
   \def\@filecolor{blue}
   \def\@urlcolor{blue}
   \def\@menucolor{blue}
   \def\@pagecolor{blue}
\begingroup
  \@makeother\`%
  \@makeother\=%
  \edef\x{%
    \edef\noexpand\x{%
      \endgroup
      \noexpand\toks@{%
        \catcode 96=\noexpand\the\catcode`\noexpand\`\relax
        \catcode 61=\noexpand\the\catcode`\noexpand\=\relax
      }%
    }%
    \noexpand\x
  }%
\x
\@makeother\`
\@makeother\=
}{}}
%
%%
%</class>
%
%    \end{macrocode}
% \Finale
% \endinput
%    \begin{macrocode}
%<*mydoc> 
\documentclass[a4paper,12pt]{article}
\usepackage{amsfonts}
\usepackage[pdftex,screen,vpanel]{docscreen}

\panelwidth=5in
\vpanelheight=1.25in
\margins{1.5cm}{1cm}{1.25cm}{1.25cm}
\screensize{210mm}{297mm}
\vpaneloverlay{bg_body1.jpg}

\usepackage{pxfonts}
\usepackage{charter}
\usepackage[scaled=.9]{lfr}
\usepackage[scaled=.8]{prima}
\usepackage{xspace}
\usepackage{pdfwidgets}
\makeatletter
\def\bs{\expandafter\@gobble\string\\}
\def\lb{\expandafter\@gobble\string\{}
\def\rb{\expandafter\@gobble\string\}}
\def\@pdfauthor{C.V.Radhakrishnan}
\def\@pdftitle{elsarticle.cls -- A documentation}
\def\@pdfsubject{Document formatting with elsarticle.cls}
\def\@pdfkeywords{LaTeX, Elsevier Ltd., document class}
\def\file#1{\textsf{#1}\xspace}
\def\Hlink#1#2{\hyperlink{#1}{{\sffamily\color{brown}#2}}}

\def\LastPage{19}

\DeclareRobustCommand{\LaTeX}{L\kern-.26em%
        {\sbox\z@ T%
         \vbox to\ht\z@{\hbox{\check@mathfonts
           \fontsize\sf@size\z@
           \math@fontsfalse\selectfont
          A\,}%
         \vss}%
        }%
     \kern-.15em%
    \TeX}
\makeatother

\usepackage{doc-tooltips}

\begin{document}

\newbox\contbox
\global\setbox\contbox=\vbox{\hsize=108mm
  \color{orange}
  \begin{enumerate}[$\square$]
   \item \Hlink{introduction}{Introduction}
	 \item \Hlink{majordifferences}{Major Differences}
	 \item \Hlink{installation}{Installation}
	 \item \Hlink{usage}{Usage}
	 \item \Hlink{preamble}{Preamble}
	 \item \Hlink{floats}{Floats}
	 \item \Hlink{theorems}{Theorems}
	 \item \Hlink{lists}{Lists}
	 \item \Hlink{crossreferences}{Cross-references}
	 \item \Hlink{math}{Mathematical Symbols and Formulae}
	 \item \Hlink{bibliography}{Bibliography}
	 \item \Hlink{final}{Final Print}
	\end{enumerate}\par\vspace{45mm}
	\footnotesize\parindent=0pt
	\color{Olive}%
	\copyright 2008, Elsevier Ltd.  Bugs, feature requests,
	suggestions and comments shall be mailed to
	\href{mailto:elsarticle@river-valley.com}
	{\texttt{<elsarticle@river-valley.com>}}. 
	\file{elsarticle.\allowbreak [dtx,ins]}, related documentation
	and supporting packages are released under \LaTeX{} Project
	Public Licence, either version 1.2 or any later version. This
	work has the LPPL maintenance status
	`author-maintained'.\par\vskip6pt
	\noindent
}

\def\testa{This is a specimen document. }
\def\testc{\testa\testa\testa\testa}
\def\testb{\testc\testc\testc\testc\testc}
\long\def\test{\testb\par\testb\par\testb\par}


\pinclude{\copy\contbox\printSq{\LastPage}}

\normalcolor

\section{Introduction}
\hypertarget{introduction}{}

\file{elsarticle.cls} is a thoroughly re-written document class
for formatting \LaTeX{} submissions to Elsevier journals.
The class uses the environments and commands defined in \LaTeX{} kernel
without change to the signature so that clashes with other
contributed \LaTeX{} packages like \file{hyperref.sty},
\file{preview-latex.sty}, etc., will be minimal.
\file{elsarticle.cls} is primarily built upon the default
\file{article.cls}.  The class depends on the following packages
for its proper functionality:

\begin{enumerate}[1.]

\item \file{pifont.sty} for openstar in the title footnotes.
\item \file{natbib.sty} for citation processing.
\item \file{geometry.sty} for margin settings.
\item \file{fleqn.clo} for left aligned equations.
\item \file{graphicx.sty} for graphics inclusion.
\item \file{txfonts.sty} optional font package, if document is to
  be formatted with Times and compatible math fonts.
\item \file{hyperref.sty} optional packages if hyper linking is
  required in the document.

\end{enumerate}

All the above packages are part of any standard \LaTeX{} installation.
Therefore, the users need not be bothered about downloading any
extra packages.  Further, users are free to make use of \textsc{ams}
math packages like, \file{amsmath.sty}, \file{amsthm.sty},
\file{amssymb.sty}, \file{amsfonts.sty}, etc., if they want.  All
these packages work in tandem with \file{elsarticle.cls} without
any problems.

\section{Major Differences}
\hypertarget{majordifferences}{}

Following are the major differences between \file{elsarticle.cls}
and its predecesor package, \file{elsart.cls}:

\begin{enumerate}[\textbullet]

\item \file{elsarticle.cls} is built upon \file{article.cls}
	while \file{elsart.cls} is not. \file{elsart.cls} redefines
	many of the commands in the \LaTeX{} classes/kernel, which can
	possibly cause surprising clashes with other contributed
	\LaTeX{} packages.

\item Provides preprint document formatting by default, and
	optionally formats the document as per the final
	style of models $1+$, $3+$ and $5+$ of Elsevier journals.

\item Some easier hooks for formatting \verb+list+ and
	\verb+theorem+ environments are provided while people can still
	use \file{amsthm.sty} package. 

\item \file{natbib.sty} is the main citation processing package
  which can comprehensively handle all kinds of citations and
	works perfectly with \file{hyperref.sty} in combination with
	\file{hypernat.sty}.

\item Long title pages are processed correctly in preprint and
  final formats.

\end{enumerate}

\section{Installation}
\hypertarget{installation}{}

The package is available at
\url{http://www.elsevier.com/locate/latex}.
It can also be found in any of the nodes of the Comprehensive
\TeX{} Archive Network (\textsc{ctan}), one of the primary nodes
being
\url{http://www.ctan.org/tex-archive/macros/latex/contrib/elsevier/}.
Please grab the \file{elsarticle.dtx} which is the composite
class with documentation and \file{elsarticle.ins} which is the
\LaTeX{} installer file. When we compile the
\file{elsarticle.ins} with \LaTeX{} it provides the class file,
\file{elsarticle.cls} by
stripping off all the documentation from the \verb+*.dtx+ file.
The class may be moved or copied to a place, usually,
\texttt{\$TEXMF/tex/latex/elsevier/}, or a folder which will be read
by \LaTeX{} during document compilation.  The \TeX{} file
database needs updation after moving/copying class file.  Usually,
we use commands like \verb+mktexlsr+ or \verb+texhash+ depending
upon the distribution and operating system.

%\newpage

\section{Usage}\label{sec:usage}
\hypertarget{usage}{}
The class should be loaded with the command:

\begin{vquote}
 \documentclass[<options>]{elsarticle}
\end{vquote}

where the \verb+options+ can be the following:

\begin{enumerate}[(1)]

\item \verb+preprint+ --- default options which formats the
  document for submission to Elsevier journals.

\item \verb+review+ --- similar to \verb+preprint+ option, but
  increases the baselineskip to facilitate easier review process.

\item \verb+1p+ --- formats to the look and feel of the final
  format of model 1+ journals. This is always single column style.

\item \verb+3p+ --- formats to the look and feel of the final
  format of model 3+ journals. If the journal is a two column
	model use \verb+twocolumn+ option in combination.

\item \verb+5p+ --- formats for model 5+ journals. This is always
  two column style.

\item \verb+authoryear+ --- author-year citation style of
  \file{natbib.sty}. If you want to add extra options of
	\file{natbib.sty}, you may use the options as a comma delimited
	strings as argument to \verb+\biboptions+ command. An example
	would be:
\end{enumerate}
\begin{vquote}
 \biboptions{longnamesfirst,angle,semicolon}
\end{vquote}

\begin{enumerate}[(1)] \setcounter{enumi}{6}
\item \verb+number+ --- numbered citation style. Extra options
  can be loaded with \verb+\biboptions+ command.

\item \verb+longtitle+ --- if front matter is unusually long, use
  this option to split the title page across pages with correct
	placing of title and author footnotes in the first page.

\item \verb+times+ --- loads \file{txfonts.sty} if available in
  the system to use Times and compatible math fonts.

\item All options of \file{article.cls} can be used with this
  document class.

\item The default options loaded are \verb+a4paper+, \verb+10pt+,
  \verb+oneside+, \verb+onecolumn+ and \verb+preprint+.

\end{enumerate}

\section{Preamble}
\hypertarget{preamble}{}

There are two types of preamble coding --- (1) each author is
connected to an affiliation with a footnote marker; hence all
authors are grouped together and affiliations follow;  (2) authors
of same affiliations are grouped together and the relevant
affiliation follows this group. An example coding of the first
type is provided below:

\begin{vquote}
 \title{This is a specimen title\tnoteref{t1,t2}}
 \tnotetext[t1]{This document is a collaborative effort.}
 \tnotetext[t2]{The second title footnote which is a longer 
    longer than the first one and with an intention to fill
    in up more than one line while formatting.} 
\end{vquote}

\begin{vquote}
 \author[rvt]{C.V.~Radhakrishnan\corref{cor1}\fnref{fn1}}
 \ead{cvr@river-valley.com}

 \author[rvt,focal]{K.~Bazargan\fnref{fn2}}
 \ead{kaveh@river-valley.com}

 \author[els]{S.~Pepping\corref{cor2}\fnref{fn1,fn3}}
 \ead[url]{http://www.elsevier.com}
\end{vquote}

\begin{vquote}
 \cortext[cor1]{Corresponding author}
 \cortext[cor2]{Principal corresponding author}
 \fntext[fn1]{This is the specimen author footnote.}
 \fntext[fn2]{Another author footnote, but a little more longer.}
 \fntext[fn3]{Yet another author footnote. Indeed, you can have
    any number of author footnotes.}
\end{vquote}

\begin{vquote}

 \address[rvt]{River Valley Technologies, SJP Building,
    Cotton Hills, Trivandrum, Kerala, India 695014}
 \address[focal]{River Valley Technologies, 9, Browns Court,
    Kennford, Exeter, United Kingdom}
 \address[els]{Central Application Management,
    Elsevier, Radarweg 29, 1043 NX\\
    Amsterdam, Netherlands}

\end{vquote}

You can see the output in the panel to the right.
\mywidth=.7\panelwidth
\Sep=8pt
\def\rulewidth{.2pt}
\def\rulecolor{orange}
\npskip=8mm
\pinclude{\def\rulecolor{blue!80}%
   \includeclip[width=3.25in]{1}{130 84 484 676}{els1.pdf}%
	 \def\rulecolor{orange}}

Most of the commands like \verb+\title+, \verb+\author+,
\verb+\address+ are self explanatory.  Various components are
linked each other by a label--reference mechanism, for
instance, title footnote is linked to the title with a footnote
mark generated by referring to the \verb+\label+ string of
the \verb=\tnotetext=.  We have used similar commands
like \verb=\tnoteref= (to link title note to title);
\verb=\corref= (to link corresponding author text to
corresponding author); \verb=\fnref= (to link footnote text to
the relevant author names).  \TeX{} needs two compilations to
resolve the footnote marks in the preamble part.  Given below are
the syntax of various note marks and note texts.

\begin{vquote}
  \tnoteref{<label(s)>}
  \corref{<label(s)>}
  \fnref{<label(s)>}
  \tnotetext[<label>]{<title note text>}
  \cortext[<label>]{<corresponding author note text>}
  \fntext[<label>]{<author footnote text>}
\end{vquote}

\noindent where \verb=<label(s)>= can be either one or more comma
delimited label strings. The optional arguments to the
\verb=\author= command holds the ref label(s) of the address(es)
to which the author is affiliated while each \verb=\address=
command can have an optional argument of a label. In the same
manner, \verb=\tnotetext=, \verb=\fntext=, \verb=\cortext= will
have optional arguments as their respective labels and note text
as their mandatory argument. 

The following example code provides the markup of the second type
of author-affiliation as seen in the output given in the 
box to the right.
\pinclude{\def\rulecolor{blue!80}
   \includeclip[width=3.25in]{1}{130 84 484 676}{els2.pdf}%
	 \def\rulecolor{orange}}

\begin{vquote}
\author{C.V.~Radhakrishnan\corref{cor1}\fnref{fn1}}
 \ead{cvr@river-valley.com}
 \address{River Valley Technologies, SJP Building,
   Cotton Hills, Trivandrum, Kerala, India 695014}
\end{vquote}

\begin{vquote}
\author{K.~Bazargan\fnref{fn2}}
 \ead{kaveh@river-valley.com}
 \address{River Valley Technologies, 9, Browns Court, Kennford, 
   Exeter, UK.}
\end{vquote}

\begin{vquote}
\author{S.~Pepping\fnref{fn1,fn3}}
 \ead[url]{http://www.elsevier.com}
 \address{Central Application Management,
   Elsevier, Radarweg 43, 1043 NX Amsterdam, Netherlands}
\end{vquote}

\begin{vquote}
\cortext[cor1]{Corresponding author}
\fntext[fn1]{This is the first author footnote.}
\fntext[fn2]{Another author footnote, this is a very long footnote and
  it should be a really long footnote. But this footnote is not yet
  sufficiently long enough to make two lines of footnote text.}
\fntext[fn3]{Yet another author footnote.}
\end{vquote}

The preamble part has further environments like
\verb+\begin{abstract}+ \dots \linebreak \verb+\end{abstract}+ and
\verb+\begin{keyword}+ \verb+...+ \verb+\end{keyword}+ which
contain the abstract and keywords respectively. Keywords can be
marked up in the following manner:

\begin{vquote}
 \begin{keyword}
  quadruple exiton \sep polariton \sep WGM

  \PACS 71.35.-y \sep 71.35.Lk \sep 71.36.+c
 \end{keyworkd}
\end{vquote}

\noindent Each keyword shall be separated by \verb+\sep+ command.
\textsc{pacs} and \textsc{msc} classifications shall be provided in
the keyword environment with the commands \verb+\PACS+ and
\verb+\MSC+ respectively.  \verb+\MSC+ accepts an optional
argument to accommodae future revisions. 
eg., \verb=\MSC[2008]=. The default is 2000.

\npskip=0mm
\pinclude{\copy\contbox\printSq{\LastPage}}

\newpage

\section{Floats}
\hypertarget{floats}{}
\tooltip{Figures}{mytip6} may be included using the command,
\verb+\includegraphics+ in combination with or without its
several options to further control the graphic.
\verb+\includegraphics+ is provided by \file{graphic[s,x].sty}
which is part of any standard \LaTeX{} distribution.
\file{graphicx.sty} is loaded by default. \LaTeX{} accepts
figures in postscript format while pdf\LaTeX{} accepts
\file{*.pdf}, \file{*.mps} (metapost), \file{*.jpg} and
\file{*.png} formats.  pdf\LaTeX{} does not accept
graphic files in postscript format.

The \verb+table+ environment is handy for marking up tabular
material. If users want to use \file{multirow.sty},
\file{array.sty}, etc., to fine control/enhance the tables, they
are welcome to load any package of their choice and
\file{elsarticle.cls} will work in combination with all loaded
packages.

\section{Theorem and theorem like environments}
\hypertarget{theorems}{}
1
\file{elsarticle.cls} provides a few hooks to format theorems and
theorem like environments with ease. All commands the options
that are used with \verb+\newtheorem+ command will work exactly
in the same manner.  \file{elsarticle.cls} provides three
commands to format theorem or theorem like environments:

\begin{vquote}
 \newtheorem{thm}{Theorem}
 \newtheorem{lem}[thm]{Lemma}
 \newdefinition{rmk}{Remark}
 \newproof{pf}{Proof}
 \newproof{pot}{Proof of Theorem \ref{thm2}}
\end{vquote}

%%
%% mytip 1
%%
\begin{toolwrite}{15cm}
\let\la\lambda
\noindent\textbf{Remark 3.}\enspace
We remark that; when the ratio $h/\la$ tends to 0, the expression $\la
L(r,s)=-(s-r)/(4\left(\frac{h}{\la}\right)^2+(r-s)^2)$ tends to
$1/(r-s)$ which is a singular function. This means that the expression
$\la L(r,s)$ is not well behaved for the small values of
$h/\la$. Consequently, for the solution to converge, the integrals of
(10) and (11) must be evaluated with a large number of
nodes. In our numerical applications (cf. section 5), we
use 100 nodes to evaluate these integrals. With the smallest value of
$h/\la=0.02$, the convergence is good with $N=20$.
\end{toolwrite}

%%
%% mytip 2
%%
\begin{toolwrite}{15cm}
\noindent\textbf{Theorem 2.}\enspace\itshape
For system (8), consensus can be achieved with
$\|T_{\omega z}(s)\|_{\infty}<\gamma$ if there exist a symmetric
positive definite
 matrix $P\in \mathcal{R}^{(n-1)\times (n-1)}$ and a scalar $\mu>0$ satisfying
\setcounter{equation}{9}
\begin{eqnarray}\label{10}
\Gamma=\begin{bmatrix}
-\bar{L}^TP-P\bar{L}+U_1^TU_1+\mu \bar{E}&PU_1^TE_1&PU_1^T\\
E_1^TU_1P&-\mu I&0\\ U_1P&0&-\gamma^2I\end{bmatrix}<0,
\end{eqnarray}
where $\bar{L}=U_1^TLU_1$ and $\bar{E}=U_1^TE_2^TE_2U_1.$
\end{toolwrite}

%%
%% mytip 3
%%
\begin{toolwrite}{15cm}
\noindent\textbf{Proof of Theorem 2.}\enspace Proof follows
straightforward from Lemma 3 and Theorem 1. However, it should be
emphasized that all possible $\bar{L}_{\sigma(t)}$ should share a
common Lyapunov function $V(\delta)=\delta^T(t)P\delta(t)$ (see
the proof of Lemma 3 in Appendix A). \hfill$\square$
\end{toolwrite}

\tooltip{\ttfamily\bs newtheorem}{mytip2} command formats a
theorem in \LaTeX's default style with italicized font, bold font
for theorem heading, theorem number at the right hand side of the
theorem heading.  It also optionally accepts an argument which
will be printed as an extra heading in parentheses. You may roll
over your \tooltip{mouse here}{mytip2} to see how some text
enclosed between \verb+\begin{thm}+ \dots \verb+\end{thm}+ will
look like.

\tooltip{\ttfamily\bs newdefinition}{mytip1} command is same in
all respects as its \verb+\newtheorem+ counterpart except that
the font shape is roman instead of italic.  Both
\verb+\newdefinition+ and \verb+\newtheorem+ commands
automatically defines counters for the environments defined.
\tooltip{See the output of}{mytip1} of \verb+\begin{rmk}+ \dots
\verb+\end{rmk}+.

\tooltip{\ttfamily\bs newproof}{mytip3} command is for defining
proof environments with upright font shape.  No counters are
defined. \tooltip{See the output of}{mytip3} \verb+\begin{pot}+
\dots \verb+\end{pot}+. 

Users can also make use of \verb+amsthm.sty+ which will override
all the default definitions described above.

\section{Enumerated and Itemized Lists}
\hypertarget{lists}{}
\file{elsarticle.cls} provides an extended list processing macros
which makes the usage a bit more user friendly than the default
\LaTeX{} list macros.   With an optional argument to the
\verb+\begin{enumerate}+ command, you can change the list counter
type and its attributes.

\begin{vquote}
 \begin{enumerate}[1.]
 \item The enumerate environment starts with an optional
   argument `1.' so that the item counter will be suffixed
   by a period.
 \item If you provide a closing parenthesis to the number in the
   optional argument, the output will have closing parenthesis
   for all the item counters.  
 \item You can use `(a)' for alphabetical counter and '(i)' for
   roman counter.
\end{vquote}

\begin{vquote}
  \begin{enumerate}[a)]
    \item Another level of list with alphabetical counter.
    \item One more item before we start another.
    \begin{enumerate}[(i)]
     \item This item has roman numeral counter.
     \item Another one before we close the third level.
    \end{enumerate}
    \item Third item in second level.
  \end{enumerate}
 \item All list items conclude with this step.
 \end{enumerate}
\end{vquote}
%%
%% Mytool 4
%%
\begin{toolwrite}{15cm}
 \begin{enumerate}[1.]
 \item The enumerate environment starts with an optional
   argument `1.' so that the item counter will be suffixed
   by a period.
 \item If you provide  parentheses to the number, the
   output will have only one parentheses for all the item
   counters.
 \item You can use `(a)' for alphabetical counter and '(i)' for
   roman counter.
  \begin{enumerate}[a)]
    \item Another level of list with alphabetical counter.
    \item One more item before we start another.
    \begin{enumerate}[(i)]
     \item This item has roman numeral counter.
     \item Another one before we close the third level.
    \end{enumerate}
    \item Third item in second level.
  \end{enumerate}
 \item All list items conclude with this step.
\end{enumerate}
\end{toolwrite}

You can see the typeset copy of the above source code if you
roll over \tooltip{your mouse here}{mytip4}.

Further, the enhanced list environment allows one to prefix a
string like `step' to all the item numbers.  Take a look at the
example below:

\begin{vquote}
 \begin{enumerate}[Step 1.]
  \item This is the first step of the example list. 
  \item Obviously this is the second step.
  \item The final step to wind up this example.
 \end{enumerate}
\end{vquote}


%%
%% mytool 5
%%
\begin{toolwrite}{10cm}
\lmrgn=4em
 \begin{enumerate}[Step 1.]
  \item This is the first step of the example list. 
	\item Obviously this is the second step.
	\item The final step to wind up this example.
 \end{enumerate}
\end{toolwrite}

\tooltip{Here is the typeset output}{mytip5} of the above example code.

\section{Cross-references}
\hypertarget{crossreferences}{}

In electronic publications articles may be internally
hyperlinked. Hyperlinks are generated from proper
cross-references in the article.  For example, the words
\textcolor{black!80}{Fig.~1} will never be more than simple text,
whereas the proper cross-reference \verb+\ref{tiger}+ may be
turned into a hyperlink to the figure itself:
\tooltip{Fig.~1}{mytip6}.  In the same way,
the words \tooltip{Ref.~[1]}{mytip7} will fail to turn into a
hyperlink; the proper cross-reference is \verb+\cite{Knuth96}+.
Cross-referencing is possible in \LaTeX{} for sections,
subsections, formulae, figures, tables, and literature
references.


\section{Mathematical symbols and formulae}
\hypertarget{math}{}

Many physical/mathematical sciences authors require more
mathematical symbols than the few that are provided in standard
\LaTeX. A useful package for additional symbols is the
\file{amssymb} package, developed by the American Mathematical
Society. This package includes such oft used symbols as
\verb+\lesssim+ for $\lesssim$, \verb+\gtrsim+ for $\gtrsim$ or
\verb+\hbar+ for $\hbar$. Note that your \TeX{} system should
have the \file{msam} and \file{msbm} fonts installed. If you need
only a few symbols, such as \verb+\Box+ for $\square$, you might
try the package \file{latexsym}.

Another point which would require authors' attention is the
breaking of longer equations.  When you use
\file{elsarticle.cls} for formatting your submissions in 
\verb+preprint+ mode, the document is formatted in single column
style with a text width of 384pt or 5.3in.  When this document is
formatted for final print and if the journal happens to be a double column
journal, the text width will be reduced to 224pt at for 3+
double column and 5+ journals respectively. All the nifty fine
tuning in equation breaking done by the author goes to waste in
such cases.  Therefore, authors are requested to check this
problem by typesetting their submissions in final format as well
just to see if their equations are broken at appropriate places,
by changing appropriate options in the document class loading
command, which is explained in section~\ref{sec:usage},
\nameref{sec:usage}. This allows authors to fix any equation breaking
problem before submission for publication.
\file{elsarticle.cls} supports formatting the author submission
in different types of final format.  This is further discussed in
section \ref{sec:final}, \nameref{sec:final}.


\section{Bibliography}
\hypertarget{bibliography}{}

Three bibliographic style files (\verb+*.bst+) are provided ---
\file{elsarticle-num.bst}, \file{elsarticle-num-names.bst} and
\file{elsarticle-harv.bst} --- the first one for numbered scheme, the
second for numbered with new options of \file{natbib.sty} and the
last one for author year scheme.

In \LaTeX{} literature references are listed in the
thebibliography environment.  Each reference is a
\verb+\bibitem+; each \verb+\bibitem+ is identified by a label,
by which it can be cited in the text: 
\verb+\bibitem[Elson et al.(1996)]{ESG96}+ is cited as 
\verb+\citet{ESG96}+. In connection with cross-referencing and
possible future hyperlinking it is not a good idea to collect
more that one literature item in one \verb+\bibitem+.  The
so-called Harvard or author-year style of referencing is enabled
by the \LaTeX{} package \file{natbib}. With this package the
literature can be cited as follows: 

\begin{enumerate}[\textbullet]
\item Parenthetical: \verb+\citep{WB96}+ produces (Wettig \&
  Brown, 1996).
\item Textual: \verb+\citet{ESG96}+ produces Elson et al. (1996).
\item An affix and part of a reference:
	\verb+\citep[e.g.][Ch. 2]{Gea97}+ produces (e.g. Governato et
	al., 1997, Ch. 2).
\end{enumerate}

In the numbered scheme of citation, \verb+\cite{<label>}+ is used,
since \verb+\citep+ or \verb+\citet+ has no relevance in numbered
scheme.  \file{natbib} package is loaded by \file{elsarticle} with
\verb+numbers+ as default option.  You can change this to author-year
or harvard scheme by adding option \verb+authoryear+ in the class
loading command.  If you want to use more options of the \file{natbib}
package, you can do so with the \verb+\biboptions+ command, which is
described in section \ref{sec:usage}, \nameref{sec:usage}.  For
details of various options of the \file{natbib} package, please take a
look at the \file{natbib} documentation, which is part of any standard
\LaTeX{} installation.


\newpage

\section{Final print}\label{sec:final}
\hypertarget{final}{}

Authors can format their submission to the page size and margins
of their preferred journal.  \file{elsarticle} provides four
class options for the same:
\lmrgn=3em
\begin{enumerate}
\item [\texttt{1p}:] $1+$ journals with a text area of
384pt $\times$ 562pt or 13.5cm $\times$ 19.75cm or 5.3in $\times$
7.78in, single column style only.

\item [\texttt{3p}:] $3+$ journals with a text area of 468pt
$\times$ 622pt or 16.45cm $\times$ 21.9cm or 6.5in $\times$
8.6in, single column style.

\item [\texttt{3pd}:] $3+$ with the same text area as above,
double column style.

\item [\texttt{5p}:] $5+$ with text area of 522pt $\times$
682pt or 18.35cm $\times$ 24cm or 7.22in $\times$ 9.45in, 
double column style only.
\end{enumerate}

Following pages have the clippings of different parts of 
the first page of different journal models typeset in final
format.

\bigskip
\mywidth=14cm
\def\rulecolor{blue!70}
\src{Upper part of first page of a single column article}
\includeclip{1}{104 510 492 712}{els-1p.pdf}
\def\rulecolor{orange}

\newpage
\vspace*{-18pt}
\def\rulecolor{blue!70}
\src{Lower part of first page of a single column article}
%\includeclip{1}{104 124 492 461}{els-1p.pdf}
\includeclip{1}{104 124 492 443}{els-1p.pdf}
\def\rulecolor{orange}

\medskip

\noindent
Model $1+$ and $3+$  will have the same look and
feel in the typeset copy when presented in this document. That is
also the case with the double column $3+$ and $5+$ journal article
pages. The only difference will be wider text width of 
higher models.  Therefore we will look at the
different portions of a typical single column journal page and
that of a double column article in the final format.

\newpage
\vspace*{-18pt}
\def\rulecolor{blue!70}
\src{Upper part of first page of a typical double column article}
 \includeclip{1}{60 245 536 752}{els-3pd.pdf}
\def\rulecolor{orange}

\newpage\vspace*{-18pt}
\def\rulecolor{blue!70}
\src{Lower part of first page a typical double column article}
\includeclip{1}{60 93 536 600}{els-3pd.pdf}
\def\rulecolor{orange}

\subsection*{Displayed equations and double column journals}

Many Elsevier journals print their text in two columns. Because
the preprint layout uses a larger line width than such columns,
the formulas are too wide for the line width in print. Here is an
example of an equation  (see equation 6) which is perfect in
single column preprint format:

\bigskip
\src{See equation (6)}
\def\rulecolor{blue!70}
\includeclip{4}{134 391 483 594}{els1.pdf}
\def\rulecolor{orange}

\bigskip
\noindent When this document is typeset for publication in a
model 3+ journal with double columns, the equation will overlap
the second column text matter if the equation is not broken at
the appropriate location.

\newpage\vspace*{-18pt}
\def\rulecolor{blue!70}
\src{See equation (6) overprints into second column}
\includeclip{3}{61 531 532 734}{els-3pd.pdf}
\def\rulecolor{orange}

\medskip

\noindent The typesetter will try to break the equation which
need not necessarily be to the liking of the author or as it
happens, typesetter's break point may be semantically incorrect.
Therefore, authors may check their submissions for the incidence
of such long equations and break the equations at the correct
places so that the final typeset copy will be as they wish.




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Tooltip 6
%%
\begin{toolwrite}{10cm}
\centering
 {\ttfamily\bs includegraphics[width=3in,angle=45]\lb
 tiger.pdf\rb}\\
 \hspace*{-1cm}
 \includegraphics[width=3in,angle=45,origin=c]{tiger.pdf}\\
 \raggedright
 \textbf{Fig.~1.}~~More details on the usage of {\ttfamily\bs
 includegraphics} can be found in the \textsf{grfguide.ps} of the
 \LaTeX{} documentation.
\end{toolwrite}

%%
%% tooltip 7
%%
\begin{toolwrite}{15cm}
\raggedright
\begin{enumerate}[{[1]}]
\item Knuth, D.E., \emph{TeX: The Program}, Computers \&
Typesetting; B., 1995, Addisson-Wesley Publishing Co., Inc., New
York.
\end{enumerate}
\end{toolwrite}

%%
%% tooltip 8
%%
%\begin{toolwrite}{15cm}
%\includegraphics[page=1,viewport=104 124 492 712]{els-1p.pdf}
%\end{toolwrite}

%</mydoc>
%<mydoc> \end{document}
%    \end{macrocode}
%    \begin{macrocode}
%<*num> 
%%% Modification of BibTeX style file elsarticle-num.bst
%%% ... by urlbst, version 0.6 (marked with "% urlbst")
%%% See <http://purl.org/nxg/dist/urlbst>
%%% Added webpage entry type, and url and lastchecked fields.
%%% Added eprint support.
%%% Added DOI support.
%%% Added hyperref support.
%%% Original headers follow...

%%
%% This is file `elsarticle-num.bst',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% merlin.mbs  (with options: `,seq-no,nm-init,ed-au,dt-end,yr-par,yrp-x,jttl-rm,thtit-a,vnum-sp,volp-blk,jdt-p,pp-last,jnm-x,btit-rm,bt-rm,pub-date,pub-xpar,pre-edn,url,url-nl,edpar,blk-com,in-col,pp,ed,abr,ednx,ord,jabr,and-xcom,xand,em-x,nfss')
%% After docstrip generation some manual changes were made (SP)

%% ----------------------------------------

ENTRY
  { address
    author
    booktitle
    chapter
    edition
    editor
    howpublished
    institution
    journal
    key
    month
    note
    number
    organization
    pages
    publisher
    school
    series
    title
    type
    volume
    year
    eprint % urlbst
    doi % urlbst
    url % urlbst
    lastchecked % urlbst
  }
  {}
  { label }

INTEGERS { output.state before.all mid.sentence after.sentence after.block }

STRINGS { urlintro eprinturl eprintprefix doiprefix doiurl openinlinelink closeinlinelink } % urlbst...
INTEGERS { hrefform inlinelinks makeinlinelink addeprints adddoiresolver }
% Following constants may be adjusted by hand, if desired
FUNCTION {init.urlbst.variables}
{
  "Available from: " 'urlintro := % prefix before URL
  "http://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref
  "arXiv:" 'eprintprefix := % text prefix printed before eprint ref
  "http://dx.doi.org/" 'doiurl := % prefix to make URL from DOI
  "doi:" 'doiprefix :=      % text prefix printed before DOI ref
  #1 'addeprints :=         % 0=no eprints; 1=include eprints
  #1 'adddoiresolver :=     % 0=no DOI resolver; 1=include it
  #2 'hrefform :=           % 0=no crossrefs; 1=hypertex xrefs; 2=hyperref refs
  #1 'inlinelinks :=        % 0=URLs explicit; 1=URLs attached to titles
  % the following are internal state variables, not config constants
  #0 'makeinlinelink :=     % state variable managed by setup.inlinelink
  "" 'openinlinelink :=     % ditto
  "" 'closeinlinelink :=    % ditto
}
INTEGERS { 
  bracket.state
  outside.brackets
  open.brackets
  within.brackets
  close.brackets
}
% ...urlbst to here
FUNCTION {init.state.consts}
{ #0 'outside.brackets := % urlbst
  #1 'open.brackets :=
  #2 'within.brackets :=
  #3 'close.brackets :=

  #0 'before.all :=
  #1 'mid.sentence :=
  #2 'after.sentence :=
  #3 'after.block :=
}

STRINGS { s t }

% urlbst
FUNCTION {output.nonnull.original}
{ 's :=
  output.state mid.sentence =
    { ", " * write$ }
    { output.state after.block =
        { add.period$ write$
          newline$
          "\newblock " write$
        }
        { output.state before.all =
            'write$
            { add.period$ " " * write$ }
          if$
        }
      if$
      mid.sentence 'output.state :=
    }
  if$
  s
}

% urlbst...
% The following three functions are for handling inlinelink.  They wrap
% a block of text which is potentially output with write$ by multiple
% other functions, so we don't know the content a priori.
% They communicate between each other using the variables makeinlinelink
% (which is true if a link should be made), and closeinlinelink (which holds
% the string which should close any current link.  They can be called
% at any time, but start.inlinelink will be a no-op unless something has
% previously set makeinlinelink true, and the two ...end.inlinelink functions
% will only do their stuff if start.inlinelink has previously set
% closeinlinelink to be non-empty.
FUNCTION {setup.inlinelink}
{ makeinlinelink
    { hrefform #1 = % hypertex
        { "\special {html:<a href=" quote$ * url * quote$ * "> }{" * 'openinlinelink :=
          "\special {html:</a>}" 'closeinlinelink :=
          }
        { hrefform #2 = % hyperref
            { "\href{" url * "}{" * 'openinlinelink :=
              "}" 'closeinlinelink :=
              }
            'skip$
          if$ % hrefform #2 =
        }
      if$ % hrefform #1 =
      #0 'makeinlinelink :=
    }
    'skip$
 if$ % makeinlinelink
}
FUNCTION {add.inlinelink}
{ openinlinelink empty$
    'skip$
    { openinlinelink swap$ * closeinlinelink *
      "" 'openinlinelink :=
      }
  if$
}
FUNCTION {output.nonnull}
{ % Save the thing we've been asked to output
  's :=
  % If the bracket-state is close.brackets, then add a close-bracket to
  % what is currently at the top of the stack, and set bracket.state
  % to outside.brackets
  bracket.state close.brackets =
    { "]" *
      outside.brackets 'bracket.state :=
    }
    'skip$
  if$
  bracket.state outside.brackets =
    { % We're outside all brackets -- this is the normal situation.
      % Write out what's currently at the top of the stack, using the
      % original output.nonnull function.
      s
      add.inlinelink
      output.nonnull.original % invoke the original output.nonnull
    }
    { % Still in brackets.  Add open-bracket or (continuation) comma, add the
      % new text (in s) to the top of the stack, and move to the close-brackets
      % state, ready for next time (unless inbrackets resets it).  If we come
      % into this branch, then output.state is carefully undisturbed.
      bracket.state open.brackets =
        { " [" * }
        { ", " * } % bracket.state will be within.brackets
      if$ 
      s * 
      close.brackets 'bracket.state :=
    }
  if$
}

% Call this function just before adding something which should be presented in 
% brackets.  bracket.state is handled specially within output.nonnull.
FUNCTION {inbrackets}
{ bracket.state close.brackets =
    { within.brackets 'bracket.state := } % reset the state: not open nor closed
    { open.brackets 'bracket.state := }
  if$
}

FUNCTION {format.lastchecked}
{ lastchecked empty$
    { "" }
    { inbrackets "cited " lastchecked * }
  if$
}
% ...urlbst to here

FUNCTION {output}
{ duplicate$ empty$
    'pop$
    'output.nonnull
  if$
}

FUNCTION {output.check}
{ 't :=
  duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    'output.nonnull
  if$
}

FUNCTION {fin.entry.original}
{ add.period$
  write$
  newline$
}

FUNCTION {new.block}
{ output.state before.all =
    'skip$
    { after.block 'output.state := }
  if$
}

FUNCTION {new.sentence}
{ output.state after.block =
    'skip$
    { output.state before.all =
        'skip$
        { after.sentence 'output.state := }
      if$
    }
  if$
}

%SP 2003/07/25
% No longer used
FUNCTION {add.blank}
{  " " * before.all 'output.state :=
}

FUNCTION {date.block}
{
  add.blank
}

FUNCTION {not}
{   { #0 }
    { #1 }
  if$
}

FUNCTION {and}
{   'skip$
    { pop$ #0 }
  if$
}

FUNCTION {or}
{   { pop$ #1 }
    'skip$
  if$
}

FUNCTION {new.block.checka}
{ empty$
    'skip$
    'new.block
  if$
}

FUNCTION {new.block.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.block
  if$
}

FUNCTION {new.sentence.checka}
{ empty$
    'skip$
    'new.sentence
  if$
}

FUNCTION {new.sentence.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.sentence
  if$
}

FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}

FUNCTION {emphasize}
{ skip$ }

FUNCTION {capitalize}
{ "u" change.case$ "t" change.case$ }

FUNCTION {space.word}
{ " " swap$ * " " * }

 % Here are the language-specific definitions for explicit words.
 % Each function has a name bbl.xxx where xxx is the English word.
 % The language selected here is ENGLISH
FUNCTION {bbl.and}
{ "and"}

FUNCTION {bbl.etal}
{ "et~al." }

FUNCTION {bbl.editors}
{ "Eds." }

FUNCTION {bbl.editor}
{ "Ed." }

FUNCTION {bbl.edby}
{ "edited by" }

FUNCTION {bbl.edition}
{ "Edition" }

FUNCTION {bbl.volume}
{ "Vol." }

FUNCTION {bbl.of}
{ "of" }

FUNCTION {bbl.number}
{ "no." }

FUNCTION {bbl.nr}
{ "no." }

FUNCTION {bbl.in}
{ "in" }

FUNCTION {bbl.pages}
{ "pp." }

FUNCTION {bbl.page}
{ "p." }

FUNCTION {bbl.chapter}
{ "Ch." }

FUNCTION {bbl.techrep}
{ "Tech. Rep." }

FUNCTION {bbl.mthesis}
{ "Master's thesis" }

FUNCTION {bbl.phdthesis}
{ "Ph.D. thesis" }

FUNCTION {bbl.first}
{ "1st" }

FUNCTION {bbl.second}
{ "2nd" }

FUNCTION {bbl.third}
{ "3rd" }

FUNCTION {bbl.fourth}
{ "4th" }

FUNCTION {bbl.fifth}
{ "5th" }

FUNCTION {bbl.st}
{ "st" }

FUNCTION {bbl.nd}
{ "nd" }

FUNCTION {bbl.rd}
{ "rd" }

FUNCTION {bbl.th}
{ "th" }

MACRO {jan} {"Jan."}

MACRO {feb} {"Feb."}

MACRO {mar} {"Mar."}

MACRO {apr} {"Apr."}

MACRO {may} {"May"}

MACRO {jun} {"Jun."}

MACRO {jul} {"Jul."}

MACRO {aug} {"Aug."}

MACRO {sep} {"Sep."}

MACRO {oct} {"Oct."}

MACRO {nov} {"Nov."}

MACRO {dec} {"Dec."}

FUNCTION {eng.ord}
{ duplicate$ "1" swap$ *
  #-2 #1 substring$ "1" =
     { bbl.th * }
     { duplicate$ #-1 #1 substring$
       duplicate$ "1" =
         { pop$ bbl.st * }
         { duplicate$ "2" =
             { pop$ bbl.nd * }
             { "3" =
                 { bbl.rd * }
                 { bbl.th * }
               if$
             }
           if$
          }
       if$
     }
   if$
}

MACRO {acmcs} {"ACM Comput. Surv."}

MACRO {acta} {"Acta Inf."}

MACRO {cacm} {"Commun. ACM"}

MACRO {ibmjrd} {"IBM J. Res. Dev."}

MACRO {ibmsj} {"IBM Syst.~J."}

MACRO {ieeese} {"IEEE Trans. Softw. Eng."}

MACRO {ieeetc} {"IEEE Trans. Comput."}

MACRO {ieeetcad}
 {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}

MACRO {ipl} {"Inf. Process. Lett."}

MACRO {jacm} {"J.~ACM"}

MACRO {jcss} {"J.~Comput. Syst. Sci."}

MACRO {scp} {"Sci. Comput. Programming"}

MACRO {sicomp} {"SIAM J. Comput."}

MACRO {tocs} {"ACM Trans. Comput. Syst."}

MACRO {tods} {"ACM Trans. Database Syst."}

MACRO {tog} {"ACM Trans. Gr."}

MACRO {toms} {"ACM Trans. Math. Softw."}

MACRO {toois} {"ACM Trans. Office Inf. Syst."}

MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}

MACRO {tcs} {"Theoretical Comput. Sci."}

FUNCTION {write.url}
{ url empty$
    { skip$ }
    { "\newline\urlprefix\url{" url * "}" * write$ newline$ }
  if$
}


INTEGERS { nameptr namesleft numnames }

FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      "{f.~}{vv~}{ll}{, jj}" format.name$
    't :=
      nameptr #1 >
        {
          namesleft #1 >
            { ", " * t * }
            {
              "," *
              s nameptr "{ll}" format.name$ duplicate$ "others" =
                { 't := }
                { pop$ }
              if$
              t "others" =
                {
                  " " * bbl.etal *
                }
                { " " * t * }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}
FUNCTION {format.names.ed}
{ format.names }
FUNCTION {format.authors}
{ author empty$
    { "" }
    { author format.names }
  if$
}

FUNCTION {format.editors}
{ editor empty$
    { "" }
    { editor format.names
      editor num.names$ #1 >
        { " (" * bbl.editors * ")" * }
        { " (" * bbl.editor * ")" * }
      if$
    }
  if$
}

FUNCTION {format.in.editors}
{ editor empty$
    { "" }
    { editor format.names.ed
      editor num.names$ #1 >
        { " (" * bbl.editors * ")" * }
        { " (" * bbl.editor * ")" * }
      if$
    }
  if$
}

FUNCTION {format.note}
{
 note empty$
    { "" }
    { note #1 #1 substring$
      duplicate$ "{" =
        'skip$
        { output.state mid.sentence =
          { "l" }
          { "u" }
        if$
        change.case$
        }
      if$
      note #2 global.max$ substring$ *
    }
  if$
}

FUNCTION {format.title}
{ title empty$
    { "" }
    { title "t" change.case$
    }
  if$
}

FUNCTION {output.bibitem.original}
{ newline$
  "\bibitem{" write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

FUNCTION {n.dashify}
{
  't :=
  ""
    { t empty$ not }
    { t #1 #1 substring$ "-" =
        { t #1 #2 substring$ "--" = not
            { "--" *
              t #2 global.max$ substring$ 't :=
            }
            {   { t #1 #1 substring$ "-" = }
                { "-" *
                  t #2 global.max$ substring$ 't :=
                }
              while$
            }
          if$
        }
        { t #1 #1 substring$ *
          t #2 global.max$ substring$ 't :=
        }
      if$
    }
  while$
}

FUNCTION {word.in}
{ bbl.in
  ":" *
  " " * }

FUNCTION {format.date}
{ year empty$
    { month empty$
        { "" }
        { "there's a month but no year in " cite$ * warning$
          month
        }
      if$
    }
    { month empty$
        'year
        { month " " * year * }
      if$
    }
  if$
  duplicate$ empty$
    'skip$
    {
      before.all 'output.state :=
    " (" swap$ * ")" *
    }
  if$
}

FUNCTION{format.year}
{ year duplicate$ empty$
    { "empty year in " cite$ * warning$ pop$ "" }
    { "(" swap$ * ")" * }
  if$
}

FUNCTION {format.btitle}
{ title
}

FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #3 <
    { "~" }
    { " " }
  if$
  swap$ * *
}

FUNCTION {either.or.check}
{ empty$
    'pop$
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  if$
}

FUNCTION {format.bvolume}
{ volume empty$
    { "" }
    { bbl.volume volume tie.or.space.connect
      series empty$
        'skip$
        { bbl.of space.word * series emphasize * }
      if$
      "volume and number" number either.or.check
    }
  if$
}

FUNCTION {format.number.series}
{ volume empty$
    { number empty$
        { series field.or.null }
        { output.state mid.sentence =
            { bbl.number }
            { bbl.number capitalize }
          if$
          number tie.or.space.connect
          series empty$
            { "there's a number but no series in " cite$ * warning$ }
            { bbl.in space.word * series * }
          if$
        }
      if$
    }
    { "" }
  if$
}

FUNCTION {is.num}
{ chr.to.int$
  duplicate$ "0" chr.to.int$ < not
  swap$ "9" chr.to.int$ > not and
}

FUNCTION {extract.num}
{ duplicate$ 't :=
  "" 's :=
  { t empty$ not }
  { t #1 #1 substring$
    t #2 global.max$ substring$ 't :=
    duplicate$ is.num
      { s swap$ * 's := }
      { pop$ "" 't := }
    if$
  }
  while$
  s empty$
    'skip$
    { pop$ s }
  if$
}

FUNCTION {convert.edition}
{ edition extract.num "l" change.case$ 's :=
  s "first" = s "1" = or
    { bbl.first 't := }
    { s "second" = s "2" = or
        { bbl.second 't := }
        { s "third" = s "3" = or
            { bbl.third 't := }
            { s "fourth" = s "4" = or
                { bbl.fourth 't := }
                { s "fifth" = s "5" = or
                    { bbl.fifth 't := }
                    { s #1 #1 substring$ is.num
                        { s eng.ord 't := }
                        { edition 't := }
                      if$
                    }
                  if$
                }
              if$
            }
          if$
        }
      if$
    }
  if$
  t
}

FUNCTION {format.edition}
{ edition empty$
    { "" }
    { output.state mid.sentence =
        { convert.edition "l" change.case$ " " * bbl.edition * }
        { convert.edition "t" change.case$ " " * bbl.edition * }
      if$
    }
  if$
}

INTEGERS { multiresult }

FUNCTION {multi.page.check}
{ 't :=
  #0 'multiresult :=
    { multiresult not
      t empty$ not
      and
    }
    { t #1 #1 substring$
      duplicate$ "-" =
      swap$ duplicate$ "," =
      swap$ "+" =
      or or
        { #1 'multiresult := }
        { t #2 global.max$ substring$ 't := }
      if$
    }
  while$
  multiresult
}

FUNCTION {format.pages}
{ pages empty$
    { "" }
    { pages multi.page.check
        { bbl.pages pages n.dashify tie.or.space.connect }
        { bbl.page pages tie.or.space.connect }
      if$
    }
  if$
}

FUNCTION {format.journal.pages}
{ pages empty$
    'skip$
    { duplicate$ empty$
        { pop$ format.pages }
        {
          " " *
          format.year * " " *
          pages n.dashify *
        }
      if$
    }
  if$
}

%SP 2001/01/23
% Only used in articles
FUNCTION {format.vol.num.pages}
{ 
%SP 2001/01/23
% Add the leading space only if there is a volume
  % volume field.or.null
  " "
  volume empty$
    { pop$ "" }
    { volume * }
  if$
  number empty$
    'skip$
    {
      "~(" number * ")" * *
      volume empty$
        { "there's a number but no volume in " cite$ * warning$ }
        'skip$
      if$
    }
  if$
}

FUNCTION {format.chapter.pages}
{ chapter empty$
    { "" }
    { type empty$
        { bbl.chapter }
        { type "l" change.case$ }
      if$
      chapter tie.or.space.connect
    }
  if$
}

FUNCTION {format.in.ed.booktitle}
{ booktitle empty$
    { "" }
    { editor empty$
        { word.in booktitle * }
        { word.in format.in.editors * ", " *
          booktitle * }
      if$
    }
  if$
}

FUNCTION {empty.misc.check}
{ author empty$ title empty$ howpublished empty$
  month empty$ year empty$ note empty$
  and and and and and
    { "all relevant fields are empty in " cite$ * warning$ }
    'skip$
  if$
}

FUNCTION {format.thesis.type}
{ type empty$
    'skip$
    { pop$
      type "t" change.case$
    }
  if$
}

FUNCTION {format.tr.number}
{ type empty$
    { bbl.techrep }
    'type
  if$
  number empty$
    { "t" change.case$ }
    { number tie.or.space.connect }
  if$
}

FUNCTION {format.article.crossref}
{
  key empty$
    { journal empty$
        { "need key or journal for " cite$ * " to crossref " * crossref *
          warning$
          ""
        }
        { word.in journal emphasize * }
      if$
    }
    { word.in key * " " *}
  if$
  " \cite{" * crossref * "}" *
}

FUNCTION {format.crossref.editor}
{ editor #1 "{vv~}{ll}" format.name$
  editor num.names$ duplicate$
  #2 >
    { pop$
      " " * bbl.etal *
    }
    { #2 <
        'skip$
        { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
            {
              " " * bbl.etal *
            }
            { bbl.and space.word * editor #2 "{vv~}{ll}" format.name$
              * }
          if$
        }
      if$
    }
  if$
}

FUNCTION {format.book.crossref}
{ volume empty$
    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
      word.in
    }
    { bbl.volume volume tie.or.space.connect
      bbl.of space.word *
    }
  if$
  editor empty$
  editor field.or.null author field.or.null =
  or
    { key empty$
        { series empty$
            { "need editor, key, or series for " cite$ * " to crossref " *
              crossref * warning$
              "" *
            }
            { series emphasize * }
          if$
        }
        { key * }
      if$
    }
    { format.crossref.editor * }
  if$
  " \cite{" * crossref * "}" *
}

FUNCTION {format.incoll.inproc.crossref}
{
  editor empty$
  editor field.or.null author field.or.null =
  or
    { key empty$
        { booktitle empty$
            { "need editor, key, or booktitle for " cite$ * " to crossref " *
              crossref * warning$
              ""
            }
            { word.in booktitle * }
          if$
        }
        { word.in key * " " *}
      if$
    }
    { word.in format.crossref.editor * " " *}
  if$
  " \cite{" * crossref * "}" *
}

FUNCTION {format.org.or.pub}
{ 't :=
  ""
  year empty$
    { "empty year in " cite$ * warning$ }
    'skip$
  if$
  address empty$ t empty$ and
  year empty$ and
    'skip$
    {
      t empty$
        { address empty$
          'skip$
          { address * }
          if$
        }
        { t *
          address empty$
            'skip$
            { ", " * address * }
          if$
        }
      if$
      year empty$
        'skip$
        { t empty$ address empty$ and
            'skip$
            { ", " * }
          if$
          year *
        }
      if$
    }
  if$
}

FUNCTION {format.publisher.address}
{ publisher empty$
    { "empty publisher in " cite$ * warning$
      ""
    }
    { publisher }
  if$
  format.org.or.pub
}

FUNCTION {format.organization.address}
{ organization empty$
    { "" }
    { organization }
  if$
  format.org.or.pub
}

% urlbst...
% Functions for making hypertext links.
% In all cases, the stack has (link-text href-url)
%
% make 'null' specials
FUNCTION {make.href.null}
{
  pop$
}
% make hypertex specials
FUNCTION {make.href.hypertex}
{ 
  "\special {html:<a href=" quote$ *
  swap$ * quote$ * "> }" * swap$ *
  "\special {html:</a>}" *
}
% make hyperref specials
FUNCTION {make.href.hyperref}
{ 
  "\href {" swap$ * "} {\path{" * swap$ * "}}" *
}
FUNCTION {make.href}
{ hrefform #2 =
    'make.href.hyperref      % hrefform = 2
    { hrefform #1 =
        'make.href.hypertex  % hrefform = 1
        'make.href.null      % hrefform = 0 (or anything else)
      if$
    }
  if$
}

% If inlinelinks is true, then format.url should be a no-op, since it's
% (a) redundant, and (b) could end up as a link-within-a-link.
FUNCTION {format.url}
{ inlinelinks #1 = url empty$ or
   { "" }
   { hrefform #1 =
       { % special case -- add HyperTeX specials
         urlintro "\url{" url * "}" * url make.href.hypertex * }
       { urlintro "\url{" * url * "}" * }
     if$
   }
  if$
}

FUNCTION {format.eprint}
{ eprint empty$
    { "" }
    { eprintprefix eprint * eprinturl eprint * make.href }
  if$
}

FUNCTION {format.doi}
{ doi empty$
    { "" }
    { doiprefix doi * doiurl doi * make.href }
  if$
}

% Output a URL.  We can't use the more normal idiom (something like
% `format.url output'), because the `inbrackets' within
% format.lastchecked applies to everything between calls to `output',
% so that `format.url format.lastchecked * output' ends up with both
% the URL and the lastchecked in brackets.
FUNCTION {output.url}
{ url empty$
    'skip$ 
    { new.block 
      format.url output
      format.lastchecked output 
    }
  if$
}

FUNCTION {output.web.refs}
{
  new.block
  output.url
  addeprints eprint empty$ not and
    { format.eprint output.nonnull }
    'skip$
  if$
  adddoiresolver doi empty$ not and
    { format.doi output.nonnull }
    'skip$
  if$
}

% Wrapper for output.bibitem.original.
% If the URL field is not empty, set makeinlinelink to be true,
% so that an inline link will be started at the next opportunity
FUNCTION {output.bibitem}
{ outside.brackets 'bracket.state :=
  output.bibitem.original
  inlinelinks url empty$ not and
    { #1 'makeinlinelink := }
    { #0 'makeinlinelink := }
  if$
}

% Wrapper for fin.entry.original
FUNCTION {fin.entry}
{ output.web.refs  % urlbst
  makeinlinelink       % ooops, it appears we didn't have a title for inlinelink
    { setup.inlinelink % add some artificial link text here, as a fallback
      "[link]" output.nonnull }
    'skip$
  if$
  bracket.state close.brackets = % urlbst
    { "]" * }
    'skip$
  if$
  fin.entry.original
}

% Webpage entry type.
% Title and url fields required;
% author, note, year, month, and lastchecked fields optional
% See references 
%   ISO 690-2 http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm
%   http://www.classroom.net/classroom/CitingNetResources.html
%   http://neal.ctstateu.edu/history/cite.html
%   http://www.cas.usf.edu/english/walker/mla.html
% for citation formats for web pages.
FUNCTION {webpage}
{ output.bibitem
  author empty$
    { editor empty$
        'skip$  % author and editor both optional
        { format.editors output.nonnull }
      if$
    }
    { editor empty$
        { format.authors output.nonnull }
        { "can't use both author and editor fields in " cite$ * warning$ }
      if$
    }
  if$
  new.block
  title empty$ 'skip$ 'setup.inlinelink if$
  format.title "title" output.check
  inbrackets "online" output
  new.block
  year empty$
    'skip$
    { format.date "year" output.check }
  if$
  % We don't need to output the URL details ('lastchecked' and 'url'),
  % because fin.entry does that for us, using output.web.refs.  The only
  % reason we would want to put them here is if we were to decide that
  % they should go in front of the rather miscellaneous information in 'note'.
  new.block
  note output
  fin.entry
}
% ...urlbst to here


FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.title "title" output.check
  crossref missing$
    { journal
      "journal" output.check
%SP 2001/01/23
% Add the space in format.vol.num.pages
      % add.blank
	  before.all 'output.state :=
      format.vol.num.pages output
    }
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
  format.journal.pages
  format.note output
  fin.entry
  write.url
}

FUNCTION {book}
{ output.bibitem
  author empty$
    { format.editors "author and editor" output.check
    }
    { format.authors output.nonnull
      crossref missing$
        { "author and editor" editor either.or.check }
        'skip$
      if$
    }
  if$
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.btitle "title" output.check
  crossref missing$
    { format.edition output
      format.bvolume output
      format.number.series output
      format.publisher.address output
    }
    {
      format.book.crossref output.nonnull
    }
  if$
  format.note output
  fin.entry
  write.url
}

FUNCTION {booklet}
{ output.bibitem
  format.authors output
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.title "title" output.check
  howpublished output
  address output
  format.note output
  format.date output
  fin.entry
  write.url
}

FUNCTION {inbook}
{ output.bibitem
  author empty$
    { format.editors "author and editor" output.check
    }
    { format.authors output.nonnull
      crossref missing$
        { "author and editor" editor either.or.check }
        'skip$
      if$
    }
  if$
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.btitle "title" output.check
  crossref missing$
    {
      format.edition output
      format.bvolume output
      format.number.series output
      format.publisher.address output
      format.chapter.pages "chapter and pages" output.check
    }
    {
      format.chapter.pages "chapter and pages" output.check
      format.book.crossref output.nonnull
    }
  if$
  format.pages "pages" output.check
  format.note output
  fin.entry
  write.url
}

FUNCTION {incollection}
{ output.bibitem
  format.authors "author" output.check
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.title "title" output.check
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.edition output
      format.bvolume output
      format.number.series output
      format.publisher.address output
      format.chapter.pages output
    }
    { format.incoll.inproc.crossref output.nonnull
      format.chapter.pages output
    }
  if$
  format.pages "pages" output.check
  format.note output
  fin.entry
  write.url
}

FUNCTION {inproceedings}
{ output.bibitem
  format.authors "author" output.check
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.title "title" output.check
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.edition output
      format.bvolume output
      format.number.series output
      publisher empty$
        { format.organization.address output }
        { organization output
          format.publisher.address output
        }
      if$
%SP 2001/01/23
%      format.pages output
    }
    { format.incoll.inproc.crossref output.nonnull
%SP 2001/01/23
%      format.pages output
    }
  if$
%SP 2001/01/23
  format.pages "pages" output.check
  format.note output
  fin.entry
  write.url
}

FUNCTION {conference} { inproceedings }

FUNCTION {manual}
{ output.bibitem
  author empty$
    { organization empty$
        'skip$
        { organization output.nonnull
          address output
        }
      if$
    }
    { format.authors output.nonnull }
  if$
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.btitle "title" output.check
  author empty$
    { organization empty$
    {
          address output
        }
        'skip$
      if$
    }
    {
      organization output
      address output
    }
  if$
  format.edition output
  format.note output
  format.date output
  fin.entry
  write.url
}

FUNCTION {mastersthesis}
{ output.bibitem
  format.authors "author" output.check
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.title "title" output.check
  bbl.mthesis format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.note output
  format.date "year" output.check
  fin.entry
  write.url
}

FUNCTION {misc}
{ output.bibitem
  format.authors output
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.title output
  howpublished output
  format.note output
  format.date output
  fin.entry
  write.url
  empty.misc.check
}

FUNCTION {phdthesis}
{ output.bibitem
  format.authors "author" output.check
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.title "title" output.check
  bbl.phdthesis format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.note output
  format.date "year" output.check
  fin.entry
  write.url
}

FUNCTION {proceedings}
{ output.bibitem
  editor empty$
    { organization output }
    { format.editors output.nonnull }
  if$
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.btitle "title" output.check
  format.bvolume output
  format.number.series output
  editor empty$
    { publisher empty$
        'skip$
        {
          format.publisher.address output
        }
      if$
    }
    { publisher empty$
        {
          format.organization.address output }
        {
          organization output
          format.publisher.address output
        }
      if$
     }
  if$
  format.note output
%  format.date "year" output.check
  fin.entry
  write.url
}

FUNCTION {techreport}
{ output.bibitem
  format.authors "author" output.check
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.title "title" output.check
  format.tr.number output.nonnull
  institution "institution" output.check
  address output
  format.note output
  format.date "year" output.check
  fin.entry
  write.url
}

FUNCTION {unpublished}
{ output.bibitem
  format.authors "author" output.check
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.title "title" output.check
  format.note "note" output.check
  format.date output
  fin.entry
  write.url
}

FUNCTION {default.type} { misc }

READ

STRINGS { longest.label }

INTEGERS { number.label longest.label.width }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #1 'number.label :=
  #0 'longest.label.width :=
}

FUNCTION {longest.label.pass}
{ number.label int.to.str$ 'label :=
  number.label #1 + 'number.label :=
  label width$ longest.label.width >
    { label 'longest.label :=
      label width$ 'longest.label.width :=
    }
    'skip$
  if$
}

EXECUTE {initialize.longest.label}

ITERATE {longest.label.pass}

FUNCTION {begin.bib}
{ preamble$ empty$
    'skip$
    { preamble$ write$ newline$ }
  if$
  "\begin{thebibliography}{"  longest.label  * "}" *
  write$ newline$
  "\expandafter\ifx\csname url\endcsname\relax"
  write$ newline$
  "  \def\url#1{\texttt{#1}}\fi"
  write$ newline$
  "\expandafter\ifx\csname urlprefix\endcsname\relax\def\urlprefix{URL }\fi"
  write$ newline$
  "\expandafter\ifx\csname href\endcsname\relax"
  write$ newline$
  "  \def\href#1#2{#2} \def\path#1{#1}\fi"
  write$ newline$
}

EXECUTE {begin.bib}

EXECUTE {init.urlbst.variables}
EXECUTE {init.state.consts}

ITERATE {call.type$}

FUNCTION {end.bib}
{ newline$
  "\end{thebibliography}" write$ newline$
}

EXECUTE {end.bib}
%% End of customized bst file
%%
%</num>
%    \end{macrocode}
%    \begin{macrocode}
%<*numnames>
%%
%% This is file `elsearticle-num-names.bst',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% merlin.mbs  (with options: `head,exlang,ay,nat,seq-no,nm-init,ed-au,dt-jnl,dt-end,atit-u,jttl-rm,vnum-sp,volp-blk,jdt-p,pp-last,num-xser,jnm-x,btit-rm,bt-rm,bkpg-x,isbn,issn,doi,edpar,bkedcap,blk-com,in-col,english,ppx,ed,abr,xedn,varand,xand,url,url-blk,bibinfo,nfss,,{}')
%% english.mbs  (with options: `exlang,ay,nat,seq-no,nm-init,ed-au,dt-jnl,dt-end,atit-u,jttl-rm,vnum-sp,volp-blk,jdt-p,pp-last,num-xser,jnm-x,btit-rm,bt-rm,bkpg-x,isbn,issn,doi,edpar,bkedcap,blk-com,in-col,english,ppx,ed,abr,xedn,varand,xand,url,url-blk,bibinfo,nfss,,{}')
%% merlin.mbs  (with options: `tail,exlang,ay,nat,seq-no,nm-init,ed-au,dt-jnl,dt-end,atit-u,jttl-rm,vnum-sp,volp-blk,jdt-p,pp-last,num-xser,jnm-x,btit-rm,bt-rm,bkpg-x,isbn,issn,doi,edpar,bkedcap,blk-com,in-col,english,ppx,ed,abr,xedn,varand,xand,url,url-blk,bibinfo,nfss,,{}')
%% ----------------------------------------
%% *** Journal of Sound and Vibration ***
%%
%% Copyright 1994-2004 Patrick W Daly
 % ===============================================================
 % IMPORTANT NOTICE:
 % This bibliographic style (bst) file has been generated from one or
 % more master bibliographic style (mbs) files, listed above.
 %
 % This generated file can be redistributed and/or modified under the terms
 % of the LaTeX Project Public License Distributed from CTAN
 % archives in directory macros/latex/base/lppl.txt; either
 % version 1 of the License, or any later version.
 % ===============================================================
 % Name and version information of the main mbs file:
 % \ProvidesFile{merlin.mbs}[2004/02/09 4.13 (PWD, AO, DPC)]
 %   For use with BibTeX version 0.99a or later
 %-------------------------------------------------------------------

ENTRY
 { address
   author
   booktitle
   chapter
   doi
   edition
   editor
   eid
   howpublished
   institution
   isbn
   issn
   journal
   key
   month
   note
   number
   organization
   pages
   publisher
   school
   series
   title
   type
   url
   volume
   year
 }
 {}
 { label extra.label sort.label short.list }
INTEGERS { output.state before.all mid.sentence after.sentence after.block }
FUNCTION {init.state.consts}
{ #0 'before.all :=
 #1 'mid.sentence :=
 #2 'after.sentence :=
 #3 'after.block :=
}
STRINGS { s t}
FUNCTION {output.nonnull}
{ 's :=
 output.state mid.sentence =
   { ", " * write$ }
   { output.state after.block =
       { add.period$ write$
         newline$
         "\newblock " write$
       }
       { output.state before.all =
           'write$
           { add.period$ " " * write$ }
         if$
       }
     if$
     mid.sentence 'output.state :=
   }
 if$
 s
}
FUNCTION {output}
{ duplicate$ empty$
   'pop$
   'output.nonnull
 if$
}
FUNCTION {output.check}
{ 't :=
 duplicate$ empty$
   { pop$ "empty " t * " in " * cite$ * warning$ }
   'output.nonnull
 if$
}
FUNCTION {fin.entry}
{ add.period$
 write$
 newline$
}

FUNCTION {new.block}
{ output.state before.all =
   'skip$
   { after.block 'output.state := }
 if$
}
FUNCTION {new.sentence}
{ output.state after.block =
   'skip$
   { output.state before.all =
       'skip$
       { after.sentence 'output.state := }
     if$
   }
 if$
}
FUNCTION {add.blank}
{  " " * before.all 'output.state :=
}

FUNCTION {date.block}
{
 skip$
}

FUNCTION {not}
{   { #0 }
   { #1 }
 if$
}
FUNCTION {and}
{   'skip$
   { pop$ #0 }
 if$
}
FUNCTION {or}
{   { pop$ #1 }
   'skip$
 if$
}
FUNCTION {new.block.checkb}
{ empty$
 swap$ empty$
 and
   'skip$
   'new.block
 if$
}
FUNCTION {field.or.null}
{ duplicate$ empty$
   { pop$ "" }
   'skip$
 if$
}
FUNCTION {emphasize}
{ duplicate$ empty$
   { pop$ "" }
   { "\emph{" swap$ * "}" * }
 if$
}
FUNCTION {tie.or.space.prefix}
{ duplicate$ text.length$ #3 <
   { "~" }
   { " " }
 if$
 swap$
}

FUNCTION {capitalize}
{ "u" change.case$ "t" change.case$ }

FUNCTION {space.word}
{ " " swap$ * " " * }
 % Here are the language-specific definitions for explicit words.
 % Each function has a name bbl.xxx where xxx is the English word.
 %-------------------------------------------------------------------
 % Begin module:
 % \ProvidesFile{english.mbs}[2003/11/06 4.2 (PWD)]

 % The language selected here is ENGLISH
FUNCTION {bbl.and}
{ "and"}

FUNCTION {bbl.etal}
{ "et~al." }

FUNCTION {bbl.editors}
{ "eds." }

FUNCTION {bbl.editor}
{ "ed." }

FUNCTION {bbl.edby}
{ "edited by" }

FUNCTION {bbl.edition}
{ "edn." }

FUNCTION {bbl.volume}
{ "vol." }

FUNCTION {bbl.of}
{ "of" }

FUNCTION {bbl.number}
{ "no." }

FUNCTION {bbl.nr}
{ "no." }

FUNCTION {bbl.in}
{ "in" }

FUNCTION {bbl.pages}
{ "" }

FUNCTION {bbl.page}
{ "" }

FUNCTION {bbl.chapter}
{ "chap." }

FUNCTION {bbl.techrep}
{ "Tech. Rep." }

FUNCTION {bbl.mthesis}
{ "Master's thesis" }

FUNCTION {bbl.phdthesis}
{ "Ph.D. thesis" }

MACRO {jan} {"Jan."}

MACRO {feb} {"Feb."}

MACRO {mar} {"Mar."}

MACRO {apr} {"Apr."}

MACRO {may} {"May"}

MACRO {jun} {"Jun."}

MACRO {jul} {"Jul."}

MACRO {aug} {"Aug."}

MACRO {sep} {"Sep."}

MACRO {oct} {"Oct."}

MACRO {nov} {"Nov."}

MACRO {dec} {"Dec."}

 % End module: english.mbs
%% Copyright 1994-2004 Patrick W Daly
MACRO {acmcs} {"ACM Computing Surveys"}

MACRO {acta} {"Acta Informatica"}

MACRO {cacm} {"Communications of the ACM"}

MACRO {ibmjrd} {"IBM Journal of Research and Development"}

MACRO {ibmsj} {"IBM Systems Journal"}

MACRO {ieeese} {"IEEE Transactions on Software Engineering"}

MACRO {ieeetc} {"IEEE Transactions on Computers"}

MACRO {ieeetcad}
 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}

MACRO {ipl} {"Information Processing Letters"}

MACRO {jacm} {"Journal of the ACM"}

MACRO {jcss} {"Journal of Computer and System Sciences"}

MACRO {scp} {"Science of Computer Programming"}

MACRO {sicomp} {"SIAM Journal on Computing"}

MACRO {tocs} {"ACM Transactions on Computer Systems"}

MACRO {tods} {"ACM Transactions on Database Systems"}

MACRO {tog} {"ACM Transactions on Graphics"}

MACRO {toms} {"ACM Transactions on Mathematical Software"}

MACRO {toois} {"ACM Transactions on Office Information Systems"}

MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}

MACRO {tcs} {"Theoretical Computer Science"}
FUNCTION {bibinfo.check}
{ swap$
 duplicate$ missing$
   {
     pop$ pop$
     ""
   }
   { duplicate$ empty$
       {
         swap$ pop$
       }
       { swap$
         "\bibinfo{" swap$ * "}{" * swap$ * "}" *
       }
     if$
   }
 if$
}
FUNCTION {bibinfo.warn}
{ swap$
 duplicate$ missing$
   {
     swap$ "missing " swap$ * " in " * cite$ * warning$ pop$
     ""
   }
   { duplicate$ empty$
       {
         swap$ "empty " swap$ * " in " * cite$ * warning$
       }
       { swap$
         "\bibinfo{" swap$ * "}{" * swap$ * "}" *
       }
     if$
   }
 if$
}
FUNCTION {format.url}
{ url empty$
   { "" }
   { "\urlprefix\url{" url * "}" * }
 if$
}

STRINGS  { bibinfo}
INTEGERS { nameptr namesleft numnames }

FUNCTION {format.names}
{ 'bibinfo :=
 duplicate$ empty$ 'skip$ {
 's :=
 "" 't :=
 #1 'nameptr :=
 s num.names$ 'numnames :=
 numnames 'namesleft :=
   { namesleft #0 > }
   { s nameptr
     "{f.~}{vv~}{ll}{, jj}"
     format.name$
     bibinfo bibinfo.check
     't :=
     nameptr #1 >
       {
         namesleft #1 >
           { ", " * t * }
           {
             "," *
             s nameptr "{ll}" format.name$ duplicate$ "others" =
               { 't := }
               { pop$ }
             if$
             t "others" =
               {
                 " " * bbl.etal *
               }
               { " " * t * }
             if$
           }
         if$
       }
       't
     if$
     nameptr #1 + 'nameptr :=
     namesleft #1 - 'namesleft :=
   }
 while$
 } if$
}
FUNCTION {format.names.ed}
{
 format.names
}
FUNCTION {format.key}
{ empty$
   { key field.or.null }
   { "" }
 if$
}

FUNCTION {format.authors}
{ author "author" format.names
}
FUNCTION {get.bbl.editor}
{ editor num.names$ #1 > 'bbl.editors 'bbl.editor if$ }

FUNCTION {format.editors}
{ editor "editor" format.names duplicate$ empty$ 'skip$
   {
     " " *
     get.bbl.editor
     capitalize
  "(" swap$ * ")" *
     *
   }
 if$
}
FUNCTION {format.isbn}
{ isbn "isbn" bibinfo.check
 duplicate$ empty$ 'skip$
   {
     "ISBN " swap$ *
   }
 if$
}

FUNCTION {format.issn}
{ issn "issn" bibinfo.check
 duplicate$ empty$ 'skip$
   {
     "ISSN " swap$ *
   }
 if$
}

 FUNCTION {format.doi}
 { doi "doi" bibinfo.check
  duplicate$ empty$ 'skip$
    {
      "\doi{" swap$  * "}" *
    }
  if$
 }



FUNCTION {format.note}
{
 note empty$
   { "" }
   { note #1 #1 substring$
     duplicate$ "{" =
       'skip$
       { output.state mid.sentence =
         { "l" }
         { "u" }
       if$
       change.case$
       }
     if$
     note #2 global.max$ substring$ * "note" bibinfo.check
   }
 if$
}

FUNCTION {format.title}
{ title
 "title" bibinfo.check
}
FUNCTION {format.full.names}
{'s :=
 "" 't :=
 #1 'nameptr :=
 s num.names$ 'numnames :=
 numnames 'namesleft :=
   { namesleft #0 > }
   { s nameptr
     "{vv~}{ll}" format.name$
     't :=
     nameptr #1 >
       {
         namesleft #1 >
           { ", " * t * }
           {
             s nameptr "{ll}" format.name$ duplicate$ "others" =
               { 't := }
               { pop$ }
             if$
             t "others" =
               {
                 " " * bbl.etal *
               }
               {
                 numnames #2 >
                   { "," * }
                   'skip$
                 if$
                 bbl.and
                 space.word * t *
               }
             if$
           }
         if$
       }
       't
     if$
     nameptr #1 + 'nameptr :=
     namesleft #1 - 'namesleft :=
   }
 while$
}

FUNCTION {author.editor.key.full}
{ author empty$
   { editor empty$
       { key empty$
           { cite$ #1 #3 substring$ }
           'key
         if$
       }
       { editor format.full.names }
     if$
   }
   { author format.full.names }
 if$
}

FUNCTION {author.key.full}
{ author empty$
   { key empty$
        { cite$ #1 #3 substring$ }
         'key
     if$
   }
   { author format.full.names }
 if$
}

FUNCTION {editor.key.full}
{ editor empty$
   { key empty$
        { cite$ #1 #3 substring$ }
         'key
     if$
   }
   { editor format.full.names }
 if$
}

FUNCTION {make.full.names}
{ type$ "book" =
 type$ "inbook" =
 or
   'author.editor.key.full
   { type$ "proceedings" =
       'editor.key.full
       'author.key.full
     if$
   }
 if$
}

FUNCTION {output.bibitem}
{ newline$
 "\bibitem[{" write$
 label write$
 ")" make.full.names duplicate$ short.list =
    { pop$ }
    { * }
  if$
 "}]{" * write$
 cite$ write$
 "}" write$
 newline$
 ""
 before.all 'output.state :=
}

FUNCTION {n.dashify}
{
 't :=
 ""
   { t empty$ not }
   { t #1 #1 substring$ "-" =
       { t #1 #2 substring$ "--" = not
           { "--" *
             t #2 global.max$ substring$ 't :=
           }
           {   { t #1 #1 substring$ "-" = }
               { "-" *
                 t #2 global.max$ substring$ 't :=
               }
             while$
           }
         if$
       }
       { t #1 #1 substring$ *
         t #2 global.max$ substring$ 't :=
       }
     if$
   }
 while$
}

FUNCTION {word.in}
{ bbl.in
 ":" *
 " " * }

FUNCTION {format.date}
{ year "year" bibinfo.check duplicate$ empty$
   {
     "empty year in " cite$ * "; set to ????" * warning$
      pop$ "????"
   }
   'skip$
 if$
 extra.label *
}
FUNCTION{format.year}
{ year "year" bibinfo.check duplicate$ empty$
   {  "empty year in " cite$ *
      "; set to ????" *
      warning$
      pop$ "????"
   }
   {
   }
 if$
 extra.label *
 "(" swap$ * ")" *
}
FUNCTION {format.btitle}
{ title "title" bibinfo.check
 duplicate$ empty$ 'skip$
   {
   }
 if$
}
FUNCTION {either.or.check}
{ empty$
   'pop$
   { "can't use both " swap$ * " fields in " * cite$ * warning$ }
 if$
}
FUNCTION {format.bvolume}
{ volume empty$
   { "" }
   { bbl.volume volume tie.or.space.prefix
     "volume" bibinfo.check * *
     series "series" bibinfo.check
     duplicate$ empty$ 'pop$
       { swap$ bbl.of space.word * swap$
         emphasize * }
     if$
     "volume and number" number either.or.check
   }
 if$
}
FUNCTION {format.number.series}
{ volume empty$
   { number empty$
       { series field.or.null }
       { series empty$
           { number "number" bibinfo.check }
           { output.state mid.sentence =
               { bbl.number }
               { bbl.number capitalize }
             if$
             number tie.or.space.prefix "number" bibinfo.check * *
             bbl.in space.word *
             series "series" bibinfo.check *
           }
         if$
       }
     if$
   }
   { "" }
 if$
}

FUNCTION {format.edition}
{ edition duplicate$ empty$ 'skip$
   {
     output.state mid.sentence =
       { "l" }
       { "t" }
     if$ change.case$
     "edition" bibinfo.check
     " " * bbl.edition *
   }
 if$
}
INTEGERS { multiresult }
FUNCTION {multi.page.check}
{ 't :=
 #0 'multiresult :=
   { multiresult not
     t empty$ not
     and
   }
   { t #1 #1 substring$
     duplicate$ "-" =
     swap$ duplicate$ "," =
     swap$ "+" =
     or or
       { #1 'multiresult := }
       { t #2 global.max$ substring$ 't := }
     if$
   }
 while$
 multiresult
}
FUNCTION {format.pages}
{ pages duplicate$ empty$ 'skip$
   { duplicate$ multi.page.check
       {
         n.dashify
       }
       {
       }
     if$
     "pages" bibinfo.check
   }
 if$
}
FUNCTION {format.journal.pages}
{ pages duplicate$ empty$ 'pop$
   { swap$ duplicate$ empty$
       { pop$ pop$ format.pages }
       {
         " " *
         format.year * " " *
         swap$
         n.dashify
         "pages" bibinfo.check
         *
       }
     if$
   }
 if$
}
FUNCTION {format.journal.eid}
{ eid "eid" bibinfo.check
 duplicate$ empty$ 'pop$
   { swap$ duplicate$ empty$ 'skip$
     {
         " " *
     }
     if$
     swap$ *
   }
 if$
}
FUNCTION {format.vol.num.pages}
{ volume field.or.null
 duplicate$ empty$ 'skip$
   {
     "volume" bibinfo.check
   }
 if$
 number "number" bibinfo.check duplicate$ empty$ 'skip$
   {
     swap$ duplicate$ empty$
       { "there's a number but no volume in " cite$ * warning$ }
       'skip$
     if$
     swap$
     "~(" swap$ * ")" *
   }
 if$ *
}

FUNCTION {format.chapter.pages}
{ chapter empty$
   { "" }
   { type empty$
       { bbl.chapter }
       { type "l" change.case$
         "type" bibinfo.check
       }
     if$
     chapter tie.or.space.prefix
     "chapter" bibinfo.check
     * *
   }
 if$
}

FUNCTION {format.booktitle}
{
 booktitle "booktitle" bibinfo.check
}
FUNCTION {format.in.ed.booktitle}
{ format.booktitle duplicate$ empty$ 'skip$
   {
     editor "editor" format.names.ed duplicate$ empty$ 'pop$
       {
         " " *
         get.bbl.editor
         capitalize
         "(" swap$ * "), " *
         * swap$
         * }
     if$
     word.in swap$ *
   }
 if$
}
FUNCTION {format.thesis.type}
{ type duplicate$ empty$
   'pop$
   { swap$ pop$
     "t" change.case$ "type" bibinfo.check
   }
 if$
}
FUNCTION {format.tr.number}
{ number "number" bibinfo.check
 type duplicate$ empty$
   { pop$ bbl.techrep }
   'skip$
 if$
 "type" bibinfo.check
 swap$ duplicate$ empty$
   { pop$ "t" change.case$ }
   { tie.or.space.prefix * * }
 if$
}
FUNCTION {format.article.crossref}
{
 word.in
 " \cite{" * crossref * "}" *
}
FUNCTION {format.book.crossref}
{ volume duplicate$ empty$
   { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
     pop$ word.in
   }
   { bbl.volume
     swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of space.word *
   }
 if$
 " \cite{" * crossref * "}" *
}
FUNCTION {format.incoll.inproc.crossref}
{
 word.in
 " \cite{" * crossref * "}" *
}
FUNCTION {format.org.or.pub}
{ 't :=
 ""
 address empty$ t empty$ and
   'skip$
   {
     t empty$
       { address "address" bibinfo.check *
       }
       { t *
         address empty$
           'skip$
           { ", " * address "address" bibinfo.check * }
         if$
       }
     if$
   }
 if$
}
FUNCTION {format.publisher.address}
{ publisher "publisher" bibinfo.warn format.org.or.pub
}

FUNCTION {format.organization.address}
{ organization "organization" bibinfo.check format.org.or.pub
}

FUNCTION {article}
{ output.bibitem
 format.authors "author" output.check
 author format.key output
 format.title "title" output.check
 crossref missing$
   {
     journal
     "journal" bibinfo.check
     "journal" output.check
     add.blank
     format.vol.num.pages output
   }
   { format.article.crossref output.nonnull
   }
 if$
 eid empty$
   { format.journal.pages }
   { format.journal.eid }
 if$
 format.issn output
 format.doi output
 format.url output
 format.note output
 fin.entry
}
FUNCTION {book}
{ output.bibitem
 author empty$
   { format.editors "author and editor" output.check
     editor format.key output
   }
   { format.authors output.nonnull
     crossref missing$
       { "author and editor" editor either.or.check }
       'skip$
     if$
   }
 if$
 format.btitle "title" output.check
 crossref missing$
   { format.bvolume output
     format.number.series output
     format.publisher.address output
   }
   {
     format.book.crossref output.nonnull
   }
 if$
 format.edition output
 format.isbn output
 format.doi output
 format.url output
 format.note output
 format.date "year" output.check
 fin.entry
}
FUNCTION {booklet}
{ output.bibitem
 format.authors output
 author format.key output
 format.title "title" output.check
 howpublished "howpublished" bibinfo.check output
 address "address" bibinfo.check output
 format.isbn output
 format.doi output
 format.url output
 format.note output
 format.date "year" output.check
 fin.entry
}

FUNCTION {inbook}
{ output.bibitem
 author empty$
   { format.editors "author and editor" output.check
     editor format.key output
   }
   { format.authors output.nonnull
     crossref missing$
       { "author and editor" editor either.or.check }
       'skip$
     if$
   }
 if$
 format.btitle "title" output.check
 crossref missing$
   {
     format.bvolume output
     format.chapter.pages "chapter and pages" output.check
     format.number.series output
     format.publisher.address output
   }
   {
     format.chapter.pages "chapter and pages" output.check
     format.book.crossref output.nonnull
   }
 if$
 format.edition output
 crossref missing$
   { format.isbn output }
   'skip$
 if$
 format.pages "pages" output.check
 format.doi output
 format.url output
 format.note output
 format.date "year" output.check
 fin.entry
}

FUNCTION {incollection}
{ output.bibitem
 format.authors "author" output.check
 author format.key output
 format.title "title" output.check
 crossref missing$
   { format.in.ed.booktitle "booktitle" output.check
     format.bvolume output
     format.number.series output
     format.chapter.pages output
     format.publisher.address output
     format.edition output
     format.isbn output
   }
   { format.incoll.inproc.crossref output.nonnull
     format.chapter.pages output
   }
 if$
 format.pages "pages" output.check
 format.doi output
 format.url output
 format.note output
 format.date "year" output.check
 fin.entry
}
FUNCTION {inproceedings}
{ output.bibitem
 format.authors "author" output.check
 author format.key output
 format.title "title" output.check
 crossref missing$
   { format.in.ed.booktitle "booktitle" output.check
     format.bvolume output
     format.number.series output
     publisher empty$
       { format.organization.address output }
       { organization "organization" bibinfo.check output
         format.publisher.address output
       }
     if$
     format.isbn output
     format.issn output
   }
   { format.incoll.inproc.crossref output.nonnull
   }
 if$
 format.pages "pages" output.check
 format.doi output
 format.url output
 format.note output
 format.date "year" output.check
 fin.entry
}
FUNCTION {conference} { inproceedings }
FUNCTION {manual}
{ output.bibitem
 format.authors output
 author format.key output
 format.btitle "title" output.check
 organization "organization" bibinfo.check output
 address "address" bibinfo.check output
 format.edition output
 format.doi output
 format.url output
 format.note output
 format.date "year" output.check
 fin.entry
}

FUNCTION {mastersthesis}
{ output.bibitem
 format.authors "author" output.check
 author format.key output
 format.btitle
 "title" output.check
 bbl.mthesis format.thesis.type output.nonnull
 school "school" bibinfo.warn output
 address "address" bibinfo.check output
 format.doi output
 format.url output
 format.note output
 format.date "year" output.check
 fin.entry
}

FUNCTION {misc}
{ output.bibitem
 format.authors output
 author format.key output
 format.title output
 howpublished "howpublished" bibinfo.check output
 format.doi output
 format.url output
 format.note output
 format.date "year" output.check
 fin.entry
}
FUNCTION {phdthesis}
{ output.bibitem
 format.authors "author" output.check
 author format.key output
 format.btitle
 "title" output.check
 bbl.phdthesis format.thesis.type output.nonnull
 school "school" bibinfo.warn output
 address "address" bibinfo.check output
 format.doi output
 format.url output
 format.note output
 format.date "year" output.check
 fin.entry
}

FUNCTION {proceedings}
{ output.bibitem
 format.editors output
 editor format.key output
 format.btitle "title" output.check
 format.bvolume output
 format.number.series output
 publisher empty$
   { format.organization.address output }
   { organization "organization" bibinfo.check output
     format.publisher.address output
   }
 if$
 format.isbn output
 format.issn output
 format.doi output
 format.url output
 format.note output
 format.date "year" output.check
 fin.entry
}

FUNCTION {techreport}
{ output.bibitem
 format.authors "author" output.check
 author format.key output
 format.title
 "title" output.check
 format.tr.number output.nonnull
 institution "institution" bibinfo.warn output
 address "address" bibinfo.check output
 format.doi output
 format.url output
 format.note output
 format.date "year" output.check
 fin.entry
}

FUNCTION {unpublished}
{ output.bibitem
 format.authors "author" output.check
 author format.key output
 format.title "title" output.check
 format.doi output
 format.url output
 format.note "note" output.check
 format.date output
 fin.entry
}

FUNCTION {default.type} { misc }
READ
FUNCTION {sortify}
{ purify$
 "l" change.case$
}
INTEGERS { len }
FUNCTION {chop.word}
{ 's :=
 'len :=
 s #1 len substring$ =
   { s len #1 + global.max$ substring$ }
   's
 if$
}
FUNCTION {format.lab.names}
{ 's :=
 "" 't :=
 s #1 "{vv~}{ll}" format.name$
 s num.names$ duplicate$
 #2 >
   { pop$
     " " * bbl.etal *
   }
   { #2 <
       'skip$
       { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
           {
             " " * bbl.etal *
           }
           { bbl.and space.word * s #2 "{vv~}{ll}" format.name$
             * }
         if$
       }
     if$
   }
 if$
}

FUNCTION {author.key.label}
{ author empty$
   { key empty$
       { cite$ #1 #3 substring$ }
       'key
     if$
   }
   { author format.lab.names }
 if$
}

FUNCTION {author.editor.key.label}
{ author empty$
   { editor empty$
       { key empty$
           { cite$ #1 #3 substring$ }
           'key
         if$
       }
       { editor format.lab.names }
     if$
   }
   { author format.lab.names }
 if$
}

FUNCTION {editor.key.label}
{ editor empty$
   { key empty$
       { cite$ #1 #3 substring$ }
       'key
     if$
   }
   { editor format.lab.names }
 if$
}

FUNCTION {calc.short.authors}
{ type$ "book" =
 type$ "inbook" =
 or
   'author.editor.key.label
   { type$ "proceedings" =
       'editor.key.label
       'author.key.label
     if$
   }
 if$
 'short.list :=
}

FUNCTION {calc.label}
{ calc.short.authors
 short.list
 "("
 *
 year duplicate$ empty$
    { pop$ "????" }
    { purify$ #-1 #4 substring$ }
 if$
 *
 'label :=
}

FUNCTION {sort.format.names}
{ 's :=
 #1 'nameptr :=
 ""
 s num.names$ 'numnames :=
 numnames 'namesleft :=
   { namesleft #0 > }
   { s nameptr
     "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}"
     format.name$ 't :=
     nameptr #1 >
       {
         "   "  *
         namesleft #1 = t "others" = and
           { "zzzzz" * }
           { t sortify * }
         if$
       }
       { t sortify * }
     if$
     nameptr #1 + 'nameptr :=
     namesleft #1 - 'namesleft :=
   }
 while$
}

FUNCTION {sort.format.title}
{ 't :=
 "A " #2
   "An " #3
     "The " #4 t chop.word
   chop.word
 chop.word
 sortify
 #1 global.max$ substring$
}
FUNCTION {author.sort}
{ author empty$
   { key empty$
       { "to sort, need author or key in " cite$ * warning$
         ""
       }
       { key sortify }
     if$
   }
   { author sort.format.names }
 if$
}
FUNCTION {author.editor.sort}
{ author empty$
   { editor empty$
       { key empty$
           { "to sort, need author, editor, or key in " cite$ * warning$
             ""
           }
           { key sortify }
         if$
       }
       { editor sort.format.names }
     if$
   }
   { author sort.format.names }
 if$
}
FUNCTION {editor.sort}
{ editor empty$
   { key empty$
       { "to sort, need editor or key in " cite$ * warning$
         ""
       }
       { key sortify }
     if$
   }
   { editor sort.format.names }
 if$
}
INTEGERS { seq.num }
FUNCTION {init.seq}
{ #0 'seq.num :=}
EXECUTE {init.seq}
FUNCTION {int.to.fix}
{ "000000000" swap$ int.to.str$ *
 #-1 #10 substring$
}
FUNCTION {presort}
{ calc.label
 label sortify
 "    "
 *
 seq.num #1 + 'seq.num :=
 seq.num  int.to.fix
 'sort.label :=
 sort.label
 *
 "    "
 *
 title field.or.null
 sort.format.title
 *
 #1 entry.max$ substring$
 'sort.key$ :=
}

ITERATE {presort}
SORT
STRINGS { last.label next.extra }
INTEGERS { last.extra.num number.label }
FUNCTION {initialize.extra.label.stuff}
{ #0 int.to.chr$ 'last.label :=
 "" 'next.extra :=
 #0 'last.extra.num :=
 #0 'number.label :=
}
FUNCTION {forward.pass}
{ last.label label =
   { last.extra.num #1 + 'last.extra.num :=
     last.extra.num int.to.chr$ 'extra.label :=
   }
   { "a" chr.to.int$ 'last.extra.num :=
     "" 'extra.label :=
     label 'last.label :=
   }
 if$
 number.label #1 + 'number.label :=
}
FUNCTION {reverse.pass}
{ next.extra "b" =
   { "a" 'extra.label := }
   'skip$
 if$
 extra.label 'next.extra :=
 extra.label
 duplicate$ empty$
   'skip$
   { "{\natexlab{" swap$ * "}}" * }
 if$
 'extra.label :=
 label extra.label * 'label :=
}
EXECUTE {initialize.extra.label.stuff}
ITERATE {forward.pass}
REVERSE {reverse.pass}
FUNCTION {bib.sort.order}
{ sort.label
 "    "
 *
 year field.or.null sortify
 *
 "    "
 *
 title field.or.null
 sort.format.title
 *
 #1 entry.max$ substring$
 'sort.key$ :=
}
ITERATE {bib.sort.order}
SORT
FUNCTION {begin.bib}
{ preamble$ empty$
   'skip$
   { preamble$ write$ newline$ }
 if$
 "\begin{thebibliography}{" number.label int.to.str$ * "}" *
 write$ newline$
 "\providecommand{\natexlab}[1]{#1}"
 write$ newline$
 "\providecommand{\url}[1]{\texttt{#1}}"
 write$ newline$
 "\providecommand{\urlprefix}{URL }"
 write$ newline$
 "\expandafter\ifx\csname urlstyle\endcsname\relax"
 write$ newline$
 "  \providecommand{\doi}[1]{doi:\discretionary{}{}{}#1}\else"
 write$ newline$
 "  \providecommand{\doi}[1]{doi:\discretionary{}{}{}\begingroup \urlstyle{rm}\url{#1}\endgroup}\fi"
 write$ newline$
 "\providecommand{\bibinfo}[2]{#2}"
 write$ newline$
}
EXECUTE {begin.bib}
EXECUTE {init.state.consts}
ITERATE {call.type$}
FUNCTION {end.bib}
{ newline$
 "\end{thebibliography}" write$ newline$
}
EXECUTE {end.bib}
%% End of customized bst file
%%
%% End of file `elsearticle-num-names.bst'.
%</numnames>
%    \end{macrocode}
%    \begin{macrocode}
%<*harvard>

 %%-------------------------------------------------------------------
 %% This bibliography style file is intended for texts in ENGLISH
 %% This is an author-year citation style bibliography. As such, it is
 %% non-standard LaTeX, and requires a special package file
 %% to function properly.
 %% Such a package is    natbib.sty   by Patrick W. Daly
 %% The form of the \bibitem entries is
 %%   \bibitem[Jones et al.(1990)]{key}...
 %%   \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}...
 %% The essential feature is that the label (the part in brackets) consists
 %% of the author names, as they should appear in the citation, with the year
 %% in parentheses following. There must be no space before the opening
 %% parenthesis!
 %% With natbib v5.3, a full list of authors may also follow the year.
 %% In natbib.sty, it is possible to define the type of enclosures that is
 %% really wanted (brackets or parentheses), but in either case, there must
 %% be parentheses in the label.
 %% The \cite command functions as follows:
 %%   \citet{key} ==>>                Jones et al. (1990)
 %%   \citet*{key} ==>>               Jones, Baker, and Smith (1990)
 %%   \citep{key} ==>>                (Jones et al., 1990)
 %%   \citep*{key} ==>>               (Jones, Baker, and Smith, 1990)
 %%   \citep[chap. 2]{key} ==>>       (Jones et al., 1990, chap. 2)
 %%   \citep[e.g.][]{key} ==>>        (e.g. Jones et al., 1990)
 %%   \citep[e.g.][p. 32]{key} ==>>   (e.g. Jones et al., p. 32)
 %%   \citeauthor{key} ==>>           Jones et al.
 %%   \citeauthor*{key} ==>>          Jones, Baker, and Smith
 %%   \citeyear{key} ==>>             1990
 %%---------------------------------------------------------------------

ENTRY
  { address
    author
    booktitle
    chapter
    edition
    editor
    howpublished
    institution
    journal
    key
    month
    note
    number
    organization
    pages
    publisher
    school
    series
    title
    type
    url
    volume
    year
  }
  {}
  { label extra.label sort.label short.list }

INTEGERS { output.state before.all mid.sentence after.sentence after.block }

FUNCTION {init.state.consts}
{ #0 'before.all :=
  #1 'mid.sentence :=
  #2 'after.sentence :=
  #3 'after.block :=
}

STRINGS { s t }

FUNCTION {output.nonnull}
{ 's :=
  output.state mid.sentence =
    { ", " * write$ }
    { output.state after.block =
        { add.period$ write$
          newline$
          "\newblock " write$
        }
        { output.state before.all =
            'write$
            { add.period$ " " * write$ }
          if$
        }
      if$
      mid.sentence 'output.state :=
    }
  if$
  s
}

FUNCTION {output}
{ duplicate$ empty$
    'pop$
    'output.nonnull
  if$
}

FUNCTION {output.check}
{ 't :=
  duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    'output.nonnull
  if$
}

FUNCTION {fin.entry}
{ add.period$
  write$
  newline$
}

FUNCTION {new.block}
{ output.state before.all =
    'skip$
    { after.block 'output.state := }
  if$
}

FUNCTION {new.sentence}
{ output.state after.block =
    'skip$
    { output.state before.all =
        'skip$
        { after.sentence 'output.state := }
      if$
    }
  if$
}

%%SP 2003/07/25
%% No longer used
FUNCTION {add.blank}
{  " " * before.all 'output.state :=
}

FUNCTION {date.block}
{
  new.sentence
}

FUNCTION {not}
{   { #0 }
    { #1 }
  if$
}

FUNCTION {and}
{   'skip$
    { pop$ #0 }
  if$
}

FUNCTION {or}
{   { pop$ #1 }
    'skip$
  if$
}

FUNCTION {new.block.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.block
  if$
}

FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}

FUNCTION {emphasize}
{ skip$ }

FUNCTION {capitalize}
{ "u" change.case$ "t" change.case$ }

FUNCTION {space.word}
{ " " swap$ * " " * }

 %% Here are the language-specific definitions for explicit words.
 %% Each function has a name bbl.xxx where xxx is the English word.
 %% The language selected here is ENGLISH
FUNCTION {bbl.and}
{ "and"}

FUNCTION {bbl.etal}
{ "et~al." }

FUNCTION {bbl.editors}
{ "Eds." }

FUNCTION {bbl.editor}
{ "Ed." }

FUNCTION {bbl.edby}
{ "edited by" }

FUNCTION {bbl.edition}
{ "Edition" }

FUNCTION {bbl.volume}
{ "Vol." }

FUNCTION {bbl.of}
{ "of" }

FUNCTION {bbl.number}
{ "no." }

FUNCTION {bbl.nr}
{ "no." }

FUNCTION {bbl.in}
{ "in" }

FUNCTION {bbl.pages}
{ "pp." }

FUNCTION {bbl.page}
{ "p." }

FUNCTION {bbl.chapter}
{ "Ch." }

FUNCTION {bbl.techrep}
{ "Tech. Rep." }

FUNCTION {bbl.mthesis}
{ "Master's thesis" }

FUNCTION {bbl.phdthesis}
{ "Ph.D. thesis" }

FUNCTION {bbl.first}
{ "1st" }

FUNCTION {bbl.second}
{ "2nd" }

FUNCTION {bbl.third}
{ "3rd" }

FUNCTION {bbl.fourth}
{ "4th" }

FUNCTION {bbl.fifth}
{ "5th" }

FUNCTION {bbl.st}
{ "st" }

FUNCTION {bbl.nd}
{ "nd" }

FUNCTION {bbl.rd}
{ "rd" }

FUNCTION {bbl.th}
{ "th" }

MACRO {jan} {"Jan."}

MACRO {feb} {"Feb."}

MACRO {mar} {"Mar."}

MACRO {apr} {"Apr."}

MACRO {may} {"May"}

MACRO {jun} {"Jun."}

MACRO {jul} {"Jul."}

MACRO {aug} {"Aug."}

MACRO {sep} {"Sep."}

MACRO {oct} {"Oct."}

MACRO {nov} {"Nov."}

MACRO {dec} {"Dec."}

FUNCTION {eng.ord}
{ duplicate$ "1" swap$ *
  #-2 #1 substring$ "1" =
     { bbl.th * }
     { duplicate$ #-1 #1 substring$
       duplicate$ "1" =
         { pop$ bbl.st * }
         { duplicate$ "2" =
             { pop$ bbl.nd * }
             { "3" =
                 { bbl.rd * }
                 { bbl.th * }
               if$
             }
           if$
          }
       if$
     }
   if$
}

MACRO {acmcs} {"ACM Comput. Surv."}

MACRO {acta} {"Acta Inf."}

MACRO {cacm} {"Commun. ACM"}

MACRO {ibmjrd} {"IBM J. Res. Dev."}

MACRO {ibmsj} {"IBM Syst.~J."}

MACRO {ieeese} {"IEEE Trans. Softw. Eng."}

MACRO {ieeetc} {"IEEE Trans. Comput."}

MACRO {ieeetcad}
 {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}

MACRO {ipl} {"Inf. Process. Lett."}

MACRO {jacm} {"J.~ACM"}

MACRO {jcss} {"J.~Comput. Syst. Sci."}

MACRO {scp} {"Sci. Comput. Programming"}

MACRO {sicomp} {"SIAM J. Comput."}

MACRO {tocs} {"ACM Trans. Comput. Syst."}

MACRO {tods} {"ACM Trans. Database Syst."}

MACRO {tog} {"ACM Trans. Gr."}

MACRO {toms} {"ACM Trans. Math. Softw."}

MACRO {toois} {"ACM Trans. Office Inf. Syst."}

MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}

MACRO {tcs} {"Theoretical Comput. Sci."}

FUNCTION {write.url}
{ url empty$
    { skip$ }
    { "\newline\urlprefix\url{" url * "}" * write$ newline$ }
  if$
}


INTEGERS { nameptr namesleft numnames }

FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      "{vv~}{ll}{, jj}{, f.}" format.name$
    't :=
      nameptr #1 >
        {
          namesleft #1 >
            { ", " * t * }
            {
              "," *
              s nameptr "{ll}" format.name$ duplicate$ "others" =
                { 't := }
                { pop$ }
              if$
              t "others" =
                {
                  " " * bbl.etal *
                }
                { " " * t * }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}
FUNCTION {format.names.ed}
{ format.names }
FUNCTION {format.key}
{ empty$
    { key field.or.null }
    { "" }
  if$
}

FUNCTION {format.authors}
{ author empty$
    { "" }
    { author format.names }
  if$
}

FUNCTION {format.editors}
{ editor empty$
    { "" }
    { editor format.names
      editor num.names$ #1 >
        { " (" * bbl.editors * ")" * }
        { " (" * bbl.editor * ")" * }
      if$
    }
  if$
}

FUNCTION {format.in.editors}
{ editor empty$
    { "" }
    { editor format.names.ed
      editor num.names$ #1 >
        { " (" * bbl.editors * ")" * }
        { " (" * bbl.editor * ")" * }
      if$
    }
  if$
}

FUNCTION {format.note}
{
 note empty$
    { "" }
    { note #1 #1 substring$
      duplicate$ "{" =
        'skip$
        { output.state mid.sentence =
          { "l" }
          { "u" }
        if$
        change.case$
        }
      if$
      note #2 global.max$ substring$ *
    }
  if$
}

FUNCTION {format.title}
{ title empty$
    { "" }
    { title "t" change.case$
    }
  if$
}

FUNCTION {format.full.names}
{'s :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      "{vv~}{ll}" format.name$
      't :=
      nameptr #1 >
        {
          namesleft #1 >
            { ", " * t * }
            {
              numnames #2 >
                { "," * }
                'skip$
              if$
              s nameptr "{ll}" format.name$ duplicate$ "others" =
                { 't := }
                { pop$ }
              if$
              t "others" =
                {
                  " " * bbl.etal *
                }
                { bbl.and
                  space.word * t *
                }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {author.editor.key.full}
{ author empty$
    { editor empty$
        { key empty$
            { cite$ #1 #3 substring$ }
            'key
          if$
        }
        { editor format.full.names }
      if$
    }
    { author format.full.names }
  if$
}

FUNCTION {author.key.full}
{ author empty$
    { key empty$
         { cite$ #1 #3 substring$ }
          'key
      if$
    }
    { author format.full.names }
  if$
}

FUNCTION {editor.key.full}
{ editor empty$
    { key empty$
         { cite$ #1 #3 substring$ }
          'key
      if$
    }
    { editor format.full.names }
  if$
}

FUNCTION {make.full.names}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.key.full
    { type$ "proceedings" =
        'editor.key.full
        'author.key.full
      if$
    }
  if$
}

FUNCTION {output.bibitem}
{ newline$
  "\bibitem[{" write$
  label write$
  ")" make.full.names duplicate$ short.list =
     { pop$ }
     { * }
   if$
  "}]{" * write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

FUNCTION {n.dashify}
{
  't :=
  ""
    { t empty$ not }
    { t #1 #1 substring$ "-" =
        { t #1 #2 substring$ "--" = not
            { "--" *
              t #2 global.max$ substring$ 't :=
            }
            {   { t #1 #1 substring$ "-" = }
                { "-" *
                  t #2 global.max$ substring$ 't :=
                }
              while$
            }
          if$
        }
        { t #1 #1 substring$ *
          t #2 global.max$ substring$ 't :=
        }
      if$
    }
  while$
}

FUNCTION {word.in}
{ bbl.in capitalize
  ":" *
  " " * }

FUNCTION {format.date}
{ year duplicate$ empty$
    { "empty year in " cite$ * "; set to ????" * warning$
       pop$ "????" }
    'skip$
  if$
  month empty$
    'skip$
    { month
      " " * swap$ *
    }
  if$
  extra.label *
  before.all 'output.state :=
  ", " swap$ *
}

FUNCTION {format.btitle}
{ title
}

FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #3 <
    { "~" }
    { " " }
  if$
  swap$ * *
}

FUNCTION {either.or.check}
{ empty$
    'pop$
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  if$
}

FUNCTION {format.bvolume}
{ volume empty$
    { "" }
    { bbl.volume volume tie.or.space.connect
      series empty$
        'skip$
        { bbl.of space.word * series emphasize * }
      if$
      "volume and number" number either.or.check
    }
  if$
}

FUNCTION {format.number.series}
{ volume empty$
    { number empty$
        { series field.or.null }
        { output.state mid.sentence =
            { bbl.number }
            { bbl.number capitalize }
          if$
          number tie.or.space.connect
          series empty$
            { "there's a number but no series in " cite$ * warning$ }
            { bbl.in space.word * series * }
          if$
        }
      if$
    }
    { "" }
  if$
}

FUNCTION {is.num}
{ chr.to.int$
  duplicate$ "0" chr.to.int$ < not
  swap$ "9" chr.to.int$ > not and
}

FUNCTION {extract.num}
{ duplicate$ 't :=
  "" 's :=
  { t empty$ not }
  { t #1 #1 substring$
    t #2 global.max$ substring$ 't :=
    duplicate$ is.num
      { s swap$ * 's := }
      { pop$ "" 't := }
    if$
  }
  while$
  s empty$
    'skip$
    { pop$ s }
  if$
}

FUNCTION {convert.edition}
{ edition extract.num "l" change.case$ 's :=
  s "first" = s "1" = or
    { bbl.first 't := }
    { s "second" = s "2" = or
        { bbl.second 't := }
        { s "third" = s "3" = or
            { bbl.third 't := }
            { s "fourth" = s "4" = or
                { bbl.fourth 't := }
                { s "fifth" = s "5" = or
                    { bbl.fifth 't := }
                    { s #1 #1 substring$ is.num
                        { s eng.ord 't := }
                        { edition 't := }
                      if$
                    }
                  if$
                }
              if$
            }
          if$
        }
      if$
    }
  if$
  t
}

FUNCTION {format.edition}
{ edition empty$
    { "" }
    { output.state mid.sentence =
        { convert.edition "l" change.case$ " " * bbl.edition * }
        { convert.edition "t" change.case$ " " * bbl.edition * }
      if$
    }
  if$
}

INTEGERS { multiresult }

FUNCTION {multi.page.check}
{ 't :=
  #0 'multiresult :=
    { multiresult not
      t empty$ not
      and
    }
    { t #1 #1 substring$
      duplicate$ "-" =
      swap$ duplicate$ "," =
      swap$ "+" =
      or or
        { #1 'multiresult := }
        { t #2 global.max$ substring$ 't := }
      if$
    }
  while$
  multiresult
}

FUNCTION {format.pages}
{ pages empty$
    { "" }
    { pages multi.page.check
        { bbl.pages pages n.dashify tie.or.space.connect }
        { bbl.page pages tie.or.space.connect }
      if$
    }
  if$
}

FUNCTION {format.journal.pages}
{ pages empty$
    'skip$
    { duplicate$ empty$
        { pop$ format.pages }
        {
          ", " *
          pages n.dashify *
        }
      if$
    }
  if$
}

%%SP 2001/01/23
%% Only used in articles
FUNCTION {format.vol.num.pages}
{ 
%%SP 2001/01/23
%% Add the leading space only if there is a volume
  %% volume field.or.null
  " "
  volume empty$
    { pop$ "" }
    { volume * }
  if$
  number empty$
    'skip$
    {
      "~(" number * ")" * *
      volume empty$
        { "there's a number but no volume in " cite$ * warning$ }
        'skip$
      if$
    }
  if$
}

FUNCTION {format.chapter.pages}
{ chapter empty$
    { "" }
    { type empty$
        { bbl.chapter }
        { type "l" change.case$ }
      if$
      chapter tie.or.space.connect
    }
  if$
}

FUNCTION {format.in.ed.booktitle}
{ booktitle empty$
    { "" }
    { editor empty$
        { word.in booktitle * }
        { word.in format.in.editors * ", " *
          booktitle * }
      if$
    }
  if$
}

FUNCTION {format.thesis.type}
{ type empty$
    'skip$
    { pop$
      type "t" change.case$
    }
  if$
}

FUNCTION {format.tr.number}
{ type empty$
    { bbl.techrep }
    'type
  if$
  number empty$
    { "t" change.case$ }
    { number tie.or.space.connect }
  if$
}

FUNCTION {format.article.crossref}
{
  word.in
  " \cite{" * crossref * "}" *
}

FUNCTION {format.book.crossref}
{ volume empty$
    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
      word.in
    }
    { bbl.volume capitalize
      volume tie.or.space.connect
      bbl.of space.word *
    }
  if$
  " \cite{" * crossref * "}" *
}

FUNCTION {format.incoll.inproc.crossref}
{
  word.in
  " \cite{" * crossref * "}" *
}

FUNCTION {format.org.or.pub}
{ 't :=
  ""
  address empty$ t empty$ and
    'skip$
    {
      t empty$
        { address empty$
          'skip$
          { address * }
          if$
        }
        { t *
          address empty$
            'skip$
            { ", " * address * }
          if$
        }
      if$
    }
  if$
}

FUNCTION {format.publisher.address}
{ publisher empty$
    { "empty publisher in " cite$ * warning$
      ""
    }
    { publisher }
  if$
  format.org.or.pub
}

FUNCTION {format.organization.address}
{ organization empty$
    { "" }
    { organization }
  if$
  format.org.or.pub
}

FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  format.date "year" output.check
  date.block
  format.title "title" output.check
  new.sentence
  crossref missing$
    { journal
      "journal" output.check
%%SP 2001/01/23
%% Add the space in format.vol.num.pages
      %% add.blank
	  before.all 'output.state :=
      format.vol.num.pages output
    }
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
  format.journal.pages
  format.note output
  fin.entry
  write.url
}

FUNCTION {book}
{ output.bibitem
  author empty$
    { format.editors "author and editor" output.check
      editor format.key output
    }
    { format.authors output.nonnull
      crossref missing$
        { "author and editor" editor either.or.check }
        'skip$
      if$
    }
  if$
  format.date "year" output.check
  date.block
  format.btitle "title" output.check
  crossref missing$
    { format.edition output
      new.sentence
	  format.bvolume output
      format.number.series output
      new.sentence
      format.publisher.address output
    }
    {
  new.sentence
      format.book.crossref output.nonnull
    }
  if$
  format.note output
  fin.entry
  write.url
}

FUNCTION {booklet}
{ output.bibitem
  format.authors output
  author format.key output
  format.date "year" output.check
  date.block
  format.title "title" output.check
  new.sentence
  howpublished output
  address output
  format.note output
  fin.entry
  write.url
}

FUNCTION {inbook}
{ output.bibitem
  author empty$
    { format.editors "author and editor" output.check
      editor format.key output
    }
    { format.authors output.nonnull
      crossref missing$
        { "author and editor" editor either.or.check }
        'skip$
      if$
    }
  if$
  format.date "year" output.check
  date.block
  format.btitle "title" output.check
  crossref missing$
    {
      format.edition output
      new.sentence
      format.bvolume output
      format.number.series output
      new.sentence
      format.publisher.address output
      format.chapter.pages "chapter and pages" output.check
    }
    {
      format.chapter.pages "chapter and pages" output.check
  new.sentence
      format.book.crossref output.nonnull
    }
  if$
  format.pages "pages" output.check
  format.note output
  fin.entry
  write.url
}

FUNCTION {incollection}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  format.date "year" output.check
  date.block
  format.title "title" output.check
  new.sentence
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.edition output
      new.sentence
      format.bvolume output
      format.number.series output
      new.sentence
      format.publisher.address output
      format.chapter.pages output
    }
    { format.incoll.inproc.crossref output.nonnull
      format.chapter.pages output
    }
  if$
  format.pages "pages" output.check
  format.note output
  fin.entry
  write.url
}

FUNCTION {inproceedings}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  format.date "year" output.check
  date.block
  format.title "title" output.check
  new.sentence
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.edition output
      new.sentence
      format.bvolume output
      format.number.series output
      new.sentence
      publisher empty$
        { format.organization.address output }
        { organization output
          format.publisher.address output
        }
      if$
%%SP 2001/01/23
%%      format.pages output
    }
    { format.incoll.inproc.crossref output.nonnull
%%SP 2001/01/23
%%      format.pages output
    }
  if$
%%SP 2001/01/23
  format.pages "pages" output.check
  format.note output
  fin.entry
  write.url
}

FUNCTION {conference} { inproceedings }

FUNCTION {manual}
{ output.bibitem
  format.authors output
  author format.key output
  format.date "year" output.check
  date.block
  format.btitle "title" output.check
  new.sentence
  organization output
  address output
  format.edition output
  format.note output
  fin.entry
  write.url
}

FUNCTION {mastersthesis}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  format.date "year" output.check
  date.block
  format.title "title" output.check
  new.sentence
  bbl.mthesis format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.note output
  fin.entry
  write.url
}

FUNCTION {misc}
{ output.bibitem
  format.authors output
  author format.key output
  format.date "year" output.check
  date.block
  format.title output
  new.sentence
  howpublished output
  format.note output
  fin.entry
  write.url
}

FUNCTION {phdthesis}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  format.date "year" output.check
  date.block
  format.title "title" output.check
  new.sentence
  bbl.phdthesis format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.note output
  fin.entry
  write.url
}

FUNCTION {proceedings}
{ output.bibitem
  format.editors output
  editor format.key output
  format.date "year" output.check
  date.block
  format.btitle "title" output.check
  new.sentence
  format.bvolume output
  format.number.series output
  new.sentence
  publisher empty$
    { format.organization.address output }
    { organization output
      format.publisher.address output
    }
  if$
  format.note output
  fin.entry
  write.url
}

FUNCTION {techreport}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  format.date "year" output.check
  date.block
  format.title "title" output.check
  new.sentence
  format.tr.number output.nonnull
  institution "institution" output.check
  address output
  format.note output
  fin.entry
  write.url
}

FUNCTION {unpublished}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  format.date "year" output.check
  date.block
  format.title "title" output.check
  format.note "note" output.check
  fin.entry
  write.url
}

FUNCTION {default.type} { misc }

READ

FUNCTION {sortify}
{ purify$
  "l" change.case$
}

INTEGERS { len }

FUNCTION {chop.word}
{ 's :=
  'len :=
  s #1 len substring$ =
    { s len #1 + global.max$ substring$ }
    's
  if$
}

FUNCTION {format.lab.names}
{ 's :=
  s #1 "{vv~}{ll}" format.name$
  s num.names$ duplicate$
  #2 >
    { pop$
      " " * bbl.etal *
    }
    { #2 <
        'skip$
        { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
            {
              " " * bbl.etal *
            }
            { bbl.and space.word * s #2 "{vv~}{ll}" format.name$
              * }
          if$
        }
      if$
    }
  if$
}

FUNCTION {author.key.label}
{ author empty$
    { key empty$
        { cite$ #1 #3 substring$ }
        'key
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {author.editor.key.label}
{ author empty$
    { editor empty$
        { key empty$
            { cite$ #1 #3 substring$ }
            'key
          if$
        }
        { editor format.lab.names }
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {editor.key.label}
{ editor empty$
    { key empty$
        { cite$ #1 #3 substring$ }
        'key
      if$
    }
    { editor format.lab.names }
  if$
}

FUNCTION {calc.short.authors}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.key.label
    { type$ "proceedings" =
        'editor.key.label
        'author.key.label
      if$
    }
  if$
  'short.list :=
}

FUNCTION {calc.label}
{ calc.short.authors
  short.list
  "("
  *
  year duplicate$ empty$
     { pop$ "????" }
     'skip$
  if$
  *
  'label :=
}

FUNCTION {sort.format.names}
{ 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}"
      format.name$ 't :=
      nameptr #1 >
        {
          "   "  *
          namesleft #1 = t "others" = and
            { "zzzzz" * }
            { t sortify * }
          if$
        }
        { t sortify * }
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {sort.format.title}
{ 't :=
  "A " #2
    "An " #3
      "The " #4 t chop.word
    chop.word
  chop.word
  sortify
  #1 global.max$ substring$
}

FUNCTION {author.sort}
{ author empty$
    { key empty$
        { "to sort, need author or key in " cite$ * warning$
          ""
        }
        { key sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {author.editor.sort}
{ author empty$
    { editor empty$
        { key empty$
            { "to sort, need author, editor, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { editor sort.format.names }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {editor.sort}
{ editor empty$
    { key empty$
        { "to sort, need editor or key in " cite$ * warning$
          ""
        }
        { key sortify }
      if$
    }
    { editor sort.format.names }
  if$
}

FUNCTION {presort}
{ calc.label
  label sortify
  "    "
  *
  type$ "book" =
  type$ "inbook" =
  or
    'author.editor.sort
    { type$ "proceedings" =
        'editor.sort
        'author.sort
      if$
    }
  if$
  #1 entry.max$ substring$
  'sort.label :=
  sort.label
  *
  "    "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.max$ substring$
  'sort.key$ :=
}

ITERATE {presort}

SORT

STRINGS { last.label next.extra }

INTEGERS { last.extra.num number.label }

FUNCTION {initialize.extra.label.stuff}
{ #0 int.to.chr$ 'last.label :=
  "" 'next.extra :=
  #0 'last.extra.num :=
  #0 'number.label :=
}

FUNCTION {forward.pass}
{ last.label label =
    { last.extra.num #1 + 'last.extra.num :=
      last.extra.num int.to.chr$ 'extra.label :=
    }
    { "a" chr.to.int$ 'last.extra.num :=
      "" 'extra.label :=
      label 'last.label :=
    }
  if$
  number.label #1 + 'number.label :=
}

FUNCTION {reverse.pass}
{ next.extra "b" =
    { "a" 'extra.label := }
    'skip$
  if$
  extra.label 'next.extra :=
  extra.label
  duplicate$ empty$
    'skip$
    { "{\natexlab{" swap$ * "}}" * }
  if$
  'extra.label :=
  label extra.label * 'label :=
}

EXECUTE {initialize.extra.label.stuff}

ITERATE {forward.pass}

REVERSE {reverse.pass}

FUNCTION {bib.sort.order}
{ sort.label
  "    "
  *
  year field.or.null sortify
  *
  "    "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.max$ substring$
  'sort.key$ :=
}

ITERATE {bib.sort.order}

SORT

FUNCTION {begin.bib}
{ preamble$ empty$
    'skip$
    { preamble$ write$ newline$ }
  if$
  "\begin{thebibliography}{" number.label int.to.str$ * "}" *
  write$ newline$
  "\expandafter\ifx\csname natexlab\endcsname\relax\def\natexlab#1{#1}\fi"
  write$ newline$
  "\expandafter\ifx\csname url\endcsname\relax"
  write$ newline$
  "  \def\url#1{\texttt{#1}}\fi"
  write$ newline$
  "\expandafter\ifx\csname urlprefix\endcsname\relax\def\urlprefix{URL }\fi"
  write$ newline$
}

EXECUTE {begin.bib}

EXECUTE {init.state.consts}

ITERATE {call.type$}

FUNCTION {end.bib}
{ newline$
  "\end{thebibliography}" write$ newline$
}

EXECUTE {end.bib}
%% End of customized bst file
%%
%% End of file `elsarticle-harv.bst'.
%</harvard>
%    \end{macrocode}
%    \begin{macrocode}
%<*harvtemplate>
%% Template article for Elsevier's document class `elsarticle'
%% with harvard style bibliographic references
%% SP 2008/03/01

\documentclass[preprint,12pt]{elsarticle}

%% Use the option review to obtain double line spacing
%% \documentclass[authoryear,preprint,review,12pt]{elsarticle}

%% Use the options 1p,twocolumn; 3p; 3p,twocolumn; 5p; or 5p,twocolumn
%% for a journal layout:
%% \documentclass[final,1p,times]{elsarticle}
%% \documentclass[final,1p,times,twocolumn]{elsarticle}
%% \documentclass[final,3p,times]{elsarticle}
%% \documentclass[final,3p,times,twocolumn]{elsarticle}
%% \documentclass[final,5p,times]{elsarticle}
%% \documentclass[final,5p,times,twocolumn]{elsarticle}

%% if you use PostScript figures in your article
%% use the graphics package for simple commands
%% \usepackage{graphics}
%% or use the graphicx package for more complicated commands
%% \usepackage{graphicx}
%% or use the epsfig package if you prefer to use the old commands
%% \usepackage{epsfig}

%% The amssymb package provides various useful mathematical symbols
\usepackage{amssymb}
%% The amsthm package provides extended theorem environments
%% \usepackage{amsthm}

%% The lineno packages adds line numbers. Start line numbering with
%% \begin{linenumbers}, end it with \end{linenumbers}. Or switch it on
%% for the whole article with \linenumbers.
%% \usepackage{lineno}


\journal{Nuclear Physics B}

\begin{document}

\begin{frontmatter}

%% Title, authors and addresses

%% use the tnoteref command within \title for footnotes;
%% use the tnotetext command for theassociated footnote;
%% use the fnref command within \author or \address for footnotes;
%% use the fntext command for theassociated footnote;
%% use the corref command within \author for corresponding author footnotes;
%% use the cortext command for theassociated footnote;
%% use the ead command for the email address,
%% and the form \ead[url] for the home page:
%% \title{Title\tnoteref{label1}}
%% \tnotetext[label1]{}
%% \author{Name\corref{cor1}\fnref{label2}}
%% \ead{email address}
%% \ead[url]{home page}
%% \fntext[label2]{}
%% \cortext[cor1]{}
%% \address{Address\fnref{label3}}
%% \fntext[label3]{}

\title{}

%% use optional labels to link authors explicitly to addresses:
%% \author[label1,label2]{}
%% \address[label1]{}
%% \address[label2]{}

\author{}

\address{}

\begin{abstract}
%% Text of abstract

\end{abstract}

\begin{keyword}
%% keywords here, in the form: keyword \sep keyword

%% PACS codes here, in the form: \PACS code \sep code

%% MSC codes here, in the form: \MSC code \sep code
%% or \MSC[2008] code \sep code (2000 is the default)

\end{keyword}

\end{frontmatter}

%% \linenumbers

%% main text
\section{}
\label{}

%% The Appendices part is started with the command \appendix;
%% appendix sections are then done as normal sections
%% \appendix

%% \section{}
%% \label{}

\begin{thebibliography}{00}

%% \bibitem{label}
%% Text of bibliographic item

\bibitem{}

\end{thebibliography}
%</harvtemplate>
%<harvtemplate>\end{document}

%     \end{macrocode}
%     \begin{macrocode}
%<*numtemplate>
%% Template article for Elsevier's document class `elsarticle'
%% with numbered style bibliographic references
%% SP 2008/03/01

\documentclass[preprint,12pt]{elsarticle}

%% Use the option review to obtain double line spacing
%% \documentclass[authoryear,preprint,review,12pt]{elsarticle}

%% Use the options 1p,twocolumn; 3p; 3p,twocolumn; 5p; or 5p,twocolumn
%% for a journal layout:
%% \documentclass[final,1p,times]{elsarticle}
%% \documentclass[final,1p,times,twocolumn]{elsarticle}
%% \documentclass[final,3p,times]{elsarticle}
%% \documentclass[final,3p,times,twocolumn]{elsarticle}
%% \documentclass[final,5p,times]{elsarticle}
%% \documentclass[final,5p,times,twocolumn]{elsarticle}

%% if you use PostScript figures in your article
%% use the graphics package for simple commands
%% \usepackage{graphics}
%% or use the graphicx package for more complicated commands
%% \usepackage{graphicx}
%% or use the epsfig package if you prefer to use the old commands
%% \usepackage{epsfig}

%% The amssymb package provides various useful mathematical symbols
\usepackage{amssymb}
%% The amsthm package provides extended theorem environments
%% \usepackage{amsthm}

%% The lineno packages adds line numbers. Start line numbering with
%% \begin{linenumbers}, end it with \end{linenumbers}. Or switch it on
%% for the whole article with \linenumbers.
%% \usepackage{lineno}


\journal{Nuclear Physics B}

\begin{document}

\begin{frontmatter}

%% Title, authors and addresses

%% use the tnoteref command within \title for footnotes;
%% use the tnotetext command for theassociated footnote;
%% use the fnref command within \author or \address for footnotes;
%% use the fntext command for theassociated footnote;
%% use the corref command within \author for corresponding author footnotes;
%% use the cortext command for theassociated footnote;
%% use the ead command for the email address,
%% and the form \ead[url] for the home page:
%% \title{Title\tnoteref{label1}}
%% \tnotetext[label1]{}
%% \author{Name\corref{cor1}\fnref{label2}}
%% \ead{email address}
%% \ead[url]{home page}
%% \fntext[label2]{}
%% \cortext[cor1]{}
%% \address{Address\fnref{label3}}
%% \fntext[label3]{}

\title{}

%% use optional labels to link authors explicitly to addresses:
%% \author[label1,label2]{}
%% \address[label1]{}
%% \address[label2]{}

\author{}

\address{}

\begin{abstract}
%% Text of abstract

\end{abstract}

\begin{keyword}
%% keywords here, in the form: keyword \sep keyword

%% PACS codes here, in the form: \PACS code \sep code

%% MSC codes here, in the form: \MSC code \sep code
%% or \MSC[2008] code \sep code (2000 is the default)

\end{keyword}

\end{frontmatter}

%% \linenumbers

%% main text
\section{}
\label{}

%% The Appendices part is started with the command \appendix;
%% appendix sections are then done as normal sections
%% \appendix

%% \section{}
%% \label{}

\begin{thebibliography}{00}

%% \bibitem{label}
%% Text of bibliographic item

\bibitem{}

\end{thebibliography}
%</numtemplate>
%<numtemplate>\end{document}
%
%     \end{macrocode}
% 
%
% \Finale
\endinput

%%
%% End of file 'elsarticle.dtx'
%%

