← All templates

Diachronica (submission template)

Diachronica's deliberately minimal LaTeX submission template, written by the journal's Executive Editor: glossed examples with gb4e, footnotes and author-year references with the unified linguistics style sheet (unified.bst).

Create an account to use this
Category
Journal
Document class
article (article.cls) — ships with TeX Live
Workflow
Journal manuscript — submissions and revision rounds
Author
John Benjamins Publishing Company (Diachronica)
Source
John Benjamins Publishing Company (Diachronica)
Licence
article.cls: LaTeX Project Public License (installed with TeX). The sample text is John Benjamins Publishing Company (Diachronica)'s, provided for authors preparing a submission.

These are the publisher’s own files. This project starts from John Benjamins Publishing Company (Diachronica)’s package for this publication — their manuscript, their article.cls, their bibliography style — so what compiles here is what they would have given you.

John Benjamins Publishing Company (Diachronica) serves this exact file to Diachronica. Check John Benjamins Publishing Company (Diachronica)’s author pages for the current instructions.

Where this differs from the publisher’s download.

  • Note: Compile with XeLaTeX: the template sets the Junicode font with fontspec.

What you get

  • bibliography.bib · 130 B
  • gb4e.sty · 14 KB
  • main.tex — the file that is compiled · 3 KB
  • unified.bst · 29 KB

These become your files. Editing them afterwards changes your project and nothing else — a project owns its files from the moment it is made.

Journals using this template

2 venues use this class

Manulyx keeps one template per document class and relates every venue to it, rather than one near-identical card per journal. Searching the gallery for any of these names finds this template.

Journal of Machine Learning Research, Transactions on Machine Learning Research
  • Journal of Machine Learning Research
  • Transactions on Machine Learning Research

Source

bibliography.bib · 130 B

@book{bow12,
title={A grammar of {Bardi}},
author={Bowern, Claire},
year={2012},
publisher={Mouton de Gruyter},
address={Berlin}}
gb4e.sty · 14 KB
% -*- LaTeX -*-
\def\gbVersion{4e}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Version 4export (= v. 4 minus the compatibility code)
%  Based on hpk's gb.sty, revised for GM syllabus by ct,
%  and incorporating macros adapted from J.Frampton, M. van der Goot en M.
%  Covington. Full documentation in gb4e-doc.tex. Bug-reports
%  and suggestions for improvements, other used features, please!
%
%  The package gb4e may be distributed under the conditions of the LaTeX Project
%  Public License (LPPL). See the README file for more details.
%
%  Notes:
%  
%  Various styles for X-bar levels; can be changed, but note that {picture}
%  environements (e.g. trees) will then come out wrong and have to be
%  fixed
%
%  This file allows _ and ^ to be used in ordinary text, hence must be
%  loaded AFTER any file that uses them in their TeX meaning. Hence
%  cgloss(n).sty is loaded early in this file.  This feature is known to
%  cause some problems with other packages, but is maintained for backward 
%  compatibility. If you have problems, you can try disabling it by
%  placing the command \noautomath immediately after loading the gb4e package.
%  [Added 2009/12/28]

% CHANGE LOG
%
% 2010/7/2
%    - Fixed bug (introduced in previous changes) that discarded spaces 
%    after sub/superscripts outside math mode. 
%
% 2010/01/03 [unreleased]
%    - Removed stray \bf
%    - Removed leftover old definition of ^, _
%
% 2009/12/28 
% 	 - Added README.txt with LPPL license statement.
%    - Updated sub- and superscripts outside of math mode. They now 
%    combine properly, and the feature can be turned off with \noautomath 
%    (and back on with \automath).
%    - Removed references to \rm, for compatibility with memoir.cls
%    - \@footnotetext is no longer modified destructively; compatible with
%    other packages that modify it.
%    - \eachwordone etc. can now be defined to font commands that take
%    arguments (e.g., to \textit).
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%
%  Format of examples: %
%%%%%%%%%%%%%%%%%%%%%%%%
% \begin{exe} or \exbegin
% <examples>                           (arab.)
% \begin{xlist} or \xlist
% <subexamples>                        (1st embedding, alph.)
% \begin{xlisti} or \xlisti
% <subsubexamples>                     (2st embedding, rom.)
% \end{xlisti}  or \endxlisti
% <more examples>
% \end{xlist} or \endxlist
% <still more examples>
% \end{exe} or \exend
%
% Other sublist-styles: xlistA (Alph.), xlistI (Rom.), xlistn (arab)
%
% \ex                               (produces Number)
% \ex <sentence>                    (numbered example)
% \ex[jdgmt]{sentence}              (numbered example with judgement)
%
% \exi{ident}                      (produces identifier)
% \exi{ident} <sentence>           (example numbered with identifier)
% \exi{ident}[jdgmt]{sentence}     (dito with judgement)
%                      (\exr, \exp and \sn are defined in terms of \exi)
%
% \exr{label}                       (produces cross-referenced Num.)
% \exr{label} <sentence>            (cross-referenced example)
% \exr{label}[jdgmt]{sentence}      (cross-referenced example with judgement)
%
% \exp{label}                       (same as
% \exp{label} <sentence>                     \exr but
% \exp{label}[jdgmt]{sentence}                        with prime)
%
% \sn <sentence>                    (unnumbered example)
% \sn[jdgmt]{sentence}              (unnumbered example with judgement)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% For my own laziness (HANDLE WITH CARE---this works only
%                                 in boringly normal cases.... ):
%
% \ea                works like \begin{exe}\ex or \begin{xlist}\ex,
%                            depending on context
% \z                 works like \end{exe} or \end{xlist}, dep on context
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% For any REALLY old distributions without \rmfamily
\@ifundefined{rmfamily}{\let\rmfamily=\rm \let\bfseries=\bf}

\@ifundefined{new@fontshape}{\def\reset@font{}\let\mathrm\rmfamily\let\mathit\mit}{}

\let\prmbrs=0
\def\primebars{\let\prmbrs=1}
\def\obar#1{\ifmmode#1^{0}\else#1$^{0}$\fi}  %% FIX
\def\mbar#1{\ifmmode#1^{\mathrm{max}}\else#1$^{\mathrm{max}}$\fi}
\def\ibar#1{\ifx\prmbrs0%
                 \ifmmode\overline{\mathrm{#1}}\else$\overline{\mbox{#1}}$\fi%
            \else\ifmmode#1^{'}\else#1$^{'}$\fi\fi}
\def\iibar#1{\ifx\prmbrs0%
                  \ifmmode\overline{\overline{\mathrm{#1}}}%
                  \else$\overline{\overline{\mbox{#1}}}$\fi%
             \else #1P\fi}
\def\th{\ifmmode\theta\else$\theta$\fi}
\def\al{\ifmmode\alpha\else$\alpha$\fi}
\def\be{\ifmmode\beta\else$\beta$\fi}
\def\ga{\ifmmode\gamma\else$\gamma$\fi}
\def\de{\ifmmode\delta\else$\delta$\fi}
\def\spec#1{[Spec,#1]} %Def. of "Specifier of #1"
\def\ct#1{{\em #1\/}} %Citation of linguistic material with alternative style:
%\def\ct#1{`#1'}
\def\tx{\bfseries} %Introduction of technical terms with alternative style:
%\def\tx{\em}

\input{cgloss\gbVersion.sty}

\newcommand{\indexgroupmark}[1]{\item{\bfseries #1}}  % ?? -CT


%%%%%%%%%%% AUTOMATH 

% this allows _ to be used in horizontal mode (from J.Frampton):
% Reimplemented to allow this feature to be turned on and off.
% The new version also combines sub- and superscripts properly.
% -Alexis

% \automath     Make _ and ^ work outside math mode
% \noautomath   Restore normal sub/superscript behavior

{ % Temporarily change catcodes
  \catcode`\_=\active
  \catcode`\^=\active

  \global\def\automath{%
    \catcode`\_=\active
    \catcode`\^=\active
    \def_##1{\gb@ifnextchar^{\automath@two_{##1}}{\ensuremath{\sb{##1}}}}%
    \def^##1{\gb@ifnextchar_{\automath@two^{##1}}{\ensuremath{\sp{##1}}}}}
}
\def\automath@two#1#2#3#4{\ensuremath{#1{#2}\relax #3{#4}}}
% Restore default catcodes for ^, _
\def\noautomath{\catcode`\_=8 \catcode`\^=7 }

% The original \@ifnextchar discards spaces when looking for the next
% ``character''. This variant accepts any token.
\long\def\gb@ifnextchar#1#2#3{%
  \let\reserved@d=#1%
  \def\reserved@a{#2}%
  \def\reserved@b{#3}%
  \futurelet\@let@token\@gbifnch}
\def\@gbifnch{%
    \ifx\@let@token\reserved@d
      \let\reserved@c\reserved@a
    \else
      \let\reserved@c\reserved@b
    \fi
  \reserved@c}

\noautomath % On by default, for backward compatibility

%%%%%%%%%


\def\lb#1{\@ifnextchar [{\@glarph{#1}}{\@bl{#1}}}
\def\@glarph#1[#2]{\ifmmode{[}\sb{{\mathrm{#1}}\sb{#2}}\else%
                           ${[}\sb{{\mathrm{#1}}\sb{#2}}$\fi}
\def\@bl#1{\ifmmode{[}\sb{\mathrm{#1}}\;\else${[}\sb{\mathrm{#1}}\;$\fi}

\def\rb#1{\@ifnextchar [{\@grarph{#1}}{\@br{#1}}}
\def\@grarph#1[#2]{\ifmmode{]}\sb{{\mathrm{#1}}\sb{#2}}\else%
                        ${]}\sb{{\mathrm{#1}}\sb{#2}}$\fi}
\def\@br#1{\ifmmode{]}\sb{\mathrm{#1}}\;\else${]}\sb{\mathrm{#1}}\;$\fi}

%%% END_NEWSTUFF.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Macros for examples, roughly following Linguistic Inquiry style.   %
%  From here on best not to tamper, else all the examples and cross-  %
%  references will come out scrambled! (see also note below) - CT     %
%  Completely rewritten for more robustness and flexibility. (hpk)    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\qlist{\begin{list}{\Alph{xnum}.}{\usecounter{xnum}%
\setlength{\rightmargin}{\leftmargin}}}
\def\endqlist{\end{list}}

\newif\if@noftnote\@noftnotetrue
\newif\if@xrec\@xrecfalse
\@definecounter{fnx}

%%%%% Get examples in footnotes right
% Replaces code in original gb4e.sty: changed 2009/12/28 by Alexis
% Same function as before, but the old version interacted poorly with
% other packages that redefine \@footnotetext.

\let\@gbsaved@footnotetext=\@footnotetext
\long\def\@footnotetext#1{%
    \@noftnotefalse\setcounter{fnx}{0}%
    \@gbsaved@footnotetext{#1}%
    \@noftnotetrue}

\newcount\@xnumdepth \@xnumdepth = 0

\@definecounter{xnumi}
\@definecounter{xnumii}
\@definecounter{xnumiii}
\@definecounter{xnumiv}
\@definecounter{exx}
\setcounter{exx}{0}
\def\thexnumi{\@xsi{xnumi}}
\def\thexnumii{\@xsii{xnumii}}
\def\thexnumiii{\@xsiii{xnumiii}}
\def\thexnumiv{\@xsiv{xnumiv}}
\def\p@xnumii{\thexnumi}
\def\p@xnumiii{\thexnumi\thexnumii-}
\def\p@xnumiv{\thexnumi\thexnumii-\thexnumiii-}

\def\xs@default#1{\csname @@xs#1\endcsname}
\def\@@xsi{\let\@xsi\arabic}
\def\@@xsii{\let\@xsii\alph}
\def\@@xsiii{\let\@xsiii\roman}
\def\@@xsiv{\let\@xsi\arabic}

\@definecounter{rxnumi}
\@definecounter{rxnumii}
\@definecounter{rxnumiii}
\@definecounter{rxnumiv}

\def\save@counters{%
\setcounter{rxnumi}{\value{xnumi}}%
\setcounter{rxnumii}{\value{xnumii}}%
\setcounter{rxnumiii}{\value{xnumiii}}%
\setcounter{rxnumiv}{\value{xnumiv}}}%


\def\reset@counters{%
\setcounter{xnumi}{\value{rxnumi}}%
\setcounter{xnumii}{\value{rxnumii}}%
\setcounter{xnumiii}{\value{rxnumiii}}%
\setcounter{xnumiv}{\value{rxnumiv}}}%


\def\exewidth#1{\def\@exwidth{#1}} \exewidth{(234)}
\def\exe{\@ifnextchar [{\@exe}{\@exe[\@exwidth]}}

\def\@exe[#1]{\ifnum \@xnumdepth >0%
                 \if@xrec\@exrecwarn\fi%
                 \if@noftnote\@exrecwarn\fi%
                 \@xnumdepth0\@listdepth0\@xrectrue%
                 \save@counters%
              \fi%
                 \advance\@xnumdepth \@ne \@@xsi%
                 \begin{list}{(\thexnumi)}%
                             {\usecounter{xnumi}\@subex{#1}{1em}%
                              \if@noftnote%
                                 \setcounter{xnumi}{\value{exx}}%
                              \else%
                                 \setcounter{xnumi}{\value{fnx}}%
                              \fi}}

\def\endexe{\if@noftnote\setcounter{exx}{\value{xnumi}}%
                   \else\setcounter{fnx}{\value{xnumi}}%
                        \reset@counters\@xrecfalse\fi\end{list}}

\def\@exrecwarn{\typeout{*** Recursion on "exe"---your
                example numbering will probably be screwed up!}}

\def\xlist{\@ifnextchar [{\@xlist{}}{\@xlist{}[iv.]}}
\def\xlista{\@ifnextchar [{\@xlist{\alph}}{\@xlist{\alph}[m.]}}
\def\xlisti{\@ifnextchar [{\@xlist{\roman}}{\@xlist{\roman}[iv.]}}
\def\xlistn{\@ifnextchar [{\@xlist{\arabic}}{\@xlist{\arabic}[9.]}}
\def\xlistA{\@ifnextchar [{\@xlist{\Alph}}{\@xlist{\Alph}[M.]}}
\def\xlistI{\@ifnextchar [{\@xlist{\Roman}}{\@xlist{\Roman}[IV.]}}

\def\endxlist{\end{list}}
\def\endxlista{\end{list}}
\def\endxlistn{\end{list}}
\def\endxlistA{\end{list}}
\def\endxlistI{\end{list}}
\def\endxlisti{\end{list}}


%%% a generic sublist-styler
\def\@xlist#1[#2]{\ifnum \@xnumdepth >3 \@toodeep\else%
    \advance\@xnumdepth \@ne%
    \edef\@xnumctr{xnum\romannumeral\the\@xnumdepth}%
    \def\@bla{#1}
    \ifx\@bla\empty\xs@default{\romannumeral\the\@xnumdepth}\else%
      \expandafter\let\csname @xs\romannumeral\the\@xnumdepth\endcsname#1\fi
    \begin{list}{\csname the\@xnumctr\endcsname.}%
                {\usecounter{\@xnumctr}\@subex{#2}{1.5ex}}\fi}

\def\@subex#1#2{\settowidth{\labelwidth}{#1}\itemindent\z@\labelsep#2%
         \ifnum\the\@xnumdepth=1%
           \topsep 7\p@ plus2\p@ minus3\p@\itemsep3\p@ plus2\p@\else%
           \topsep1.5\p@ plus\p@\itemsep1.5\p@ plus\p@\fi%
         \parsep\p@ plus.5\p@ minus.5\p@%
         \leftmargin\labelwidth\advance\leftmargin#2\relax}

%%% the example-items
\def\ex{\@ifnextchar [{\@ex}{\item}}
\def\@ex[#1]#2{\item\@exj[#1]{#2}}
\def\@exj[#1]#2{\@exjbg{#1} #2 \end{list}}
\def\exi#1{\item[#1]\@ifnextchar [{\@exj}{}}
\def\judgewidth#1{\def\@jwidth{#1}}
\judgewidth{??}
\def\@exjbg#1{\begin{list}{#1}{\@subex{\@jwidth}{.5ex}}\item}
\def\exr#1{\exi{{(\ref{#1})}}}
\def\exp#1{\exi{{(\ref{#1}$'$)}}}
\def\sn{\exi{}}
\def\bu{\item[$\bullet$]}

%%% Lazy abbrevs (HANDLE WITH CARE!)
\def\ea{\ifnum\@xnumdepth=0\begin{exe}[(234)]\else\begin{xlist}[iv.]\fi\ex}
\def\z{\ifnum\@xnumdepth=1\end{exe}\else\end{xlist}\fi}


%%%%%%% \lcomment for breaks in (example-)lists (leaves all counters
%%%%%%% as they are)    (hpk) 
\newlength{\lcommentsep}
\lcommentsep = 1ex

\long\def\lcomment#1%
   {\vspace{\lcommentsep}
    \item[]\hspace*{-\leftmargin}%
    \@tempskipa=\linewidth%
    \addtolength{\@tempskipa}{\rightmargin}%
    \addtolength{\@tempskipa}{\leftmargin}%
    \parbox{\@tempskipa}{#1}%
    \vspace{\lcommentsep}%
   }

%%%%%% control the alignment of exampleno. and (picture-)example
%%%%%%         (by Lex Holt <[email protected]>).
\def\attop#1{\leavevmode\vtop{\strut\vskip-\baselineskip\vbox{#1}}}
\def\atcenter#1{$\vcenter{#1}$}
%%%%%%

%-------------------Move Arrows (from J.Frampton):

\def\leaderfill{\leaders\hrule\hfil}
\def\pointerup{\hbox to 0pt{\hss
  \vbox{\offinterlineskip\vskip-1pt\hbox{\elevenex\char'170}\null}\hss}}
\def\pointerdown{\hbox to 0pt{\hss
  \vtop{\offinterlineskip\null\hbox{\elevenex\char'171}\vskip-1pt}\hss}}

\let\pu=\pointerup
\let\pd=\pointerdown
\let\lf=\leaderfill

\def\spacer{\hskip4.5pt}
\def\fillright#1{\hfil#1\leaderfill}
\def\fillleft#1{\leaderfill#1\hfil}
% Changed spelling to \centr, else conflicts with LaTeX \center{} -CT
\def\centr#1{\leaderfill#1\leaderfill}
\def\link#1{\multispan#1\leaderfill}

\def\arrowalign#1{\vtop{\baselineskip=0pt \lineskiplimit=0pt \lineskip=2pt
  \halign{&##\cr#1}}}

\font\elevenex=cmex10 scaled\magstephalf  % just for the arrow!
      %PS: this may not work on some installations, not sure why. CT
      %%PPS: (e.g., PCTeX, but it works find works fine with EmTeX)
%----------------END Move Arrows

\def\pijl{$\rightarrow$\ }

% Special accents for Vata & Gbadi; Navajo coming soon, I hope...:
%\def\bb#1{$\mathrm{\overline{#1}}$} Following looks better:
\def\bb#1{\ifmmode\overline{\mathrm{#1}}\else$\bar{\mathrm{#1}}$\fi}

\def\boven#1#2{\raisebox{-0.2pt}{$\stackrel{#1}{\mathrm{#2}}$}}
\def\bovenop#1#2{\raisebox{-0.06ex}[0ex][0ex]{$\stackrel{#1}{\mathrm{#2}}$}}
\def\vl{\rule{0.05em}{0.30em}}
\def\|#1{\ifmmode\vert#1\else\bovenop{\vl}{#1}\fi}
main.tex — the file that is compiled · 3 KB
\documentclass[12pt,letterpaper]{article}
\usepackage[lmargin=1.2in,rmargin=1.2in,tmargin=1in,bmargin=1in]{geometry}
\usepackage[bf,tiny]{titlesec}
	 \usepackage{fontspec,xltxtra,xunicode}
    	\defaultfontfeatures{Mapping=tex-text}
\usepackage[utf8]{inputenc}
%\usepackage[utf8]{fontenc}
\setmainfont{Junicode}

\usepackage{setspace}
\usepackage{gb4e}
\let\eachwordone=\it %italicise the first line of examples
\usepackage[sort]{natbib}
\bibpunct[: ]{(}{)}{,}{a}{}{,}
\usepackage{afterpage}
\usepackage{graphicx}


%%% your packages here; please use sparingly and for things you actually need (not for aesthetics)

\title{Your paper}
\author{Claire Bowern \\ Executive Editor, \textit{Diachronica}}
%\date{\today}

\begin{document}

\maketitle

\begin{abstract}
    Here's an abstract of about 150 words
\end{abstract}

\noindent\textbf{Keywords:} templates, fonts, examples, bibliography

\section{Introduction}
We've provided this template for \LaTeX{} users to submit articles to \textit{Diachronica}. Note that it's very minimal. That's deliberate! It is far easier for the typesetters to typeset your article if there is minimal styling.\footnote{Here's an example of a footnote. Note that we do acknowledgements at the end of the paper, not as footnotes to the title or the first section.} There are a number of points about this template which do not conform to the final style for published articles. However, this template is optimized to make the preparation of the submitted manuscript as straightforward as possible.

Here's an example of a sentence with glossed text.

\begin{exe}
\ex Bardi \hfill\citep[123]{bow12}
\gll Ardiyooloon Bardi ngaanka\\
One.Arm.Point Bardi language\\
\glt `One Arm Point Bardi'
\end{exe}

Note that the translation has single quotes. However, a quotation from an individual ``should have double quotes,'' (me, pers. comm. 2021).

Here's an example of a table:
\begin{table}[ht]
    \centering
    \caption{Caption} %note table captions go above the table
    \label{tab:my_label}    \begin{tabular}{cc}
      one   & a \\ \hline
    two     & b
    \end{tabular}
\end{table}

And here's an example of a figure:

\begin{figure}[ht]
    \centering
 %   \includegraphics{}
    \caption{Caption} %note figure captions go below the figure
    \label{fig:my_label}
\end{figure}

\section{Other notes}
This template should use XeLaTeX and unicode: here's ŋ, an engma. Here's [daɪəkʰɹʌnɪkʰə]. Feel free to change the font if you don't like junicode.

\section{Conclusion}
In conclusion, we use the \texttt{unified} stylesheet for linguistics. For further details, please consult the style guide, available from the journal's homepage at \texttt{https://benjamins.com/catalog/dia}.

\section*{Funding information}
Grant or other funding acknowledgements should go here.

\section*{Acknowledgements}
Thanks to Juhyae Kim for comments on this template.

\section*{Abbreviations}
A list of abbreviations used in the text should appear here.


\bibliographystyle{unified}
\bibliography{bibliography}


\bigskip

\appendix
\section{Information about appendices}
If you have any Appendices, this is where they would appear.

\section*{Résumé}

French summary goes here



\section*{Zusammenfassung}

German summary goes here

\bigskip

\section*{Author's address}
\medskip

\noindent\begin{minipage}{\linewidth}
Claire Bowern\\
Department of Linguistics\\
Yale University\\
370 Temple St\\
\textsc{New Haven}, CT\\[3ex]
\texttt{[email protected]}
\end{minipage}

\end{document}
unified.bst · 29 KB
%%% This is unified.bst, made by Bridget Samuels. It is based on sp.bst (v1.9+)
%%% coded by Kai von Fintel as the house style for bibliographies in the journal
%%% Semantics and Pragmatics. The style is based on a style generated 
%%% with custom-bib/merlin.mbs, a system for customizing bibliographic styles
%%% created by Patrick W Daly. There have been some hand-coded adjustments to that
%%% style to get the style closer to the Unified Style Sheet for Linguistics Journals.
%%%
%%% Please note that unified.bst does not supply periods after abbreviated authors' names
%%% (which are anyway discouraged by the Unified Style Sheet for Linguistics Journals). Also,
%%% article titles are changed to lower case. In order to protect capitals, it is necessary to
%%% enclose the relevant material in curly brackets.
%%%
%%% Version 1.2 [6 Mar 2010] Improved handling of multiple non-numerical year items by the same author. Should now output, e.g., "To appear(a)"
%%% Version 1.1 [2 Feb 2010] Added comma before vol.
%%% Version 1.0 [22 Aug 2009] Changes from sp.bst include conforming to the Unified
%%% Style Sheet format for PhD & MA theses and citing URLs for online materials (use 
%%% misc or unpublished as the category).
%%

ENTRY
  { address
    author
    booktitle
    chapter
    doi
    edition
    editor
    eid
    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$
}
FUNCTION {add.blank}
{  " " * before.all 'output.state :=
}

FUNCTION {add.colon}
{  ": " * before.all 'output.state :=
}

FUNCTION {add.comma}
{  ", " * before.all 'output.state :=
}


FUNCTION {date.block}
{
  new.block
}

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$ * " " * }

FUNCTION {bbl.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}
{ "MA thesis" }

FUNCTION {bbl.phdthesis}
{ "dissertation" }

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$
}

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

INTEGERS { nameptr namesleft numnames }


STRINGS  { bibinfo}

FUNCTION {format.names}
{ 'bibinfo :=
  duplicate$ empty$ 'skip$ {
  's :=
  "" 't :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      duplicate$ #1 >
        { "{ff~}{vv~}{ll}{, jj}" }
        { "{vv~}{ll}{, ff}{, jj}" }
      if$
      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 *
                }
                {
                  bbl.and
                  space.word * t *
                }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
  } if$
}
FUNCTION {format.names.ed}
{
  'bibinfo :=
  duplicate$ empty$ 'skip$ {
  's :=
  "" 't :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      "{ff~}{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 *
                }
                {
                  bbl.and
                  space.word * t *
                }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
  } if$
}
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
   "(" swap$ * ")" *
      *
    }
  if$
}
FUNCTION {format.doi}
{ doi "doi" bibinfo.check
  duplicate$ empty$ 'skip$
    {
      new.block
      "\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
  duplicate$ empty$ 'skip$
    { "t" change.case$ }
  if$
  "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 *
                }
                {
                  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 "year" bibinfo.check duplicate$ empty$
    {
      "empty year in " cite$ * "; set to ????" * warning$
       pop$ "????"
    }
    'skip$
  if$
  extra.label *
  before.all 'output.state :=
  after.sentence 'output.state :=
}
FUNCTION {format.btitle}
{ title "title" bibinfo.check
  duplicate$ empty$ 'skip$
    {
      "t" change.case$
      emphasize
    }
  if$
}
FUNCTION {either.or.check}
{ empty$
    'pop$
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  if$
}
FUNCTION {format.bvolume}
{ volume empty$
    { "" }
    { add.comma bbl.volume volume tie.or.space.prefix
      "volume" bibinfo.check * *
    }
  if$
}
FUNCTION {format.number.series}
    { number empty$
        { series field.or.null }
        { series empty$
            { number "number" bibinfo.check }
            { add.blank "(" *
              series "series" bibinfo.check *
              number tie.or.space.prefix "number" bibinfo.check * 
              ")" *
            }
          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}
{ 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 duplicate$ empty$ 'skip$
    {
      convert.edition
      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 }
        {
          ". " *
          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$ *
  eid empty$
    { format.journal.pages }
    { format.journal.eid }
  if$
}

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

FUNCTION {format.booktitle}
{
  booktitle "booktitle" bibinfo.check
  "t" change.case$
  emphasize
}
FUNCTION {format.in.ed.booktitle}
{ format.booktitle duplicate$ empty$ 'skip$
    {
      editor "editor" format.names.ed duplicate$ empty$ 'pop$
        {
          " " *
          get.bbl.editor
          "(" 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
      capitalize
      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$
    {
      address "address" bibinfo.check *
      t empty$
        'skip$
        { address empty$
            'skip$
            { ": " * }
          if$
          t *
        }
      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.date "year" output.check
  date.block
  format.title "title" output.check
  new.block
  crossref missing$
    {
      journal
      "journal" bibinfo.check
      emphasize
      "journal" output.check
      add.blank
      format.vol.num.pages output
    }
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
  format.doi output
  new.block
  format.url output
  new.block
  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.date "year" output.check
  date.block
  format.btitle "title" output.check
  crossref missing$
    { format.bvolume output
      format.number.series output
      new.block
      new.sentence
      format.publisher.address output
    }
    {
      new.block
      format.book.crossref output.nonnull
    }
  if$
  format.edition output
  format.doi output
  new.block
  format.url output
  new.block
  format.note output
  fin.entry
}
FUNCTION {booklet}
{ output.bibitem
  format.authors output
  author format.key output
  format.date "year" output.check
  date.block
  format.title "title" output.check
  new.block
  howpublished "howpublished" bibinfo.check output
  address "address" bibinfo.check output
  format.doi output
  new.block
  format.url output
  new.block
  format.note output
  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.date "year" output.check
  date.block
  format.btitle "title" output.check
  crossref missing$
    {
      format.bvolume output
      format.chapter.pages "chapter and pages" output.check
      new.block
      new.sentence
      format.number.series output
      format.publisher.address output
    }
    {
      format.chapter.pages "chapter and pages" output.check
      new.block
      format.book.crossref output.nonnull
    }
  if$
  format.edition output
  format.doi output
  new.block
  format.url output
  new.block
  format.note output
  fin.entry
}

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.block
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.bvolume output
      format.number.series output
      add.comma
      format.chapter.pages output
      new.sentence
      format.publisher.address output
      format.edition output
    }
    { format.incoll.inproc.crossref output.nonnull
      format.chapter.pages output
    }
  if$
  format.doi output
  new.block
  format.url output
  new.block
  format.note output
  fin.entry
}
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.block
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.bvolume output
      format.number.series output
      add.comma
      format.pages output
      new.sentence
      publisher empty$
        { format.organization.address output }
        { organization "organization" bibinfo.check output
          format.publisher.address output
        }
      if$
    }
    { format.incoll.inproc.crossref output.nonnull
      format.pages output
    }
  if$
  format.doi output
  new.block
  format.url output
  new.block
  format.note output
  fin.entry
}
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
  organization address new.block.checkb
  organization "organization" bibinfo.check output
  address "address" bibinfo.check output
  format.edition output
  format.doi output
  new.block
  format.url output
  new.block
  format.note output
  fin.entry
}

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

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

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

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.block
  format.tr.number output.nonnull
  institution "institution" bibinfo.warn output
  address "address" bibinfo.check output
  format.doi output
  new.block
  format.url output
  new.block
  format.note output
  fin.entry
}

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.doi output
  new.block
  format.note "note" output.check
  new.block
  format.url 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$
  short.list key field.or.null = or
     { pop$ "" }
     'skip$
  if$
  *
  'label :=
}

FUNCTION {sort.format.names}
{ 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      "{ll{ }}{  ff{ }}{  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$
  { year field.or.null #-1 #1 substring$ chr.to.int$ #65 <
     { "{\natexlab{" swap$ * "}}" * }
     { "{(\natexlab{" swap$ * "})}" * }
   if$ }
  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]{#1}"
  write$ newline$
  "\providecommand{\urlprefix}{}"
  write$ newline$
  "\expandafter\ifx\csname urlstyle\endcsname\relax"
  write$ newline$
  "  \providecommand{\doi}[1]{doi:\discretionary{}{}{}#1}\else"
  write$ newline$
  "  \providecommand{\doi}{doi:\discretionary{}{}{}\begingroup \urlstyle{rm}\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}

The first page, as this template compiles today. Click it to enlarge, and again to shrink. Open the file ↗