← All templates

Wiley journals (USG)

Wiley's own LaTeX authoring template for its journals (USG.cls, the 2026 PDF design): two-column article with title block, ORCID links, abstract, figures, tables, algorithms, appendices and a Chicago-style reference list.

Create an account to use this
Category
Journal
Document class
USG (USG.cls) — ships with TeX Live
Workflow
Journal manuscript — submissions and revision rounds
Author
Wiley
Source
Wiley
Licence
No licence is stated in the files. Wiley distributes them for authors preparing a submission.

These are the publisher’s own files. This project starts from Wiley’s package for this publication — their manuscript, their USG.cls, their bibliography style — so what compiles here is what they would have given you.

Wiley serves this exact file to Bulletin of Economic Research and 12 other titles. Check Wiley’s author pages for the current instructions.

Where this differs from the publisher’s download.

  • Note: Wiley's package carries the bibliography style for its CHICAGO and ASNA options (the sample uses ASNA); the class's other reference-style options (APA, Harvard, Vancouver, AMA…) name style files Wiley does not include, so keep CHICAGO or ASNA. Many Wiley journals take LaTeX in free format and restyle references at typesetting; your journal's instructions for authors say which.

What you get

  • Optimal-Design-layout/LETTERSP.STY · 12 KB
  • Optimal-Design-layout/NJDapacite.sty · 70 KB
  • Optimal-Design-layout/NJDnatbib.sty · 45 KB
  • Optimal-Design-layout/Optimal-Design-layout.tex — the file that is compiled · 63 KB
  • Optimal-Design-layout/USG.cls · 93 KB
  • Optimal-Design-layout/algorithm.sty · 3 KB
  • Optimal-Design-layout/algorithmicx.sty · 26 KB
  • Optimal-Design-layout/amssymb.sty · 14 KB
  • Optimal-Design-layout/appendix.sty · 3 KB
  • Optimal-Design-layout/empty-eps-converted-to.pdf · 2 KB
  • Optimal-Design-layout/empty.eps · 3 KB
  • Optimal-Design-layout/images/Facebook_Logo-eps-converted-to.pdf · 10 KB
  • Optimal-Design-layout/images/Facebook_Logo.eps · 272 KB
  • Optimal-Design-layout/images/LinkedIn_Logo-eps-converted-to.pdf · 14 KB
  • Optimal-Design-layout/images/LinkedIn_Logo.eps · 281 KB
  • Optimal-Design-layout/images/ORCID_Logo-eps-converted-to.pdf · 11 KB
  • Optimal-Design-layout/images/ORCID_Logo.eps · 388 KB
  • Optimal-Design-layout/images/Twitter_Logo-eps-converted-to.pdf · 11 KB
  • Optimal-Design-layout/images/Twitter_Logo.eps · 360 KB
  • Optimal-Design-layout/images/Wiley_logo-eps-converted-to.pdf · 10 KB
  • Optimal-Design-layout/images/Wiley_logo.eps · 404 KB
  • Optimal-Design-layout/images/allergy-eps-converted-to.pdf · 32 KB
  • Optimal-Design-layout/images/allergy.eps · 1439 KB
  • Optimal-Design-layout/images/openaccess-eps-converted-to.pdf · 14 KB
  • Optimal-Design-layout/images/openaccess.eps · 1202 KB
  • Optimal-Design-layout/mla.sty · 11 KB
  • Optimal-Design-layout/natbib.sty · 44 KB
  • Optimal-Design-layout/wileyNJD-Chicago-lastoo.bst · 26 KB
  • Optimal-Design-layout/wileyNJD-Chicago.bib · 10 KB
  • Optimal-Design-layout/wileyNJD-Chicago.bst · 39 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

All 13 journals →

Source

Optimal-Design-layout/LETTERSP.STY · 12 KB
% Self-documenting file

\ifx  \Comment \Undefined
      \long \def \Comment #1\EndComment {}
\else
      \ifx  \EndComment \Undefined
            \def \EndComment
                {\message {Error: \noexpand \EndComment encountered
                                without preceding \noexpand \Comment}}
      \else %%% both defined; let's hope they're the right definitions!
      \fi
\fi

\Comment
This file, "letterspacing.tex", created by Philip Taylor of RHBNC
([email protected]) for Kaveh Bazargan of Focal Image
([email protected]) may be freely distributed provided that
no changes whatsoever are made to its contents
\EndComment

\Comment
As far as is possible, `inaccessible' control sequences (i.e.~control sequences
containing one or more commercial-at$\,$s) are used to minimise the risk of
accidental collision with user-defined macros; however, the control sequences
used to access the natural dimensions of the text are required to be user
accessible, and therefore must contain only letters.
\EndComment

%%% Open control sequences

\newdimen \naturalwidth
\newdimen \naturaldepth
\newdimen \naturalheight

\Comment
All control sequences defined hereafter are inaccessible to the casual user,
including the control sequence used to store the category code of commercial-at;
this catcode must be saved in order to be able to re-instate it at end of
module, as we have no idea in what context the module will be |\input|. Having
saved the catcode of commercial-at, we then change it to |11| (i.e.~that of a
letter) in order to allow it to be used in the cs-names which follow.
\EndComment

%%% Concealed control sequences

%\expandafter \chardef
%        \csname \string @code\endcsname =
%                \the \catcode `\@
%\catcode `\@ = 11

\Comment
We will need a a box register in order to measure the natural dimensions of
the text, and a token-list register in which to save the tokens to be
letter-spaced.
\EndComment

\newbox \l@tterspacebox
\newtoks \l@tterspacetoks

\Comment
We will need to test whether a particular macro expands to a space, so we will
need another macro which does so expand with which to compare it; we will
also need a `more infinite' variant of |\hss|.
\EndComment

\def \sp@ce { }
\def \hsss
    {\hskip 0 pt plus 1 fill minus 1 fill\relax}

\Comment
Many of the macros will used delimited parameter structures, typically
terminated by the reserved control sequence |\@nd|; we make this a synonym
for the empty macro (which expands to nothing), so that should it accidentally
get expanded there will be no side effects.  We also define a brief synonym
for |\expandafter|, just to keep the individual lines of code reasonably short.
\EndComment

\let \@nd = \empty
\let \@x = \expandafter

\Comment
We will also need to compare a token which has been peeked at by |\futurelet|
with a space token; because of the difficulty of accessing such a space
token (which would usually be absorbed by a preceding control word), we
establish |\sp@cetoken| as a synonym.  The code to achieve this is messy,
because of the very difficulty just outlined, and so we `waste' a control
sequence |\t@mp|; we then return this to the pool of undefined tokens.
\EndComment

\let \sp@cetoken = \relax
\edef \t@mp {\let \sp@cetoken = \sp@ce}
\t@mp \let \t@mp = \undefined

\Comment
The user-level macro |\letterspace| has exactly the same syntax as that for
|\hbox| and |\vbox|, as explained in the introduction; the delimited parameter
structure for this macro ensures that everything up to the open brace which
delimits the beginning of the text to be letter-spaced is absorbed as parameter
to the macro, and the brace-delimited text which follows is then assigned to the
token-list register |\l@tterspacetoks|; |\afterassignment| is used to regain
control once the assignment is complete.
\EndComment

%%% Primary (user-level) macro

\def \letterspace #1#%
    {\def \hb@xmodifier {#1}%
     \afterassignment \l@tterspace
     \l@tterspacetoks =
    }

\Comment
Control then passes to |\l@tterspace|, which starts by setting an |\hbox|
containing the text to be typeset; the dimensions of this box (and therefore
of the text) are then saved in the open control sequences previously declared,
and the |\hbox| becomes of no further interest.

A new |\hbox| is now created, in which the same text, but this time
letter-spaced, will be set; the box starts and ends with |\hss| glue so that if
only a single character is to be letter-spaced, it will be centered in the box.
If two or more characters are to be letter-spaced, they will be separated by
|\hsss| glue, previously declared, which by virtue of its greater degree of
infinity will completely override the |\hss| glue at the beginning and end;
thus the first and last characters will be set flush with the edges of the box.

The actual mechanism by which letter-spacing takes place is not yet apparent,
but it will be seen that it is crucially dependent on the definition of
|\l@tt@rspace|, which is expanded as the box is being set; the |\@x|
(|\expandafter|) causes the actual tokens stored in |\l@tterspacetoks| to be
made available as parameter to |\l@tt@rspace| rather than the token-list
register itself, as it is these tokens on which |\l@tt@rspace| will operate.
The |\@nd| terminates the parameter list, and the |{}| which immediately
precedes it ensures that that there is always a null element at the end of the
list: without this, the braces which are needed to protect an accent/character
pair would be lost if such a pair formed the final element of the list, at the
point where they are passed as the second (delimited) parameter to |\p@rtiti@n|;
by definition, <TeX> removes the outermost pair of braces from both simple and
delimited parameters during parameter substitution if such braces form the first
and last tokens of the parameter, and thus if a brace-delimited group ever
becomes the second element of a two-element list, the braces will be irrevocably
lost.  The |{}| ensure that such a situation can never occur.
\EndComment

%%% Secondary (implementation-level) macro

\def \l@tterspace
    {\setbox \l@tterspacebox = \hbox
                {\the \l@tterspacetoks}%
     \naturalwidth =  \wd \l@tterspacebox
     \naturaldepth =  \dp \l@tterspacebox
     \naturalheight = \ht \l@tterspacebox
     \hbox \hb@xmodifier
     \bgroup
           \hss
           \@x \l@tt@rspace
           \the \l@tterspacetoks {}\@nd
           \hss
     \egroup
    }

\Comment
The next macro is |\l@tt@rspace|, which forms the crux of the entire operation.
The text to be letter-spaced is passed as parameter to this macro, and the
first step is to check whether there is, in fact, any such text; this is
necessary both to cope with pathological usage (e.g.~|\letterspace {}|), and to
provide an exit route, as the macro uses tail-recursion to apply itself
iteratively to the `tail' of the text to be letter-spaced; when no elements
remain, the macro must exit.

Once the presence of text has been ensured, the token-list representing
this text is partitioned into a head (the first element), and the tail
(the remainder);  at each iteration, only the head is considered, although
if the tail is empty (i.e.~the end of the list has been reached), special
action is taken.

If the first element is a space, it is treated specially by surrounding it
with two globs of |\hsss| glue, to provide extra stretchability when compared
to the single glob of |\hsss| glue which will separate consecutive non-space
tokens; otherwise, the element itself is yielded, followed by a single glob
of |\hsss| glue.  This glue is suppressed if the element is the last of the
list, to ensure that the last token aligns with the edge of the box.

When the first element has been dealt with, the macro uses tail
recursion to apply itself to the remaining elements (i.e.~to the tail);
|\@x| (|\expandafter|) is again used to ensure that the tail is expanded
into its component tokens before being passed as parameter.
\EndComment

%%% Tertiary (implementation-level) macro

\def \l@tt@rspace #1\@nd
    {\ifx  \@nd #1\@nd
           \let \n@xt = \relax
     \else
           \p@rtition #1\@nd
           \ifx \h@ad \sp@ce \hsss \h@ad \hsss
           \else
                \h@ad
                \ifx \t@il \@nd \else \hsss \fi
           \fi
           \@x \def \@x \n@xt \@x
                {\@x \l@tt@rspace \t@il \@nd}%
     \fi
     \n@xt
    }

\Comment
The operation of token-list partitioning is conceptually simple: one passes the
token list as parameter text to a macro defined to take two parameters, the
first simple and the second delimited; the first element of the list will be
split off as parameter-1, and the remaining material passed as parameter-2.
Unfortunately this na\"\i ve approach fails when the first element is a bare
space, as the semantics of <TeX> prevent such a space from ever being passed as
a simple parameter (it could be passed as a delimited parameter, but as one
does not know what token follows the space, defining an appropriate delimiter
structure would be tricky if not impossible).  The technique used here relies
upon the adjunct macro |\m@kespacexplicit|, which replaces a leading bare space
by a space protected by braces; such spaces may legitimately be passed as simple
parameters.  Once that operation has been completed, the re-constructed token
list is passed to |\p@rtiti@n|, which actually performs the partitioning as
above; again |\@x| (|\expandafter|) is used to expand |\b@dy| (the
re-constructed token list) into its component elements before being passed as
parameter text.
\EndComment

%%% Adjunct macros -- list partitioning

\def \p@rtition #1\@nd
    {\m@kespacexplicit #1\@nd
     \@x \p@rtiti@n \b@dy \@nd
    }

\def \p@rtiti@n #1#2\@nd
    {\def \h@ad {#1}%
     \def \t@il {#2}%
    }

\Comment
The operation of making a space explicit relies on prescience: the code needs
to know what token starts the token list before it knows how to proceed.
Prescience in <TeX> is usually accomplished by |\futurelet|, and this code
is no exception: |\futurelet| here causes |\h@ad| to be |\let| equal to
the leading token, and control is then ceded to |\m@kesp@cexplicit|.

The latter compares |\h@ad| with |\sp@cetoken| (remember the convolutions we
had to go through to get |\sp@cetoken| correctly defined in the first place),
and if they match (i.e.~if the leading token is a space), then |\b@dy|
(the control sequence through which the results of this operation will
be returned) is defined to expand to a protected space (a space surrounded by
braces), followed by the remainder of the elements; if they do not match
(i.e.~if the leading token is \stress {not} a space), then |\b@dy| is simply
defined to be the original token list, unmodified.  If the leading token
\stress {was} a space, it must be replaced by a protected space: this is
accomplished by |\pr@tectspace|.

The |\pr@tectspace| macro uses a delimited parameter structure, as do most
of the other macros in this suite, but the structure used here is unique,
in that the initial delimiter is a space.  Thus, when a token-list starting
with a space is passed as parameter text, that space is regarded as matching
the space in the delimiter structure and removed; the expansion of the macro
is therefore the tokens remaining once the leading space has been removed,
preceded by a protected space |{ }|.
\EndComment

%%% Adjunct macros -- <space>... -> {<space>}...

\def \m@kespacexplicit #1\@nd
    {\futurelet \h@ad \m@kesp@cexplicit #1\@nd}

\def \m@kesp@cexplicit #1\@nd
    {\ifx \h@ad \sp@cetoken
          \@x \def \@x \b@dy
                     \@x {\pr@tectspace #1\@nd}%
     \else
          \def \b@dy {#1}%
     \fi
    }%

\@x \def \@x \pr@tectspace \sp@ce #1\@nd {{ }#1}

\Comment
The final step is to re-instate the category code of commercial-at.
\EndComment

%%% re-instate category code of commercial-at

%\catcode `\@ = \the \@code

\Comment
Thus letter-spacing is accomplished.  The author hopes both that the code will
be found useful and that the explanation which accompanies it will be found
informative and interesting.
\EndComment
Optimal-Design-layout/NJDapacite.sty · 70 KB

70 KB — too long to show here. It arrives with the project.

Optimal-Design-layout/NJDnatbib.sty · 45 KB

45 KB — too long to show here. It arrives with the project.

Optimal-Design-layout/Optimal-Design-layout.tex — the file that is compiled · 63 KB

63 KB — too long to show here. It arrives with the project.

Optimal-Design-layout/USG.cls · 93 KB

93 KB — too long to show here. It arrives with the project.

Optimal-Design-layout/algorithm.sty · 3 KB
%%
%% This is file `algorithm.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% algorithms.dtx  (with options: `algorithm')
%% This is a generated file.
%% 
%% Copyright (C) 1994-2004   Peter Williams <[email protected]>
%% Copyright (C) 2005-2009   Rogério Brito <[email protected]>
%% 
%% This document file is free software; you can redistribute it and/or
%% modify it under the terms of the GNU Lesser General Public License as
%% published by the Free Software Foundation; either version 2 of the
%% License, or (at your option) any later version.
%% 
%% This document file is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
%% General Public License for more details.
%% 
%% You should have received a copy of the GNU Lesser General Public License
%% along with this document file; if not, write to the Free Software
%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
%% USA.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{algorithm}
   [2009/08/24 v0.1 Document Style `algorithm' - floating environment]
\RequirePackage{float}
\RequirePackage{ifthen}
\newcommand{\ALG@within}{nothing}
\newboolean{ALG@within}
\setboolean{ALG@within}{false}
\newcommand{\ALG@floatstyle}{ruled}
\newcommand{\ALG@name}{Algorithm}
\newcommand{\listalgorithmname}{List of \ALG@name s}
% Declare Options:
% * first: appearance
\DeclareOption{plain}{
  \renewcommand{\ALG@floatstyle}{plain}
}
\DeclareOption{ruled}{
  \renewcommand{\ALG@floatstyle}{ruled}
}
\DeclareOption{boxed}{
  \renewcommand{\ALG@floatstyle}{boxed}
}
% * then: numbering convention
\DeclareOption{part}{
  \renewcommand{\ALG@within}{part}
  \setboolean{ALG@within}{true}
}
\DeclareOption{chapter}{
  \renewcommand{\ALG@within}{chapter}
  \setboolean{ALG@within}{true}
}
\DeclareOption{section}{
  \renewcommand{\ALG@within}{section}
  \setboolean{ALG@within}{true}
}
\DeclareOption{subsection}{
  \renewcommand{\ALG@within}{subsection}
  \setboolean{ALG@within}{true}
}
\DeclareOption{subsubsection}{
  \renewcommand{\ALG@within}{subsubsection}
  \setboolean{ALG@within}{true}
}
\DeclareOption{nothing}{
  \renewcommand{\ALG@within}{nothing}
  \setboolean{ALG@within}{true}
}
\DeclareOption*{\edef\ALG@name{\CurrentOption}}
% ALGORITHM
%
\ProcessOptions
\floatstyle{\ALG@floatstyle}
\ifthenelse{\boolean{ALG@within}}{
  \ifthenelse{\equal{\ALG@within}{part}}
     {\newfloat{algorithm}{htbp}{loa}[part]}{}
  \ifthenelse{\equal{\ALG@within}{chapter}}
     {\newfloat{algorithm}{htbp}{loa}[chapter]}{}
  \ifthenelse{\equal{\ALG@within}{section}}
     {\newfloat{algorithm}{htbp}{loa}[section]}{}
  \ifthenelse{\equal{\ALG@within}{subsection}}
     {\newfloat{algorithm}{htbp}{loa}[subsection]}{}
  \ifthenelse{\equal{\ALG@within}{subsubsection}}
     {\newfloat{algorithm}{htbp}{loa}[subsubsection]}{}
  \ifthenelse{\equal{\ALG@within}{nothing}}
     {\newfloat{algorithm}{htbp}{loa}}{}
}{
  \newfloat{algorithm}{htbp}{loa}
}
\floatname{algorithm}{\ALG@name}
\newcommand{\listofalgorithms}{\listof{algorithm}{\listalgorithmname}}
\endinput
%%
%% End of file `algorithm.sty'.
Optimal-Design-layout/algorithmicx.sty · 26 KB
% ALGORITHMIC STYLE -- Released 27 APR 2005
%    for LaTeX version 2e
%
% Copyright Szasz Janos
% E-mail [email protected]
%
%
%      ***      INITIALISING      ***
%
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{algorithmicx}[2005/04/27 v1.2 Algorithmicx]
\RequirePackage{ifthen}
\typeout{Document Style algorithmicx 1.2 - a greatly improved `algorithmic' style}
%
\newcounter{ALG@line}
\newcounter{ALG@rem}
\newcounter{ALG@nested}
\newlength{\ALG@tlm}
\newlength{\ALG@thistlm}
\newcounter{ALG@Lnr}% the number of defined languages
\setcounter{ALG@Lnr}{0}
\newcounter{ALG@blocknr}% the number of defined blocks
\setcounter{ALG@blocknr}{0}
\newcounter{ALG@storecount}% number of stored but not restored algorithmic environments
\setcounter{ALG@storecount}{0}
\newcounter{ALG@tmpcounter}% only to decrement things
\newlength\ALG@tmplength%
%\def\algorithmicnoindent{-\ALG@tlm}
%       \def\algbackskipbegin{\hskip\ALG@ctlm}
%\def\algbackskip{\hskip-\ALG@thistlm}
%\def\algbackskipend{\hskip-\ALG@tlm}
\def\ALG@defaultindent{\algorithmicindent}
%
% conditional states
%
\def\ALG@newcondstate#1%
   {%
   \expandafter\edef\csname ALG@x@#1\endcsname%
      {\expandafter\noexpand\csname @@ALG@x@#1\endcsname}%
   }%
\ALG@newcondstate{notext}%
\ALG@newcondstate{default}%
%
%
%      ***      ALGORITHMIC      ***
%
%
\newcommand\ALG@beginblock[1]% #1 - indentation
   {%
      \ALG@thistlm\ALG@tlm%
      \addtolength\ALG@tlm{#1}%
      \addtocounter{ALG@nested}{1}%
      \setlength\ALG@tmplength{#1}%
      \expandafter\edef\csname ALG@ind@\theALG@nested\endcsname{\the\ALG@tmplength}%
   }%
\newcommand\ALG@endblock%
   {%
      \addtolength\ALG@tlm{-\csname ALG@ind@\theALG@nested\endcsname}%
      \addtocounter{ALG@nested}{-1}%
      \ALG@thistlm\ALG@tlm%
   }%
%
%   algorithmic environment
%
\def\ALG@step%
   {%
   \addtocounter{ALG@line}{1}%
   \addtocounter{ALG@rem}{1}%
   \ifthenelse{\equal{\arabic{ALG@rem}}{\ALG@numberfreq}}%
      {\setcounter{ALG@rem}{0}\alglinenumber{\arabic{ALG@line}}}%
      {}%
   }%
\newenvironment{algorithmic}[1][0]%
   {%
   \edef\ALG@numberfreq{#1}%
   \def\@currentlabel{\theALG@line}%
   %
   \setcounter{ALG@line}{0}%
   \setcounter{ALG@rem}{0}%
   %
   \let\\\algbreak%
   %
   \expandafter\edef\csname ALG@currentblock@\theALG@nested\endcsname{0}%
   \expandafter\let\csname ALG@currentlifetime@\theALG@nested\endcsname\relax%
   %
   \begin{list}%
      {\ALG@step}%
      {%
      \rightmargin\z@%
      \itemsep\z@ \itemindent\z@ \listparindent2em%
      \partopsep\z@ \parskip\z@ \parsep\z@%
      \labelsep 0.5em \topsep 0.2em%\skip 1.2em 
      \ifthenelse{\equal{#1}{0}}%
         {\labelwidth 0.5em}%
         {\labelwidth 1.2em}%
      \leftmargin\labelwidth \addtolength{\leftmargin}{\labelsep}% Ok. the perfect leftmargin :-))
      \ALG@tlm\z@%
      }%
   \setcounter{ALG@nested}{0}%
   \ALG@beginalgorithmic%
   }%
   {% end{algorithmic}
   % check if all blocks are closed
   \ALG@closeloops%
   \expandafter\ifnum\csname ALG@currentblock@\theALG@nested\endcsname=0\relax%
   \else%
      \PackageError{algorithmicx}{Some blocks are not closed!!!}{}%
   \fi%
   \ALG@endalgorithmic%
   \end{list}%
   }%
%
%
%   ***   Functional core   ***
%
%
\def\ALG@makeentity#1% execute the entity (#1)
   {%
   \def\ALG@thisentity{#1}%
   \expandafter\ifx\csname ALG@b@\ALG@L @#1@0\endcsname\relax%
      \let\ALG@makenobeginrepeat\ALG@makenobegin\ALG@makenobeginrepeat% this entitie ends or continues blocks
   \else%
      \let\ALG@makebeginrepeat\ALG@makebegin\ALG@makebeginrepeat% this entitie can open blocks
   \fi%
   \ALG@entitiecommand%
   }%
%
\def\ALG@makebegin% executes an entitie that can open blocks
   {%
   \expandafter\let\expandafter\ALG@thislifetime\csname ALG@currentlifetime@\theALG@nested\endcsname%
   \ifx\ALG@thislifetime\relax%
      \let\ALG@makebeginrepeat\ALG@doentity% in infinite block I can open my block
   \else%
      \ifnum\ALG@thislifetime>0\relax%
         \ifnum\ALG@thislifetime>65534\else%
            \setcounter{ALG@tmpcounter}{\ALG@thislifetime}% the block has 'space' for another included block
            \addtocounter{ALG@tmpcounter}{-1}%
            \expandafter\edef\csname ALG@currentlifetime@\theALG@nested\endcsname{\arabic{ALG@tmpcounter}}%
         \fi%
         \let\ALG@makebeginrepeat\ALG@doentity%
      \else% the block needs to be closed
         \expandafter\ifx\csname ALG@b@\ALG@L @\ALG@thisentity @\csname ALG@currentblock@\theALG@nested\endcsname\endcsname\relax%
            \ALG@closebyforce% I can not close this block, continue after it is closed by force
%            \ALG@makebegin%
         \else%
            % the block would be closed automatically, but this entitie can close it, so let's do it with the entity
            \let\ALG@makebeginrepeat\ALG@doentity%
         \fi%
      \fi%
   \fi%
   \ALG@makebeginrepeat%
   }%
%
\def\ALG@makenobegin% executes an entitie that can not open blocks
   {%
   \expandafter\ifx\csname ALG@currentlifetime@\theALG@nested\endcsname\relax%
      \let\ALG@makenobeginrepeat\ALG@doentity% an infinite block must be broken
   \else%
      \expandafter\ifx\csname ALG@b@\ALG@L @\ALG@thisentity @\csname ALG@currentblock@\theALG@nested\endcsname\endcsname\relax%
         \ALG@closebyforce% the block must be ended by force,
      \else%
         \let\ALG@makenobeginrepeat\ALG@doentity% I can continue / end this block, let's do it
      \fi%
   \fi%
   \ALG@makenobeginrepeat%
   }%
%
\def\ALG@dobegin%
   {%
   \ALG@beginblock{\csname ALG@i@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname}%
   \expandafter\edef\csname ALG@currentblock@\theALG@nested\endcsname{\csname ALG@b@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname}%
   \expandafter\ifx\csname ALG@c@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname\relax%
      \expandafter\let\csname ALG@currentlifetime@\theALG@nested\endcsname\relax%
   \else%
      \expandafter\edef\csname ALG@currentlifetime@\theALG@nested\endcsname{\csname ALG@c@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname}%
   \fi%
   }%
%
\def\ALG@doend%
   {%
   \ALG@endblock%
   }%
%
\def\ALG@doentity% the number of the closed block, the entitie
   {%
   \edef\ALG@thisblock{\csname ALG@currentblock@\theALG@nested\endcsname}%
   \expandafter\ifx\csname ALG@b@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname\relax%
      \def\ALG@thisblock{0}%
   \fi%
   \ALG@getentitytext%
   \ifnum\ALG@thisblock=0\else\ALG@doend\fi%
   \ifx\ALG@text\ALG@x@notext%
      \item[]\nointerlineskip%\vskip-\prevdepth\nointerlineskip% bug: if there are no text and no lines, then this is wrong
   \else%
      \item%
   \fi%
   \noindent\hskip\ALG@tlm%
   \expandafter\ifnum0=\csname ALG@b@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname\else%
      \ALG@dobegin%
   \fi%
   \def\ALG@entitiecommand{\ALG@displayentity}%
   }%
%
\def\ALG@getentitytext%
   {%
   \expandafter\let\expandafter\ALG@text\csname ALG@t@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname%
   \ifx\ALG@text\ALG@x@default%
      % block specific - default
      \expandafter\let\expandafter\ALG@text\csname ALG@t@\ALG@L @\ALG@thisentity\endcsname%
      \ifx\ALG@text\ALG@x@default%
         % block specific - default, language specific - default
         \def\ALG@text{\ALG@deftext{\ALG@thisentity}}%
      \fi%
   \fi%
   }%
%
\def\ALG@deftext{\csname ALG@deftext@\ALG@L\endcsname}%
%
\def\ALG@displayentity%
   {%
   \ifx\ALG@text\ALG@x@notext%
      \let\ALG@text\relax%
   \fi
   \ALG@text%
   }%
%
\def\ALG@closebyforce%
   {%
   \ALG@endblock%
   }%
%
\def\ALG@closeloops% closes all finite blocks
   {%
   \expandafter\ifx\csname ALG@currentlifetime@\theALG@nested\endcsname\relax%
   \else% only if it is finite
      \ALG@closebyforce% the block must be ended by force,
      \ALG@closeloops% the command still runs
   \fi%
   }%
%
%
%   ***   Low level block/entitie defining commands   ***
%
%
\def\ALG@bl@{0}% the BIG block
\let\ALG@bl@@\ALG@bl@% the BIG block
%
%  Create a block
%
\def\ALG@createblock#1% create the block #1, if it does not exists
   {%
   \@ifundefined{ALG@bl@\ALG@Ld @#1}% needs to be created?
      {%
      \addtocounter{ALG@blocknr}{1}% increment the block counter
      \expandafter\edef\csname ALG@bl@\ALG@Ld @#1\endcsname{\arabic{ALG@blocknr}}% set the block number
      }%
      {}%
   }%
%
%  Get the block number
%
\def\ALG@getblocknumber#1{\csname ALG@bl@\ALG@Ld @#1\endcsname}%
%
%  Create an entitie
%
\def\ALG@createentitie#1% create the entitie #1, if it does not exists
   {%
   \expandafter\ALG@edefcmd\csname #1\endcsname{\noexpand\ALG@makeentity{#1}}%
   \@ifundefined{ALG@t@\ALG@Ld @#1}% the entity text is defined in this language?
      {%
      \expandafter\let\csname ALG@t@\ALG@Ld @#1\endcsname\ALG@x@default%
      }%
      {}%
   }%
%
\def\ALG@createtext#1#2% #1 = closed block; #2 = entitie; creates \ALG@t@#2@#1
   {%
   \expandafter\let\csname ALG@t@\ALG@Ld @#2@#1\endcsname\ALG@x@default%
   }%
%
%  End and Continue block
%
\def\ALG@endandcontinueblock#1#2#3#4#5% #1 = new block; #2 = old block; #3 = entitie; #4 = credits; #5 = indent
   {%
   \ifthenelse{\equal{#3}{}}{}% execute only if the entity is not empty
      {%
      \ALG@createentitie{#3}% create the entitie
      \ALG@createblock{#2}% create the old block, if needed
      \ifthenelse{\equal{#1}{}}% whe need to open a new block?
         {\expandafter\edef\csname ALG@b@\ALG@Ld @#3@\ALG@getblocknumber{#2}\endcsname{0}}% no, just close the old one
         {% yes,
         \ALG@createblock{#1}% create the block
         \expandafter\edef\csname ALG@b@\ALG@Ld @#3@\ALG@getblocknumber{#2}\endcsname{\ALG@getblocknumber{#1}}% ending the old block opens a new one
         \ifthenelse{\equal{#4}{}}% infinite or finite credits?
            {\expandafter\let\csname ALG@c@\ALG@Ld @#3@\ALG@getblocknumber{#2}\endcsname\relax}% infinite credits
            {\expandafter\edef\csname ALG@c@\ALG@Ld @#3@\ALG@getblocknumber{#2}\endcsname{#4}}% finite credits
         \ifthenelse{\equal{#5}{}}% default or specified indentation
            {\expandafter\let\csname ALG@i@\ALG@Ld @#3@\ALG@getblocknumber{#2}\endcsname\ALG@defaultindent}% default indentation
            {\expandafter\edef\csname ALG@i@\ALG@Ld @#3@\ALG@getblocknumber{#2}\endcsname{#5}}% indentation is specified
         }%
      \ALG@createtext{\ALG@getblocknumber{#2}}{#3}%
      }%
   }%
%
%   macros used in declarations
%
\def\ALG@p@endtext@E{\algrenewtext{\ALG@v@end}}%
\def\ALG@p@endtext@xE{\algrenewtext[\ALG@v@newblock]{\ALG@v@end}}%
\def\ALG@p@endtext@nE{\algnotext{\ALG@v@end}}%
\def\ALG@p@endtext@xnE{\algnotext[\ALG@v@newblock]{\ALG@v@end}}%
\def\ALG@p@endtext@{}%
% starttext defines are more compex -- care must be taken for the optional parameters
\def\ALG@p@starttext@S{\ALG@p@s@process{\algrenewtext}}%
\def\ALG@p@starttext@C{\ALG@p@s@process{\algrenewtext}}%
\def\ALG@p@starttext@xC{\ALG@p@s@process{\algrenewtext[\ALG@v@oldblock]}}%
\def\ALG@p@s@process#1%
   {%
   \ifthenelse{\equal{\ALG@v@start}{}}%
      {\ALG@p@endtext}%
      {\@ifnextchar{[}{\ALG@p@s@getparamcount{#1}}{\ALG@p@s@simple{#1}}}%
   }%
\def\ALG@p@s@getparamcount#1[#2]%
   {%
   \@ifnextchar{[}{\ALG@p@s@getdefparam{#1}{#2}}{\ALG@p@s@param{#1}{#2}}%
   }%
\def\ALG@p@s@getdefparam#1#2[#3]%
   {%
   \ALG@p@s@defparam{#1}{#2}{#3}%
   }%
\def\ALG@p@s@simple#1#2{#1{\ALG@v@start}{#2}\ALG@p@endtext}%
\def\ALG@p@s@param#1#2#3{#1{\ALG@v@start}[#2]{#3}\ALG@p@endtext}%
\def\ALG@p@s@defparam#1#2#3#4{#1{\ALG@v@start}[#2][#3]{#4}\ALG@p@endtext}%
% the rest of the crew
\def\ALG@p@starttext@nS{\algnotext{\ALG@v@start}\ALG@p@endtext}%
\def\ALG@p@starttext@nC{\algnotext{\ALG@v@start}\ALG@p@endtext}%
\def\ALG@p@starttext@xnC{\algnotext[\ALG@v@oldblock]{\ALG@v@start}\ALG@p@endtext}%
\def\ALG@p@starttext@{\ALG@p@endtext}%
\def\ALG@p@indent@def#1{\def\ALG@v@indent{#1}\ALG@p@setup}%
\def\ALG@p@indent@{\def\ALG@v@indent{}\ALG@p@setup}%
\def\ALG@p@credits@def#1{\def\ALG@v@credits{#1}\ALG@p@indent}%
\def\ALG@p@credits@{\ALG@p@indent}%
\def\ALG@p@end@def#1{\def\ALG@v@end{#1}\ALG@p@credits}%
\def\ALG@p@end@{\def\ALG@v@end{}\ALG@p@credits}%
\def\ALG@p@start@def#1{\def\ALG@v@start{#1}\ALG@p@end}%
\def\ALG@p@start@{\def\ALG@v@start{}\ALG@p@end}%
\def\ALG@p@oldblock@def#1{\def\ALG@v@oldblock{#1}\ALG@p@start}%
\def\ALG@p@oldblock@{\def\ALG@v@oldblock{}\ALG@p@start}%
\newcommand\ALG@p@newblock[1][]{\def\ALG@v@newblock{#1}\ALG@p@oldblock}%
\def\ALG@p@setup%
   {%
   \ifthenelse{\equal{\ALG@v@newblock}{}}%
      {%
      \ifthenelse{\equal{\ALG@v@start}{}}%
         {%
            \PackageError{algorithmicx}{Block or starting entitie must be specified!!!}{}%
         }%
         {%
            \let\ALG@v@newblock\ALG@v@start%
         }%
      }%
      {%
      }%
   \ALG@endandcontinueblock%
      {\ALG@v@newblock}{\ALG@v@oldblock}{\ALG@v@start}%
      {\ALG@v@credits}{\ALG@v@indent}%
   \ALG@endandcontinueblock%
      {}{\ALG@v@newblock}{\ALG@v@end}%
      {}{}%
   \ALG@p@starttext%
   }%
%
%   param handling
%
\newcommand\ALG@p@def[2][def]%
   {%
   \expandafter\let\csname ALG@p@#2\expandafter\endcsname\csname ALG@p@#2@#1\endcsname%
   }%
\def\ALG@p@undef{\ALG@p@def[]}%
%
\def\ALG@p@ons{\ALG@p@def{start}}%
\def\ALG@p@onS{\ALG@p@def{start}\ALG@p@def[S]{starttext}}%
\def\ALG@p@onc{\ALG@p@def{oldblock}\ALG@p@def{start}}%
\def\ALG@p@onC{\ALG@p@def{oldblock}\ALG@p@def{start}\ALG@p@def[C]{starttext}}%
\def\ALG@p@one{\ALG@p@def{end}}%
\def\ALG@p@onE{\ALG@p@def{end}\ALG@p@def[E]{endtext}}%
\def\ALG@p@onxC{\ALG@p@def{oldblock}\ALG@p@def{start}\ALG@p@def[xC]{starttext}}%
\def\ALG@p@onxE{\ALG@p@def{end}\ALG@p@def[xE]{endtext}}%
\def\ALG@p@onnS{\ALG@p@def{start}\ALG@p@def[nS]{starttext}}%
\def\ALG@p@onnC{\ALG@p@def{oldblock}\ALG@p@def{start}\ALG@p@def[nC]{starttext}}%
\def\ALG@p@onnE{\ALG@p@def{end}\ALG@p@def[nE]{endtext}}%
\def\ALG@p@onxnC{\ALG@p@def{oldblock}\ALG@p@def{start}\ALG@p@def[xnC]{starttext}}%
\def\ALG@p@onxnE{\ALG@p@def{end}\ALG@p@def[xnE]{endtext}}%
\def\ALG@p@onb{\def\ALG@v@credits{}}%
\def\ALG@p@onl{\def\ALG@v@credits{1}}%
\def\ALG@p@onL{\ALG@p@def{credits}}%
\def\ALG@p@oni{\ALG@p@def{indent}}%
%
\def\ALG@p@main#1%
   {%
   \@ifundefined{ALG@ps@\ALG@p@state @#1}%
      {%
      \csname ALG@ps@\ALG@p@state @other\endcsname{#1}%
      }%
      {%
      \csname ALG@ps@\ALG@p@state @#1\endcsname%
      }%
   \ALG@p@rec%
   }%
% STATE : <<starting state>>
\expandafter\def\csname ALG@ps@@]\endcsname{\let\ALG@p@rec\relax}%
\def\ALG@ps@@s{\ALG@p@ons}%
\def\ALG@ps@@S{\ALG@p@onS}%
\def\ALG@ps@@c{\ALG@p@onc}%
\def\ALG@ps@@C{\ALG@p@onC}%
\def\ALG@ps@@e{\ALG@p@one}%
\def\ALG@ps@@E{\ALG@p@onE}%
\def\ALG@ps@@N{\typeout{algdef: 'N' obsoloted, use 'nE'.}\ALG@p@onnE}%
\def\ALG@ps@@b{\ALG@p@onb}%
\def\ALG@ps@@l{\ALG@p@onl}%
\def\ALG@ps@@L{\ALG@p@onL}%
\def\ALG@ps@@i{\ALG@p@oni}%
\def\ALG@ps@@x{\def\ALG@p@state{x}}%
\def\ALG@ps@@n{\def\ALG@p@state{n}}%
\def\ALG@ps@@other#1{\typeout{algdef: Ignoring unknown token #1}}%
% STATE : x
\def\ALG@ps@x@C{\def\ALG@p@state{}\ALG@p@onxC}%
\def\ALG@ps@x@E{\def\ALG@p@state{}\ALG@p@onxE}%
\def\ALG@ps@x@N{\def\ALG@p@state{}\typeout{algdef: 'xN' obsoloted, use 'xnE'.}\ALG@p@onxnE}%
\def\ALG@ps@x@n{\def\ALG@p@state{xn}}%
\def\ALG@ps@x@other#1%
   {%
   \typeout{algdef: Ignoring 'x' before '#1'.}%
   \def\ALG@p@state{}%
   \def\ALG@p@rec{\let\ALG@p@rec\ALG@p@main\ALG@p@rec#1}%
   }%
% STATE : n
\def\ALG@ps@n@S{\def\ALG@p@state{}\ALG@p@onnS}%
\def\ALG@ps@n@C{\def\ALG@p@state{}\ALG@p@onnC}%
\def\ALG@ps@n@E{\def\ALG@p@state{}\ALG@p@onnE}%
\def\ALG@ps@n@x{\def\ALG@p@state{nx}}%
\def\ALG@ps@n@other#1%
   {%
   \typeout{algdef: Ignoring 'n' before '#1'.}%
   \def\ALG@p@state{}%
   \def\ALG@p@rec{\let\ALG@p@rec\ALG@p@main\ALG@p@rec#1}%
   }%
% STATE : xn
\def\ALG@ps@xn@C{\def\ALG@p@state{}\ALG@p@onxnC}%
\def\ALG@ps@xn@E{\def\ALG@p@state{}\ALG@p@onxnE}%
\def\ALG@ps@xn@x{\typeout{algdef: Ignoring 'x' after 'xn'.}}%
\def\ALG@ps@xn@n{\typeout{algdef: Ignoring 'n' after 'xn'.}}%
\def\ALG@ps@xn@other#1%
   {%
   \typeout{algdef: Ignoring 'xn' before '#1'.}%
   \def\ALG@p@state{}%
   \def\ALG@p@rec{\let\ALG@p@rec\ALG@p@main\ALG@p@rec#1}%
   }%
% STATE : nx
\def\ALG@ps@nx@C{\def\ALG@p@state{}\ALG@p@onxnC}%
\def\ALG@ps@nx@E{\def\ALG@p@state{}\ALG@p@onxnE}%
\def\ALG@ps@nx@x{\typeout{algdef: Ignoring 'x' after 'nx'.}}%
\def\ALG@ps@nx@n{\typeout{algdef: Ignoring 'n' after 'nx'.}}%
\def\ALG@ps@nx@other#1%
   {%
   \typeout{algdef: Ignoring 'nx' before '#1'.}%
   \def\ALG@p@state{}%
   \def\ALG@p@rec{\let\ALG@p@rec\ALG@p@main\ALG@p@rec#1}%
   }%
%
%
%   ***   User level block/entitie commands   ***
%
%
%
%   algdef{switches}... -- the king of all definitions in the algorithmicx package
%
\newcommand\algdef[1]%
   {%
   \ALG@p@undef{oldblock}%
   \ALG@p@undef{start}%
   \ALG@p@undef{end}%
   \def\ALG@v@credits{}%
   \ALG@p@undef{credits}%
   \ALG@p@undef{indent}%
   \ALG@p@undef{starttext}%
   \ALG@p@undef{endtext}%
   \def\ALG@p@state{}%
   \let\ALG@p@rec\ALG@p@main%
   \ALG@p@rec#1]%
   \ALG@p@newblock%
   }%
%
%   a lot of other macros are provided for convenience
%
\def\algblock{\algdef{se}}%
\def\algcblock{\algdef{ce}}%
\def\algloop{\algdef{sl}}%
\def\algcloop{\algdef{cl}}%
\def\algsetblock{\algdef{seLi}}%
\def\algsetcblock{\algdef{ceLi}}%
\def\algblockx{\algdef{SxE}}%
\def\algblockdefx{\algdef{SE}}%
\def\algcblockx{\algdef{CxE}}%
\def\algcblockdefx{\algdef{CE}}%
\def\algsetblockx{\algdef{SxELi}}%
\def\algsetblockdefx{\algdef{SELi}}%
\def\algsetcblockx{\algdef{CxELi}}%
\def\algsetcblockdefx{\algdef{CELi}}%
\def\algloopdefx{\algdef{Sl}}%
\def\algcloopx{\algdef{xCl}}%
\def\algcloopdefx{\algdef{Cl}}%
% algloopx is not correct, use algloopdefx
%
%   Text output commands
%
\newcommand\algrenewtext[2][]% [block]{entity}
   {%
   \ifthenelse{\equal{#2}{}}{}%
      {%
      \ifthenelse{\equal{#1}{}}%
         {%
         \expandafter\let\csname ALG@t@\ALG@Ld @#2\endcsname\relax%
         \expandafter\newcommand\csname ALG@t@\ALG@Ld @#2\endcsname%
         }%
         {%
         \expandafter\let\csname ALG@t@\ALG@Ld @#2@\ALG@getblocknumber{#1}\endcsname\relax%
         \expandafter\newcommand\csname ALG@t@\ALG@Ld @#2@\ALG@getblocknumber{#1}\endcsname%
         }%
      }%
   }%
%
\def\ALG@letentitytext#1#2% [block]{entity}
   {%
   \ifthenelse{\equal{#2}{}}{}%
      {%
      \ifthenelse{\equal{#1}{}}%
         {%
         \expandafter\let\csname ALG@t@\ALG@Ld @#2\endcsname%
         }%
         {%
         \expandafter\let\csname ALG@t@\ALG@Ld @#2@\ALG@getblocknumber{#1}\endcsname%
         }%
      }%
   }%
%
\newcommand\algnotext[2][]% [block]{entity}
   {%
   \ALG@letentitytext{#1}{#2}\ALG@x@notext%
   }%
%
\newcommand\algdefaulttext[2][]% [block]{entity}
   {%
   \ALG@letentitytext{#1}{#2}\ALG@x@default%
   }%
%
\def\ALG@notext*{\algnotext}%
\def\algtext{\@ifnextchar{*}{\ALG@notext}{\algrenewtext}}%
%
%
%   ***   LANGUAGE SWITCHING   ***
%
%
%
\newcommand\algnewlanguage[1]%
   {%
   \@ifundefined{ALG@L@#1}% needs to be created?
      {}%
      {%
      \PackageError{algorithmicx}{Language '#1' already defined!}{}%
      }%
   \addtocounter{ALG@Lnr}{1}% increment the language counter
   \expandafter\edef\csname ALG@L@#1\endcsname{\arabic{ALG@Lnr}}% set the language number
   \edef\ALG@Ld{\csname ALG@L@#1\endcsname}%
   \expandafter\let\csname ALG@bl@\ALG@Ld @\endcsname\ALG@bl@% the BIG block
   \expandafter\let\csname ALG@bl@\ALG@Ld @@\endcsname\ALG@bl@% the BIG block
   \algdef{SL}[STATE]{State}{0}{}%
   \expandafter\def\csname ALG@deftext@\ALG@Ld\endcsname{\textbf}%
   \algnewcommand\algorithmiccomment[1]{\hfill\(\triangleright\) ##1}%
   \algnewcommand\algorithmicindent{1.5em}%
   \algnewcommand\alglinenumber[1]{\footnotesize ##1:}%
   \algnewcommand\ALG@beginalgorithmic\relax% for user overrides
   \algnewcommand\ALG@endalgorithmic\relax% for user overrides
   }%
%
\newcommand\algsetlanguage[1]%
   {%
   \@ifundefined{ALG@L@#1}% needs to be created?
      {%
      \PackageError{algorithmicx}{Language '#1' is not yet defined!}{}%
      }{}%
   \edef\ALG@L{\csname ALG@L@#1\endcsname}%
   }%
%
\newcommand\algdeflanguage[1]%
   {%
   \@ifundefined{ALG@L@#1}% needs to be created?
      {%
      \PackageError{algorithmicx}{Language '#1' is not yet defined!}{}%
      }{}%
   \edef\ALG@Ld{\csname ALG@L@#1\endcsname}%
   }%
%
\newcommand\alglanguage[1]%
   {%
   \algdeflanguage{#1}%
   \algsetlanguage{#1}%
   }%
%
%
%   ***   Defining language dependent stuff   ***
%
%
\def\ALG@eatoneparam#1{}%
\def\ALG@defbasecmd#1#2%
   {%
   \edef\ALG@tmp{\expandafter\ALG@eatoneparam\string #2}%
   \@ifundefined\ALG@tmp{\edef #2{\noexpand\csname ALG@cmd@\noexpand\ALG@L @\ALG@tmp\endcsname}}{}%
   \expandafter#1\csname ALG@cmd@\ALG@Ld @\ALG@tmp\endcsname%
   }%
\newcommand\algnewcommand{\ALG@defbasecmd\newcommand}%
\newcommand\algrenewcommand{\ALG@defbasecmd\renewcommand}%
\def\ALG@letcmd{\ALG@defbasecmd\let}%
\def\ALG@defcmd{\ALG@defbasecmd\def}%
\def\ALG@edefcmd{\ALG@defbasecmd\edef}%
%
%
%   ***   OTHERS   ***
%
%
\def\BState{\State \algbackskip}%
\def\Statex{\item[]}% an empty line
\newcommand\algrenewcomment{\algrenewcommand\algorithmiccomment}%
\def\Comment{\algorithmiccomment}%
\def\algref#1#2{\ref{#1}.\ref{#2}}%
\algnewlanguage{default}%
\algsetlanguage{default}%
%
%
%   ***   Line breaks   ***
%
%
\newcommand\algbreak% for multiline parameters !!! needs fix
   {%
      \item%
%      \hskip\ALG@parindent%!!! not yet implemented
%      \hskip-\algorithmicindent%
   }%
%
\def\ALG@noputindents%
   {%
   \hskip\ALG@tlm%
   }%
%
%
%   ***   algorithm store / restore   ***
%
%
%   store
%
\ALG@newcondstate{mustrestore}%
\def\algstore%
   {%
   \renewcommand\ALG@beginblock%
      {%
      \PackageError{algorithmicx}{The environment must be closed after store!}{}%
      }%
   \@ifstar{\ALG@starstore}{\ALG@nostarstore}%
   }%
\def\ALG@nostarstore#1% save all infos into #1 and terminate the algorithmic block
   {%
   \addtocounter{ALG@storecount}{1}%
   \expandafter\global\expandafter\let\csname ALG@save@mustrestore@#1\endcsname\ALG@x@mustrestore%
   \ALG@starstore{#1}%
   }%
\def\ALG@starstore#1%
   {%
   \@ifundefined{ALG@save@line@#1}{}%
       {\PackageError{algorithmicx}{This save name '#1' is already used!}{}}%
   \def\ALG@savename{#1}%
   \expandafter\xdef\csname ALG@save@totalnr@\ALG@savename\endcsname{\theALG@nested}%
   \expandafter\xdef\csname ALG@save@line@\ALG@savename\endcsname{\theALG@line}%
   \expandafter\xdef\csname ALG@save@numberfreq@\ALG@savename\endcsname{\ALG@numberfreq}%
   \expandafter\xdef\csname ALG@save@rem@\ALG@savename\endcsname{\theALG@rem}%
   \let\ALG@storerepeat\ALG@store%
   \ALG@storerepeat%
   }%
\def\ALG@store% simply terminate all open blocks
   {%
   \ifnum\theALG@nested=0\let\ALG@storerepeat\relax%
   \else%
      \expandafter\xdef\csname ALG@save@currentblock@\ALG@savename @\theALG@nested\endcsname%
         {\csname ALG@currentblock@\theALG@nested\endcsname}%
      \expandafter\ifx\csname ALG@currentlifetime@\theALG@nested\endcsname\relax%
      \else%
         \expandafter\xdef\csname ALG@save@currentlifetime@\ALG@savename @\theALG@nested\endcsname%
            {\csname ALG@currentlifetime@\theALG@nested\endcsname}%
      \fi%
      \expandafter\xdef\csname ALG@save@ind@\ALG@savename @\theALG@nested\endcsname%
         {\csname ALG@ind@\theALG@nested\endcsname}%
      \ALG@closebyforce%
   \fi%
   \ALG@storerepeat%
   }%
%
%   restore
%
\def\algrestore%
   {%
   \@ifstar{\ALG@starrestore}{\ALG@nostarrestore}%
   }%
\def\ALG@starrestore%
   {%
   \let\ALG@restorerem\relax%
   \let\ALG@restorereprem\relax%
   \ALG@restoremain%
   }%
\def\ALG@nostarrestore%
   {%
   \let\ALG@restorerem\ALG@restoreremovesave%
   \let\ALG@restorereprem\ALG@restorerepremovesave%
   \ALG@restoremain%
   }%
\def\ALG@restoreremovesave%
   {%
   \expandafter\global\expandafter\let\csname ALG@save@totalnr@\ALG@savename\endcsname\relax%
   \expandafter\global\expandafter\let\csname ALG@save@line@\ALG@savename\endcsname\relax%
   \expandafter\global\expandafter\let\csname ALG@save@rem@\ALG@savename\endcsname\relax%
   \expandafter\global\expandafter\let\csname ALG@save@totalnr@\ALG@savename\endcsname\relax%
   \expandafter\global\expandafter\let\csname ALG@save@numberfreq@\ALG@savename\endcsname\relax%
   }%
\def\ALG@restorerepremovesave%
   {%
   \expandafter\global\expandafter\let\csname ALG@save@currentblock@\ALG@savename @\theALG@tmpcounter\endcsname\relax%
   \expandafter\global\expandafter\let\csname ALG@save@currentlifetime@\ALG@savename @\theALG@tmpcounter\endcsname\relax%
   \expandafter\global\expandafter\let\csname ALG@save@currentlifetime@\ALG@savename @\theALG@tmpcounter\endcsname\relax%
   \expandafter\global\expandafter\let\csname ALG@save@ind@\ALG@savename @\theALG@tmpcounter\endcsname\relax%
   }%
\def\ALG@restoremain#1% restore all infos from #1 in an open algorithmic block
   {%
   \ifnum\theALG@line=0%
      \else\PackageError{algorithmicx}{Restore might be used only at the beginning of the environment!}{}%
   \fi%
   \def\ALG@savename{#1}%
   \expandafter\ifx\csname ALG@save@totalnr@\ALG@savename\endcsname\relax%
      \PackageError{algorithmicx}{Save '\ALG@savename'\space not defined!!!}{}%
   \fi%
   \@ifundefined{ALG@save@mustrestore@\ALG@savename}{}%
      {%
      \addtocounter{ALG@storecount}{-1}%
      \expandafter\global\expandafter\let\csname ALG@save@mustrestore@\ALG@savename\endcsname\relax%
      }%
   \setcounter{ALG@line}{\csname ALG@save@line@\ALG@savename\endcsname}%
   \edef\ALG@numberfreq{\csname ALG@save@numberfreq@\ALG@savename\endcsname}%
   \setcounter{ALG@rem}{\csname ALG@save@rem@\ALG@savename\endcsname}%
   \setcounter{ALG@tmpcounter}{\csname ALG@save@totalnr@\ALG@savename\endcsname}%
   \setcounter{ALG@nested}{0}%
   \ALG@restorerem%
   \let\ALG@restorerepeat\ALG@restore%
   \ALG@restorerepeat%
   }%
\def\ALG@restore%
   {%
   \ifnum\theALG@tmpcounter>0%
      \expandafter\edef\csname ALG@currentblock@\theALG@tmpcounter\endcsname%
         {\csname ALG@save@currentblock@\ALG@savename @\theALG@tmpcounter\endcsname}%
      \expandafter\ifx\csname ALG@save@currentlifetime@\ALG@savename @\theALG@tmpcounter\endcsname\relax%
         \expandafter\let\csname ALG@currentlifetime@\theALG@tmpcounter\endcsname\relax%
         \else%
            \expandafter\edef\csname ALG@currentlifetime@\theALG@tmpcounter\endcsname%
            {\csname ALG@save@currentlifetime@\ALG@savename @\theALG@tmpcounter\endcsname}%
         \fi%
      %
      \ALG@beginblock{\csname ALG@save@ind@\ALG@savename @\theALG@tmpcounter\endcsname}%
      \ALG@restorereprem%
      \addtocounter{ALG@tmpcounter}{-1}%
   \else\let\ALG@restorerepeat\relax%
   \fi%
   \ALG@restorerepeat%
   }%
\AtEndDocument%
   {%
   \ifnum\theALG@storecount>0\relax%
      \PackageError{algorithmicx}{Some stored algorithms are not restored!}{}%
   \fi%
   }%
Optimal-Design-layout/amssymb.sty · 14 KB
%%
%% This is file `amssymb.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% amssymb.dtx
%%
%% This is a generated file.
%%
%% Copyright 2001, 2009, 2013 American Mathematical Society.
%%
%% American Mathematical Society
%% Technical Support
%% Publications Technical Group
%% 201 Charles Street
%% Providence, RI 02904
%% USA
%% tel: (401) 455-4080
%%      (800) 321-4267 (USA and Canada only)
%% fax: (401) 331-3842
%% email: [email protected]
%%
%% Unlimited copying and redistribution of this file are permitted as
%% long as this file is not modified.  Modifications, and distribution
%% of modified versions, are permitted, but only if the resulting file
%% is renamed.
%%
\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX)
[1994/12/01]% LaTeX date must be December 1994 or later
\ProvidesPackage{amssymb}[2013/01/14 v3.01 AMS font symbols]
\DeclareOption{psamsfonts}{\PassOptionsToPackage{psamsfonts}{amsfonts}}
\ProcessOptions\relax
\RequirePackage{amsfonts}[1995/01/01]
\@ifpackageloaded{stix}{%
    \PackageWarningNoLine{amssymb}{The 'amssymb' package is redundant when
      you are using the 'stix' package, so I'm not going to load amssymb}
    \endinput
}{}
\let\square\relax \let\rightsquigarrow\square \let\lozenge\square
\let\vartriangleright\square \let\vartriangleleft\square
\let\trianglerighteq\square \let\trianglelefteq\square
\begingroup \catcode`\"=12
\DeclareMathSymbol{\boxdot}       {\mathbin}{AMSa}{"00}
\DeclareMathSymbol{\boxplus}      {\mathbin}{AMSa}{"01}
\DeclareMathSymbol{\boxtimes}     {\mathbin}{AMSa}{"02}
\DeclareMathSymbol{\square}       {\mathord}{AMSa}{"03}
\DeclareMathSymbol{\blacksquare}  {\mathord}{AMSa}{"04}
%\DeclareMathSymbol{\centerdot}    {\mathbin}{AMSa}{"05}
\DeclareMathSymbol{\lozenge}      {\mathord}{AMSa}{"06}
\DeclareMathSymbol{\blacklozenge} {\mathord}{AMSa}{"07}
\DeclareMathSymbol{\circlearrowright}   {\mathrel}{AMSa}{"08}
\DeclareMathSymbol{\circlearrowleft}    {\mathrel}{AMSa}{"09}
%% In amsfonts.sty:
%%\DeclareMathSymbol{\rightleftharpoons}{\mathrel}{AMSa}{"0A}
\DeclareMathSymbol{\leftrightharpoons}  {\mathrel}{AMSa}{"0B}
\DeclareMathSymbol{\boxminus}     {\mathbin}{AMSa}{"0C}
\DeclareMathSymbol{\Vdash}        {\mathrel}{AMSa}{"0D}
\DeclareMathSymbol{\Vvdash}       {\mathrel}{AMSa}{"0E}
\DeclareMathSymbol{\vDash}        {\mathrel}{AMSa}{"0F}
\DeclareMathSymbol{\twoheadrightarrow}  {\mathrel}{AMSa}{"10}
\DeclareMathSymbol{\twoheadleftarrow}   {\mathrel}{AMSa}{"11}
\DeclareMathSymbol{\leftleftarrows}     {\mathrel}{AMSa}{"12}
\DeclareMathSymbol{\rightrightarrows}   {\mathrel}{AMSa}{"13}
\DeclareMathSymbol{\upuparrows}         {\mathrel}{AMSa}{"14}
\DeclareMathSymbol{\downdownarrows} {\mathrel}{AMSa}{"15}
\DeclareMathSymbol{\upharpoonright} {\mathrel}{AMSa}{"16}
 \global\let\restriction\upharpoonright
\DeclareMathSymbol{\downharpoonright}   {\mathrel}{AMSa}{"17}
\DeclareMathSymbol{\upharpoonleft}  {\mathrel}{AMSa}{"18}
\DeclareMathSymbol{\downharpoonleft}{\mathrel}{AMSa}{"19}
\DeclareMathSymbol{\rightarrowtail} {\mathrel}{AMSa}{"1A}
\DeclareMathSymbol{\leftarrowtail}  {\mathrel}{AMSa}{"1B}
\DeclareMathSymbol{\leftrightarrows}{\mathrel}{AMSa}{"1C}
\DeclareMathSymbol{\rightleftarrows}{\mathrel}{AMSa}{"1D}
\DeclareMathSymbol{\Lsh}            {\mathrel}{AMSa}{"1E}
\DeclareMathSymbol{\Rsh}            {\mathrel}{AMSa}{"1F}
\DeclareMathSymbol{\rightsquigarrow}  {\mathrel}{AMSa}{"20}
\DeclareMathSymbol{\leftrightsquigarrow}{\mathrel}{AMSa}{"21}
\DeclareMathSymbol{\looparrowleft}  {\mathrel}{AMSa}{"22}
\DeclareMathSymbol{\looparrowright} {\mathrel}{AMSa}{"23}
\DeclareMathSymbol{\circeq}       {\mathrel}{AMSa}{"24}
\DeclareMathSymbol{\succsim}      {\mathrel}{AMSa}{"25}
\DeclareMathSymbol{\gtrsim}       {\mathrel}{AMSa}{"26}
\DeclareMathSymbol{\gtrapprox}    {\mathrel}{AMSa}{"27}
\DeclareMathSymbol{\multimap}     {\mathrel}{AMSa}{"28}
\DeclareMathSymbol{\therefore}    {\mathrel}{AMSa}{"29}
\DeclareMathSymbol{\because}      {\mathrel}{AMSa}{"2A}
\DeclareMathSymbol{\doteqdot}     {\mathrel}{AMSa}{"2B}
 \global\let\Doteq\doteqdot
\DeclareMathSymbol{\triangleq}    {\mathrel}{AMSa}{"2C}
\DeclareMathSymbol{\precsim}      {\mathrel}{AMSa}{"2D}
\DeclareMathSymbol{\lesssim}      {\mathrel}{AMSa}{"2E}
\DeclareMathSymbol{\lessapprox}   {\mathrel}{AMSa}{"2F}
\DeclareMathSymbol{\eqslantless}  {\mathrel}{AMSa}{"30}
\DeclareMathSymbol{\eqslantgtr}   {\mathrel}{AMSa}{"31}
\DeclareMathSymbol{\curlyeqprec}  {\mathrel}{AMSa}{"32}
\DeclareMathSymbol{\curlyeqsucc}  {\mathrel}{AMSa}{"33}
\DeclareMathSymbol{\preccurlyeq}  {\mathrel}{AMSa}{"34}
\DeclareMathSymbol{\leqq}         {\mathrel}{AMSa}{"35}
\DeclareMathSymbol{\leqslant}     {\mathrel}{AMSa}{"36}
\DeclareMathSymbol{\lessgtr}      {\mathrel}{AMSa}{"37}
\DeclareMathSymbol{\backprime}    {\mathord}{AMSa}{"38}
\DeclareMathSymbol{\risingdotseq} {\mathrel}{AMSa}{"3A}
\DeclareMathSymbol{\fallingdotseq}{\mathrel}{AMSa}{"3B}
\DeclareMathSymbol{\succcurlyeq}  {\mathrel}{AMSa}{"3C}
\DeclareMathSymbol{\geqq}         {\mathrel}{AMSa}{"3D}
\DeclareMathSymbol{\geqslant}     {\mathrel}{AMSa}{"3E}
\DeclareMathSymbol{\gtrless}      {\mathrel}{AMSa}{"3F}
%% in amsfonts.sty
%% \DeclareMathSymbol{\sqsubset}    {\mathrel}{AMSa}{"40}
%% \DeclareMathSymbol{\sqsupset}    {\mathrel}{AMSa}{"41}
\DeclareMathSymbol{\vartriangleright}{\mathrel}{AMSa}{"42}
\DeclareMathSymbol{\vartriangleleft} {\mathrel}{AMSa}{"43}
\DeclareMathSymbol{\trianglerighteq} {\mathrel}{AMSa}{"44}
\DeclareMathSymbol{\trianglelefteq}  {\mathrel}{AMSa}{"45}
\DeclareMathSymbol{\bigstar}    {\mathord}{AMSa}{"46}
\DeclareMathSymbol{\between}    {\mathrel}{AMSa}{"47}
\DeclareMathSymbol{\blacktriangledown}  {\mathord}{AMSa}{"48}
\DeclareMathSymbol{\blacktriangleright} {\mathrel}{AMSa}{"49}
\DeclareMathSymbol{\blacktriangleleft}  {\mathrel}{AMSa}{"4A}
\DeclareMathSymbol{\vartriangle}        {\mathrel}{AMSa}{"4D}
\DeclareMathSymbol{\blacktriangle}      {\mathord}{AMSa}{"4E}
\DeclareMathSymbol{\triangledown}       {\mathord}{AMSa}{"4F}
\DeclareMathSymbol{\eqcirc}       {\mathrel}{AMSa}{"50}
\DeclareMathSymbol{\lesseqgtr}    {\mathrel}{AMSa}{"51}
\DeclareMathSymbol{\gtreqless}    {\mathrel}{AMSa}{"52}
\DeclareMathSymbol{\lesseqqgtr}   {\mathrel}{AMSa}{"53}
\DeclareMathSymbol{\gtreqqless}   {\mathrel}{AMSa}{"54}
\DeclareMathSymbol{\Rrightarrow}  {\mathrel}{AMSa}{"56}
\DeclareMathSymbol{\Lleftarrow}   {\mathrel}{AMSa}{"57}
%\DeclareMathSymbol{\veebar}       {\mathbin}{AMSa}{"59}
%\DeclareMathSymbol{\barwedge}     {\mathbin}{AMSa}{"5A}
%\DeclareMathSymbol{\doublebarwedge} {\mathbin}{AMSa}{"5B}
%% In amsfonts.sty
%%\DeclareMathSymbol{\angle}        {\mathord}{AMSa}{"5C}
\DeclareMathSymbol{\measuredangle}  {\mathord}{AMSa}{"5D}
\DeclareMathSymbol{\sphericalangle} {\mathord}{AMSa}{"5E}
\DeclareMathSymbol{\varpropto}    {\mathrel}{AMSa}{"5F}
\DeclareMathSymbol{\smallsmile}   {\mathrel}{AMSa}{"60}
\DeclareMathSymbol{\smallfrown}   {\mathrel}{AMSa}{"61}
\DeclareMathSymbol{\Subset}       {\mathrel}{AMSa}{"62}
\DeclareMathSymbol{\Supset}       {\mathrel}{AMSa}{"63}
\DeclareMathSymbol{\Cup}          {\mathbin}{AMSa}{"64}
 \global\let\doublecup\Cup
\DeclareMathSymbol{\Cap}          {\mathbin}{AMSa}{"65}
 \global\let\doublecap\Cap
\DeclareMathSymbol{\curlywedge}   {\mathbin}{AMSa}{"66}
\DeclareMathSymbol{\curlyvee}     {\mathbin}{AMSa}{"67}
\DeclareMathSymbol{\leftthreetimes} {\mathbin}{AMSa}{"68}
\DeclareMathSymbol{\rightthreetimes}{\mathbin}{AMSa}{"69}
\DeclareMathSymbol{\subseteqq}    {\mathrel}{AMSa}{"6A}
\DeclareMathSymbol{\supseteqq}    {\mathrel}{AMSa}{"6B}
\DeclareMathSymbol{\bumpeq}       {\mathrel}{AMSa}{"6C}
\DeclareMathSymbol{\Bumpeq}       {\mathrel}{AMSa}{"6D}
\DeclareMathSymbol{\lll}          {\mathrel}{AMSa}{"6E}
 \global\let\llless\lll
\DeclareMathSymbol{\ggg}          {\mathrel}{AMSa}{"6F}
 \global\let\gggtr\ggg
%\DeclareMathSymbol{\circledS}     {\mathord}{AMSa}{"73}
\DeclareMathSymbol{\pitchfork}    {\mathrel}{AMSa}{"74}
%\DeclareMathSymbol{\dotplus}      {\mathbin}{AMSa}{"75}
\DeclareMathSymbol{\backsim}      {\mathrel}{AMSa}{"76}
\DeclareMathSymbol{\backsimeq}    {\mathrel}{AMSa}{"77}
%\DeclareMathSymbol{\complement}   {\mathord}{AMSa}{"7B}
%\DeclareMathSymbol{\intercal}     {\mathbin}{AMSa}{"7C}
\DeclareMathSymbol{\circledcirc}  {\mathbin}{AMSa}{"7D}
\DeclareMathSymbol{\circledast}   {\mathbin}{AMSa}{"7E}
\DeclareMathSymbol{\circleddash}  {\mathbin}{AMSa}{"7F}
%%   Begin AMSb declarations
\DeclareMathSymbol{\lvertneqq}    {\mathrel}{AMSb}{"00}
\DeclareMathSymbol{\gvertneqq}    {\mathrel}{AMSb}{"01}
\DeclareMathSymbol{\nleq}         {\mathrel}{AMSb}{"02}
\DeclareMathSymbol{\ngeq}         {\mathrel}{AMSb}{"03}
\DeclareMathSymbol{\nless}        {\mathrel}{AMSb}{"04}
\DeclareMathSymbol{\ngtr}         {\mathrel}{AMSb}{"05}
\DeclareMathSymbol{\nprec}        {\mathrel}{AMSb}{"06}
\DeclareMathSymbol{\nsucc}        {\mathrel}{AMSb}{"07}
\DeclareMathSymbol{\lneqq}        {\mathrel}{AMSb}{"08}
\DeclareMathSymbol{\gneqq}        {\mathrel}{AMSb}{"09}
\DeclareMathSymbol{\nleqslant}    {\mathrel}{AMSb}{"0A}
\DeclareMathSymbol{\ngeqslant}    {\mathrel}{AMSb}{"0B}
\DeclareMathSymbol{\lneq}         {\mathrel}{AMSb}{"0C}
\DeclareMathSymbol{\gneq}         {\mathrel}{AMSb}{"0D}
\DeclareMathSymbol{\npreceq}      {\mathrel}{AMSb}{"0E}
\DeclareMathSymbol{\nsucceq}      {\mathrel}{AMSb}{"0F}
\DeclareMathSymbol{\precnsim}     {\mathrel}{AMSb}{"10}
\DeclareMathSymbol{\succnsim}     {\mathrel}{AMSb}{"11}
\DeclareMathSymbol{\lnsim}        {\mathrel}{AMSb}{"12}
\DeclareMathSymbol{\gnsim}        {\mathrel}{AMSb}{"13}
\DeclareMathSymbol{\nleqq}        {\mathrel}{AMSb}{"14}
\DeclareMathSymbol{\ngeqq}        {\mathrel}{AMSb}{"15}
\DeclareMathSymbol{\precneqq}     {\mathrel}{AMSb}{"16}
\DeclareMathSymbol{\succneqq}     {\mathrel}{AMSb}{"17}
\DeclareMathSymbol{\precnapprox}  {\mathrel}{AMSb}{"18}
\DeclareMathSymbol{\succnapprox}  {\mathrel}{AMSb}{"19}
\DeclareMathSymbol{\lnapprox}     {\mathrel}{AMSb}{"1A}
\DeclareMathSymbol{\gnapprox}     {\mathrel}{AMSb}{"1B}
\DeclareMathSymbol{\nsim}         {\mathrel}{AMSb}{"1C}
\DeclareMathSymbol{\ncong}        {\mathrel}{AMSb}{"1D}
\DeclareMathSymbol{\diagup}       {\mathord}{AMSb}{"1E}
\DeclareMathSymbol{\diagdown}     {\mathord}{AMSb}{"1F}
\DeclareMathSymbol{\varsubsetneq}   {\mathrel}{AMSb}{"20}
\DeclareMathSymbol{\varsupsetneq}   {\mathrel}{AMSb}{"21}
\DeclareMathSymbol{\nsubseteqq}     {\mathrel}{AMSb}{"22}
\DeclareMathSymbol{\nsupseteqq}     {\mathrel}{AMSb}{"23}
\DeclareMathSymbol{\subsetneqq}     {\mathrel}{AMSb}{"24}
\DeclareMathSymbol{\supsetneqq}     {\mathrel}{AMSb}{"25}
\DeclareMathSymbol{\varsubsetneqq}  {\mathrel}{AMSb}{"26}
\DeclareMathSymbol{\varsupsetneqq}  {\mathrel}{AMSb}{"27}
\DeclareMathSymbol{\subsetneq}      {\mathrel}{AMSb}{"28}
\DeclareMathSymbol{\supsetneq}      {\mathrel}{AMSb}{"29}
\DeclareMathSymbol{\nsubseteq}      {\mathrel}{AMSb}{"2A}
\DeclareMathSymbol{\nsupseteq}      {\mathrel}{AMSb}{"2B}
\DeclareMathSymbol{\nparallel}      {\mathrel}{AMSb}{"2C}
\DeclareMathSymbol{\nmid}           {\mathrel}{AMSb}{"2D}
\DeclareMathSymbol{\nshortmid}      {\mathrel}{AMSb}{"2E}
\DeclareMathSymbol{\nshortparallel} {\mathrel}{AMSb}{"2F}
\DeclareMathSymbol{\nvdash}         {\mathrel}{AMSb}{"30}
\DeclareMathSymbol{\nVdash}         {\mathrel}{AMSb}{"31}
\DeclareMathSymbol{\nvDash}         {\mathrel}{AMSb}{"32}
\DeclareMathSymbol{\nVDash}         {\mathrel}{AMSb}{"33}
\DeclareMathSymbol{\ntrianglerighteq}{\mathrel}{AMSb}{"34}
\DeclareMathSymbol{\ntrianglelefteq}{\mathrel}{AMSb}{"35}
\DeclareMathSymbol{\ntriangleleft}  {\mathrel}{AMSb}{"36}
\DeclareMathSymbol{\ntriangleright} {\mathrel}{AMSb}{"37}
\DeclareMathSymbol{\nleftarrow}     {\mathrel}{AMSb}{"38}
\DeclareMathSymbol{\nrightarrow}    {\mathrel}{AMSb}{"39}
\DeclareMathSymbol{\nLeftarrow}     {\mathrel}{AMSb}{"3A}
\DeclareMathSymbol{\nRightarrow}    {\mathrel}{AMSb}{"3B}
\DeclareMathSymbol{\nLeftrightarrow}{\mathrel}{AMSb}{"3C}
\DeclareMathSymbol{\nleftrightarrow}{\mathrel}{AMSb}{"3D}
%\DeclareMathSymbol{\divideontimes}  {\mathbin}{AMSb}{"3E}
\DeclareMathSymbol{\varnothing}     {\mathord}{AMSb}{"3F}
\DeclareMathSymbol{\nexists}        {\mathord}{AMSb}{"40}
%\DeclareMathSymbol{\Finv}           {\mathord}{AMSb}{"60}
%\DeclareMathSymbol{\Game}           {\mathord}{AMSb}{"61}
%% In amsfonts.sty:
%%\DeclareMathSymbol{\mho}          {\mathord}{AMSb}{"66}
\DeclareMathSymbol{\eth}            {\mathord}{AMSb}{"67}
\DeclareMathSymbol{\eqsim}          {\mathrel}{AMSb}{"68}
%\DeclareMathSymbol{\beth}           {\mathord}{AMSb}{"69}
%\DeclareMathSymbol{\gimel}          {\mathord}{AMSb}{"6A}
%\DeclareMathSymbol{\daleth}         {\mathord}{AMSb}{"6B}
\DeclareMathSymbol{\lessdot}        {\mathbin}{AMSb}{"6C}
\DeclareMathSymbol{\gtrdot}         {\mathbin}{AMSb}{"6D}
\DeclareMathSymbol{\ltimes}         {\mathbin}{AMSb}{"6E}
\DeclareMathSymbol{\rtimes}         {\mathbin}{AMSb}{"6F}
\DeclareMathSymbol{\shortmid}       {\mathrel}{AMSb}{"70}
\DeclareMathSymbol{\shortparallel}  {\mathrel}{AMSb}{"71}
\DeclareMathSymbol{\smallsetminus}  {\mathbin}{AMSb}{"72}
%\DeclareMathSymbol{\thicksim}       {\mathrel}{AMSb}{"73}
%\DeclareMathSymbol{\thickapprox}    {\mathrel}{AMSb}{"74}
\DeclareMathSymbol{\approxeq}       {\mathrel}{AMSb}{"75}
\DeclareMathSymbol{\succapprox}     {\mathrel}{AMSb}{"76}
\DeclareMathSymbol{\precapprox}     {\mathrel}{AMSb}{"77}
\DeclareMathSymbol{\curvearrowleft} {\mathrel}{AMSb}{"78}
\DeclareMathSymbol{\curvearrowright}{\mathrel}{AMSb}{"79}
\DeclareMathSymbol{\digamma}        {\mathord}{AMSb}{"7A}
\DeclareMathSymbol{\varkappa}       {\mathord}{AMSb}{"7B}
\DeclareMathSymbol{\Bbbk}           {\mathord}{AMSb}{"7C}
%\DeclareMathSymbol{\hslash}         {\mathord}{AMSb}{"7D}
%% In amsfonts.sty:
%%\DeclareMathSymbol{\hbar}         {\mathord}{AMSb}{"7E}
\DeclareMathSymbol{\backepsilon}    {\mathrel}{AMSb}{"7F}
\endgroup
\endinput
%%
%% End of file `amssymb.sty'.
Optimal-Design-layout/appendix.sty · 3 KB
%%
%% This is file `appendix.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% appendix.dtx  (with options: `package')
%% =============================================
%% IMPORTANT NOTICE:
%% This is a generated file.
%% 
%% It is subject to the same copyright conditions (see below)
%% as in the original file: appendix.dtx.
%% It may not be distributed without appendix.dtx.
%% 
%% Full documentation can be obtained by LaTeXing that original file.
%% Only a few abbreviated comments remain here to describe the usage.
%% =============================================
%% Copyright 1993-2005 Patrick W Daly
%% Max-Planck-Institut f\"ur Aeronomie
%% Max-Planck-Str. 2
%% D-37191 Katlenburg-Lindau
%% Germany
%% E-mail: [email protected]
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{appendix}
           [2005/10/30 2.2 (PWD)]
 % Adding this package redefines \appendix so that main counters for
 % figures, tables, equations are subnumbered under the appendix.
 % A \noappendix command is included so that things like bibliographies
 % may be called after the appendix with \section*. It resets the sectioning
 % commands. There should be no \section commands after this though.
 %
 % LaTeX2e options:
 %   mylang (default) -> keeps current \appendixname
 %   english, american  -> sets \appendixname to  `Appendix'
 %   german, austrian, french, esperanto -> translates \appendixname
 %   blank    -> suppresses the word `Appendix' with \appendix
 % Options processed in order given, default is mylang (no change)
 %-----------------------------------------------------------
\@ifundefined{iffigcaps}{}
  {\PackageWarningNoLine{appendix}
     {***********************************\MessageBreak
      This package read in after `figcaps'\MessageBreak
      There could be problems with sublabelled\MessageBreak
      figure and table numbers.\MessageBreak
      ***********************************}}
\DeclareOption{english}{\def\appendixname{Appendix}}
\DeclareOption{american}{\def\appendixname{Appendix}}
\DeclareOption{german}{\def\appendixname{Anhang}}
\DeclareOption{austrian}{\def\appendixname{Anhang}}
\DeclareOption{french}{\def\appendixname{Annexe}}
\DeclareOption{esperanto}{\def\appendixname{Apendico}}
\DeclareOption{blank}{\def\appendixname{}}
\DeclareOption{mylang}{\providecommand{\appendixname}{Appendix}}
\ExecuteOptions{mylang}
\ProcessOptions*
\let\orisection=\section
\let\theolds=\thesection
\let\theoldss=\thesubsection
\def\appendix{\par
  \if\@empty\appendixname \else  \section*{\appendixname} \fi
  \setcounter{section}{0}
  \setcounter{subsection}{0}
  \def\thesection{\Alph{section}}
  \def\thesubsection{\thesection\arabic{subsection}}
  \setcounter{secnumdepth}{4}
  \@addtoreset{equation}{section}
  \setcounter{equation}{0}
  \def\theequation{\thesection\arabic{equation}}
  \@addtoreset{figure}{section}
  \setcounter{figure}{0}
  \def\thefigure{\thesection\arabic{figure}}
  \@addtoreset{table}{section}
  \def\thetable{\thesection\arabic{table}}
  \setcounter{table}{0}
\def\@Alph##1{%
  \ifcase##1A\or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or
   K\or L\or M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or
    Y\or Z\else\@ctrerr\fi}
}
\def\noappendix{\setcounter{secnumdepth}{0}
  \global\let\section=\orisection
  \global\let\thesection=\theolds
  \global\let\thesubsection=\theoldss
}
%% 
%% <<<<< End of generated file <<<<<<
%%
%% End of file `appendix.sty'.

Optimal-Design-layout/empty-eps-converted-to.pdf — binary, 2 KB

Optimal-Design-layout/empty.eps — binary, 3 KB

Optimal-Design-layout/images/Facebook_Logo-eps-converted-to.pdf — binary, 10 KB

Optimal-Design-layout/images/Facebook_Logo.eps — binary, 272 KB

Optimal-Design-layout/images/LinkedIn_Logo-eps-converted-to.pdf — binary, 14 KB

Optimal-Design-layout/images/LinkedIn_Logo.eps — binary, 281 KB

Optimal-Design-layout/images/ORCID_Logo-eps-converted-to.pdf — binary, 11 KB

Optimal-Design-layout/images/ORCID_Logo.eps — binary, 388 KB

Optimal-Design-layout/images/Twitter_Logo-eps-converted-to.pdf — binary, 11 KB

Optimal-Design-layout/images/Twitter_Logo.eps — binary, 360 KB

Optimal-Design-layout/images/Wiley_logo-eps-converted-to.pdf — binary, 10 KB

Optimal-Design-layout/images/Wiley_logo.eps — binary, 404 KB

Optimal-Design-layout/images/allergy-eps-converted-to.pdf — binary, 32 KB

Optimal-Design-layout/images/allergy.eps — binary, 1439 KB

Optimal-Design-layout/images/openaccess-eps-converted-to.pdf — binary, 14 KB

Optimal-Design-layout/images/openaccess.eps — binary, 1202 KB

Optimal-Design-layout/mla.sty · 11 KB
% Latex style file MLA for use with MLA.bst
% taken completely from the file chicago.sty and
% modified slightly as documented.
% 3/25/97 added functions for the MLAnnote.BST Annotated bibliography
% [email protected] on 10/22/95
%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     author          = "Glenn Paulley",
%%%     version         = "4",
%%%     date            = "31 August 1992",
%%%     time            = "09:42:44 199",
%%%     filename        = "chicago.sty",
%%%     address         = "Data Structuring Group
%%%                        Department of Computer Science
%%%                        University of Waterloo
%%%                        Waterloo, Ontario, Canada
%%%                        N2L 3G1",
%%%     telephone       = "(519) 885-1211",
%%%     FAX             = "(519) 885-1208",
%%%     checksum        = "44674 264 1050 10394",
%%%     email           = "[email protected]",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "",
%%%     supported       = "yes",
%%%     abstract        = "Contains the LaTeX style command definitions
%%%                        for the Chicago BibTeX styles chicago.bst and
%%%                        chicagoa.bst. For details, see below.",
%%%     docstring       = "The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility.",
%%%  }
%%% ====================================================================
%
% chicago.sty: Style file for use with bibtex style chicago.bst, for
% bibliographies formatted according to the 13th Edition of the Chicago
% Manual of Style.
%
% 'newapa.bst' was made from 'plain.bst', 'named.bst', and 'apalike.bst',
% with lots of tweaking to make it look like APA style, along with tips
% from Young Ryu and Brian Reiser's modifications of 'apalike.bst'.
% newapa.sty formed the basis of this style, chicago.sty. Author-date
% references in newapa.bst formed the basis for chicago.bst. Chicagoa.bst
% supports annotations.
%
% Version 4 (August, 1992):
% - fixed chicago.bst and chicagoa.bst to handle long author lists in
%   sorting
% - fixed chicago.bst and chicagoa.bst so that missing page numbers in
%   ``article'' entries are handled correctly
% - modified chicago.sty to format entries with 2nd and subsequent lines
%   indented.
%
%   Citation format: (author-last-name year)
%             (author-last-name and author-last-name year)
%             (author-last-name et al. year)
%             (author-last-name)
%             author-last-name
%             author-last-name (year)
%             (author-last-name and author-last-name)
%             (author-last-name et al.)
%             (year) or (year,year)
%             year or year,year
%
%   Reference list ordering: alphabetical by author or whatever passes
%    for author in the absence of one.
%
% This BibTeX style has support for abbreviated author lists and for
%    year-only citations.  This is done by having the citations
%    actually look like
%
%    \citeauthoryear{full-author-info}{abbrev-author-info}{year}
%
% The LaTeX style has to have the following (or similar)
%
%     \let\@internalcite\cite
%     \def\fullcite{\def\citeauthoryear##1##2##3{##1, ##3}\@internalcite}
%     \def\fullciteA{\def\citeauthoryear##1##2##3{##1}\@internalcite}
%     \def\shortcite{\def\citeauthoryear##1##2##3{##2, ##3}\@internalcite}
%     \def\shortciteA{\def\citeauthoryear##1##2##3{##2}\@internalcite}
%     \def\citeyear{\def\citeauthoryear##1##2##3{##3}\@internalcite}
%
% -------------------------------------------------------------------------
% This file implements citations for the ``chicago'' bibliography style.
%  Place it in a file called chicago.sty in the TeX search path.
%(Placing it in the same directory as the LaTeX document should also work.)
%
%    This file is a modification of the ``newapa'' LaTeX style,
%    originally adapted by Steven Spencer from the ``apalike'' LaTeX style.
%    It was originally modified by Stephen N. Spencer, with further
%    modifications by Young U. Ryu.
%
% The ``chicago'' BibTeX bibliography style creates citations with labels:
%       \citeauthoryear{author-info}{abbrev. author-info}{year}
%
% These labels are processed by the following LaTeX commands:
%
%  \cite{key}
%    which produces citations with full author list and year.
%    eg. (Brown 1978; Jarke, Turner, Stohl, et al. 1985)
%  \citeNP{key}
%    which produces citations with full author list and year, but without
%    enclosing parentheses:
%    eg. Brown 1978; Jarke, Turner and Stohl 1985
%  \citeA{key}
%    which produces citations with only the full author list.
%    eg. (Brown; Jarke, Turner and Stohl)
%  \citeANP{key}
%    which produces citations with only the full author list, without
%    parentheses eg. Brown; Jarke, Turner and Stohl
%  \citeN{key}
%    which produces citations with the full author list and year, but
%    can be used as nouns in a sentence; no parentheses appear around
%    the author names, but only around the year.
%      eg. Shneiderman (1978) states that......
%    \citeN should only be used for a single citation.
%  \shortcite{key}
%    which produces citations with abbreviated author list and year.
%  \shortciteNP{key}
%    which produces citations with abbreviated author list and year.
%  \shortciteA{key}
%    which produces only the abbreviated author list.
%  \shortciteANP{key}
%    which produces only the abbreviated author list.
%  \shortciteN{key}
%    which produces the abbreviated author list and year, with only the
%    year in parentheses. Use with only one citation.
%  \citeyear{key}
%    which produces the year information only, within parentheses.
%  \citeyearNP{key}
%    which produces the year information only.
%
% Abbreviated author lists use the ``et al.'' construct.
%
% `NP' means `no parentheses'.
%
% This LaTeX style file must be used with the ``chicago'' or ``chicagoa''
% (annotated chicago style) BibTeX styles.
%
\typeout{Using MLA Manual of Style bibliography: 23 MAR 1997}
% any definitions or changes are so marked as MLA
% The bibliography in MLA Style is called          "Works Cited"
% new commands are defined at the end:
%
% \workscited{bibfile}{style}{nocite}
%     bibfile is the bibfile.bib
%     style is the style.bst file: either MLA or MLAA (annotated)
%     nocite is the list of keys or * to issue nocite commands
%
% -------------------------------------------------------------------------
%
% Citation macros.
%
\let\@internalcite\cite
%
\def\cite{\def\@citeseppen{-1000}%
    \def\@cite##1##2{(##1\if@tempswa , ##2\fi)}%
    \def\citeauthoryear##1##2##3{##1 ##3}\@internalcite}
\def\citeNP{\def\@citeseppen{-1000}%
    \def\@cite##1##2{##1\if@tempswa , ##2\fi}%
    \def\citeauthoryear##1##2##3{##1 ##3}\@internalcite}
\def\citeN{\def\@citeseppen{-1000}%
    \def\@cite##1##2{##1\if@tempswa , ##2)\else{)}\fi}%
    \def\citeauthoryear##1##2##3{##1 (##3}\@citedata}
\def\citeA{\def\@citeseppen{-1000}%
    \def\@cite##1##2{(##1\if@tempswa , ##2\fi)}%
    \def\citeauthoryear##1##2##3{##1}\@internalcite}
\def\citeANP{\def\@citeseppen{-1000}%
    \def\@cite##1##2{##1\if@tempswa , ##2\fi}%
    \def\citeauthoryear##1##2##3{##1}\@internalcite}
%
\def\shortcite{\def\@citeseppen{-1000}%
    \def\@cite##1##2{(##1\if@tempswa , ##2\fi)}%
    \def\citeauthoryear##1##2##3{##2 ##3}\@internalcite}
\def\shortciteNP{\def\@citeseppen{-1000}%
    \def\@cite##1##2{##1\if@tempswa , ##2\fi}%
    \def\citeauthoryear##1##2##3{##2 ##3}\@internalcite}
\def\shortciteN{\def\@citeseppen{-1000}%
    \def\@cite##1##2{##1\if@tempswa , ##2)\else{)}\fi}%
    \def\citeauthoryear##1##2##3{##2 (##3}\@citedata}
\def\shortciteA{\def\@citeseppen{-1000}%
    \def\@cite##1##2{(##1\if@tempswa , ##2\fi)}%
    \def\citeauthoryear##1##2##3{##2}\@internalcite}
\def\shortciteANP{\def\@citeseppen{-1000}%
    \def\@cite##1##2{##1\if@tempswa , ##2\fi}%
    \def\citeauthoryear##1##2##3{##2}\@internalcite}
%
\def\citeyear{\def\@citeseppen{-1000}%
    \def\@cite##1##2{(##1\if@tempswa , ##2\fi)}%
    \def\citeauthoryear##1##2##3{##3}\@citedata}
\def\citeyearNP{\def\@citeseppen{-1000}%
    \def\@cite##1##2{##1\if@tempswa , ##2\fi}%
    \def\citeauthoryear##1##2##3{##3}\@citedata}
%
% \@citedata and \@citedatax:
%
% Place commas in-between citations in the same \citeyear, \citeyearNP,
% \citeN, or \shortciteN command.
% Use something like \citeN{ref1,ref2,ref3} and \citeN{ref4} for a list.
%
\def\@citedata{%
   \@ifnextchar [{\@tempswatrue\@citedatax}%
              {\@tempswafalse\@citedatax[]}%
}
\def\@citedatax[#1]#2{%
\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi%
  \def\@citea{}\@cite{\@for\@citeb:=#2\do%
    {\@citea\def\@citea{, }\@ifundefined% by Young
       {b@\@citeb}{{\bf ?}%
       \@warning{Citation `\@citeb' on page \thepage \space undefined}}%
{\csname b@\@citeb\endcsname}}}{#1}}%
% don't box citations, separate with ; and a space
% also, make the penalty between citations negative: a good place to break.
%
\def\@citex[#1]#2{%
\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi%
  \def\@citea{}\@cite{\@for\@citeb:=#2\do%
    {\@citea\def\@citea{; }\@ifundefined% by Young
       {b@\@citeb}{{\bf ?}%
       \@warning{Citation `\@citeb' on page \thepage \space undefined}}%
{\csname b@\@citeb\endcsname}}}{#1}}%
% (from apalike.sty)
% No labels in the bibliography.
%
\def\@biblabel#1{}
% (from apalike.sty)
% Set length of hanging indentation for bibliography entries.
%
\newlength{\bibhang}
\setlength{\bibhang}{2em}
% Indent second and subsequent lines of bibliographic entries. Stolen
% from openbib.sty: \newblock is set to {}.
\newdimen\bibindent
\bibindent=1.5em
\@ifundefined{refname}%
   {\@ifundefined{chapter}%
     {\newcommand{\refname}{References}}%
     {\newcommand{\refname}{Bibliography}}%
   }%
   {}%
\@ifundefined{chapter}%
 {\def\thebibliography#1{\section*{\refname\@mkboth
   {\uppercase{\refname}}{\uppercase{\refname}}}\list
   {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}
   \leftmargin\labelwidth
   \advance\leftmargin\labelsep
   \advance\leftmargin\bibindent
   \itemindent -\bibindent
   \listparindent \itemindent
   \parsep \z@
   \usecounter{enumi}}
   \def\newblock{}
   \sloppy
   \sfcode`\.=1000\relax}}
 {\def\thebibliography#1{\chapter*{\refname\@mkboth
   {\uppercase{\refname}}{\uppercase{\refname}}}\list
   {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}
   \leftmargin\labelwidth
   \advance\leftmargin\labelsep
   \advance\leftmargin\bibindent
   \itemindent -\bibindent
   \listparindent \itemindent
   \parsep \z@
   \usecounter{enumi}}
   \def\newblock{}
   \sloppy
   \sfcode`\.=1000\relax}}
%
% any new definitions for MLA are below
%
\ifx\chapter\@undefined%
   \newcommand{\bibname}{Works Cited}% report style
\else
   \renewcommand{\refname}{Works Cited}% Article style
\fi
% Define the command \workscited{bib}{style}{nocite}
\newcommand{\workscited}[3]{%
  \ifx\chapter\@undefined%
    \addcontentsline{toc}{chapter}{\bfseries\bibname}% report style
  \else
    \addcontentsline{toc}{section}{\bfseries\refname}% Article style
  \fi
  \bibliography{#1}\bibliographystyle{#2}\nocite{#3}}
%
% defined the following for the annotated bibliography style
\newcommand{\annote}[1]{\begin{list}{}{%
              \setlength{\labelwidth}{0pt}
              \addtolength{\leftmargin}{\parindent}
              \setlength{\labelsep}{0pt}}%
              \item #1 \end{list}}
Optimal-Design-layout/natbib.sty · 44 KB

44 KB — too long to show here. It arrives with the project.

Optimal-Design-layout/wileyNJD-Chicago-lastoo.bst · 26 KB
%% File: `plainnat.bst'
%% A modification of `plain.bst' for use with natbib package 
%%
%% Copyright 1993-2007 Patrick W Daly
%% Max-Planck-Institut f\"ur Sonnensystemforschung
%% Max-Planck-Str. 2
%% D-37191 Katlenburg-Lindau
%% Germany
%% E-mail: [email protected]
%%
%% This program 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.
%%
 % Version and source file information:
 % \ProvidesFile{natbst.mbs}[2007/11/26 1.93 (PWD)]
 %
 % BibTeX `plainnat' family
 %   version 0.99b for BibTeX versions 0.99a or later,
 %   for LaTeX versions 2.09 and 2e.
 %
 % For use with the `natbib.sty' package; emulates the corresponding
 %   member of the `plain' family, but with author-year citations.
 %
 % With version 6.0 of `natbib.sty', it may also be used for numerical
 %   citations, while retaining the commands \citeauthor, \citefullauthor,
 %   and \citeyear to print the corresponding information.
 %
 % For version 7.0 of `natbib.sty', the KEY field replaces missing
 %   authors/editors, and the date is left blank in \bibitem.
 %
 % Includes field EID for the sequence/citation number of electronic journals
 %  which is used instead of page numbers.
 %
 % Includes fields ISBN and ISSN.
 %
 % Includes field URL for Internet addresses.
 %
 % Includes field DOI for Digital Object Idenfifiers.
 %
 % Works best with the url.sty package of Donald Arseneau.
 %
 % Works with identical authors and year are further sorted by
 %   citation key, to preserve any natural sequence.
 %
ENTRY
  { address
    author
    booktitle
    chapter
    doi
    eid
    edition
    editor
    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 {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}
{ duplicate$ empty$
    { pop$ "" }
    { "\emph{" swap$ * "}" * }
  if$
}

INTEGERS { nameptr namesleft numnames }

FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
      nameptr #1 >
        { namesleft #1 >
            { ", " * t * }
            { numnames #2 >
                { "," * }
                'skip$
              if$
              t "others" =
                { " et~al." * }
                { " and " * t * }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

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 >
        { ", editors" * }
        { ", editor" * }
      if$
    }
  if$
}

FUNCTION {format.isbn}
{ isbn empty$
    { "" }
    { new.block "ISBN " isbn * }
  if$
}

FUNCTION {format.issn}
{ issn empty$
    { "" }
    { new.block "ISSN " issn * }
  if$
}

FUNCTION {format.url}
{ url empty$
    { "" }
    { new.block "URL \url{" url * "}" * }
  if$
}

FUNCTION {format.doi}
{ doi empty$
    { "" }
    { new.block "\doi{" doi * "}" * }
  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$
              t "others" =
                { " et~al." * }
                { " and " * t * }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {author.editor.full}
{ author empty$
    { editor empty$
        { "" }
        { editor format.full.names }
      if$
    }
    { author format.full.names }
  if$
}

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

FUNCTION {editor.full}
{ editor empty$
    { "" }
    { editor format.full.names }
  if$
}

FUNCTION {make.full.names}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.full
    { type$ "proceedings" =
        'editor.full
        'author.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 {format.date}
{ year duplicate$ empty$
    { "empty year in " cite$ * warning$
       pop$ "" }
    'skip$
  if$
  month empty$
    'skip$
    { month
      " " * swap$ *
    }
  if$
  extra.label *
}

FUNCTION {format.btitle}
{ title emphasize
}

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$
    { "" }
    { "volume" volume tie.or.space.connect
      series empty$
        'skip$
        { " of " * 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 =
            { "number" }
            { "Number" }
          if$
          number tie.or.space.connect
          series empty$
            { "there's a number but no series in " cite$ * warning$ }
            { " in " * series * }
          if$
        }
      if$
    }
    { "" }
  if$
}

FUNCTION {format.edition}
{ edition empty$
    { "" }
    { output.state mid.sentence =
        { edition "l" change.case$ " edition" * }
        { edition "t" change.case$ " 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
        { "pages" pages n.dashify tie.or.space.connect }
        { "page" pages tie.or.space.connect }
      if$
    }
  if$
}

FUNCTION {format.eid}
{ eid empty$
    { "" }
    { "art." eid tie.or.space.connect }
  if$
}

FUNCTION {format.vol.num.pages}
{ volume field.or.null
  number empty$
    'skip$
    { "\penalty0 (" number * ")" * *
      volume empty$
        { "there's a number but no volume in " cite$ * warning$ }
        'skip$
      if$
    }
  if$
  pages empty$
    'skip$
    { duplicate$ empty$
        { pop$ format.pages }
        { ":\penalty0 " * pages n.dashify * }
      if$
    }
  if$
}

FUNCTION {format.vol.num.eid}
{ volume field.or.null
  number empty$
    'skip$
    { "\penalty0 (" number * ")" * *
      volume empty$
        { "there's a number but no volume in " cite$ * warning$ }
        'skip$
      if$
    }
  if$
  eid empty$
    'skip$
    { duplicate$ empty$
        { pop$ format.eid }
        { ":\penalty0 " * eid * }
      if$
    }
  if$
}

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

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

FUNCTION {empty.misc.check}
{ author empty$ title empty$ howpublished empty$
  month empty$ year empty$ note empty$
  and and and and and
  key empty$ not 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$
    { "Technical Report" }
    '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$
          ""
        }
        { "In \emph{" journal * "}" * }
      if$
    }
    { "In " }
  if$
  " \citet{" * crossref * "}" *
}

FUNCTION {format.book.crossref}
{ volume empty$
    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
      "In "
    }
    { "Volume" volume tie.or.space.connect
      " of " *
    }
  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$
              "" *
            }
            { "\emph{" * series * "}" * }
          if$
        }
        'skip$
      if$
    }
    'skip$
  if$
  " \citet{" * 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$
              ""
            }
            { "In \emph{" booktitle * "}" * }
          if$
        }
        { "In " }
      if$
    }
    { "In " }
  if$
  " \citet{" * crossref * "}" *
}

FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { journal emphasize "journal" output.check
      eid empty$
        { format.vol.num.pages output }
        { format.vol.num.eid output }
      if$
      format.date "year" output.check
    }
    { format.article.crossref output.nonnull
      eid empty$
        { format.pages output }
        { format.eid output }
      if$
    }
  if$
  format.issn output
  format.doi output
  format.url output
  new.block
  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$
  new.block
  format.btitle "title" output.check
  crossref missing$
    { format.bvolume output
      new.block
      format.number.series output
      new.sentence
      publisher "publisher" output.check
      address output
    }
    { new.block
      format.book.crossref output.nonnull
    }
  if$
  format.edition output
  format.date "year" output.check
  format.isbn output
  format.doi output
  format.url output
  new.block
  note output
  fin.entry
}




FUNCTION {booklet}
{ output.bibitem
  format.authors output
  author format.key output
  new.block
  format.title "title" output.check
  howpublished address new.block.checkb
  howpublished output
  address output
  format.date output
  format.isbn output
  format.doi output
  format.url output
  new.block
  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$
  new.block
  format.btitle "title" output.check
  crossref missing$
    { format.bvolume output
      format.chapter.pages "chapter and pages" output.check
      new.block
      format.number.series output
      new.sentence
      publisher "publisher" output.check
      address output
    }
    { format.chapter.pages "chapter and pages" output.check
      new.block
      format.book.crossref output.nonnull
    }
  if$
  format.edition output
  format.date "year" output.check
  format.isbn output
  format.doi output
  format.url output
  new.block
  note output
  fin.entry
}

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

FUNCTION {inproceedings}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.bvolume output
      format.number.series output
      format.pages output
      address empty$
        { organization publisher new.sentence.checkb
          organization output
          publisher output
          format.date "year" output.check
        }
        { address output.nonnull
          format.date "year" output.check
          new.sentence
          organization output
          publisher output
        }
      if$
    }
    { format.incoll.inproc.crossref output.nonnull
      format.pages output
    }
  if$
  format.isbn output
  format.doi output
  format.url output
  new.block
  note output
  fin.entry
}

FUNCTION {conference} { inproceedings }

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

FUNCTION {mastersthesis}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  new.block
  format.title "title" output.check
  new.block
  "Master's thesis" format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.date "year" output.check
  format.url output
  new.block
  note output
  fin.entry
}

FUNCTION {misc}
{ output.bibitem
  format.authors output
  author format.key output
  title howpublished new.block.checkb
  format.title output
  howpublished new.block.checka
  howpublished output
  format.date output
  format.issn output
  format.url output
  new.block
  note output
  fin.entry
  empty.misc.check
}

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

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

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

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

FUNCTION {default.type} { misc }

MACRO {jan} {"Jan."}

MACRO {feb} {"Feb."}

MACRO {mar} {"Mar."}

MACRO {apr} {"Apr."}

MACRO {may} {"May"}

MACRO {jun} {"June"}

MACRO {jul} {"July"}

MACRO {aug} {"Aug."}

MACRO {sep} {"Sept."}

MACRO {oct} {"Oct."}

MACRO {nov} {"Nov."}

MACRO {dec} {"Dec."}

MACRO {acmcs} {"ACM Computing Surveys"}

MACRO {acta} {"Acta Informatica"}

MACRO {cacm} {"Communications ACM"}

MACRO {ibmjrd} {"IBM J. Research and Development"}

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

MACRO {ieeese} {"IEEE Trans. Software Engineering"}

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

MACRO {ieeetcad}
 {"IEEE Trans. Computer-Aided Design"}

MACRO {ipl} {"Information Processing Letters"}

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

MACRO {jcss} {"J.~Computer and System Sciences"}

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

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

MACRO {tocs} {"ACM Trans. Computer Systems"}

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

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

MACRO {toms} {"ACM Trans. Mathematical Software"}

MACRO {toois} {"ACM Trans. Office Information Systems"}

MACRO {toplas} {"ACM Trans. Programming Languages and Systems"}

MACRO {tcs} {"Theoretical Computer Science"}

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$ " et~al." * }
    { #2 <
        'skip$
        { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
            { " et~al." * }
            { " and " * 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 {author.key.organization.label}
{ author empty$
    { key empty$
        { organization empty$
            { cite$ #1 #3 substring$ }
            { "The " #4 organization chop.word #3 text.prefix$ }
          if$
        }
        'key
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {editor.key.organization.label}
{ editor empty$
    { key empty$
        { organization empty$
            { cite$ #1 #3 substring$ }
            { "The " #4 organization chop.word #3 text.prefix$ }
          if$
        }
        'key
      if$
    }
    { editor format.lab.names }
  if$
}

FUNCTION {calc.short.authors}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.key.label
    { type$ "proceedings" =
        'editor.key.organization.label
        { type$ "manual" =
            'author.key.organization.label
            'author.key.label
          if$
        }
      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 "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
      nameptr #1 >
        {
          "   "  *
          namesleft #1 = t "others" = and
            { "zzzzz" * }
            { numnames #2 > nameptr #2 = and
                { "zz" * year field.or.null * "   " * }
                'skip$
              if$
              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 {author.organization.sort}
{ author empty$
    { organization empty$
        { key empty$
            { "to sort, need author, organization, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { "The " #4 organization chop.word sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {editor.organization.sort}
{ editor empty$
    { organization empty$
        { key empty$
            { "to sort, need editor, organization, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { "The " #4 organization chop.word sortify }
      if$
    }
    { editor sort.format.names }
  if$
}


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

ITERATE {presort}

SORT

STRINGS { longest.label last.label next.extra }

INTEGERS { longest.label.width last.extra.num number.label }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #0 int.to.chr$ 'last.label :=
  "" 'next.extra :=
  #0 'longest.label.width :=
  #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.longest.label}

ITERATE {forward.pass}

REVERSE {reverse.pass}

FUNCTION {bib.sort.order}
{ sort.label  '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$
  "\expandafter\ifx\csname urlstyle\endcsname\relax"
  write$ newline$
  "  \providecommand{\doi}[1]{doi: #1}\else"
  write$ newline$
  "  \providecommand{\doi}{doi: \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}
Optimal-Design-layout/wileyNJD-Chicago.bib · 10 KB
%==Ref1
@article{Hirt1974,
      author = "C. W. Hirt  and A. A. Amsden  and J. L. Cook",
       title = "An arbitrary Lagrangian-Eulerian computing method for all flow speeds",
        year = "1974",
     journal = "J Comput Phys",
      volume = "14",
      number = "3",
       pages = "227--253"
}

%==Ref2
@article{Benson1992,
      author = "D. J. Benson",
       title = "Computational methods in {L}agrangian and {E}ulerian hydrocodes",
        year = "1992",
     journal = "Comput Method Appl M",
      volume = "99",
      number = "2--3",
       pages = "235--394"
}

%==Ref3
@article{Dukowicz1984,
      author = "J. Dukowicz",
       title = "Conservative rezoning (remapping) for general quadrilateral meshes",
        year = "1984",
     journal = "J Comput Phys",
      volume = "54",
      number = "3",
       pages = "411--424"
}

%==Ref4
@article{Margolin2003,
      author = "L. G. Margolin and M. Shashkov",
       title = "Second-order sign-preserving conservative interpolation (remapping) on general grids",
        year = "2003",
     journal = "J Comput Phys",
      volume = "184",
      number = "1",
       pages = "266--298"
}

%==Ref5
@inproceedings{Kenamond2013,
      author = "M. A. Kenamond and D. E. Burton",
       title = "Exact intersection remapping of multi-material domain-decomposed polygonal meshes",
      series = "Talk at {M}ultimat 2013, {I}nternational {C}onference on {N}umerical {M}ethods for {M}ulti-{M}aterial {F}luid {F}lows",
organization = "The organization",
     address = "San {F}rancisco",
        year = "September 2--6, 2013",
        note = "LA-UR-13-26794"
}

%==Ref6
@inproceedings{Burton2013,
      author = "D. E. Burton and M. A. Kenamond and N. R. Morgan and T. C. Carney and M. J. Shashkov and A. B. Author",
       title = "An intersection based {ALE} scheme {(xALE)} for cell centered hydrodynamics {(CCH)}",
      series = "Talk at {M}ultimat 2013, {I}nternational {C}onference on {N}umerical {M}ethods for {M}ulti-{M}aterial {F}luid {F}lows",
     address = "San {F}rancisco",
organization = "The Organization", 
        year = "September 2--6, 2013",
        note = "LA-UR-13-26756.2"
}

%==Ref7
@article{Berndt2011,
      author = "M. Berndt  and J. Breil  and S. Galera and M. Kucharik and P. H. Maire  and M. Shashkov",
       title = "Two-step hybrid conservative remapping for multimaterial arbitrary {L}agrangian-{E}ulerian methods",
        year = "2011",
     journal = "J Comput Phys",
      volume = "230",
      number = "17",
       pages = "6664--6687"
}

%==Ref8
@article{Kucharik2012,
      author = "M. Kucharik and M. Shashkov",
       title = "One-step hybrid remapping algorithm for multi-material arbitrary {L}agrangian-{E}ulerian methods",
        year = "2012",
     journal = "J Comput Phys",
      volume = "231",
      number = "7",
       pages = "2851--2864"
}

%==Ref9
@article{Breil2015,
      author = "J. Breil and H. Alcin and P. H. Maire",
       title = "A swept intersection-based remapping method for axisymmetric {ReALE} computation",
        year = "2015",
     journal = "Int J Numer Meth Fl",
      volume = "77",
      number = "11",
       pages = "694--706",
        note = "Fld.3996"
}

%==Ref10
@InProceedings{Barth1997,
      author = "T. J. Barth",
       title = "Numerical methods for gasdynamic systems on unstructured meshes",
   booktitle = "An {I}ntroduction to {R}ecent {D}evelopments in {T}heory and {N}umerics for {C}onservation {L}aws, {P}roceedings of the {I}nternational {S}chool on {T}heory and {N}umerics for {C}onservation {L}aws",
      editor = "Kroner, D. and Rohde, C. and Ohlberger, M.",
     address = "Berlin",
      series = "Lecture {N}otes in {C}omputational {S}cience and {E}ngineering",
   publisher = "Springer",
        year = "1997",
        note = "ISBN 3-540-65081-4"
}

%==Ref11
@article{Liska2010,
      author = "R. Liska  and M. Shashkov  and P. Vachal and B. Wendroff and A. B. Author  and B. B. Author,  and C. C. Author",
       title = "Optimization-based synchronized flux-corrected conservative interpolation (remapping) of mass and momentum for arbitrary {L}agrangian-{E}ulerian methods",
        year = "2010",
     journal = "J {C}omput {P}hys",
      volume = "229",
      number = "5",
       pages = "1467--1497"
}

%==Ref12
@article{Kucharik2003,
      author = "M.  Kucharik and M. Shashkov and B. Wendroff",
       title = "An efficient linearity-and-bound-preserving remapping method",
        year = "2003",
     journal = "J {C}omput {P}hys",
      volume = "188",
      number = "2",
       pages = "462--471"
}

%==Ref13
@misc{Blanchard2015,
      author = "G. Blanchard and R. Loubere",
       title = "High-Order {C}onservative {R}emapping with a posteriori {MOOD} stabilization on polygonal meshes",
        year = "2015",
howpublished = "Details on how published",
	note = "\url{https://hal.archives-ouvertes.fr/hal-01207156}, the {HAL} {O}pen {A}rchive, hal-01207156. (accessed: January 13, 2016)"
}

%==Ref14
@article{Lauritzen2011,
      author = "P. Lauritzen and C.  Erath and R. Mittal",
       title = "On simplifying `incremental remap'-based transport schemes",
        year = "2011",
     journal = "J {C}omput {P}hys",
      volume = "230",
      number = "22",
       pages = "7957--7963"
}

%==Ref15
@article{Klima2017,
      author = "M. Klima and M. Kucharik and M. Shashkov",
       title = "Local error analysis and comparison of the swept- and intersection-based remapping methods",
        year = "2017",
     journal = "Commun {C}omput {P}hys",
      volume = "21",
      number = "2",
       pages = "526--558"
}

%==Ref16
@article{Dukowicz2000,
      author = "J. K. Dukowicz and J. R. Baumgardner",
       title = "Incremental remapping as a transport/advection algorithm",
        year = "2000",
     journal = "J {C}omput {P}hys",
      volume = "160",
      number = "1",
       pages = "318--335"
}

%==Ref17
@InProceedings{Kucharik2011,
      author = "M. Kucharik  and  M. Shashkov",
       title = "Flux-based approach for conservative remap of multi-material quantities in {2D} arbitrary {L}agrangian-{E}ulerian simulations",
   booktitle = "Finite {V}olumes for {C}omplex {A}pplications {VI} {P}roblems \& {P}erspectives",
      editor = "Fo\v{r}t, J. and F{\"{u}}rst, J. and Halama, J. and Herbin, R. and Hubert, F.",
      series = "Springer {P}roceedings in {M}athematics",
      volume = "1",
   publisher = "Springer",
        year = "2011",
       pages = "623--631"
}

%==Ref18
@article{Kucharik2014,
      author = "M. Kucharik  and M. Shashkov",
       title = "Conservative multi-material remap for staggered multi-material arbitrary {L}agrangian-{E}ulerian methods",
        year = "2014",
     journal = "J {C}omput {P}hys",
      volume = "258",
       pages = "268--304"
}

%==Ref19
@article{Loubere2005,
      author = "R. Loubere  and M. Shashkov",
       title = "A subcell remapping method on staggered polygonal grids for arbitrary-{L}agrangian-{E}ulerian methods",
        year = "2005",
     journal = "J {C}omput {P}hys",
      volume = "209",
      number = "1",
       pages = "105--138"
}

%==Ref20
@techreport{Margolin2002,
      author = "L. G. Margolin   and M. Shashkov",
       title = "Second-order sign-preserving remapping on general grids",
     address = "The address",
 institution = "Los {A}lamos {N}ational {L}aboratory",
        year = "2002",
      number = "Technical Report LA-UR-02-525"
}

%==Ref21
@inproceedings{Mavriplis2003,
      author = "D. J. Mavriplis",
       title = "Revisiting the least-squares procedure for gradient reconstruction on unstructured meshes",
        year = "June 23--26, 2003",
      series = "AIAA 2003-3986. 16th {AIAA} {C}omputational {F}luid {D}ynamics {C}onference",
organization = "The organization",
     address = "Orlando, {F}lorida"
}

%==Ref22
@article{Scovazzi2008,
      author = "G. Scovazzi  and E. Love  and M. Shashkov",
       title = "Multi-scale {L}agrangian shock hydrodynamics on {Q1/P0} finite elements: {T}heoretical framework and two-dimensional computations",
        year = "2008",
     journal = "Comput {M}ethod {A}ppl {M}",
      volume = "197",
      number = "9--12",
       pages = "1056--1079"
}

%==Ref23
@article{Caramana1998,
      author = "E. J. Caramana  and M. J. Shashkov",
       title = "Elimination of artificial grid distortion and hourglass-type motions by means of {L}agrangian subzonal masses and pressures",
        year = "1998",
     journal = "J {C}omput {P}hys",
      volume = "142",
      number = "2",
       pages = "521--561"
}

%==Ref24
@techreport{Hoch2009,
      author = "P. Hoch",
       title = "An arbitrary {L}agrangian-{E}ulerian strategy to solve compressible fluid flows",
      number = "Technical {R}eport",
 institution = "CEA",
     address = "The address",
        note = "HAL: hal-00366858. https://hal.archives-ouvertes.fr/docs/00/36/68/58/PDF/ale2d.pdf. Accessed January 13, (2016)"
}

%==Ref25
@book{Shashkov1996,
      author = "M. Shashkov",
       title = "Conservative {F}inite-{D}ifference {M}ethods on {G}eneral {G}rids",
   publisher = "CRC {P}ress",
     address = "Boca Raton, Florida",
        year = "1996",
        note = "ISBN 0-8493-7375-1"
}

%==Ref26
@article{Knupp1999,
      author = "P. M. Knupp",
       title = "Winslow smoothing on two-dimensional unstructured meshes",
        year = "1999",
     journal = "Eng {C}omput",
      volume = "15",
       pages = "263--268"
}

%==Ref27
@techreport{kamm2000,
      author = "J. Kamm",
       title = "Evaluation of the {S}edov-von {N}eumann-{T}aylor blast wave solution",
 institution = "Los {A}lamos {N}ational {L}aboratory",
     address = "The address",
        year = "2000",
      number = "Technical {R}eport LA-UR-00-6055"
}

%==Ref28
@article{Taylor1937,
      author = "G. I. Taylor  and A. E. Green",
       title = "Mechanism of the production of small eddies from large ones",
        year = "1937",
     journal = "P {R}oy {S}oc {L}ond {A} {M}at",
      volume = "158",
      number = "895",
       pages = "499--521",
        note = "\url{https://doi.org/10.1098/rspa.1937.0036}, \url{http://rspa.royalsocietypublishing.org/content/158/895/499}"
}

Optimal-Design-layout/wileyNJD-Chicago.bst · 39 KB
%%% ====================================================================
%%%  @BibTeX-style-file{
%%%     author          = "Glenn Paulley",
%%%     version         = "4",
%%%     date            = "28 August 1992",
%%%     time            = "10:23:39 199",
%%%     filename        = "chicago.bst",
%%%     address         = "Data Structuring Group
%%%                        Department of Computer Science
%%%                        University of Waterloo
%%%                        Waterloo, Ontario, Canada
%%%                        N2L 3G1",
%%%     telephone       = "(519) 885-1211",
%%%     FAX             = "(519) 885-1208",
%%%     checksum        = "26323 1654 5143 37417",
%%%     email           = "[email protected]",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "",
%%%     supported       = "yes",
%%%     abstract        = "A BibTeX bibliography style that follows the
%%%                        `B' reference style of the 13th Edition of
%%%                        the Chicago Manual of Style. A detailed
%%%                        feature list is given below.",
%%%     docstring       = "The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility.",
%%%  }
%%% ====================================================================
%
% "Chicago" BibTeX style, chicago.bst
% ===================================
%
% BibTeX `chicago' style file for BibTeX version 0.99c, LaTeX version 2.09
% Place it in a file called chicago.bst in the BibTeX search path.
% You need to include chicago.sty as a \documentstyle option.
% (Placing it in the same directory as the LaTeX document should also work.)
% This "chicago" style is based on newapa.bst (American Psych. Assoc.)
% found at ymir.claremont.edu.
%
%   Citation format: (author-last-name)
%             (author-last-name and author-last-name )
%             (author-last-name, author-last-name, and author-last-name year)
%             (author-last-name et al. year)
%             (author-last-name)
%             author-last-name (year)
%             (author-last-name and author-last-name)
%             (author-last-name et al.)
%             (year) or (year,year)
%             year or year,year
%
%   Reference list ordering: alphabetical by author or whatever passes
%    for author in the absence of one.
%
% This BibTeX style has support for abbreviated author lists and for
%    year-only citations.  This is done by having the citations
%    actually look like
%
%    \citeauthoryear{full-author-info}{abbrev-author-info}{year}
%
% The LaTeX style has to have the following (or similar)
%
%     \let\@internalcite\cite
%     \def\fullcite{\def\citeauthoryear##1##2##3{##1, ##3}\@internalcite}
%     \def\fullciteA{\def\citeauthoryear##1##2##3{##1}\@internalcite}
%     \def\shortcite{\def\citeauthoryear##1##2##3{##2, ##3}\@internalcite}
%     \def\shortciteA{\def\citeauthoryear##1##2##3{##2}\@internalcite}
%     \def\citeyear{\def\citeauthoryear##1##2##3{##3}\@internalcite}
%
% These TeX macro definitions are found in chicago.sty. Additional
% commands to manipulate different components of a citation can be defined
% so that, for example, you can list author's names without parentheses
% if using a citation as a noun or object in a sentence.
%
% This file was originally copied from newapa.bst at ymir.claremont.edu.
%
% Features of chicago.bst:
% =======================
%
% - full names used in citations, but abbreviated citations are available
%   (see above)
% - if an entry has a "month", then the month and year are also printed
%   as part of that bibitem.
% - all conjunctions use "and" instead of "\&"
% - major modification from Chicago Manual of Style (13th ed.) is that
%   only the first author in a reference appears last name first-
%   additional authors appear as J. Q. Public.
% - pages are listed as "pp. xx-xx" in all entry types except
%   article entries.
% - book, inbook, and manual use "location: publisher" (or organization)
%   for address and publisher. All other types list publishers separately.
% - "pp." are used to identify page numbers for all entry types except
%   articles.
% - organization is used as a citation label if neither author nor editor
%   is present (for manuals).
% - "et al." is used for long author and editor lists, or when "others"
%   is used.
%
% Modifications and bug fixes from newapa.bst:
% ===========================================
%
%   - added month, year to bib entries if month is present
%   - fixed bug with In proceedings, added necessary comma after title
%   - all conjunctions changed to "and" from "\&"
%   - fixed bug with author labels in my.full.label: "et al." now is
%        generated when "others" is an author name
%   - major modification from Chicago Manual of Style (13th ed.) is that
%     only the first author in a reference appears last name first-
%     additional authors appear as J. Q. Public.
%   - pages are listed as "pp. xx-xx" in all entry types except
%     article entries. Unnecessary (IMHO) "()" around page numbers
%     were removed, and page numbers now don't end with a period.
%   - created chicago.sty for use with this bibstyle (required).
%   - fixed bugs in FUNCTION {format.vol.num.pages} for missing volume,
%     number, and /or pages. Renamed to format.jour.vol.
%   - fixed bug in formatting booktitles: additional period an error if
%     book has a volume.
%   - fixed bug: editors usually given redundant period before next clause
%     (format.editors.dot) removed.
%   - added label support for organizations, if both author and editor
%     are missing (from alpha.bst). If organization is too long, then
%     the key field is used for abbreviated citations.
%   - In proceedings or books of several volumes, no comma was written
%     between the "Volume x" and the page numbers (this was intentional
%     in newapa.bst). Fixed.
%   - Some journals may not have volumes/numbers, only month/year (eg.
%     IEEE Computer). Fixed bug in article style that assumed volume/number
%     was always present.
%
% Original documentation for newapa.sty:
% =====================================
%
% This version was made by modifying the master file made by
% Oren Patashnik ([email protected]), and the 'named' BibTeX
% style of Peter F. Patel-Schneider.
%
% Copyright (C) 1985, all rights reserved.
% Copying of this file is authorized only if either
% (1) you make absolutely no changes to your copy, including name, or
% (2) if you do make changes, you name it something other than 'newapa.bst'.
% There are undoubtably bugs in this style.  If you make bug fixes,
% improvements, etc.  please let me know.  My e-mail address is:
%    [email protected] or [email protected]
%
% This style was made from 'plain.bst', 'named.bst', and 'apalike.bst',
% with lots of tweaking to make it look like APA style, along with tips
% from Young Ryu and Brian Reiser's modifications of 'apalike.bst'.

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

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

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
}

% Use a colon to separate output. Used only for address/publisher
% combination in book/inbook types, address/institution for manuals,
% and organization:publisher for proceedings (inproceedings).
%
FUNCTION {output.nonnull.colon}
{ '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.colon}
{ duplicate$ empty$
    'pop$
    'output.nonnull.colon
  if$
}

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

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

FUNCTION {output.year.check}
{ year empty$
     { "empty year in " cite$ * warning$ }
     { write$
        " " year * extra.label *
       month empty$
          { "" * }
          { ", " * month * ")" * }
       if$
       mid.sentence 'output.state :=
     }
  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 {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$
}

%
% Emphasize the top string on the stack.
%
FUNCTION {emphasize}
{ duplicate$ empty$
    { pop$ "" }
    { "{\it " swap$ * "}" * }
  if$
}

%
% Emphasize the top string on the stack, but add a trailing space.
%
FUNCTION {emphasize.space}
{ duplicate$ empty$
    { pop$ "" }
    { "{\it " swap$ * "\/}" * }
  if$
}

INTEGERS { nameptr namesleft numnames }
%
% Format bibliographical entries with the first author last name first,
% and subsequent authors with initials followed by last name.
% All names are formatted in this routine.
%
FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
      nameptr #1 >
        { namesleft #1 >
            { ", " * t * }
            { numnames #2 >
                { "," * }
                'skip$
              if$
              t "others" =
                { " et~al." * }
                 { ", and " * t * "."} % from Chicago Manual of Style
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {my.full.label}
{ 's :=
  #1 'nameptr :=               % nameptr = 1;
  s num.names$ 'numnames :=    % numnames = num.name$(s);
  numnames 'namesleft :=
    { namesleft #0 > }

    { s nameptr "{vv~}{ll}" format.name$ 't :=  % get the next name
      nameptr #1 >
        { namesleft #1 >
              { ", " * t * }
              { numnames #2 >
                  { "," * }
                  'skip$
                if$
                t "others" =
                    { " et~al." * }
                    { " and " * t *  } % from Chicago Manual of Style
                  if$
               }
               if$
             }
            't
        if$
        nameptr #1 + 'nameptr :=          % nameptr += 1;
        namesleft #1 - 'namesleft :=      % namesleft =- 1;
    }
  while$

}

FUNCTION {format.names.fml}
%
% Format names in "familiar" format, with first initial followed by
% last name. Like format.names, ALL names are formatted.
%
{ 's :=
  #1 'nameptr :=               % nameptr = 1;
  s num.names$ 'numnames :=    % numnames = num.name$(s);
  numnames 'namesleft :=
    { namesleft #0 > }

    { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := %f.

      nameptr #1 >
        { namesleft #1 >
              { ", " * t * }
               { numnames #2 >
                    { "," * }
                    'skip$
                  if$
                  t "others" =
                        { " et~al." * }
                        { " and " * t * }
%                       { " \& " * t * }
                      if$
                }
               if$
             }
            't
        if$
        nameptr #1 + 'nameptr :=          % nameptr += 1;
        namesleft #1 - 'namesleft :=      % namesleft =- 1;
    }
  while$
}

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

FUNCTION {format.key}
{ empty$
    { key field.or.null }
    { "" }
  if$
}

%
% Format editor names for use in the "in" types: inbook, incollection,
% inproceedings: first initial, then last names. When editors are the
% LABEL for an entry, then format.editor is used which lists editors
% by last name first.
%

%%FUNCTION {format.editors.fml}
%%{ editor empty$
%%    { "" }
%%    { editor format.names.fml
%%      editor num.names$ #1 >
%%    { " (Eds.)" * }
%%    { " (Ed.)" * }
%%      if$
%%    }
%%  if$
%%}

FUNCTION {format.editors.fml}
{ editor empty$
    { "" }
    { "ed. " editor format.names.fml
      editor num.names$ #1 >
    { * }
    { * }
      if$
    }
  if$
}

FUNCTION {format.editors.byfml}
{ editor empty$
    { "" }
    { "edited by " editor format.names.fml
      editor num.names$ #1 >
    { * }
    { * }
      if$
    }
  if$
}

%
% Format editor names for use in labels, last names first.
%
FUNCTION {format.editors}
{ editor empty$
    { "" }
    { editor format.names
      editor num.names$ #1 >
    { " (Eds.)" * }
    { " (Ed.)" * }
      if$
    }
  if$
}



FUNCTION {format.title}
{ title empty$
    { "" }
%    { title "t" change.case$ }
     { "``" title * ".''  "  * } 	
  if$
}

FUNCTION {format.title.article}
{ title empty$
    { "" }
    { "``" title * ".''  "  * } 
  if$
}

% Note that the APA style requres case changes
% in article titles. The following does not
% change cases. If you perfer it, uncomment the
% following and comment out the above.

%FUNCTION {format.title}
%{ title empty$
%    { "" }
%    { title }
%  if$
%}

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 {format.btitle}
{ edition empty$
  { title emphasize }
  { title empty$
    { title emphasize }
    { volume empty$     % gnp - check for volume, then don't need period
       { "{\it " title * "\/} (" * edition * " ed.)" * "." * }
       { "{\it " title * "\/} (" * edition * " ed.)" * }
      if$
    }
    if$
  }
  if$
}

FUNCTION {format.emphasize.booktitle}
{ edition empty$
  { booktitle emphasize }
  { booktitle empty$
    { booktitle emphasize }
    { volume empty$    % gnp - extra period an error if book has a volume
        { "{\it " booktitle * "\/} (" * edition * " ed.)" * "." *}
        { "{\it " booktitle * "\/} (" * edition * " ed.)" * }
      if$
      }
    if$
    }
  if$
  }


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$
    { "" }
    { "Vol" volume tie.or.space.connect % gnp - changed to mixed case
      series empty$
        'skip$
        { " of " * series emphasize * }
      if$
      "volume and number" number either.or.check
    }
  if$
}



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



FUNCTION {format.number.series}
{ volume empty$
    { number empty$
    { series field.or.null }
    { output.state mid.sentence =
        { "Number" } % gnp - changed to mixed case always
        { "Number" }
      if$
      number tie.or.space.connect
      series empty$
        { "there's a number but no series in " cite$ * warning$ }
        { " in " * series * }
      if$
    }
      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
	{ "pp.\ " pages n.dashify tie.or.space.connect } % gnp - removed ()
	{ "pp.\ " pages tie.or.space.connect }
    if$
  }
  if$
}

FUNCTION {format.nopppages}
{ pages empty$
  { "" }
  { pages multi.page.check
	{ " " pages n.dashify tie.or.space.connect } % gnp - removed ()
	{ " " pages tie.or.space.connect }
    if$
  }
  if$
}

% By Young (and Spencer)
% GNP - fixed bugs with missing volume, number, and/or pages
%
% Format journal, volume, number, pages for article types.
%
FUNCTION {format.jour.vol}
{ journal empty$
    { "no journal in " cite$ * warning$
      "" }
    { journal emphasize.space }
    if$
  number empty$
    { volume empty$
       { "no number and no volume in " cite$ * warning$
         "" * }
       { "~{" * Volume * "}" * }
      if$
    }
    { volume empty$
      {"no volume for " cite$ * warning$
       ", no. " * number * "" * }
      { "~" *
%        volume.space 
        ", no. " * number * "" * * }
      if$
    } %emphasize
  if$
  pages empty$
    {"page numbers missing in " cite$ * warning$
     "" * } % gnp - place a null string on the stack for output
    { duplicate$ empty$
      { pop$ format.pages }
      { ": " *  pages n.dashify * } % gnp - removed pp. for articles
      if$
    }
  if$
}

FUNCTION {format.jour.vol.num}
{ journal empty$
    { "no journal in " cite$ * warning$
      "" }
    { journal emphasize.space }
    if$
  number empty$
    { volume empty$
       { "no number and no volume in " cite$ * warning$
         "" * }
      {  *  Volume   * }
      if$
    }
    {  volume empty$
      {"no volume for " cite$ * warning$
       ", no. " * number * "" * }
      { "~" *
		volume * ", no. " * number * "" * * }
      if$
    } %emphasize
  if$
  pages empty$
    {"page numbers missing in " cite$ * warning$
     "" * } % gnp - place a null string on the stack for output
    { duplicate$ empty$
      { pop$ format.pages }
      { " (" * year * "): " *  pages n.dashify * } % gnp - removed pp. for articles
      if$
    }
  if$
}

FUNCTION {format.chapter.pages}
{ chapter empty$
    'format.pages
    { type empty$
        { "Chapter" } % gnp - changed to mixed case
        { type "t" change.case$ }
      if$
      chapter tie.or.space.connect
      pages empty$
        {"page numbers missing in " cite$ * warning$} % gnp - added check
        { ", " * format.pages * }
      if$
    }
  if$
}

%FUNCTION {putnodot}
%{post.title 'output.state :=}

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

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



%%FUNCTION {format.in.ed.booktitle}
%%{ booktitle empty$
%%  { "" }
%%  { editor empty$
%%    { "In " format.emphasize.booktitle * }
%%    { "In " format.editors.fml * ", " * format.emphasize.booktitle * }
%%    if$
%%  }
%%  if$
%%}

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

FUNCTION {format.in.ed.volbooktitle}
{ booktitle empty$
  { "" }
  { editor empty$
    { "In " format.emphasize.booktitle * }
    { "In " format.emphasize.booktitle * ", " * format.bvolume * ", " * format.editors.byfml * }
    if$
  }
  if$
}



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

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

FUNCTION {format.article.crossref}
{ "See"
  "\citeN{" * crossref * "}" *
}

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

FUNCTION {format.book.crossref}
{ volume empty$
    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
      "In "
    }
    { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
      " of " *
    }
  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$
          "" *
        }
        { "{\em " * series * "\/}" * }
      if$
    }
    { key * }
      if$
    }
    { format.crossref.editor * }
  if$
  " \citeN{" * crossref * "}" *
}

FUNCTION {format.incoll.inproc.crossref}
{ "See"
  " \citeN{" * crossref * "}" *
}

% format.lab.names:
%
% determines "short" names for the abbreviated author information.
% "Long" labels are created in calc.label, using the routine my.full.label
% to format author and editor fields.
%
% There are 4 cases for labels.   (n=3 in the example)
% a) one author             Foo
% b) one to n               Foo, Bar and Baz
% c) use of "and others"    Foo, Bar et al.
% d) more than n            Foo et al.
%
FUNCTION {format.lab.names}
{ 's :=
  s num.names$ 'numnames :=
  numnames #2 >    % change number to number of others allowed before
		   % forcing "et al".
    { s #1 "{vv~}{ll}" format.name$ " et~al." * }
    {
      numnames #1 - 'namesleft :=
      #2 'nameptr :=
      s #1 "{vv~}{ll}" format.name$
	{ namesleft #0 > }
	{ nameptr numnames =
	    { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
		{ " et~al." * }
		{ " and " * s nameptr "{vv~}{ll}" format.name$ * }
	      if$
	    }
	    { ", " * s nameptr "{vv~}{ll}" format.name$ * }
	  if$
	  nameptr #1 + 'nameptr :=
	  namesleft #1 - 'namesleft :=
	}
      while$
    }
  if$
}

FUNCTION {author.key.label}
{ author empty$
    { key empty$
          { "no key, author in " cite$ * warning$
            cite$ #1 #3 substring$ }
         'key
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {editor.key.label}
{ editor empty$
    { key empty$
          { "no key, editor in " cite$ * warning$
            cite$ #1 #3 substring$ }
          'key
        if$
     }
     { editor format.lab.names }
  if$
}

FUNCTION {author.key.organization.label}
%
% added - gnp. Provide label formatting by organization if author is null.
%
{ author empty$
    { organization empty$
	{ key empty$
	    { "no key, author or organization in " cite$ * warning$
              cite$ #1 #3 substring$ }
	    'key
	  if$
	}
        { organization }
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {editor.key.organization.label}
%
% added - gnp. Provide label formatting by organization if editor is null.
%
{ editor empty$
    { organization empty$
	{ key empty$
	    { "no key, editor or organization in " cite$ * warning$
              cite$ #1 #3 substring$ }
	    'key
	  if$
	}
        { organization }
      if$
    }
    { editor format.lab.names }
  if$
}

FUNCTION {author.editor.key.label}
{ author empty$
    { editor empty$
          { key empty$
               { "no key, author, or editor in " cite$ * warning$
                 cite$ #1 #3 substring$ }
             'key
           if$
         }
          { editor format.lab.names }
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {calc.label}
%
% Changed - GNP. See also author.organization.sort, editor.organization.sort
% Form label for BibTeX entry. The classification of which fields are used
% for which type of entry (book, inbook, etc.) are taken from alpha.bst.
% The change here from newapa is to also include organization as a
% citation label if author or editor is missing.
%
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.key.label
    { type$ "proceedings" =
	'editor.key.organization.label
	{ type$ "manual" =
	    'author.key.organization.label
	    'author.key.label
	  if$
	}
      if$
    }
  if$

  author empty$  % generate the full label citation information.
    { editor empty$
        { organization empty$
           { "no author, editor, or organization in " cite$ * warning$
             "??" }
           { organization }
           if$
        }
        { editor my.full.label }
        if$
    }
    { author my.full.label }
  if$

% leave label on the stack, to be popped when required.

  "}{" * swap$ * "}{" *
%  year field.or.null purify$ #-1 #4 substring$ *
%
% save the year for sort processing afterwards (adding a, b, c, etc.)
%
  year field.or.null purify$ #-1 #4 substring$
  'label.year :=
}

FUNCTION {output.bibitem}
{ newline$

  "\bibitem[\protect\citeauthoryear{" write$
  calc.label write$
  sort.year write$
  "}]{" write$

  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}



FUNCTION {article}
{ output.bibitem
  format.authors
  "author" output.check
  author format.key output          % added
  new.block
  format.title.article
  "title" output.check
   new.block
    crossref missing$
    { format.jour.vol.num output
    }
    { format.article.crossref output.nonnull
      format.pages output
	  "year"
    }
  if$
  new.block
  note output
  fin.entry
}



FUNCTION {magazine}
{ output.bibitem
  format.authors
  "author" output.check
  author format.key output          % added
%  output.year.check                 % added
  new.block
  format.title.article
  "title" output.check
  del.comma
    crossref missing$
    { format.jour.vol output
    }
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
  date output
  add.comma
  year output
  new.block
  note output
  fin.entry
}

FUNCTION {paper}
{ output.bibitem
  format.authors output
  author format.key output          % added
  output.year.check                 % added
  new.block
  format.title
  "title" output.check
  del.comma
  howpublished output
  number output
  new.block
  address output
  new.block
  date output 
  new.block  
  note output
  fin.entry
}



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$
  output.year.check       % added
  new.block
  title emphasize output  
%  "title" output.check
  crossref missing$
    { title output
	format.editors.byfml
	format.bvolume output
      new.block
      format.number.series output
      new.sentence
      address output
      publisher "publisher" output.check.colon
    }
    { new.block
      format.book.crossref output.nonnull
    }
  if$
  new.block
  note output
  fin.entry
}


FUNCTION {booklet}
{ output.bibitem
  format.authors output
  author format.key output          % added
  output.year.check                 % added
  new.block
  format.title
  "title" output.check
  new.block
  howpublished output
  address output
  new.block
  note output
  fin.entry
}

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$
  output.year.check                 % added
  new.block
  format.btitle
  "title" output.check
  crossref missing$
    { format.bvolume output
      format.chapter.pages
      "chapter and pages" output.check
      new.block
      format.number.series output
      new.sentence
      address output
      publisher
      "publisher" output.check.colon
    }
    { format.chapter.pages "chapter and pages" output.check
      new.block
      format.book.crossref output.nonnull
    }
  if$
  new.block
  note output
  fin.entry
}

FUNCTION {booked}
{ output.bibitem
  author empty$
    { 
	format.editors.fml output.check
    }
    {  format.authors output.nonnull
	format.editors.fml output.check
      crossref missing$
    { "author and editor" editor either.or.check }
    'skip$
      if$
    }
  if$
  output.year.check                 % added
  new.block
  format.btitle
  "title" output.check
  crossref missing$
    { format.bvolume output
      format.chapter.pages
      "chapter and pages" output.check
      new.block
      format.number.series output
      new.sentence
      address output
      publisher
      "publisher" output.check.colon
    }
    { format.chapter.pages "chapter and pages" output.check
      new.block
      format.book.crossref output.nonnull
    }
  if$
  new.block
  note output
  fin.entry
}

FUNCTION {incollection}
{ output.bibitem
  format.authors
  "author" output.check
  author format.key output            % added
  output.year.check                   % added
  new.block
  format.title
  "title" output.check
  del.comma
  crossref missing$
    { 
	  format.in.ed.volbooktitle
	  "booktitle" output.check
       format.number.series output
	  add.comma
      format.nopppages output
	  new.block
	  address output
	  organization output
      publisher output.colon
      }
    { format.incoll.inproc.crossref output.nonnull
      format.pages output
    }
  if$
  new.block
  note output
  fin.entry
}


FUNCTION {inproceedings}
{ output.bibitem
  format.authors
  "author" output.check
  author format.key output            % added
  output.year.check                   % added
  new.block
  format.title
  "title" output.check
  del.comma
  crossref missing$
    { 
	  format.in.ed.booktitle
	  "booktitle" output.check
	   format.bvolume output
       format.number.series output
	  add.comma
      format.nopppages output
	  new.block
	  address output
	  organization output
      publisher output.colon
      }
    { format.incoll.inproc.crossref output.nonnull
      format.pages output
    }
  if$
  new.block
  note output
  fin.entry
}

FUNCTION {conference} { inproceedings }

FUNCTION {manual}
{ output.bibitem
  author empty$
    { editor empty$
      { organization "organization" output.check
        organization format.key output }  % if all else fails, use key
      { format.editors "author and editor" output.check }
      if$
    }
    { format.authors output.nonnull }
    if$
  output.year.check                 % added
  new.block
  format.btitle
  "title" output.check
  organization address new.block.checkb
% Reversed the order of "address" and "organization", added the ":".
  address output
  organization "organization" output.check.colon
%  address output
%  ":" output
%  organization output
  new.block
  note output
  fin.entry
}

FUNCTION {mastersthesis}
{ output.bibitem
  format.authors
  "author" output.check
  author format.key output          % added
  output.year.check                 % added
  new.block
  format.title
  "title" output.check
  del.comma
  "MS thesis" format.thesis.type output.nonnull
  add.comma
  publisher output
  school "school" output.check
  address output
  new.block
  note output
  fin.entry
}

FUNCTION {misc}
{ output.bibitem
  format.authors output
  author format.key output            % added
  output.year.check                   % added
  title howpublished new.block.checkb
  format.title output
  del.comma
  howpublished output
  add.comma
  date output
  new.block
  note output
  fin.entry
}

FUNCTION {phdthesis}
{ output.bibitem
  format.authors
  "author" output.check
  author format.key output            % added
  output.year.check                   % added
  new.block
  format.title
  "title" output.check
  del.comma
 % "PhD" format.thesis.type output.nonnull
  series output 
  add.comma
  publisher output
  new.block
  note output
  fin.entry
}

FUNCTION {proceedings}
{ output.bibitem
  editor empty$
    { organization output
      organization format.key output }  % gnp - changed from author format.key
    { format.editors output.nonnull }
  if$
% author format.key output             % gnp - removed (should be either
%                                        editor or organization
  output.year.check                    % added (newapa)
  new.block
  format.btitle
  "title" output.check
  format.bvolume output
  format.number.series output
  address output
  new.sentence
  organization output
  publisher output.colon
  new.block
  note output
  fin.entry
}

FUNCTION {techreport}
{ output.bibitem
  format.authors
  "author" output.check
  author format.key output             % added
  output.year.check                    % added
  new.block
  format.title
  "title" output.check
  del.comma
  format.tr.number output.nonnull
  institution
  "institution" output.check
  address output
  new.block
  note output
  fin.entry
}

FUNCTION {unpublished}
{ output.bibitem
  format.authors
  "author" output.check
  author format.key output              % added
  output.year.check                      % added
  new.block
  format.title
  "title" output.check
  new.block
  note "note" output.check
  fin.entry
}

FUNCTION {default.type} { misc }

MACRO {jan} {"January"}

MACRO {feb} {"February"}

MACRO {mar} {"March"}

MACRO {apr} {"April"}

MACRO {may} {"May"}

MACRO {jun} {"June"}

MACRO {jul} {"July"}

MACRO {aug} {"August"}

MACRO {sep} {"September"}

MACRO {oct} {"October"}

MACRO {nov} {"November"}

MACRO {dec} {"December"}

MACRO {acmcs} {"ACM Computing Surveys"}

MACRO {acta} {"Acta Informatica"}

MACRO {ai} {"Artificial Intelligence"}

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

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$ " et~al." * }
    { #2 <
        'skip$
        { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
            { " et~al." * }
            { " and " * 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 {author.key.organization.label}
{ author empty$
    { key empty$
        { organization empty$
            { cite$ #1 #3 substring$ }
            { "The " #4 organization chop.word #3 text.prefix$ }
          if$
        }
        'key
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {editor.key.organization.label}
{ editor empty$
    { key empty$
        { organization empty$
            { cite$ #1 #3 substring$ }
            { "The " #4 organization chop.word #3 text.prefix$ }
          if$
        }
        'key
      if$
    }
    { editor format.lab.names }
  if$
}

FUNCTION {calc.short.authors}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.key.label
    { type$ "proceedings" =
        'editor.key.organization.label
        { type$ "manual" =
            'author.key.organization.label
            'author.key.label
          if$
        }
      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 :=
}

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 *
  #1 entry.max$ substring$
  'sort.key$ :=
}

ITERATE {presort}

SORT

STRINGS { longest.label last.label next.extra }

INTEGERS { longest.label.width last.extra.num number.label }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #0 int.to.chr$ 'last.label :=
  "" 'next.extra :=
  #0 'longest.label.width :=
  #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.longest.label}

ITERATE {forward.pass}

REVERSE {reverse.pass}

FUNCTION {bib.sort.order}
{ sort.label  '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$
  "\expandafter\ifx\csname urlstyle\endcsname\relax"
  write$ newline$
  "  \providecommand{\doi}[1]{doi: #1}\else"
  write$ newline$
  "  \providecommand{\doi}{doi: \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 ↗