% \iffalse meta-comment
%
% Copyright (C) 1994-2013 Erik Meijer and any individual authors listed
% elsewhere in this file.
%
% This file is part of the `apacite' package.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3 of this license or (at your option) any later
% version.  The latest version of this license is in:
%
%    http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of
% LaTeX version 2005/12/01 or later.
%
% The `apacite' package consists of the files apacite.dtx and
% apacite.ins, and the following generated files:
% apacite.sty, apacdoc.sty,  apacite.drv,
% apacite.bst, apacitex.bst, apacann.bst,  apacannx.bst,
% apa5ex.bib,  apacxmpl.tex,
% english.apc, dutch.apc,    finnish.apc,  french.apc,
% german.apc,  ngerman.apc,  greek.apc,    norsk.apc,
% spanish.apc, swedish.apc.
%
% This work has the LPPL maintenance status `maintained'
%
% The Current Maintainer of this work is Erik Meijer
%
% This file may only be distributed together with a copy of the
% source files of the apacite package, i.e., apacite.dtx and
% apacite.ins. You may however distribute the apacite package without
% the generated files.
%
% \fi
%
% \CheckSum{0}
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \iffalse
%<*dtx>
\ProvidesFile{apacite.dtx}
   [2013/07/21 v6.03 apacite dtx file]
%</dtx>
%<driver>\ProvidesFile{apacite.drv}
%<package|docpkg>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{apacite}
%<docpkg>\ProvidesPackage{apacdoc}
%<english>\ProvidesFile{english.apc}
%<dutch>\ProvidesFile{dutch.apc}
%<finnish>\ProvidesFile{finnish.apc}
%<german>\ProvidesFile{german.apc}
%<ngerman>\ProvidesFile{ngerman.apc}
%<greek>\ProvidesFile{greek.apc}
%<norsk>\ProvidesFile{norsk.apc}
%<spanish>\ProvidesFile{spanish.apc}
%<swedish>\ProvidesFile{swedish.apc}
%<xmpl>%% apacxmpl.tex
%<bibdb>%% apa5ex.bib
%<bibstyle&!annotated>%% apacite.bst
%<bibstyle&annotated>%% apacann.bst
%<xbibstyle&!annotated>%% apacitex.bst
%<xbibstyle&annotated>%% apacannx.bst
%^^A
%^^A I have to find out how I can replace the hard-coded date+version with a
%^^A command such that the value of the command is written to the file instead
%^^A of the name.
%^^A
%<driver>   [2013/07/21 v6.03 apacite documentation driver file]
%<package>   [2013/07/21 v6.03 APA citation]
%<docpkg>   [2013/07/21 v6.03 apacite documentation style]
%<english>   [2013/07/21 v6.03 apacite language file]
%<dutch>   [2013/07/21 v6.03 apacite language file]
%<finnish>   [2013/07/21 v6.03 apacite language file]
%<german>   [2013/07/21 v6.03 apacite language file]
%<ngerman>   [2013/07/21 v6.03 apacite language file]
%<greek>   [2013/07/21 v6.03 apacite language file]
%<norsk>   [2013/07/21 v6.03 apacite language file]
%<spanish>   [2013/07/21 v6.03 apacite language file]
%<swedish>   [2013/07/21 v6.03 apacite language file]
%<xmpl>%%   [2013/07/21 v6.03 LaTeX file for examples]
%<bibdb>%%   [2013/07/21 v6.03 bibliography database for examples]
%<bibstyle&!annotated>%%   [2013/07/21 v6.03 APA bibliography style]
%<*xbibstyle&!annotated>
%%   [2013/07/21 v6.03 APA bibl. style with author index info]
%</xbibstyle&!annotated>
%<bibstyle&annotated>%%   [2013/07/21 v6.03 APA annotated bibliography style]
%<*xbibstyle&annotated>
%%   [2013/07/21 v6.03 APA annotated bibl. style with author index info]
%</xbibstyle&annotated>
%
%<*install>
%^^A =============================================
%^^A    Here is the docstrip installation file
%^^A    It is written on first LaTeX run if it
%^^A    does not already exist
%^^A =============================================
\begin{filecontents*}{apacite.ins}
%%
%% This file will generate fast loadable files and documentation
%% driver files from apacite.dtx when run through LaTeX.
%%
%% Copyright (C) 1994-2013 Erik Meijer and any individual authors listed
%% elsewhere in this file.
%%
%% This file is part of the `apacite' package.
%% -------------------------------------------
%%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version.  The latest version of this license is in:
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
%% The `apacite' package consists of the files apacite.dtx and
%% apacite.ins, and the following generated files:
%% apacite.sty, apacdoc.sty,  apacite.drv,
%% apacite.bst, apacitex.bst, apacann.bst,  apacannx.bst,
%% apa5ex.bib,  apacxmpl.tex,
%% english.apc, dutch.apc,    finnish.apc,  french.apc,
%% german.apc,  ngerman.apc,  greek.apc,    norsk.apc,
%% spanish.apc, swedish.apc.
%%
%% This work has the LPPL maintenance status `maintained'
%%
%% The Current Maintainer of this work is Erik Meijer
%%
%% This file may only be distributed together with a copy of the
%% source files of the apacite package, i.e., apacite.dtx and
%% apacite.ins. You may however distribute the apacite package without
%% the generated files.

\input docstrip.tex
\keepsilent

\declarepreamble\mainpreamble

This is a generated file.

Copyright (C) 1994-2013 Erik Meijer and any individual authors listed
elsewhere in this file.

This file is part of the `apacite' package.
-------------------------------------------

It may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
version 1.3 of this license or (at your option) any later
version.  The latest version of this license is in:

   http://www.latex-project.org/lppl.txt

and version 1.3 or later is part of all distributions of
LaTeX version 2005/12/01 or later.

The `apacite' package consists of the files apacite.dtx and
apacite.ins, and the following generated files:
apacite.sty, apacdoc.sty,  apacite.drv,
apacite.bst, apacitex.bst, apacann.bst,  apacannx.bst,
apa5ex.bib,  apacxmpl.tex,
english.apc, dutch.apc,    finnish.apc,  french.apc,
german.apc,  ngerman.apc,  greek.apc,    norsk.apc,
spanish.apc, swedish.apc.

This work has the LPPL maintenance status `maintained'

The Current Maintainer of this work is Erik Meijer

This file may only be distributed together with a copy of the
source files of the apacite package, i.e., apacite.dtx and
apacite.ins. You may however distribute the apacite package without
the generated files.

\endpreamble

\declarepreamble\drvpreamble

This is a generated file.

Copyright (C) 1994-2013 Erik Meijer and any individual authors listed
elsewhere in this file.

This file is part of the `apacite' package.
-------------------------------------------

It may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
version 1.3 of this license or (at your option) any later
version.  The latest version of this license is in:

   http://www.latex-project.org/lppl.txt

and version 1.3 or later is part of all distributions of
LaTeX version 2005/12/01 or later.

The `apacite' package consists of the files apacite.dtx and
apacite.ins, and the following generated files:
apacite.sty, apacdoc.sty,  apacite.drv,
apacite.bst, apacitex.bst, apacann.bst,  apacannx.bst,
apa5ex.bib,  apacxmpl.tex,
english.apc, dutch.apc,    finnish.apc,  french.apc,
german.apc,  ngerman.apc,  greek.apc,    norsk.apc,
spanish.apc, swedish.apc.

This work has the LPPL maintenance status `maintained'

The Current Maintainer of this work is Erik Meijer

This file may only be distributed together with a copy of the
source files of the apacite package, i.e., apacite.dtx and
apacite.ins. You may however distribute the apacite package without
the generated files.

You are allowed to make changes to this file, in order to generate
the user's manual with your preferred settings (e.g., to choose
whether or not to include the documented source code). Please
do not change apacite.dtx for this purpose.

\endpreamble

\edef\noendinputpostamble{%
  \MetaPrefix ^^J%
  \MetaPrefix\space End of file `\outFileName'.%
}

\askonceonly
\generate{%
  \usepreamble\mainpreamble
  \file{apacite.sty}{\from{apacite.dtx}{package}}
  \file{apacdoc.sty}{\from{apacite.dtx}{docpkg}}
  \file{english.apc}{\from{apacite.dtx}{english}}
  \file{dutch.apc}{\from{apacite.dtx}{dutch}}
  \file{finnish.apc}{\from{apacite.dtx}{finnish}}
  \file{french.apc}{\from{apacite.dtx}{french}}
  \file{german.apc}{\from{apacite.dtx}{german}}
  \file{ngerman.apc}{\from{apacite.dtx}{ngerman}}
  \file{greek.apc}{\from{apacite.dtx}{greek}}
  \file{norsk.apc}{\from{apacite.dtx}{norsk}}
  \file{spanish.apc}{\from{apacite.dtx}{spanish}}
  \file{swedish.apc}{\from{apacite.dtx}{swedish}}
  \file{apacxmpl.tex}{\from{apacite.dtx}{xmpl}}
  \usepreamble\drvpreamble
  \file{apacite.drv}{\from{apacite.dtx}{driver}}
  \usepreamble\mainpreamble
  \usepostamble\noendinputpostamble
  \file{apa5ex.bib}{\from{apacite.dtx}{bibdb}}
  \file{apacite.bst}{\from{apacite.dtx}{bibstyle}}
  \file{apacitex.bst}{\from{apacite.dtx}{xbibstyle}}
  \file{apacann.bst}{\from{apacite.dtx}{bibstyle,annotated}}
  \file{apacannx.bst}{\from{apacite.dtx}{xbibstyle,annotated}}
}

\obeyspaces
\Msg{*****************************************************}
\Msg{*                                                   *}
\Msg{* To finish the installation you have to move the   *}
\Msg{* following files into a directory searched by TeX: *}
\Msg{*                                                   *}
\Msg{*     All *.apc, *.sty                              *}
\Msg{*                                                   *}
\Msg{* and to move the following files into a directory  *}
\Msg{* searched by BibTeX:                               *}
\Msg{*                                                   *}
\Msg{*     All *.bib, *.bst                              *}
\Msg{*                                                   *}
\Msg{* To produce the documentation, run the following   *}
\Msg{* script (or something similar, depending on your   *}
\Msg{* operating system):                                *}
\Msg{*                                                   *}
\Msg{*  pdflatex apacite.drv                             *}
\Msg{*  bibtex   apacite                                 *}
\Msg{*  pdflatex apacite.drv                             *}
\Msg{*  pdflatex apacite.drv                             *}
\Msg{*  pdflatex apacite.drv                             *}
\Msg{*  makeindex -o apacite.and apacite.adx             *}
\Msg{*  pdflatex apacite.drv                             *}
\Msg{*  pdflatex apacite.drv                             *}
\Msg{*                                                   *}
\Msg{* See the README file for a brief explanation and   *}
\Msg{* the file apacite.drv for how to customize the     *}
\Msg{* manual (e.g., to include the documented source    *}
\Msg{* code.                                             *}
\Msg{*                                                   *}
\Msg{* Happy TeXing!                                     *}
\Msg{*                                                   *}
\Msg{*****************************************************}

\endbatchfile
\end{filecontents*}
%</install>
%<*gobble>
\IfFileExists{apacdoc.sty}{%
    \let\finishprematurely\relax
}{%
    \typeout{**************************************************%
             ********************}%
    \typeout{*}%
    \typeout{* To extract the package, style, and support files
             of apacite,}%
    \typeout{* run TeX on apacite.ins}%
    \typeout{*}%
    \typeout{* To (re)generate the apacite documentation, first
             run TeX on}%
    \typeout{* apacite.ins and then run LaTeX on apacite.drv
             or apacite.dtx}%
    \typeout{*}%
    \typeout{**************************************************%
             ********************^^J}%
    \makeatletter
    \edef\finishprematurely{\csname @@end\endcsname}%
    \makeatother
}
\finishprematurely
%</gobble>
% \fi
%
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs}
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage}
% \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions}
% \DoNotIndex{\AtEndOfClass,\AtEndOfPackage,\AtBeginDocument,\AtEndDocument}
% \DoNotIndex{\InputIfFileExists,\IfFileExists,\ClassError,\PackageError}
% \DoNotIndex{\ClassWarning,\PackageWarning,\ClassWarningNoLine}
% \DoNotIndex{\PackageWarningNoLine,\ClassInfo,\PackageInfo,\MessageBreak}
% \DoNotIndex{\space,\protect,\DeclareRobustCommand,\CheckCommand}
% \DoNotIndex{\newcommand,\renewcommand,\providecommand,\newenvironment}
% \DoNotIndex{\renewenvironment,\newif,\newlength,\newcounter,\setlength}
% \DoNotIndex{\setcounter,\if,\ifx,\ifcase,\ifnum,\ifdim,\else,\fi}
% \DoNotIndex{\texttt,\textbf,\textrm,\textsl,\textsc,\reset@font}
% \DoNotIndex{\textup,\textit,\textmd,\textsf,\emph,\futurelet}
% \DoNotIndex{\ttfamily,\rmfamily,\sffamily,\mdseries,\bfseries,\upshape}
% \DoNotIndex{\slshape,\scshape,\itshape,\em,\LaTeX,\LaTeXe}
% \DoNotIndex{\filename,\fileversion,\filedate,\let,\makeindex}
% \DoNotIndex{\@auxout,\@for,\@gobble,\@ifnextchar,\@m,\@mkboth,\@nil}
% \DoNotIndex{\@noitemerr,\@tempa,\@tempswafalse,\@tempswatrue,\@warning}
% \DoNotIndex{\advance,\arabic,\AtBeginDocument,\bf,\bibname,\chapter}
% \DoNotIndex{\citation,\clubpenalty,\CodelineNumbered,\csname}
% \DoNotIndex{\DisableCrossrefs,\do,\edef,\else,\endcsname,\endlist}
% \DoNotIndex{\expandafter,\fi,\gdef,\global,\hbox,\hfill,\hskip,\hspace}
% \DoNotIndex{\if,\if@filesw,\if@tempswa,\ifx,\immediate,\itemindent,\labelsep}
% \DoNotIndex{\labelwidth,\lastskip,\leftmargin,\list,\mbox,\newblock}
% \DoNotIndex{\newpage,\p@enumiv,\parindent,\penalty,\refname}
% \DoNotIndex{\relax,\section,\settowidth,\sfcode,\sloppy,\small,\string}
% \DoNotIndex{\theenumiv,\thepage,\unskip,\uppercase,\usecounter,\vskip}
% \DoNotIndex{\widowpenalty,\write,\xdef,\z@,\catcode,\ifnum,\the}
% \DoNotIndex{\@empty,\@ifundefined,\@latex@warning,\@minus,\@plus,\ }
% \DoNotIndex{\document,\@namedef,\@listi,\markboth,\or,\p@}
% \DoNotIndex{\listparindent,\noexpand,\par,\parsep,\pb,\pbf,\pbfseries}
% \DoNotIndex{\pc,\pd,\pem,\pit,\pitshape,\pmdseries,\prm,\prmfamily,\psc}
% \DoNotIndex{\pscshape,\psf,\psffamily,\psl,\pslshape,\ptt,\pttfamily}
% \DoNotIndex{\pupshape,\@iden,\@firstofone,\@unexpandable@protect}
% \DoNotIndex{\if@draft,\typeout}
% \DoNotIndex{\@ifclassloaded,\@ifstar,\@onlypreamble,\@preamblecmds}
% \DoNotIndex{\addtolength,\endinput,\@bsphack,\begingroup,\@wrindex}
% \DoNotIndex{\@listctr,\bibname,\enddocument,\hfil,\ignorespaces,\item}
% \DoNotIndex{\NAT@temp,\refname,\stepcounter,\@ifpackageloaded}
% \DoNotIndex{\@gobbletwo,\index,\itemsep,\markright,\scriptsize}
% \DoNotIndex{\textsuperscript,\@undefined}
% \DoNotIndex{\@celt,\@cite@list,\@citea,\@citeb,\@compress@cite}
% \DoNotIndex{\@bsphack,\@esphack,\@h@ld,\@make@cite@list,\@ne}
% \DoNotIndex{\@sort@celt,\@tempcnta,\@tempcntb,\delimiter,\endgroup}
% \DoNotIndex{\ifcat,\m@ne,\number}
% \DoNotIndex{\@markboth,\@mkboth,\nobreak,\SK@,\SK@@citex}
% \DoNotIndex{\SK@@label,\SK@@ref,SK@def,\SK@lbibitem,\bbl@redefine}
% \DoNotIndex{\@safe@activesfalse,\@save@activestrue,\active@prefix}
%
% \DoNotIndex{\ ,\&,\{,\},\.,\!,\",\#,\%,\',\(,\),\*,\,,\-,\/}
% \DoNotIndex{\:,\;,\<,\=,\>,\?,\@,\[,\\,\],\^,\_,\`,\|,\~}
% \DoNotIndex{\@backslashchar,\@citec,\@element@,\@input@,\@nameuse}
% \DoNotIndex{\@makeschapterhead,\@restonecolfalse,\@restonecoltrue}
% \DoNotIndex{\@old@endthebibliography,\@oldbibpreamble,\@orig@@cite}
% \DoNotIndex{\@orig@@nocitemeta,\@orig@nocite}
% \DoNotIndex{\@tmp@arg,\@xp,\AA,\aa,\addcontentsline}
% \DoNotIndex{\afterassignment,\aftergroup,\alph,\ast,\b@ex}
% \DoNotIndex{\backslash,\baselineskip,\BibTeX,\bigskip,\bs}
% \DoNotIndex{\clearpage,\cmd,\cmdfour,\cmdthree,\cmdthreealt}
% \DoNotIndex{\cmdthreepre,\cmdtwo,\columnsep,\columnseprule,\count@}
% \DoNotIndex{\dag,\do@url@hyp,\EM,\ensuremath,\entryname,\envirname}
% \DoNotIndex{\evensidemargin,\fieldname,\flqq,\fname,\fontencoding}
% \DoNotIndex{\fontfamily,\footnotesize,\footskip,\frqq}
% \DoNotIndex{\g@addto@macro,\GlossaryPrologue,\headheight,\headsep}
% \DoNotIndex{\hoffset,\if@mainmatter,\ifcodeline@index,\iffalse}
% \DoNotIndex{\ifhave@multicol,\index@prologue,\IndexMin,\IndexParms}
% \DoNotIndex{\IndexPrologue,\input,\jobname,\kern,\langle,\LaTeXrtf}
% \DoNotIndex{\latextohtml,\lbrace,\LC,\ldots,\linewidth,\lower}
% \DoNotIndex{\makeatletter,\makeatother,\MakeIndex,\MakeUppercase}
% \DoNotIndex{\marginparpush,\marginparsep,\marginparwidth,\mid}
% \DoNotIndex{\mathbin,\mathchar,\mathord,\newskip,\newwrite}
% \DoNotIndex{\normalsize,\oddsidemargin,\oldBED,\oldBEd,\oldBEDS}
% \DoNotIndex{\oldbibinitial,\oldbibliteral,\oldbibskipbracenodot}
% \DoNotIndex{\oldBIn,\oldBRetrieved,\oldevensidemargin,\oldfootskip}
% \DoNotIndex{\oldheadheight,\oldheadsep,\oldhoffset,\oldlinewidth}
% \DoNotIndex{\oldmarginparpush,\oldmarginparsep,\oldmarginparwidth}
% \DoNotIndex{\oldoddsidemargin,\oldtextheight,\oldtextwidth}
% \DoNotIndex{\oldtopmargin,\oldvoffset,\onecolumn,\openout,\opt}
% \DoNotIndex{\orig@printindex,\origbibDSM,\parskip,\Perl,\pfill}
% \DoNotIndex{\pkg,\pkgoption,\protected@edef,\protected@write}
% \DoNotIndex{\quad,\raggedright,\raisebox,\rangle,\rbrace,\rm,\sc}
% \DoNotIndex{\selectfont,\simpleguillemots,\symbol,\TeX,\TeXht}
% \DoNotIndex{\textheight,\textwidth,\thinspace,\thispagestyle}
% \DoNotIndex{\thr@@,\times,\tiny,\topmargin,\triangleright}
% \DoNotIndex{\twocolumn,\undefined,\voffset,\vspace,\X,\Y}
%
% \iffalse
%<*driver>
\documentclass{ltxdoc}
%<driver>%\documentclass[twoside]{ltxdoc}
%<driver>%\documentclass[a4paper]{ltxdoc}
%<driver>%\documentclass[twoside,a4paper]{ltxdoc}
%%
\usepackage{apacdoc}[2013/07/21 v6.03]
%% The |\providecommand|s make sure we don't get an error during
%% installation.
%% Define document-specific macros that are not interesting for
%% users.
\providecommand{\SetupAPACdoc}{}%
\SetupAPACdoc
%% Document page layout.
\providecommand{\APACdocPageLayout}{}%
\APACdocPageLayout
%% Index styles for the source code documentation
\providecommand{\SetupAPACdocPrologues}{}%
\SetupAPACdocPrologues
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LOADING OF PACKAGES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The following line is used for references to internet sources.
%% It is not generally necessary for apacite, but used in the examples.
\usepackage{url}
%%
%% Loading apacite with author index option.
\usepackage[ltxemindex,bibnewpage]{apacite}[2013/07/21 v6.03]
%%
\raggedbottom
%%
%% To include the detailed explanation of the coding, comment out
%% the next line
\OnlyDescription
%%
%% To produce a command index: add the following line for one run,
%% then run  makeindex -s gind.ist apacite
%% and reprocess, with or without this line (much faster without)
%<driver>% \EnableCrossrefs\CodelineIndex
%%
%% To produce a change history: add the following line for one run,
%% then run  makeindex -s gglo.ist -o apacite.gls apacite.glo
%% and reprocess, with or without this line (faster without)
%<driver>% \RecordChanges
%%
\DisableCrossrefs % May stay; zapped by \EnableCrossrefs
\CodelineNumbered % May stay
%%
\begin{document}
  \DocInput{apacite.dtx}
\end{document}
%</driver>
% \fi
%
% ^^A (I have to find out how to get the following remark in the right
% ^^A place in the documentation.)
% ^^A The earlier version numbers have been assigned retroactively;
% ^^A originally, apacite had only release dates.
%
% \changes{v1.0}{1994/11/30}{First public version}
% \changes{v2.0}{2000/09/22}{Second packaged version, the result of
%   continuous updating over many years. Not officially released through
%   ctan because there was no update of the documentation, but this was
%   available through my homepage at the time. Many additions in terms
%   of customizability, and introduction of the author indexing
%   facilities, which were first used in my PhD thesis in 1998.}
% \changes{v2.1}{2003/03/27}{First official release since 1994. Compared
%   to 2.0, this primarily solved some important compatibility problems
%   with other packages.}
% \changes{v2.2}{2003/09/05}{Updated for the 5th edition of the APA
%   manual, up to date documentation and test document, reorganized the
%   material, and improved compatibility.}
% \changes{v3.0}{2004/07/01}{Now adds initials if necessary to
%   distinguish first authors; now adds 2nd and later authors if necessary
%   to distinguish references; now truncates author list after 6th author
%   and editor list after 1st in reference list if there are more than 6
%   authors/editors; improved sorting for reference list; improved author
%   index support; added explicit support for reporting a meta-analysis.}
% \changes{v3.1}{2005/06/01}{Introduces explicit non-English language
%   support, solves some compatibility problems.}
% \changes{v3.2}{2005/06/08}{Fix of a small but annoying bug.}
% \changes{v4.00}{2007/09/03}{Solved many compatibility issues; improved
%   and extended language support; more extensive customizability.}
% \changes{v4.05}{2009/03/01}{Some bug fixes; extended language support;
%   annotated bibliographies.}
% \changes{v6.00}{2012/02/14}{First step toward compliance with v6 of
%   the APA manual; version number now indicates which version of the APA
%   manual is implemented.}
% \changes{v6.01}{2012/02/25}{Bug fix}
% \changes{v6.02}{2013/07/04}{Bug fixes}
% \changes{v6.03}{2013/07/21}{Thesis formatting adapted to 6th edition
%   requirements}
%
% \GetFileInfo{apacite.sty}
%
% \setcounter{IndexColumns}{2}
% \setlength{\IndexMin}{10cm}
%
% ^^A Start documentation here.
%
%
% \iffalse
%<*dtx>
% \fi
\MakePercentComment
%
% User's reference manual and test of the apacite package.
% Written by Erik Meijer
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% START OF ``NORMAL'' PART OF DOCUMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{The \pkg{apacite} package%
       \thanks{This document describes \pkg{apacite} version~\fileversion{}
       dated \filedate.}
       \vspace{0.3\baselineskip}\\
       \large Citation and reference list with \LaTeX{} and \BibTeX{}
       according to the rules of the American Psychological Association}
\author{Erik Meijer\\
        \textsf{apacite at gmail.com}
}
\date{\filedate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% If ecmr (T1) font not available:
\simpleguillemots
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{abstract}
  \noindent
  This document describes and tests the \pkg{apacite} package
  \APACversiondate{\filedate}. This is a package that can be used with
  \LaTeX{} and \BibTeX{} to generate citations and a reference list,
  formatted according to the rules of the American Psychological Association.
  Furthermore, \pkg{apacite} contains an option to (almost) automatically
  generate an author index as well. The package can be customized in many
  ways.
\end{abstract}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\clearpage
\tableofcontents
\clearpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The American Psychological Association (APA) is very strict about the style in
which manuscripts submitted to its journals are written and formatted. The
requirements of the APA are described in the \emph{Publication Manual of the
American Psychological Association}, the latest version of which is the 6th
edition \cite{APAManual6}. In the sequel, this is simply called the \emph{APA
manual}.

The APA manual discusses how candidate authors should write their manuscripts:
writing style, parts of a manuscript and their order, presentation of the
results in the form of tables and figures, and so forth. Candidate authors
should study this and adhere to this.

The APA manual also gives specific rules about the formatting of a manuscript.
This includes double spacing, a running head, the typographic style of section
headings, the placement of tables and figures on separate pages at the end of
the document, and so forth. \LaTeX{} users will recognize these as ``style''
elements that should be defined in a package (\fname{.sty} file) or class
(\fname{.cls} file). Their specific documents (\fname{.tex} file) should be
largely style-independent. This idea of separating content and logical
structure from specific formatting is one of the basic elements of \LaTeX{}
\cite[p.~7]{LaTeXbook}.

An implementation of the formatting rules of the APA manual for use with
\LaTeX{} is the \pkg{apa6} class by Brian Beitzel, which is a continuation of
the earlier \pkg{apa} class by Athanassios Protopapas. This handles all kinds of
issues about general document formatting, title page, section headings, figures
and tables, and so forth. Therefore, if you intend to submit a manuscript to an
APA journal, I strongly recommend using the \pkg{apa6} class.

An important part of the APA style is the way citations and the reference list
should be formatted. This takes 56 pages in the APA manual (pp.~169--224). This
part is not handled by the \pkg{apa6} class, but by the \pkg{apacite} package.
\pkg{apacite} can be used without \pkg{apa6}. The current document, for example,
does not use the \pkg{apa6} class, because I find it desirable that possible
users can study the \pkg{apacite} package and its documentation without having
to install several other classes and packages first. Therefore, the current
document uses standard \LaTeX{} as much as possible. (The \pkg{apa} class used
to require the \pkg{apacite} package, but this was dropped because there is now
also the \pkg{biblatex-apa} citation package as an alternative to
\pkg{apacite}.)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection*{Philosophy of \pkg{apacite}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The first priority of \pkg{apacite} is to implement the rules of the APA manual
with regard to citation and reference list as closely as possible. However, just
like its predecessors (culminating in Young U. Ryu's \pkg{theapa} package), and
actually expanding much beyond their realm, \pkg{apacite} offers many
possibilities for customization as well. Many details of \pkg{apacite},
particularly punctuation and some fixed texts (e.g., ``Tech.\ Rep.'') can be
changed easily by the user by redefining some commands in \LaTeX{}. Furthermore,
\pkg{apacite} also offers several proper options to change some of its settings.

Whether certain options or customizable aspects are implemented depends on two
criteria: (1) Is it possible, easy (enough), and convenient to implement them
without compromising the ability to adhere to the APA rules, and (2) Do I (EM)
consider them important or useful enough to spend time to implement them.
Actually, the decision process is the reverse of this: First, I decide whether
I find it a relevant or useful option. If not, I will not implement it. If so,
I will think about if and how I can implement it. If I have an idea for a
solution that is practically feasible, I will pursue it. If I don't see a
solution, if I think it will take me too much time, or if I think a solution
will be inconvenient to other users, then I will not pursue it.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection*{New in this version}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Changes with respect to the previous version (v6.02,
\APACversiondate{2013/07/04}):
\begin{itemize}

\item
Thesis formatting (\entryname{@phdthesis}, \entryname{@mastersthesis})
rewritten in order to conform to the 6th edition of the APA Manual.

\item
Added the \cmd{\APACaddressSchool} and \cmd{\APACtypeAddressSchool}
commands to facilitate customization of the formatting of theses.

\item
Added the \cmd{\APACredefineOnce} command to \fname{apacdoc.sty}.

\item
Added examples 31--44 from the APA manual to \fname{apacxmpl.tex} and
\fname{apa5ex.bib}.

\item
Improved source code documentation in the \fname{.dtx} file.

\item
Some minor changes and bug fixes.

\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection*{About this document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The current document describes how to use \pkg{apacite} and largely assumes
knowledge of or access to the standard \BibTeX{} documentation, such as
\citeA{Pata88}, \citeA[Chapter~12]{KoDa04}, or \citeA[Chapters~12 and~13]{TLC2}.
Hence, this document does not always describe how to use some of the citation
commands or how to construct a bibliography database file in detail if there
is no \pkg{apacite}-specific element to it. This document comes in two
versions. The version supplied with the distribution is the user's manual.
As is customary with packages that are distributed in \fname{.dtx} form, it is
also possible to regenerate the user's manual in such a way that it includes
the documented source code of the package as well. This is currently still
in a primitive form compared to other packages, but it will be improved
with later releases. The \fname{README} file describes how the documented
source code can be included in this manual. \citeA{meijer07} contains some
simple examples in which \pkg{apacite} is compared to standard \LaTeX/\BibTeX{}
citation, as well as a description of how \pkg{apacite} works technically.

{\bfseries Note that this manual is not completely up to date.}
This is primarily the case for the specific discussion of the examples
in section~\ref{sec:xmpl}, which focus on the 5th edition of the APA
manual, but there may be some obsolete discussions or omissions elsewhere
in the document as well.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Installation, package loading, and running \BibTeX{}}
\label{sec:usage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pkg{apacite} is distributed as a \fname{.dtx} file, like
most \LaTeX{} packages. The file \fname{apacite.dtx} is supplemented by a
\fname{README} file, which gives a brief introduction and installation
instructions, the user's manual in the file \fname{apacite.pdf} (which you are
reading right now), and the installation file \fname{apacite.ins}. Strictly
speaking, only the \fname{apacite.dtx} file is necessary, because the
installation file is regenerated from it if it is not available, and the user's
manual is generated by running \LaTeX{} on \fname{apacite.dtx}. But it is
customary (and convenient for potential users) to include the other files as
well.

The \LaTeX{} packages, \BibTeX{} style files, and other files in the
distribution are generated by running \LaTeX{} on \fname{apacite.ins}.
This generates the following files:
\begin{description}
\item[\fname{apacite.sty}] The \LaTeX{} citation package. This must
  be placed in a directory where \TeX{} can find it.
\item[\fname{apacite.bst}] The \BibTeX{} reference list style. This
  must be placed in a directory where \BibTeX{} can find it.
\item[\fname{apacitex.bst}] The \BibTeX{} reference list style with
  added author index support. This must also be placed in a directory
  where \BibTeX{} can find it.
\item[\fname{apacann.bst}]
\item[\fname{apacannx.bst}] Versions of \fname{apacite.bst} and
  \fname{apacitex.bst} that generate annotated bibliographies (if the
  \fieldname{annote} and/or \fieldname{annotate} fields are provided). Again,
  these must be placed in a directory where \BibTeX{} can find it. Most
  probably, some time in the future, the four \fname{.bst} files will be
  combined in \fname{apacite.bst}, with the desired behavior induced by
  options, but this is nontrivial and currently not implemented yet.
\item[\fname{apacxmpl.tex}] \LaTeX{} file that (with the bibliography
  database) implements the examples from the APA manual.
  This can best be kept in the same directory as \fname{apacite.dtx}.
\item[\fname{apa5ex.bib}] The file with bibliographic information
  of the examples from the APA manual, this user's manual.
  This is useful for users to find out how
  certain nontrivial problems can be solved. This can best be kept
  in the same directory as \fname{apacite.dtx}.
\item[\fname{apacite.drv}] Documentation driver. Run \LaTeX{} on this
  file to regenerate the user's manual. This is the current document,
  and can also be ontained by running \LaTeX{} on \fname{apacite.dtx},
  but you can edit the file \fname{apacite.drv} to change some settings,
  e.g., choose whether or not the documented source code must be
  included in the manual or not. Please don't edit \fname{apacite.dtx}
  itself. The file \fname{apacite.drv} can best be kept
  in the same directory as \fname{apacite.dtx}.
\item[\fname{*.apc}] Language-specific modifications of \pkg{apacite}.
  See section~\ref{sec:compat-babel} for a discussion of these.
  These must be placed in a directory where \LaTeX{} can find them.
  The files that are currently supplied are \fname{english.apc},
  \fname{dutch.apc},  \fname{finnish.apc}, \fname{french.apc},
  \fname{german.apc}, \fname{ngerman.apc}, \fname{greek.apc},
  \fname{norsk.apc},  \fname{spanish.apc}, and \fname{swedish.apc}.
\item[\fname{apacdoc.sty}] A \LaTeX{} package that contains commands
  and settings used in this user's manual. This can be placed in a
  directory where \TeX{} can find it, but given that it is primarily
  useful for processing the user's manual and not intended as a
  package for wider usage, it can also be left in the same directory as
  \fname{apacite.dtx}. See section~\ref{sec:apacdoc} for a further discussion
  of this package.
\end{description}

The \fname{apacite.sty} \LaTeX{} package is loaded by putting
\mbox{}\vspace{0.7\baselineskip}\\
\cmdthreealt{usepackage}{options}{apacite}
\mbox{}\vspace{0.7\baselineskip}\\
somewhere in your document between \cmd{\documentclass} and
|\begin{document}|, or putting
\mbox{}\vspace{0.7\baselineskip}\\
\cmdthreealt{RequirePackage}{options}{apacite}
\mbox{}\vspace{0.7\baselineskip}\\
in your own personal \LaTeX{} package (say, \fname{mysettings.sty})
that is loaded by your document.

To load the \fname{apacite.bst} or \fname{apacitex.bst} bibliography style in
\BibTeX{}, put
\mbox{}\vspace{0.7\baselineskip}\\
|\bibliographystyle{apacite}|
\mbox{}\vspace{0.7\baselineskip}\\
(or |apacitex|, |apacann|, or |apacannx|) in your document
before the \cmd{\bibliography} command. The
position of the bibliography (reference list) is determined by the line
\mbox{}\vspace{0.7\baselineskip}\\
\cmdtwo{bibliography}{bibfiles}
\mbox{}\vspace{0.7\baselineskip}\\
where \opt{bibfiles} is a list of filenames with \fname{.bib} extension, which
contain the bibliographic information that is used by \BibTeX{} to construct the
reference list. Usually, the \cmd{\bibliographystyle} and \cmd{\bibliography}
are kept together (immediately follow each other) in the document, although when
you are using the \pkg{apa6} document class with \pkg{apacite} support, the
\cmd{\bibliographystyle} is defined by the class and you are not supposed to use
the \cmd{\bibliographystyle} command yourself. See the documentation of the
\pkg{apa6} documentclass for details about this.

If you use one of the author indexing options, the author index is put in
the \LaTeX{} output by the line
\begin{verbatim}
\printindex[autx]
\end{verbatim}
If you put this line in your document, but don't use one of the author
indexing options, it will be ignored. For more on author indexing, see
section~\ref{sec:autindex}.

To get all parts in the final output, the following sequence of runs should
typically be taken (when starting from scratch): (1) \LaTeX{}, (2) \BibTeX{},
(3) \LaTeX{}, (4) \LaTeX{}, and, when author indexing is on, (5) \MakeIndex{},
(6) \LaTeX{}, and (7) \LaTeX{}. The last one is to get the index in the table
of contents. If the table of contents is on a regular page, i.e., an
arabic-numbered page instead of a roman-numbered page in the front matter, it
may even be necessary to run \MakeIndex{} another time, followed by \LaTeX{}
once or twice. Occasionally, somewhere in the process, \LaTeX{} may complain
about labels that may have changed, which requires even more additional
\LaTeX{} runs at that stage. So the number of runs that are necessary to get
everything right may become large.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Package options}
\label{sec:options}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The following options are recognized by \pkg{apacite}:
\begin{description}
\item[\pkgoption{apaciteclassic}]
\item[\pkgoption{natbibapa}]
\item[\pkgoption{nocitation}] \mbox{}\\
  These three option determine which citation commands are defined in
  \pkg{apacite}. \pkgoption{apaciteclassic} defines the ``classic''
  \pkg{apacite} citation commands \cmd{\cite}, \cmd{\citeA}, \cmd{\citeNP},
  and so forth, which use angled bracket syntax for prenotes, for example,
  |\cite<see>[for more details]{ex1}|. These are the commands
  described in section~\ref{sec:cite} below. This is the default in the
  current version, but this may change in the future.

  \pkgoption{natbibapa}
  loads the \pkg{natbib} package for the citation commands. These
  commands, such as \cmd{\citet} and \cmd{\citep}, use double square
  brackets, for example, |\citep[see][for more details]{ex1}|.
  Because these commands are not defined by \pkg{apacite} but by
  \pkg{natbib}, they are not documented in this manual. See the
  \pkg{natbib} documentation for their usage. Using \pkg{natbib} has a
  few advantages over using the classic \pkg{apacite} commands:
  (i) the citation commands are robust, which means they can be used
  inside other commands, such as \cmd{\caption}, whereas the \pkg{apacite}
  commands, like the traditional \LaTeX{} \cmd{\cite} command, are
  fragile and must be \cmd{\protect}ed when used inside other commands;
  (ii) the angled brackets do not normally occur in text mode and when
  they do, they have special meaning; this may lead to incompatibilities;
  (iii) \pkg{natbib} supports sorting citations within a citation
  command, and has commands such as \cmd{\Citet} that capitalize the
  first letter of a citation; the classic \pkg{apacite} commands lack
  this functionality;
  (iv) it is easier to switch to other styles, even to numbered styles.

  When the \pkgoption{nocitation} option is requested, no citation
  commands (except for \cmd{\nocitemeta}) are defined in \pkg{apacite}.
  This may be useful if you want to use another citation package and
  want to avoid potential compatibility conflicts.

  The option \pkgoption{natbibapa} is different from
  \pkgoption{nocitation} combined with loading of \pkg{natbib} by the
  user, because \pkgoption{natbibapa} modifies \pkg{natbib}'s and
  \pkg{apacite}'s behavior in a way that better satisfies the APA
  rules and fixes some compatibility problems.

\item[\pkgoption{BCAY}] \mbox{}\\
  This is a technical option for backwards compatibility with old versions
  (pre-\APACversiondate{2003/09/05}) of \pkg{apacite}. In those versions of
  \pkg{apacite}, the \cmd{\BCAY} construction was used to pass relevant
  citation information from the \fname{.bbl} file (\BibTeX{}'s output) to
  \LaTeX{}. This was taken over from its immediate predecessor, Young U. Ryu's
  \pkg{theapa}. However, \pkg{natbib} does not recognize the \cmd{\BCAY}
  construction, but it does recognize the analogous \cmd{\citeauthoryear}
  construction, which was also used by an earlier predecessor of
  \pkg{apacite}, \pkg{newapa}. Therefore, \pkg{apacite} has reverted to
  \cmd{\citeauthoryear} as well. This makes different versions of
  \pkg{apacite} incompatible with each other, because it is not possible to
  support both constructions at the same time. This option is used to fix
  that: In the (unlikely) event that you \emph{must} use a \fname{.bbl} file
  that is generated by an old version of \pkg{apacite}, you can turn this
  option on.

\item[\pkgoption{mask}]
\item[\pkgoption{unmask}] \mbox{}\\
  Many journals use a double blind refereeing process. To conceal the
  author's identity in such a masked review, it may be necessary to
  suppress some citations, for example, to the working paper version
  of the manuscript under review. \pkg{apa6} introduced masked citation
  commands, which are now included in \pkg{apacite} as well. These
  work as ordinary citations when the \pkgoption{mask} option is not
  requested (or when the \pkgoption{unmask} option is chosen, which
  is the default) and print a message mentioning suppression of citations
  when \pkg{apacite} is loaded with the \pkgoption{mask} option.

\item[\pkgoption{index}]
\item[\pkgoption{indexpackage}]
\item[\pkgoption{noindexpackage}] \mbox{}\\
  The \pkgoption{index} option turns author indexing on. See
  section~\ref{sec:autindex} for a discussion of the author indexing facility.
  The \pkgoption{index} option should be used with the \fname{apacitex.bst}
  (or \fname{apacannx.bst})
  \BibTeX{} style, although it does not give errors with \fname{apacite.bst}
  (or \fname{apacann.bst}),
  but simply does not give author index entries, so then this option
  typically does not have any effect (and an undesirable effect if
  it does). The \pkgoption{indexpackage} and \pkgoption{noindexpackage}
  select whether the author index entries should be generated according
  to the method of the \pkg{index} package or using a more standard-\LaTeX{}
  method.

  By default, if the \pkgoption{index} option is requested, the
  \pkgoption{indexpackage} option is turned on as well, consistent with
  the behavior of previous versions of \pkg{apacite}.

\item[\pkgoption{noindex}] \mbox{}\\
  Turns author indexing off (the default). Typically used with
  \fname{apacite.bst}, but can also be used with \fname{apacitex.bst}. In the
  latter case, the author indexing commands are simply ignored. Therefore,
  \fname{apacite.bst} is actually superfluous, but because author indexing
  will be used rarely and \fname{apacitex.bst} is more likely to lead to errors
  or incompatibilities, a ``clean'' (no author indexing) version,
  \fname{apacite.bst}, is provided as well.

\item[\pkgoption{suppresscorporate}] \mbox{}\\
  Excludes corporate authors from the author index. The \cmd{\bibcorporate}
  command must be used in the \fname{.bib} file to denote a corporate author;
  see sections~\ref{subsec:fields}, \ref{subsec:labels}, and~\ref{sec:autindex}.

\item[\pkgoption{includecorporate}] \mbox{}\\
  Includes corporate authors in the author index, provided that an author index
  is requested of course.

\item[\pkgoption{stdindex}]
\item[\pkgoption{tocindex}]
\item[\pkgoption{emindex}]
\item[\pkgoption{ltxemindex}] \mbox{}\\
  These options select the style of index formatting. They all imply the
  \pkgoption{index} option. The first three of these imply the
  \pkgoption{indexpackage} option, whereas the fourth implies
  \pkgoption{noindexpackage}. See section~\ref{sec:autindex}.

\item[\pkgoption{numberedbib}] \mbox{}\\
  This option implies that the bibliography (reference list) is a numbered
  section or chapter, e.g., ``6.~References'', instead of just ``References''.

\item[\pkgoption{unnumberedbib}] \mbox{}\\
  The reverse of \pkgoption{numberedbib}: The bibliography is an unnumbered
  section or chapter. This is the default. However, it is possible that when
  using the \pkg{apa} document class, then \pkgoption{numberedbib} works
  better, because that class turns section numbering off anyway and it may be
  that \pkg{apa}'s page headings work well if the reference list is a
  \cmd{\section} and not if it is a \cmd{\section*}. I have not experimented
  with this (yet), however.

\item[\pkgoption{sectionbib}] \mbox{}\\
  With this option, the bibliography is a section and not a chapter. Mainly
  useful in combination with the \pkg{chapterbib} package. Therefore, it will
  be discussed in more detail in section~\ref{sec:compat-chapterbib}.

\item[\pkgoption{nosectionbib}] \mbox{}\\
  With this option, the bibliography is a chapter, if the \cmd{\chapter}
  command is defined. Otherwise, it is always a section. Again, see
  section~\ref{sec:compat-chapterbib}.

\item[\pkgoption{tocbib}] \mbox{}\\
  This puts the bibliography in the table of contents, even if it is
  unnumbered, provided of course that a table of contents is requested in the
  document (by \cmd{\tableofcontents}). This is the default.

\item[\pkgoption{notocbib}] \mbox{}\\
  This does not put the bibliography in the table of contents if it is an
  unnumbered section or chapter. If it's numbered, it is always in the table
  of contents.

\item[\pkgoption{bibnewpage}] \mbox{}\\
  The bibliography is started on a new page. This is required by some journal
  styles, including the APA manual. The \pkg{apa} class already contained this
  in its \pkgoption{man} option, but now it has been made available directly
  in \pkg{apacite}.

\item[\pkgoption{nobibnewpage}] \mbox{}\\
  The bibliography is not explicitly started on a new page, although if the
  bibliography is a chapter, it will be started on a new page anyway, because
  chapters are started on a new page. This is the default in \pkg{apacite} and
  thus is the only time a non-APA setting is used as default instead of an
  available APA setting. Therefore, to satisfy the APA rules, you have to
  request the \pkgoption{bibnewpage} option explicitly.

\item[\pkgoption{doi}] \mbox{}\\
  Includes doi information in the reference list; the default.

\item[\pkgoption{nodoi}] \mbox{}\\
  Suppresses doi information in the reference list.

\end{description}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The citation commands}
\label{sec:cite}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This section describes the commands that can be used to cite a work.
Section~\ref{sec:classic} describes the commands available with the
\pkgoption{apaciteclassic} option selected. Section~\ref{sec:natbibapa}
is devoted to the citation commands with the \pkgoption{natbibapa}
command selected. Apart from differences in syntax, there are a few
important differences between these sets of commands:
\begin{itemize}
\item
The \pkgoption{apaciteclassic} commands are \emph{fragile}, like the
standard \LaTeX{} \cmd{\cite} command. This means that they cannot be
used in other commands, like \cmd{\caption}, unless they are protected
by putting \cmd{\protect} before them, for example,
\begin{verbatim}
\caption{Theoretical constructs from \protect\citeA{Jones01}}
\end{verbatim}
In contrast, the \pkg{natbib}/\pkgoption{natbibapa} commands are
\emph{robust}, so they can be used in other commands without the
need for \cmd{\protect}.
\item
The use of the angled brackets (`|<|' and `|>|') in the
\pkgoption{apaciteclassic} commands sometimes causes compatibility
problems, for example, with certain options of the \pkg{babel}
package, such as \pkgoption{spanish}.
\item
With the \pkgoption{sort} option, \pkg{natbib} sorts citations
within the same citation command in the same order as in the reference
list, as required by the APA manual (p.~178). Therefore, when
\pkg{apacite} is loaded with the \pkgoption{natbibapa} option, it
loads \pkg{natbib} with the \pkgoption{sort} option.
Sorting is not implemented in the \pkgoption{apaciteclassic} commands,
and thus the user will need to manually order the citations
alphabetically.
\item
\pkg{natbib} provides a set of commands (e.g., \cmd{\Citet}) that
capitalize the first letter of a citation. This can be used when
a citation, of which the first author's name starts with a lowercase
letter, starts a sentence (APA manual, p.~101). This behavior would
be very hard to reproduce with the \pkgoption{apaciteclassic}
commands.
\end{itemize}
Overall, I believe that the \pkg{natbibapa} option will be preferred
by most users, and I expect that I will make this the default in a
future release of \pkg{apacite}. However, because most users of
\pkg{apacite} will still be working on documents that use the
\pkgoption{apaciteclassic} commands, this is still the default in the
current version.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The ``classic'' \pkg{apacite} citation commands}
\label{sec:classic}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This section describes the default behavior of the citation commands
that are avilable with the \pkgoption{apaciteclassic} option.
In section~\ref{sec:custom}, customization of this behavior will be
discussed. Extensive examples are given in section~\ref{sec:xmpl}
and the new examples file described there. Table~\ref{tab:basic-cite}
gives a brief impression of the usage and results of the most common
citation commands.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{table}[tp]
\begin{center}
\caption{Examples of usage of basic citation commands.}
\label{tab:basic-cite}
\begin{tabular}{@{}ll@{}}
\hline
Command & Result \\
\hline
|\cite<e.g.,>[p.~11]{Jone01,Ross87}|       &
   (e.g., Jones, 2001; Ross, 1987, p.~11) \\
|\citeA<e.g.,>[p.~11]{Jone01,Ross87}|      &
   e.g., Jones (2001); Ross (1987, p.~11) \\
|\citeauthor<e.g.,>[p.~11]{Jone01,Ross87}| &
   e.g., Jones; Ross, p.~11 \\
|\citeyear<e.g.,>[p.~11]{Jone01,Ross87}|   &
   (e.g., 2001; 1987, p.~11) \\
|\citeyearNP<e.g.,>[p.~11]{Jone01,Ross87}|   &
   e.g., 2001; 1987, p.~11 \\
|\citeNP<e.g.,>[p.~11]{Jone01,Ross87}|       &
   e.g., Jones, 2001; Ross, 1987, p.~11 \\
\hline
\end{tabular}
\end{center}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection*{Structure of the citation commands;
  parenthetical citations}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DescribeMacro{\cite}
The traditional \LaTeX{} citation command is \cmd{\cite}, and
\pkg{apacite} reimplements this command. This command is used for
\emph{parenthetical} citations. For example,
``|\cite{Jone01}|'' results in ``(Jones, 2001)''. Here,
|Jone01| is the \emph{key} that identifies the reference; it is
defined in the \fname{.bib} file, see section~\ref{sec:bib}.
An optional postfix---text that follows the actual citation---can
be added as a standard \LaTeX{} optional argument in square brackets:
``|\cite[p.~11]{Jone01}|'' results in ``(Jones, 2001, p.~11)''.
Similarly, an optional prefix can be added between angled brackets:
``|\cite<e.g.,>{Jone01}|'' results in ``(e.g., Jones, 2001)''.
Finally, there can be both a prefix and a postfix (in that order):
``|\cite<e.g.,>[p.~11]{Jone01}|'' results in
``(e.g., Jones, 2001, p.~11)''. As usual, multiple references
can be included within the same citation:
``|\cite<e.g.,>[p.~11]{Jone01, Ross87}|'' results in
(e.g., Jones, 2001; Ross, 1987, p.~11). The citation keys of multiple
citations must be separated by commas, with optional spaces after the
commas.

By default, \pkg{apacite} follows the APA rules and includes the
citation in round parentheses, separates the author and year by a
comma, the different references by a semicolon, and the year and
the postfix by a comma, but this can all be changed by the user;
see section~\ref{sec:custom}.

\pkg{apacite} defines a large number of alternative citation
commands, but they all have this same structure:
\cmdfour{command}{prefix}{postfix}{keys}. However, the prefix, and to
a lesser extent the postfix, are most useful with the parenthetical
citation commands.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection*{Text citations; splitting author and year; no
parentheses}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DescribeMacro{\citeA}
The \cmd{\citeA} command produces text citations:
``|\citeA{Jone01}|'' results in ``Jones (2001)'' and.
``|\citeA[p.~11]{Jone01}|'' results in ``Jones (2001, p.~11)''.
Prefixes are generally not useful for text citations (you can simply
include the prefix in the text), but supported. Multiple citations
are also supported. These are typically only useful for cases in which
the authors are the same and only the year is repeated:
``|\citeA{Jone01, Jone02}|'' results in ``Jones (2001, 2002)''.
Corresponding with the APA rules, an ``and'' before the last author
is formatted as ``and'' in text citations, whereas it is formatted
as ``\&'' in parenthetical citations:
``|\citeA{SmJo03}|'' gives ``Smith and Jones (2003)'', whereas
``|\cite{SmJo03}|'' gives ``(Smith \& Jones, 2003)''.

\DescribeMacro{\citeauthor}
If a proper citation has been given in a paragraph,\footnote{Note that
a paragraph is not a section. Nor does it need to be declared as a
\cmd{\paragraph}. A reminder for Dutch readers: ``section'' =
``paragraaf'' and ``paragraph'' = ``alinea''.}
the second reference to the source may omit the year if no ambiguity
can  arise (APA manual, p.~174). The \cmd{\citeauthor} command can
be used for such purposes:
\begin{verbatim}
\citeA{Jone01} argued that [...]. The empirical results of
\citeauthor{Jone01} supported his argument.
\end{verbatim}
gives ``Jones (2001) argued that [\ldots]. The empirical results of
Jones supported his argument.''

\DescribeMacro{\citeyear}
The \cmd{\citeyear} command gives just the year part of a text
citation. This can be used for constructions like
``|\citeauthor{Jone01}' \citeyear{Jone01} method|'', which
gives ``Jones' (2001) method''. Note that \cmd{\citeyear} inserts the
parentheses.

\DescribeMacro{\citeyearNP}
Some constructions may require even more flexibility. The
\cmd{\citeyearNP} command (NP = no parentheses) omits the
parentheses, which can be useful for a construction like
``|In \citeyearNP{Jone01},| |\citeauthor{Jone01}| |introduced|
|his method|'', which gives ``In 2001, Jones introduced his method''.

\DescribeMacro{\citeauthorNP}
As mentioned above, text citations use ``and'' between authors,
whereas parenthetical citations use ``\&''. The, \cmd{\citeauthor}
command is a text citation command and thus should not be used
in a parenthetical citation; \cmd{\citeauthorNP} is the corresponding
parenthetical command, which gives just the authors, but now with
``\&'' when applicable. Note that neither \cmd{\citeauthor} nor
\cmd{\citeauthorNP} insert parentheses. In hindsight, it would have
been more logical---following \cmd{\cite} and \cmd{\citeA}---to use
\cmd{\citeauthorA} for what is now \cmd{\citeauthor} and
\cmd{\citeauthor} for what is now \cmd{\citeauthorNP}, but
\cmd{\citeauthor} already existed as a text citation command in
\pkg{apacite}'s predecessor \pkg{theapa}, it is used as such in
some other packages (e.g., \pkg{natbib}), and I didn't realize at
the time that \pkg{apacite} would need both. Therefore, the name
\cmd{\citeauthorNP} is modeled after \cmd{\citeNP}

\DescribeMacro{\citeNP}
The \cmd{\citeNP} command is \cmd{\cite} without the parentheses.
This is useful for complex constructions like
\begin{verbatim}
\citeauthor{Jone01} (\citeyearNP{Jone01}; see also \citeNP{SmJo03})
\end{verbatim}
which gives
``Jones (2001; see also Smith \& Jones, 2003)''.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection*{References without citation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DescribeMacro{\nocite}
The standard \LaTeX{} command \cmd{\nocite} is also provided by
\pkg{apacite}; \cmdtwo{nocite}{keys} includes the references
corresponding with the keys in the reference list, but does not
generate a citation in the text. Therefore, it does not allow a pre-
or postfix. However, it does allow multiple citations. Like the
standard \LaTeX{} command, |\nocite{*}| includes all references
from the \fname{.bib} file in the reference list. In general, the APA
requires (p.~174) that each reference list entry should be cited in
the text, and thus this command will rarely be used in APA style
manuscripts. One potential application is a meta-analysis based
on more than 50 works. (See \cmd{\nocitemeta} below.)

\DescribeMacro{\nocitemeta}
An exception to the one-to-one correspondence requirement between
citations and reference list is when a meta-analysis is reported.
This is a quantitative analysis with results, e.g., regression
coefficients, from published work used as data in the current work.
Studies that are included in the meta-analysis should be included
in the reference list, but do not need to be cited. They should,
however, be marked with an asterisk in the reference list. This
can be obtained by using \cmd{\nocitemeta}, which is otherwise
identical to \cmd{\nocite}: the syntax is \cmdtwo{nocitemeta}{keys}
and |\nocitemeta{*}| includes all entries from the \fname{.bib} file
in the reference list and flags all of them with an asterisk. This
is an unlikely situation, though. Because other packages, in particular
\pkg{natbib} do not define \cmd{\nocitemeta} or an analogous command,
\pkg{apacite} provides \cmd{\nocitemeta} regardless of whether the
\pkgoption{apaciteclassic}, \pkgoption{natbibapa}, or even
\pkgoption{nocitation} option is requested.

If a meta-analysis includes more than 50 studies, these should not
be included in the main reference list, but in a separate online
supplemental archive (APA manual, p.~183). \pkg{apacite} currently
does not count the number of references included in the meta-analysis,
and thus does not check whether the references should be included in
a separate online supplemental archive, it does not disable the
\cmd{\nocitemeta} command, and it does not automatically generate
the supplemental document. This is the responsibility of the user.
If there is demand for it, I might implement such a counter so that
\pkg{apacite} can give a warning at the end of the \LaTeX{} run that
there are more than 50 references included in the meta-analysis.
Presumably, in the online supplemental archive, the references are
not marked with an asterisk, so this would be an example where
\cmd{\nocite} can be useful.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection*{Full and short author lists}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DescribeMacro{\fullcite}
\DescribeMacro{\fullciteA}
\DescribeMacro{\fullciteNP}
\DescribeMacro{\fullciteauthor}
\DescribeMacro{\fullciteauthorNP}
When citing a work with one or two authors, all authors are included
in each citation. When citing a work with six or more authors, only
the first author's name is included in the text, followed by
``et al.\hbox{}''. With three to five authors, the full list is
included the first time the work is cited, and only the first with
``et al.\hbox{}'' in subsequent citations.

\DescribeMacro{\shortcite}
\DescribeMacro{\shortciteA}
\DescribeMacro{\shortciteNP}
\DescribeMacro{\shortciteauthor}
\DescribeMacro{\shortciteauthorNP}
There are some special cases, where some of the authors and the year
are the same, but not the whole author list, in which more names are
retained on subsequent citations as well. Section~\ref{sec:xmpl}
includes some examples of complex situations and how to deal with
them. All of this is automatically handled by \pkg{apacite}.

However, occasionally one may want to use the full
author list even after a first citation, or the short author list in
the first citation. For such (rare) cases, \pkg{apacite} provides
``full'' and ``short'' versions of all citation commands that include
an author (list) in the text. Other than forcing the full or short
author list in the text, these commands are identical to the versions
without ``|full|'' or ``|short|''.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection*{Masked citations}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DescribeMacro{\maskcite}
\DescribeMacro{\maskciteA}
\DescribeMacro{\maskciteNP}
\DescribeMacro{\maskciteauthor}
\DescribeMacro{\maskciteauthorNP}
\DescribeMacro{\maskciteyear}
\DescribeMacro{\maskciteyearNP}
Many journals use a ``masked'' or double-blind review process, in
which the identities of the authors are concealed from the reviewers.
As the APA manual states (p.~226), it is the responsibility of the
authors to ensure that the content of the manuscript does not reveal
their identities. This may include suppressing citations to other
work by the authors, in particular unpublished material, such as
the working paper version of the manuscript under review. To this
end, the \pkg{apa6} class introduced ``masked'' citation commands,
which produce the desired citation for the unmasked mode, but
insert a message stating that citations have been masked in masked
mode. Because these are citation commands, they are more properly
included in \pkg{apacite}, and they now are. I am coordinating with
\pkg{apa6}'s author Brian Beitzel on this issue (and other points
of interaction between \pkg{apa6} and \pkg{apacite}).

\DescribeMacro{\maskfullcite}
\DescribeMacro{\maskfullciteA}
\DescribeMacro{\maskfullciteNP}
\DescribeMacro{\maskfullciteauthor}
\DescribeMacro{\maskfullciteauthorNP}
All the citation commands introduced in this section have a
corresponding masked version, which has the same syntax and the same
name, except that ``|mask|'' is inserted immediately after the
backslash. Thus, the masked version of \cmd{\cite} is \cmd{\maskcite},
the masked version of \cmd{\fullciteauthorNP} is
\cmd{\maskfullciteauthorNP}, and so forth.

\DescribeMacro{\maskshortcite}
\DescribeMacro{\maskshortciteA}
\DescribeMacro{\maskshortciteNP}
\DescribeMacro{\maskshortciteauthor}
\DescribeMacro{\maskshortciteauthorNP}
When \pkg{apacite} is loaded with the \pkgoption{mask} option, these
masked citation commands insert the message
``\emph{(1\ citation removed for masked review)}'', or
``\emph{(2\ citations removed for masked review)}'', and so forth,
depending on the number of citations included in the citation
command. When \pkg{apacite} is loaded with the \pkgoption{unmask}
option (the default), the masked citation commands are equivalent
to the same commands without the ``|mask|''.

\DescribeMacro{\masknocite}
\DescribeMacro{\masktext}
%% \DescribeMacro{\maskcitations}
%% \DescribeMacro{\unmaskcitations}
In addition to the masked citation commands, \pkg{apacite} also
provides \cmd{\masknocite}, although its usefulness seems even more
remote than \cmd{\nocite} itself in APA style documents. Because
\cmd{\nocite} does not insert a citation, \cmd{\masknocite} does
not remove citations in \pkgoption{mask} mode. It only prevents an
entry in the reference list. Therefore, this command does not
insert a message about removed citations in the text either. Hence,
it does nothing in \pkgoption{mask} mode. An additional command
provided by \pkg{apacite} is \cmd{\masktext}. This has one mandatory
argument, the text that is to be masked. It also has an optional
argument, which is the text to be inserted in \pkgoption{mask} mode.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection*{Ad-hoc citation commands}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
In order to format the examples from the APA manual correctly in
section~\ref{sec:xmpl}, the \fname{apacdoc.sty} package defines the
following additional citation commands: \cmd{\DSMcite},
\cmd{\biblecite}, and \cmd{\citesong}, and obvious variations with
|full|, |short|, |A|, and |NP|. I have decided not to include these
in \fname{apacite.sty}, primarily because I find it unattractive to
introduce different types of citation commands for different types of
citations. This also makes it more difficult to use the same document
with another citation package. Perhaps I'll be able to provide,
in a future version of \pkg{apacite}, more elegant solutions to the
problems for which these commands were defined. See
section~\ref{sec:apacdoc} for a description of the \fname{apacdoc.sty}
package and some brief usage instructions.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Using \pkg{natbib} for citations}
\label{sec:natbibapa}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
With the \pkgoption{natbibapa} option, \pkg{apacite} loads \pkg{natbib}
with the options \pkgoption{longnamesfirst} and \pkgoption{sort}. The
former inserts the full author lists in the first citation and the
short author lists in subsequent citations, in the same way the
\pkgoption{apaciteclassic} commands do. The \pkgoption{sort} option
sorts the citations within the same citation command in the same order
as in the reference list, as required by the APA manual (p.~178).
In addition to loading \pkg{natbib}, \pkg{apacite} includes some
code to improve the interoperability, and it defines some additional
commands that are specific to the \pkg{natbib}-\pkg{apacite}
combination. The latter will be described below.

Because the citation commands are defined by \pkg{natbib}, this is
not the place for extensive documentation of them. See the \pkg{natbib}
documentation. However, for completeness, I provide very brief
information here. Table~\ref{tab:natbibapa} lists the commands and
a brief description.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{table}[tp]
\centering
\caption{The \pkg{natbib} citation commands.}
\label{tab:natbibapa}
\begin{tabular}{@{}ll@{}}
\hline
Command             & Description \\
\hline
\cmd{\citep}        & Parenthetical citation           \\
\cmd{\citet}        & Text citation                    \\
\cmd{\citeauthor}   & Author only (text citation)      \\
\cmd{\citeyear}     & Year only (no parentheses)       \\
\cmd{\citeyearpar}  & Year citation (with parentheses) \\
\cmd{\citealp}      & Parenthetical citation without the parentheses \\
\cmd{\citealt}      & Text citation without the parentheses          \\
\cmd{\citenum}      & Number of the reference                        \\
\cmd{\nocite}       & No citation, only reference list entry         \\
\cmd{\Citep} etc.   & Capitalized citation               \\
\cmd{\citep*} etc.  & Full author lists                  \\
\cmd{\shortcites}   & Short author lists                 \\
\cmd{\defcitealias} & Define alias (e.g., \emph{DSM-IV}) \\
\cmd{\citepalias}   & Parenthetical citation of alias    \\
\cmd{\citetalias}   & Text citation of alias             \\
\cmd{\citetext}     & Arbitrary text within citation parentheses \\
\hline
\end{tabular}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Compared to the \pkgoption{apaciteclassic} commands,
the \pkg{natbib} commands use square brackets for both the prefix and
the postfix: ``|\command[prefix][postfix]{keys}|''. If only one
optional argument is present, it is interpreted as a postfix. A
citation with only a prefix is obtained by using both optional
arguments, but leaving the postfix empty:
``|\command[prefix][]{keys}|''. The full author list is obtained
by adding a star after the command, for example, |\citet*{key}|.
There is no separate command for the short author list, but it can
be obtained with the construction |\shortcites{key}\citet{key}|.
The first letter of the author list is capitalized with citation
commands that capitalize the first letter of the citation command,
such as \cmd{\Citet}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection*{Filling some gaps and other additions}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DescribeMacro{\citeauthorp}
\DescribeMacro{\citeauthort}
\DescribeMacro{\Citeauthorp}
\DescribeMacro{\Citeauthort}
As mentioned in section~\ref{sec:classic}, the APA requires that
``and'' between authors is ``and'' in text citations and ``\&'' in
parenthetical citations, and therefore the \pkgoption{apaciteclassic}
option defines two author-citing commands: \cmd{\citeauthor} for
text citations and \cmd{\citeauthorNP} for parenthetical citations.
However, \pkg{natbib} only provides \cmd{\citeauthor}. For
consistency with \cmd{\citep} and \cmd{\citet}, when loaded with the
\pkgoption{natbibapa} option, \pkg{apacite} defines
\cmd{\citeauthorp} for parenthetical use and \cmd{\citeauthort} for
text use, and the corresponding capitalized versions \cmd{\Citeauthorp}
and \cmd{\Citeauthort}. The default command \cmd{\citeauthor} is a
text citation command, so it's equivalent to \cmd{\citeauthort}.

%% \DescribeMacro{\citefullauthorp}
%% \DescribeMacro{\citefullauthort}
%% \DescribeMacro{\Citefullauthorp}
%% \DescribeMacro{\Citefullauthort}

\DescribeMacro{\bibstyle@apacite}
\DescribeMacro{\bibstyle@apa}
The \pkg{natbib} package is also highly customizable, and one of
the ways it allows customization is by the \cmd{\bibstyle@xxx}
commands, which typically define the desired punctuation through
\cmd{\bibpunct} and may define other customizations. These are
executed by using the command |\citestyle{xxx}|. Furthermore, when
\pkg{natbib} is loaded, it checks the bibliography style and if it
is \fname{xxx.bst}, then it tries to execute |\citestyle{xxx}| if
defined. With the \pkgoption{natbibapa} option, \pkg{apacite}
defines \cmd{\bibstyle@apacite}, and as a synonym, \cmd{\bibstyle@apa}.
Thus, the APA punctuation defaults can be obtained with
|\citestyle{apacite}| or |\citestyle{apa}|, which are executed
by \pkg{apacite}, so the user only needs to do this if the style
has been changed.

\DescribeMacro{\maskcitep}
\DescribeMacro{\maskcitet}
\DescribeMacro{\maskciteauthor}
\DescribeMacro{\maskciteyear}
\DescribeMacro{\maskciteyearpar}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection*{Masked citations}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DescribeMacro{\maskcitealp}
\DescribeMacro{\maskcitealt}
\DescribeMacro{\maskcitenum}
\DescribeMacro{\maskcitetalias}
\DescribeMacro{\maskcitepalias}
Section~\ref{sec:classic} described masked citation commands that
can be used in double-blind review processes in an effort to conceal
the identity of the authors. Because \pkg{natbib} itself does not
define such commands, \pkg{apacite} with the \pkgoption{natbibapa}
option defines a full set of \pkg{natbib}-style masked citation
commands. Again, these are identical to the un-|mask| version if
the \pkgoption{mask} option is not requested, but insert a message
about removed citations when the \pkgoption{mask} option is requested.

\DescribeMacro{\maskCitep}
\DescribeMacro{\maskCitet}
\DescribeMacro{\maskCiteauthor}
\DescribeMacro{\maskCitealp}
\DescribeMacro{\maskCitealt}
%% The |\mbox{}| is necessary to avoid errors about too many
%% unprocessed floats. This gives some ugly vertical whitespace, but
%% the only alternative would be to write some superfluous paragraphs,
%% which is equally unattractive.
\mbox{}

\DescribeMacro{\maskciteauthorp}
\DescribeMacro{\maskciteauthort}
\DescribeMacro{\maskCiteauthorp}
\DescribeMacro{\maskCiteauthort}
\DescribeMacro{\masknocite}
\DescribeMacro{\masktext}
\mbox{}

%% \DescribeMacro{\maskcite}
%% \DescribeMacro{\maskcitefullauthor}
%% \DescribeMacro{\maskCitefullauthor}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Contents of the bibliography database file}
\label{sec:bib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The information that is used by \LaTeX/\BibTeX{} to generate
the citations and reference list must be stored by the user in one
or more files with the \fname{.bib} extension.
A detailed overview of the contents of the \fname{.bib} file is
given in \citeA[section~12.2]{KoDa04} and \citeA[section~13.2]{TLC2}.
Roughly speaking, the
\fname{.bib} file consists of a collection of \emph{entries}
of the form
\mbox{}\vspace{0.7\baselineskip}\\
\verb+@+\opt{entryname}\verb+{+\opt{contents}\verb+}+
\mbox{}\vspace{0.7\baselineskip}\\
Most entries describe a work that may be referenced, e.g., a book
or article. There are, however, two exceptions: a \entryname{preamble}
entry (with \opt{entryname} = \verb+preamble+) and a \entryname{string}
entry (with \opt{entryname} = \verb+string+). There is typically
at most one \entryname{preamble} entry. Its \opt{contents} consist of a
string---according to \BibTeX, i.e., between double quotes (\verb+"+)
or an additional pair of braces (\verb+{+ and \verb+}+). This
string, which typically consists of \LaTeX{} commands like
\verb+\newcommand{\SortNoop}[1]{}+, is literally included
in the document before the bibliography. It can therefore be used
to define commands that are used in the (other) entries of the
\fname{.bib} file and that are not standard \LaTeX{}.

A \entryname{string} entry is similar, but the contents are now not
included in the document. Instead, the string is assigned to a kind of
``variable'', the name of which may contain characters
not usually associated with variable names, like colons and
hyphens, see \citeA[p.~769]{TLC2}. An example of a
\entryname{string} entry is
\begin{verbatim}
@string{ JPSP = {Journal of Personality and Social Psychology} }
\end{verbatim}
Then, if in a later entry, the journal is
\emph{Journal of Personality and Social Psychology}, you can format this
as
\begin{verbatim}
  journal = JPSP,
\end{verbatim}
instead of the usual
\begin{verbatim}
  journal = {Journal of Personality and Social Psychology},
\end{verbatim}
This is not only convenient because it saves typing of common
long journal names (and reduces the likelihood of typos), but it can
also be used to define style-specific variations. For example, some
styles abbreviate journal names, such as
\emph{J.~Pers.\ Soc.\ Psych.}\hbox{} instead of
\emph{Journal of Personality and Social Psychology}.
You could then put the definitions of all full journal names
in one \fname{.bib} file (\fname{fulljou.bib}, say) and the definitions
of the abbreviated journal names in another (\fname{abbrjou.bib}, say).
Suppose that the information about the referenced works is stored in a
third file, say, \fname{myrefs.bib}, and that the ``NotAPA''
style rules, implemented in the \fname{notapa.bst} \BibTeX{} style file,
require the abbreviated journal names. Then you can use
\begin{verbatim}
\bibliographystyle{notapa}
\bibliography{abbrjou,myrefs}
\end{verbatim}
to obtain a reference list complying with the ``NotAPA'' rules. If
you change your mind and decide to switch to using the rules of the
APA manual, you only need to change the two lines above into
\begin{verbatim}
\bibliographystyle{apacite}
\bibliography{fulljou,myrefs}
\end{verbatim}
(and additionally load the \fname{apacite.sty} \LaTeX{} package
through \cmd{\usepackage}).

The remaining entry types are types that correspond with the
type of a referenced work, e.g., \entryname{book} or
\entryname{article}. These entry types (reference types) are
discussed in section~\ref{subsec:types} below.
Such entries have the following structure:
\mbox{}\vspace{0.7\baselineskip}\\
\verb+@+\opt{entryname}\verb+{+\opt{key}\verb+,+\\
$\mbox{}\qquad$\opt{fieldname1}\verb+ = +\opt{value1}\verb+,+\\
$\mbox{}\qquad$\opt{fieldname2}\verb+ = +\opt{value2}\verb+,+\\
$\mbox{}\qquad\qquad\vdots$\\
$\mbox{}\qquad$\opt{fieldnameN}\verb+ = +\opt{valueN}\verb+,+\\
\verb+}+
\mbox{}\vspace{0.7\baselineskip}\\
where \opt{key} corresponds to the key used in the citation
commands and matches the entry with the citation (and should
therefore be unique). The fieldnames are \verb+author+, \verb+year+,
etc., which are described in section~\ref{subsec:fields} below.
The values are strings, either defined previously by a
\entryname{string} entry or explicitly indicated as such here
by putting the relevant information between double quotes
(\verb+"+) or a pair of braces (\verb+{+ and \verb+}+).

To be able to obey the rules of the APA manual, \pkg{apacite}
provides several fields and reference types that are not
described in the standard \BibTeX{} documentation
\cite<e.g.,>[Chapter~13]{TLC2}. Furthermore,
the meaning and usage of many fields and reference types that
\emph{are} described there have been altered somewhat. Therefore,
a complete description is given here.
The symbol \LC{} will be used to indicate that the field or
reference type is also described in \citeA[Appendix~B]{LaTeXbook},
\citeA[Chapter~12]{KoDa04}, or \citeA[Chapter~13]{TLC2}, although, as
mentioned above, the specific meaning of the item may have been
changed.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Types of references}
\label{subsec:types}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
In this section, the list of reference types that are recognized by
\pkg{apacite} is given. An overview of which fields can be used for which
reference type is given in Table~\ref{tab:fieldref}. If fields are not
relevant, but you use them anyway in your \fname{.bib} file, they are ignored.
The fields and their use are described in more detail in
section~\ref{subsec:fields}, but here some specific issues will already be
mentioned.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{table}[p]
\centering
\caption{List of fields that are used by the various reference types
         (blank = not used; \X{} = used;
          \Y{} = used, but only for citations; \A{} = only used by
          \pkg{apacann} and \pkg{apacannx}).}
\label{tab:fieldref}
\small
\makebox[0pt]{% some manipulation to squeeze the table onto the page
\newlength{\oldtabcolsep}
\setlength{\oldtabcolsep}{\tabcolsep}
\setlength{\tabcolsep}{2pt}
\begin{tabular}{@{}l@{}cccccccccc@{}}
\hline
 & \multicolumn{10}{c}{Reference type}\\
   \cline{2-11}
%
% Normally, I would use the sideways environment of the rotating
% package to format this nicely, but I do not want to require
% other packages to format this document, so I choose an uglier
% solution here.
%
 & article\\
 & magazine   &      &              &            &              &
 & phdthesis
 &
 & manual\\
Field
 & newspaper  & book & incollection & techreport & intechreport & lecture
 & mastersthesis
 & unpublished
 & misc
 & literal\\
\hline
address           &  &\X&\X&\X&\X&\X&\X&\X&\X&  \\
annote            &\A&\A&\A&\A&\A&\A&\A&\A&\A&\A\\
annotate          &\A&\A&\A&\A&\A&\A&\A&\A&\A&\A\\
author            &\X&\X&\X&\X&\X&\X&\X&\X&\X&  \\
booktitle         &  &  &\X&  &\X&  &  &  &  &  \\
chair             &  &  &  &  &  &\X&  &  &  &  \\
chapter           &  &  &\X&  &  &  &  &  &  &  \\
day               &\X&  &\X&\X&\X&\X&  &\X&\X&  \\
doi               &\X&\X&\X&\X&\X&\X&\X&\X&\X&\X\\
edition           &  &\X&\X&\X&\X&  &\X&  &\X&  \\
editor            &\X&\X&\X&\X&\X&  &  &\X&\X&  \\
englishtitle      &\X&\X&\X&\X&\X&\X&\X&\X&\X&  \\
firstkey          &\Y&\Y&\Y&\Y&\Y&\Y&\Y&\Y&\Y&\Y\\
howpublished      &\X&\X&\X&\X&\X&\X&\X&\X&\X&  \\
institution       &  &  &  &\X&\X&  &  &  &  &  \\
journal           &\X&  &  &  &  &  &\X&  &  &  \\
key               &\Y&\Y&\Y&\Y&\Y&\Y&\Y&\Y&\Y&\Y\\
lastchecked       &\X&\X&\X&\X&\X&\X&\X&\X&\X&  \\
month             &\X&  &\X&\X&\X&\X&  &\X&\X&  \\
note              &\X&\X&\X&\X&\X&\X&\X&\X&\X&  \\
number            &\X&\X&  &\X&\X&  &\X&\X&\X&  \\
organization      &  &  &  &  &  &  &  &\X&  &  \\
originaladdress   &\X&\X&\X&  &\X&  &  &  &  &  \\
originalbooktitle &\X&\X&\X&  &\X&  &  &  &  &  \\
originaledition   &\X&\X&\X&  &\X&  &  &  &  &  \\
originaleditor    &\X&\X&\X&  &\X&  &  &  &  &  \\
originaljournal   &\X&\X&\X&  &\X&  &  &  &  &  \\
originalnumber    &\X&\X&\X&  &\X&  &  &  &  &  \\
originalpages     &\X&\X&\X&  &\X&  &  &  &  &  \\
originalpublisher &\X&\X&\X&  &\X&  &  &  &  &  \\
originalvolume    &\X&\X&\X&  &\X&  &  &  &  &  \\
originalyear      &\X&\X&\X&\Y&\X&\Y&\X&\Y&\Y&\Y\\
pages             &\X&  &\X&  &\X&  &\X&  &  &  \\
publisher         &  &\X&\X&  &  &  &  &  &\X&  \\
school            &  &  &  &  &  &  &\X&  &  &  \\
series            &  &  &  &  &  &  &  &  &  &  \\
symposium         &  &  &  &  &  &\X&  &  &  &  \\
text              &  &  &  &  &  &  &  &  &  &\X\\
title             &\X&\X&\X&\X&\X&\X&\X&\X&\X&  \\
translator        &\X&\X&\X&\Y&\X&\Y&\Y&\Y&\Y&\Y\\
type              &\X&\X&\X&\X&\X&\X&\X&\X&\X&  \\
url               &\X&\X&\X&\X&\X&\X&\X&\X&\X&  \\
urldate           &\X&\X&\X&\X&\X&\X&\X&\X&\X&  \\
volume            &\X&\X&\X&\X&\X&  &\X&  &\X&  \\
year              &\X&\X&\X&\X&\X&\X&\X&\X&\X&\Y\\
\hline
\end{tabular}%
\setlength{\tabcolsep}{\oldtabcolsep}
}
%
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The following entry types (reference types) are defined in \pkg{apacite}:
\begin{description}
    \item[\entryname{article}\LC] \mbox{}\\
        A journal article or comparable. If the
        ``article'' referenced to is a special issue of a journal or
        something else that has editors instead of authors, the
        \fieldname{author} field should be empty and the \fieldname{editor}
        field should be used for the editors. If the journal paginates
        by issue instead of by volume, or when you are referring to a
        whole special issue, the issue number should be given
        in the \fieldname{number} field. In all other cases (including
        referring to an article within a special issue), the
        \fieldname{number} field must not be used. The \fieldname{type}
        field can be used to denote the type of article, for example,
        ``\verb+Letter to the editor+'', or
        ``\verb+Review of the book \emph{Life in the middle}+''.

    \item[\entryname{magazine}] \mbox{}\\
        A magazine article. Unlike in early versions of \pkg{apacite},
        this is now equivalent to \entryname{article}. However, with
        an \entryname{article}, the \fieldname{month} and \fieldname{day}
        fields should generally not be used, unless there is a compelling
        reason to use them. For a magazine, the \fieldname{month}, and
        \fieldname{day} (for weeklies) fields are commonly used.

    \item[\entryname{newspaper}] \mbox{}\\
        A newspaper article. This is similar to \entryname{article} and
        \fieldname{magazine}, except that the pages are formatted a little
        different, with ``pp.~23--49'' instead of just ``23--49''.

    \item[\entryname{book}\LC] \mbox{}\\
        An entire book. The \fieldname{type} field can be used
        to denote a specific type of item (so generally not strictly
        a book), e.g., ``\verb+Brochure+''. Similarly, the
        \fieldname{number} field can be used if this is considered
        useful. (It is used in example 24 in the APA manual, see
        below.) This seems quite rare to me, however. It should
        certainly \emph{not} be used for ISBN numbers and the like.

    \item[\entryname{incollection}\LC] \mbox{}\\
        An article in a (usually edited) book, or other kind of larger
        work, except a report, for which the \entryname{intechreport}
        entry is used. The \fieldname{booktitle} field contains the
        title of the whole collection (book). The \fieldname{type}
        field is currently used to denote the type of article, as
        with the \entryname{article} reference type, although in some
        cases, it may be more naturally to let the \fieldname{type}
        field contain the type of the whole work (e.g., CD). Therefore,
        I may change this somewhat in future versions of \pkg{apacite}.

    \item[\entryname{techreport}\LC] \mbox{}\\
        A report. This may be a ``technical'' report such as published
        by universities, or a report from government organizations or
        private companies. The \fieldname{type} field can be used to
        indicate what kind of report it is, e.g.,
        ``\verb+College Board Rep.+'' or ``\verb+{DHHS} Publication+''.
        If the \fieldname{type} field is missing, the default type
        ``\verb+Tech.\ Rep.\hbox{}+'' is used. (The \verb+\hbox{}+
        ensures that \TeX{} does not view the period as the end of a
        sentence, which would insert too much space.) If no type
        description should
        be given, \verb+\bibnotype+ should be used as the contents of
        the \fieldname{type} field. The \fieldname{number} field can
        be used to give the report number. The organization that
        published the report should be given in the \fieldname{institution}
        field.

    \item[\entryname{intechreport}] \mbox{}\\
        An article in a (usually edited) report. This is more or less
        a combination of \entryname{incollection} and
        \entryname{techreport}. It uses the same fields as the former
        to describe the article itself, except \fieldname{type}, e.g.,
        \fieldname{booktitle}, which is in this case the title of the
        entire report,
        and the same fields as the latter to describe the report.
        In particular, the \fieldname{type}, \fieldname{number},
        and \fieldname{institution} fields are used for the report.

    \item[\entryname{lecture}] \mbox{}\\
        A paper presented at a meeting. According to the APA manual,
        the year and month should be given, but \pkg{apacite} also
        uses the \fieldname{day} field when available.
        The \fieldname{symposium} field can be used for the
        name of the symposium and the \fieldname{chair} field for the chair of
        the meeting. The \fieldname{howpublished} field should be used to
        indicate the occasion at which the paper was presented if the
        \fieldname{symposium} field is empty, e.g.,
        ``\texttt{Paper presented at the meeting of the American
                  Professional Society on the Abuse of Children}''.
        It can also be used to give additional information about
        the symposium if the \fieldname{symposium} field is not empty.

    \item[\entryname{phdthesis}\LC] \mbox{}\\
        A doctoral dissertation. The \fieldname{school} field is used
        to denote the university for which the thesis was written.
        The \fieldname{type} field can be used for the thesis type,
        e.g., ``\verb+PhD thesis+''. If it is empty, the default type
        is used, which is ``\verb+Unpublished doctoral dissertation+''
        or ``\verb+Doctoral dissertation+'', depending on whether
        the \fieldname{journal} field is empty or not.

        If the thesis is abstracted in \emph{Dissertation Abstracts
        International} or similar, then the \fieldname{journal},
        \fieldname{volume}, \fieldname{number}, and \fieldname{pages} fields
        can be used as with journal articles. The \fieldname{year} field
        should denote the year of the ``journal''.
        The \fieldname{originalyear} field should be used to denote the year
        of the original thesis, even if it is the same as the year of the
        abstract, provided that the original thesis is used, and not
        the abstract. Then, the \fieldname{school} field should also
        be used, and optionally the \fieldname{type} field. If only
        the abstract is used, it should presumably be treated as a
        journal article.


    \item[\entryname{mastersthesis}\LC] \mbox{}\\
        This is equivalent to the \entryname{phdthesis} type, except that
        the default ``unpublished'' and ``published'' \fieldname{type}s are
        ``\verb+Unpublished master's thesis+'' and
        ``\verb+Master's thesis+''.

    \item[\entryname{unpublished}\LC] \mbox{}\\
         For unpublished manuscripts and similarly ``obscure'' material.
         The \fieldname{howpublished} field will typically be used to
         indicate what kind of work is referred to (e.g.,
         ``\verb+Unpublished manuscript+''). The \fieldname{organization}
         field can be used to denote the organization in which the document
         was produced, e.g., ``\texttt{Johns Hopkins University, Center
         for Social Organization of Schools}''. Note that the larger
         organization should be given first and the department after that.
         The address (city and state, etc., see the discussion of the
         \fieldname{address} field in section~\ref{subsec:fields} below)
         of the organization should be given in the \fieldname{address}
         field, unless it is already mentioned in the name of the
         organization. Presumably, if the organization is
         ``\verb+University of Groningen+'', the city name ``Groningen''
         should not be given in the \fieldname{address} field, but
         the country ``The Netherlands'' should. When both the
         \fieldname{organization} and the \fieldname{address} field
         are available, \pkg{apacite} formats these as
         ``organization, address''. This is different from the
         usual ``address: publisher'' form. This behavior cannot
         explicitly be deduced from the 5th edition, nor from the
         4th edition, of the APA manual, but the 3rd edition
         \cite{APAManual3} gives an explicit example (example 53,
         p.~131): \citeA{APA-3rd-ed-ex53}.

    \item[\entryname{misc}\LC] \mbox{}\\
        For works that do not fit into the other categories, such as
        motion pictures, cassette recordings, computer software, etc.
        The \fieldname{type} field can be used to indicate the type
        of work, and \pkg{apacite} recognizes a few specific types
        that should be formatted a little differently, see the discussion
        of the \fieldname{type} field below. If the \fieldname{address}
        and \fieldname{publisher} fields are available, the address and
        publisher part is formatted as with books. The \entryname{unpublished}
        and \entryname{misc} types are very similar, but there are some
        differences. For example, \entryname{unpublished} uses the
        \entryname{organization} field and \entryname{misc} uses the
        \fieldname{publisher} field, and this part is formatted differently.
        Further, the \entryname{unpublished} type requires
        \fieldname{author}, \fieldname{editor}, \fieldname{title}, or
        \fieldname{type}, whereas with \fieldname{misc},
        \fieldname{howpublished} takes the first position if these fields
        are all empty. Finally, as briefly indicated above and discussed
        in more detail below, \entryname{misc} recognizes some special
        types in the \fieldname{type} field.

    \item[\entryname{literal}] \mbox{}\\
        If the other categories do not format the item correctly, this
        category can be used. The \fieldname{text} field is copied literally
        to the bibliography. The \fieldname{firstkey}, \fieldname{key},
        \fieldname{year}, and possibly \fieldname{originalyear} and
        \fieldname{translator} fields are necessary to get correct
        in-text citations. However, I have never needed to use this
        entry type and I think that \entryname{misc} should also
        be able to format the entry correctly. Furthermore, the
        correct placement of \entryname{literal} references in the
        reference list (alphabetizing, sorting), may be problematic.

    \item[\entryname{manual}\LC] \mbox{}\\
        This is treated as a \entryname{misc}, except that when the
        \fieldname{type} field is empty, it is assumed to be a
        \cmd{\bibcomputersoftwaremanual}. See also the description of
        the \fieldname{type} field below.

    \item[\entryname{booklet}\LC]
    \item[\entryname{inbook}\LC]
    \item[\entryname{inproceedings}\LC]
    \item[\entryname{proceedings}\LC] \mbox{}\\
        These categories are defined by all standard citation styles. They
        are, however, not needed for the examples in the APA manual. For
        compatibility, however, they are included and defined as follows:
        \entryname{booklet} = \entryname{proceedings} =
        \entryname{misc}; \entryname{inbook} = \entryname{inproceedings} =
        \entryname{incollection}. \citeA[p.~230]{KoDa04} also mention
        \entryname{conference} as being the same as \entryname{inproceedings};
        for compatibility, this is now supported in \pkg{apacite}.
\end{description}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Fields}
\label{subsec:fields}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The following fields can be used to describe a reference in the
\fname{.bib} file:
\begin{description}

    \item[\fieldname{address}\LC] \mbox{}\\%
       The address (usually the city and state or country) of the
       publisher, school, institution, or organization that published
       the item or at which the item was produced. The APA manual
       requires that the state or territory of a U.S.-city must be given
       in the official two-letter U.S. Postal Services form.

    \item[\fieldname{annote}\LC]
    \item[\fieldname{annotate}\LC] \mbox{}\\
       These are used with the \pkg{apacann} and \pkg{apacannx} bibliography
       styles to generate annotated bibliographies, see
       section~\ref{sec:annotate}. They are simply ignored without warning by
       the \pkg{apacite} and \pkg{apacitex} bibliography styles.

    \item[\fieldname{author}\LC] \mbox{}\\
       The author(s) of the work. This may also be a corporate
       author when applicable, but some specific measures must
       then be taken to prevent the corporate name from being
       interpreted as a first name and last name
       (such as ``Association, A. P.''):
\begin{verbatim}
  author = {{\bibcorporate{American Psychological Association}}},
\end{verbatim}
       It is important to surround the \cmd{\bibcorporate}\marg{Author}
       by an additional pair of braces. Otherwise, \BibTeX{} sorts
       the entry as if its name was ``Bibcorporate\marg{Author}''.
       Section~\ref{sec:xmpl} contains more examples.

       As discussed in the standard \BibTeX{} documentation,
       multiple authors must be separated by the word \verb+and+,
       and each author's name can either be given in the form
       ``\opt{firstnames}\verb+ +\opt{lastnames}'' or
       ``\opt{lastnames}\verb+, +\opt{firstnames}''. However,
       ``von'' parts and ``junior'' parts complicate issues
       a bit. See the examples and the discussion of them.

       I would generally give the full first name(s) in the \fname{.bib}
       file, even though the APA manual only requires initials,
       because other styles require full first name(s) and
       \pkg{apacite} abbreviates to initials automatically.
       I have done this only occasionally with the examples,
       because the APA manual only gives the initials.
       Therefore, I have only provided first names with a few
       examples for which I knew the authors' first names.

       Previous versions of the APA manual required that, if there
       are more than six authors, only the first six should be named
       in the reference list, followed by ``et al.'', which allowed
       one to include only the first six plus ``|and others|'' in the
       \fname{.bib} file. In the 6th edition, however, the APA changed
       this. Now, when there are up to seven authors, they should
       all be listed, but with eight or more, the first six should
       be listed, plus dots (\ldots), plus the last author. Therefore,
       ``|and others|'' should not be used anymore in the \fname{.bib}
       file. (It was already discouraged in earlier versions of the
       \pkg{apacite} documentation.) Thus, one should list all authors
       in the \fname{.bib} file.

    \item[\fieldname{booktitle}\LC] \mbox{}\\
       The title of the larger work, typically book, but sometimes
       something else, like a report, in which the referenced item
       (article) was published.

    \item[\fieldname{chair}] \mbox{}\\
       The chair(s) of a symposium or meeting. Used for lectures.
       It is formatted the same way as editors.

    \item[\fieldname{chapter}\LC] \mbox{}\\
       The chapter number if the referenced item is a chapter in
       a larger collection. Typically used if the referenced work
       is a chapter in an internet document. If the collection is
       a book, page numbers (in the \fieldname{pages} field)
       should be used instead according to the APA rules.

    \item[\fieldname{crossref}\LC] \mbox{}\\
       The \pkg{apacite} package does not recognize this field,
       because the APA manual does not discuss explicit
       cross-referencing. If the referenced work is a chapter
       (article) in an edited book, all relevant information
       should be given in the reference list as part of the
       information about the referenced chapter, not as, e.g.,
       ``In Wainrib (1992)''. If several chapters from the
       book edited by Wainrib are referenced, the same information
       about this book is given with each referenced chapter,
       and the work itself is not a separate entry in the reference
       list (unless it is explicitly referred to).

       However, the \fieldname{crossref} field
       \emph{can} be used, as part of standard \BibTeX{} usage.
       Missing fields for the referenced work are then copied from
       the cross-referenced entry, which must come \emph{after}
       the referring entry in the \fname{.bib} file. If you use
       this, remember to put the title of the book (also) in the
       \fieldname{booktitle} field, because the \fieldname{title}
       field of the referring entry is not empty (it contains
       the chapter title).

       I have not tested cross-referencing in detail, so I do not
       know whether it behaves well (i.e., complies with the implicit
       or explicit APA rules) under various circumstances.
       Therefore, I do not recommend using it without thorough
       testing.

    \item[\fieldname{day}] \mbox{}\\
       The day of the month on which the referenced item was published,
       produced, or presented. Mainly used for articles in daily or
       weekly magazines or newspapers, for lectures (although the
       APA manual only specifies the month), and electronic documents.

    \item[\fieldname{doi}] \mbox{}\\
       Digital object identifier (DOI). The 6th edition of the APA manual
       asks authors to supply this whenever available.

    \item[\fieldname{edition}\LC] \mbox{}\\
       The edition of the book or report. Traditionally, this is of the
       form ``1st'', ``2nd'', ``3rd'', etc., or ``Rev.'' for a revised edition.
       This form is still supported, but \pkg{apacite} now also supports
       the form in which only the number is given: ``1'', ``2'', etc.
       If \pkg{apacite} detects that only a number is given, it inserts
       ``\cmd{\PrintOrdinal}\marg{number}'' in the \fname{.bbl} file.
       This \LaTeX{} function converts the number again to ``1st'', etc.
       The advantage of this is that the same bibliography database can be
       used for documents in different languages: In the language-specific
       (\fname{.apc}) files supplied with \pkg{apacite},
       \cmd{\PrintOrdinal} is redefined according to the document
       language.

    \item[\fieldname{editor}\LC] \mbox{}\\
       The editor(s) of a book, report, or special issue of a journal.
       In the examples, this field is also ``misused'' for the
       producer of a television series.

    \item[\fieldname{englishtitle}] \mbox{}\\
       The English translation of the title of an item with a non-English
       title. The APA manual requires that if the referenced work has a
       non-English title, an English translation should be given as well. For
       an article in a journal with a non-English name or in a book with a
       non-English title, the journal name or book title should not be
       translated or put in this field, only the title of the referenced work
       itself must be translated. Because, as of version
       \APACversiondate{2005/06/01}, \pkg{apacite} contains some support of
       other languages for the main document (see
       section~\ref{sec:compat-babel}), this field needs rethinking, which
       will be deferred to a future version (but, as always, suggestions
       are welcome).

    \item[\fieldname{firstkey}] \mbox{}\\
       The \fieldname{firstkey} field, if not empty, is used as
       ``author'' for the first citation to an item. Subsequent citations
       then use the \fieldname{key} field. This can be used if there is
       no author or editor field that can be used for citations, or in
       certain cases with corporate authors, where the citation in the
       text uses an abbreviation of the author's name for second and
       subsequent citations, where the abbreviation is introduced in the
       first citation. It can also be used to ``trick'' the system
       in difficult cases. See also \fieldname{key}.

    \item[\fieldname{howpublished}\LC] \mbox{}\\
       A description of how something was ``published''. For example,
       ``Unpublished manuscript'' or ``Paper presented at the meeting
       of the American Professional Society on the Abuse of Children''.
       Also used for more retrieval information about electronic
       documents, e.g., ``Retrieved November 19, 2000, from the
       PsycARTICLES database'', or
\begin{verbatim}
  howpublished = {Retrieved August 24, 2000, from Columbia University,
                  Institute for Learning Technologies Web site:
                  \url{http://www.ilt.columbia.edu/
                    publications/papers/newwine1.html}\bibnodot{.}}
\end{verbatim}
        However, if the retrieval information consists only of a
        date and/or a URL, it is better to use the \fieldname{lastchecked}
        and \fieldname{url} fields for this and let \pkg{apacite}
        format this information. See also the \fieldname{note} field
        for an alternative to the \fieldname{howpublished} field.

    \item[\fieldname{institution}\LC] \mbox{}\\
       The institution, university, or company that published a
       (technical) report.

    \item[\fieldname{journal}\LC] \mbox{}\\
       The journal, magazine, newspaper, etc.{} in which an
       article, a review, or an abstract of a thesis was published.

    \item[\fieldname{key}\LC] \mbox{}\\
       See \fieldname{firstkey}. The \fieldname{key} field, if not
       empty, is used for second and subsequent citations, or all citations
       if \fieldname{firstkey} is missing. If \fieldname{author} is
       empty and \fieldname{editor} is empty or can not be used as
       author (e.g., in \entryname{incollection}), the \fieldname{key}
       field may be necessary to obtain a useful citation. This is
       so, because the APA manual requires an abbreviation of the
       title as in-text citation, and the abbreviation must be
       sensible. In the current version, \pkg{apacite} uses the
       whole title if \fieldname{firstkey} and \fieldname{key} are missing.
       Therefore, if the title is considered too long to use in citations,
       the user must provide an abbreviation in the \fieldname{key} field.
       Furthermore, the user must then also define the formatting:
       If the key is used for a difficult kind of author (e.g.,
       corporate author), it should be formatted as an author,
       i.e., in plain text, with names capitalized.
       If the key is used for an abbreviation of an article
       title, it should be in plain text, with major words capitalized
       (unlike in the reference list), and between double quotes
       (`` and ''; also unlike in the reference list).
       If the key is used for an abbreviation of a book title, it
       should be emphasized, with major words capitalized
       (unlike in the reference list), but not between quotes.

       In a field in the \fname{.bib} file that is also
       used for the citations, such as the \fieldname{key} field,
       formatting through, e.g.,
\begin{verbatim}
  key = {{\itshape Text}},
  key = {{\em Text\/}},
\end{verbatim}
       can be done (note the extra pair of braces!), but the
       seemingly more logical variations
\begin{verbatim}
  key = {\textit{Text}},
  key = {{\textit{Text}}},
  key = {\emph{Text}},
  key = {{\emph{Text}}},
\end{verbatim}
       do not work.
       However, it is generally preferable to use as less explicit
       formatting in the \fname{.bib} files as possible, because this
       decreases the possibilities of successfully using the
       same \fname{.bib} file with other styles. The following works
       excellent:
\begin{verbatim}
  key = {{\APACcitebtitle{Text}}},
\end{verbatim}
       where the \cmd{\APACcitebtitle} macro recognizes that the argument
       should be formatted as a booktitle (i.e., in italics according to the
       APA rules). This macro, and its companion \cmd{\APACciteatitle} for
       article title formatting, are used by \pkg{apacite} if the
       \fieldname{firstkey} and \fieldname{key} fields are missing,
       but can also be used by the user. Note that if you use such a
       \fname{.bib} file with another style, you have to provide
       definitions of these macros yourself (which can be copied from
       the \pkg{apacite} source code).

       \emph{Warning:} the \fieldname{key} field, which acts
       as a kind of pseudo-author, should not be confused with the
       (citation) \opt{key} that is used to match citations with
       entries in a \fname{.bib} file.

    \item[\fieldname{lastchecked}] \mbox{}\\
       The date on which a web page was last visited. Only used in
       combination with the \fieldname{url} field. Currently,
       \pkg{apacite} does not contain language-specific code to
       dissect this date, but copies its contents literally to the
       \fname{.bbl} file. Hence, if you intend to use the same
       bibliography database for documents in different languages,
       you may have to use a self-defined command for this. You can
       use the \pkg{apacite} commands \cmd{\APACrefYearMonthDay}
       and \cmd{\APACmonth} as templates for this. I will probably
       provide such a facility in a future version of \pkg{apacite}.

    \item[\fieldname{month}\LC] \mbox{}\\
       The month something was published. Mainly used for
       magazine or newspaper articles, lectures, and electronic documents.
       Use the month macros \verb+jan+, \verb+feb+, etc. These are
       predefined strings in the \fname{.bst} files, reverting to
       ``\verb+{\APACmonth{01}}+'', etc. You can also use the additional
       macros \verb+winter+, \verb+spring+, \verb+summer+, and \verb+fall+,
       which the \fname{.bst} files translate into
       ``\verb+{\APACmonth{13}}+''--``\verb+{\APACmonth{16}}+''.
       The \cmd{\APACmonth} command translates the numbers to the month or
       season names. This system allows language-specific behavior at
       the \LaTeX{} stage.

    \item[\fieldname{note}\LC] \mbox{}\\
       A note. This puts additional information between parentheses
       at the end of a reference list entry. In the examples from
       the APA manual, it is used for NTIS No., ERIC No., and UMI No.,
       and for notes about how to obtain the work
       (``Available from \opt{organization}, \opt{full address}'').
       If however, the work has been obtained from the internet
       or from an ``aggregated database'', then the
       \fieldname{howpublished} or \fieldname{url} field should be
       used, because it should not be between parentheses then.

       Finally, the \fieldname{note} field is used to give the
       recording date (i.e., year) of a song when this is different
       from the date (year) of copyright. The latter should be
       put in the \fieldname{year} field.

       Do not use the \fieldname{note} field to denote the original
       publication of a reprint or translation, because the
       \fieldname{originalyear} field must be used in those cases to
       obtain the correct citation in the text \cite<e.g.,>{ex39}.

    \item[\fieldname{number}\LC] \mbox{}\\
       The number of a journal issue or a report. This can be quite
       complex, for example, ``\verb+PRM~92-01+'', or
       ``\verb+3, Pt.~2+'', or ``\verb+1, Serial No.~231+''.
       These latter examples imply that the generality (language and
       style independence) of the \fname{.bib} file is somewhat lost.
       Furthermore, if the journal paginates by year and not by issue,
       the issue number should not be mentioned at all (except when
       referring to a whole special issue). Of course, \pkg{apacite}
       does not know whether the journal paginates by issue or by year.
       If the \fieldname{number} field is available, \pkg{apacite}
       simply assumes that it should be included. It is the user's
       responsibility to ensure that this is indeed the case.

    \item[\fieldname{organization}\LC] \mbox{}\\
       Used for the \entryname{unpublished} reference type to denote
       the organization in which the unpublished work was produced.

    \item[\fieldname{originaladdress}]
    \item[\fieldname{originalbooktitle}]
    \item[\fieldname{originaledition}]
    \item[\fieldname{originaleditor}]
    \item[\fieldname{originaljournal}]
    \item[\fieldname{originalnumber}]
    \item[\fieldname{originalpages}]
    \item[\fieldname{originalpublisher}]
    \item[\fieldname{originalvolume}]
    \item[\fieldname{originalyear}] \mbox{}\\
        These (\fieldname{original*-}) fields have the same
        meaning as their counterparts without the ``original'' prefix,
        except that they refer to the book or journal in which the
        work was originally published. This can be used in referring to
        translations or reprints of articles in journals or books. If the
        original work is a book or other ``standalone'' work,
        only the \fieldname{originalyear} field should be used. If the
        original work is a (PhD or Master's) thesis that is also abstracted
        in \emph{Dissertation Abstracts International},
        \emph{Masters Abstracts International}, or comparable, the
        \fieldname{originalyear} field should be used to denote the year
        of the dissertation and the \fieldname{year} field to
        denote the year of publication of the abstract, even if they
        are the same.

    \item[\fieldname{pages}\LC] \mbox{}\\
        The (inclusive) page numbers of the article that is referred to,
        in the journal or book in which it was published. If a range of
        pages is given (which is usually the case), an  en-dash should
        be used: ``\verb+29--43+''. Other styles sometimes allow a
        single hyphen (``\verb+29-43+''), which is then automatically
        formatted as an en-dash (``29--43''), rather than as a hyphen
        (``29-43''), but I have encountered situations, such as software
        manuals (LISREL) and reports for the U.S. Government, in which
        the page number was of the form ``II-3'',
        meaning page~3 of chapter~2. In such a situation, you may
        get page numbers like ``II-1--II-15'', where the distinction
        between a hyphen and an en-dash becomes important. Therefore,
        \pkg{apacite} does not perform such automatic transformations.

    \item[\fieldname{publisher}\LC] \mbox{}\\
        The publisher of the item. Primarily used for books.

    \item[\fieldname{school}\LC] \mbox{}\\
        The school or university for which a PhD thesis or
        master's thesis was written.

    \item[\fieldname{series}\LC] \mbox{}\\
        Not used, although the APA manual has a rule for series.
        If you refer to a volume in a series, the series title,
        volume number, and volume title should be joined into
        a two-part title , e.g., \emph{Handbook of child psychology:
        Vol.~4. Socialization, personality, and social development},
        see ex.~36. In \pkg{apacite} this whole part must be put in
        the \fieldname{title} or \fieldname{booktitle} field
        (whichever is appropriate).

        For a long time, I have intended to support the
        \fieldname{series} field to allow disentangling such
        situations. However, in the end, I have decided not to
        do this. The reason for this is that, according to my
        interpretation, the meaning of ``series'' in the APA manual
        is quite different from the meaning of the \fieldname{series}
        field, as intended by Oren Patashnik (the author of \BibTeX{}
        and the original style files). Many books are published in
        some sort of series. For example, my book with Tom Wansbeek
        \cite{WaMe00}, is vol.~37 in the \emph{Advanced Textbooks
        in Economics} series, of which the series editors are
        C.~J. Bliss and M.~D. Intriligator. The intention of the
        \fieldname{series} field is to generate a reference list entry
        like
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{list}{\relax}{\labelsep=0em%
              \parsep=0pt%
              \itemsep=0pt plus .3pt\relax%
              \leftmargin=2.5em%
              \itemindent=-2.5em}%
\sloppy\clubpenalty4000\widowpenalty4000
\sfcode`\.=1000\relax
\item
Wansbeek, T., \& Meijer, E.
\unskip\ \hskip .11em plus .33em minus .07em
(2000).
\unskip\ \hskip .11em plus .33em minus .07em
\Bem{Measurement error and latent variables in econometrics}
(Advanced Textbooks in Economics No.~37).
\unskip\ \hskip .11em plus .33em minus .07em
Amsterdam: North-Holland.
\end{list}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        In economics (and often in psychology, I guess), mentioning
        the series usually does not add much relevant information,
        and it is therefore typically omitted. I think this is how
        the APA intends it as well. However, in computer science, it
        is often very convenient, because certain series, like Springer's
        \emph{Lecture Notes in Computer Science} (LNCS) have a certain
        status of their own, and researchers know how to find volumes
        in this series.

        In my interpretation, the APA ``series'' refers to a single
        multivolume work with separate editors for the constituent
        volumes, but with a series editor who initiates the whole
        series. In the example from the APA manual, the
        \emph{Handbook of child psychology} is not a loose collection
        of separate books by different authors, but a combined effort
        managed by the series editor to give an overview of the field.
        In this case, the series editor may be considered the primary
        author and it makes sense to have the different volumes of the
        series together in the reference list. With my book with
        Tom Wansbeek, the series editors act more like journal editors,
        and different volumes of the series are unrelated books that
        do not need to be gathered together in the reference list.
        It would make no sense to cite this book as
        ``Bliss, Intriligator, Wansbeek, \& Meijer (2000)''.

        Because in my interpretation, the usual meaning of the
        \fieldname{series} field should not be included in the
        reference list according to the APA rules, \pkg{apacite}
        ignores the \fieldname{series} field. Perhaps I'll
        implement the APA manual ``series'' rules by introducing
        a \fieldname{volumetitle} field, but this will further reduce
        compatibility with other citation styles.

    \item[\fieldname{symposium}] \mbox{}\\
        The name of the symposium or meeting at which a
        lecture was given. This is typically used for the
        construction ``In \opt{chair} (Chair), \opt{symposium}'',
        see ex.~51. I have never used it myself, however,
        I always use the ``Paper presented \dots'' form,
        which puts this information in the \fieldname{howpublished}
        field.

    \item[\fieldname{text}] \mbox{}\\
        Used for items of type \entryname{literal}. This field contains
        the complete literal text to be used in the bibliography.
        I've never used it.

    \item[\fieldname{title}\LC] \mbox{}\\
        The title of the work.

    \item[\fieldname{translator}] \mbox{}\\
        The translator of a book or article. This should
        be formatted in the same way as \fieldname{author} and
        \fieldname{editor}. If the \fieldname{translator} and
        \fieldname{editor} fields are identical, they are
        formatted as if there were only an editor, except that the
        editor receives the suffix ``(Ed. \& Trans.)'' instead of
        just ``(Ed.)'', or similarly if there is more than 1 editor.

    \item[\fieldname{type}\LC] \mbox{}\\
        The type of \entryname{phdthesis} (e.g.,
        ``Doctoral dissertation''), type of \entryname{article}
        (e.g., ``Letter to the editor''), type of \entryname{techreport}
        (e.g., ``DHHS Publication''), type of \entryname{book}
        (e.g., ``Brochure''), type of \entryname{misc}
        (e.g., ``Cassette recording''), and so forth.

        With a review (which is typically an \entryname{article}),
        the \fieldname{type} field contains a lot of information
        and formatting, e.g.:
\begin{verbatim}
  type = {Review of the book {\APACcitebtitle{Life in the middle:
            Psychological and social development in middle age}}},
\end{verbatim}
        where I used the \cmd{\APACcitebtitle} command introduced above in
        the discussion of the \fieldname{key} field.

        In one of the APA manual examples, I used the \fieldname{type}
        field to give a description of the subject of an unpublished
        raw data file (``Auditory response latencies in rat auditory
        cortex''), leaving the \fieldname{title} field blank.

        For most reference types, if the \fieldname{type} field
        is missing, it is simply ignored and no type description
        is given. For a \entryname{techreport}, however, if the
        \fieldname{type} field is missing, the default type
        (``Tech.\ Rep.\hbox{}'') is inserted. In ex.~42 of the APA manual,
        a report without a type description is given. To make it
        possible to format a report successfully without a
        type description, \pkg{apacite} recognizes
\begin{verbatim}
  type = {\bibnotype},
\end{verbatim}
        indicating that there should be no type description.

        Another special purpose use of the \fieldname{type}
        field is for a computer program, software, programming
        language and/or manual. These are put into a \entryname{misc}
        entry, but unlike other \entryname{misc} types (such as
        motion pictures) the titles of these types should not
        be italicized. This is now recognized by \pkg{apacite}
        in the following way: When referring to a computer program,
        software, programming language and/or manual, you should
        use the \entryname{misc} reference type with
        one of the following commands in the \fieldname{type} field:\\
        \cmd{\bibcomputerprogram},\\
        \cmd{\bibcomputerprogrammanual},\\
        \cmd{\bibcomputerprogramandmanual},\\
        \cmd{\bibcomputersoftware},\\
        \cmd{\bibcomputersoftwaremanual},\\
        \cmd{\bibcomputersoftwareandmanual}, or\\
        \cmd{\bibprogramminglanguage}.\\
        Using any of these commands as type designator of a
        \entryname{misc} entry ensures that the title is not italicized,
        as required. The \entryname{manual} entry is now equal to
        \entryname{misc} with default type \cmd{\bibcomputersoftwaremanual}
        if the \fieldname{type} field is empty.

        Similarly, if you refer to a message that has been posted to
        a newsgroup, internet forum, etc., you should use the
        \entryname{misc} reference type with \cmd{\bibmessage} as
        \fieldname{type} field.

    \item[\fieldname{url}] \mbox{}\\
       The web address of a document. Used if the cited document (or
       other work) is a website or was obtained from a website. Long
       web addresses can cause problems, because \BibTeX{} splits long
       lines (more than 80 characters) in the \fname{.bbl} file and inserts
       a \TeX{} comment (percent sign). In most situations, this works fine,
       because the percent sign ``hides'' the line break, which would be
       processed as an undesired space by \TeX{}. But within the argument of
       a \cmd{\url} command, a percent sign is copied to the output, because
       it is a valid character in a URL. To prevent this problem, insert
       line breaks and/or spaces in the URL in the \fname{.bib} file:
\begin{verbatim}
  url = {ftp://ftp.princeton.edu/harnad/Psycoloquy/
         2000.volume.11/psyc.00.11.001.
         language-sex-chromosomes.1.crow},
\end{verbatim}
       Then \BibTeX{} breaks lines at the spaces/line breaks if a line
       break in the output is considered necessary (but not otherwise).
       These spaces are suppressed by default in the output, which is usually
       the desired behavior. But see the \pkg{hyperref} and \pkg{url}
       documentation if you want this differently. Also note that in the
       \fieldname{url} field, special characters like `|%|'
       and `|#|' should be entered without a backslash, unlike the normal
       situation if they would be used in the text.

    \item[\fieldname{urldate}] \mbox{}\\
       See \fieldname{lastchecked}. This one is apparently defined in the
       \pkg{jurabib} package. It is unfortunate that different packages define
       different fields for the same function.

    \item[\fieldname{volume}\LC] \mbox{}\\
        The volume or volumes of the referenced book(s) or
        of the book in which the referenced article was published,
        or the volume of the journal (magazine, newspaper, \ldots)
        in which the referenced article was published.

    \item[\fieldname{year}\LC] \mbox{}\\
        The year in which the referenced item was published, or
        if it was not published, the year in which it was written
        or presented. For manuscripts or books that are accepted
        for publication but have not yet been published, ``in press''
        should be used according to the APA rules. The best way to do
        this is to use the ``\cmd{\BIP}'' command, which can be redefined
        by the user if the language or editorial style requires
        something else than ``in press''. Furthermore, \cmd{\BIP}
        is recognized by \pkg{apacite} and treated a little differently,
        because for multiple ``in press'' references with the same
        author(s), a hyphen (``-'') should be inserted between the
        ``year'' (i.e., ``in press'') and the ``a'', ``b'', etc., that
        follow it to distinguish the works, whereas this hyphen must
        be omitted if the ``year'' is an ordinary year (1991a, 1991b).

        If no date is explicitly given in (or on) the referenced work,
        a ``n.d.'' (no date) should be given as year description.
        For this, \pkg{apacite} supports the \cmd{\bibnodate}
        command. This sometimes leads to different formatting as well,
        e.g., by referencing a translation of a work of which there
        is no original date. Then the \fieldname{originalyear}
        field should be \cmd{\bibnodate} and the \fieldname{year} field
        is then, e.g., \verb+1931+. If the \fieldname{translator}
        field is not empty, the citation in the text is then formatted
        as, e.g., ``\citeA{3.100-2}''.
\end{description}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Overriding the default sorting orders}
\label{subsec:sort}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Occasionally, it may be necessary to override \BibTeX's default sorting.
For example, the way \BibTeX{} handles accents and other nonstandard
characters, which is typically fine for documents in English, may
not be acceptable for documents in other languages:
``\verb+\"{u}+'' is treated as ``\verb+u+'', ``\verb+\ss+'' is treated as
``\verb+ss+'', and ``\verb+\ae+'' is treated as ``\verb+ae+''.
In non-English languages this sorting may not be appropriate and one
may desire that ``\verb+\"{u}+'' is treated as ``\verb+ue+''.
Numerous problems are caused by different conventions in different languages.
Some examples are given in the documentation of the \textsf{amsrefs}
package. Non-latin scripts (Greek, Hebrew, Arabic, Chinese, etc.) may not be
handled correctly as well. I am not able to judge this, nor does it seem
to be a problem that must be solved in \textsf{apacite}. It has been
announced that \BibTeX~1.0, when it will be released, will support
non-English languages as well.

An issue that occurs in English (APA) documents is that, according to
the APA, numbers should be sorted as if they were spelled in words:
``2003'' must be sorted as if it says ``\mbox{twothousandandthree}'';
see example~4.04 in section~\ref{sec:xmpl} below.

\DescribeMacro{\APACSortNoop}
Overriding the default sorting order can be done by using the
\cmd{\APACSortNoop} command in the \fname{.bib} file. This is a \LaTeX{}
command provided by \pkg{apacite}. It has one mandatory argument, but it
outputs nothing. However, \BibTeX{} does not know this and uses the
contents of this command to sort the entry. For example,
\begin{verbatim}
  author = {M{\"{u}}ller, Gerd},
\end{verbatim}
is sorted as ``\verb*+muller  g+'', whereas
\begin{verbatim}
  author = {{\APACSortNoop{Mueller}}M{\"{u}}ller, Gerd},
\end{verbatim}
is sorted as ``\verb*+muellermuller  g+'', which typically results
in the correct ordering. In the typeset document, both look like
``M{\"{u}}ller''. Note that the extra pair of braces around the
\cmd{\APACSortNoop} command are necessary to suggest to \BibTeX{}
that it is an ``accent''. The specification
\begin{verbatim}
  author = {\APACSortNoop{Mueller}M{\"{u}}ller, Gerd},
\end{verbatim}
is sorted as ``\verb*+apacsortnoopmuellermuller  g+'', which is
incorrect.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Customization}
\label{sec:custom}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The description in the previous sections, with the exception of
section~\ref{sec:options}, primarily discussed the default behavior of
\pkg{apacite}. However, as mentioned in the introduction, in addition to the
options, \pkg{apacite} offers many possibilities for customization. Most
punctuation used in the citations and reference list are implemented through
\LaTeX{} commands instead of explicit symbols. Consequently, the user can
fine-tune the behavior of \pkg{apacite} by redefining these commands, through
\cmd{\renewcommand} after \pkg{apacite} has been loaded. Analogously, most
fixed texts, like ``Tech.\ Rep.\hbox{}'' and ``Eds.\hbox{}'' are implemented
through \LaTeX{} commands as well, and can similarly be changed by the user.
The commands used by \pkg{apacite} are discussed in this section. Of course,
the defaults are based on the rules of the APA manual.

Some commands, predominantly punctuation, are used both in citations and in
the reference list. If you want their definitions in citations to be different
from their definitions in the reference list, you can simply redefine their
definitions before starting the bibliography.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Punctuation and small formatting issues}
\label{sec:custom-punct}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The following punctuation commands are provided and used for
the citations and reference list.

\DescribeMacro{\BAstyle}
\DescribeMacro{\BAastyle}
\cmd{\BAstyle} defines the text style of the authors (or whatever
takes their place) for an in-text citation. It defaults to nothing:
The authors use the same fonts as the text surrounding it. Introduced
because some journals use a different style. For example,
\emph{Statistica Neerlandica} uses small caps, so for that journal,
you would define
\begin{verbatim}
\renewcommand{\BAstyle}{\scshape}
\end{verbatim}
Do not use the \cmd{\textsc}-type commands, but \cmd{\scshape},
\cmd{\bfseries}, and so forth. The \cmd{\BAstyle} command is used for
the author part by the \pkgoption{apaciteclassic} citation commands,
except the author-only citation commands. \cmd{\BAastyle} is the same
as \cmd{\BAstyle}, except that \cmd{\BAastyle} is used for the
author-only citation commands.

\DescribeMacro{\APACrefauthstyle}
\cmd{\APACrefauthstyle} is similar to \cmd{\BAstyle}, except
that this one is used for formatting authors in the reference list.
In the current implementation, it also applies to editors in the
author position, but not to editors in the editor position and
not to titles and other elements that take the position of authors
if there are no authors and editors.

\DescribeMacro{\BBAA}
\DescribeMacro{\BBAB}
\DescribeMacro{\BAnd}
\cmd{\BBAA} is the ``and'' between authors in a parenthetical
citation and in the reference list, as in
``(Mooijaart \& Bentler, 1986)'' or ``Mooijaart, A., \&
Bentler, P.~M. (1986).''. Its default is ``\&''.
\cmd{\BBAB} is the same ``and'' in a text citation, as in
``Mooijaart and Bentler (1986)''. Its default is ``and''.
The third ``and'', \cmd{\BAnd}, is used in the reference list
if someone is both editor and translator:
``In J. Strachey (Ed. \& Trans.),''. Default is ``\&''.

\DescribeMacro{\BBOP}
\DescribeMacro{\BBCP}
\cmd{\BBOP} (opening parenthesis) and \cmd{\BBCP} (closing parenthesis)
are used for the parentheses in a citation, as in ``(Rao, 1973)'' or
``Rao (1973)'', and the year in the reference list, as in
``Rao, C.~R. (1973).'' By default, they are round parentheses
``('' and ``)''.

\DescribeMacro{\BAP}
\cmd{\BAP} is inserted after the prefix and before the first citation
in a parenthetical citation. It defaults to an ordinary space. Note
that if the prefix ends with a period, \TeX{} interprets this as a
sentence ending and typically inserts a larger space, which is often
not desirable. The standard way to avoid this would be to insert an
explicit space (``|\ |''), but this does not work in a prefix. The
solution is to insert an empty |\hbox{}| after the period:
|\cite<cf.\hbox{}>{Jone01}|.

\DescribeMacro{\BBAY}
\DescribeMacro{\BBYY}
\DescribeMacro{\BBN}
\cmd{\BBAY} is the punctuation between author(s) and year in a
parenthetical citation, as in ``(Rao, 1973)''. \cmd{\BBYY} is the
punctuation between two subsequent years, if two works by the same
author(s) are referenced in a single citation command, as in
``(Rao, 1965, 1973)'' or ``Rao (1965, 1973)''. \cmd{\BBN} is the
punctuation before a note (postfix) after a citation, as in
``(Rao, 1973, p.~25)''.  Default for all three is a comma and a
space (``, '').

\DescribeMacro{\BBC}
\cmd{\BBC} is the punctuation between multiple cites, as in
``(Rao, 1973; Mooijaart \& Bentler, 1986)''. Default is a semicolon
and a space (``; '').

\DescribeMacro{\BBOQ}
\DescribeMacro{\BBCQ}
\cmd{\BBOQ} (opening quote) and \cmd{\BBCQ} (closing quote) are the
quotes around an article title in the reference list, for example the
double quotes in ``Random polynomial factor analysis.'' Default is
the empty string: no quotes are used. (The \pkg{theapa} package
required the closing period to be part of the closing quote, but this
has been changed, because the period must be left out if title
comments, such as type, English translation of non-English title, or
translator follow the title.)

\DescribeMacro{\BPBI}
\cmd{\BPBI} is the period between initials. Default is a period and a
non-breaking space (``.~''), as required by the APA manual. However,
many users prefer removing or reducing the space and in some
non-English speaking countries this is customary. This can be achieved
by redefining this command to, for example, just a period (no space),
or ``|.\,|'' (small space). This command cannot be used to remove
periods altogether, because there is still a period at the end. That
is, redefining it as an empty string gives awkward results like
``Bentler, PM., \& Mooijaart, A.''.

\DescribeMacro{\BHBI}
\cmd{\BHBI} is the hyphen between initials. Introduced for analogy with
\cmd{\BPBI} and used for authors who have two or more first names
with a hyphen between them, e.g., Jean-Paul Sartre. Default is
a period and a hyphen. Unlike \cmd{\BPBI}, I think this one will not be
changed often, although \BibTeX{} suppresses hyphens when it suppresses
spaces between initials as well, so there are people who have different
preferences. (Hence, \pkg{apacite} partly bypasses the standard
\BibTeX{} formatting functions to make this work.)

\DescribeMacro{\BCBT}
\DescribeMacro{\BCBL}
\cmd{\BCBT} is the comma between authors in the reference section when
there are two authors, as in
``Mooijaart, A., \& Bentler, P.~M. (1986).'' The comma after the ``A.''
is this one. Default is a comma. The APA manual requires it, but other
styles leave out this comma. In such a case, you would redefine this
``comma'' to be the empty string:
\begin{verbatim}
\renewcommand{\BCBT}{}
\end{verbatim}
Analogously, \cmd{\BCBL} is the comma before the last author when there
are three or more authors in a citation and in the reference section,
as in ``(Gill, Murray, \& Wright, 1981)'' or
``Gill, P.~E., Murray, W., \& Wright, M.~H. (1981).'' Its default is
also a comma, as required by the APA manual, which is standard U.S.
usage. Other styles, particularly European, such as British English,
omit this comma. Again, in such a case, you would redefine this
``comma'' to be the empty string. (This is in fact done in several of
the language files. See section~\ref{sec:compat-babel}.)

\DescribeMacro{\BDBL}
\cmd{\BDBL} is the dots before the last author in the reference
section when the reference has more than seven authors. The default
is ``|, \dots{} |''. The APA manual seems to imply that there
shouldn't be space around the dots, but I think it's better to have
the space and I assume editors won't mind. However, if they insist on
removing the space, you can redefine \cmd{\BDBL} accordingly.

\DescribeMacro{\theBibCnt}
\DescribeMacro{\BCnt}
\DescribeMacro{\BCntIP}
\DescribeMacro{\BCntND}
If there are multiple citations with the same author and year, a
letter should be added to the year to distinguish the references.
For example, one may refer to two or more articles by J.~Smith
published in 1982. They should be referred to as ``Smith (1982a)'',
``Smith (1982b)'', and so forth. To accomplish this, the counter
|BibCnt| is defined in \fname{apacite.sty}. The \cmd{\theBibCnt}
command defines how the value of |BibCnt| is formatted. The default
is ``|\alph{BibCnt}|'', that is, as a plain lowercase letter. To
emphasize (italicize) the ``a'', ``b'', and so forth, you can redefine
this as
\begin{verbatim}
\renewcommand{\theBibCnt}{{\em\alph{BibCnt}\/}}
\end{verbatim}
(This presumably works better than ``\verb+\emph{\alph{BibCnt}}+''.)
To control this behavior, redefining the \cmd{\theBibCnt} command
should normally be sufficient. However, the complete formatting
commands are \cmd{\BCnt}, \cmd{\BCntIP}, and \cmd{\BCntND}. The
second of these is for ``in press'' works, which need an extra hyphen
between ``in press'' and the ``a'' and ``b'' suffixes. The third is
similar, for works without a date, which is formatted as
``n.d.\hbox{}'' in APA style. Their default definitions
in \fname{apacite.sty} are
\begin{verbatim}
\DeclareRobustCommand{\BCnt}[1]{\setcounter{BibCnt}{#1}\theBibCnt}
\DeclareRobustCommand{\BCntIP}[1]{\setcounter{BibCnt}{#1}\mbox{-\theBibCnt}}
\DeclareRobustCommand{\BCntND}[1]{\setcounter{BibCnt}{#1}\mbox{-\theBibCnt}}
\end{verbatim}

\DescribeMacro{\APACciteatitle}
\DescribeMacro{\APACcitebtitle}
\cmd{\APACciteatitle} determines the formatting of the title of an
article (or similar work) when used as a citation in the text when no
author or editor is available for that purpose. Its default definition
is
\begin{verbatim}
\newcommand{\APACciteatitle}[1]{``#1''}
\end{verbatim}
that is, the title is put between double quotes. Similarly,
\cmd{\APACcitebtitle} determines the formatting of the title of a book
(or other independent work) when used as a citation in the text when no
author or editor is available for that purpose. Its default definition
is
\begin{verbatim}
\newcommand{\APACcitebtitle}[1]{{\em #1\/}}
\end{verbatim}
that is, the title is emphasized (in italics) but not put between
double quotes.

\DescribeMacro{\APACmetastar}
\cmd{\APACmetastar} is the asterisk that precedes an item in the
bibliography to denote that it is included in the meta-analysis.
The default value is ``\verb+\ensuremath{{}^\ast}+'', which
prints as ``\APACmetastar''.

\DescribeMacro{\bibnewpage}
If the \pkgoption{bibnewpage} option is chosen, \cmd{\bibnewpage} is
included before the bibliography. Its default definition is
\cmd{\clearpage}, but \fname{apa.cls} used \cmd{\newpage} in a
similar construction with its \pkgoption{man} option. See
\citeA[p.~215]{LaTeXbook} or \citeA[p.~37]{KoDa04} for the differences
between \cmd{\clearpage} and \cmd{\newpage}.

\DescribeMacro{\bibliographytypesize}
\cmd{\bibliographytypesize} is used before the reference list, but
after the section or chapter heading. It is intended for the font size
of the reference list: For \citeA{WaMe00}, I defined it as \cmd{\small}
(and even then the reference list took up 34 pages). The default value
is \cmd{\normalsize}.

\DescribeMacro{\bibleftmargin}
\DescribeMacro{\bibindent}
\DescribeMacro{\bibitemsep}
\DescribeMacro{\bibparsep}
\DescribeMacro{\biblabelsep}
Several parameters determine the layout of the reference list.
\cmd{\bibleftmargin} gives the indentation of the second and subsequent
lines of a reference list entry, relative to the usual left margin. It
is not a proper command, but a rubber length, which means that it is
not changed by \cmd{\renewcommand} but by \cmd{\setlength}. Its default
value is 2.5em. \cmd{\bibindent} gives the indentation of the
first line of a reference list entry, relative to the second line. It
is also a rubber length, with default value is |-\bibleftmargin|, which
means that the first line starts at the original left margin, and the
second and subsequent lines are indented by 2.5em. \cmd{\biblabelsep}
gives the horizontal separation between the reference list label and
the rest of the entry. Normally, there are no reference list labels
when using \pkg{apacite}, but this command allows one to define them
through redefining \cmd{\@biblabel} and \cmd{\@lbibitem} without having
to redefine the whole \envirname{bibliography} environment. I once used
this to generate a numbered reference list for my CV. It is a rubber
length in principle, but the default is a fixed length of 0pt.
\cmd{\bibitemsep} gives the vertical separation between two reference
list entries. It is also a rubber length, with default value
``|0pt plus .3pt|'', i.e., 0pt, but it may be stretched a little to
fill the page nicely. If you want to change it, e.g., to get a blank
line between reference list entries, you can use
\begin{verbatim}
\setlength{\bibitemsep}{\baselineskip}
\end{verbatim}
Finally, \cmd{\bibparsep} gives the vertical separation between two
paragraphs within the same reference list entry. Such a situation does
not occur in the default setup, so it is not used, but it is
conceivable that certain customizations lead to its use. It is a
rubber length with default value 0pt.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Labels}
\label{subsec:labels}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
There are many specific pieces of text that can be put into the reference
list or a citation by \pkg{apacite}. Here, these pieces are called
\emph{labels}. Almost all of these are to some extent language-specific, and
sometimes style-specific even within the same language. Therefore, they are
implemented through \LaTeX{} commands, so that users can easily change them.
In this section, these commands and their purposes are described, and their
(U.S.\ English) defaults are given. Section~\ref{sec:compat-babel} below will
discuss how these commands are changed if another language is used.

The following label commands are used:
\begin{description}

  \item[\cmd{\onemaskedcitationmsg}] \DescribeMacro{\onemaskedcitationmsg}
  \item[\cmd{\maskedcitationsmsg}] \DescribeMacro{\maskedcitationsmsg}
      These commands have one mandatory argument (which should always
      be 1 for \cmd{\onemaskedcitationmsg}) and define a message
      stating that citations are removed for a masked review. The
      default messages are
      ``\emph{(1\ citation removed for masked review)}'' and
      ``\emph{(}|#1|\emph{\ citations removed for masked review)}'',
      respectively.

  \item[\cmd{\bibmessage}] \DescribeMacro{\bibmessage}
      This is the first of 9 specific type
      commands that are recognized by \pkg{apacite}. If you
      define the \fieldname{type} field of a \entryname{misc}
      entry as ``\cmd{\bibmessage}'', the formatting of the
      entry is changed (e.g., the title is not italicized),
      see the discussion of the \fieldname{type} field in
      section~\ref{subsec:fields} above. This one is used for
      messages in newsgroups, internet forums, etc.
      Default is ``\verb+Msg+''.

  \item[\cmd{\bibcomputerprogram}] \DescribeMacro{\bibcomputerprogram}
      Default is ``\verb+Computer program+''.

  \item[\cmd{\bibcomputerprogrammanual}] \DescribeMacro{\bibcomputerprogrammanual}
      Default is ``\verb+Computer program manual+''.

  \item[\cmd{\bibcomputerprogramandmanual}] \DescribeMacro{\bibcomputerprogramandmanual}
      Default is ``\verb+Computer program and manual+''.

  \item[\cmd{\bibcomputersoftware}] \DescribeMacro{\bibcomputersoftware}
      Default is ``\verb+Computer software+''.

  \item[\cmd{\bibcomputersoftwaremanual}] \DescribeMacro{\bibcomputersoftwaremanual}
      Default is ``\verb+Computer software manual+''.

  \item[\cmd{\bibcomputersoftwareandmanual}] \DescribeMacro{\bibcomputersoftwareandmanual}
      Default is ``\verb+Computer software and manual+''.

  \item[\cmd{\bibprogramminglanguage}] \DescribeMacro{\bibprogramminglanguage}
      Default is ``\verb+Programming language+''.

  \item[\cmd{\bibnotype}] \DescribeMacro{\bibnotype}
      This one is a bit different from the previous 8. It is used for
      \entryname{techreport} entries to indicate that the type specifier
      should be suppressed. Its default value is the empty string, but this
      will not have an effect on \pkg{apacite} behavior, because the type
      specifier is suppressed anyway by \pkg{apacite}. However, by defining it
      as the empty string, formatting may become better (i.e., closer to the
      desired formatting) with other styles.

  \item[\cmd{\bibnodate}] \DescribeMacro{\bibnodate}
      Used in the \fieldname{year} and
      \fieldname{originalyear} fields to indicate that no
      publication date has been given. Default value is ``\verb+n.d.\hbox{}+''.
      The ``\verb+\hbox{}+'' ensures that \TeX{} does not treat
      the last period as a sentence-ending period, after which
      more space is inserted. This also applies to several other
      labels discussed below.

  \item[\cmd{\BOthers}] \DescribeMacro{\BOthers}
      Used for ``others'' if the number of authors
      or editors is too large, as in ``(Gill et al., 1981)''.
      The default is ``\verb+et al.\hbox{}+''.

      However, the definition contains a slight adaptation, because
      in a previous version of \pkg{apacite}, there was a problem
      implying that in some cases \BibTeX{} might put an extra period after
      \cmd{\BOthers}, not recognizing that it already contains a period,
      so that you would get ``et al.\hbox{}.'', which is undesirable.
      It depends on the definition of \cmd{\BOthers} whether there should
      be a period or not: If it is defined as ``\verb+et al.\hbox{}+'',
      there should not be an additional period, but if it is defined
      as, say, ``\verb+and others+'', then there should be an additional
      period. But \BibTeX{} does not know what the (later) definition
      of this command will be in \LaTeX{}. Therefore, the \cmd{\BOthers}
      command is defined to have one argument. In \BibTeX,
      \pkg{apacite} inserts \verb+\BOthers{.}+ in the output, so no
      additional period is inserted by \BibTeX. By default, this
      command is defined as ``\verb+et al.\hbox{}+'', and the argument is
      simply ignored.

      If you redefine the \cmd{\BOthers} command and need the additional
      period, you can redefine it appropriately. However, in the current
      version, the \cmd{\BOthers} command is distinguished from the
      \cmd{\BOthersPeriod} command and I think the mentioned problems
      do not occur anymore. Nevertheless, I have kept the definition of the
      previous version. I may decide, after thorough testing, to change
      this again in a next version.

      There is still a complication, however. If you use a \cmd{\citeauthor}
      at the end of a sentence, there may be a period too many, if
      you end the sentence explicitly with it and \cmd{\BOthers} is
      ``et al.\hbox{}''. On the other hand, if you omit the sentence-finishing
      period but decide to redefine \cmd{\BOthers} to ``and others'',
      the period is missing. Therefore, it seems wise not to end a sentence
      with a \cmd{\citeauthor}, or you could define a command, e.g.,
      \cmd{\finishsentence}, and insert it in an appropriate place.
      Then, this command should be changed along with \cmd{\BOthers}.

  \item[\cmd{\BOthersPeriod}] \DescribeMacro{\BOthersPeriod}
      Also used for ``others'' if the number of
      authors or editors is too large, as in
      ``Gill, P. E., et al.\hbox{} (1981)''.
      But this one is used for situations when it should always end with
      a period. The default is ``\verb+et al.\hbox{}+''.

  \item[\cmd{\bibcorporate}] \DescribeMacro{\bibcorporate}
      This command can be used in the \fieldname{author}
      field (and \fieldname{editor} and \fieldname{translator}) to tell
      \pkg{apacite} that the author is a corporate author. See
      section~\ref{subsec:fields} for an example of its usage. In combination
      with the \pkgoption{includecorporate} and \pkgoption{suppresscorporate}
      options, it can be used to include or exclude corporate authors from
      the author index. The usage as described above is structured as if
      \cmd{\bibcorporate} has an argument, the corporate author name, but
      by default, this argument simply would have to be copied to the output
      without further processing. Therefore, in the actual implementation,
      \cmd{\bibcorporate} does not have an argument and reduces to \cmd{\relax},
      i.e., it does nothing in \LaTeX{} and exerts its influence at the
      \BibTeX{} stage.

  \item[\cmd{\BIP}] \DescribeMacro{\BIP}
      ``In press'', the string to be used as year for
      in-press references. In the \fname{.bib} file, the \fieldname{year}
      field should be ``\verb+\BIP+'', so that \pkg{apacite} can recognize
      this and use appropriate formatting and sorting.
      The default value is ``\verb+in press+''.

  \item[\cmd{\BIn}] \DescribeMacro{\BIn}
      Used for \entryname{incollection} and
      \entryname{intechreport}, for ``In \opt{editor} (Ed.\hbox{}),
      \opt{booktitle}'', and similar phrases. Default value is ``\verb+In+''.

  \item[\cmd{\BCHAP}] \DescribeMacro{\BCHAP}
      Used for \entryname{incollection} if the
      \fieldname{pages} field is empty, to denote the chapter number
      of the referenced work in the collection. Used primarily for
      internet documents, where there are no page numbers.
      Default value is ``chap.\hbox{}''. Note that in the text, in
      particular in a citation, the APA (p.~179) prescribes ``Chapter'':
      ``(Shimamura, 1989, Chapter~3)''. This is, however, something that
      would be typed by the author of the manuscript, not inserted by
      \pkg{apacite}, and thus \pkg{apacite} does not have a command
      for this.

  \item[\cmd{\BCHAPS}] \DescribeMacro{\BCHAPS}
      Just like \cmd{\BCHAP}, but this one is used
      if the \fieldname{chapter} field refers to more than 1 chapter.
      Default value is ``chap.\hbox{}''.

  \item[\cmd{\BED}] \DescribeMacro{\BED}
      Editor in reference list, as in
      ``In P. R. Krishnaiah (Ed.\hbox{})''. Default is ``\verb+Ed.\hbox{}+''.

  \item[\cmd{\BEDS}] \DescribeMacro{\BEDS}
      Editors (more than one editor) in reference list,
      as in ``In C.~R. Rao \& J.~K. Ghosh (Eds.\hbox{})''.
      Default is ``\verb+Eds.\hbox{}+''.

  \item[\cmd{\BTRANS}] \DescribeMacro{\BTRANS}
      Translator, as in ``(J. Strachey, Trans.\hbox{})''.
      Default is ``\verb+Trans.\hbox{}+''.

  \item[\cmd{\BTRANSS}] \DescribeMacro{\BTRANSS}
      Translators. Default is ``\verb+Trans.\hbox{}+''.

  \item[\cmd{\BTRANSL}] \DescribeMacro{\BTRANSL}
      Translation. Used in a text citation when
      referring to a translated work for which there is no date
      for the original work. This is then formatted as
      ``Aristotle (trans.\hbox{} 1931)''. Default is
      ``\verb+trans.\hbox{}+''.

  \item[\cmd{\BCHAIR}] \DescribeMacro{\BCHAIR}
      Chair of a symposium, etc.
      Default is ``\verb+Chair+''.

  \item[\cmd{\BCHAIRS}] \DescribeMacro{\BCHAIRS}
      Chairs. Default is ``\verb+Chairs+''.

  \item[\cmd{\BVOL}] \DescribeMacro{\BVOL}
      Volume, as in ``Vol.\hbox{}~1''.
      Default is ``\verb+Vol.\hbox{}+''.

  \item[\cmd{\BVOLS}] \DescribeMacro{\BVOLS}
      Volumes, as in ``Vols.\hbox{} 1--4''.
      Default is ``\verb+Vols.\hbox{}+''.

  \item[\cmd{\BNUM}] \DescribeMacro{\BNUM}
      Number, as in ``Tech.\ Rep.\hbox{}
      No.\hbox{}~12''.
      Default is ``\verb+No.\hbox{}+''.

  \item[\cmd{\BNUMS}] \DescribeMacro{\BNUMS}
      Numbers, as in ``Nos.\hbox{} 3--5''.
      Default is ``\verb+Nos.\hbox{}+''.

  \item[\cmd{\BEd}] \DescribeMacro{\BEd}
      Edition, as in ``2nd ed.\hbox{}''.
      Default is ``\verb+ed.\hbox{}+''.

  \item[\cmd{\BPG}] \DescribeMacro{\BPG}
      Page, default is ``\verb+p.\hbox{}+''.

  \item[\cmd{\BPGS}] \DescribeMacro{\BPGS}
      Pages, default is ``\verb+pp.\hbox{}+''.

  \item[\cmd{\BTR}] \DescribeMacro{\BTR}
      The (default) technical report type name, which can be
      overridden by the \fieldname{type} field. Default is
      ``\verb+Tech.\ Rep.\hbox{}+''

  \item[\cmd{\BPhD}] \DescribeMacro{\BPhD}
      The (default) PhD thesis type name, which can be
      overridden by the \fieldname{type} field. Default is
      ``\texttt{Doctoral dissertation}''.

  \item[\cmd{\BUPhD}] \DescribeMacro{\BUPhD}
      The (default) Unpublished PhD thesis type name,
      which can be overridden by the \fieldname{type} field. Default is
      ``\texttt{Unpublished doctoral dissertation}''.

  \item[\cmd{\BMTh}] \DescribeMacro{\BMTh}
      The (default) master's thesis type name, which can be
      overridden by the \fieldname{type} field. Default is
      ``\texttt{Master's thesis}''.

  \item[\cmd{\BUMTh}] \DescribeMacro{\BUMTh}
      The (default) unpublished master's thesis type name,
      which can be overridden by the \fieldname{type} field. Default is
      ``\texttt{Unpublished master's thesis}''.

  \item[\cmd{\BOWP}] \DescribeMacro{\BOWP}
      ``Original work published'', default is
      ``\texttt{Original work published}''.

  \item[\cmd{\BREPR}] \DescribeMacro{\BREPR}
      ``Reprinted from'', default is
      ``\texttt{Reprinted from}''.

  \item[\cmd{\Bby}] \DescribeMacro{\Bby}
      ``by'' in the construction
       ``by P.~R. Krishnaiah, Ed.\hbox{}'' referring to the original
       editor of a reprinted work. Default is ``\verb+by+''.

  \item[\cmd{\BAuthor}] \DescribeMacro{\BAuthor}
      ``Author'' as a description of the publisher
       if the author and publisher are the same. Default is
       ``\verb+Author+''

  \item[\cmd{\BAvailFrom}] \DescribeMacro{\BAvailFrom}
      ``Available from''. This is used in versions
       of \pkg{apacite} up to [2009/03/01] if the \fieldname{url}
       field is specified but the \fieldname{lastchecked} field is not.
       This is now superseded by \cmd{\BRetrievedFrom}.
       Default is ``\verb+Available from\ +''. Note the extra space.
       This construction allows customization by redefining this command
       as being empty, thereby omitting the phrase altogether, without
       undesirable extra space.

  \item[\cmd{\BRetrieved}] \DescribeMacro{\BRetrieved}
      ``Retrieved from'', used if both the
       \fieldname{url} field and the \fieldname{lastchecked} field are
       specified. It has one argumnt: the date, i.e., the contents of
       the \fieldname{lastchecked} field. The default is
       ``\verb+Retrieved {#1}, from\ +'', again with extra space.

  \item[\cmd{\BRetrievedFrom}] \DescribeMacro{\BRetrievedFrom}
      ``Retrieved from'', used if the \fieldname{url}
       field is specified but the \fieldname{lastchecked} field is not.
       This was introduced, because the APA manual (p.~192) now states
       that retrieval dates should be omitted ``unless the source
       material may change over time'', and prescribes ``Retrieved from''
       (p.~199).
       Default is ``\verb+Retrieved from\ +'', again with extra space.

  \item[\cmd{\BMsgPostedTo}] \DescribeMacro{\BMsgPostedTo}
       Used for messages to newsgroups and the like.
       Default is ``\verb+Message posted to\ +'', with space.

  \item[\cmd{\refname}] \DescribeMacro{\refname}
      Name of the reference list if it's a section.
      (So it's the section name.) Default is ``\verb+References+''.
      A problem with the current implementation is, that if you use
      \pkg{babel}'s \cmd{\selectlanguage} command, then \cmd{\refname}
      and \cmd{\bibname} are overwritten. Because \pkg{babel}'s
      definitions of these commands are often (for various languages)
      different from the names prescribed by the APA manual and analogous
      bodies in other countries, it will often be necessary to redefine
      \cmd{\refname} or \cmd{\bibname} if you have used
      \cmd{\selectlanguage}. I hope to provide a fix in a next version
      of \pkg{apacite}.

  \item[\cmd{\bibname}] \DescribeMacro{\bibname}
      Name of the reference list if it's a chapter.
      Default is ``\verb+References+''. See also \cmd{\refname}.

  \item[\cmd{\bibliographyprenote}] \DescribeMacro{\bibliographyprenote}
      This command is used before
      the reference list, but after the section or chapter heading,
      and immediately after \cmd{\bibliographytypesize}.
      It is intended for an optional note just before the references
      in the reference list. It defaults to nothing, but can be changed
      to a list of commands (e.g., if some commands should be different
      in the reference list than in the text) and/or some text.

  \item[\cmd{\APACmetaprenote}] \DescribeMacro{\APACmetaprenote}
      If a meta-analysis is reported, the
      works included in the meta-analysis should in the bibliography be
      preceded by an asterisk, see the description of \cmd{\APACmetastar}
      above. This should then be explained in a note before the references.
      This command contains the text of that note. Default is
      ``\texttt{References marked with an asterisk indicate studies
      included in the meta-analysis.}''.

  \item[\cmd{\authorindexname}] \DescribeMacro{\authorindexname}
      Name (heading) of the author index.
      Default is ``\verb+Author Index+''.

  \item[\cmd{\doiprefix}] \DescribeMacro{\doiprefix}
      String that is printed before a DOI.
      Default is ``\verb+doi:+''.

\end{description}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{More drastic formatting changes to the reference list}
\label{sec:custom-big-formatting}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
In earlier versions of \pkg{apacite}, most of the formatting of the
reference list was done in the \BibTeX{} stage, i.e., by the \fname{.bst}
files. This corresponds with most other \BibTeX{} styles. This makes
it difficult for users to customize the formatting of the reference
list: They would have to make their own \fname{.bst} file, by adapting
\fname{apacite.bst}. Certain small changes are relatively easy to make,
but \BibTeX's ``bst'' language is not easy to understand for most users,
and thus most desired changes, though seemingly small, may be too
complicated to implement. Another drawback of this setup is that, each
time I release a new version of \pkg{apacite}, users would have to make
the same adaptations again. In the early days of \pkg{apacite}, wasting
disk space was another drawback, but this is not important anymore.

To overcome the most salient of these problems, \pkg{apacite} has always
deferred some formatting choices to the \LaTeX{} stage, by using tailor-made
formatting commands instead of explicit formatting, as discussed in
sections~\ref{sec:custom-punct} and~\ref{subsec:labels} above. The amount of
formatting thus handled has slightly grown over time, but still most choices
were hard wired in the \BibTeX{} styles.

Since the \APACversiondate{2007/09/03} version of \pkg{apacite}, a big step
has been made in transferring these choices to the \LaTeX{} domain. Hence,
a much larger set of commands, with wider-ranging scope, has been defined,
and considerably fewer choices are made at the \BibTeX{} stage. For
example, \fname{apacite.bst} now inserts
\mbox{}\vspace{0.7\baselineskip}\\
\mbox{\cmd{\APACjournalVolNumPages}%
      \marg{journal}%
      \marg{volume}%
      \marg{number}%
      \marg{pages}%
     }
\mbox{}\vspace{0.7\baselineskip}\\
in the \fname{.bbl} file for an \entryname{article} entry, and
the actual formatting of this information is defined in
\fname{apacite.sty}. If all four components are available, the
default (APA manual) formatting of this looks like
\mbox{}\vspace{0.7\baselineskip}\\
\mbox{\Bem{Acta Paedopsychiatrica},
      \Bem{38}(9),
      {229--231}}
\mbox{}\vspace{0.7\baselineskip}\\
but by redefining this command, users can change this, e.g., to
\mbox{}\vspace{0.7\baselineskip}\\
\mbox{\Bem{Acta Paedopsychiatrica}
      \textbf{38}, No.~9:
      {229--231}}
\mbox{}\vspace{0.7\baselineskip}\\
The advantage of this is that users can fairly easily construct a
customized style by redefining only a few commands in \LaTeX, by
using \cmd{\renewcommand}. Users will generally find it much easier
to do this than adapt the \fname{.bst} files. Furthermore, only
the affected commands need to be redefined, so that, when a new
version of \pkg{apacite} becomes available, all the new features
can be used---with the exception of the redefined commands, of
course---without having to adapt everything again. The drawback
is that the \fname{.bbl} file becomes less readable and more
difficult to adapt: Previously, it was easy to make ad-hoc changes
by editing the \fname{.bbl} file, but this has now become more
difficult. However, I intend to make this facility more user-friendly
in the future, e.g., by introducing options in the \LaTeX{} package
(say, \pkgoption{boldvolume}) or by introducing user-friendly
commands that accomplish the same (say, \cmd{\boldvolume}), so that
the advantages will clearly outweigh the disadvantages for the vast
majority of users.

Some packages (\pkg{amsrefs} and \pkg{biblatex} are the ones I am aware of)
handle the formatting of the reference list completely in the \LaTeX{} domain,
using \BibTeX{} only for sorting the reference list. The current version of
\pkg{apacite} does not go that far; there are still certain choices that are
hardwired in the \BibTeX{} code. Examples are the ordering of the various blocks
(most notably the position of the year; some styles have this at the end) and
the formatting of names. It is doubtful whether \pkg{apacite} will follow the
path toward the end, like these other packages. Some formatting choices are
closely connected with sorting of entries (e.g., by title if there is no author;
this assumes that the title then takes the author position) or other cross-entry
relations (such as adding `a' and `b' suffixes to the year). Therefore, it does
not seem useful to disconnect these choices by handing them over to \LaTeX.

The following commands are currently implemented to format the reference
list. If you want to customize them, you can study the source code in
the file \fname{apacite.sty}, copy it to you own package file, and adapt
the code as desired.\\[-0.3\baselineskip]
\par\noindent\DescribeMacro{\APACmonth}
\makebox[2.1in][l]{\cmd{\APACmonth}}
\makebox{Month name (as function of a number)}
\par\noindent\DescribeMacro{\APACrefYear}
\makebox[2.1in][l]{\cmd{\APACrefYear}}
\makebox{Year in the reference list}
\par\noindent\DescribeMacro{\APACrefYearMonthDay}
\makebox[2.1in][l]{\cmd{\APACrefYearMonthDay}}
\makebox{Year + month + day}
\par\noindent\DescribeMacro{\APACrefatitle}
\makebox[2.1in][l]{\cmd{\APACrefatitle}}
\makebox{Title (article style, default upright)}
\par\noindent\DescribeMacro{\APACrefbtitle}
\makebox[2.1in][l]{\cmd{\APACrefbtitle}}
\makebox{Title (book style, default italicized)}
\par\noindent\DescribeMacro{\APACrefaetitle}
\makebox[2.1in][l]{\cmd{\APACrefaetitle}}
\makebox{English translation of title (article)}
\par\noindent\DescribeMacro{\APACrefbetitle}
\makebox[2.1in][l]{\cmd{\APACrefbetitle}}
\makebox{English translation of title (book)}
\par\noindent\DescribeMacro{\APACjournalVolNumPages}
\makebox[2.1in][l]{\cmd{\APACjournalVolNumPages}}
\makebox{Journal, volume, number, and pages}
\par\noindent\DescribeMacro{\APACaddressPublisher}
\makebox[2.1in][l]{\cmd{\APACaddressPublisher}}
\makebox{Address and publisher}
\par\noindent\DescribeMacro{\APACaddressInstitution}
\makebox[2.1in][l]{\cmd{\APACaddressInstitution}}
\makebox{Address and institution (for technical reports)}
\par\noindent\DescribeMacro{\APACaddressPublisherEqAuth}
\makebox[2.1in][l]{\cmd{\APACaddressPublisherEqAuth}}
\makebox{Address and publisher if the publisher is the author}
\par\noindent\DescribeMacro{\APACaddressInstitutionEqAuth}
\makebox[2.1in][l]{\cmd{\APACaddressInstitutionEqAuth}}
\makebox{Address and institution if the latter is the author}
\par\noindent\DescribeMacro{\APACaddressSchool}
\makebox[2.1in][l]{\cmd{\APACaddressSchool}}
\makebox{Address and school (for theses)}
\par\noindent\DescribeMacro{\APACtypeAddressSchool}
\makebox[2.1in][l]{\cmd{\APACtypeAddressSchool}}
\makebox{Type, address, and school (for theses)}
\par\noindent\DescribeMacro{\APAChowpublished}
\makebox[2.1in][l]{\cmd{\APAChowpublished}}
\makebox{\fieldname{howpublished} field}
\par\noindent\DescribeMacro{\APACorigED}
\makebox[2.1in][l]{\cmd{\APACorigED}}
\makebox{Original editor for reprints and translations}
\par\noindent\DescribeMacro{\APACorigEDS}
\makebox[2.1in][l]{\cmd{\APACorigEDS}}
\makebox{Ditto, multiple editors}
\par\noindent\DescribeMacro{\APACrefnote}
\makebox[2.1in][l]{\cmd{\APACrefnote}}
\makebox{Formatting of \fieldname{note} field}
\par\noindent\DescribeMacro{\APACorigyearnote}
\makebox[2.1in][l]{\cmd{\APACorigyearnote}}
\makebox{Original year + optional note}
\par\noindent\DescribeMacro{\APACorigjournalnote}
\makebox[2.1in][l]{\cmd{\APACorigjournalnote}}
\makebox{Original journal (+ volume, number, pages) + optional note}
\par\noindent\DescribeMacro{\APACorigbooknote}
\makebox[2.1in][l]{\cmd{\APACorigbooknote}}
\makebox{Formatting of ``original'' information if the original is a book}
\par\noindent\DescribeMacro{\APACbVolEdTR}
\makebox[2.1in][l]{\cmd{\APACbVolEdTR}}
\makebox{Technical report information}
\par\noindent\DescribeMacro{\APACbVolEdTRpgs}
\makebox[2.1in][l]{\cmd{\APACbVolEdTRpgs}}
\makebox{Ditto, for \entryname{intechreport}}
\par\noindent\DescribeMacro{\doi}
\makebox[2.1in][l]{\cmd{\doi}}
\makebox{Formatting of DOI string}\\[0.7\baselineskip]
In addition, the following environments are used:\\[-0.3\baselineskip]
\par\noindent\DescribeEnv{APACrefauthors}   \makebox[1.3in][l]{\envirname{APACrefauthors}   } \makebox{Formatting of authors (or editors acting as authors) in the reference list.}
\par\noindent\DescribeEnv{APACrefURL}       \makebox[1.3in][l]{\envirname{APACrefURL}       } \makebox{Formatting of \fieldname{url} field}
\par\noindent\DescribeEnv{APACrefDOI}       \makebox[1.3in][l]{\envirname{APACrefDOI}       } \makebox{Formatting of \fieldname{doi} field}
\par\noindent\DescribeEnv{APACrefURLmsg}    \makebox[1.3in][l]{\envirname{APACrefURLmsg}    } \makebox{Formatting of \fieldname{url} field for messages}
\par\noindent\DescribeEnv{APACrefannotation}\makebox[1.3in][l]{\envirname{APACrefannotation}} \makebox{Formatting of \fieldname{annote} or \fieldname{annotate} fields for annotated bibliographies.}
\\[0.7\baselineskip]
It is likely that these lists will be expanded in future versions of
\pkg{apacite}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Language support}
\label{sec:compat-babel}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The APA is, of course, American, and therefore the rules in the APA manual
are also based on the (U.S.) English language. Because \pkg{apacite} was
primarily designed to implement the APA rules, and because I write all
my scientific work in English, \pkg{apacite} originally did not contain
explicit support for other languages. However, most language-specific
elements have been implemented in the form of \LaTeX{} commands, so that
users could define their own \LaTeX{} package in which these elements were
changed. The labels discussed in section~\ref{subsec:labels} above are the
most important part of this.

Furthermore, when writing in a non-English language, the \pkg{babel} package
will usually be loaded. The \pkg{babel} package is an extensive package that
facilitates using \LaTeX{} for documents in languages other than English.
There have been some compatibility problems between \pkg{babel} and
\pkg{apacite}, and therefore since 2003 \pkg{apacite} contained some
explicit code to overcome the compatibility problems. I think this works
well, provided that \pkg{apacite} is loaded \emph{after} \pkg{babel}.

Thus, although \pkg{apacite} did not support non-English languages
explicitly, it did facilitate them. Supporting non-English languages is
not a main objective of \pkg{apacite}, because it is not needed for
the APA. Nevertheless, it potentially is a useful addition. Many journals in
non-English languages and universities in countries where other languages
are spoken base their rules on the APA manual. Therefore, it is
efficient if, with a few adaptations, \pkg{apacite} can also be used in
these circumstances. For this reason, and based on user requests,
\pkg{apacite} has contained some explicit language support since June 2005.

The unpacked \pkg{apacite} distribution contains files that have names
according to the construction \opt{language}\fname{.apc}, i.e.,
\fname{english.apc}, \fname{dutch.apc}, etc.
These files define the language-specific modifications of \pkg{apacite},
mainly translations of terms like ``and'', ``Ed.\hbox{}'', etc. They have been
written by \pkg{apacite} users who are (native) speakers of the languages
involved. If the \pkg{babel}, \pkg{german}, or \pkg{ngerman} package is
loaded, \pkg{apacite} is able to determine the language of the document that
is processed. Then the corresponding \fname{.apc} file, when available, is
read. In this way, language-specific elements are changed to the relevant
language. This is done fully automatically, the user does not have to do
anything explicitly. However, sometimes an \fname{.apc} file makes some
assumptions or choices that are nontrivial. Therefore, look at the source
code of the \fname{.apc} file (or in the Implementation section of this
manual if you have generated this manual with the \cmd{\AlsoImplementation}
option) if you obtain unexpected results. These files contain some brief
documentation of the specific issues relevant for the language at hand.

The list with available \fname{.apc} files has been given in
section~\ref{sec:usage}. One file is defined for each ``language'', which can
be used for several ``dialects'' (in \pkg{babel} terminology). For example,
\fname{english.apc} is also used if the language is ``american''. See the
documentation of the \pkg{babel} and \pkg{(n)german} packages for a list of
dialects of the language files supplied. If an \fname{.apc} file is not
available for the language you need, you can use one of the supplied ones as a
template and write your own. If you send it to me, I can include it in a next
version of \pkg{apacite}.

The \pkg{babelbib} package offers very sophisticated support of
different languages. Perhaps some of the features that it offers are
useful additions to \pkg{apacite} as well, and these may be included
in a future version of \pkg{apacite}.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Language-specific issues}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This section lists issues that are specific to one or more language
files. It is currently very incomplete. Again, I suggest you study
the \fname{.apc} file of your language for more information.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection*{Spanish}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pkg{apacite}'s usage of |<| and |>| for pre-notes, as in
|\cite<e.g.,>{jones06}| (inherited from its predecessor, \fname{theapa.sty}),
conflicts with \pkg{babel}'s \pkgoption{spanish} option, which makes |<| and |>|
active characters. Hence, either you must avoid using prenotes with
\pkg{apacite}'s construction or you must disable \pkg{babel}'s behavior by
inserting the command \cmd{\deactivatequoting} after loading \pkg{babel}.

\DescribeMacro{\usespanishe}
The default ``and'' between authors in Spanish is `y', but when the
subsequent author's last name starts with an `I', this should be `e'.
Therefore, \fname{spanish.apc} introduces the command \cmd{\usespanishe},
which takes a comma-separated list of citation keys as argument. The ``and''
in these citations is then formatted as `e'. So
\begin{verbatim}
\citeA{AnIn93},
\citeA{AnIn95},
\usespanishe{AnIn93, AnIn95}
\citeA{AnIn93},
\citeA{AnIn95}.
\end{verbatim}
gives as output ``Anderson y Ingram (1993), Anderson y Ingram (1995),
Anderson e Ingram (1993), Anderson e Ingram (1995).''

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Setting up \MiKTeX}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\MiKTeX{} preloads the \pkg{babel} package and often uses \pkgoption{french}
as the default language. The result is that \pkg{apacite} formats
the heading of the reference list and other text strings in French.
(Other distributions also preload \pkg{babel} but use
\pkgoption{english} or \pkgoption{nohyphenation} as default.)
I have received many reports from \pkg{apacite} users who use \MiKTeX{},
who just want the default English, but get French output and don't
know how to turn this off. Therefore, even though I believe this is a
\MiKTeX{} issue and not an \pkg{apacite} issue, I\footnote{Actually,
most of this investigation, testing, etc., was done by David Huffer,
because I don't have \MiKTeX. Thanks, David!} have reluctantly
decided to investigate this issue, and as a result of my investigation,
provide this section.

So here is the way to solve this problem (for \MiKTeX{} version 2.7;
presumably it works similar for other versions):
\begin{enumerate}
\item
Click Start $\rightarrow$ Programs $\rightarrow$ MiKTeX 2.7 $\rightarrow$
Settings to open the \MiKTeX{} Options window. Click on the Languages tab.
\item
Select ``\pkgoption{english}'', ``\pkgoption{nohyphenation}'', or whatever
else you'd like to be the default language, and use the Down button to move
this to the bottom. The \emph{last} checked language is the default main
document language.
\item
Click on the General tab and click on Update Formats.
\end{enumerate}
If you do this with ``\pkgoption{english}'' or ``\pkgoption{nohyphenation}''
as default language, \pkg{apacite} will use English strings and punctuation.

If you want to override the default (and/or you are not able to set the
default, perhaps because you don't have the administrative permissions),
you can also insert the line
\begin{verbatim}
\usepackage[english]{babel}
\end{verbatim}
in your document, before loading \pkg{apacite}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Compatibility}
\label{sec:compat}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Generally speaking, I would want \pkg{apacite} to be compatible with other
packages, of course. However, what does compatibility mean? It can mean
various things:
\begin{enumerate}
\item \label{compat1}%
      The same \fname{.bib} file can be used with
      different \BibTeX{} styles and \LaTeX{} citation packages;
\item \label{compat2}%
      The same citation commands as other citation packages;
\item \label{compat3}%
      Another \LaTeX{} citation package can be used with a
      \fname{.bbl} file that is generated by the \pkg{apacite}
      \BibTeX{} style;
\item \label{compat4}%
      The \pkg{apacite} \LaTeX{} citation package can be used with a
      \fname{.bbl} file that is generated by another \BibTeX{} style;
\item \label{compat5}%
      The \pkg{apacite} \LaTeX{} citation package can be loaded at the
      same time as other packages without errors or undesirable
      side-effects.
\end{enumerate}
Because of the complicated rules of the APA manual, it is not always possible
to achieve all kinds of compatibility with all other packages. Later in this
section, I will discuss compatibility issues with other packages with which
known incompatibility problems exist or have existed. A first example of this,
the \pkg{babel} package, has already been mentioned above in
section~\ref{sec:compat-babel}.

Point~\ref{compat1} is the most important. If you have to write a completely
different \fname{.bib} file for different citation styles, there does not seem
to be an advantage in using \BibTeX{}. You might as well write the reference
list explicitly in \LaTeX{} then. However, not even this point can be achieved
completely, although the vast majority of the items will be the same for
different styles. But there remain a number of choices that are style-specific
and that lead to differences in the \fname{.bib} file. Examples from the APA
manual are:
\begin{itemize}
\item If a referenced book is volume~III according to its title
      page, this should be referenced as Vol.~3 according to the
      APA manual rules, but that may not be the case with other
      styles;
\item Journal names are abbreviated by some styles, but not
      according to the APA manual rules;
\item Publisher names should be abbreviated according to the
      APA manual, e.g., ``John Wiley \& Sons'' becomes ``Wiley''.
      Other styles do not do this;
\item The issue number of a journal should only be given if
      the journal starts each issue with page~1, not if page
      numbers of different issues in the same volume are consecutive.
      Other styles may require the issue number in all cases;
\item Page ranges are given as ``341--351'' in APA style, whereas
      other styles use ``341--51'';
\item The APA rules require a capital after a colon (`\verb+:+'),
      so that subtitles start with a capital as well. Other styles
      may not do this;
\item The APA has specific rules about the address: For a U.S. city,
      the state (or territory) should be given as a 2-letter code
      from the U.S. Postal Services, and the province and country
      should be given if it is a non-U.S. city. There
      are some exceptions if the name of the state (and sometimes
      even city) is already mentioned in the university name and
      the university acts as publisher;
\item Yearbooks like \emph{Annual Review of Psychology} should be treated
      as journals according to the APA rules, whereas other styles
      treat these as books;
\item The additional fields (such as \fieldname{translator} and the
      \fieldname{original*}-fields) that are used by \pkg{apacite} but are
      not defined in other \BibTeX{} styles are of course
      \pkg{apacite}-specific.
\end{itemize}
Some of these problems can be handled relatively elegantly. For example,
the user could use a command like ``\verb+\RomanVol{3}+'' in the
\fieldname{volume} field. Then, the user could define a counter,
\verb+RomanVolcounter+, say, in \LaTeX{} and then define
\cmd{\RomanVol} (similar to \cmd{\BCnt} discussed earlier) as
\begin{verbatim}
\newcommand{\RomanVol}[1]{%
  \setcounter{RomanVolcounter}{#1}\theRomanVolcounter}
\end{verbatim}
where \cmd{\theRomanVolcounter} is defined as \verb+\arabic{RomanVolcounter}+
if \pkg{apacite} is loaded and as \verb+\Roman{RomanVolcounter}+ if another
package is loaded that desires this. The example with style-specific
\fname{.bib} files that contain the definitions of journal-strings was already
given in section~\ref{sec:bib} above. However, many users will not go through
all this trouble, and not all problems can be solved in this way. So we have
to realize that not all entries in the \fname{.bib} file will be suitable for
all citation styles. On the other hand, most citation styles and journals are
not as critical as APA journals and many styles in psychology and other social
sciences (including economics) are very similar, so a \fname{.bib} file that
is tailor-made for \pkg{apacite} is likely to be suitable enough for the
styles of most relevant alternative journals.

Point~\ref{compat2} above is currently not fulfilled. The \pkg{apacite}
citation commands are directly based on those of its immediate
predecessor, \pkg{theapa}. But the use of `|<|' and `|>|' for prefixes
is not used by other packages. The \pkg{chicago} package uses
\cmd{\citeA} instead of \cmd{\citeauthor}, many ``numerical'' citation
styles only recognize \cmd{\cite}, and so forth. Because \pkg{natbib}
is widely used and versatile, the \pkgoption{natbibapa} option loads
\pkg{natbib} for the citation commands, thereby allowing at least a
little ``compatibility'' (actuallu, borrowing) of citation commands.

I think that points~\ref{compat3} and~\ref{compat4} are not that
important. It seems to me that there is not much wrong with defining
a style through a combination of a \fname{.sty} and \fname{.bst} file,
each requiring the other to work. However, given the possibilities and
philosophy of the \pkg{natbib} package, it is desirable that
\fname{natbib.sty} can be used with \fname{apacite.bst}. This is the
case, especially with the \pkgoption{natbibapa} option.

Point~\ref{compat5} is very important, especially with other packages that are
complementary to \pkg{apacite} in some sense. It would be very annoying having
to choose between using \pkg{babel} and \pkg{apacite}, or between
\pkg{hyperref} and \pkg{apacite}, etc. These packages serve totally different
purposes, cannot usefully be compared, and are more valuable when they can be
used jointly. The rest of this section addresses this issue for a number of
packages with which compatibility problems are known to exist or have existed.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{\pkg{natbib}}
\label{sec:compat-natbib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The \pkg{natbib} package is a general purpose citation package that is
intended to work with a broad range of \BibTeX{} (and non-\BibTeX{}) styles
that generate the bibliography. The \pkg{natbib} package is quite advanced and
can be used to switch easily between completely different citation styles.
Furthermore, the apparent popularity of \pkg{natbib} has inspired writers of
packages that would otherwise be incompatible with \pkg{natbib} to write code
to resolve these incompatibilities. I will mention some of these packages
below.

Using \pkg{natbib} for the citations has some advantages over using
\pkg{apacite} for the citations. Apart from the abovementioned sorting
of citations within a single citation command, these are mainly
\pkg{natbib}'s better compatibility with some other important packages,
although many compatibility problems with \pkg{apacite} have now been
solved.

When you want to use \pkg{natbib} for citation and \pkg{apacite} for the
reference list, you still need to load the \LaTeX{} package \fname{apacite.sty}
(with \cmd{\usepackage}), because of the commands that are included in the
\BibTeX{} output (as defined in section~\ref{sec:custom} above). The best
interoperability is obtained by loading \pkg{apacite} with the
\pkgoption{natbibapa} option. There is then no need to load
\pkg{natbib} explicitly, because \pkg{apacite} already does this.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{\pkg{hyperref}, \pkg{backref}, and \pkg{url}}
\label{sec:compat-hyper}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The \pkg{hyperref} package turns (\mbox{cross-}) references into hypertext
links. This can be used in conjunction with a program such as \latextohtml{} to
compose \fname{.html} files with clickable links, to internet pages or within
the same document, or it can be used to create a \fname{.pdf} document with
clickable crossreferences. Evidently, citations are also references. Therefore,
the \pkg{hyperref} package transforms these into hypertext links as well, and
needs to redefine the citation commands and reference list commands in order to
do so. These redefinitions have caused severe incompatibility problems between
\pkg{apacite} and \pkg{hyperref} in the past. These incompatibility
problems have been solved and \pkg{apacite} is compatible with \pkg{hyperref},
provided that \pkg{apacite} is loaded \emph{after} \pkg{hyperref}.
However, some of the ``dirty tricks'' I needed for
complicated examples in section~\ref{sec:xmpl} still conflict with
\pkg{hyperref}. You will probably not encounter these problems very often, but
if you do these can be easily solved by editing the \fname{.bbl} file instead of
using dangerous tricks; see also section~\ref{sec:autindex} below.

The \pkg{backref} package adds to each entry in the bibliography a list of pages
(or sections) on which it is referenced. Hence, it serves as an alternative to
an author index, in which not the entries themselves are backreferenced, but the
authors of these entries, see section~\ref{sec:autindex}. Note that \pkg{natbib}
offers yet another possibility, viz.\ the citations in the standard index, or a
separate citation index, see the \pkg{natbib} documentation. In my opinion, the
\pkg{backref} way of indexing the page numbers of the citations is more logical.
Moreover, it is more condensed as well.

Obviously, the \pkg{backref} package has to change the citation commands and
reference list to be able to do its backreferencing. Because \pkg{apacite}
redefines these as well, they are conflicting to some degree. A similar
compatibility problem between \pkg{backref} and \pkg{natbib} was noticed by the
author of \pkg{backref}. Therefore, \pkg{backref} contains some code to make it
compatible with \pkg{natbib}. This code has been adapted for \pkg{apacite} and
incorporated in \pkg{apacite}. Thus, \pkg{backref} as a standalone package has
been made compatible with \pkg{apacite}. The drawback of this solution is that
if changes are made in the \pkg{backref} package, this may result in new
incompatibilities with \pkg{apacite} unless \pkg{apacite} is changed as well.
Whether, and if so, when, this will occur will be a question for the future.

Apart from being a standalone package, \pkg{backref} can also be combined with
\pkg{hyperref}. It is then not loaded separately, but through the
\pkgoption{backref} or \pkgoption{pagebackref} option of the \pkg{hyperref}
package. In this case, the backreferences become hypertext links. See the
discussion of the \pkg{hyperref} package above.

The \pkg{url} package provides the \cmd{\url} command for formatting URLs, i.e.,
web addresses. It is typically loaded if \pkg{hyperref} is also loaded, but it
is very useful on its own as well. There are no compatibility problems with
\pkg{apacite} and it is not required when using \pkg{apacite}. However, if you
use the \fieldname{url} field, \pkg{apacite} puts it into a \cmd{\url} command.
If the \cmd{\url} command is not defined by another package, \pkg{apacite}
provides a crude definition, so that no errors are generated. But the formatting
thus obtained usually does not satisfy the APA rules about formatting,
especially its rules about line breaking within a URL. The default line breaking
rules of the \pkg{url} package are fairly close to the APA rules, but there are
some differences. Therefore, \pkg{apacite} provides several URL-styles that
adhere to the APA line breaking rules, supplemented by the additional
suggestions in \citeA[p.~645]{chicago}. These styles apply to URL formatting
through the \cmd{\url} command anywhere in the document, not only in the
reference list and not only in the \fieldname{url} field.

The only difference between the URL styles defined by \pkg{apacite} is which
font family they use: \verb+APACtt+ uses \cmd{\ttfamily}, \verb+APACsf+ uses
\cmd{\sffamily}, \verb+APACrm+ uses \cmd{\rmfamily}, and \verb+APACsame+ does
not define a font family, and thus uses the font family that is active at the
start of the URL. \verb+APACtt+ is selected by default, but you can select
another URL style by inserting the command \cmd{\urlstyle}\marg{style} in your
document, after \verb+\begin{document}+. See the documentation of the \pkg{url}
package for more details.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Multiple bibliographies}
\label{sec:compat-chapterbib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The \pkg{chapterbib} package allows separate bibliographies for separate
chapters of a book, or, technically, separate \cmd{\include}d files. To work
properly, it needs some small changes to the citation package, which are
clearly described in the \pkg{chapterbib} documentation. These changes have
been incorporated in \pkg{apacite}, and therefore \pkg{apacite} is compatible
with \pkg{chapterbib}.

It is generally advisable not to use the \pkgoption{sectionbib} option of
\pkg{chapterbib}, because this redefines \cmd{\thebibliography}, which
interferes with the redefinition by \pkg{apacite}. You can use the
\pkgoption{sectionbib} option of \pkg{apacite} to accomplish that the
bibliography or bibliographies are sections, rather than chapters.

Moreover, \pkg{apacite} is configured such that it takes a section as default
if it is in the main matter (signified by \cmd{\mainmatter}) of the document.
In the back matter (\cmd{\backmatter}) the bibliography is put in a chapter.
This is also the case if \cmd{\chapter} is defined but \cmd{\mainmatter} not.
(Is this possible? Perhaps for reports?) Consequently, the
\pkgoption{sectionbib} option is only useful in specific circumstances. The
\pkgoption{nosectionbib} forces the bibliography to be a chapter, provided
\cmd{\chapter} is defined. (I figured a \pkgoption{chapterbib} option would be
a bit confusing, so I stuck with \pkgoption{nosectionbib}.)

The \pkg{bibunits} package is an alternative to \pkg{chapterbib}. It allows a
greater flexibility in choosing the scope of a bibliography (chapter, section,
or arbitrarily defined part of the document). In previous versions, there
have been some compatibility problems between \pkg{apacite} and \pkg{bibunits},
but these have now been solved.

The \pkg{multibib} and \pkg{multibbl} packages support using multiple
bibliographies simultaneously. Thus, one can cite entries from multiple
bibliographies in the same part of the document. This may be useful of one
wants thematically different bibliographies or separate bibliographies for
references in different scripts (e.g., Latin and Greek). These packages
accomplish this by introducing different citation commands for the different
bibliographies. \pkg{apacite} contains compatibility code such that these
packages can be used jointly with \pkg{apacite}.

The \pkg{bibtopic} package offers a similar functionality, but instead of
using separate citation commands, it requires the user to keep the references
in different \fname{.bib} files, so that there is one bibliography per
\fname{.bib} file. \pkg{apacite} contains a little bit of compatibility code,
which largely seems to work, but ``and'' between authors is always ``\&'', even
in \cmd{\citeA}. I hope to fix this in a future version of \pkg{apacite}.

Another package that offers similar functionality is \pkg{splitbib}. This
uses neither different citation commands, nor separate \fname{.bib} files.
rather, it requires the user to declare the ``category'' of each cited
reference, typically at the beginning of the document. Again, \pkg{apacite}
contains compatibility code such that simultaneous redefinitions of some
of the citation and reference list commands do not conflict.

A few caveats must be mentioned here. First, simultaneous bibliographies
only work well if it is guaranteed that there are no ambiguities in the
reference lists. With a single bibliography, ambiguities are resolved at the
\BibTeX{} stage by adding initials to ambiguous first author names,
adding additional authors before (or instead of) ``et al.\hbox{}'' to
ambiguous multiple-author lists, and adding ``a'' and ``b'' suffixed to
the year for references to different documents with the same authors published
in the same year. Because, with the exception of \pkg{splitbib}, these
packages require multiple \BibTeX{} runs on separate selections of references,
\fname{apacite.bst} can only resolve ambiguities within the same bibliography.
When there are cross-bibliography ambiguities, these are not resolved. It
seems like these packages are primarily intended to work with numbered
citation styles, or otherwise labeled citation styles, so that unique
cross-bibliography numbers or labels can be generated at the \LaTeX{} stage.

Second, I wrote the compatibility code in early 2006 and have not
recently tested it thoroughly.
Please let me know if you encounter problems. Then I'll
try to fix them or at the least mention them in the next version of the
manual. In particular, I believe that usage of \cmd{\nocitemeta} is not
prefectly integrated yet: You may get the ``References marked\dots'' message
even if the relevant bibliography does not contain marked references,
or references that are \cmd{\nocitemeta}'d for one bibliography but not
for another are marked for both. I don't think the \cmd{\nocitemeta}
command is used much, so I would be surprised if anybody encountered
such problems, but please let me know if you do. Then I'll try to fix them.

Third, the compatibility code for all of these packages either follows
instructions given in those packages, or brutally redefines part of the
code of those packages. If these packages change, this may mean that
new compatibility problems are created, or that improved features of
these packages are not available when combined with \pkg{apacite}. I do
not have the time to regularly check for updates of these packages and
then study changes and/or test compatibility again. Instead, I only take
action when a user notifies me of a problem, or I coincidentally find out
myself. Therefore, again, please let me know if you encounter problems.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{\pkg{bibentry}}
\label{sec:compat-bibentry}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pkg{bibentry} is a package that allows including a complete reference
list entry in the text (or a footnote, which is arguably more common).
Previous versions of \pkg{apacite} were incompatible with \pkg{bibentry},
but I believe this has been fixed now. However, the APA reference format,
which uses periods to separate the elements of a reference list entry and
not commas, does not appear to be very suitable for in-text use, so this
is most likely only useful for footnotes that do not contain any other text.
Also note that the final period of the reference entry is not suppressed.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Programs for conversion to html, rtf, etc.}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
There are several programs that convert \LaTeX{} files to other types
of files, most notably \fname{html} and \fname{rtf}. This may, for example,
be useful if you want to publish your document on the internet or if you
are requested to send a ``Word'' file to a journal. I have received reports
that \latextohtml{} and \LaTeXrtf{} do not handle documents that use
\pkg{apacite} well. Therefore, I have studied these programs. This section
contains my observations. Note that these are quite old and not updated, and
it is quite likely that the software mentioned in this section has been
altered (improved) considerably. Therefore, the information may be outdated.
Please let me know if there are major changes that I should be aware of.

\latextohtml{} is a \Perl{} program that converts a \LaTeX{} input
file into one or more \fname{.html} files, so that a document that is prepared
with \LaTeX{} can be used as a (user-friendly) internet document.
Similarly, \LaTeXrtf{} is a standalone program that converts a \LaTeX{}
document to \fname{.rtf} format, which can be read by most word processors.
This may be convenient if you (a \LaTeX{} user) want to share a document with
someone who does not work with \LaTeX{}, or as mentioned above, if you are
required to send a ``Word'' file to a journal.
Both \latextohtml{} and \LaTeXrtf{} implement \LaTeX{} macros etc.\ in
another programming language (\latextohtml{}: \Perl{}; \LaTeXrtf{}: C) and
process the \fname{.tex} files directly. This design implies that the
conversion program must know the definitions of all \LaTeX{} macros that
are used. A drawback of this design is that essentially the same code has
to be written in different programming languages (\LaTeX{} macros for the
\fname{.sty} file, \Perl{} for \latextohtml{}, and C for \LaTeXrtf{}), but
typically with some adaptations specific for the application at hand.

With \LaTeXrtf{}, the \LaTeX{} macros that it is able to process are included
in the C source code that is compiled. Consequently, no user additions are
possible in principle. However, the source code is freely available, so if you
define a \LaTeX{} macro, you could adapt \LaTeXrtf{}'s source code and
recompile \LaTeXrtf{}. It is obvious that this is very inconvenient,
especially if \LaTeX{} macros are defined differently for different styles or
if they are defined differently in different parts of the same document.
Version~1.9.15 and higher of \LaTeXrtf{} contains some support for
\pkg{apacite}, but lags a few versions of \pkg{apacite} behind and thus
doesn't work with recent versions of \pkg{apacite}. Moreover, even if this
would be fixed, e.g., because I (or you) send patches to the \LaTeXrtf{}
authors, this wouldn't do justice to the flexibility of \pkg{apacite}, i.e.,
its customization options.

In contrast with this, \latextohtml{} allows the possibility to supply
external \Perl{} scripts. If \latextohtml{} encounters a
\cmdtwo{usepackage}{package} command in the document, it attempts to read the
corresponding \opt{package}\fname{.perl} \Perl{} script. \latextohtml{} is
shipped with many such \Perl{} scripts. There is not one for \pkg{apacite},
but there is one for \pkg{natbib}, which could possibly be adapted for
\pkg{apacite}. Alternatively, you could use the \pkg{natbib} citation commands
and use the \pkg{natbib} package (e.g., through loading \pkg{apacite}
with the \pkgoption{natbibapa} option), which should work.

An alternative to both \latextohtml{} and \LaTeXrtf{} is \TeXht{}. This is
a collection of programs and style files that convert \LaTeX{} to
various formats, such as html, xml, and OpenOffice format. If you have
OpenOffice, the latter can be used to convert to Word (or rtf) format.
The principle of \TeXht{} is to let \LaTeX{} do most of the formatting and
processing of commands, and do the conversion at low-level \TeX{} commands.
In this way, all newly defined commands and user-defined changes are
automatically supported. This even carries over to redefinitions of macros
in the middle of a document. However, for some specific purposes, there are
some additional things that must be arranged. Therefore, \TeXht{} contains a
large list of \fname{.4ht} files that are necessary to support various
\LaTeX{} packages. One of these is the \fname{apacite.4ht} file. The main
purpose of this file is to make citations into hyperlinks to the corresponding
entries in the reference list. Currently, this only works partially, but
the citation text itself is formatted correctly, so this is only a
relatively minor inconvenience. But, of course, it would be better if this
would work perfectly. Perhaps I'll study the problems in the future and
solve this for a future version (although, technically, it is a \TeXht{}
problem and not an \pkg{apacite} problem).

The choice of which converter to use will typically not (only) depend on how
good it works in conjunction with \pkg{apacite}. Furthermore, apart from the
converters mentioned above, there are several additional converters that I
haven't studied at all. I will only study them if I receive reports about
incompatibility and even then it is far from certain that I will be willing or
able to fix the problems. It would be very demanding if I would have to define
the \pkg{apacite} commands in a large number of programming languages for a
large number of different converters. Because I prefer the design of \TeXht{}
and because this converter seems to work best at the moment, I will give a
bit more attention to this one.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Generating an author index}
\label{sec:autindex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The \pkg{apacite} package contains an option to (almost) automatically
generate an author index. This is done by using the \fname{apacitex.bst}
\BibTeX{} style file instead of \fname{apacite.bst} and loading the
\fname{apacite.sty} \LaTeX{} package with the \pkgoption{index} option,
either explicitly or implicitly through one of the \pkgoption{stdindex},
\pkgoption{tocindex}, \pkgoption{emindex}, or \pkgoption{ltxemindex} options.

In earlier versions of \pkg{apacite}, the \pkgoption{index} option
automatically loaded the \pkg{index} package for multiple indexes, so that
you can have a subject index as well as an author index. However,
the current document uses the standard \pkg{ltxdoc} class for documenting
\LaTeX{} packages, and this class uses another method for supporting
multiple indexes, which appears incompatible with the \pkg{index} package.
I have been unable to resolve these compatibility problems and,
therefore, have implemented another way to generate an author index in
addition to other indexes. This uses the same principles as \pkg{ltxdoc}
and thus does work for this user's manual. As a consequence,
\pkg{apacite} now offers options that generate the author index either
with the \pkg{index} package or without it.

The \pkgoption{indexpackage} option implies that author indexing is done
according to the \pkg{index}-scheme, whereas the \pkgoption{noindexpackage}
uses the \pkg{ltxdoc}-based scheme. These options are ignored if the
\pkgoption{index} option of \pkg{apacite} is not requested. When the
\pkgoption{index} option is requested, the \pkgoption{indexpackage} option
loads the \pkg{index} package. This is the default unless it is disabled
by using either the \pkgoption{noindexpackage} option or the
\pkgoption{ltxemindex} option.

Obviously, the \pkg{index} package must be available in a directory that
is read by \LaTeX{} if the \pkgoption{indexpackage} option is requested,
either explicitly or implicitly. If a subject index is desired, it must be
defined by the user, it is not defined by \pkg{apacite}. See the manual of
the \pkg{index} package on how to do this. A default author index \emph{is}
defined by \pkg{apacite}. The author index is then requested by putting
\begin{verbatim}
\printindex[autx]
\end{verbatim}
at the point in the \LaTeX{} document where the index is supposed to appear.
To include the author index in the processed document, the following sequence
must be followed: First, \LaTeX{}, which puts citation entries in the
\fname{.aux} file. Second, \BibTeX{}, which generates the bibliography in the
\fname{.bbl} file. Third, \LaTeX{} (at least) twice, which puts index entries
in a \fname{.adx} file, Fourth, \MakeIndex{}, which uses the \fname{.adx} file
as input and puts the formatted index in a \fname{.and} file, which can be
processed by \LaTeX{}. So, if the main document is \fname{filename.tex}, then
\MakeIndex{} must be called as follows:
\begin{verbatim}
makeindex -o filename.and filename.adx
\end{verbatim}
although the command with which the \MakeIndex{} program must be called
may on some systems be slightly different, e.g., \fname{makeinde} or
\fname{makeindx}. Furthermore, several additional options may be chosen
on the \MakeIndex{} command line. Fifth, run \LaTeX{} again, which
(finally) includes the formatted author index in the typeset document
(\fname{.dvi} or \fname{.pdf} file).

The \pkg{apacite} package provides some options to change the appearance of
the index somewhat. With (only) the \pkgoption{index} option, the indexing
facility is turned on, but the \envirname{theindex} environment is not explicitly
(re)defined by \pkg{apacite}. This means that this environment is defined just
like in standard \LaTeX{}, or the \pkg{index} package, or some other package
that has been loaded that redefines this environment.

The \pkgoption{stdindex} option explicitly uses the definition of the
\envirname{theindex} environment that is defined in the \pkg{index} package
[1995/09/28 v4.1beta Improved index support (dmj)].
With this definition, the index does not appear in the table of contents. With
the \pkgoption{tocindex} option, this definition is augmented with a table of
contents entry. With the \pkgoption{emindex} option, there are some alternative
definitions. It writes a table of contents entry as well, but the index itself
is now set in two columns using the \pkg{multicol} package instead of the
\cmd{\twocolumn} command, the text of the index is set in small type, and the
page head is not put in uppercase. The \pkgoption{ltxemindex} option uses
the same style as the \pkgoption{emindex} option, except that it does not
load the \pkg{index} package and is thus tailored to a somewhat different
indexing method.

When a table of contents entry is desired, another additional \LaTeX{} run is
required to obtain the table of contents with the author index included. In
exceptional cases, the extra line in de table of contents may cause the text
to be moved as well, so that it may be necessary to run \MakeIndex{} a second
time, followed by yet one or two more \LaTeX{} runs.

\DescribeMacro{\APACstdindex}
\DescribeMacro{\APACtocindex}
\DescribeMacro{\APACemindex}
\DescribeMacro{\APACltxemindex}
The definitions of the index discussed apply to all indexes in the
document, so to, for example, the subject index as well as the author
index. This may be undesirable, and therefore \pkg{apacite} provides
the \cmd{\APACstdindex}, \cmd{\APACtocindex}, \cmd{\APACemindex}, and
\cmd{\APACltxemindex} commands to switch index styles.
These correspond to the package options \pkgoption{stdindex},
\pkgoption{tocindex}, \pkgoption{emindex}, and \pkgoption{ltxemindex},
respectively. Note, however, that the \pkgoption{ltxemindex} option
and/or the \cmd{\APACltxemindex} command generally cannot be used in
a document that uses one of the other styles, and vice versa, because
the way \pkg{index} works is incompatible with how standard \LaTeX{}
indexing works.

If you want a different index style, either for all indexes in your document or
only for some indexes, you can define such a style using the
\cmd{\renewenvironment} command in the appropriate place. See the standard
\LaTeX{} documentation for this command. The source code of the four commands
mentioned here can be used as a template for such a style definition.

Finally, some elements of the formatting of the index itself can be changed
by using (and/or writing) an \fname{.ist} file containing the preferred
options. \MakeIndex{} should then be called with the filename of this index
style file after a ``\verb+-s+'' option on the command line, so, e.g.,
\begin{verbatim}
makeindex -s mystyle.ist -o filename.and filename.adx
\end{verbatim}
The \MakeIndex{} documentation discusses the possible options that can be put
into the \fname{.ist} file.

As discussed in sections~\ref{sec:options}, \ref{subsec:fields}, and
\ref{subsec:labels}, the \pkgoption{suppresscorporate} and
\pkgoption{includecorporate} options can be used to either
exclude corporate authors from the author index or include them in it.
The \cmd{\bibcorporate} command must be used in the \fname{.bib} file
to denote a corporate author.

For some of the examples from the APA manual, I had to use quite advanced
\LaTeX{} tricks to obtain the correct formatting in the text, the reference
list, and the author index; see section~\ref{sec:xmpl} below. This will
typically not be necessary in practice. In the unlikely event that you
encounter similar difficult cases, it will usually be sufficient to use
a relatively simple trick in the \fname{.bib} file. In rare situations,
this may still give incorrect formatting, most likely in the author index.
Somewhat less rare is the situation when there is such a problematic case
but you also want to use the \pkg{hyperref} package. The tricks I used
conflict with \pkg{hyperref}.

An easy solution to incorrect formatting and/or sorting in the author index is
to edit the \fname{.bbl} file manually. This should be done at a time when
\BibTeX{} will not have to be run again. Otherwise, the changes would be
overwritten by the next \BibTeX{} run. This editing of the \fname{.bbl} file
is not in the \TeX-spirit, but in my experience---I used it for two books
with lots of references \cite{meijer1998, WaMe00}, with a previous version of
\pkg{apacite} that caused a fair amount of problematic cases---this takes very
little time, usually only minutes. Compare that with the time spent on writing
a book, or with the time that would be necessary to manually make an author
index. I also used it more recently for an edited book \cite{dLMe08a}
with an adapted version of \pkg{apacite}, with essentially the current
author indexing code, and had to do very little editing. The author index
of the current document is automatically generated and does not contain
any manual editing, although it does contain some advanced \LaTeX{} code
to fix some issues.

\DescribeMacro{\AX}
The connection between the \fname{.bbl} file and the author index is through
\cmd{\AX} commands that are entered by \fname{apacitex.bst} in the
\fname{.bbl} file. These are responsible for the author indexing facilities.
By looking at the contents of the \fname{.bbl} file, it is not difficult
to see how problematic cases must be edited. For example, the entry for Bender
is generated by the following lines:
\begin{verbatim}
\AX{bender  jdirector
@Bender, J\BPBI
  {\protect\bibliteral{(Director)}\protect\indexskipbracenodot}.}%
\end{verbatim}
This can be changed to
\begin{verbatim}
\AX{bender  j
@Bender, J.}%
\end{verbatim}
which is formatted correctly in the author index without the need for
advanced \LaTeX{} code, and conflicts with \pkg{hyperref} are resolved.
Note that \pkg{apacite} uses the \opt{key}|@|\opt{visual} form of
indexing. This form is used in \MakeIndex{} to distinguish between the actual
representation in the index and the place where it should occur. The \opt{key}
is used by \MakeIndex{} to sort the entry, but the entry actually appearing in
the index is \opt{visual}. In the \opt{key} part as formatted by
\pkg{apacite}, all names are in lower case letters and all accents and
punctuation are removed. Furthermore, \pkg{apacite} inserts \emph{two} spaces
between surname and initials, and to \MakeIndex{}, two spaces are different
from one space. Spaces between surnames are removed, as well as spaces between
initials. Finally, note that \pkg{apacite} always inserts a new line before
the ``|@|''. This is to avoid bad line breaks by \BibTeX. To \MakeIndex,
this means that each citation \opt{key} ends with a space.

The author index of the current document does not contain entries for the authors
Shocked and Goodenough as cited in section~\ref{sec:xmpl}, although it does for
the reference list part. The reason for this is that the \fieldname{key} field was
used for the citations. If you use the \fieldname{key} (and \fieldname{firstkey})
field and you want the authors in the author index as well, you have to include
the index command \cmd{\AX} explicitly. For example, the \fieldname{key} field
for Michelle Shocked is
\begin{verbatim}
  key = {{\protect\bibsong{Shocked}{1992}{Over the
         Waterfall}{track~5}}},
\end{verbatim}
and if we change this into
\begin{verbatim}
  key = {{\protect\bibsong{Shocked\AX{shocked  m
         @Shocked, M.}}{1992}{Over the Waterfall}{track~5}}},
\end{verbatim}
then citations to her are included in the author index.

\DescribeMacro{\corporateAX}
For corporate authors, the \cmd{\corporateAX} command is used instead of the
\cmd{\AX} command. Depending on whether the \pkgoption{suppresscorporate}
option or the \pkgoption{includecorporate} option is requested, either explicitly
or implicitly, \cmd{\corporateAX} either swallows its argument or is equivalent
to \cmd{\AX}. To make sure that this ends up correctly in the author index,
it is important that this command as entered in the \fieldname{key} and/or
\fieldname{firstkey} field is exactly as output by \fname{apacite.bst} for
the \fieldname{author} field. The easiest way to accomplish this is to start
with \fieldname{key} and/or \fieldname{firstkey} fields that do not have
the \cmd{\corporateAX} command yet. Then, run \LaTeX{} and \BibTeX{} and
extract the correct \cmd{\corporateAX} command from the \fname{.bbl} file
and insert this in the \fieldname{key} and/or \fieldname{firstkey} fields.
Rerun \BibTeX{} and after that proceed as usual. For example, the following
is an excerpt from an entry for one of the examples from section~3.96 in the
APA manual:
\begin{verbatim}
  author   = {{\bibcorporate{National Institute of Mental Health}}},
  firstkey = {{National Institute of Mental Health [NIMH]}},
  key      = {{NIMH}},
\end{verbatim}
If I run \LaTeX{} and \BibTeX{} on the current document, the \fname{.bbl}
file contains the lines
\begin{verbatim}
\corporateAX{nationalinstituteofmentalhealth
@{\bibcorporate{National Institute of Mental Health}}}%
\end{verbatim}
Note the \cmd{\bibcorporate} command and the additional braces. If these
are left out,
\begin{verbatim}
  firstkey = {{National Institute of Mental Health
              [NIMH]}\corporateAX{nationalinstituteofmentalhealth
              @{National Institute of Mental Health}}},
  key      = {{NIMH}\corporateAX{nationalinstituteofmentalhealth
              @{National Institute of Mental Health}}},
\end{verbatim}
then this organization gets two separate entries in the author index, which
is incorrect. Instead, if we copy them literally,
\begin{verbatim}
  firstkey = {{National Institute of Mental Health
              [NIMH]}\corporateAX{nationalinstituteofmentalhealth
              @{\bibcorporate{National Institute of Mental Health}}}},
  key      = {{NIMH}\corporateAX{nationalinstituteofmentalhealth
              @{\bibcorporate{National Institute of Mental Health}}}},
\end{verbatim}
then everything is as desired. The additional spaces before the ``\verb+@+''
sign make no difference, but percentage signs should not be included in
the \fname{.bib} file at the end of lines to hide a line break (as in
\LaTeX{}), because \BibTeX{} does not recognize the percentage sign as
a comment. Rather, it includes it in the \fname{.bbl} file and sometimes
puts additional code behind it, which would then not be read by \LaTeX{}
because \LaTeX{} does interpret the percent sign as a comment. This
behavior has now become less likely, because \pkg{apacite} inserts
numerous line breaks in the \fname{.bbl} file to avoid this problem and,
more importantly, line breaks inserted by \BibTeX{} at undesired
locations (e.g., in the middle of a command name or in the argument of
a \cmd{\url} command), but is still a possibility.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Annotated bibliographies}
\label{sec:annotate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Annotated bibliographies can be obtained by requesting
\begin{verbatim}
\bibliographystyle{apacann}
\end{verbatim}
instead of
\begin{verbatim}
\bibliographystyle{apacite}
\end{verbatim}
or
\begin{verbatim}
\bibliographystyle{apacannx}
\end{verbatim}
instead of
\begin{verbatim}
\bibliographystyle{apacitex}
\end{verbatim}
The \BibTeX{} style files \fname{apacann.bst} and \fname{apacannx.bst} are
almost identical to \fname{apacite.bst} and \fname{apacitex.bst}, respectively.
The only relevant difference is that these styles include the contents of the
\fieldname{annote} or \fieldname{annotate} field in the output, thereby
generating an annotated bibliography.

According to \citeA[pp.~810--811]{TLC2}, the \pkg{annotation} style uses the
\fieldname{annote} field for annotations, whereas the \pkg{annotate} style
defines the \fieldname{annotate} field for this purpose. To be compatible with
both, \pkg{apacann} and \pkg{apacannx} support both of these fields. However,
they are not both included in the output for the same reference, in case
someone wants to make a file that is compatible with both the \pkg{annotate}
and \pkg{annotation} styles and thus duplicates the information. In such a case,
the contents of the \fieldname{annote} field is included in the output.

\DescribeEnv{APACrefannotation}
The annotation is inserted in the \fname{.bbl} file within a
\envirname{APACrefannotation} environment. Hence, its formatting can be
changed by the user by redefining this environment.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Auxiliary, ad hoc, and experimental commands in
   \fname{apacdoc.sty}}
\label{sec:apacdoc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Section~\ref{sec:xmpl} below cites all examples from the APA manual.
This is a test of \pkg{apacite} and a proof that it does what it's
supposed to do---format citations and reference lists complying with
the APA rules. However, the APA manual discusses many nonstandard
issues and several of them need nonstandard treatment. Some of these
can only be formatted by what I call ``tricking'' the system. This
has been done by defining several \LaTeX{} commands that are too
specifically tailored for a certain reference, or ad hoc in other
ways, or more generally experimental and not well tested, and likely
to lead to more (compatibility) errors. Therefore,
I do not consider these commands suitable for inclusion in the
\pkg{apacite} package proper, that is, the file \fname{apacite.sty}.

They are not important enough for that, and thus you would rarely need
them, and for most of them I anticipated (or hoped) at one point that
better solutions would be available in the future. Thus, it seemed
quite likely that major changes in these commands would be made,
and I didn't want to feel obliged to keep supporting them for backwards
compatibility. Rather, I considered these as illustrations of the
power of \LaTeX{} and templates that users can base their own tricks
upon. I still largely feel the same way about these commands, although
I'm not convinced anymore that within reasonable time I will come up
with elegant solutions that make them obsolete. Nevertheless, I still
make improvements in this direction.

These auxiliary, ad hoc, and experimental commands are defined in a
supplementary package file, \fname{apacdoc.sty}. As
this name indicates, it is a package that is intended to be used
for the \pkg{apacite} documentation (i.e., the current document).
It contains several commands and settings (like page margins) that
are not interesting outside this document. However, as mentioned
above, I needed many of the commands defined in this file for the
examples in section~\ref{sec:xmpl}. Thus, you might encounter
similar situations as well, and these commands may be useful for you.

Because most of the commands in \fname{apacdoc.sty} will not be
useful for you, it is generally not a good idea to load this file with
\cmd{\usepackage} to use the commands that are useful to you.
Instead, if you want to use them, you can copy their definitions
to the top of your own document or personal style file (say,
\fname{mysettings.sty}), study their behavior, and perhaps improve
them. This reflects the ``illustration'' or ``template'' nature
of these commands.

Accordingly, this section briefly mentions the commands that may
be useful outside the context of the current document. Thorough
documentation is outside the scope of this manual; their definitions
can be studied in the source code of \fname{apacdoc.sty}, and their
usage is illustrated in section~\ref{sec:xmpl}. I will mildly
support them, though: If you want to use them, you can ask me
questions, but I will not put as much effort in fixing possible
problems as I do with proper \pkg{apacite} issues.

The list below mentions (some of) the numbered examples in
section~\ref{sec:xmpl} in which the commands are used.
\begin{description}

\item[\cmd{\biblecite}]
\DescribeMacro{\biblecite}
\DescribeMacro{\bibleciteA}
\DescribeMacro{\bibleciteNP}
\DescribeMacro{\fullbiblecite}
\DescribeMacro{\fullbibleciteA}
\DescribeMacro{\fullbibleciteNP}
\DescribeMacro{\shortbiblecite}
\DescribeMacro{\shortbibleciteA}
\DescribeMacro{\shortbibleciteNP}
This command, and its siblings \cmd{\bibleciteA}, \cmd{\bibleciteNP},
\cmd{\fullbiblecite}, \cmd{\fullbibleciteA}, \cmd{\fullbibleciteNP},
\cmd{\shortbiblecite}, \cmd{\shortbibleciteA}, and
\cmd{\shortbibleciteNP} are commands for citing the Bible. They
have one mandatory argument: the relevant chapter and verse, for
example, |\biblecite{1~Cor.\ 13:1}| (ex.~3.100-3).

\item[\cmd{\bibleversion}]
\DescribeMacro{\bibleversion}
This defines the version of the Bible used:
|\bibleversion{Revised Standard Version}|. Use this before using
the bible citing commands, typically in the preamble of your document.
Note that the Bible is not included in the reference list. You can use
these commands as templates for references to other ``classic'' works.
See ex.~3.100-3.

\item[\cmd{\citesong}]
\DescribeMacro{\citesong}
\DescribeMacro{\citeAsong}
\DescribeMacro{\citesongNP}
\DescribeMacro{\fullcitesong}
\DescribeMacro{\fullciteAsong}
\DescribeMacro{\fullcitesongNP}
\DescribeMacro{\shortcitesong}
\DescribeMacro{\shortciteAsong}
\DescribeMacro{\shortcitesongNP}
This command and its siblings \cmd{\citeAsong}, \cmd{\citesongNP},
\cmd{\fullcitesong}, \cmd{\fullciteAsong}, \cmd{\fullcitesongNP},
\cmd{\shortcitesong}, \cmd{\shortciteAsong}, and \cmd{\shortcitesongNP}
cite a song as required by the APA (except for the relative
placement of closing quotes and comma). See ex.~69.

\item[\cmd{\bibsong}]
\DescribeMacro{\bibsong}
For \cmd{\citesong} and its siblings, the \fieldname{key} field
(and possibly \fieldname{firstkey}) should contain the relevant
information in the form of a protected \cmd{\bibsong} command:
\begin{verbatim}
  key = {{\protect\bibsong{author}{year}{song title}{track info}}},
\end{verbatim}
See ex.~69.

\item[\cmd{\bibInstring}]
\DescribeMacro{\bibInstring}
This command has one argument. The macro changes the definition of
the macro \cmd{\BIn} to the argument and then immediately changes
the definition back to the old definition. So it makes a one-time
change. Used to change ``In'' a book to ``On'' a CD for citing songs.
See ex.~69.

\item[\cmd{\BOn}]
\DescribeMacro{\BOn}
``On'', for citing songs ``On'' a CD. See ex.~69.

\item[\cmd{\DSMcite}]
\DescribeMacro{\DSMcite}
\DescribeMacro{\DSMciteA}
\DescribeMacro{\DSMciteNP}
\DescribeMacro{\DSMfullcite}
\DescribeMacro{\DSMfullciteA}
\DescribeMacro{\DSMfullciteNP}
\DescribeMacro{\DSMshortcite}
\DescribeMacro{\DSMshortciteA}
\DescribeMacro{\DSMshortciteNP}
This command and its siblings \cmd{\DSMciteA}, \cmd{\DSMciteNP},
\cmd{\DSMfullcite}, \cmd{\DSMfullciteA}, \cmd{\DSMfullciteNP},
\cmd{\DSMshortcite}, \cmd{\DSMshortciteA}, and \cmd{\DSMshortciteNP}
cite the DSM. See ex.~29. They can also be used for other
``named'' works. \pkg{natbib} offers a similar functionality
through the definition of an \emph{alias}, but I think that to
get this working in the way the APA wants (i.e., the alias is not
used for the first citation, but only for second and subsequent
citations), it cannot be directly used. But the technical
implementation of its functionality may form a useful basis
for a better (more elegant) solution for this type of citation.

\item[\cmd{\bibDSM}]
\DescribeMacro{\bibDSM}
For \cmd{\DSMcite} and its siblings, the \fieldname{key} field
(and possibly \fieldname{firstkey}) should contain the relevant
\cmd{\bibDSM} command:
\begin{verbatim}
  key = {{\bibDSM{American Psychiatric Association}{Diagnostic
         and Statistical Manual of Mental Disorders}{4th
         ed.\hbox{}}{DSM-IV}}},
\end{verbatim}
See ex.~29.

\item[\cmd{\DSMauthor},
\cmd{\DSMfulltitle},
\cmd{\DSMedition},
\cmd{\DSMshorttitle}]
\DescribeMacro{\DSMauthor}
\DescribeMacro{\DSMfulltitle}
\DescribeMacro{\DSMedition}
\DescribeMacro{\DSMshorttitle}
These four commands extract the four elements of a \cmd{\bibDSM}
command. They are used in the \cmd{\DSMcite} command and its
siblings, but may occasionally be useful by themselves.

\item[\cmd{\bibliteral}] \DescribeMacro{\bibliteral}
This command is used in some of the examples in
section~\ref{sec:xmpl} to put some literal text into the
reference list that would otherwise be abbreviated to a
single ``initial'' at the \BibTeX{} stage. For example, in
ex.~4.08, the authors are ``Bulatao, E. (with Winford, C.~A.)'',
where ``(with Winford, C.~A.)'' is inserted by wrapping it
in a \cmd{\bibliteral} command, which itself is wrapped in
an additional pair of braces, so that \BibTeX{} treats it a
a complicated ``accent'' and the argument as a complicated
single character. This text should not be put in the author
index, and therefore some manipulation through redefining
the meaning of this command before and after the reference
list is used to suppress this text, as well as an additional
period, there. Used in examples 4.08, 65, 66, 68, and 70.

\item[\cmd{\bibinitial}] \DescribeMacro{\bibinitial}
This command is similar to \cmd{\bibliteral}. It is used in
one example (ex.~67), where the ``author'' is a ``(Producer)'',
but the initial of the author is put in the text because there
is another author with the same surname (Miller). This
causes problems not encountered in the examples where
\cmd{\bibliteral} is used, and after a lot of trial and error,
the current definition of \cmd{\bibinitial} was developed
to format this particular author correctly in text, reference
list, and author index. It looks like this is an improved
version of the \cmd{\bibliteral} command, so perhaps in the
next release I'll use \cmd{\bibinitial} for all the examples
in which now \cmd{\bibliteral} is used.

\item[\cmd{\bibreftext}] \DescribeMacro{\bibreftext}
This command takes two arguments. By default, it ignores the
first and inserts the second in the output. In this manual,
it is redefined before the reference list to ignore its
second argument and insert the first argument in the output.
This is used in ex.~17, where the year in the in-text
citation should be ``1992/1993'', whereas in the reference
list, it should be 1992 (and the 1993 is mentioned elsewhere).
For reprints and translations, this is handled automatically
by \pkg{apacite} if you use the \fieldname{original*} fields,
but this one is different.

\item[\cmd{\Dutchvon}] \DescribeMacro{\Dutchvon}
This command is equivalent to \cmd{\bibreftext}, but is used
for a different situation, and therefore, depending on
language, subtle style differences, and other preferences,
you might want to change the definition of one but not of
the other. This one illustrates how the Dutch way to treat
``von'' parts of surnames can be handled. It is discussed
in ex.~B-2, although it is not actually used in the examples,
because the Dutch way to treat ``von'' parts is not APA
style.

\item[\cmd{\SwapArgs}] \DescribeMacro{\SwapArgs}
This command takes two arguments and swaps their order. This
is useful if you cite a work whose title, (corporate) author,
or other element starts with an article that should be
disregarded for ordering. \pkg{apacite} disregards ``a'',
``an'', and ``the'' in the sorting of titles, but these are
obviously English. For French, you could say
\begin{verbatim}
  title = {\SwapArgs{Marseillaise}{La }},
\end{verbatim}
which is thus alphabetized under M. (Not used in the examples.)

\item[\cmd{\swallownext}] \DescribeMacro{\swallownext}
Eats up the next character. Dangerous but sometimes useful.
Used in the definitions of some of the following commands.

\item[\cmd{\swallowdot}] \DescribeMacro{\swallowdot}
Eats up the next character, but only if it's a dot (`.').
Used in the definitions of some of the following commands.

\item[\cmd{\bibnodot}] \DescribeMacro{\bibnodot}
Used as |\bibnodot{.}|. Eats the period, but prevents \BibTeX{}
from adding one. Used in examples 78, 79, 87, 91, and 95.
This is likely to be useful for many users, and is stable, so it
may be upgraded to \fname{apacite.sty} in the next release of
\pkg{apacite}. The only thing against this is that it is used in
highly unelegant manual formatting of a fairly large piece of the
description of a reference to a website in a
\fieldname{howpublished} field. I'd prefer to avoid this, but that
would require either adding another idiosyncratic field or even
less elegant trickery in the \fname{.bib} file.

\item[\cmd{\bibskipbracenodot}] \DescribeMacro{\bibskipbracenodot}
Suppresses the period after a subsequent closing brace. Quickly leads
to errors because it uses very low level \TeX{} code that (locally)
changes some fundamental settings. This is used in some examples
(65, 68) where \cmd{\bibliteral} is used to insert a description
of a first ``author'', such as ``(Producer)''. This is
interpreted by \BibTeX{} as a complicated one-letter first
name, and thus it adds a period to make it into an initial.
This period is the one that's eaten by this command.
Used in examples 65 and 68.

\item[\cmd{\indexskipbracenodot}] \DescribeMacro{\indexskipbracenodot}
This serves the same purpose as \cmd{\bibskipbracenodot}, and it
uses the same code, but whereas \cmd{\bibskipbracenodot} is
activated for the reference list, \cmd{\indexskipbracenodot}
is only activated for the author index. This has technical
reasons and it does not work under all circumstances. Used in
examples 4.08-3, 65, 66, and 68.

\item[\cmd{\APACredefineOnce}] \DescribeMacro{\APACredefineOnce}
This macro takes two arguments: (1) the name of a command (without the
backslash) and (2) arbitrary \TeX{} code. It then redefines the
command (1) to the \TeX{} code (2) as a one-time change, so after the
command (1) has been invoked once, it reverts to its definition before
\cmd{\APACredefineOnce} was issued. This can be used to redefine, say,
\cmd{\BRetrievedFrom} from ``Retrieved from'' to ``Retrieved from
Poverty Alleviation website'' for a single reference but restore it
to ``Retrieved from'' immediately afterwards.

\item[\cmd{\bibeditortype}] \DescribeMacro{\bibeditortype}
This has one argument. The macro changes the definitions of the macros
\cmd{\BED} and \cmd{\BEDS} to the argument and then immediately
changes the definitions back to their old definitions. So it makes a
one-time change. This is used when there is someone in an ``editor-type''
role, but with another designation, such as ``producer'' or ``director''.
Ex.\ 36, 67, and 68.

\item[\cmd{\renewbibeditortype}] \DescribeMacro{\renewbibeditortype}
The above-mentioned definition of \cmd{\bibeditortype} is only relevant
in the reference list: In the citations in the text and in the author
index, the command should do nothing. Therefore, the command is
initially defined as ``nothing''. The definition discussed above is
initialized by \cmd{\renewbibeditortype}. This command is executed
just before the reference list in the current document. (After the
reference list, \cmd{\bibeditortype} becomes ``nothing'' again.)

\item[\cmd{\BAbstractRetrieved}] \DescribeMacro{\BAbstractRetrieved}
This command is similar to \cmd{\BRetrieved}, except that it
inserts ``Abstract retrieved'' instead of ``Retrieved''. Used in
examples 82 and 83.

\item[\cmd{\BmakeAbstractRetrieved}]
\DescribeMacro{\BmakeAbstractRetrieved}
This command functions much like \cmd{\bibeditortype}: It replaces
the next instance of \cmd{\BRetrieved} by \cmd{\BAbstractRetrieved}.
Used in examples 82 and 83.

\item[\cmd{\noedition}] \DescribeMacro{\noedition}
Suppresses the ``ed.'' (or ``\cmd{\BEd}'', rather) of an
\fieldname{edition}. Used in examples 92 and 94 to format a
string like ``Version~4'' as an \fieldname{edition}.

\item[\cmd{\APACmanBeforeBib}] \DescribeMacro{\APACmanBeforeBib}
Illustrates how some of the commands defined above are used in practice:
This command is given just before the \cmd{\bibliography} command, and
redefines some of the commands above, so that their meaning
is different in the reference list from their meaning in the main text.
Similar commands: \cmd{\APACmanBeforeIndex}, \cmd{\APACmanAfterIndex}.

\end{description}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Known problems and todo-list}
\label{sec:todo}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
With any kind of software, there is usually a list with known problems (bugs)
and desirable future work (to-do), and \pkg{apacite} is no exception. These
subjects will be discussed in this section.

A class of problems was already discussed in section~\ref{sec:compat} above.
This concerns the incompatibility of the \fname{.bib} file with other citation
styles, through \pkg{apacite}-specific fields, APA-specific contents of
fields, or through special tricks. These lead to correctly formatted
references in APA style, but may cause problems with using the \fname{.bib}
file with other styles (in case APA journals reject your article~\ldots). As
discussed there, however, this problem is unavoidable and presumably not a
very big problem to most users.

An incomplete list of other known problems and things that I would
like to do with \pkg{apacite} follows below. Several items of this list
are the direct result of the tricks I had to use for the examples in
section~\ref{sec:xmpl} below.
\begin{itemize}
\item Fix a bug (which is unlikely to show up) in the \fname{.bst} file:
      If there are two or more references, published in the same year, each
      with 6 authors, the first 5 of which are the same but the 6th authors
      are different, then these lead to ambiguous citations. The same thing
      happens when one has 6 authors and another 7, with the same first 6
      authors.
\item In an \entryname{unpublished} entry, if \fieldname{author} and
      \fieldname{organization} are equivalent, maybe we should replace
      the latter with
      ``Author'' in the output, analogous to the situation where
      \fieldname{publisher} or \fieldname{institution} are equal to
      \fieldname{author} in several of the other entry types.
\item Solve several other rare cases where \pkgoption{apacite} does not
      correctly implement the APA rules: (p.~175) If additional authors
      are needed to resolve an ambiguity, end with ``et al.\hbox{}'',
      even if this is only one author; (p.~179) citing the Qur'an;
      (p.~184) same last name and same initials, but different first name;
      (p.~185) ``ca.\hbox{}''; (p.~198) Advance online publication;
      (p.~202) Abstract retrieved from; (pp.~208, 212) better deal with
      named archives; (p.~214) uncertain author;
      update the language files (\fname{.apc}) with correct definitions
      of new text string commands; finish the examples file.
      Many of these cases will not be a feature, but an ad-hoc workaround,
      similar to the tricks that are described in section~\ref{sec:xmpl}.
      Please contact me if you encounter any of these (or other
      formatting errors) and need a workaround.
\item Study referencing legal materials (Appendix~7.1).
\item Support nonstandard types of authors, like ``Director'' and
      ``Series Ed.\hbox{}''. This currently must be tricked in a
      nonelegant way. Perhaps I (or you) can think of a better solution.
\item If a work is authored by someone, ``with'' someone else: This
      currently must be tricked in a nonelegant way. Perhaps I (or you)
      can think of a better solution.
\item Add more options and/or commands for easier customization of reference
      list and author index.
\item Continue with transferring reference list formatting code from
      \BibTeX{} to \LaTeX.
\item Introduce options for the \BibTeX{} part, e.g., index vs.\ noindex (so
      that \fname{apacitex.bst} becomes superfluous); full first names
      instead of only initials, or perhaps options for putting initials
      in front of (2nd and later) author names; unsorted reference lists
      or lists sorted chronologically (forward or reverse; for CVs); etc.
\item Extend the \cmd{\bibcorporate} command with an optional argument that
      gives the abbreviated form, so that the \fieldname{firstkey} and
      \fieldname{key} fields do not have to be used for this common situation.
\item Define \BibTeX{} macros or strings for commonly encountered
      journals (at least the APA journals).
\item Allow \fieldname{lastchecked} fields of the form |2009-02-01| and/or
      |2009/02/01| and/or other schemes, and translate these into
      language-specific date strings.
\item Rewrite and reorganize the documentation; perhaps create a ``getting
      started'' document.
\item Improve the source code documentation, esp.\ the formatting,
      indexing, and cross-referencing. (You only see this if you regenerate
      this manual with the \cmd{\AlsoImplementation} flag set.)
\end{itemize}
Quite likely, other problems will come up when using the current version of
\pkg{apacite}. I have lots of ideas for improvements, extensions, options, and
so forth, but not much time to devote to it. Therefore, it is difficult to give
a good estimate of when I will release a new update. However, in the meantime,
if you have questions, remarks, suggestions, or bug reports, you can e-mail them
to me.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Examples of the APA manual}
\label{sec:xmpl}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\bfseries Note: the text of this section has not been updated and
reflects the working of the [2009/03/01] version of \pkg{apacite}
vis-\`a-vis the 5th edition of the APA manual. The actual formatting
is done by the current version of \pkg{apacite} and thus may not
correspond to the text. This section is retained for the moment, because
the majority may still be relevant and I haven't finished incorporating
the examples from the 6th edition yet, and because it describes various
workarounds and tips that may still be useful.}

In this section, the \pkg{apacite} package is tested by citing the examples of
the 5th edition of the APA manual \cite[pp.~207--281]{APAManual5}, and some
additional references for additional purposes.

The following list gives the examples from chapter~3 of the 5th edition of
the APA manual, with
section number. For these and all later examples, whenever I thought it
necessary or desirable, I added some comments. These are indicated by the \EM{}
symbol. Especially for later examples (from Chapter~4), the comments frequently
pertain to the corresponding reference list entry.

\begin{itemize}
\item[3.94]  \citeA{3.94-1} compared reaction times\\
             In a recent study of reaction times \cite{3.94-1}\\
             In \citeyearNP{3.94-1} \citeauthor{3.94-1} compared
               reaction times\\
             In a recent study of reaction times, \citeA{3.94-1}
             described the method\ldots. \citeauthor{3.94-1} also found
\item[3.95]  \citeA{3.95-1} found\\
             \citeA{3.95-1} found\\
             \citeauthor{3.95-1} found\\
             \fullcite{3.95-2} and \fullcite{3.95-3}\\
             \citeA{3.95-2} and \citeA{3.95-3}\\
             \EM It seems that if ``et al.\hbox{}'' would refer to one additional
             author, then this author is named instead of the ``et al.\hbox{}''
             clause.\\
             \citeA{3.95-4} and \citeA{3.95-5}\\
             as \citeA{3.95-6} demonstrated\\
             \EM The comma after ``Nightlinger'' in the reference list
             does not look right, but is explicitly required by the APA.
             Of course, with people as authors,
             one almost always has initials (although I have seen
             an example of an econometrician who only had
             one name), so this problem is not likely to occur.
             With nicknames (``screen names'' as they are called in the
             APA manual below ex. 85) in messages to newsgroups, initials
             are typically missing, but then there is usually (always?)
             only one author, so the problem does not exist either.
             The problem can, however, come up when there are two authors,
             the first of which is a corporate author, or with artists,
             e.g., the song ``Into the Groove'' is written by
             Madonna and Stephen Bray. \\
             as has been shown \cite{3.95-7}
\item[3.96]  \cite{3.96-1}\\
             \cite{3.96-1}\\
             \cite{3.96-2}\\
             \EM If the \fieldname{firstkey} field is different for different
             references
             and the \fieldname{key} field is the same, then, analogous
             to the use of extra authors in 3.95 above, \pkg{apacite}
             uses the \fieldname{firstkey} field for all citations:\\
             \citeA{3.96-3}, \citeA{3.96-4}, \citeA{3.96-5}, \citeA{3.96-6};\\
             \citeA{3.96-3}, \citeA{3.96-4}, \citeA{3.96-5}, \citeA{3.96-6}.\\
             Although this is a constructed example, these organizations
             really exist. The ``Koninklijke Nederlandse Schaakbond''
             is the Royal Dutch Chess Association and the
             ``Koninklijke Nederlandse Schaatsbond'' is the Royal Dutch
             Skating Association. Both are abbreviated to KNSB and
             presumably, both publish an annual report each year.
             Furthermore, in these examples, I copied the contents of the
             \fieldname{author} field to the \fieldname{publisher} field.
             \pkg{apacite} recognizes this and puts the APA-requirement
             ``Author'' as publisher description in the reference list.
             Other styles may prefer the full publisher name again.
\item[3.97]  on free care \cite{3.97-1}\\
             \EM The order of the
             closing quotes and the comma is different from the
             APA manual. I think this one is more logical, although the
             APA manual's is the conventional one, presumably for
             aesthetic reasons. I hope to implement this in a future
             version.\\
             the book \citeA{3.97-2}\\
             \cite{3.97-3}\\
             \EM If two articles both have no author and the title and
             the year are the same, a's and b's should be used:
             \citeA{3.97-4}, \citeA{3.97-5}, and \citeA{3.97-6}.
             The latter two entries are correctly sorted by month,
             through the way the month macros are defined in
             the \fname{.bst} files.
\item[3.98]  \citeA{3.98-1} and \citeA{3.98-2} also found\\
             \citeA{3.98-3} and \citeA{3.98-4} studied
\item[3.99]  Past research \cite{3.99-1,3.99-2}\\
             Past research \cite{3.99-3,3.99-4,3.99-5}\\
             Several studies
               \cite{3.99-6,3.99-7,3.99-8,3.99-9,3.99-10,3.99-11}\\
             Several studies \cite{3.99-12,3.99-13,3.99-14}\\
             \EM \pkg{apacite} does not (yet?) sort the cited
             references in the text (of course it does for the reference
             list), as required by the APA manual.\\
             (\citeNP{3.99-15}; see also \citeNP{3.99-16,3.99-17})\\
             \EM Note that I had to use \cmd{\citeNP} here.
\item[3.100] \cite{3.100-1}\\
             \EM This is not an example, but a rule in the text.
             The ``\bibnodate'' is handled by the \cmd{\bibnodate}
             macro. It is not clear whether it is really meant that the
             in-text form is \citeauthor{3.100-1}, \citeyearNP{3.100-1}
             or the more logically consistent \citeA{3.100-1}.
             The former can (currently) only be accomplished by using
             \cmd{\citeauthor} and \cmd{\citeyearNP} explicitly,
             whereas the latter is simply obtained by \cmd{\citeA}.\\
             \cite{3.100-1b}\\
             \EM Again, this is not an example, but a rule in the text.\\
             \cite{3.100-2}\\
             \citeA{3.100-3}\\
             \EM For citations to the bible, I used \cmd{\biblecite} and
             several obvious variations on it, as discussed in
             section~\ref{sec:apacdoc}:\\
             \cmd{\bibleciteA}, first cite:  \bibleciteA{1 Cor.\ 13:1}\\
             \cmd{\bibleciteA}, second cite: \bibleciteA{1 Cor.\ 13:1}\\
             \cmd{\biblecite}, first cite: \fullbiblecite{1 Cor.\ 13:1}\\
             \cmd{\biblecite}, second cite: \biblecite{1 Cor.\ 13:1}\\
             (\cmd{\bibleciteNP}, first cite:
              \fullbibleciteNP{1 Cor.\ 13:1} and some text surrounding it)\\
             (\cmd{\bibleciteNP}, second cite:
              \bibleciteNP{1 Cor.\ 13:1} and some text surrounding it)\\
             \EM Here, there probably should be a comma if it's the first
             cite and not a comma when it's a later cite. A difficult one.\\
             \EM Ancient Greek and Roman works should be treated similarly,
             i.e., not be listed in the reference list. But it seems to me
             that title and/or author must be given in the text as well.
             Maybe I will try to construct a tentative example of this in
             a future release.
\item[3.101] \cite[p.~332]{3.101-1}\\
             \cite[Chapter~3]{3.101-2}\\
             \EM If you like, you can use the \pkg{apacite}-defined
             abbreviation commands \verb+\BPG+ and \verb+\BCHAP+.\\
             \cite[\P~5]{3.101-3}\\
             \cite[Conclusion section, para.~1]{3.101-4}
\item[3.102] \EM Personal communication is not really citation and should
             be done manually:\\
             T.~K. Lutes (personal communication, April 18, 2001)\\
             (V.-G. Nguyen, personal communication, September 28, 1998)
\item[3.103] \cite<see Table~2 of>[for complete data]{3.103-1}
\end{itemize}

\noindent
Chapter~4 of the APA manual deals with the reference list
and only mentions some in-text citation issues in passing.
Therefore, the rest mainly requires a lot of moving back and forth
between the reference list and this part. I start with the
more general part, sections 4.01--4.15, presented similar to
the sections from chapter~3 as presented above.
\begin{itemize}
\item[4.04] \EM First, some examples mentioned in the text:\\
            \citeA{4.04-t1},
            \citeA{4.04-t2},
            \citeA{4.04-t3},
            \citeA{4.04-t4},
            \citeA{4.04-t5},
            \citeA{4.04-t6},
            \citeA{4.04-t7},
            \citeA{4.04-t8},
            \citeA{4.04-t9}\\
            \EM The APA manual states that prefixes must be treated
            according to the rules of the language of origin. These rules
            can differ a lot between languages (and countries) and it
            is impossible to know all these rules. The APA manual gives two
            examples, one in which ``De Vries'' is treated as the surname,
            and one in which ``Helmholtz'' is the surname and ``von'' is
            the ``von'' part of the name.

            In the former case, the author is referred to as, say, ``De Vries
            (1999)'' in text and ``De Vries, J. (1999).'', alphabetized under
            ``D'' in the reference list. In the second example, the author is
            referred to as, say, ``Helmholtz (1870)'' and listed in the
            reference list as ``Helmholtz, H. L. F. von. (1870).'',
            alphabetized under ``H''. To get this right, the author must be
            defined as
\begin{verbatim}
  author = {H. L. F. von Helmholtz},
\end{verbatim}
            or
\begin{verbatim}
  author = {von Helmholtz, H. L. F.},
\end{verbatim}
            then \BibTeX{} will assign the correct parts to the first names,
            ``von''-part, and last name. The seemingly logical
\begin{verbatim}
  author = {Helmholtz, H. L. F. von},
\end{verbatim}
            will not be formatted correctly, because ``von'' is now
            considered to be part of the first names and therefore
            abbreviated to ``v.''.

            Below, under example B-2, I will further discuss some
            issues about ``von'' parts.

            \EM The APA manual requires that numerals are alphabetized
            as if they were spelled out. This is not done by \pkg{apacite},
            so when applicable should be done by the user, e.g.\ by using
            the \cmd{\APACSortNoop} command as discussed in
            section~\ref{subsec:sort}. I give one fictitious example
            \cite{4.04-t10}.

            \citeA{4.04-1}\\
            \citeA{4.04-2}\\
            \citeA{4.04-3}\\
            \citeA{4.04-4}\\
            \citeA{4.04-5}\\
            \citeA{4.04-6}\\
            \citeA{4.04-7}\\
            \citeA{4.04-8}\\
            \citeA{4.04-9}\\
            \citeA{4.04-10}\\
            \citeA{4.04-11}\\
            \citeA{4.04-12}\\
            \EM As stated in the APA manual, an exception to the rule
            of sorting by title if author and year are the same occurs
            when the works are identified as a series. Then ordering
            the parts of the series sequentially can be done using the
            \cmd{\APACSortNoop} command.\\
            \EM Here, it says that only ``A'' and ``The'' are excluded
            from the sorting (if they are the initial words), but I
            assume they mean ``An'' as well. This is how it is
            implemented in \pkg{apacite}.

            \citeA{4.04-13}\\
            \citeA{4.04-14}\\
            \EM I have not (yet?) studied referencing legal materials.
            In the first version of \pkg{apacite}, I defined a
            \entryname{literal} type, so that the users can
            literally format such entries themselves. This is still
            available. However, I think that if you need to refer to
            legal cases, you can find a way to use the
            \entryname{misc} type to get it right. I might study this
            and give examples in a next version of \pkg{apacite}.
\item[4.05] \citeA{4.05-1}\\
            \nocitemeta{4.05-2}\citeA{4.05-2}\\
            \EM Here I used the \cmd{\nocitemeta} command to let
            \pkg{apacite} know that a meta-analysis is reported and this
            work is included in it. As you can see, you can still cite
            the work by using the normal citation commands such as
            \cmd{\citeA}.
\item[4.08] \citeA{4.08-1}\\
            \citeA{4.08-2}\\
            \citeA{4.08-3}\\
            \EM To obtain the ``(with \dots)'' description in the
            reference list, I used the \cmd{\bibliteral} command.
            Furthermore, to get this formatted correctly in the author
            index, I used the \cmd{\indexskipbracenodot} command to
            suppress an additional period. These commands are described
            in section~\ref{sec:apacdoc}.

            To \BibTeX{}, the \cmd{\bibliteral} construction is a complicated
            accented character, which is the second initial of the author.
            Consequently, this does not work properly with styles that put
            the initials \emph{before} the surnames, and care must be
            exercised with ``junior'' parts (see ex.~70). Furthermore,
            this construction must be put between a pair of
            braces in order for \BibTeX{} to treat it as an accented letter,
            instead of abbreviating it.
\item[4.09] \citeA{4.09-1}
\item[4.10] \citeA{4.10-1}\\
            \citeA{4.10-2}
\item[4.11] \citeA{4.11-1}\\
            \citeA{4.11-2}\\
            \EM Note that in the \fname{.bib} file, the ``junior'' part comes
            directly after the surname and a comma, with the initials
            after the ``junior'' part, whereas in the formatted
            reference list, the more logical order \opt{surname},
            \opt{initials}, \opt{junior}, is used.
\item[4.12] \citeA{4.12-1}
\item[4.13] \citeA{4.13-1}\\
            \EM ``For substantial reference works with a large editorial
            board, naming the lead editor followed by \texttt{et al.} is
            acceptable''. This is now implemented in \pkg{apacite} as
            follows: If there are 7 or more editors, only the first one
            is named, followed by ``et al.\hbox{}'' \cite{4.13-2}.
\item[4.15] \citeA{4.15-1}\\
            \EM Here I used the new \fieldname{url} and
            \fieldname{lastchecked} fields.\\
            \citeA{4.15-2}
\end{itemize}

\noindent
The rest is from section~4.16, the examples section. The section number
is omitted, but A--I are used instead for the unnumbered examples. For
the numbered examples, only the number is given.
The following enumerated list gives the example number, and
the two basic in-text citation commands, both in a full and
short form, of the examples.
\begin{enumerate}
\item[A-1] \cite{A-1}  \\ \cite{A-1} \\ \fullciteA{A-1} \\ \citeA{A-1}
\item \cite{ex1}  \\ \cite{ex1} \\ \fullciteA{ex1} \\ \citeA{ex1}
\item \cite{ex2}  \\ \cite{ex2} \\ \fullciteA{ex2} \\ \citeA{ex2}
\item \cite{ex3}  \\ \cite{ex3} \\ \fullciteA{ex3} \\ \citeA{ex3}
\item \cite{ex4}  \\ \cite{ex4} \\ \fullciteA{ex4} \\ \citeA{ex4}\\
      \cite{ex4-2} \\ \cite{ex4-2} \\ \fullciteA{ex4-2} \\ \citeA{ex4-2}\\
      \EM Note that the list of authors can be finished with
      ``\verb+and others+'' if there are more than 6 authors, or
      all authors can be given, in which case \pkg{apacite} truncates
      the list after the first~6. For compatibility with other styles,
      the latter is preferable.
\item \cite{ex5}  \\ \cite{ex5} \\ \fullciteA{ex5} \\ \citeA{ex5}
\item \cite{ex6}  \\ \cite{ex6} \\ \fullciteA{ex6} \\ \citeA{ex6}
\item \cite{ex7}  \\ \cite{ex7} \\ \fullciteA{ex7} \\ \citeA{ex7}\\
      \EM Here, I used
\begin{verbatim}
  month = spring,
\end{verbatim}
      using the new \verb+spring+ macro defined in the \fname{.bst} files.
\item \cite{ex8}  \\ \cite{ex8} \\ \fullciteA{ex8} \\ \citeA{ex8}\\
      \EM Here, again, the order of the closing quotes and the
      following comma should be reversed according to the APA rules.\\
      \EM The \fieldname{month} field is formatted as
\begin{verbatim}
  month = aug # "/" # sep,
\end{verbatim}
      which uses the month macros and \BibTeX's concatenation
      operator `\verb+#+'.
\item \cite{ex9}  \\ \cite{ex9} \\ \fullciteA{ex9} \\ \citeA{ex9}\\
      \EM Here, again, the order of the closing quotes and the
      following comma should be reversed according to the APA rules.
\item \cite{ex10} \\ \cite{ex10}\\ \fullciteA{ex10}\\ \citeA{ex10}
\item \cite{ex11} \\ \cite{ex11}\\ \fullciteA{ex11}\\ \citeA{ex11}\\
      \EM Apparently, a weekly newspaper is not a magazine and should
      therefore include ``p.\hbox{}'' or ``pp.\hbox{}'' in front of
      the page
      number(s), whereas a magazine article should not. I do not
      understand the distinction very well and find it not very
      useful as well, but will adhere to it. It means that the
      \entryname{newspaper} type gets the ``pp.\hbox{}'', whereas
      \entryname{magazine} and \entryname{article}, which are now
      identical, do not.
\item \cite{ex12} \\ \cite{ex12}\\ \fullciteA{ex12}\\ \citeA{ex12}\\
      \EM Here, \verb+\emph{DSM-IV}+ must be entered without an extra
      pair of braces in the title field; see ex.~73 for the intricacies
      of braces and \verb+\emph+ in the title field.
\item \cite{ex13} \\ \cite{ex13}\\ \fullciteA{ex13}\\ \citeA{ex13}\\
      \EM Here, the \fieldname{number} field is \verb+1, Serial No.~231+.
\item \cite{ex14} \\ \cite{ex14}\\ \fullciteA{ex14}\\ \citeA{ex14}\\
      \EM Here, the \fieldname{number} field is \verb+3, Pt.~2+.
\item \cite{ex15} \\ \cite{ex15}\\ \fullciteA{ex15}\\ \citeA{ex15}
\item \cite{ex16} \\ \cite{ex16}\\ \fullciteA{ex16}\\ \citeA{ex16}
\item \cite{ex17} \\ \cite{ex17}\\ \fullciteA{ex17}\\ \citeA{ex17}\\
      \EM This case is the opposite of the more common situation where a
      reprint is cited and an original publication year is given. I could
      implement similar code to handle this case (and I may if I get requests
      to do this), but for the moment, I decided to trick the system: I
      used the \cmd{\bibreftext} command mentioned in
      section~\ref{sec:apacdoc}. It must be called with two
      arguments. Initially, it places the second argument in the text, but
      just before the bibliography, its definition is changed so that the
      first argument is placed in the reference list. By defining
\begin{verbatim}
  year = {{\protect\bibreftext{1992}{1992/1993}}},
\end{verbatim}
      in the \fname{.bib} file, the year is ``1992'' in the reference
      list and ``1992/1993'' in the text citations. The \cmd{\protect}
      is necessary to make sure that the \cmd{\bibreftext} macro is not
      written out in the label-part of the bibliography, because then
      only ``1992'' would appear in the text reference. The additional
      pair of braces are necessary to make sure that the entry
      is alphabetized correctly. When these are omitted, the entry
      is alphabetized under the ``P'' of ``protect''. Of course, the
      latter is only important if the reference list contains
      multiple works by the same author(s), but the same phenomenon
      is encountered when the \fieldname{author} or \fieldname{editor}
      field starts with a command, or when there is no author or editor
      and the \fieldname{title} field starts with a command, as in
      the entry \citeA{4.04-t10} introduced in 4.04 above.

      Of course, you can save yourself a lot of trouble by
      obtaining the original article and citing that.
\item \cite{ex18} \\ \cite{ex18}\\ \fullciteA{ex18}\\ \citeA{ex18}\\
      \EM Here, the \fieldname{number} field is \verb+Suppl.~2+.
\item \cite{ex19} \\ \cite{ex19}\\ \fullciteA{ex19}\\ \citeA{ex19}\\
      \EM Other styles treat the \emph{Annual Review} as a book
      (\emph{Sociological Methodology} is an even stronger example),
      so this is a point where the \fname{.bib} file becomes
      highly incompatible between styles. This cannot be avoided.
\item \cite{ex20} \\ \cite{ex20}\\ \fullciteA{ex20}\\ \citeA{ex20}\\
      \EM Here, the \fieldname{englishtitle} field is used for the
      English translation of the German title. To get the German
      capitalization of the title right, the capitalized words must
      be protected by an additional pair of braces.
\item \cite{ex21} \\ \cite{ex21}\\ \fullciteA{ex21}\\ \citeA{ex21}\\
      \EM Apparently, a translator and original publication date
      do not have to be mentioned here.
\item Seidenberg and McClelland's study \cite<as cited in>{ex22}\\
      %\cite{ex22} \\ \cite{ex22}\\ \fullciteA{ex22}\\ \citeA{ex22}\\
      \EM The APA website (\url{http://www.apastyle.org/faqs.html})
      mentions that the year should generally also be mentioned,
      making it a complete cite, except that there is no reference
      list entry. In my opinion, it would be better to list the
      complete original work in the reference list as well, in case
      readers do have access to the original work, but not to the
      secondary source. But this is not the APA rule. \\
      \EM You may like to have the authors of the unlisted reference
      in the author index as well. Use the \cmd{\AX} command for
      this, as explained in section~\ref{sec:autindex}.
\item[B-1] \cite{B-1}  \\ \cite{B-1} \\ \fullciteA{B-1} \\ \citeA{B-1}
\item \cite{ex23} \\ \cite{ex23}\\ \fullciteA{ex23}\\ \citeA{ex23}\\
      \EM Here, and in several other references, I put \verb+\hbox{}+
      after the ``\verb+Jr.+'', so that \TeX{} does not consider the
      period as a sentence-ending period.\\
      \EM \pkg{apacite} now supports only an integer value (``\verb+3+'')
      in the \fieldname{edition} field, and transforms this to
      ``3rd''.
\item \cite{ex24} \\ \cite{ex24}\\ \fullciteA{ex24}\\ \citeA{ex24}\\
      \EM The APA manual gives a number, which would not ordinarily be
      done with proper books and which suggests that it could also
      be treated as a report. In that case, the default
      ``Tech.\ Rep.\hbox{}''
      description should be left out, however. This can be accomplished
      by defining
\begin{verbatim}
  type = {\bibnotype},
\end{verbatim}
      which flags that the type must be left out, see ex.~42.
      However, for books, it now works fine leaving the \fieldname{type}
      field empty and giving the number in the \fieldname{number} field.
\item \cite{ex25} \\ \cite{ex25}\\ \fullciteA{ex25}\\ \citeA{ex25}\\
      \EM According to the note after ex.~25 in the APA manual,
      an edited book with ``just one'' author should list
      the editor (and translator, when available) after the
      title, just like the translator. An example of this is
      \citeA{ex25-t1}. (Should the original years of publication
      be used here?)

      However, what does ``just one author'' mean here? Does it mean that if
      there are 2 authors and 1 or more editors, the editors should
      not be mentioned, or the authors should not be mentioned?
      Presumably, it means the following:
      In the default case, an edited book consists of several chapters,
      with different chapters written by different authors. In this case,
      the reference to the whole book lists only the editor(s).
      If every chapter is written by the same author, and there are 1
      or more editors, their condition holds. I think that if all
      chapters are written by the same $n$ ($\geq 2$) authors, it should
      also be treated in this way, i.e., with the authors in the
      author position and the editor behind the title. A difficult
      case would appear if the book were a collection of works of, say,
      2 authors, with some chapters written by one and some by the
      other, and some jointly, as in \citeA{ex25-t2}. These choices have
      to be made by the user, however, \pkg{apacite} will format author,
      editor, and translator, whenever available.
\item \cite{ex26} \\ \cite{ex26}\\ \fullciteA{ex26}\\ \citeA{ex26}\\
      \EM According to section~3.97, the title should be in italics.
      In this example, in the citation, it is not given in italics,
      but this must be an error, because they do give it in italics
      on p.~219 (but give no date there).
\item \cite{ex27} \\ \cite{ex27}\\ \fullciteA{ex27}\\ \citeA{ex27}\\
      \EM Here, the \fieldname{edition} field has value
      ``\verb+Rev.\hbox{}+'' and \pkg{apacite} handles this
      noninteger value correctly as well.
\item \cite{ex28} \\ \cite{ex28}\\ \fullciteA{ex28}\\ \citeA{ex28}\\
      \EM Use the en-dash (``\verb+--+'') and not simply a hyphen
      (``\verb+-+''), because the latter is not considered to mean
      ``to'' by \pkg{apacite} (cf.\hbox{} ``Vol.~A-1'').
\item \EM As mentioned in section~\ref{sec:apacdoc}, \fname{apacdoc.sty}
      provides the \cmd{\DSMcite} macro and some related
      alternatives to get the \emph{DSM} references right. On rereading
      the description in the APA manual, I discovered that previous
      versions of \pkg{apacite} did not format the first citation
      correctly, although the description is a bit ambiguous as to
      how exactly the first citation should be formatted. Therefore,
      I looked at a recent issue of
      \emph{Journal of Abnormal Psychology}, \emph{116}(3); and
      \emph{Psychological Assessment}, \emph{19}(2). These show
      some slight variations, some of which have good reasons, but
      others seem arbitrary. In all articles I looked at, the first
      citation was an in-text citation, and the following form was
      the most frequently used, and thus implemented in
      \fname{apacdoc.sty}:\\
      \cmd{\DSMciteA}, first citation: \DSMciteA{ex29} \\
      \EM The following citations then only use the abbreviated title:\\
      \cmd{\DSMciteA}, second citation: \DSMciteA{ex29} \\
      \EM Because I haven't found a parenthetical first cite, I
      have to use some logic and common sense to define it:\\
      \cmd{\DSMcite}, first citation: \DSMfullcite{ex29} \\
      \EM Subsequent parenthetical cites are formatted as\\
      \cmd{\DSMcite}, second citation: \DSMcite{ex29} \\
      \EM Finally, here are ``\verb+NP+'' versions of them:\\
      \cmd{\DSMciteNP}, first citation: \DSMfullciteNP{ex29} \\
      \cmd{\DSMciteNP}, second citation: \DSMciteNP{ex29} \\
      To use these citation commands, you have to provide a
      \fieldname{key} field that contains a \cmd{\bibDSM}
      command:
\begin{verbatim}
  key = {{\bibDSM{American Psychiatric Association}{Diagnostic
         and Statistical Manual of Mental Disorders}{4th
         ed.\hbox{}}{DSM-IV}}},
\end{verbatim}
      As is evident from this example, the four arguments are
      author, full title, edition, short title. Thus, because
      all this information is provided in the \fname{.bib}
      entry (and not preprogrammed in \pkg{apacite}), it is
      conceivable that this command is useful for other types
      of works as well. The generality is a bit limited, though,
      because all four arguments must be available and have
      meaningful content (i.e., should not be empty). But it
      is relatively straightforward to write your own specialized
      citation commands, based on the \cmd{\DSMcite} code,
      which do not require all parts to be available.

      However, the \cmd{\DSM*} macros are still very rough. Multiple
      citations are not handled well, so only one work should
      be cited with such a macro. Furthermore, the pre- and
      postfixes (through \verb+<...>+ and \verb+[...]+) are not
      available. Note also that the edition should be spelled
      out as ``\verb+4th ed.\hbox{}+''. When I experimented with
      just ``\verb+4+'', trying to use the \cmd{\PrintOrdinal}
      function, things went terribly wrong. Even if I put
      \verb+\PrintOrdinal{4}+ in the \fieldname{key} field, it
      didn't work. Finally, the ``ed.\hbox{}'' must be added
      to allow reference to the ``3rd ed., rev.\hbox{}'' and the
      ``4th ed., text rev.\hbox{}'' as well.

      \EM In some of the articles I studied, ordinary citations
      were used, esp.\ when page numbers were given in
      parenthetical cites. Thus, you can also use\\
      \verb+\cite[p.~25]{ex29}+: \cite[p.~25]{ex29}
\item \cite{ex30} \\ \cite{ex30}\\ \fullciteA{ex30}\\ \citeA{ex30}\\
      \EM Here, ``6th ed.'' comes before ``Vols.\ 1--20'', so it is
      Vols.\ 1--20 of the 6th edition. Pre-[2003/09/05] versions
      of \pkg{apacite} placed volumes before editions,
      which is appropriate when different volumes of a series
      are not updated jointly, so that you may have the 3rd edition
      of Vol.~2, but only the 1st edition of Vol.~6. Should you
      want this, you have to trick the system by putting both
      elements in the \fieldname{edition} field:
\begin{verbatim}
  edition = {\BVOLS\ 1--20, 6th},
\end{verbatim}
      and leaving the \fieldname{volume} field empty.\\
      \EM Does the remark about large editorial boards mean that the
      APA intended to add ``et al.\hbox{}'' here? Anyway, here is an
      example of such a situation: \citeA{ex30-2}.
\item \cite{ex31} \\ \cite{ex31}\\ \fullciteA{ex31}\\ \citeA{ex31}
\item \cite{ex32} \\ \cite{ex32}\\ \fullciteA{ex32}\\ \citeA{ex32}
\item \cite{ex33} \\ \cite{ex33}\\ \fullciteA{ex33}\\ \citeA{ex33}\\
      \EM This illustrates that a \fieldname{type} field can be used
      with a \entryname{book} entry.
\item[B-2] \cite{B-2} \\ \cite{B-2} \\ \fullciteA{B-2} \\ \citeA{B-2} \\
      \EM This is a suitable point to discuss ``von'' parts further.
      One of the editors in the current example is called
      P. van den Broek. I am Dutch and I recognize this as a Dutch
      name, so let's assume that this person is Dutch. Let us now
      consider the situation that this person is the (only) author.
      Then according to the Dutch rules, this person would be listed in the
      reference list as ``Broek, P. van den. (1992)'' and listed under ``B'',
      but referred to in the text as ``Van den Broek (1992)'', including
      the ``von'' part and capitalizing the first letter. When an
      initial precedes the ``von'' part (e.g., when there are two
      primary authors with this surname, but with different initials),
      then this person would be referred to in the text as
      ``P. van den Broek (1992)'', including the ``von'' part, but now
      in lower case. The Dutch rules are very difficult to do right in
      \BibTeX{}/\LaTeX{} and they conflict with the rules for other
      languages, and presumably with the rules of the APA, which would
      require this person to be alphabetized under ``V'', at least.

      For the current editor position, there is no big problem with
      the APA rules. The ``von'' part can really be put in the ``von''
      part as recognized by \BibTeX{}, which I did, or it can be enclosed
      in braces, making the whole last name one part. Either will come
      out right and the editor will not be referred to in the text
      anyway. With styles that put the initials behind the surname,
      it will only work right when put in the ``von'' part. In the
      author position, however, things are different. Then this author
      could be formatted as
\begin{verbatim}
  author = {Van {\lowercase{D}}en Broek, P.},
\end{verbatim}
      where the \verb+{\lowercase{D}}+ construction is used to prevent
      \BibTeX{} from interpreting it as a ``von'' part, or
\begin{verbatim}
  author = {Van{\ }den{\ }Broek, P.},
  author = {{Van den Broek}, P.},
\end{verbatim}
      which in most situations gives the correct version according to the
      Dutch rules with the correct alphabetizing according to the APA
      rules. Only in situations when the initial would appear
      \emph{before} the surname (when there are other authors with the
      same surname or when using other styles), this would lead to
      unwanted results.

      If you really want to alphabetize according to the Dutch rules
      (which is \emph{not} APA in my interpretation), you can use the
      following trick. \fname{apacdoc.sty} defines a macro \cmd{\Dutchvon}
      with two arguments, which is equivalent to the \cmd{\bibreftext}
      macro discussed in ex.~17 above. That is, in the beginning
      of the document, it is defined as echoing its second argument,
      and just before the reference list, it is redefined to echo
      its first argument. Then define the author as
\begin{verbatim}
  author = {van den {\protect\Dutchvon{Broek}{Van den Broek}}, P.},
\end{verbatim}
      which, combined with the \pkg{apacite} formatting implies
      that in text, ``Van den Broek'' is used, whereas the author
      is alphabetized under ``B'' in the reference list, and listed
      as ``Broek, P. van den''. Of course, we could simply have
      used \cmd{\bibreftext} again, but that was used to cover a
      completely different situation, and I can easily imagine that
      when switching to another citation style, the former application
      (i.e., 1992/1993) must be kept, but the ``von'' part is handled
      differently, so that \cmd{\Dutchvon} must be redefined.
      Based on this example, users should be able to define their
      own tricks for similar peculiarities.

      Finally, note that in Belgium, where many people
      speak Dutch as well, it is customary to alphabetize under ``V''
      anyway (``Van Damme'').
\item \cite{ex34} \\ \cite{ex34}\\ \fullciteA{ex34}\\ \citeA{ex34}
\item \cite{ex35} \\ \cite{ex35}\\ \fullciteA{ex35}\\ \citeA{ex35}\\
      \EM The series title, volume number, and volume title are all
      put into the \fieldname{booktitle} field.
\item \cite{ex36} \\ \cite{ex36}\\ \fullciteA{ex36}\\ \citeA{ex36}\\
      \EM Again, the series title, volume number, and volume title are
      all put into the \fieldname{booktitle} field.\\
      \EM I had to use some tricks to get the Series and Volume Editors'
      descriptions right. The ``(Series Ed.\hbox{})'' is according to
      \BibTeX{} part of the last name of the first editor,
      and I used the \cmd{\bibeditortype} macro from
      \fname{apacdoc.sty} to get the volume editor right.
      See section~\ref{subsec:fields} for my interpretation of
      APA's usage of the term ``series''.
\item \cite{ex37} \\ \cite{ex37}\\ \fullciteA{ex37}\\ \citeA{ex37}\\
      \EM Note that ``Van'' in the first editor's surname is
      capitalized here, as in the APA manual. In the original Dutch,
      this would be in lower case.
\item \cite{ex38} \\ \cite{ex38}\\ \fullciteA{ex38}\\ \citeA{ex38}
\item \cite{ex39} \\ \cite{ex39}\\ \fullciteA{ex39}\\ \citeA{ex39}\\
      \EM Here, it is stated that the translator's name should be put
      after the editor's name when both are different, but in ex.~40,
      the translators are put after the title, before the editors.
      Apparently, if the book is a collection of works by one
      author(-group), edited and translated, then the translator
      should come after the editor, but if different chapters
      are translated by different translators, or perhaps not all
      are translated works, then the translator should come after
      the title. Of course, \pkg{apacite} has no way of knowing this.
      In the current implementation, for an \entryname{incollection},
      if the editor and translator are the same, they are formatted as
      in this example, whereas if they are different, they are treated
      as in ex.~40 below. I think this will be satisfactory in
      most cases. If you really want the translator after the editor
      when they are different, you can trick the system in a way
      similar to ex.~36.
\item \cite{ex40} \\ \cite{ex40}\\ \fullciteA{ex40}\\ \citeA{ex40}\\
      \EM See my comments to ex.~39 above.

      A test of the \fieldname{originaljournal} formatting:
      \citeA{ex40-t1}.
\item[C-1] \cite{C-1}  \\ \cite{C-1} \\ \fullciteA{C-1} \\ \citeA{C-1}\\
      \EM The APA manual initially formats the number with an
      en-dash: ``91--5''. When it discusses the number separately,
      however (p.~256), it uses a single hyphen: ``91-5''. Logically,
      the latter makes more sense to me (and is generally used in
      other numbers in the APA manual as well), so that's what I
      did here. Moreover, if the en-dash would be entered as
      ``\verb+--+'' in the \fieldname{number} field, \pkg{apacite}
      would interpret this as ``to'' and insert ``Nos.\hbox{}''
      instead of ``No.\hbox{}''. Thus, if you want the en-dash,
      you have to put this in the \fname{.bib} file in a different
      way, e.g., using the \cmd{\textendash} command.
\item \cite{ex41} \\ \cite{ex41}\\ \fullciteA{ex41}\\ \citeA{ex41}
\item \cite{ex42} \\ \cite{ex42}\\ \fullciteA{ex42}\\ \citeA{ex42}\\
      \EM I used the \cmd{\bibnotype} command to suppress the default
      ``(Tech.\ Rep.\hbox{})'' description. Actually, I don't think
      there is anything wrong with calling a report a report, be it
      ``technical'' by default, or by specifying
\begin{verbatim}
  type = {Report},
\end{verbatim}
      except that it's not done so in this specific example in the
      APA manual. But there does not seem to be a rule against it.

      \EM The NTIS information is put in a \fieldname{note} field.
\item \cite{ex43} \\ \cite{ex43}\\ \fullciteA{ex43}\\ \citeA{ex43}\\
      \EM The ERIC number is given in the \fieldname{note} field.
\item \cite{ex44} \\ \cite{ex44}\\ \fullciteA{ex44}\\ \citeA{ex44}
\item \cite{ex45} \\ \cite{ex45}\\ \fullciteA{ex45}\\ \citeA{ex45}
\item \cite{ex46} \\ \cite{ex46}\\ \fullciteA{ex46}\\ \citeA{ex46}\\
      \EM Note that in the example in the APA manual, ``Western Australia''
      \emph{is} mentioned in the publisher location, whereas their rule
      explicitly states that this should not be the case in this
      situation, and they stress that again below the example.
      Therefore, I did not mention ``Western Australia'' in the
      \fieldname{publisher} field.
\item \cite{ex47} \\ \cite{ex47}\\ \fullciteA{ex47}\\ \citeA{ex47}
\item \cite{ex48} \\ \cite{ex48}\\ \fullciteA{ex48}\\ \citeA{ex48}
\item \cite{ex49} \\ \cite{ex49}\\ \fullciteA{ex49}\\ \citeA{ex49}
\item \cite{ex50} \\ \cite{ex50}\\ \fullciteA{ex50}\\ \citeA{ex50}
\item \cite{ex51} \\ \cite{ex51}\\ \fullciteA{ex51}\\ \citeA{ex51}\\
      \EM As of this version of \pkg{apacite}, the location of a
      \entryname{lecture} can be given in the \fieldname{address}
      field.
\item \cite{ex52} \\ \cite{ex52}\\ \fullciteA{ex52}\\ \citeA{ex52}
\item \cite{ex53} \\ \cite{ex53}\\ \fullciteA{ex53}\\ \citeA{ex53}
\item \cite{ex54} \\ \cite{ex54}\\ \fullciteA{ex54}\\ \citeA{ex54}
\item \cite{ex55} \\ \cite{ex55}\\ \fullciteA{ex55}\\ \citeA{ex55}\\
      \EM It seems logical to suppress the original year in the
      citation if it's the same as the year of the abstract, cf.\
      the comment to ex.~17 in the APA manual (5th ed., p.~245).

      \EM According to example 54 and the text below it, an ``A''
      or ``B'' should be added to the volume number of \emph{DAI}
      of this entry, presumably an ``A'', but because they did not
      give one, I left it out as well.
\item \cite{ex56} \\ \cite{ex56}\\ \fullciteA{ex56}\\ \citeA{ex56}
\item \cite{ex57} \\ \cite{ex57}\\ \fullciteA{ex57}\\ \citeA{ex57}\\
      \EM In ex.~59, the city should not be mentioned because it is
      already mentioned in the name of the university. Here, the
      city \emph{is} mentioned again, which seems contradictory.
      This is all in the \fname{.bib} file; \pkg{apacite} uses
      whatever is given there, so this is not a formatting problem
      for \pkg{apacite} itself.
\item \cite{ex58} \\ \cite{ex58}\\ \fullciteA{ex58}\\ \citeA{ex58}
\item \cite{ex59} \\ \cite{ex59}\\ \fullciteA{ex59}\\ \citeA{ex59}\\
      \EM See ex.~57 for the city issue.
\item \cite{ex60} \\ \cite{ex60}\\ \fullciteA{ex60}\\ \citeA{ex60}
\item \cite{ex61} \\ \cite{ex61}\\ \fullciteA{ex61}\\ \citeA{ex61}\\
      \EM The description of the data goes into the
      \fieldname{type} field. It may be more logical to put it
      in the \fieldname{title} field, with some trickery to indicate
      that it's a description and not a title, but putting it in the
      \fieldname{type} field already ensures that it's formatted
      correctly, so I think I'm gonna be lazy on this one. The same
      applies more or less to reviews (G-1, 63, 64), although there
      it is logical to put at least ``Review'' in the \fieldname{type}
      field, so as we're already there, we might as well make it
      complete.
\item \cite{ex62} \\ \cite{ex62}\\ \fullciteA{ex62}\\ \citeA{ex62}\\
      \EM ``Available from'' an address should be spelled out in the
      \fieldname{note} field, to get the parentheses. ``Available
      from'' a website is without parentheses, see ex.~95.
\item[G-1] \cite{G-1}  \\ \cite{G-1} \\ \fullciteA{G-1} \\ \citeA{G-1}\\
      \EM See my comments to ex.~61 above about the logic of the
      \fieldname{type} field. For a review, the \fieldname{type}
      field must contain the message that it is a review of a
      \emph{book} (or motion picture, or whatever it is a review of)
      and give the title of the reviewed work in italics, which must
      be manually formatted, e.g., by using the \cmd{\APACcitebtitle}
      macro. The author of the reviewed work should apparently not be
      mentioned.
\item \cite{ex63} \\ \cite{ex63}\\ \fullciteA{ex63}\\ \citeA{ex63}
\item \cite{ex64} \\ \cite{ex64}\\ \fullciteA{ex64}\\ \citeA{ex64} \\
      \EM Here, the title of the motion picture,
      \APACcitebtitle{Discovering Psychology}, is capitalized,
      whereas this was not done with book titles in ex.~G-1 and 63.
      I don't know whether this is an error or an implicit rule,
      but this formatting must be done in the \fname{.bib} file,
      so it's up to the user to do this as desired.
\item \EM The rules for movies, television series, etc.\ do not appeal
      very much to me, although they are not nearly as bad as those
      for music recordings (ex.~69 and further, see below). My
      primary objection is that when referring to movies and TV series,
      the title is the most important characteristic. The director
      may be a good second in some cases, but producers and writers are
      almost always unknown to the general public and not relevant
      when referring to them. You talk about the movie \emph{Jaws}
      and not about Spielberg (1975) or whoever wrote the script.
      Recognizing the primary creative input or authorship may be
      politically correct, but not particularly informative.
      However, you may think that my objections are mainly
      driven by the difficulties of trying to format the entries
      in \BibTeX{}. Anyway, here are my attempts to implement
      the APA rules.\\
      \cite{ex65-1} \\ \cite{ex65-1}\\ \fullciteA{ex65-1}\\ \citeA{ex65-1} \\
      \EM I find ``United States'' a somewhat uninformative address.

      \cite{ex65-2} \\ \cite{ex65-2}\\ \fullciteA{ex65-2}\\ \citeA{ex65-2} \\
      \EM Note again that this and the following ``Available from''
      must be between
      parentheses (accomplished by putting it in the \fieldname{note} field),
      whereas ``Available from'' some web site must not be between
      parentheses, cf.\ ex.~95.

      \EM In these examples, I used the \cmd{\bibliteral},
      \cmd{\bibskipbracenodot}, and  \cmd{\indexskipbracenodot} commands
      from \fname{apacdoc.sty}.\\
      \cite{ex65-3} \\ \cite{ex65-3}\\ \fullciteA{ex65-3}\\ \citeA{ex65-3}\\
      \EM Here, I simply let ``(Producer)'' be part of the author name,
      but because of this addendum, the entry is not sorted correctly
      in the reference list: It should be before \citeA{APAManual6},
      but because of the addendum, the authors are different to \BibTeX{}
      and this one comes after \citeA{APAManual6}. The ordering can be
      corrected by using the \cmd{\APACSortNoop} command as discussed in
      section~\ref{subsec:sort}. However, the authors of these entries will
      still be different. If it's important that they are the same (e.g.,
      for the author index), the \fname{.bbl} file should be edited manually.
      This seems an extremely rare event, though.
\item \cite{ex66} \\ \cite{ex66}\\ \fullciteA{ex66}\\ \citeA{ex66} \\
      \EM Here, I used the same tricks as in ex.~65.
\item \cite{ex67} \\ \cite{ex67}\\ \fullciteA{ex67}\\ \citeA{ex67} \\
      \EM I used several tricks introduced before: the \cmd{\bibeditortype}
      (cf.\ ex.~36) construction to be able to use ``(Producer)'' in
      the editor position instead of  ``(Ed.\hbox{})'', and the ones used
      in the previous examples. Because there is another Miller as well,
      the initial is given here. To make sure that \BibTeX{} thinks
      that there is only one initial, but the ``(Producer)'' is formatted
      correctly, the name is defined as follows:
\begin{verbatim}
  editor = {Miller, {\bibinitial{R\bibeditortype{Producer}}}},
\end{verbatim}
      using the \cmd{\bibinitial} and \cmd{\bibeditortype} commands from
      \fname{apacdoc.sty}.
      It is then formatted correctly both in the text and in the reference
      list if \cmd{\bibeditortype} is defined to swallow its argument
      in the text, and redefined prior to the bibliography. After the
      bibliography (before the index), it has to be redefined again
      to swallow its argument.
\item \cite{ex68} \\ \cite{ex68}\\ \fullciteA{ex68}\\ \citeA{ex68}\\
      \EM Again, I used several tricks that were also used in the previous
      examples.
\item \EM The rules for music recordings do not make any sense, and they
      are not entirely clear as well. It would seem to me that
      most pop, rock, and other ``light'' music songs are almost always
      attributed to the performing artist. You can usually read who the
      composer and lyricist of the song are on the inlay-details
      of the CD, but if you want the reader to refer to ``My Way'',
      the reader will easier find it (in a CD store or on the
      internet, for example) under ``Frank Sinatra'' than under
      the composer's name (whoever that may be). Furthermore, the
      year of release of the CD (or other medium) seems more relevant
      in referring to the CD than the year of copyright of the
      specific song, or the recording date.

      For classical music, things are different. Then, the writer (composer)
      is often more important than the performing artist, although
      the percentage of people who know who wrote the lyrics for
      Mozart's operas may not be high. Furthermore, it may be
      time-consuming and not very relevant for most authors and
      readers to find the year in which a certain piece was written,
      although strictly speaking, we should use the ``date of copyright'',
      which is not relevant for a lot of classical music.

      However, when referring to Beethoven's 9th symphony, say, it will
      typically not be very informative to refer to a specific recording on a
      specific CD, unless that specific recording is the subject of interest,
      but then it would seem that the ``performing artist'' (conductor or
      orchestra) should take the role of ``author''. For example, when
      comparing a performance of this symphony conducted in 1975 by Masur with
      a performance of this symphony conducted in 1990 by Bernstein (assuming
      this exists), it does not seem logical to compare ``9th Symphony''
      (Beethoven, 1823a, tracks~1--4) with ``9th Symphony'' (Beethoven, 1823b,
      tracks~1--4), but more logical to compare Masur (1975) with
      Bernstein (1990).

      Finally, it seems a bit strange that the track number should be
      mentioned in text, but not in the reference list.

      Again, you may think that my objections are mainly
      driven by the difficulties of trying to format the entries
      in \BibTeX. Nevertheless, here are my attempts to implement
      the APA rules, using variations of the \cmd{\citesong}
      command, defined in \fname{apacdoc.sty}:\\
      \begin{tabular}{ll}
      \cmd{\citeAsong}:  & \citeAsong{ex69-1} \\
      \cmd{\citesong}:   & \citesong{ex69-1}  \\
      \cmd{\citesongNP}: & \citesongNP{ex69-1}\\
      \cmd{\citeAsong}:  & \citeAsong{ex69-2} \\
      \cmd{\citesong}:   & \citesong{ex69-2}  \\
      \cmd{\citesongNP}: & \citesongNP{ex69-2}
      \end{tabular}\\
      \EM The \fieldname{key} field contains the relevant
      information in the form of a protected \cmd{\bibsong} command:
\begin{verbatim}
  key = {{\protect\bibsong{author}{year}{song title}{track info}}},
\end{verbatim}
      Furthermore, I used some tricks to get the reference list
      entry right. I used the \entryname{incollection} type as
      a basis, with the CD title in the \fieldname{booktitle} field.
      At first sight, it seems natural to define
\begin{verbatim}
  type = {CD},
\end{verbatim}
      but with an \entryname{incollection}, the \fieldname{type}
      field is put after the title, not after the book title.
      I may change this for music-types (CD, record, etc.),
      but this is currently not yet implemented. This means that the
      ``[CD]'' description must be put in the \fieldname{booktitle}
      field, after the CD title and with explicit formatting
      commands:
\begin{verbatim}
  booktitle = {Arkansas Traveler {\upshape[\uppercase{CD}]}},
\end{verbatim}
      On the other hand, we can now use the \fieldname{type}
      field to put the recording artists in for the second example:
\begin{verbatim}
  type = {Recorded by G. Bok, A. Mayo, \& E. Trickett},
\end{verbatim}
      We have to change the ``In'' string to ``On''
      (``In'' a book versus ``On'' a CD). This is done with a
      macro similar to the \cmd{\bibeditortype} macro discussed
      in ex.~36. In this case, the macro is \cmd{\bibInstring},
      defined in \fname{apacdoc.sty},
      which has one argument. The macro changes the definition of
      the macro \cmd{\BIn} to the argument and then immediately changes
      the definition back to the old definition. So it makes a one-time
      change. Of course, the \cmd{\bibInstring} macro only works
      if it is executed \emph{before} the \cmd{\BIn} macro. The latter
      macro comes before the \fieldname{booktitle}, so
      \cmd{\bibInstring} must be added to a field that comes before
      that. I put it in the \fieldname{title} field:
\begin{verbatim}
  title = {Over the Waterfall{\bibInstring{\BOn}}},
\end{verbatim}
      where \cmd{\BOn} is defined by default as ``\BOn''.
      Finally, the recording date of the second example (1990) must
      be put in the \fieldname{note} field.

      If you want an author index, you would want the authors of
      these works in the index as well. Because of the usage of the
      \fieldname{key} field, this is not automatically done for the
      citations. The \cmd{\AX} command has to be inserted explicitly,
      see section~\ref{sec:autindex} above.

      Note that this is all trickery within the \LaTeX{} domain
      and the \fname{.bib} file, i.e., the user-definable and
      user-customizable area.
\item \cite{ex70} \\ \cite{ex70}\\ \fullciteA{ex70}\\ \citeA{ex70}
\item \cite{ex71-1} \\ \cite{ex71-1}\\ \fullciteA{ex71-1}\\ \citeA{ex71-1} \\
      \cite{ex71-2} \\ \cite{ex71-2}\\ \fullciteA{ex71-2}\\ \citeA{ex71-2} \\
      \EM In contrast with earlier versions of \pkg{apacite}, in which
      the ``Retrieved \dots'' message had to be formatted in the
      \fieldname{howpublished} field, this is now formatted
      automatically by using the \fieldname{url} and
      \fieldname{lastchecked} fields.
\item \cite{ex72} \\ \cite{ex72}\\ \fullciteA{ex72}\\ \citeA{ex72}
\item \cite{ex73} \\ \cite{ex73}\\ \fullciteA{ex73}\\ \citeA{ex73} \\
      \EM Note that the APA manual breaks a line \emph{after} a
      period instead of before, against their own rules. Furthermore,
      the APA manual uses a typeface in which `1' (one) and `l' (ell)
      are not distinguishable. This requires some guessing of the
      correct URLs. I think that this conflicts with their own stress
      on accuracy w.r.t.\ URLs.

      \EM Note the subtle use of braces to get \emph{Homo sapiens}
      correctly formatted: The capital in \verb+\emph{Homo}+
      is retained by \BibTeX, whereas the capital in
      \verb+{\emph{Sapiens}}+ is changed into a lower case letter
      by \BibTeX, because of the extra pair of braces.
\item \cite{ex74} \\ \cite{ex74}\\ \fullciteA{ex74}\\ \citeA{ex74}
\item \cite{ex75} \\ \cite{ex75}\\ \fullciteA{ex75}\\ \citeA{ex75}\\
      \EM Note that \BibTeX{} does not consider a question mark
      or an exclamation point as the end of the title and the beginning
      of the subtitle. Hence, if there is a subtitle after it, the
      capitalization of its first word is not retained (unlike
      after a colon), so we have to protect it using braces in the
      \fname{.bib} file.
\item \cite{ex76} \\ \cite{ex76}\\ \fullciteA{ex76}\\ \citeA{ex76}
\item \cite{ex77} \\ \cite{ex77}\\ \fullciteA{ex77}\\ \citeA{ex77}
\item \cite{ex78} \\ \cite{ex78}\\ \fullciteA{ex78}\\ \citeA{ex78}\\
      \EM For this example, the source is not simply the URL, but
      with the qualification ``Columbia University, Institute for
      Learning Technologies Web site:''. This means that we cannot
      simply use the \fieldname{lastchecked} and \fieldname{url}
      fields, but must revert to the way I proposed to format
      references to electronic sources in previous versions of
      \pkg{apacite}: by putting all the information in a
      \fieldname{howpublished} field. This includes explicitly using
      the \cmd{\url} command and adding ``\verb+\bibnodot{.}+''
      immediately after the URL. The \cmd{\bibnodot} command,
      defined in \fname{apacdoc.sty}, swallows the period, so that
      there is no period after the URL in the reference list, thus
      complying with the APA rules. This also applies to examples
      79, 87, 91, and 95, and all the examples that do not list
      a specific URL, but only a description, like
      ``the PsycARTICLES database'' (ex.~88).
\item \cite{ex79} \\ \cite{ex79}\\ \fullciteA{ex79}\\ \citeA{ex79}
\item \cite{ex80} \\ \cite{ex80}\\ \fullciteA{ex80}\\ \citeA{ex80}
\item \cite{ex81} \\ \cite{ex81}\\ \fullciteA{ex81}\\ \citeA{ex81}
\item \cite{ex82} \\ \cite{ex82}\\ \fullciteA{ex82}\\ \citeA{ex82}\\
      \EM Here and in ex.~83, I used the \cmd{\BAbstractRetrieved}
      and \cmd{\BmakeAbstractRetrieved} commands defined in
      \fname{apacdoc.sty} to replace ``Retrieved'' by
      ``Abstract retrieved''.
\item \cite{ex83} \\ \cite{ex83}\\ \fullciteA{ex83}\\ \citeA{ex83} \\
\item \cite{ex84} \\ \cite{ex84}\\ \fullciteA{ex84}\\ \citeA{ex84}
\item \cite{ex85} \\ \cite{ex85}\\ \fullciteA{ex85}\\ \citeA{ex85} \\
      \EM When referring to a message to a newsgroup, internet forum, etc.,
      use the \entryname{misc} type. Then define
\begin{verbatim}
  type = {\bibmessage},
\end{verbatim}
      and use the \fieldname{number} field when relevant. The URL
      of the message is given in the \fieldname{url} field.  Then
      the entry is formatted
      correctly: If the message has a number, say 1, it reverts to
      ``\verb+[\bibmessage~1]+'', i.e., ``[Msg~1]'' with the default
      definition of \cmd{\bibmessage}. If there is no number, the
      type identifier is omitted (because it is mentioned as
      ``Message posted to [\dots]'' anyway). In both cases,
      the title is formatted as an article title, i.e., not
      italicized.
\item \cite{ex86} \\ \cite{ex86}\\ \fullciteA{ex86}\\ \citeA{ex86}
\item \cite{ex87} \\ \cite{ex87}\\ \fullciteA{ex87}\\ \citeA{ex87}
\item \cite{ex88} \\ \cite{ex88}\\ \fullciteA{ex88}\\ \citeA{ex88}
\item \cite{ex89} \\ \cite{ex89}\\ \fullciteA{ex89}\\ \citeA{ex89}
\item \cite{ex90} \\ \cite{ex90}\\ \fullciteA{ex90}\\ \citeA{ex90} \\
      \EM Here, ``de Ridder'' may well be a Dutch name. If the APA
      manual is serious about its rule to format names as they
      should according to the rule of the country of origin,
      this name should then be formatted as ``De Ridder''.
\item \cite{ex91} \\ \cite{ex91}\\ \fullciteA{ex91}\\ \citeA{ex91}
\item \cite{ex92} \\ \cite{ex92}\\ \fullciteA{ex92}\\ \citeA{ex92}\\
      \EM From ex.~94 below, I deduce that the version information
      should be treated as an edition and not as part of the title.
      Therefore, in this example and ex.~94, the version is formatted
      in the \fieldname{edition} field:
\begin{verbatim}
  edition = {Version~4.0\noedition\ignorespaces},
\end{verbatim}
      using the \cmd{\noedition} command from \fname{apacdoc.sty},
      which temporarily redefines \cmd{\BEd} to do nothing, and
      \cmd{\ignorespaces}, which eats up the space that is ordinarily
      present between the edition number and the ``ed.\hbox{}'' string.
\item \cite{ex93} \\ \cite{ex93}\\ \fullciteA{ex93}\\ \citeA{ex93}\\
      \EM To test the \entryname{manual} entry: \citeA{ex93-t1}.
\item \cite{ex94} \\ \cite{ex94}\\ \fullciteA{ex94}\\ \citeA{ex94}\\
      \EM The example in the APA manual does not list a date, not even
      a ``n.d.\hbox{}''. Given the logic of the APA manual, this seems
      an error to me, so I added a ``\cmd{\bibnodate}'' in the
      \fieldname{year} field, which becomes ``\bibnodate'' in the
      output. If it would really be the rule to omit the year, then
      it is not clear when a year must be omitted and when not, or
      replaced by ``n.d.\hbox{}''. Furthermore, formatting in both
      the \fname{.sty} file and the \fname{.bst} file would have to
      be adapted to anticipate a missing year. Currently, I assume
      that there should always be something that acts like a date
      (a year, an ``in press'', or a ``n.d.\hbox{}'').

      \EM See ex.~92 for the treatment of the version.
\item \cite{ex95} \\ \cite{ex95}\\ \fullciteA{ex95}\\ \citeA{ex95}\\
      \EM Note that here, unlike ex.~44 and ex.~91,
      ``U.S.'' is omitted before ``Department of Health and Human
      Services''.
\end{enumerate}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\StopEventually{%
\MakePercentComment
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Change History
\PrintChanges
%
% Redefine commands that should be different in the bibliography.
\APACmanBeforeBib
%
% Request apacite or apacitex bibliography style
% depending on whether an index option was requested or not.
\bibliographystyle{\APACbibstyle}%
% Include the bibliography
\bibliography{apa5ex}%
%
% Again redefine commands.
\APACmanBeforeIndex
%
% Include the author index if the index option is on.
\printindex[autx]
%
% Again redefine commands.
\APACmanAfterIndex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\PrintIndex
\MakePercentIgnore
}
%
\MakePercentIgnore
% \iffalse
%</dtx>
% \fi
%
% \clearpage
% \APACcodePageLayout
% \section{Implementation}
% The following sections describe the source code of the various
% constituent parts of \pkg{apacite}.
%
%
% \section{\LaTeX\ package (\fname{apacite.sty})}
% This is the \LaTeX\ package part of \pkg{apacite}. We start with some
% comments at the top of the package to recognize borrowed code.
%
%    \begin{macrocode}
%<*package>
%%
%% apacite.sty : citation and reference list according to APA manual
%% Written by Erik Meijer
%%
%% Contains code adapted from
%%   index.sty [1995/09/28 v4.1beta Improved index support (dmj)],
%%   hyperref.dtx [6.71, 2000/10/04],
%%   babel.def [2001/03/01, v3.7h],
%%   backref.dtx [1.20, 2002/06/09],
%%   ltbibl.dtx [2004/02/15 v1.1q LaTeX Kernel (Bibliography)],
%%   bibtopic.dtx [2002/08/22 v1.0k],
%%   multibib.dtx [2004/01/28 v1.3 Multiple bibliographies for one document.],
%%   multibbl.dtx [2004/07/27 v1.1],
%%   amsrefs.dtx [2004/06/30 v2.0]
%%   ltidxglo.dtx [1996/01/20 v1.1e LaTeX Kernel (Index and Glossary)]
%%   doc.dtx [2004/02/09 v2.1b Standard LaTeX documentation package (FMi)]
%% and code (used with permission) provided by:
%%   Stefan Bj\"ork.
%%
%    \end{macrocode}
%
% \subsection{Options}
%
% ^^A There does not appear to be a \cmd{\DescribeOption} command.
%
% \subsubsection{Backwards compatibility}
%
% \begin{macro}{\@year@}
% The \pkg{theapa} package used the \cmd{\BCAY} command where \pkg{newapa}
% used \cmd{\citeauthoryear} for the same purpose. Because the first version
% of \pkg{apacite} descended from \pkg{theapa}, it used \cmd{\BCAY} as well.
% However, \pkg{natbib} does not recognize \cmd{\BCAY}, but it does
% recognize \cmd{\citeauthoryear}. Therefore, since
% \APACversiondate{2003/09/05}, \pkg{apacite} uses \cmd{\citeauthoryear}.
% Unfortunately, the construction below can only be defined for one of them.
% Therefore, this is a backwards compatibility option.
%    \begin{macrocode}
\def\@year@\citeauthoryear#1#2#3{#3} % default
\DeclareOption{BCAY}{% compatibility with old .bbl files
   \def\@year@\BCAY#1#2#3{#3}%
}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Citation}
%
% \begin{macro}{\if@APAC@classic@cite}
% \begin{macro}{\if@APAC@natbib@emu}
% \begin{macro}{\if@APAC@natbib@apa}
% \begin{macro}{\if@APAC@classic@or@emu}
% \begin{macro}{\if@APAC@any@natbib}
% \begin{macro}{\if@APAC@anycitation}
% Allow different sets of citation commands through different options,
% implemented through |\if| commands that enable and disable the relevant
% parts of the code. \pkgoption{apaciteclassic} is the default, but this
% may change in the future.
%    \begin{macrocode}
\newif\if@APAC@classic@cite
\newif\if@APAC@natbib@emu
\newif\if@APAC@natbib@apa
\newif\if@APAC@classic@or@emu
\newif\if@APAC@any@natbib
\newif\if@APAC@anycitation
\DeclareOption{apaciteclassic}{%
  \@APAC@classic@citetrue
  \@APAC@natbib@emufalse
  \@APAC@natbib@apafalse
  \@APAC@classic@or@emutrue
  \@APAC@any@natbibfalse
  \@APAC@anycitationtrue
}
\DeclareOption{natbibemu}{%
  \@APAC@classic@citefalse
  \@APAC@natbib@emutrue
  \@APAC@natbib@apafalse
  \@APAC@classic@or@emutrue
  \@APAC@any@natbibtrue
  \@APAC@anycitationtrue
}
\DeclareOption{natbibapa}{%
  \@APAC@classic@citefalse
  \@APAC@natbib@emufalse
  \@APAC@natbib@apatrue
  \@APAC@classic@or@emufalse
  \@APAC@any@natbibtrue
  \@APAC@anycitationtrue
}
\DeclareOption{nocitation}{%
  \@APAC@classic@citefalse
  \@APAC@natbib@emufalse
  \@APAC@natbib@apafalse
  \@APAC@classic@or@emufalse
  \@APAC@any@natbibfalse
  \@APAC@anycitationfalse
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% The \pkgoption{mask} option masks citations that are flagged as
% self-citations with the |\mask|-citation commands. The
% \pkgoption{unmask} option (default) ignores the masking.
%
%    \begin{macrocode}
\newif\if@APAC@mask
\DeclareOption{mask}{\@APAC@masktrue}
\DeclareOption{unmask}{\@APAC@maskfalse}
%    \end{macrocode}
%
% \subsubsection{Bibliography}
%
% Various options for changing the formatting of the reference list. Most of
%% ^^A \cmd{\if} somehow gives an error
% these are implemented through |\if| commands, deferring the actual
% implementation.
% \begin{macro}{\if@numberedbib}
% Should the bibliography section or chapter be numbered?
%    \begin{macrocode}
\newif\if@numberedbib
%    \end{macrocode}
% \end{macro}
% The bibliography is a section or chapter with a number (e.g.,
% section~6 or chapter~10). This does not work properly when the section or
% chapter is in the backmatter.
%    \begin{macrocode}
\DeclareOption{numberedbib}{\@numberedbibtrue}
%    \end{macrocode}
% The bibliography is a section or chapter without a number (i.e.,
% a section* or chapter*). This is the default.
%    \begin{macrocode}
\DeclareOption{unnumberedbib}{\@numberedbibfalse}
%    \end{macrocode}
% The next options determine whether the bibliography should be a section or
% a chapter.
% \begin{macro}{\if@sectionbib}
% \begin{macro}{\if@sectionbibdefault}
% With the \pkgoption{sectionbib} option, the bibliography is a section. This
% is typically used with the \pkg{chapterbib} package; then each chapter has a
% bibliography section. The \pkgoption{nosectionbib} option makes the
% bibliography a chapter (if chapters are defined). If none of these options
% are requested, \pkg{apacite} tries to guess the most logical choice. The
% bibliography is a section if chapters are not defined or if we are in the
% ``mainmatter'' of a document. Otherwise, i.e., in the ``backmatter'' of a
% document that has chapters, it is a chapter. |\if@sectionbibdefault|
% registers whether the default should be used (neither
% \pkgoption{sectionbib} nor \pkgoption{nosectionbib} chosen) and if
% the default is not used, |\if@sectionbib| registers which option was
% chosen.
%    \begin{macrocode}
\newif\if@sectionbib
\newif\if@sectionbibdefault
\@sectionbibfalse
\@sectionbibdefaulttrue
\DeclareOption{sectionbib}{%
  \@sectionbibdefaultfalse
  \@sectionbibtrue
}
\DeclareOption{nosectionbib}{%
  \@sectionbibdefaultfalse
  \@sectionbibfalse
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\if@tocbib}
% These options determine whether the bibliography should be in the table of
% contents.
%    \begin{macrocode}
\newif\if@tocbib
%    \end{macrocode}
% The bibliography in the table of contents, even if it's unnumbered. This is
% the default.
%    \begin{macrocode}
\DeclareOption{tocbib}{\@tocbibtrue}
%    \end{macrocode}
% The bibliography not in the table of contents if it's unnumbered. This is
% ignored if it's numbered.
%    \begin{macrocode}
\DeclareOption{notocbib}{\@tocbibfalse}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@bibnewpage}
% Start the bibliography on a new page? This is ignored if it's a chapter.
%    \begin{macrocode}
\DeclareOption{bibnewpage}{\def\@bibnewpage{\bibnewpage}}
\DeclareOption{nobibnewpage}{\let\@bibnewpage\relax}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@doi}
% Should DOI information be printed in the reference list?
%    \begin{macrocode}
\newif\if@doi
\DeclareOption{doi}{\@doitrue}
\DeclareOption{nodoi}{\@doifalse}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Author indexing}
%
% \begin{macro}{\if@APAC@index}
% No author index.
%% ^^A \cmd{\if} somehow gives an error
% The |\if| is necessary because packages can not be required here, so
% we must handle the consequences of the \pkgoption{index} and
% \pkgoption{noindex} options later.
%    \begin{macrocode}
\newif\if@APAC@index
\DeclareOption{noindex}{\@APAC@indexfalse}%
%    \end{macrocode}
% \end{macro}
%
% Request author index.
%    \begin{macrocode}
\DeclareOption{index}{\@APAC@indextrue}%
%    \end{macrocode}
%
% \begin{macro}{\if@APAC@include@corporate}
% Include corporate authors in index?
%% ^^A \cmd{\if} somehow gives an error
% Use an |\if| here, the real definitions are handled within the index
% options.
%    \begin{macrocode}
\newif\if@APAC@include@corporate
\DeclareOption{includecorporate}{\@APAC@include@corporatetrue}%
\DeclareOption{suppresscorporate}{\@APAC@include@corporatefalse}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@APAC@index@package}
% Use \pkg{index} package or standard \LaTeX\ index? Again, we only define the
% boolean.
%    \begin{macrocode}
\newif\if@APAC@index@package
\DeclareOption{indexpackage}{\@APAC@index@packagetrue}%
\DeclareOption{noindexpackage}{\@APAC@index@packagefalse}%
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{index}
% Some options for changing the \envirname{index} environment. The actual
% definitions are done through macros below; here these macros are used.
%
% The first option uses the definition from the \pkg{index} package
% |[1995/09/28 v4.1beta Improved index support (dmj)]|,
% which is the same code as in |(v3.02, 15 September 1993)|,
% i.e., without table of contents entry.
%    \begin{macrocode}
\DeclareOption{stdindex}{%
  \ExecuteOptions{index}%         Request author index
  \ExecuteOptions{indexpackage}%  This option requires the index package
  \AtEndOfPackage{\APACstdindex}% index environment as in index package
}%
%    \end{macrocode}
% The next option adds a table of contents entry to the standard index.
%    \begin{macrocode}
\DeclareOption{tocindex}{%
  \ExecuteOptions{index}%         Request author index
  \ExecuteOptions{indexpackage}%  This option requires the index package
  \AtEndOfPackage{\APACtocindex}% index environment as in index package
                               %% with toc entry added
}%
%    \end{macrocode}
% This option defines my (EM) own favorite index style. Maybe you like it too.
%    \begin{macrocode}
\DeclareOption{emindex}{%
  \ExecuteOptions{index}%         Request author index
  \ExecuteOptions{indexpackage}%  This option requires the index package
  \AtEndOfPackage{\APACemindex}%  EM's index environment (see below)
}%
%    \end{macrocode}
% The next option is a variation on the \pkgoption{emindex} option, but uses
% standard \LaTeX\ code (adapted from the \pkg{ltxdoc} class) instead of the
% the \pkg{index} package to support multiple indexes.
%    \begin{macrocode}
\DeclareOption{ltxemindex}{%
  \ExecuteOptions{index}%           Request author index
  \ExecuteOptions{noindexpackage}%  Don't use the index package
  \AtEndOfPackage{\APACltxemindex}% EM's index environment without the index
                                 %% package (see below)
}
%    \end{macrocode}
% \end{environment}
%
% \subsubsection{Obsolete compatibility options}
%
% For compatibility with older versions of \pkg{apacite}.
%    \begin{macrocode}
\DeclareOption{hyper}{%
  \PackageWarningNoLine{apacite}{Obsolete option `hyper' ignored}%
}
\DeclareOption{nohyper}{%
  \PackageWarningNoLine{apacite}{Obsolete option `nohyper' ignored}%
}
\DeclareOption{accentfix}{%
  \PackageWarningNoLine{apacite}{Obsolete option `accentfix' ignored}%
}
\DeclareOption{noaccentfix}{%
  \PackageWarningNoLine{apacite}{Obsolete option `noaccentfix' ignored}%
}
%    \end{macrocode}
%
% \subsection{Option processing}
%
% Execute default options.
%    \begin{macrocode}
\ExecuteOptions{apaciteclassic,noindex,indexpackage,unnumberedbib,tocbib,%
                nobibnewpage,suppresscorporate,doi,unmask}
%    \end{macrocode}
% Execute user-requested options.
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
%
% \subsection{Citation commands}
%
% \begin{macro}{\citeauthoryear}
% The \cmd{\citeauthoryear} command is defined within the citation commands,
% but some packages (\pkg{splitbib}, \pkg{bibentry}) choke if it has not
% been defined. Therefore, we start with defining it to do nothing. However,
% \pkg{natbib} defines this with a \cmd{\newcommand}, so if \pkg{natbib} is
% loaded after \pkg{apacite}, defining it here would give an error. Therefore,
% we postpone this to |\begin{document}| and only initialize it then if it
% hasn't been defined before.
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifundefined{citeauthoryear}{\def\citeauthoryear#1#2#3{}}{}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\themaskedRefs}
% A counter for the number of masked citations, which should be
% defined for all the citation options.
% This construction ensures that there is no conflict if the
% |maskedRefs| counter has already been defined (in \fname{apa6.cls}).
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifundefined{themaskedRefs}{\newcounter{maskedRefs}}{}}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Shared code between the \pkgoption{apaciteclassic} and
% \pkgoption{natbibemu} options}
%
% Define a few |\if|s outside the main |\if|, because \TeX{} otherwise
% chokes.
% \begin{macro}{\if@F@cite}
% First citation in a multi-citation.
%    \begin{macrocode}
\newif\if@F@cite\@F@citetrue
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@A@cite}
% \begin{macro}{\if@Y@cite}
% Two flags to denote whether only the author or only the year must be cited
% or both.
%    \begin{macrocode}
\newif\if@A@cite\@A@citefalse
\newif\if@Y@cite\@Y@citefalse
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
\if@APAC@classic@or@emu
%    \end{macrocode}
%
% \begin{macro}{\nocite}
% This induces an entry in the reference list, but not in the text. It is
% also called by the other citation commands to handle some bookkeeping.
%    \begin{macrocode}
\def\nocite#1{%
%    \end{macrocode}
% No flag-setting in \cmd{\nocite}: a no-cite is not a citation, so a
% subsequent citation may be the first one.
%    \begin{macrocode}
  \@bsphack
  \ifx\@onlypreamble\document
%    \end{macrocode}
%   We are after |\begin{document}|, so we can do the citations.
%    \begin{macrocode}
    \@for\@citeb:=#1\do{%
      \edef\@citeb{\expandafter\@firstofone\@citeb}%
%    \end{macrocode}
%     The \cmd{\@newciteauxhandle} is for compatibility with \pkg{multibib}.
%    \begin{macrocode}
      \if@filesw
        \immediate\write\@newciteauxhandle{\string\citation{\@citeb}}%
      \fi
      \@ifundefined{b@\@citeb\APAC@extra@b@citeb}{%
%    \end{macrocode}
%       Check for |\nocite{*}|.
%    \begin{macrocode}
        \edef\B@my@dummy{*}%
        \ifx\@citeb\B@my@dummy
        \else
          \G@refundefinedtrue
          \@latex@warning{Citation `\@citeb' undefined}%
        \fi
      }{}%
    }%
  \else
%    \end{macrocode}
%    \pkg{apacite} has no compatibility problems with \LaTeX~2.09, because it
%    does not work with \LaTeX~2.09 anyway, so we can do the following,
%    suggested in \fname{ltbibl.dtx}:
%    \begin{macrocode}
     \AtBeginDocument{\nocite{#1}}%
  \fi
  \@esphack
%    \end{macrocode}
% For compatibility with \pkg{multibib}.
%    \begin{macrocode}
  \@restore@auxhandle
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\B@my@dummy}
% This needs to be initialized to avoid errors with \pkg{tex4ht}.
%    \begin{macrocode}
\global\def\B@my@dummy{*}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@ifauthorsequalc@de}
% Code to be executed if current author(s) equal(s) previous.
%    \begin{macrocode}
\def\@ifauthorsequalc@de#1{%
  \if@F@cite
     \@F@citefalse
  \else
     \if@Y@cite
        {\@BBY}%
     \fi
  \fi
  \if@Y@cite
     \hyper@natlinkstart{#1}%
     {\csname Y@\@citeb\APAC@extra@b@citeb\endcsname}%
     \hyper@natlinkend
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@ifauthorsunequalc@de}
% Code to be executed if current author(s) do(es) not equal previous.
%    \begin{macrocode}
\def\@ifauthorsunequalc@de#1{%
  \if@F@cite
     \@F@citefalse
  \else
     \if@Y@cite
        {\@BAY}%
     \fi
     {\@BBC}%
  \fi
  \edef\@cite@undefined{?}%
  \def\BBA{\@BBA}%
  \if@A@cite
     \hyper@natlinkstart{#1}%
     {\csname b@\@citeb\APAC@extra@b@citeb\endcsname}%
     \hyper@natlinkend
     \if@Y@cite
        {\@BBAY}%
     \fi
  \fi
  \if@Y@cite
     \hyper@natlinkstart{#1}%
     {\csname Y@\@citeb\APAC@extra@b@citeb\endcsname}%
     \hyper@natlinkend
  \fi
  \let\BBA\relax
}
%    \end{macrocode}
% \end{macro}
%
% End of shared code.
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \subsubsection{\pkg{apacite} ``classic'' commands}
%
% This defines the citation commands and syntax with angled brackets that
% have traditionally been used by \pkg{apacite}.
%    \begin{macrocode}
\if@APAC@classic@cite
%    \end{macrocode}
%
% \begin{macro}{\cite}
% \begin{macro}{\fullcite}
% \begin{macro}{\shortcite}
% Parenthetical citation commands.
%    \begin{macrocode}
\def\cite{%
    \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    \def\@BBOP{\BBOP}% % open parenthesis
    \def\@BBCP{\BBCP}% % close parenthesis
    \@ifnextchar<%     % >
        {\@cite}%
        {\@cite<>}%
}
\def\fullcite{%
    \def\BCAY##1##2##3{\BCA{##1}{##1}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##1}}%
    \def\@BBOP{\BBOP}% % open parenthesis
    \def\@BBCP{\BBCP}% % close parenthesis
    \@ifnextchar<%     % >
        {\@cite}%
        {\@cite<>}%
}
\def\shortcite{%
    \def\BCAY##1##2##3{\BCA{##2}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##2}{##2}}%
    \def\@BBOP{\BBOP}% % open parenthesis
    \def\@BBCP{\BBCP}% % close parenthesis
    \@ifnextchar<%     % >
        {\@cite}%
        {\@cite<>}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\citeNP}
% \begin{macro}{\fullciteNP}
% \begin{macro}{\shortciteNP}
% Parenthetical citation commands, but without the actual parentheses.
%    \begin{macrocode}
\def\citeNP{%
    \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    \def\@BBOP{}% % open parenthesis
    \def\@BBCP{}% % close parenthesis
    \@ifnextchar<%% >
        {\@cite}%
        {\@cite<>}%
}
\def\fullciteNP{%
    \def\BCAY##1##2##3{\BCA{##1}{##1}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##1}}%
    \def\@BBOP{}% % open parenthesis
    \def\@BBCP{}% % close parenthesis
    \@ifnextchar<%% >
        {\@cite}%
        {\@cite<>}%
}
\def\shortciteNP{%
    \def\BCAY##1##2##3{\BCA{##2}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##2}{##2}}%
    \def\@BBOP{}% % open parenthesis
    \def\@BBCP{}% % close parenthesis
    \@ifnextchar<%% >
        {\@cite}%
        {\@cite<>}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@cite}
% Second layer of the parenthetical and NP citation commands.
%    \begin{macrocode}
\def\@cite<#1>{%
    \def\@BAP{\BAP}%   % after precitation [=#1] before first citation
    \def\@BBA{\BBAA}%  % `and' between authors
    \def\@BBAY{\BBAY}% % between author and year
    \def\@BAY{}%       % after year
    \def\@BBY{\BBYY}%  % between years of multiple citations with same author
    \def\@BBC{\BBC}%   % between cites
    \def\@BBN{\BBN}%   % after last citation before note/postcitation [=#2]
    \def\@BAstyle{\BAstyle}% text style of authors
    \@A@citetrue%       % cite authors
    \@Y@citetrue%       % cite years
    \@ifnextchar[%      % ]
        {\@@cite<#1>}%
        {\@@cite<#1>[]}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\citeA}
% \begin{macro}{\fullciteA}
% \begin{macro}{\shortciteA}
% In-text citation commands.
%    \begin{macrocode}
\def\citeA{%
    \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    \@ifnextchar<%          %>
        {\@citeA}%
        {\@citeA<>}%
}
\def\fullciteA{%
    \def\BCAY##1##2##3{\BCA{##1}{##1}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##1}}%
    \@ifnextchar<%          %>
        {\@citeA}%
        {\@citeA<>}%
}
\def\shortciteA{%
    \def\BCAY##1##2##3{\BCA{##2}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##2}{##2}}%
    \@ifnextchar<%          %>
        {\@citeA}%
        {\@citeA<>}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@citeA}
% Second layer of in-text citation commands.
%    \begin{macrocode}
\def\@citeA<#1>{%
    \def\@BBOP{}%      % open parenthesis.
    \def\@BAP{\BAP}%   % after precitation [=#1] before first citation
    \def\@BBA{\BBAB}%  % `and' between authors
    \def\@BBAY{ \BBOP}%% between author and year
    \def\@BAY{\BBCP}%  % after year
    \def\@BBY{\BBYY}%  % between years of multiple citations with same author
    \def\@BBC{\BBC}%   % between cites
    \def\@BBN{\BBN}%   % after last citation before note/postcitation [=#2]
    \def\@BBCP{}%      % close parenthesis
    \def\@BAstyle{\BAstyle}% text style of authors
    \@A@citetrue%      % cite authors
    \@Y@citetrue%      % cite years
    \@ifnextchar[%     % ]
        {\@@cite<#1>}%
        {\@@cite<#1>[]}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\citeauthor}
% \begin{macro}{\fullciteauthor}
% \begin{macro}{\shortciteauthor}
% \begin{macro}{\citeauthorNP}
% \begin{macro}{\fullciteauthorNP}
% \begin{macro}{\shortciteauthorNP}
% Commands that only cite the author, for parenthetical and in-text citations,
% the difference being that `\&' is used in the parenthetical versions,
% whereas the in-text versions use `and' between the authors. Note that all
% are without parentheses; \cmd{\citeauthorA} would be a better name for
% \cmd{\citeauthor} to clarify its role (cf.~\cmd{\citeA}, \cmd{\cite}, and
% \cmd{\citeNP}), but for backwards compatibility and compatibility with
% some other citation packages, it is \cmd{\citeauthor}.
%    \begin{macrocode}
\def\citeauthor{%
    \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    \@ifnextchar<%    %>
        {\@citeauthor}%
        {\@citeauthor<>}%
}
\def\fullciteauthor{%
    \def\BCAY##1##2##3{\BCA{##1}{##1}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##1}}%
    \@ifnextchar<%    %>
        {\@citeauthor}%
        {\@citeauthor<>}%
}
\def\shortciteauthor{%
    \def\BCAY##1##2##3{\BCA{##2}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##2}{##2}}%
    \@ifnextchar<%    %>
        {\@citeauthor}%
        {\@citeauthor<>}%
}
\def\citeauthorNP{%
    \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    \@ifnextchar<%    %>
        {\@citeauthorNP}%
        {\@citeauthorNP<>}%
}
\def\fullciteauthorA{%
    \def\BCAY##1##2##3{\BCA{##1}{##1}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##1}}%
    \@ifnextchar<%    %>
        {\@citeauthorNP}%
        {\@citeauthorNP<>}%
}
\def\shortciteauthorA{%
    \def\BCAY##1##2##3{\BCA{##2}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##2}{##2}}%
    \@ifnextchar<%    %>
        {\@citeauthorNP}%
        {\@citeauthorNP<>}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@citeauthor}
% \begin{macro}{\@citeauthorNP}
% Second layer of the author citation commands.
%    \begin{macrocode}
\def\@citeauthor<#1>{%
    \def\@BBOP{}%      % open parenthesis
    \def\@BAP{\BAP}%   % after precitation [=#1] before first citation
    \def\@BBA{\BBAB}%  % `and' between authors
    \def\@BBAY{}%      % between author and year
    \def\@BAY{}%       % after year
    \def\@BBY{}%       % between years of multiple citations with same author
    \def\@BBC{\BBC}%   % between cites
    \def\@BBN{\BBN}%   % after last citation before note/postcitation [=#2]
    \def\@BBCP{}%      % close parenthesis
    \def\@BAstyle{\BAastyle}% text style of authors
    \@A@citetrue%      % cite authors
    \@Y@citefalse%     % do not cite years
    \@ifnextchar[%     % ]
        {\@@cite<#1>}%
        {\@@cite<#1>[]}%
}
\def\@citeauthorNP<#1>{%
    \def\@BBOP{}%      % open parenthesis
    \def\@BAP{\BAP}%   % after precitation [=#1] before first citation
    \def\@BBA{\BBAA}%  % `and' between authors
    \def\@BBAY{}%      % between author and year
    \def\@BAY{}%       % after year
    \def\@BBY{}%       % between years of multiple citations with same author
    \def\@BBC{\BBC}%   % between cites
    \def\@BBN{\BBN}%   % after last citation before note/postcitation [=#2]
    \def\@BBCP{}%      % close parenthesis
    \def\@BAstyle{\BAastyle}% text style of authors
    \@A@citetrue%      % cite authors
    \@Y@citefalse%     % do not cite years
    \@ifnextchar[%     % ]
        {\@@cite<#1>}%
        {\@@cite<#1>[]}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\citeyear}
% \begin{macro}{\citeyearNP}
% Cite only the year; parenthetical and without parentheses.
%    \begin{macrocode}
\def\citeyear{%
    \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    \def\@BBOP{\BBOP}% % open parenthesis
    \def\@BBCP{\BBCP}% % close parenthesis
    \@ifnextchar<%     % >
        {\@citeyear}%
        {\@citeyear<>}%
}
\def\citeyearNP{%
    \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    \def\@BBOP{}%   % open parenthesis
    \def\@BBCP{}%   % close parenthesis
    \@ifnextchar<%  % >
        {\@citeyear}%
        {\@citeyear<>}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@citeyear}
% Second layer of the year citation commands.
%    \begin{macrocode}
\def\@citeyear<#1>{%
    \def\@BAP{\BAP}%   % after precitation [=#1] before first citation
    \def\@BBA{}%       % `and' between authors
    \def\@BBAY{}%      % between author and year
    \def\@BAY{}%       % after year
    \def\@BBY{\BBYY}%  % between years of multiple citations with same author
    \def\@BBC{\BBC}%   % between cites
    \def\@BBN{\BBN}%   % after last citation before note/postcitation [=#2]
    \def\@BAstyle{}%   % text style of authors
    \@A@citefalse%     % do not cite authors
    \@Y@citetrue%      % cite years
    \@ifnextchar[%     % ]
        {\@@cite<#1>}%
        {\@@cite<#1>[]}%
}
%    \end{macrocode}
% \end{macro}
%
% We are now arriving at the core citation routines. The following commands
% must have been defined:\\
% \begin{tabular}{@{\qquad}ll@{}}
% \cmd{\@BBOP}    & open parenthesis                                     \\
% \cmd{\@BAP}     & after precitation before first citation              \\
% \cmd{\@BBA}     & `and' between authors                                \\
% \cmd{\@BBAY}    & between author and year                              \\
% \cmd{\@BAY}     & after year                                           \\
% \cmd{\@BBY}     & between years of multiple citations with same author \\
% \cmd{\@BBC}     & between cites                                        \\
% \cmd{\@BBN}     & after last citation before note/postcitation         \\
% \cmd{\@BBCP}    & close parenthesis                                    \\
% \cmd{\@BAstyle} & formatting style of authors (e.g., \cmd{\scshape})
% \end{tabular}
%
% \begin{macro}{\@@cite}
% The core citation command. Standard \LaTeX{} and other packages use
% \cmd{\@citex} for this. It may be useful to change this as well, to increase
% the likelihood of compatibility with some packages.
%    \begin{macrocode}
\def\@@cite<#1>[#2]#3{%
%    \end{macrocode}
%   Write citation(s) to .aux file(s)
%    \begin{macrocode}
    \nocite{#3}%
%    \end{macrocode}
%   The previous cite, for multiple citations with same author.
%    \begin{macrocode}
    \edef\@citeP{}%
%    \end{macrocode}
%   Open parenthesis and pre-note. The \cmd{\mbox} is to avoid \pkg{hyperref}
%   problems if a \cmd{\citeA} follows an \cmd{\item}.
%    \begin{macrocode}
    \mbox{\@BBOP}%
    \ifx\@empty#1\@empty
    \else%
      {\ignorespaces #1\@BAP}%
    \fi%
%    \end{macrocode}
%   Loop over citation entries
%    \begin{macrocode}
    \@for\@citeb:=#3\do{%
%    \end{macrocode}
%       Removes a possible space before the citation key, so that, e.g.,
%       \verb*+\cite{key1, key2}+ can be done.
%    \begin{macrocode}
        \edef\@citeb{\expandafter\@firstofone\@citeb}%
%    \end{macrocode}
%       For \pkg{backref}.
%    \begin{macrocode}
        \back@cite{\@citeb}%
%    \end{macrocode}
%       Check whether the citation is defined.
%    \begin{macrocode}
        \@ifundefined{b@\@citeb\APAC@extra@b@citeb}%
          {\expandafter\def\csname b@\@citeb\APAC@extra@b@citeb\endcsname{?}%
           \expandafter\def\csname Y@\@citeb\APAC@extra@b@citeb\endcsname{?}%
           %% The following is now handled by \nocite
           %% \G@refundefinedtrue
           %% \@latex@warning{Citation `\@citeb' undefined}%
          }%%
%    \end{macrocode}
%       If the citation is defined, check whether the flag has been set that
%       identifies that this is not the first citation to the work. If this
%       flag has not been set, it will be set to |DUMMY|. If this is the first
%       citation to the work, the full citation is used; else the short version
%       is used.
%    \begin{macrocode}
          {\@ifundefined{flag@\@citeb\APAC@extra@b@citeb}%
             {\global\expandafter
              \def\csname flag@\@citeb\APAC@extra@b@citeb\endcsname{DUMMY}%
              \def\BCA##1##2{{\@BAstyle ##1}}%
             }%
             {\def\BCA##1##2{{\@BAstyle ##2}}%
             }%
          }%
%    \end{macrocode}
%       Check whether the current author(s) is (are) equivalent to the
%       previous. If so, only the year is cited in the text and a \cmd{\@BBY}
%       (probably comma and space) is inserted between the two years. The
%       \cmd{\protected@edef} fixes the problem with authors with accents
%       (e.g., J{\"{o}}reskog). Older versions of \pkg{apacite} solved this
%       less elegantly (\pkgoption{accentfix} option). This fix was provided by
%       Robert Schlicht. See also the new definition of \cmd{\@citeP} below.
%    \begin{macrocode}
        \protected@edef\B@my@dummy{\csname
                                   b@\@citeb\APAC@extra@b@citeb\endcsname}%
        \ifx\@citeP\B@my@dummy
            \@ifauthorsequalc@de{\@citeb\APAC@extra@b@citeb}%
        \else
            \@ifauthorsunequalc@de{\@citeb\APAC@extra@b@citeb}%
        \fi
%    \end{macrocode}
%       Store the current author(s) for comparison in the next citation (if
%       any).
%    \begin{macrocode}
        \protected@edef\@citeP{\csname b@\@citeb\APAC@extra@b@citeb\endcsname}%
        \let\BCA\relax
    }%%
%    \end{macrocode}
%   End of the loop over citation entries. Add the post-note and closing
%   parenthesis.
%    \begin{macrocode}
    \ifx\@empty#2\@empty
    \else%
      {\@BBN #2}%
    \fi%
    \if@Y@cite%
       {\@BAY}%
    \fi%
    {\@BBCP}%
%    \end{macrocode}
%   We're finished with this citation command. Initialize for the next
%   \cmd{\@@cite} call.
%    \begin{macrocode}
    \@F@citetrue %
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\maskcitations}
% \begin{macro}{\unmaskcitations}
% \begin{macro}{\masknocite}
% \begin{macro}{\maskcite}
% \begin{macro}{\maskfullcite}
% \begin{macro}{\maskshortcite}
% \begin{macro}{\maskciteNP}
% \begin{macro}{\maskfullciteNP}
% \begin{macro}{\maskshortciteNP}
% \begin{macro}{\maskciteA}
% \begin{macro}{\maskfullciteA}
% \begin{macro}{\maskshortciteA}
% \begin{macro}{\maskciteauthor}
% \begin{macro}{\maskfullciteauthor}
% \begin{macro}{\maskshortciteauthor}
% \begin{macro}{\maskciteauthorNP}
% \begin{macro}{\maskfullciteauthorNP}
% \begin{macro}{\maskshortciteauthorNP}
% \begin{macro}{\maskciteyear}
% \begin{macro}{\maskciteyearNP}
% \begin{macro}{\masktext}
% These commands allow masking of (self-)citations  for a masked
% review.
% The \cmd{maskcitations} command defines the masked citation commands;
% \cmd{unmaskcitations} does the same, but lets them be equal to the
% non-mask versions. The advantage of putting these definitions within
% a command is that we can switch between masked and unmasked within
% the same document. This is not likely to be used very often in
% practice, but is useful for writing tutorials.
%    \begin{macrocode}
\newcommand{\maskcitations}{%
    \def\masknocite##1{}%
    \def\maskcite{%
        \@ifnextchar<%     % >
            {\mask@cite}%
            {\mask@cite<>}%
    }%
    \def\mask@cite<##1>{%
        \@ifnextchar[%      % ]
            {\mask@@cite<##1>}%
            {\mask@@cite<##1>[]}%
    }%
    \def\mask@@cite<##1>[##2]##3{%
        \relax
%    \end{macrocode}
% Count number of masked references.
%    \begin{macrocode}
        \setcounter{maskedRefs}{0}%
        \@for\@citeb:=##3\do{%
            \addtocounter{maskedRefs}{1}%
        }%
        \ifnum\value{maskedRefs} = 1%
            \onemaskedcitationmsg{\themaskedRefs}%
        \else
            \maskedcitationsmsg{\themaskedRefs}%
        \fi
    }%
%    \end{macrocode}
% Let all other citation commands be identical to \cmd{\maskcite}.
% We could try to do fancy things with parentheses, but it's unlikely
% we will be able to cover all cases of interest, and users can easily
% change their document if they don't like how this comes out.
%    \begin{macrocode}
    \let\maskfullcite\maskcite
    \let\maskshortcite\maskcite
    \let\maskciteNP\maskcite
    \let\maskfullciteNP\maskciteNP
    \let\maskshortciteNP\maskciteNP
    \let\maskciteA\maskcite
    \let\maskfullciteA\maskciteA
    \let\maskshortciteA\maskciteA
    \let\maskciteauthor\maskcite
    \let\maskfullciteauthor\maskciteauthor
    \let\maskshortciteauthor\maskciteauthor
    \let\maskciteauthorNP\maskciteauthor
    \let\maskfullciteauthorNP\maskciteauthorNP
    \let\maskshortciteauthorNP\maskciteauthorNP
    \let\maskciteyear\maskcite
    \let\maskciteyearNP\maskciteyear
%    \end{macrocode}
% A user command to flexibly mask or unmask certain pieces of text.
% An environment is technically more stable than a command, but less
% intuitive for users. Under masking, this command prints the optional
% alternative text |#1|, which defaults to nothing.
%    \begin{macrocode}
    \DeclareRobustCommand{\masktext}[2][]{##1}%
}
%    \end{macrocode}
%
% The ``mask'' citation commands revert to the same commands without
% ``mask'' if the \pkgoption{mask} option is not set.
%    \begin{macrocode}
\newcommand{\unmaskcitations}{%
    \let\masknocite\nocite
    \let\maskcite\cite
    \let\maskfullcite\fullcite
    \let\maskshortcite\shortcite
    \let\maskciteNP\citeNP
    \let\maskfullciteNP\fullciteNP
    \let\maskshortciteNP\shortciteNP
    \let\maskciteA\citeA
    \let\maskfullciteA\fullciteA
    \let\maskshortciteA\shortciteA
    \let\maskciteauthor\citeauthor
    \let\maskfullciteauthor\fullciteauthor
    \let\maskshortciteauthor\shortciteauthor
    \let\maskciteauthorNP\citeauthorNP
    \let\maskfullciteauthorNP\fullciteauthorNP
    \let\maskshortciteauthorNP\shortciteauthorNP
    \let\maskciteyear\citeyear
    \let\maskciteyearNP\citeyearNP
%    \end{macrocode}
% Unmasked, this command prints the mandatory second argument |#2|.
%    \begin{macrocode}
    \DeclareRobustCommand{\masktext}[2][]{##2}
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% End of ``classic'' citation commands.
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \subsubsection{Emulation of \pkg{natbib} citation commands}
%
% If requested, this section defines the \pkg{natbib} citation commands,
% using the same syntax, without actually loading \pkg{natbib}. We also
% define a few additional commands that \pkg{natbib} did not implement,
% but that fit the scheme and serve some useful purpose for APA style
% citation.
%
% |\if@APAC@alias@cite| needs to be defined outside the
% |\if@APAC@natbib@emu| because otherwise \TeX{} does not process the
% nested |\if|'s below correctly.
%    \begin{macrocode}
\newif\if@APAC@alias@cite
\@APAC@alias@citefalse
\if@APAC@natbib@emu
%    \end{macrocode}
%
% \begin{macro}{\citep}
% \begin{macro}{\shortcitep}
% Parenthetical citation commands.
%    \begin{macrocode}
\DeclareRobustCommand\citep{%
    \@ifstar{% full cite
        \def\BCAY##1##2##3{\BCA{##1}{##1}}% kept for compat. with prev. versions
        \def\citeauthoryear##1##2##3{\BCA{##1}{##1}}%
    }{% else
        \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
        \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    }%
    \def\@BBOP{\BBOP}% % open parenthesis
    \def\@BBCP{\BBCP}% % close parenthesis
    \@ifnextchar[%     % ]
        {\APACNAT@citep}%
        {\APACNAT@citep[]}%
}
\DeclareRobustCommand\shortcitep{%
    \def\BCAY##1##2##3{\BCA{##2}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##2}{##2}}%
    \def\@BBOP{\BBOP}% % open parenthesis
    \def\@BBCP{\BBCP}% % close parenthesis
    \@ifnextchar[%     % ]
        {\APACNAT@citep}%
        {\APACNAT@citep[]}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\citealp}
% \begin{macro}{\shortcitealp}
% Parenthetical citation commands, but without the actual parentheses.
%    \begin{macrocode}
\DeclareRobustCommand\citealp{%
    \@ifstar{% full cite
        \def\BCAY##1##2##3{\BCA{##1}{##1}}% kept for compat. with prev. versions
        \def\citeauthoryear##1##2##3{\BCA{##1}{##1}}%
    }{% else
        \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
        \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    }%
    \def\@BBOP{}% % open parenthesis
    \def\@BBCP{}% % close parenthesis
    \@ifnextchar[%% ]
        {\APACNAT@citep}%
        {\APACNAT@citep[]}%
}
\DeclareRobustCommand\shortcitealp{%
    \def\BCAY##1##2##3{\BCA{##2}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##2}{##2}}%
    \def\@BBOP{}% % open parenthesis
    \def\@BBCP{}% % close parenthesis
    \@ifnextchar[%% ]
        {\APACNAT@citep}%
        {\APACNAT@citep[]}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APACNAT@citep}
% Second layer of the parenthetical and alp citation commands.
%    \begin{macrocode}
\newcommand\APACNAT@citep{}
\def\APACNAT@citep[#1]{%
    \def\@BAP{\BAP}%   % after precitation [=#1] before first citation
    \def\@BBA{\BBAA}%  % `and' between authors
    \def\@BBAY{\BBAY}% % between author and year
    \def\@BAY{}%       % after year
    \def\@BBY{\BBYY}%  % between years of multiple citations with same author
    \def\@BBC{\BBC}%   % between cites
    \def\@BBN{\BBN}%   % after last citation before note/postcitation [=#2]
    \def\@BAstyle{\BAstyle}% text style of authors
    \@A@citetrue%       % cite authors
    \@Y@citetrue%       % cite years
    \@ifnextchar[%      % ]
        {\@citex[#1]}%
        {\@citex[][#1]}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\citet}
% \begin{macro}{\shortcitet}
% In-text citation commands.
%    \begin{macrocode}
\DeclareRobustCommand\citet{%
    \@ifstar{%
        \def\BCAY##1##2##3{\BCA{##1}{##1}}% kept for compat. with prev. versions
        \def\citeauthoryear##1##2##3{\BCA{##1}{##1}}%
    }{% else
        \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
        \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    }%
    \def\@BBAY{ \BBOP}%% between author and year
    \@ifnextchar[%          %]
        {\APACNAT@citet}%
        {\APACNAT@citet[]}%
}
\DeclareRobustCommand\shortcitet{%
    \def\BCAY##1##2##3{\BCA{##2}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##2}{##2}}%
    \def\@BBAY{ \BBOP}%% between author and year
    \@ifnextchar[%          %]
        {\APACNAT@citet}%
        {\APACNAT@citet[]}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\citealt}
% \begin{macro}{\shortcitealt}
% Text citation commands, but without the actual parentheses. Not sure when
% this would be useful, but \pkg{natbib} defines them.
%    \begin{macrocode}
\DeclareRobustCommand\citealt{%
    \@ifstar{% full cite
        \def\BCAY##1##2##3{\BCA{##1}{##1}}% kept for compat. with prev. versions
        \def\citeauthoryear##1##2##3{\BCA{##1}{##1}}%
    }{% else
        \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
        \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    }%
    \def\@BBOP{}% % open parenthesis
    \def\@BBCP{}% % close parenthesis
    \def\@BBAY{ }%% between author and year
    \@ifnextchar[%% ]
        {\APACNAT@citet}%
        {\APACNAT@citet[]}%
}
\DeclareRobustCommand\shortcitealt{%
    \def\BCAY##1##2##3{\BCA{##2}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##2}{##2}}%
    \def\@BBOP{}% % open parenthesis
    \def\@BBCP{}% % close parenthesis
    \def\@BBAY{ }%% between author and year
    \@ifnextchar[%% ]
        {\APACNAT@citet}%
        {\APACNAT@citet[]}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APACNAT@citet}
% Second layer of in-text and alt citation commands.
%    \begin{macrocode}
\newcommand\APACNAT@citet{}
\def\APACNAT@citet[#1]{%
    \def\@BBOP{}%       % open parenthesis.
    \def\@BAP{\BAP}%    % after precitation [=#1] before first citation
    \def\@BBA{\BBAB}%   % `and' between authors
%%   \def\@BBAY{ \BBOP}%% between author and year
    \def\@BAY{\BBCP}%   % after year
    \def\@BBY{\BBYY}%   % between years of multiple citations with same author
    \def\@BBC{\BBC}%    % between cites
    \def\@BBN{\BBN}%    % after last citation before note/postcitation [=#2]
    \def\@BBCP{}%       % close parenthesis
    \def\@BAstyle{\BAstyle}% text style of authors
    \@A@citetrue%       % cite authors
    \@Y@citetrue%       % cite years
    \@ifnextchar[%      % ]
        {\@citex[#1]}%
        {\@citex[][#1]}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\citeauthort}
% \begin{macro}{\shortciteauthort}
% \begin{macro}{\citeauthorp}
% \begin{macro}{\shortciteauthorp}
% \begin{macro}{\citeauthor}
% \begin{macro}{\citefullauthor}
% \begin{macro}{\shortciteauthor}
% Commands that only cite the author, for parenthetical and in-text citations,
% the difference being that `\&' is used in the parenthetical versions,
% whereas the in-text versions use `and' between the authors. Note that all
% are without parentheses.
%    \begin{macrocode}
\DeclareRobustCommand\citeauthort{%
    \@ifstar{%
        \def\BCAY##1##2##3{\BCA{##1}{##1}}% kept for compat. with prev. versions
        \def\citeauthoryear##1##2##3{\BCA{##1}{##1}}%
    }{% else
        \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
        \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    }%
    \@ifnextchar[%    %]
        {\APACNAT@citeauthort}%
        {\APACNAT@citeauthort[]}%
}
\DeclareRobustCommand\shortciteauthort{%
    \def\BCAY##1##2##3{\BCA{##2}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##2}{##2}}%
    \@ifnextchar[%    %]
        {\APACNAT@citeauthort}%
        {\APACNAT@citeauthort[]}%
}
\DeclareRobustCommand\citeauthorp{%
    \@ifstar{%
        \def\BCAY##1##2##3{\BCA{##1}{##1}}% kept for compat. with prev. versions
        \def\citeauthoryear##1##2##3{\BCA{##1}{##1}}%
    }{% else
        \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
        \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    }%
    \@ifnextchar[%    %]
        {\APACNAT@citeauthorp}%
        {\APACNAT@citeauthorp[]}%
}
\DeclareRobustCommand\shortciteauthorp{%
    \def\BCAY##1##2##3{\BCA{##2}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##2}{##2}}%
    \@ifnextchar[%    %]
        {\APACNAT@citeauthorp}%
        {\APACNAT@citeauthorp[]}%
}
\DeclareRobustCommand\citeauthor{\citeauthort}
\DeclareRobustCommand\citefullauthor{\citeauthort*}
\DeclareRobustCommand\shortciteauthor{\shortciteauthort}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APACNAT@citeauthort}
% \begin{macro}{\APACNAT@citeauthorp}
% Second layer of the author citation commands.
%    \begin{macrocode}
\newcommand\APACNAT@citeauthort{}
\def\APACNAT@citeauthort[#1]{%
    \def\@BBOP{}%      % open parenthesis
    \def\@BAP{\BAP}%   % after precitation [=#1] before first citation
    \def\@BBA{\BBAB}%  % `and' between authors
    \def\@BBAY{}%      % between author and year
    \def\@BAY{}%       % after year
    \def\@BBY{}%       % between years of multiple citations with same author
    \def\@BBC{\BBC}%   % between cites
    \def\@BBN{\BBN}%   % after last citation before note/postcitation [=#2]
    \def\@BBCP{}%      % close parenthesis
    \def\@BAstyle{\BAastyle}% text style of authors
    \@A@citetrue%      % cite authors
    \@Y@citefalse%     % do not cite years
    \@ifnextchar[%     % ]
        {\@citex[#1]}%
        {\@citex[][#1]}%
}
\newcommand\APACNAT@citeauthorp{}
\def\APACNAT@citep[#1]{%
    \def\@BBOP{}%      % open parenthesis
    \def\@BAP{\BAP}%   % after precitation [=#1] before first citation
    \def\@BBA{\BBAA}%  % `and' between authors
    \def\@BBAY{}%      % between author and year
    \def\@BAY{}%       % after year
    \def\@BBY{}%       % between years of multiple citations with same author
    \def\@BBC{\BBC}%   % between cites
    \def\@BBN{\BBN}%   % after last citation before note/postcitation [=#2]
    \def\@BBCP{}%      % close parenthesis
    \def\@BAstyle{\BAastyle}% text style of authors
    \@A@citetrue%      % cite authors
    \@Y@citefalse%     % do not cite years
    \@ifnextchar[%     % ]
        {\@citex[#1]}%
        {\@citex[][#1]}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\citeyearpar}
% \begin{macro}{\citeyear}
% Cite only the year; parenthetical and without parentheses. Note that these
% are the \pkg{natbib} conventions, so unlike traditional \pkg{apacite}
% \cmd{\citeyear}, \cmd{\citeyear} here does not include the parentheses.
%    \begin{macrocode}
\DeclareRobustCommand\citeyearpar{%
    \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    \def\@BBOP{\BBOP}% % open parenthesis
    \def\@BBCP{\BBCP}% % close parenthesis
    \@ifnextchar[%     % ]
        {\APACNAT@citeyear}%
        {\APACNAT@citeyear[]}%
}
\DeclareRobustCommand\citeyear{%
    \def\BCAY##1##2##3{\BCA{##1}{##2}}% kept for compat. with prev. versions
    \def\citeauthoryear##1##2##3{\BCA{##1}{##2}}%
    \def\@BBOP{}%   % open parenthesis
    \def\@BBCP{}%   % close parenthesis
    \@ifnextchar[%  % ]
        {\APACNAT@citeyear}%
        {\APACNAT@citeyear[]}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APACNAT@citeyear}
% Second layer of the year citation commands.
%    \begin{macrocode}
\newcommand\APACNAT@citeyear{}
\def\APACNAT@citeyear[#1]{%
    \def\@BAP{\BAP}%   % after precitation [=#1] before first citation
    \def\@BBA{}%       % `and' between authors
    \def\@BBAY{}%      % between author and year
    \def\@BAY{}%       % after year
    \def\@BBY{\BBYY}%  % between years of multiple citations with same author
    \def\@BBC{\BBC}%   % between cites
    \def\@BBN{\BBN}%   % after last citation before note/postcitation [=#2]
    \def\@BAstyle{}%   % text style of authors
    \@A@citefalse%     % do not cite authors
    \@Y@citetrue%      % cite years
    \@ifnextchar[%     % ]
        {\@citex[#1]}%
        {\@citex[][#1]}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACNAT@citex}
% The core citation command. We will let \cmd{\@citex} revert to this.
%    \begin{macrocode}
\newcommand\APACNAT@citex{}
\def\APACNAT@citex[#1][#2]#3{%
%    \end{macrocode}
%   Write citation(s) to \fname{.aux} file(s)
%    \begin{macrocode}
    \nocite{#3}%
%    \end{macrocode}
%   The previous cite, for multiple citations with same author.
%    \begin{macrocode}
    \edef\@citeP{}%
%    \end{macrocode}
%   Open parenthesis and pre-note. The \cmd{\mbox} is to avoid \pkg{hyperref}
%   problems if a citation command follows an \cmd{\item}. Better to change
%   this to using \cmd{\citetext}; for the todo list.
%    \begin{macrocode}
    \mbox{\@BBOP}%
    \ifx\@empty#1\@empty
    \else%
      {\ignorespaces #1\@BAP}%
    \fi%
%    \end{macrocode}
%   Loop over citation entries
%    \begin{macrocode}
    \@for\@citeb:=#3\do{%
%    \end{macrocode}
%       Removes a possible space before the citation key, so that, e.g.,
%       \verb*+\cite{key1, key2}+ can be done.
%    \begin{macrocode}
        \edef\@citeb{\expandafter\@firstofone\@citeb}%
%    \end{macrocode}
%       For \pkg{backref}.
%    \begin{macrocode}
        \back@cite{\@citeb}%
%    \end{macrocode}
% If this is an alias cite, we should include the alias but not author
% or year, so the code is slightly different.
%    \begin{macrocode}
        \if@APAC@alias@cite
%    \end{macrocode}
% Check whether the alias is defined.
%    \begin{macrocode}
          \@ifundefined{al@\@citeb\APAC@extra@b@citeb}%
            {\PackageWarning{apacite}{Undefined alias for citation \@citeb}
             \expandafter\def\csname al@\@citeb\APAC@extra@b@citeb\endcsname{?}%
            }{}%
%    \end{macrocode}
% Replace the authors by the alias and don't cite years.
%    \begin{macrocode}
          \@Y@citefalse  % do not cite years
          \def\BCA##1##2{{\@BAstyle \csname
            al@\@citeb\APAC@extra@b@citeb\endcsname}}%
%    \end{macrocode}
% Use the ``unequal'' code because the alias takes the place of the
% authors.
%    \begin{macrocode}
          \@ifauthorsunequalc@de{\@citeb\APAC@extra@b@citeb}%
        \else
%    \end{macrocode}
% The usual author and/or year citation. Check whether the citation is
% defined.
%    \begin{macrocode}
          \@ifundefined{b@\@citeb\APAC@extra@b@citeb}%
            {\expandafter\def\csname b@\@citeb\APAC@extra@b@citeb\endcsname{?}%
             \expandafter\def\csname Y@\@citeb\APAC@extra@b@citeb\endcsname{?}%
            }%
%    \end{macrocode}
% If the citation is defined, check whether the flag has been set that
% identifies that this is not the first citation to the work. If this
% flag has not been set, it will be set to |DUMMY|. If this is the first
% citation to the work, the full citation is used; else the short version
% is used.
%    \begin{macrocode}
            {\@ifundefined{flag@\@citeb\APAC@extra@b@citeb}%
               {\global\expandafter
                \def\csname flag@\@citeb\APAC@extra@b@citeb\endcsname{DUMMY}%
                \def\BCA##1##2{{\@BAstyle ##1}}%
               }%
               {\def\BCA##1##2{{\@BAstyle ##2}}%
               }%
            }%
%    \end{macrocode}
% Check whether the current author(s) is (are) equivalent to the
% previous. If so, only the year is cited in the text and a \cmd{\@BBY}
% (probably comma and space) is inserted between the two years. The
% \cmd{\protected@edef} fixes the problem with authors with accents
% (e.g., J{\"{o}}reskog). Older versions of \pkg{apacite} solved this
% less elegantly (\pkgoption{accentfix} option). This fix was provided by
% Robert Schlicht. See also the new definition of \cmd{\@citeP} below.
%    \begin{macrocode}
          \protected@edef\B@my@dummy{\csname
            b@\@citeb\APAC@extra@b@citeb\endcsname}%
          \ifx\@citeP\B@my@dummy
              \@ifauthorsequalc@de{\@citeb\APAC@extra@b@citeb}%
          \else
              \@ifauthorsunequalc@de{\@citeb\APAC@extra@b@citeb}%
          \fi
%    \end{macrocode}
% Store the current author(s) for comparison in the next citation (if
% any).
%    \begin{macrocode}
          \protected@edef\@citeP{\csname
            b@\@citeb\APAC@extra@b@citeb\endcsname}%
          \let\BCA\relax
        \fi
    }%
%    \end{macrocode}
%   End of the loop over citation entries. Add the post-note and closing
%   parenthesis.
%    \begin{macrocode}
    \ifx\@empty#2\@empty
    \else%
      {\@BBN #2}%
    \fi%
    \if@Y@cite%
       {\@BAY}%
    \fi%
    {\@BBCP}%
%    \end{macrocode}
%   We're finished with this citation command. Initialize for the next
%   \cmd{\APACNAT@citex} call.
%    \begin{macrocode}
    \@F@citetrue %
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\citetext}
% To place any arbitrary text inside the citation braces, use
% \cmd{\citetext}.
%    \begin{macrocode}
\newcommand\citetext[1]{\mbox{}\BBOP{}#1\BBCP}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@citex}
% The core citation command.
%    \begin{macrocode}
\let\@citex\APACNAT@citex
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cite}
% The use of \cmd{\cite} is considered deprecated in \pkg{natbib}, but
% we provide it as a backwards compatibility definition just like \pkg{natbib}.
% Without optional arguments, it reverts to \cmd{\citep} and with optional
% arguments (even empty ones), it reverts to \cmd{\citet}.
%    \begin{macrocode}
\DeclareRobustCommand\cite{%
  \@ifstar{%
    \@ifnextchar[%    %]
        {\citep*}%
        {\citet*}%
  }{%
    \@ifnextchar[%    %]
        {\citep}%
        {\citet}%
  }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Citet}
% \begin{macro}{\Citep}
% \begin{macro}{\Citealt}
% \begin{macro}{\Citealp}
% \begin{macro}{\Citeauthort}
% \begin{macro}{\Citeauthorp}
% \begin{macro}{\Citeauthor}
% \begin{macro}{\Citefullauthor}
% \begin{macro}{\Cite}
% Commands that capitalize the first name in a citation, to be used at the
% beginning of a sentence. These are currently not implemented yet, so let's
% just define them to be equal to the non-capitalized versions.
%    \begin{macrocode}
\DeclareRobustCommand\Citet{\citet}
\DeclareRobustCommand\Citep{\citep}
\DeclareRobustCommand\Citealt{\citealt}
\DeclareRobustCommand\Citealp{\citealp}
\DeclareRobustCommand\Citeauthort{\citeauthort}
\DeclareRobustCommand\Citeauthorp{\citeauthorp}
\DeclareRobustCommand\Citeauthor{\citeauthor}
\DeclareRobustCommand\Citefullauthor{\citefullauthor}
\DeclareRobustCommand\Cite{\cite}
\DeclareRobustCommand\shortCitet{\shortcitet}
\DeclareRobustCommand\shortCitep{\shortcitep}
\DeclareRobustCommand\shortCitealt{\shortcitealt}
\DeclareRobustCommand\shortCitealp{\shortcitealp}
\DeclareRobustCommand\shortCiteauthort{\shortciteauthort}
\DeclareRobustCommand\shortCiteauthorp{\shortciteauthorp}
\DeclareRobustCommand\shortCiteauthor{\shortciteauthor}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\shortcites}
% This declares a list of citations that should be cited in their
% short form. This can be overridden by using the starred form of
% the citation commands later.
%    \begin{macrocode}
\newcommand\shortcites[1]{%
  \@bsphack
    \@for\@citeb:=#1\do{%
      \edef\@citeb{\expandafter\@firstofone\@citeb}%
      \global\expandafter
         \def\csname flag@\@citeb\APAC@extra@b@citeb\endcsname{DUMMY}%
    }%
  \@esphack
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\defcitealias}
% \begin{macro}{\citetalias}
% \begin{macro}{\citepalias}
% Define an ``alias'', which can be an arbitrary text string, and use
% this instead of the author and year in a citation. Adapted from
% \fname{natbib.dtx}.
%    \begin{macrocode}
\newcommand\defcitealias[2]{%
   \@ifundefined{al@#1\APAC@extra@b@citeb}{}
   {\PackageWarning{apacite}{Overwriting existing alias for citation #1}}
   \@namedef{al@#1\APAC@extra@b@citeb}{#2}}
\DeclareRobustCommand\citetalias{%
  \@APAC@alias@citetrue
  \citet
}
\DeclareRobustCommand\citepalias{%
  \@APAC@alias@citetrue
  \citep
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% Define \cmd{\citeindextype}, |\citeindextrue|, and |\citeindexfalse|
% for compatibility with \pkg{natbib}. However, these don't do anything
% in \pkg{apacite}, which supports author indexes using one of the
% ``index'' options and back referencing of specific citations using
% the \pkg{backref} package.
%    \begin{macrocode}
\newif\ifciteindex \citeindexfalse
\newcommand\citeindextype{default}
%    \end{macrocode}
%
% \begin{macro}{\citenumfont}
% The \pkg{natbib} command \cmd{\citenum} is undefined and thus gives an
% error, but the \cmd{\citenumfont} declaration is harmless and can stay.
%    \begin{macrocode}
\let\citenumfont=\@empty
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bibpunct}
% This sets various punctuation commands equal to its arguments.
% In contrast with the \pkg{natbib} implementation, the 5th argument
% (4th mandatory argument) is ignored, because \pkg{apacite} currently
% only supports author-year citations. Also, in contrast to the
% \pkg{natbib} implementation, this does not disable subsequent
% \cmd{\bibstyle} commands.
%    \begin{macrocode}
\newcommand\bibpunct[7][, ]%
  {\gdef\BBOP{#2}\gdef\BBCP{#3}\gdef\BBC{#4}%
   \gdef\BBAY{#6}\gdef\BBYY{#7}\gdef\BBN{#1}%
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bibstyle@apacite}
% \begin{macro}{\bibstyle@apa}
% These commands define the punctuation to be the \pkg{apacite}
% default. This is normally not very useful, because this only
% defines things as they are by default in \pkg{apacite} anyway, but
% it may be useful as a simple reset if different parts of the
% document need to use different styles.
%    \begin{macrocode}
\newcommand\bibstyle@apacite{%
    \bibpunct[, ]{(}{)}{; }{a}{, }{, }%
    \setlength{\bibhang}{2.5em}%
    \setlength{\bibsep}{0pt}%
}
\let\bibstyle@apa=\bibstyle@apacite
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\citestyle}
% This command selects a predefined citation punctuation style.
% In contrast to the \pkg{natbib} implementation, this is not
% deactivated at |\begin{document}|, so it's possible to change
% to a different style in the document body.
%    \begin{macrocode}
\newcommand\citestyle[1]{\csname bibstyle@#1\endcsname}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setcitestyle}
% This sets individual punctuation parameters. Adapted from
% \fname{natbib.dtx}.
%    \begin{macrocode}
\newcommand\setcitestyle[1]{%
 \@for\@tempa:=#1\do
 {\def\@tempb{round}\ifx\@tempa\@tempb
    \renewcommand\BBOP{(}\renewcommand\BBCP{)}\fi
  \def\@tempb{square}\ifx\@tempa\@tempb
    \renewcommand\BBOP{[}\renewcommand\BBCP{]}\fi
  \def\@tempb{angle}\ifx\@tempa\@tempb
    \renewcommand\BBOP{$<$}\renewcommand\BBCP{$>$}\fi
  \def\@tempb{curly}\ifx\@tempa\@tempb
    \renewcommand\BBOP{\{}\renewcommand\BBCP{\}}\fi
  \def\@tempb{semicolon}\ifx\@tempa\@tempb
    \renewcommand\BBC{; }\fi
  \def\@tempb{colon}\ifx\@tempa\@tempb
    \renewcommand\BBC{: }\fi
  \def\@tempb{comma}\ifx\@tempa\@tempb
    \renewcommand\BBC{, }\fi
%    \end{macrocode}
% \pkg{apacite} supports author-year citation only, so |authoryear|,
% |numbers|, and |super| are ignored. (Alternatively, we could have
% issued an error for |numbers| and |super|.)
%    \begin{macrocode}
  \def\@tempb{authoryear}\ifx\@tempa\@tempb
    \fi
  \def\@tempb{numbers}\ifx\@tempa\@tempb
    \fi
  \def\@tempb{super}\ifx\@tempa\@tempb
    \fi
  \expandafter\APAC@find@eq\@tempa=\relax\@nil
  \if\@tempc\relax\else
    \expandafter\APAC@rem@eq\@tempc
    \def\@tempb{open}\ifx\@tempa\@tempb
     \xdef\BBOP{\@tempc}\fi
    \def\@tempb{close}\ifx\@tempa\@tempb
     \xdef\BBCP{\@tempc}\fi
    \def\@tempb{aysep}\ifx\@tempa\@tempb
     \xdef\BBAY{\@tempc}\fi
    \def\@tempb{yysep}\ifx\@tempa\@tempb
     \xdef\BBYY{\@tempc}\fi
    \def\@tempb{notesep}\ifx\@tempa\@tempb
     \xdef\BBN{\@tempc}\fi
    \def\@tempb{citesep}\ifx\@tempa\@tempb
     \xdef\BBC{\@tempc}\fi
  \fi
 }%
}
\def\APAC@find@eq#1=#2\@nil{\def\@tempa{#1}\def\@tempc{#2}}
\def\APAC@rem@eq#1={\def\@tempc{#1}}
%    \end{macrocode}
% \end{macro}
%
% End of \pkg{natbib} emulation code.
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \subsubsection{Using \pkg{apacite} with \pkg{natbib} for citations}
%
% If requested, this section loads \pkg{natbib} with the options
% \pkgoption{longnamesfirst} and \pkgoption{sort}, which are
% necessary for APA-style adherence. Then, we redefine some
% \pkg{natbib} and \pkg{apacite} commands to improve APA adherence of
% the combination. We also define a few additional commands that
% \pkg{natbib} did not implement, but that fit the scheme and serve
% some useful purpose for APA style citation. Defer loading this part
% until the end of the package, after loading the bibliography part.
% (This needs to be fixed.)
%
%    \begin{macrocode}
\newcommand{\BBA@nat}{%
  \ifNAT@swa
%    \end{macrocode}
% parenthetical; ``\&''
%    \begin{macrocode}
    \BBAA
  \else
%    \end{macrocode}
% in-text; ``and''
%    \begin{macrocode}
    \BBAB
  \fi
}
\if@APAC@natbib@apa
  \AtEndOfPackage{%
    \if@sectionbibdefault
      \RequirePackage[longnamesfirst,sort]{natbib}
    \else\if@sectionbib
      \RequirePackage[longnamesfirst,sort,sectionbib]{natbib}
    \else
      \RequirePackage[longnamesfirst,sort]{natbib}
    \fi\fi
%    \end{macrocode}
%
% \begin{macro}{\NAT@parse@date}
% Redefine \pkg{natbib}'s date parsing function to avoid dropping the
% year in ``(2008a, 2008b)''.
%    \begin{macrocode}
\renewcommand\NAT@parse@date{}
\def\NAT@parse@date#1#2#3#4#5#6@@{%
    \def\NAT@year{#1#2}\def\NAT@exlab{{#3}}}
%    \end{macrocode}
% \end{macro}
% ``and'' vs.\ ``\&''.
%    \begin{macrocode}
\DeclareRobustCommand{\BBA}{\BBA@nat}
%    \end{macrocode}
% In the reflist ``\&''.
%    \begin{macrocode}
\let\orig@nat@@lbibitem\@lbibitem
\def\@lbibitem{\NAT@swatrue\orig@nat@@lbibitem}
%    \end{macrocode}
%
% Make sure we're in parenthetical mode when in \cmd{\citetext}
%    \begin{macrocode}
\renewcommand\citetext[1]{\NAT@open\begingroup\NAT@swatrue
  #1\endgroup\NAT@close}
%    \end{macrocode}
%
% \begin{macro}{\citeauthort}
% \begin{macro}{\citeauthorp}
% \begin{macro}{\citefullauthort}
% \begin{macro}{\citefullauthorp}
% \begin{macro}{\Citeauthort}
% \begin{macro}{\Citeauthorp}
% \begin{macro}{\Citefullauthort}
% \begin{macro}{\Citefullauthorp}
% There's only one \cmd{\citeauthor}, but we need to distinguish
% between parenthetical and in-text. The most common is in-text, so
% let \cmd{\citeauthor} be the in-text one, but define
% \cmd{\citeauthort} to be the same, and add \cmd{\citeauthorp}.
%    \begin{macrocode}
\DeclareRobustCommand\citeauthort{\citeauthor}
\DeclareRobustCommand\Citeauthort{\Citeauthor}
\DeclareRobustCommand\citeauthorp
   {\begingroup\NAT@swatrue\let\NAT@ctype\@ne\NAT@parfalse
    \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
\DeclareRobustCommand\Citeauthorp
   {\begingroup\NAT@swatrue\let\NAT@ctype\@ne\NAT@parfalse
     \let\NAT@up\NAT@Up
    \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
%    \end{macrocode}
% For completeness of the system.
%    \begin{macrocode}
\DeclareRobustCommand{\Citefullauthor}{\Citeauthor*}
\DeclareRobustCommand{\citefullauthort}{\citeauthort*}
\DeclareRobustCommand{\citefullauthorp}{\citeauthorp*}
\DeclareRobustCommand{\Citefullauthort}{\Citeauthort*}
\DeclareRobustCommand{\Citefullauthorp}{\Citeauthorp*}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\bibstyle@apacite}
% \begin{macro}{\bibstyle@apa}
% Other settings. I think the \pkg{natbib} defaults are good, but
% let's define this explicitly and allow the usual \pkg{apacite}
% customization options.
%    \begin{macrocode}
\providecommand\bibstyle@apacite{%
%    \end{macrocode}
% \pkg{natbib} is inconsistent with adding space.
%    \begin{macrocode}
    \renewcommand{\BBAY}{,}%
    \renewcommand{\BBC}{;}%
    \renewcommand{\BBYY}{,}%
    \bibpunct[\BBN ]{\BBOP }{\BBCP }{\BBC }{a}{\BBAY }{\BBYY }%
    \setlength{\bibhang}{2.5em}%
    \setlength{\bibsep}{0pt}%
}
\providecommand\bibstyle@apa{\bibstyle@apacite}
\citestyle{apacite}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% End of \pkg{natbib}--\pkg{apacite} code.
%    \begin{macrocode}
}% end \cmd{\AtEndOfPackage}
\fi
%    \end{macrocode}
%
% \subsubsection{Shared code for \pkgoption{natbibemu} and
% \pkgoption{natbibapa}}
%
% This section defines some extensions of \pkg{natbib} that are
% useful with both the \pkgoption{natbibemu} and \pkgoption{natbibapa}
% options.
%
%    \begin{macrocode}
\if@APAC@any@natbib
%    \end{macrocode}
%
% \begin{macro}{\maskcitations}
% \begin{macro}{\unmaskcitations}
% \begin{macro}{\masknocite}
% \begin{macro}{\maskcitep}
% \begin{macro}{\maskcitealp}
% \begin{macro}{\maskcitet}
% \begin{macro}{\maskcitealt}
% \begin{macro}{\maskciteauthor}
% \begin{macro}{\maskcitefullauthor}
% \begin{macro}{\maskciteyearpar}
% \begin{macro}{\maskciteyear}
% \begin{macro}{\maskcite}
% \begin{macro}{\maskcitetalias}
% \begin{macro}{\maskcitepalias}
% \begin{macro}{\maskCitet}
% \begin{macro}{\maskCitep}
% \begin{macro}{\maskCitealt}
% \begin{macro}{\maskCitealp}
% \begin{macro}{\maskCiteauthor}
% \begin{macro}{\maskcitenum}
% \begin{macro}{\maskciteauthort}
% \begin{macro}{\maskciteauthorp}
% \begin{macro}{\maskCitefullauthor}
% \begin{macro}{\maskCiteauthort}
% \begin{macro}{\maskCiteauthorp}
% \begin{macro}{\masktext}
% These commands allow masking of (self-)citations  for a masked
% review.
% The \cmd{maskcitations} command defines the masked citation commands;
% \cmd{unmaskcitations} does the same, but lets them be equal to the
% non-mask versions. The advantage of putting these definitions within
% a command is that we can switch between masked and unmasked within
% the same document. This is not likely to be used very often in
% practice, but is useful for writing tutorials.
%    \begin{macrocode}
\newcommand{\maskcitations}{%
    \def\masknocite##1{}%
    \DeclareRobustCommand\maskcite{%
        \@ifnextchar[%     % ]
            {\mask@cite}%
            {\mask@cite[]}%
    }%
    \def\mask@cite[##1]{%
        \@ifnextchar[%      % ]
            {\mask@@cite[##1]}%
            {\mask@@cite[##1][]}%
    }%
    \def\mask@@cite[##1][##2]##3{%
        \relax
%    \end{macrocode}
% Count number of masked references.
%    \begin{macrocode}
        \setcounter{maskedRefs}{0}%
        \@for\@citeb:=##3\do{%
            \addtocounter{maskedRefs}{1}%
        }%
        \ifnum\value{maskedRefs} = 1%
            \onemaskedcitationmsg{\themaskedRefs}%
        \else
            \maskedcitationsmsg{\themaskedRefs}%
        \fi
    }%
%    \end{macrocode}
% Let all other citation commands be identical to \cmd{\maskcite}.
% We could try to do fancy things with parentheses, but it's unlikely
% we will be able to cover all cases of interest, and users can easily
% change their document if they don't like how this comes out.
%    \begin{macrocode}
    \let\maskcitep\maskcite
    \let\maskcitealp\maskcite
    \let\maskcitet\maskcite
    \let\maskcitealt\maskcite
    \let\maskciteauthor\maskcite
    \let\maskcitefullauthor\maskcite
    \let\maskciteyearpar\maskcite
    \let\maskciteyear\maskcite
    \let\maskcitetalias\maskcite
    \let\maskcitepalias\maskcite
    \let\maskCitet\maskcite
    \let\maskCitep\maskcite
    \let\maskCitealt\maskcite
    \let\maskCitealp\maskcite
    \let\maskCiteauthor\maskcite
    \let\maskcitenum\maskcite
    \let\maskciteauthort\maskcite
    \let\maskciteauthorp\maskcite
    \let\maskCitefullauthor\maskcite
    \let\maskCiteauthort\maskcite
    \let\maskCiteauthorp\maskcite
%    \end{macrocode}
% A user command to flexibly mask or unmask certain pieces of text.
% An environment is technically more stable than a command, but less
% intuitive for users. Under masking, this command prints the optional
% alternative text |#1|, which defaults to nothing.
%    \begin{macrocode}
    \DeclareRobustCommand{\masktext}[2][]{##1}%
}
%    \end{macrocode}
%
% The ``mask'' citation commands revert to the same commands without
% ``mask'' if the \pkgoption{mask} option is not set.
%    \begin{macrocode}
\newcommand{\unmaskcitations}{%
    \let\masknocite\nocite
    \let\maskcitep\citep
    \let\maskcitealp\citealp
    \let\maskcitet\citet
    \let\maskcitealt\citealt
    \let\maskciteauthor\citeauthor
    \let\maskcitefullauthor\citefullauthor
    \let\maskciteyearpar\citeyearpar
    \let\maskciteyear\citeyear
    \let\maskcite\cite
    \let\maskcitetalias\citetalias
    \let\maskcitepalias\citepalias
    \let\maskCitet\Citet
    \let\maskCitep\Citep
    \let\maskCitealt\Citealt
    \let\maskCitealp\Citealp
    \let\maskCiteauthor\Citeauthor
    \let\maskcitenum\citenum
    \let\maskciteauthort\citeauthort
    \let\maskciteauthorp\citeauthorp
    \let\maskCitefullauthor\Citefullauthor
    \let\maskCiteauthort\Citeauthort
    \let\maskCiteauthorp\Citeauthorp
%    \end{macrocode}
% Unmasked, this command prints the mandatory second argument |#2|.
%    \begin{macrocode}
    \DeclareRobustCommand{\masktext}[2][]{##2}
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% End of \pkg{natbib} code.
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% This is part of the shared code, but has to be put after loading
% of \pkg{natbib}, so we'll put it here for the moment.
%    \begin{macrocode}
\if@APAC@anycitation
    \AtEndOfPackage{%
        \if@APAC@mask
            \maskcitations
        \else
            \unmaskcitations
        \fi
    }%
\fi
%    \end{macrocode}
%
% \subsubsection{Meta analysis}
%
% To my knowledge. \cmd{\nocitemeta} is not defined by any other citation
% package, so we'll provide it here regardless of the citation option
% chosen.
% \begin{macro}{\definemetaflag}
% \begin{macro}{\nocitemeta}
% This induces an entry in the reference list, but not in the text, and
% compared to \cmd{\nocite} defines an additional flag that indicates that the
% reference has been used in the meta-analysis reported. The construction
% with \cmd{\definemetaflag} is necessary to support \cmd{\nocitemeta} in
% an appendix \emph{after} the reference list. However, the previous version
% did not require the |\if@filesw|, which suggests that that would work if
% we can't write to the \fname{.aux} file, whereas the current one wouldn't.
% I don't know under what conditions this would happen or be useful, but it
% seems extremely rare. If somebody complains, I'll make a fix.
%    \begin{macrocode}
\def\definemetaflag#1{%
  \@bsphack
%    \end{macrocode}
% Define the note that precedes the reference list.
%    \begin{macrocode}
  \expandafter\global\expandafter\def
    \csname APAC@metaprenote@\APAC@extra@b@citeb\endcsname{%
      \APACmetaprenote}%
  \@for\@citeb:=#1\do{%
    \edef\@citeb{\expandafter\@firstofone\@citeb}%
%    \end{macrocode}
% Define the meta-analysis flag for the current item.
%    \begin{macrocode}
    \@ifundefined{flagmeta@\@citeb\APAC@extra@b@citeb}%
      {\global\expandafter
       \def\csname flagmeta@\@citeb\APAC@extra@b@citeb\endcsname{DUMMY}%
      }%
      {}%
  }%
  \@esphack
}
\def\nocitemeta#1{%
    \nocite{#1}%
    \@bsphack
    \if@filesw
      \@for\@citeb:=#1\do{%
        \edef\@citeb{\expandafter\@firstofone\@citeb}%
        \immediate\write
          \@newciteauxhandle{\string\definemetaflag{\@citeb}}%
    }%
    \fi
    \@esphack
    \@restore@auxhandle
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Bibliography structure}
%
% Here we define commands and environments that handle the structure of the
% reference list, various global style parameters, and the communication with
% the citation commands. Commands for detailed aspects of the entries
% themselves are defined below.
%
% \begin{macro}{\bibnewpage}
% Macro for starting a new page before the bibliography, if requested.
%    \begin{macrocode}
\def\bibnewpage{\clearpage}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@biblabel}
% No labels in the bibliography.
%    \begin{macrocode}
\def\@biblabel#1{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@lbibitem}
% Label-bibitem. If \pkg{natbib} is loaded after \pkg{apacite} (or
% \pkg{apacite} is loaded with the \pkgoption{natbibapa} option),
% this is overwritten. I should introduce an option that disables
% \pkg{apacite}'s bibliography-defining commands and/or senses whether
% \pkg{natbib} is loaded, so this is never defined in such cases.
%    \begin{macrocode}
\def\@lbibitem[#1]#2{%
    \def\BBA{\BBAA}%    ``\&''
%    \end{macrocode}
%   For compatibility with \pkg{chapterbib}, \pkg{bibunits}, \pkg{backref}, and
%   \pkg{hyperref}. Adapted from \fname{natbib.dtx}.
%    \begin{macrocode}
    \item[\hyper@natanchorstart{#2\APAC@extra@b@citeb}%
          \@biblabel{#1}%
          \hyper@natanchorend]%
    \if@filesw{%
        \def\BBA{\string\BBA}%
        \let\protect\noexpand
%    \end{macrocode}
%       \pkg{bibunits} redefines \cmd{\bibcite} through \cmd{\AtBeginDocument}
%       in a way that is incompatible with \pkg{apacite}'s definition. The
%       simplest way to get things working automatically seems to be
%       introducing the parallel \cmd{\APACbibcite} command. This should also
%       solve many other compatibility problems.
%    \begin{macrocode}
        \immediate\write\@newciteauxhandle{\string\bibcite{#2}{#1}}%
        \immediate\write\@newciteauxhandle{\string\APACbibcite{#2}{#1}}%
        \def\BBA{\BBAA}%
    }%
    \fi
    \ignorespaces
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACbibcite}
% \begin{macro}{\bibcite}
% These commands pass the author-year information from the reference list to
% the citation commands. See above for the necessity for \cmd{\APACbibcite}.
%    \begin{macrocode}
\def\APACbibcite#1#2{%
  \global\expandafter
    \def\csname b@#1\APAC@extra@binfo\endcsname{#2}%        names
  \global\expandafter
    \def\csname Y@#1\APAC@extra@binfo\endcsname{\@year@#2}% year
}
%    \end{macrocode}
% We don't need this one anymore, but other packages may use it.
%    \begin{macrocode}
\let\bibcite\APACbibcite
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\st@rtbibsection}
% Start a new section for the reference list.
%    \begin{macrocode}
\def\st@rtbibsection{%
  \@bibnewpage%           start a new page if desired
  \if@numberedbib%
    \section{\refname}%   e.g.,   6. References
  \else%
    \section*{\refname}%  e.g.,   References
    \if@tocbib%
      \addcontentsline{toc}{section}{\refname}%
    \fi%
%    \end{macrocode}
%   Ideally, we'd use something like |\sectionmark{{\refname}}|, so that
%   user-defined page heading styles are respected. But this does not work
%   properly, because it generates section numbers. Therefore, we define the
%   complete headings here. I need to find a better solution for this.
%    \begin{macrocode}
    \@ifundefined{chapter}
      {\@mkboth{{\refname}}{{\refname}}}%
      {\markright{{\refname}}}%
  \fi%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\st@rtbibchapter}
% Start a new chapter for the reference list.
%    \begin{macrocode}
\def\st@rtbibchapter{%
%    \end{macrocode}
% Here no \cmd{\@bibnewpage}, because it is assumed that the \cmd{\chapter}
% starts a new page.
%    \begin{macrocode}
  \if@numberedbib%
    \chapter{\bibname}%   e.g.,   6. References
  \else%
    \chapter*{\bibname}%   e.g.,   References
    \if@tocbib%
      \addcontentsline{toc}{chapter}{\bibname}%
    \fi%
%    \end{macrocode}
%   Again, \cmd{\chaptermark} and \cmd{\sectionmark} don't work properly, so
%   define headings at a lower level.
%    \begin{macrocode}
    \@mkboth{{\bibname}}{{\bibname}}%
  \fi%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{thebibliography}
% This environment contains the reference list. For historical reasons, it is
% defined in the plain \TeX{} way through definition of the
% \cmd{\thebibliography} and \cmd{\endthebibliography} macros instead of
% \cmd{\renewenvironment}.
%    \begin{macrocode}
\def\thebibliography#1{%
%    \end{macrocode}
% If \cmd{\chapter} is not defined, start a bibliography section.
%    \begin{macrocode}
  \@ifundefined{chapter}%
    {\st@rtbibsection}%
%    \end{macrocode}
%   Else, chapter is defined. Check first whether an explicit option has been
%   chosen.
%    \begin{macrocode}
    {\if@sectionbibdefault
%    \end{macrocode}
%      No explicit option chosen, so we have to speculate. If \cmd{\mainmatter}
%      is not defined (typically a report), assume that the bibliography is
%      a chapter. If \cmd{\mainmatter} is defined, a bibliography in the
%      main matter is typically a chapter-specific one, so generate a
%      bibliography section. A bibliography in the back matter is most likely
%      a global one, so then generate a bibliography chapter.
%    \begin{macrocode}
       {\@ifundefined{@mainmatterfalse}%
          {\st@rtbibchapter}%
          {\if@mainmatter
             \st@rtbibsection
           \else
             \st@rtbibchapter
           \fi
          }%
       }%
%    \end{macrocode}
%      If an explicit option has been chosen, simply use this.
%    \begin{macrocode}
     \else
        \if@sectionbib
          \st@rtbibsection
        \else
          \st@rtbibchapter
        \fi
     \fi
    }%
%    \end{macrocode}
% Insert some code between the chapter or section heading and the reference
% list. \cmd{\bibliographytypesize} will typically be used for some font
% settings and \cmd{\bibliographyprenote} for explanatory text, but this is
% up to the user. The ``metaprenote'' is a fixed text indicating that
% marked references are included in the meta-analysis reported.
%    \begin{macrocode}
  \bibliographytypesize % e.g., to put the bibliography in \small type
  \bibliographyprenote  % some explanatory note before the references
  \@ifundefined{APAC@metaprenote@\APAC@extra@b@citeb}%
    {}% skip
    {\csname APAC@metaprenote@\APAC@extra@b@citeb\endcsname}%
%    \end{macrocode}
% Initialize the list environment that holds the reference list.
%    \begin{macrocode}
  \list{\relax}{\labelsep=\biblabelsep
%               \parskip\z@ \@plus .3\p@\relax
                \parsep=\bibparsep
                \itemsep=\bibitemsep
                \leftmargin=\bibleftmargin
                \itemindent=\bibindent}% changed to cope with 4th ed.
%    \end{macrocode}
%  \cmd{\newblock} is inserted between ``blocks'' of a reference entry and
%  inserts some stretchable and shrinkable extra space between the blocks.
%    \begin{macrocode}
   \def\newblock{\hskip .11em plus .33em minus .07em}%
   \sloppy\clubpenalty4000\widowpenalty4000
   \sfcode`\.=1000\relax %'
%    \end{macrocode}
%  For compatibility with \pkg{bibtopic}.
%    \begin{macrocode}
   \bt@beg@thb@hook
%    \end{macrocode}
%  To overrule \pkg{backref}.
%    \begin{macrocode}
   \APACrestorebibitem
}
\def\endthebibliography{%
%    \end{macrocode}
%  For compatibility with \pkg{bibtopic}.
%    \begin{macrocode}
   \bt@end@thb@hook
%    \end{macrocode}
%  Warning if no item was included in the list and return to normal font size.
%  If \cmd{\bibliographytypesize} includes other formatting as well, the user
%  has to reset this explicitly after the bibliography, at least if there is
%  text after it.
%    \begin{macrocode}
   \def\@noitemerr{%
       \@latex@warning{Empty `thebibliography' environment}%
   }%
   \endlist\normalsize
}
%    \end{macrocode}
% \end{environment}
%
% \subsection{Reference list formatting}
%
% Traditionally, the reference list formatting is almost completely done by
% the bibliography style (\fname{.bst} file). Modeled after its predecessor,
% \pkg{theapa}, \pkg{apacite} has always supported some possibilities for
% customization through redefinable macros in the reference list. Due to my
% own customization needs, requests by users, and the language support, an
% increasing amount of reference list formatting is handled in this way. This
% section defines the default implementation of these macros, which users
% thus can redefine.
%
% \begin{macro}{\@connect@with@commas}
% An auxiliary function: Make a comma-separated output list of the input,
% recognizing empty arguments. Must be called with one argument, and the
% argument contains a comma-separated list of elements. The elements of this
% should generally be enclosed in braces.
%    \begin{macrocode}
\def\@connect@with@commas#1{%
  \def\@comma@space{\unskip, }%
  \let\@connect@string\relax
%    \end{macrocode}
% Loop over elements.
%    \begin{macrocode}
  \@for\@element@:=#1\do{%
%    \end{macrocode}
%    Commas should only be inserted if both sides are nonempty.
%    \begin{macrocode}
     \ifx\@empty\@element@%
     \else
%    \end{macrocode}
%      Not empty: insert connect string (nothing for the first nonempty
%      element, a comma and space afterwards).
%    \begin{macrocode}
       \@connect@string\@element@%
       \let\@connect@string\@comma@space
     \fi
  }%
  \let\@connect@string\@undefined
  \let\@comma@space\@undefined
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACmetastar}
% \begin{macro}{\APACinsertmetastar}
% Insert an asterisk before the names in the reference list for entries that
% are used in a meta-analysis.
%    \begin{macrocode}
\newcommand{\APACmetastar}{\ensuremath{{}^\ast}}
\def\APACinsertmetastar#1{%
  \@for\@citeb:=#1\do{%
    \edef\@citeb{\expandafter\@firstofone\@citeb}%
    \@ifundefined{flagmeta@\@citeb\APAC@extra@b@citeb}%
      {}% skip
      {{\APACmetastar}}%
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{environment}{APACrefauthors}
% An environment that allows some limited customization of author
% formatting in the reference list. In this implementation customization
% is handled through the \cmd{\APACrefauthstyle} macro, which allows some
% style definition, in particular font changes such as \cmd{\sc}.
%    \begin{macrocode}
\newenvironment{APACrefauthors}{%
  \begingroup \APACrefauthstyle
}{\endgroup }
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\APACrefYear}
% Formatting of the year in the reference list. Note that instead of redefining
% this command, one can also redefine the parentheses themselves. The argument
% should never be empty. The companion macro \cmd{\APACrefYearMonthDay} is
% defined below in the language-specific section.
%    \begin{macrocode}
\newcommand{\APACrefYear}[1]{%
  {\BBOP}{#1}{\BBCP}%
}
%    \end{macrocode}
% \end{macro}
%
% Title formatting. In these, |#1| is the capitalized title and |#2| is the
% sentence-case title.
%
% \begin{macro}{\APACrefatitle}
% Article title (roman, not capitalized).
%    \begin{macrocode}
\newcommand{\APACrefatitle}[2]{#2}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\APACrefbtitle}
% Book title (italic, not capitalized).
%    \begin{macrocode}
\newcommand{\APACrefbtitle}[2]{\Bem{#2}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\APACrefaetitle}
% English translation of a foreign article title (bracketed, roman, not
% capitalized).
%    \begin{macrocode}
\newcommand{\APACrefaetitle}[2]{[#2]}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\APACrefbetitle}
% English translation of a foreign book title (bracketed, roman, not
% capitalized).
%    \begin{macrocode}
\newcommand{\APACrefbetitle}[2]{[#2]}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACjournalVolNumPages}
% Journal, volume, number, pages
% (|#1| = journal, |#2| = volume, |#3| = number, |#4| = formatted pages).
%    \begin{macrocode}
\newcommand{\APACjournalVolNumPages}[4]{%
  \Bem{#1}%             journal
  \ifx\@empty#2\@empty
  \else
    \unskip, \Bem{#2}%  volume
  \fi
  \ifx\@empty#3\@empty
  \else
    \unskip({#3})%      issue number
  \fi
  \ifx\@empty#4\@empty
  \else
    \unskip, {#4}%      pages
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACaddressPublisher}
% \begin{macro}{\APACaddressInstitution}
% \begin{macro}{\APACaddressSchool}
% Address and publisher, institution, or school (|#1| = address,
% |#2| = publisher).
%    \begin{macrocode}
\DeclareRobustCommand{\APACaddressPublisher}[2]{%
  \ifx\@empty#1\@empty
    \ifx\@empty#2\@empty
    \else
      {#2}%                 publisher
    \fi
  \else
    {#1}%                   address
    \ifx\@empty#2\@empty
    \else
      \unskip: {#2}%        publisher
    \fi
  \fi
}
\let\APACaddressInstitution\APACaddressPublisher
\DeclareRobustCommand{\APACaddressSchool}[2]{%
  \ifx\@empty#2\@empty
    \ifx\@empty#1\@empty
    \else
      {#1}%                 address
    \fi
  \else
    {#2}%                   school
    \ifx\@empty#1\@empty
    \else
      \unskip, {#1}%        address
    \fi
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APACtypeAddressSchool}
% Type, school, and address in parenthese after the title in a thesis.
%    \begin{macrocode}
\DeclareRobustCommand{\APACtypeAddressSchool}[3]{%
  \ifx\@empty#1\@empty
    \ifx\@empty#3\@empty
      \ifx\@empty#2\@empty
      \else
        ({#2})%               address
      \fi
    \else
      ({#3}%                  school
      \ifx\@empty#2\@empty
      \else
        \unskip, {#2}%        address
      \fi
      )%
    \fi
  \else
    ({#1}%                    type
    \ifx\@empty#3\@empty
      \ifx\@empty#2\@empty
      \else
        \unskip, {#2}%        address
      \fi
    \else
      \unskip, {#3}%          school
      \ifx\@empty#2\@empty
      \else
        \unskip, {#2}%        address
      \fi
    \fi
    )%
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACaddressPublisherEqAuth}
% \begin{macro}{\APACaddressInstitutionEqAuth}
% Address and publisher/institution if the latter is also the author.
% (|#1| = address, |#2| = publisher).
%    \begin{macrocode}
\newcommand{\APACaddressPublisherEqAuth}[2]{%
  \ifx\@empty#1\@empty
    {\BAuthor{}}% Publisher formatted as ``Author''
  \else
    {#1\unskip: \BAuthor{}}% Address: Author
  \fi
}
\let\APACaddressInstitutionEqAuth\APACaddressPublisherEqAuth
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APAChowpublished}
% Formatting of the \fieldname{howpublished} field. The
% \cmd{\APAChowpublished} macro is only inserted in the \fname{.bbl} file if
% the argument is nonempty. Because we don't want any special formatting, and
% |\def\APAChowpublished#1{#1}| leads to problems with hash marks (`|#|') in
% url's that may be present in \fieldname{howpublished}, we simply pretend
% that \cmd{\APAChowpublished} does not have an argument and does nothing.
%    \begin{macrocode}
\let\APAChowpublished\relax
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{APACrefURL}
% URL formatting. Use an environment instead of a macro to avoid some problems
% with url's as arguments of macros. The optional argument is the date that
% the url was last checked.
%    \begin{macrocode}
\newenvironment{APACrefURL}[1][]{%
  \ifx\@empty#1\@empty
    \BRetrievedFrom % Retrieved from
  \else
    \BRetrieved{#1}%  Retrieved <date>, from
  \fi
}{}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{APACrefDOI}
% DOI formatting. Use an environment instead of a macro to avoid some problems
% with url's as arguments of macros.
%    \begin{macrocode}
\newenvironment{APACrefDOI}{%
  \global\let\old@doi\doi
  \if@doi
    \doiprefix
  \else
%    \end{macrocode}
% Suppression of DOIs. For non-APA styles.
%    \begin{macrocode}
    \global\let\doi\@gobble
  \fi
%    \end{macrocode}
% Restore definition of \cmd{\doi}, in case a user wants to use this
% command explicitly.
%    \begin{macrocode}
  }{\global\let\doi\old@doi }
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{APACrefURLmsg}
% URLs of messages.
%    \begin{macrocode}
\newenvironment{APACrefURLmsg}{%
  \BMsgPostedTo
}{}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\APACorigED}
% \begin{macro}{\APACorigEDS}
% Original editor(s) for reprints and translations.
%    \begin{macrocode}
\newcommand{\APACorigED}[1]{%
  \ifx\@empty#1\@empty
  \else
    \Bby\ {#1}, \BED{}% ``by E. D. Itor (Ed.)''
  \fi
}
\newcommand{\APACorigEDS}[1]{%
  \ifx\@empty#1\@empty
  \else
    \Bby\ {#1}, \BEDS{}% ``by E. D. Itor \& A. N. Other (Eds.)''
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APACbVolEdTR}
% Volume, edition, type, number, for a technical report (|#1| = formatted
% edition + volume, |#2| = formatted technical report type + number).
%    \begin{macrocode}
\newcommand{\APACbVolEdTR}[2]{%
  \ifx\@empty#1\@empty
    \ifx\@empty#2\@empty
    \else
      {(#2)}%            (Technical Report No.\ <no>)
    \fi
  \else
    ({#1}%               (2nd ed., Vol.~1
    \ifx\@empty#2\@empty
    \else
      \unskip; {#2}%     ; Technical Report No.\ <no>
    \fi
    )%                   Final parenthesis.
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACbVolEdTRpgs}
% Volume, edition, type, number, pages for an \entryname{@intechreport}.
% Arguments: |#1| = formatted edition + volume, |#2| = formatted technical
% report type + number, |#3| = formatted pages.
%    \begin{macrocode}
\newcommand{\APACbVolEdTRpgs}[3]{%
  \ifx\@empty#1\@empty
    \ifx\@empty#2\@empty
      \ifx\@empty#3\@empty
      \else
        {(#3)}%% (pp. 10--30)
      \fi
    \else
      %% (Technical Report No.\ <no>, pp. 10--30)
      (\@connect@with@commas{{#2},{#3}})%
    \fi
  \else
    ({#1}%                  (2nd ed., Vol.~1
    \ifx\@empty#2\@empty
      \ifx\@empty#3\@empty
      \else
        \unskip; {#3}%      ; pp. 10--30
      \fi
    \else
      %%                    ; Technical Report No.\ <no>, pp. 10--30
      \unskip; \@connect@with@commas{{#2},{#3}}%
    \fi
    )%                      Final parenthesis.
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% Various note formatting functions.
%
% \begin{macro}{\APACrefnote}
% Only a note.
%    \begin{macrocode}
\newcommand{\APACrefnote}[1]{%
  \ifx\@empty#1\@empty
  \else
    ({#1})%
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACorigyearnote}
% Original year + optional note (|#1| = year, |#2| =  note).
%    \begin{macrocode}
\newcommand{\APACorigyearnote}[2]{%
  \ifx\@empty#1\@empty
%    \end{macrocode}
%   Original year empty: format note.
%    \begin{macrocode}
    \APACrefnote{#2}%
  \else
%    \end{macrocode}
%   Check for \cmd{\bibnodate}. I think the following command does not check
%   whether |#1| = `\cmd{\bibnodate}', but expands them; but that should also
%   be OK and saves a lot of juggling with \cmd{\expandafter} commands.
%    \begin{macrocode}
    \ifx\bibnodate#1\@empty
%    \end{macrocode}
%     Original year unknown: Format (only) note.
%    \begin{macrocode}
      \APACrefnote{#2}%
    \else
%    \end{macrocode}
%     Original year has been given: ``Original work published''.
%    \begin{macrocode}
      (\BOWP{} {#1}%
%    \end{macrocode}
%     Insert note.
%    \begin{macrocode}
      \ifx\@empty#2\@empty
      \else
        \unskip; {#2}%
      \fi
%    \end{macrocode}
%    Final parenthesis.
%    \begin{macrocode}
      )%
    \fi
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACorigjournalnote}
% Original journal + optional note.
% Arguments: |#1| = year, |#2| = journal, |#3| = volume, |#4| = issue number,
%            |#5| = formatted pages, |#6| = note.
%    \begin{macrocode}
\newcommand{\APACorigjournalnote}[6]{%
  (\BREPR{} %          ``(Reprinted from '' (note the space)
  \Bem{#2}%            Journal (should not be empty)
  \ifx\@empty#1\@empty
  \else
    \unskip, {#1}%     , year
  \fi
  \ifx\@empty#3\@empty
  \else
    \unskip, \Bem{#3}% , volume
  \fi
  \ifx\@empty#4\@empty
  \else
    \unskip{[#4]}%     [issue number]
  \fi
  \ifx\@empty#5\@empty
  \else
    \unskip, {#5}%     , pages
  \fi
  \ifx\@empty#6\@empty
  \else
    \unskip; {#6}%     ; note
  \fi
  )%                   Final parenthesis
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACorigbooknote}
% Original book + optional note. Arguments:
% |#1| = year, |#2| = formatted editor, |#3| = formatted title,
% |#4| = formatted edition, |#5| = formatted volume, |#6| = formatted pages,
% |#7| = address, |#8| = publisher, |#9| = note.
%    \begin{macrocode}
\newcommand{\APACorigbooknote}[9]{%
    %% ``(Reprinted from '' (note the space)
  (\BREPR{} %
    %% Title, edition, volume, pages, editor, year, address: publisher
%    \end{macrocode}
%   These should not all be empty, but this is not checked here, because it's
%   done in the \fname{.bst} file.
%    \begin{macrocode}
  \@connect@with@commas{%
    {#3},{#4},{#5},{#6},{#2},{#1},{\APACaddressPublisher{#7}{#8}}%
  }%%
  \ifx\@empty#9\@empty
  \else
    ; #9%%              ; note
  \fi
  )%                    Final parenthesis.
}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{APACrefannotation}
% Annotations; for annotated bibliographies. Cf.~\citeA[pp.~810--811]{TLC2}.
%    \begin{macrocode}
\newenvironment{APACrefannotation}{%
  \begin{quotation}\noindent\ignorespaces
}{\end{quotation}}
%    \end{macrocode}
% \end{environment}
%
% \subsection{Various specific style settings and utility macros}
%
% \begin{macro}{\BAstyle}
% Text style of authors for citations that include the year as well
% (\cmd{\cite}, \cmd{\shortcite}, \cmd{\fullcite}, \cmd{\citeA},
% \cmd{\shortciteA}, \cmd{\fullciteA}, \cmd{\citeNP}, \cmd{\shortciteNP},
% \cmd{\fullciteNP}).
%    \begin{macrocode}
\newcommand{\BAstyle}{}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\BAastyle}
% Text style of authors for \cmd{\citeauthor} and its variants
% (\cmd{\shortciteauthor}, \cmd{\fullciteauthor}, \cmd{\citeauthorNP},
% \cmd{\shortciteauthorNP}, \cmd{\fullciteauthorNP}).
%    \begin{macrocode}
\newcommand{\BAastyle}{}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACrefauthstyle}
% Text style of authors in reference list.
%    \begin{macrocode}
\newcommand{\APACrefauthstyle}{}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACciteatitle}
% \begin{macro}{\APACcitebtitle}
% Formatting of ``article'' and ``book'' titles when they are used in a
% citation, typically when there is no author and the title takes this role.
%    \begin{macrocode}
\newcommand{\APACciteatitle}[1]{``#1''}
\newcommand{\APACcitebtitle}[1]{{\em #1\/}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APACyear}
% \begin{macro}{\APACexlab}
% Formatting of the year and the extra label (`a', `b', etc.) that is used to
% distinguish different works by the same author(s) in the same year. These
% macros have been introduced to solve some problems with \pkg{natbib}'s
% parsing macros.
%    \begin{macrocode}
\newcommand{\APACyear}[1]{{#1}}%
\newcommand{\APACexlab}[1]{{#1}}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\theBibCnt}
% \begin{macro}{\BCnt}
% The |BibCnt| counter is used to distinguish multiple citations with the same
% author(s) and year. Using a counter allows the user control over its
% formatting. The default formatting (APA style) is to add roman lowercase
% letters: ``(Kruskal, 1964a, 1964b)''. The \cmd{\protect} is necessary when
% \pkg{natbib} is used.
%    \begin{macrocode}
\newcounter{BibCnt}
\renewcommand{\theBibCnt}{\alph{BibCnt}}
\DeclareRobustCommand{\BCnt}[1]{\setcounter{BibCnt}{#1}\theBibCnt}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BCntIP}
% \begin{macro}{\BCntND}
% Variations of \cmd{\BCnt} for in-press and no-date citations. The \cmd{\mbox}
% prevents a line break at the hyphen.
%    \begin{macrocode}
\DeclareRobustCommand{\BCntIP}[1]{\setcounter{BibCnt}{#1}\mbox{-\theBibCnt}}
\DeclareRobustCommand{\BCntND}[1]{\setcounter{BibCnt}{#1}\mbox{-\theBibCnt}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\bibliographytypesize}
% Font size of the references, but this macro can be abused to insert lots of
% other style commands and/or text between the section or chapter heading and
% the actual references as well.
%    \begin{macrocode}
\let\bibliographytypesize\normalsize
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bibliographyprenote}
% An optional note just before the references in the reference list (but after
% \cmd{\bibliographytypesize}). It defaults to nothing, but can be changed to
% a list of commands (e.g., if author formatting should be different in the
% reference list) and/or text (e.g., for an explanatory note).
%    \begin{macrocode}
\newcommand{\bibliographyprenote}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bibleftmargin}
% \begin{macro}{\bibindent}
% \begin{macro}{\bibparsep}
% \begin{macro}{\bibitemsep}
% \begin{macro}{\biblabelsep}
% Declare a few length parameters for the reference list and give them
% default values. Supporting the \pkg{natbib} length \cmd{\bibhang} would
% be nice, but I don't see a way to do this in a user-friendly way that
% allows loading \pkg{apacite} both with and without \pkg{natbib} and
% also allows changing \cmd{\bibindent} and \cmd{\bibleftmargin}
% separately.
%    \begin{macrocode}
\newskip{\bibleftmargin}
\newskip{\bibindent}
\newskip{\bibparsep}
\newskip{\bibitemsep}
\newskip{\biblabelsep}
\setlength{\bibleftmargin}{2.5em}
\setlength{\bibindent}{-\bibleftmargin}
\setlength{\bibparsep}{0pt}
\setlength{\bibitemsep}{0pt plus .3pt}
\setlength{\biblabelsep}{0pt}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\bibcorporate}
% Formatting of corporate (group) authors. Its primary function is in the
% \BibTeX{} stage. It is recognized by \fname{apacite.bst}, which handles
% such authors slightly differently from ordinary authors.
%    \begin{macrocode}
\let\bibcorporate\relax
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\BBA}
% Initialize this command, which formats the ``and'' between authors.
%    \begin{macrocode}
\newcommand{\BBA}{\BBAA}% `\&'
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Bem}
% Emphasis in the bibliography. A relic from \pkg{theapa}. It allows to use
% underlining in the bibliography and italics in the text, but the default is
% italics.
%    \begin{macrocode}
\let\Bem\emph
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bibnotype}
% This macro indicates that the type information should be left empty. It is
% used for \entryname{@techreport} and \entryname{@intechreport}, where
% ``\cmd{\BTR}'' is the default type if the field is left empty. As such, it
% primarily modifies the behavior of \fname{apacite.bst}.
%    \begin{macrocode}
\newcommand{\bibnotype}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACSortNoop}
% \begin{macro}{\bibphant}
% The \cmd{\APACSortNoop} macro can be used to change the sorting order:
% When put between a pair of braces at the beginning of a field, the entry is
% sorted on the argument of this command, but the argument is never displayed.
% \cmd{\bibphant} is the same as \cmd{\APACSortNoop}, so it is not discussed
% in the main documentation. It is only kept for backwards compatibility with
% old versions of \pkg{apacite}, in which it was documented.
%    \begin{macrocode}
\newcommand{\APACSortNoop}[1]{}
\let\bibphant\APACSortNoop
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\makehashother}
% \begin{macro}{\makehashmacropar}
% Setting the catcode of the hash mark `|#|'. This is mainly useful in some
% cases in which the bibliography contains urls containing `|#|' symbols.
% These are analogous to \cmd{\makeatother} and \cmd{\makeatletter}.
% (They are undocumented in the main documentation!)
%    \begin{macrocode}
\def\makehashother{\catcode`\#=12\relax}
\def\makehashmacropar{\catcode`\#=6\relax}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Author index setup and index styles}
%
% Here, the author index options are implemented. It also defines some index
% styles and defines most of the index-related commands to do nothing in case
% no author index is requested.
%
% \begin{macro}{\AX}
% \begin{macro}{\corporateAX}
% \begin{macro}{\@AXfile}
% \begin{macro}{\currentindexname}
% \begin{macro}{\printindex}
% \begin{macro}{\PrintAX}
% \begin{macro}{\orig@printindex}
% \begin{macro}{\APAC@printindex}
% \begin{macro}{\check@printindex}
% Define the author-indexing macros and the index-printing commands.
%    \begin{macrocode}
\if@APAC@index
%    \end{macrocode}
%   Author index requested.
%    \begin{macrocode}
    \if@APAC@index@package
%    \end{macrocode}
%       Load \pkg{index} package.
%    \begin{macrocode}
        \RequirePackage{index}[1995/09/28]
%    \end{macrocode}
%       Define the author index. This may be changed in the preamble of the
%       document (or in a user-provided package) by a \cmd{\renewindex}
%       command.
%    \begin{macrocode}
        \newindex{autx}{adx}{and}{\authorindexname}
%    \end{macrocode}
%       Author indexing command. Some trial and error and adapting code from
%       other packages to get this right, esp.\ when \pkg{hyperref} is also
%       loaded.
%    \begin{macrocode}
        \DeclareRobustCommand{\AX}[1]{%
          \if@filesw{%
            \protected@write\@auxout{}{%
              \string\protected@write\string\tf@autx{}{%
              \string\string\string
              \indexentry{\string#1|hyperpage}{\thepage}}}%
          }%
          \fi
        }%
    \else
%    \end{macrocode}
%       Without the \pkg{index} package, using standard \LaTeX{}. This includes
%       a bit of code adapted from \fname{ltidxglo.dtx} and \fname{doc.dtx}.
%    \begin{macrocode}
        \newwrite\@AXfile
        \immediate\openout\@AXfile=\jobname.adx
        \typeout
            {Writing author index file \jobname.adx }%
        \DeclareRobustCommand{\AX}[1]{%
            \protected@write\@AXfile{}%
                {\string\indexentry{\string#1}{\thepage}}%
        }%
        \def\PrintAX{\edef\currentindexname{\authorindexname}%
             \@input@{\jobname.and}%
             \global\let\PrintAX\@empty
        }%
        \AtBeginDocument{%
%    \end{macrocode}
%         Make sure that \cmd{\printindex} is defined.
%    \begin{macrocode}
          \@ifundefined{printindex}{\makeindex}{}%
%    \end{macrocode}
%         Now, redefine \cmd{\printindex} to accommodate both \cmd{\printindex}
%         without argument and |\printindex[autx]|.
%    \begin{macrocode}
          \let\orig@printindex\printindex
          \def\printindex{\@ifnextchar[{\APAC@printindex}{%
                                        \orig@printindex}}%
          \def\APAC@printindex[autx]{\PrintAX}%
        }%
    \fi
%    \end{macrocode}
%   Include corporate authors in the author index?
%    \begin{macrocode}
    \if@APAC@include@corporate
      \let\corporateAX\AX
    \else
      \let\corporateAX\@gobble
    \fi
\else
%    \end{macrocode}
%   No author index. Wait until |\begin{document}| for checking whether another
%   package is loaded that defines \cmd{\printindex}.
%    \begin{macrocode}
    \AtBeginDocument{%
      \@ifundefined{printindex}%
        {%
%    \end{macrocode}
%         \cmd{\printindex} has not been defined. Define \cmd{\printindex} so
%         that it suppresses the indexes.
%    \begin{macrocode}
          \def\printindex{\@ifnextchar[{\check@printindex}{%
                                        \check@printindex[]}}%
          \def\check@printindex[#1]{\relax }%
        }%
        {%
%    \end{macrocode}
%         \cmd{\printindex} has been defined, so save its definition.
%    \begin{macrocode}
          \let\orig@printindex\printindex
%    \end{macrocode}
%         Redefine \cmd{\printindex} so that it suppresses the author index
%         but does not change other indexes: (1) If there is no optional
%         argument, use the original definition.
%    \begin{macrocode}
          \def\printindex{\@ifnextchar[{\check@printindex}{\orig@printindex}}%
%    \end{macrocode}
%         (2) If there is an optional argument, check whether it is equal to
%         ``|autx|''. If so, suppress this (author) index. If not, use the
%         original definition.
%    \begin{macrocode}
          \def\check@printindex[#1]{%
%    \end{macrocode}
%           Use a clumsy way to check whether |#1| = |autx|, but seemingly more
%           elegant ways somehow didn't work.
%    \begin{macrocode}
            \expandafter\def\csname APAC@#1\endcsname{DUMMY}%
            \@ifundefined{APAC@autx}%
              {\orig@printindex[#1]}%
              {\let\APAC@autx\@undefined}%
          }%
        }%
    }%
%    \end{macrocode}
%   Empty author indexing commands.
%    \begin{macrocode}
    \let\AX\@gobble
    \let\corporateAX\@gobble
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{environment}{theindex}
% \begin{macro}{\APACstdindex}
% The \envirname{index} environment as defined in the \pkg{index} package;
% literally copied from \fname{index.sty}.
%    \begin{macrocode}
\newcommand{\APACstdindex}{%
    \@ifclassloaded{article}{%
       \renewenvironment{theindex}{%
           \edef\indexname{\the\@nameuse{idxtitle@\@indextype}}%
           \if@twocolumn
               \@restonecolfalse
           \else
               \@restonecoltrue
           \fi
           \columnseprule \z@
           \columnsep 35\p@
           \twocolumn[%
               \section*{\indexname}%
               \ifx\index@prologue\@empty\else
                   \index@prologue
                   \bigskip
               \fi
           ]%
           \@mkboth{\MakeUppercase\indexname}%
                   {\MakeUppercase\indexname}%
           \thispagestyle{plain}%
           \parindent\z@
           \parskip\z@ \@plus .3\p@\relax
           \let\item\@idxitem
       }{%
           \if@restonecol
               \onecolumn
           \else
               \clearpage
           \fi
       }
    }{%
       \renewenvironment{theindex}{%
           \edef\indexname{\the\@nameuse{idxtitle@\@indextype}}%
           \if@twocolumn
               \@restonecolfalse
           \else
               \@restonecoltrue
           \fi
           \columnseprule \z@
           \columnsep 35\p@
           \twocolumn[%
               \@makeschapterhead{\indexname}%
               \ifx\index@prologue\@empty\else
                   \index@prologue
                   \bigskip
               \fi
           ]%
           \@mkboth{\MakeUppercase\indexname}%
                   {\MakeUppercase\indexname}%
           \thispagestyle{plain}%
           \parindent\z@
           \parskip\z@ \@plus .3\p@\relax
           \let\item\@idxitem
       }{%
           \if@restonecol
               \onecolumn
           \else
               \clearpage
           \fi
       }%
    }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACtocindex}
% The \envirname{index} environment as defined in the \pkg{index} package, but
% with a table of contents entry added.
%    \begin{macrocode}
\newcommand{\APACtocindex}{%
    \@ifclassloaded{article}{%
       \renewenvironment{theindex}{%
           \edef\indexname{\the\@nameuse{idxtitle@\@indextype}}%
           \if@twocolumn
               \@restonecolfalse
           \else
               \@restonecoltrue
           \fi
           \columnseprule \z@
           \columnsep 35\p@
           \twocolumn[%
               \section*{\indexname}%
               \ifx\index@prologue\@empty\else
                   \index@prologue
                   \bigskip
               \fi
           ]%
           \@mkboth{\MakeUppercase\indexname}%
                   {\MakeUppercase\indexname}%
%    \end{macrocode}
%          The following line added by EM.
%    \begin{macrocode}
           \addcontentsline{toc}{section}{\indexname}%
           \thispagestyle{plain}%
           \parindent\z@
           \parskip\z@ \@plus .3\p@\relax
           \let\item\@idxitem
       }{%
           \if@restonecol
               \onecolumn
           \else
               \clearpage
           \fi
       }
    }{%
       \renewenvironment{theindex}{%
           \edef\indexname{\the\@nameuse{idxtitle@\@indextype}}%
           \if@twocolumn
               \@restonecolfalse
           \else
               \@restonecoltrue
           \fi
           \columnseprule \z@
           \columnsep 35\p@
           \twocolumn[%
               \@makeschapterhead{\indexname}%
               \ifx\index@prologue\@empty\else
                   \index@prologue
                   \bigskip
               \fi
           ]%
           \@mkboth{\MakeUppercase\indexname}%
                   {\MakeUppercase\indexname}%
%    \end{macrocode}
%          The following line added by EM.
%    \begin{macrocode}
           \addcontentsline{toc}{chapter}{\indexname}%
           \thispagestyle{plain}%
           \parindent\z@
           \parskip\z@ \@plus .3\p@\relax
           \let\item\@idxitem
       }{%
           \if@restonecol
               \onecolumn
           \else
               \clearpage
           \fi
       }%
    }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACemindex}
% An alternative style for the \envirname{index} environment, such that
% automatically a chapter or section title is generated, with a corresponding
% table of contents entry. The index is now in a \envirname{multicol}
% environment.
%    \begin{macrocode}
\newcommand{\APACemindex}{%
    \RequirePackage{multicol}
    \renewenvironment{theindex}{%
        \edef\@indexname{\the\@nameuse{idxtitle@\@indextype}}%
        \@ifundefined{chapter}%
          {\section*{\@indexname}%
           \addcontentsline{toc}{section}{\@indexname}%
%%          \sectionmark{{\@indexname}}% doesn't work: generates numbers
          }%
          {\chapter*{\@indexname}%
           \addcontentsline{toc}{chapter}{\@indexname}%
%%          \chaptermark{{\@indexname}}% doesn't work: generates numbers
%%                                     % (except in the backmatter)
%%          \sectionmark{{\@indexname}}% doesn't work: generates numbers
          }%
        \@mkboth{{\@indexname}}{{\@indexname}}% Hence we need this.
        \parindent\z@
        \parskip\z@ \@plus .3\p@\relax
        \let\item\@idxitem
        \setlength{\columnsep}{2em}
        \small
        \begin{multicols}{2}
        \raggedright
      }%
      {\end{multicols}\normalsize
      }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACltxemindex}
% A variation on \cmd{\APACemindex}, but without using the \pkg{index} package,
% which conflicts with the standard \LaTeX{} documentation classes.
%    \begin{macrocode}
\newcommand{\APACltxemindex}{%
    \RequirePackage{multicol}
    \renewenvironment{theindex}{%
%    \end{macrocode}
%       The index naming scheme of the \pkg{index} package is also absent.
%       Therefore, try to guess an index name.
%    \begin{macrocode}
        \@ifundefined{currentindexname}{%
          \@ifundefined{indexname}{%
            \edef\@indexname{Index}%
          }{\edef\@indexname{\indexname}}%
        }{\edef\@indexname{\currentindexname}}%
        \@ifundefined{chapter}%
          {\section*{\@indexname}%
           \addcontentsline{toc}{section}{\@indexname}%
%%          \sectionmark{{\@indexname}}% doesn't work: generates numbers
          }%
          {\chapter*{\@indexname}%
           \addcontentsline{toc}{chapter}{\@indexname}%
%%          \chaptermark{{\@indexname}}% doesn't work: generates numbers
%%                                     % (except in the backmatter)
%%          \sectionmark{{\@indexname}}% doesn't work: generates numbers
          }%
        \@mkboth{{\@indexname}}{{\@indexname}}% Hence we need this.
        \def\pfill{\relax{}}%
        \parindent\z@
        \parskip\z@ \@plus .3\p@\relax
        \let\item\@idxitem
        \setlength{\columnsep}{2em}
        \small
        \begin{multicols}{2}
        \raggedright
      }%
      {\end{multicols}\normalsize
      }%
}
%    \end{macrocode}
% \end{macro}
% \end{environment}
%
% \subsection{Formatting of urls}
%
% \begin{macro}{\Url@force@Tilde}
% \begin{macro}{\Url@APACdot}
% \begin{macro}{\Url@APACcomma}
% \begin{macro}{\Url@APACquestionmark}
% \begin{macro}{\Url@APACexclamation}
% \begin{macro}{\Url@APAChyphen}
% \begin{macro}{\Url@APACunderscore}
% \begin{macro}{\APACurlBreaks}
% \begin{macro}{\url@APACttstyle}
% \begin{macro}{\url@APACrmstyle}
% \begin{macro}{\url@APACsfstyle}
% \begin{macro}{\url@APACsamestyle}
% The APA manual requires breaking of urls \emph{after} a slash or
% \emph{before} a dot. In particular, there should not be a break between
% ``|http:|'' and ``|//|''. This differs from the standard line breaking
% style of the \pkg{url} package. Therefore, we define an APA-style for
% url formatting here. (Maybe this should be part of the \pkg{apa} class,
% but urls occur most often in the reference list, so we do it here.)
% The \pkg{url} package also defines many other (punctuation) symbols at
% which a line break may occur. The APA manual does not mention these, but
% it seems in the spirit of the APA manual to use these as well. See also
% \citeA[pp.~645--646]{chicago}.
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifpackageloaded{url}{%
%    \end{macrocode}
%   To circumvent an ``undefined'' error.
%    \begin{macrocode}
    \@ifundefined{Url@force@Tilde}{\def\Url@force@Tilde{\relax}}{}%
%    \end{macrocode}
%   The original dot. Simply using `|.|' causes an infinite loop. This command
%   is used below, so that encoding-issues can be resolved easier by redefining
%   \cmd{\Url@APACdot}. The same argument holds for the other punctuation
%   marks.
%    \begin{macrocode}
    \def\Url@APACdot{\mathchar"2E }%
    \def\Url@APACcomma{\mathchar"2C }%
    \def\Url@APACquestionmark{\mathchar"3F }%
    \def\Url@APACexclamation{\mathchar"21 }%
    \def\Url@APAChyphen{\mathchar"2D }%
    \def\Url@APACunderscore{\_}%
%    \end{macrocode}
%   Define the APA-style line breaks for urls.
%    \begin{macrocode}
    \def\APACurlBreaks{%
%    \end{macrocode}
%     Remove dot (`|.|') and slash (`|/|') from the ordinary breaks and add
%     the slash to the big breaks, so that |http://| is broken after the second
%     slash instead of after the colon. The \cmd{\UrlNoBreaks} and
%     \cmd{UrlOrds} are the default ones from the \pkg{url} package, but they
%     are repeated here to obtain a complete style, so that we don't have to
%     rely on what is the \pkg{url} default (which might change).
%    \begin{macrocode}
      \def\UrlBreaks{\do\@\do\\\do\|\do\;\do\>\do\]\do\)\do\'\do+\do\=\do\#}%
      \def\UrlBigBreaks{\do\/\do\:\do@url@hyp}%
      \def\UrlNoBreaks{\do\(\do\[\do\{\do\<}% \)
      \def\UrlOrds{\do\*\do\~\do\'\do\"}%
%    \end{macrocode}
%     Define the dot as an empty binary relation (after which a break may
%     occur) followed by a dot-symbol (after which no break may occur).
%     \citeA{chicago} requires the same treatment of a few other punctuation
%     marks, different from \pkg{url}'s default behavior. We implement these
%     as well.
%    \begin{macrocode}
      \def\UrlSpecials{%
        \do\.{\mathbin{}\Url@APACdot }%
        \do\,{\mathbin{}\Url@APACcomma }%
        \do\-{\mathbin{}\Url@APAChyphen }%
        \do\?{\mathbin{}\Url@APACquestionmark }%
        \do\!{\mathbin{}\Url@APACexclamation }%
        \do\_{\mathbin{}\Url@APACunderscore }%
        \do\ {\Url@space}\do\%{\Url@percent}\do\^^M{\Url@space}%
        \Url@force@Tilde}% package option may force faked text-ascii-tilde
    }%%
%    \end{macrocode}
%   Change the underscore for when a non-tt font is used.
%    \begin{macrocode}
    \def\Url@OTnonTT{\do\<{\langle}\do\>{\mathbin{\rangle}}\do
      \_{\mathbin{}\_}\do\|{\mid}\do\{{\lbrace}\do\}{\mathbin{\rbrace}}\do
      \\{\mathbin{\backslash}}\UrlTildeSpecial}
%    \end{macrocode}
%   Define four APA url-styles, based on the standard styles in
%   \fname{url.sty}, and use the |APACtt|-style as default.
%    \begin{macrocode}
    \def\url@APACttstyle{\def\UrlFont{\ttfamily}\APACurlBreaks }%
    \def\url@APACrmstyle{\def\UrlFont{\rmfamily}\APACurlBreaks }%
    \def\url@APACsfstyle{\def\UrlFont{\sffamily}\APACurlBreaks }%
    \def\url@APACsamestyle{\def\UrlFont{}\APACurlBreaks }%
    \urlstyle{APACtt}%
  }{}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\url}
% In case \cmd{\url} is undefined, define a very simple version.
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifundefined{url}{%
    \def\url#1{\texttt{#1}}%
  }{}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\doi}
% \begin{macro}{\doiprefix}
% Similarly, define \cmd{\doi}. Adapted from code in \fname{plainnat.bst}.
%    \begin{macrocode}
\AtBeginDocument{%
  \expandafter\ifx\csname urlstyle\endcsname\relax
    \providecommand{\doi}[1]{#1}\else
    \providecommand{\doi}{\begingroup \urlstyle{APACsame}\Url}\fi
}
\@ifundefined{doiprefix}{%
  \newcommand{\doiprefix}{doi:\penalty0{}}%
}{}%
%    \end{macrocode}
% \end{macro}
%
% \subsection{Compatibility code}
%
% Many other packages redefine citation commands and reference list commands,
% or at least affect them, even if that is not their core business. This leads
% to all kinds of compatibility problems. Here, these are repaired.
%
% \subsubsection{\pkg{babel}}
%
% From \fname{hyperref.dtx}:
% \begin{quote}
%   Package \pkg{babel} redefines \cmd{\bibcite} with macro
%   \cmd{\bbl@cite@choice}. It needs to be overwritten to avoid the warning
%   ``Label(s) may have changed.''.
% \end{quote}
% Here, a slightly adapted version of the code mentioned above is inserted. The
% other \cmd{\bibcite}-restoring compatibility code above does something
% similar, but does not do the job correctly if \pkg{babel} is loaded (why?).
% This only works if \pkg{babel} is loaded before \pkg{apacite}; putting it in
% a \cmd{\AtBeginDocument} does not work well.
%    \begin{macrocode}
\@ifundefined{bbl@cite@choice}{}{%
  \g@addto@macro\bbl@cite@choice{%
    \let\bibcite\APACbibcite
  }%
}
%    \end{macrocode}
%
% \subsubsection{\pkg{natbib}}
%
% Above, we implemented some code for the \pkgoption{natbibapa} option.
% The code here is intended as a fix for more general cases, but we
% have to make sure not to conflict with the code above. This applies
% to the redefinition of the \cmd{\NAT@parse@date} command.
%    \begin{macrocode}
\if@APAC@natbib@apa
\else
\AtBeginDocument{%
  \@ifpackageloaded{natbib}{%
%    \end{macrocode}
% Redefine a \pkg{natbib} command. This may be ethically dubious, but without
% it, \pkg{natbib} simply cannot handle \pkg{apacite}-generated \fname{.bbl}
% files. The only reason I can think of why both \pkg{apacite} and \pkg{natbib}
% would be loaded is exactly the situation when you want to use \pkg{natbib}
% for the citations and \pkg{apacite} for the reference list. In this
% situation you would load \fname{apacite.sty}, not for the citation commands,
% but for the punctuation commands and labels defined by \pkg{apacite}. In this
% situation, the redefinition below is necessary and therefore I do this here.
%    \begin{macrocode}
    \def\NAT@parse@date#1#2#3#4#5#6@@{%
      \def\NAT@year{{#1}}\def\NAT@exlab{{#2}}%
    }%
  }{}%
}
\fi
%    \end{macrocode}
% \pkg{natbib} redefines \cmd{\thebibliography}, which interferes a little with
% our purposes. Therefore, add some patches.  This goes wrong if
% \cmd{\bibpreamble} is redefined later on, i.e., by the user, but I haven't
% come up with a better hack yet.
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifpackageloaded{natbib}{%
    \let\@oldbibpreamble\bibpreamble
    \def\bibpreamble{%
      \@oldbibpreamble%
      \bibliographytypesize%
      \bibliographyprenote%
      \@ifundefined{APAC@metaprenote@\APAC@extra@b@citeb}%
        {}% skip
        {\csname APAC@metaprenote@\APAC@extra@b@citeb\endcsname}%
    }%
    \let\@old@endthebibliography\endthebibliography
    \def\endthebibliography{\@old@endthebibliography%
                            \normalsize}%
  }{}%
}
%    \end{macrocode}
%
% \subsubsection{\pkg{hyperref}}
%
% The code here is adapted from \pkg{hyperref}, \pkg{natbib}, and their
% respective documentation, to make use of their interoperability.
%    \begin{macrocode}
\AtBeginDocument{%
    \@ifundefined{NAT@parse}{%
      \def\NAT@parse{This is a fake natbib command to fool hyperref.}}{}%
    \@ifundefined{hyper@natlinkstart}{%
      \let\hyper@natlinkstart\@gobble}{}%
    \@ifundefined{hyper@natlinkend}{%
      \let\hyper@natlinkend\relax}{}%
    \@ifundefined{hyper@natanchorstart}{%
      \let\hyper@natanchorstart\@gobble}{}%
    \@ifundefined{hyper@natanchorend}{%
      \let\hyper@natanchorend\relax}{}%
    \@ifundefined{hyperpage}{%
      \def\hyperpage#1{#1}}{}%
%    \end{macrocode}
% Remove spaces from hyperlinks (\pkg{hyperref} keeps them, even if they are
% removed from the visible output, so you'd get awkward results like
% |\href{http://my .link}{http://my.link}|).
%    \begin{macrocode}
    \@ifpackageloaded{hyperref}{%
%    \end{macrocode}
%     The next should always be true, but just to be sure\ldots
%    \begin{macrocode}
      \@ifpackageloaded{url}{%
%    \end{macrocode}
%       Is \pkgoption{obeyspaces} option requested? If not, then remove spaces
%       from hyperlinks.
%    \begin{macrocode}
        \ifx\@empty\Url@ObeySp\@empty
          \def\url@#1{\def\@tmp@arg{\string#1}%
                      \HyPsd@Subst{ }{}{\@tmp@arg}%
                      \hyper@linkurl{\Hurl{#1}}{\@tmp@arg}}%
        \fi
      }{}%
    }{}%
}
%    \end{macrocode}
%
% \subsubsection{\pkg{backref}}
%
% \begin{macro}{\back@cite}
% \begin{macro}{\CurrentBib}
% \begin{macro}{\PrintBackRefs}
% \begin{macro}{\APACrestorebibitem}
% A bit of code that makes life a little easier, adapted from
% \fname{amsrefs.dtx}.
%    \begin{macrocode}
\def\back@cite{}%
\def\CurrentBib{}%
\def\PrintBackRefs{}%
\def\APACrestorebibitem{}%
\AtBeginDocument{%
  \@ifpackageloaded{backref}{%
%    \end{macrocode}
%   Make sure that \cmd{\ifBR@verbose} is defined.
%    \begin{macrocode}
    \@ifundefined{ifBR@verbose}{%
      \let\ifBR@verbose\iffalse
      \let\fi\fi}{}%
%    \end{macrocode}
%   A backcite command that makes the code of other commands better readable.
%    \begin{macrocode}
    \def\back@cite#1{%
      \ifBR@verbose
        \PackageInfo{backref}{back cite \string`#1\string'}%
      \fi
      \Hy@backout{#1\APAC@extra@b@citeb}%
    }%
%    \end{macrocode}
%   Adaptation of the \cmd{\bibitem} command so that \pkg{backref} does not
%   scan the whole entry. The placement of the backrefs is explicitly done
%   through \cmd{\PrintBackRefs}.
%    \begin{macrocode}
    \def\APACrestorebibitem{%
      \def\BR@@lbibitem[##1]##2{%
        \BRorg@bibitem[{##1}]{##2}%
        \def\CurrentBib{##2\APAC@extra@b@citeb}%
      }%
    }%
%    \end{macrocode}
%   Printing the backrefs: Revert to the standard \pkg{backref} macro.
%    \begin{macrocode}
    \def\PrintBackRefs#1{\BR@backref{#1}}%
  }{%
%    \end{macrocode}
%   Else: \pkg{backref} not loaded.
%    \begin{macrocode}
    \let\back@cite\@gobble
    \let\PrintBackRefs\@gobble
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BR@@lbibitem}
% Frankly, at the moment, I do not completely understand why we need this. But
% I'm sure it was for a good reason when I included this.
%    \begin{macrocode}
\def\BR@@lbibitem[#1]#2#3\par{%
  \BRorg@bibitem[#1]{#2}#3%
  \BR@backref{#2}%
}%
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{\pkg{chapterbib}}
%
% \begin{macro}{\@extra@b@citeb}
% \begin{macro}{\@extra@binfo}
% From the instructions of the \pkg{chapterbib} package.
%    \begin{macrocode}
\@ifundefined{@extra@b@citeb}{\def\@extra@b@citeb{}}{}
\gdef\@extra@binfo{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APAC@extra@b@citeb}
% \begin{macro}{\APAC@extra@binfo}
% Replacements of the \pkg{chapterbib} \cmd{\@extra@b@citeb} and
% \cmd{\@extra@binfo} commands. These accumulate all kinds of additional flags
% to accommodate multiple bibliographies of various packages (\pkg{chapterbib},
% \pkg{bibunits}, \pkg{multibbl}).
%    \begin{macrocode}
\def\APAC@extra@b@citeb{\APAC@curr@aux\APAC@bu\@extra@b@citeb}%
\def\APAC@extra@binfo{\APAC@curr@aux\APAC@bu\@extra@binfo}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection{\pkg{bibunits}}
%
% \begin{macro}{\APACstd@cite}
% \begin{macro}{\APACstd@nocite}
% \begin{macro}{\APACstd@lbibitem}
% \begin{macro}{\APAC@bu}
% Store the standard \pkg{apacite} definitions.
%    \begin{macrocode}
\AtEndOfPackage{%
  \let\APACstd@cite\cite
  \let\APACstd@nocite\nocite
  \let\APACstd@lbibitem\@lbibitem
}
%    \end{macrocode}
% Default definition, if \pkg{bibunits} is not loaded.
%    \begin{macrocode}
\@ifundefined{APAC@bu}{\def\APAC@bu{}}{}
\AtBeginDocument{%
  \@ifpackageloaded{bibunits}{%
%    \end{macrocode}
%   To mimic \pkg{chapterbib} behavior (with flags etc.).
%    \begin{macrocode}
    \def\APAC@bu{%
      \ifx\cite\std@cite
%    \end{macrocode}
%       Outside a bibunit. The ``|@APACbu|'' strings are intended to minimize
%       the possibility of wrong matches, such as |\b@ex11| = |ex11| from the
%       global aux or |\b@ex11| = |ex1| from bibunit~1. The last `|@|' is
%       similarly intended to avoid confusion if both \pkg{bibunits} and
%       \pkg{chapterbib} are loaded (``|11@1|'' = 11th bibunit, 1st
%       \pkg{chapterbib} unit; ``|1@11|'' = 1st bibunit, 11th
%       \pkg{chapterbib} unit). It seems unlikely that both packages would be
%       used at the same time, but safety first.
%    \begin{macrocode}
        @APACbu0@%
      \else
%    \end{macrocode}
%       Within a bibunit: Use bibunit number to distinguish the bibunits.
%    \begin{macrocode}
        @APACbu\the\@bibunitauxcnt @%
      \fi
    }%
%    \end{macrocode}
%   Standard \pkg{apacite} definition of the \cmd{\cite} and \cmd{\nocite}
%   commands. The latter is mainly necessary to avoid incorrect ``Citation
%   undefined'' warnings.
%    \begin{macrocode}
    \let\std@cite\APACstd@cite
    \let\std@nocite\APACstd@nocite
%    \end{macrocode}
%   Restore the \pkg{apacite} definition of \cmd{\bibitem}, mainly because of
%   the \cmd{\@newciteauxhandle} instead of \cmd{\@auxout}.
%    \begin{macrocode}
    \def\std@lbibitem[#1]#2{%
      \let\@APACtemp@auxout\@newciteauxhandle
      \let\@newciteauxhandle\@bibunitaux
      \APACstd@lbibitem[#1]{#2}%
      \let\@newciteauxhandle\@APACtemp@auxout
    }%
%    \end{macrocode}
%   To make sure everything works whether \pkg{bibunits} is loaded before or
%   after \pkg{apacite}.
%    \begin{macrocode}
    \let\@lbibitem\std@lbibitem
  }{}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsubsection{\pkg{bibtopic}}
%
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifpackageloaded{bibtopic}{%
%    \end{macrocode}
%   Somewhat rudely disable this command to prevent an undesired error
%   message of \pkg{bibtopic}.
%    \begin{macrocode}
    \renewcommand*\bt@change@thb{\relax}%
  }{%
%    \end{macrocode}
%   These \pkg{bibtopic} hooks are included in the
%   \envirname{thebibliography} environment as generated by
%   \fname{apacite.bst}, so \pkg{bibtopic} should work correctly. If
%   \pkg{bibtopic} is not loaded, they should do nothing.
%    \begin{macrocode}
    \providecommand{\bt@beg@thb@hook}{\relax}
    \providecommand{\bt@end@thb@hook}{\relax}
  }%
}
%    \end{macrocode}
%
% \subsubsection{\pkg{multibbl}}
%
% Almost all of \pkg{multibbl}'s code is redefined here, mainly because
% \pkg{apacite} needs to distinguish which citation refers to which
% bibliography, so that flags can be correctly set whether a citation
% is the first citation to the work from the specific bibliography and
% correctly includes the meta-analysis flags with the various
% bibliographies.
%
% \begin{macro}{\APAC@curr@aux}
% Default flag definition if \pkg{multibbl} is not loaded.
%    \begin{macrocode}
\@ifundefined{APAC@curr@aux}{\def\APAC@curr@aux{}}{}
\AtBeginDocument{%
  \@ifpackageloaded{multibbl}{%
%    \end{macrocode}
%   To mimic \pkg{chapterbib} behavior (with flags etc.).
%    \begin{macrocode}
    \def\APAC@def@curr@aux#1{\def\APAC@curr@aux{@APACaux@#1@}}%
%    \end{macrocode}
% \begin{macro}{\newbibliography}
%   Ditto. This puts the \cmd{\bibcite} commands in |#1.aux| instead of in
%   the main \fname{.aux} file, so that the flags can be differentiated.
%   This also means that the \fname{.aux} file has to be read by \LaTeX{}
%   before it is overwritten.
%    \begin{macrocode}
    \def\newbibliography#1{%
      \APAC@def@curr@aux{#1}%
      \@input@{#1.aux}%
      \begingroup
        \if@filesw
          \expandafter\newwrite\csname #1@auxfile\endcsname
          \expandafter\immediate\openout
            \csname #1@auxfile\endcsname #1.aux\relax
          \typeout{Writing auxiliary file #1.aux }%
        \fi
      \endgroup
    }%%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APAC@mbbl@bibliography}
% \begin{macro}{\bibliography}
%   Add the flag to the bibliography.
%    \begin{macrocode}
    \let\APAC@mbbl@bibliography\bibliography
    \def\bibliography#1#2#3{%
      \APAC@def@curr@aux{#1}%
      \let\@APACtemp@auxout\@newciteauxhandle
      \def\@APACtemp{\csname #1@auxfile\endcsname}%
      \let\@newciteauxhandle\@APACtemp
      \APAC@mbbl@bibliography{#1}{#2}{#3}%
      \let\@newciteauxhandle\@APACtemp@auxout
    }%%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@orig@@cite}
% \begin{macro}{\@@cite}
%   Add an extra argument to \cmd{\@@cite}.
%    \begin{macrocode}
    \let\@orig@@cite\@@cite
    \def\@@cite<#1>[#2]#3#4{%
      \nocite{#3}{#4}%
      \let\@temp@nocite\nocite
      \let\nocite\@gobble
      \APAC@def@curr@aux{#3}%
      \@orig@@cite<#1>[#2]{#4}%
      \let\nocite\@temp@nocite
      \let\@temp@nocite\@undefined
    }%%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@orig@nocite}
% \begin{macro}{\nocite}
%   Add an extra argument to \cmd{\nocite}.
%    \begin{macrocode}
    \let\@orig@nocite\nocite
    \def\nocite#1#2{%
%    \end{macrocode}
%     Define a flag.
%    \begin{macrocode}
      \APAC@def@curr@aux{#1}%
%    \end{macrocode}
%     No flag-setting in \cmd{\nocite}: A no-cite is not a citation,
%     so a subsequent citation may be the first citation.
%    \begin{macrocode}
      \@bsphack
      \ifx\@onlypreamble\document
%    \end{macrocode}
%       Since we are after |\begin{document}| we can do the citations:
%    \begin{macrocode}
        \@for\@citeb:=#2\do{%
          \edef\@citeb{\expandafter\@firstofone\@citeb}%
%    \end{macrocode}
%         \cmd{\@newciteauxhandle} for compatibility with \pkg{multibib};
%         |#1@auxfile| for compatibility with \pkg{multibbl}.
%    \begin{macrocode}
          \@ifundefined{#1@auxfile}{%
            \if@filesw
              \immediate\write\@newciteauxhandle{\string\citation{\@citeb}}%
            \fi
          }{\if@filesw
              \expandafter\immediate%
              \write\csname #1@auxfile\endcsname{\string\citation{\@citeb}}%
            \fi
          }%
          \@ifundefined{b@\@citeb\APAC@extra@b@citeb}{%
            \edef\B@my@dummy{*}%
            \ifx\@citeb\B@my@dummy
            \else
              \G@refundefinedtrue
              \@latex@warning{Citation `\@citeb' undefined}%
            \fi
          }{}%
        }%
      \else
%    \end{macrocode}
%        \pkg{apacite} has no compatibility problems with \LaTeX~2.09,
%        because it does not work with \LaTeX~2.09 anyway, so we can do the
%        following, suggested in \fname{ltbibl.dtx}:
%    \begin{macrocode}
         \AtBeginDocument{\nocite{#1}{#2}}%
      \fi
      \@esphack
%    \end{macrocode}
%     For compatibility with \pkg{multibib}.
%    \begin{macrocode}
      \@restore@auxhandle
    }%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@orig@nocitemeta}
% \begin{macro}{\nocitemeta}
%   Add an extra argument to \cmd{\nocitemeta}.
%    \begin{macrocode}
    \let\@orig@@nocitemeta\nocitemeta
    \def\nocitemeta#1#2{%
      \nocite{#1}{#2}%
      \let\@temp@nocite\nocite
      \let\nocite\@gobble
      \@orig@@nocitemeta{#2}%
      \let\nocite\@temp@nocite
      \let\@temp@nocite\@undefined
    }%
  }{}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection{\pkg{multibib}}
%
% From the instructions in \fname{multibib.dtx}.
%    \begin{macrocode}
\providecommand\@newciteauxhandle{\@auxout}
\def\@restore@auxhandle{\gdef\@newciteauxhandle{\@auxout}}
\AtBeginDocument{%
  \@ifundefined{newcites}{\global\let\@restore@auxhandle\relax}{}%
}
%    \end{macrocode}
% List of citation commands.
%    \begin{macrocode}
\if@APAC@classic@cite
\def\@mb@citenamelist{%
  cite,fullcite,shortcite,citeNP,fullciteNP,shortciteNP,%
  citeA,fullciteA,shortciteA,citeauthor,fullciteauthor,shortciteauthor,%
  citeauthorNP,fullciteauthorNP,shortciteauthorNP,%
  citeyear,citeyearNP,nocite,nocitemeta,%
  maskcite,maskfullcite,maskshortcite,maskciteNP,maskfullciteNP,%
  maskshortciteNP,maskciteA,maskfullciteA,maskshortciteA,%
  maskciteauthor,maskfullciteauthor,maskshortciteauthor,%
  maskciteauthorNP,maskfullciteauthorNP,maskshortciteauthorNP,%
  maskciteauthorA,maskfullciteauthorA,maskshortciteauthorA,%
  maskciteyear,maskciteyearNP,masknocite%
}
\fi
\if@APAC@natbib@apa
\AtEndOfPackage{%
%    \end{macrocode}
% The \pkg{natbib} commands, if they haven't been declared already.
%    \begin{macrocode}
\@ifundefined{@mb@citenamelist}{%
  \def\@mb@citenamelist{%
    nocite,citep,citealp,citet,citealt,citeauthor,citefullauthor,%
    citeyearpar,citeyear,citetext,cite,shortcites,citetalias,%
    citepalias,Citet,Citep,Citealt,Citealp,Citeauthor,citenum}%
}{}
%    \end{macrocode}
% The commands \pkg{apacite} adds.
%    \begin{macrocode}
\let\orig@mb@citenamelist\@mb@citenamelist
\edef\@mb@citenamelist{%
  \orig@mb@citenamelist,%
  citeauthort,citeauthorp,citefullauthort,citefullauthorp,Citeauthort,%
  Citeauthorp,Citefullauthort,Citefullauthorp,%
  masknocite,maskcitep,maskcitealp,maskcitet,maskcitealt,%
  maskciteauthor,maskcitefullauthor,maskciteyearpar,maskciteyear,%
  maskcite,maskcitetalias,maskcitepalias,maskCitet,maskCitep,%
  maskCitealt,maskCitealp,maskCiteauthor,maskcitenum,maskciteauthort,%
  maskciteauthorp,maskCitefullauthor,maskCiteauthort,maskCiteauthorp,%
  nocitemeta%
}
}
\fi
%    \end{macrocode}
%
%
% \subsection{Language-specific macros and loading of language file}
% \label{sec:language-code}
%
% This section initializes a number of macros that are likely to be subject
% to redefinition in the language-specific files. Most of these are fairly
% obvious, particularly literal text strings, but some style issues are
% language-specific as well, e.g., whether or not a comma should be inserted
% before the last author. After initializing these macros, \pkg{apacite} tries
% to infer which language-specific (\fname{.apc}) file must be loaded, if any,
% and then loads this file.
%
% \subsubsection{Literal text strings}
%
% \begin{macro}{\onemaskedcitationmsg}
% \begin{macro}{\maskedcitationsmsg}
% Messages that are inserted in the text if citations are masked.
% Put these messages in separate commands so that they're easily
% changed; e.g., for different languages. We use \cmd{\emph} instead
% of \cmd{\textit}, so that this is put upright if it's executed
% within an italic surrounding, and the parentheses are included
% within the \cmd{\emph}, which looks better if this is included in
% another pair of parentheses. But all of this is easily changed.
%    \begin{macrocode}
\newcommand{\onemaskedcitationmsg}[1]{%
    \emph{(#1\ citation removed for masked review)}}
\newcommand{\maskedcitationsmsg}[1]{%
    \emph{(#1\ citations removed for masked review)}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\refname}
% \begin{macro}{\bibname}
% \begin{macro}{\authorindexname}
% The section/chapter headings to be used for the reference list and the
% author index. One of the first two is typically already defined by the
% document class (e.g., \fname{article.cls} defines \cmd{\refname},
% \fname{book.cls} defines \cmd{\bibname}. When using \pkg{babel}, these are
% both redefined at each \cmd{\selectlanguage} invocation. The
% language-specific (\fname{.apc}) file typically should override that, because
% the strings defined by \pkg{babel} are often not the same as the strings
% prescribed by the style guides for Psychology. For example, the standard
% definition of \cmd{\bibname} in English is ``Bibliography'', whereas the
% APA insists on ``References'' (with a few exceptions). In other languages,
% the \cmd{\refname} may also be defined differently from the \pkg{babel}
% definition. See the various \fname{.apc} files for how \pkg{babel} is
% overridden.
%    \begin{macrocode}
\def\refname{References}% Name of ref. list if it's a section.
\def\bibname{References}% Name of ref. list if it's a chapter.
\newcommand{\authorindexname}{Author Index}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APACmetaprenote}
% A note used just before the references in the reference list when a
% meta-analysis is reported.
%    \begin{macrocode}
\newcommand{\APACmetaprenote}{%
  References marked with an asterisk indicate studies included in
  the meta-analysis.}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bibmessage}
% \begin{macro}{\bibcomputerprogram}
% \begin{macro}{\bibcomputerprogrammanual}
% \begin{macro}{\bibcomputerprogramandmanual}
% \begin{macro}{\bibcomputersoftware}
% \begin{macro}{\bibcomputersoftwaremanual}
% \begin{macro}{\bibcomputersoftwareandmanual}
% \begin{macro}{\bibprogramminglanguage}
% Commands for specific types of \entryname{@misc} entries. Besides the strings
% themselves (as language-specific text), these are significant in that they
% are recognized by \fname{apacite.bst} and used to modify the formatting of
% the corresponding reference list entries.
%    \begin{macrocode}
\newcommand{\bibmessage}{Msg}% Message, for internet forums and the like
\newcommand{\bibcomputerprogram}{Computer program}
\newcommand{\bibcomputerprogrammanual}{Computer program manual}
\newcommand{\bibcomputerprogramandmanual}{Computer program and manual}
\newcommand{\bibcomputersoftware}{Computer software}
\newcommand{\bibcomputersoftwaremanual}{Computer software manual}
\newcommand{\bibcomputersoftwareandmanual}{Computer software and manual}
\newcommand{\bibprogramminglanguage}{Programming language}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\bibnodate}
% \begin{macro}{\BIP}
% Two types of ``special'' years: ``no date'' and ``in press''. These are not
% only text strings unlike normal years, but also are recognized by
% \fname{apacite.bst} and treated differently there. Here and in many other
% macros below, the \cmd{\hbox} ensures that \TeX{} does not interpret the
% final period as a sentence-ending period, and thus does not insert the extra
% space associated with that.
%    \begin{macrocode}
\newcommand{\bibnodate}{n.d.\hbox{}}% no date
\newcommand{\BIP}{in press}         % in press
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BOthers}
% \begin{macro}{\BOthersPeriod}
% ``and others''. The argument contains a period to suppress an additional one
% in the reference list, i.e., it is used as |\BOthers{.}| and the period in the
% argument is seen by \BibTeX{}, which does not insert an additional one, so
% that we now correctly get |et al.| and not |et al..| in the reference list.
% The difference between \cmd{\BOthers} and \cmd{\BOthersPeriod} is that the
% latter is used in a context where there should always be a period at the
% end. Given that \BibTeX{} does not insert it because of the mentioned usage
% of a period in the argument, this explicit distinction is necessary here.
% Hence, if an unabbreviated string is used to define these commands, their
% definitions become different. For example,
% \begin{verbatim}
% \renewcommand{\BOthers}{and others}
% \renewcommand{\BOthersPeriod}{and others.}
% \end{verbatim}
% This does not work perfectly if \cmd{\citeauthor} is used at the end of a
% sentence. This is on the todo-list. For the moment, the user will have to
% employ an explicit workaround, i.e., insert an additional period if
% \cmd{\BOthers} does not contain one and omit this period if it does.
%    \begin{macrocode}
\newcommand{\BOthers}[1]{et al.\hbox{}}%       ``and others''
\newcommand{\BOthersPeriod}[1]{et al.\hbox{}}% ``and others.'', with a period
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BIn}
% \begin{macro}{\Bby}
% Used for ``In Editor (Ed.), \emph{Booktitle}'' and
% ``by Editor, Ed., \emph{Booktitle}'', respectively.
%    \begin{macrocode}
\newcommand{\BIn}{In}                 % for ``In '' editor...
\newcommand{\Bby}{by}                 % for ``by '' editor... (in reprints)
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BED}
% \begin{macro}{\BEDS}
% \begin{macro}{\BTRANS}
% \begin{macro}{\BTRANSS}
% \begin{macro}{\BTRANSL}
% \begin{macro}{\BCHAIR}
% \begin{macro}{\BCHAIRS}
% Various types of non-author contributions.
%    \begin{macrocode}
\newcommand{\BED}{Ed.\hbox{}}         % editor
\newcommand{\BEDS}{Eds.\hbox{}}       % editors
\newcommand{\BTRANS}{Trans.\hbox{}}   % translator
\newcommand{\BTRANSS}{Trans.\hbox{}}  % translators
\newcommand{\BTRANSL}{trans.\hbox{}}  % translation, for the year field
\newcommand{\BCHAIR}{Chair}           % chair of symposium
\newcommand{\BCHAIRS}{Chairs}         % chairs
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BVOL}
% \begin{macro}{\BVOLS}
% \begin{macro}{\BNUM}
% \begin{macro}{\BNUMS}
% \begin{macro}{\BEd}
% \begin{macro}{\BCHAP}
% \begin{macro}{\BCHAPS}
% \begin{macro}{\BPG}
% \begin{macro}{\BPGS}
% Various strings that indicate what kind of number is given.
%    \begin{macrocode}
\newcommand{\BVOL}{Vol.\hbox{}}       % volume (of a multi-volume book)
\newcommand{\BVOLS}{Vols.\hbox{}}     % volumes
\newcommand{\BNUM}{No.\hbox{}}        % number (of a technical report)
\newcommand{\BNUMS}{Nos.\hbox{}}      % numbers
\newcommand{\BEd}{ed.\hbox{}}         % edition
\newcommand{\BCHAP}{chap.\hbox{}}     % chapter (for electronic documents)
\newcommand{\BCHAPS}{chap.\hbox{}}    % chapters
\newcommand{\BPG}{p.\hbox{}}          % page
\newcommand{\BPGS}{pp.\hbox{}}        % pages
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BTR}
% \begin{macro}{\BPhD}
% \begin{macro}{\BUPhD}
% \begin{macro}{\BMTh}
% \begin{macro}{\BUMTh}
% Various strings that indicate what kind of work is referenced.
%    \begin{macrocode}
%% Default technical report type name.
\newcommand{\BTR}{Tech.\ Rep.\hbox{}}
%% Default PhD thesis type name.
\newcommand{\BPhD}{Doctoral dissertation}
%% Default unpublished PhD thesis type name.
\newcommand{\BUPhD}{Unpublished doctoral dissertation}
%% Default master's thesis type name.
\newcommand{\BMTh}{Master's thesis}
%% Default unpublished master's thesis type name.
\newcommand{\BUMTh}{Unpublished master's thesis}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BAuthor}
% ``Author'', the string used for the publisher if the publisher is also the
% author of the work.
%    \begin{macrocode}
\newcommand{\BAuthor}{Author}% ``Author'' if publisher = author
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\BOWP}
% \begin{macro}{\BREPR}
% Two strings that are used for reprints and translations.
%    \begin{macrocode}
\newcommand{\BOWP}{Original work published}
\newcommand{\BREPR}{Reprinted from}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BAvailFrom}
% \begin{macro}{\BRetrieved}
% \begin{macro}{\BRetrievedFrom}
% \begin{macro}{\BMsgPostedTo}
% Strings that indicate where on the internet the referenced document was
% obtained.
%    \begin{macrocode}
\newcommand{\BAvailFrom}{Available from\ }%          Websites; note the space.
%% The argument is the date on which it was last checked.
\newcommand{\BRetrieved}[1]{Retrieved {#1}, from\ }% Websites; note the space.
\newcommand{\BRetrievedFrom}{Retrieved from\ }%      Websites; note the space.
\newcommand{\BMsgPostedTo}{Message posted to\ }%     Messages; note the space.
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsubsection{Punctuation}
%
% Most of this is more style-specific than language specific, but there are
% some punctuation differences between different languages, or even
% ``dialects'' (in \pkg{babel}'s terminology) of the same ``language''.
% Therefore, these are all included here and redefined in the \fname{.apc}
% files.
%
% \begin{macro}{\BBOP}
% \begin{macro}{\BBCP}
% Opening and closing parentheses. Used to enclose the whole citation for a
% parenthetical citation (e.g., \cmd{\cite}), only the year and post-note for
% in-text citations (e.g., \cmd{\citeA}), and the year (and month and day, if
% present) in the reference list. If different punctuation is desired for
% the reference than used in citations, these commands can be redefined
% immediately before the location of the \cmd{\bibliography} command. If
% different punctuation is desired for parenthetical citations than for in-text
% citations (seems unlikely), the citation commands themselves have to be
% redefined.
%    \begin{macrocode}
\newcommand{\BBOP}{(}   % opening parenthesis
\newcommand{\BBCP}{)}   % closing parenthesis
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BBOQ}
% \begin{macro}{\BBCQ}
% Opening and closing quotes for article-type titles in the reference list.
%    \begin{macrocode}
\newcommand{\BBOQ}{}    % opening quote for article title
\newcommand{\BBCQ}{}    % closing quote for article title
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BBAA}
% \begin{macro}{\BBAB}
% \begin{macro}{\BAnd}
% Three forms of ``and''. Of course, the word ``and'' is a literal text string,
% so this part could also have been allocated to the the section that handles
% those.
%    \begin{macrocode}
\newcommand{\BBAA}{\&}  % between authors in parenthetical cites and ref. list
\newcommand{\BBAB}{and} % between authors in in-text citation
\newcommand{\BAnd}{\&}  % for ``Ed. \& Trans.'' in ref. list
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BPBI}
% \begin{macro}{\BHBI}
% Punctuation between initials. This is primarily used to reduce or eliminate
% space between initials. Note that there is currently not a similar command
% for the last period after the initials, so that removing the periods in these
% macros will generally give undesirable results.
%    \begin{macrocode}
\DeclareRobustCommand{\BPBI}{.~}% Period between initials
\DeclareRobustCommand{\BHBI}{.-}% Hyphen between initials
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BAP}
% \begin{macro}{\BBAY}
% \begin{macro}{\BBYY}
% \begin{macro}{\BBC}
% \begin{macro}{\BBN}
% \begin{macro}{\BCBT}
% \begin{macro}{\BCBL}
% \begin{macro}{\BDBL}
% Punctuation between various parts of citations and reference list entries.
%    \begin{macrocode}
\newcommand{\BAP}{ }    % after prefix, before first citation
\newcommand{\BBAY}{, }  % between author(s) and year
\newcommand{\BBYY}{, }  % between years of multiple citations with same author
\newcommand{\BBC}{; }   % between cites
\newcommand{\BBN}{, }   % before note
\newcommand{\BCBT}{,}   % comma between authors in ref. list when no. of
                       %% authors = 2
\newcommand{\BCBL}{,}   % comma before last author when no. of authors > 2
\newcommand{\BDBL}{, \dots{} }% dots before last author when no. of authors > 7
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsubsection{Date formatting}
%
% This consists of literal strings (names of the months), relative ordering of
% year, month, and day, and punctuation between the elements.
%
% \begin{macro}{\APACmonth}
% This takes one argument. If it is a number between 1 and 12, the name of
% the corresponding month is produced (1 = January, \dots, 12 = December),
% and 13--16 represent the seasons. Anything else is copied literally. In this
% way, other kinds of dates can be handled as well, such as
% ``August/September''. Note that this in its turn can be flexibly entered
% as |\APACmonth{08}/\APACmonth{09}| in the \fname{.bib} file.
%    \begin{macrocode}
\newcommand{\APACmonth}[1]{\ifcase #1\or January\or February\or March\or
    April\or May\or June\or July\or August\or September\or October\or
    November\or December\or Winter\or Spring\or Summer\or Fall\else
    {#1}\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACrefYearMonthDay}
% Year, month, and day in the reference list. Often used for newspaper articles
% and presentations at conferences. By default, this results in something like
% ``(2005, July~5)''. The month and day should be seen as parenthetical
% refinements of the year, so that in other languages, the year should be
% named first as well, regardless of the conventions for representing dates in
% such languages.
%    \begin{macrocode}
\newcommand{\APACrefYearMonthDay}[3]{%
  {\BBOP}{#1}%           year (+ addendum); should not be empty
  \ifx\@empty#2\@empty
    \ifx\@empty#3\@empty
    \else
      \unskip, {#3}%     day
    \fi
  \else
    \unskip, {#2}%       month
    \ifx\@empty#3\@empty
    \else
      \unskip~{#3}%      day
    \fi
  \fi
  {\BBCP}%               closing parenthesis
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACdate}
% A date in the ordinary form, like \cmd{\today}. This is needed for processing
% the \fieldname{lastchecked} field. Should be able to handle dates in both
% typical \LaTeX{} input format (|2005/07/05|) and ISO format
% (|2005-07-05|, possibly with time after it, which will be ignored). Maybe
% other formats as well; e.g., |20050705|, as in the Un*x |touch| command.
% Not yet implemented.
% \end{macro}
%
% \subsubsection{Ordinal numbers}
%
% Some functions, for use with the \fieldname{edition} field, which transform
% a (cardinal) number (``1'', ``2'', \dots) to an ordinal number (``1st'',
% ``2nd'', \dots).
%
% I copied the functions here literally from \fname{amsrefs.dtx} (starting
% with \cmd{\PrintEdition} there) and made only one slight adaptation: removing
% \cmd{\editiontext}. In the \APACversiondate{2007/09/03} version of
% \pkg{apacite}, \cmd{\PrintOrdinal} and \cmd{\print@ordinal} were called
% \cmd{\PrintCardinal} and \cmd{\print@cardinal}, respectively, and what is
% called ``ordinal'' now was called ``cardinal''. This terminology was copied
% from the documentation of \pkg{amsrefs}, but it is incorrect and has
% therefore been changed in the current version. This causes a slight
% incompatibility between versions of \pkg{apacite}. So in case users have
% redefined one of these macros to fit their own needs, they should rename
% these accordingly. Note, however, that the current version of \pkg{apacite}
% redefines these macros in the language-specific files, so for most users,
% this will presumably be sufficient.
%
% \begin{macro}{\@xp}
% Abbreviation.
%    \begin{macrocode}
\let\@xp\expandafter
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PrintOrdinal}
% \begin{macro}{\print@ordinal}
% \begin{macro}{\CardinalNumeric}
% \begin{macro}{\keep@last@digit}
% |\PrintOrdinal{2}| gives ``2nd'', etc. If the argument is not an integer
% number, it is copied literally to the output. At least, apparently, because
% I do not really understand how it works. The \pkg{amsrefs} documentation
% suggests that \cmd{\CardinalNumeric} already gives the ordinal number
% (incorrectly called ``cardinal number'' there), and the name
% \cmd{\CardinalNumeric} without `|@|' sign likewise suggests that it is a
% user command, but some tests using this give garbage. Therefore,
% \cmd{\PrintOrdinal} (a slight adaptation of \pkg{amsrefs}'
% \cmd{\PrintEdition}) is the command that ultimately should be used.
%    \begin{macrocode}
\newcommand{\PrintOrdinal}[1]{%
    \afterassignment\print@ordinal
    \count@ 0#1\relax\@nil
}
\def\print@ordinal#1#2\@nil{%
    \ifx\relax#1\relax
        \ifnum\count@>\z@
            \CardinalNumeric\count@
        \else
            ??th%
        \fi
    \else
        \ifnum \count@>\z@ \number\count@ \fi
        #1#2\relax
    \fi
}
\newcommand{\CardinalNumeric}[1]{%
    \number#1\relax
    \if
        \ifnum#1<14
            \ifnum#1>\thr@@ T\else F\fi
        \else
            F%
        \fi
        T%
        th%
    \else
        \@xp\keep@last@digit\@xp#1\number#1\relax
        \ifcase#1th\or st\or nd\or rd\else th\fi
    \fi
}
\def\keep@last@digit#1#2{%
    \ifx\relax#2%
        \@xp\@gobbletwo
    \else
        #1=#2\relax
    \fi
    \keep@last@digit#1%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% Load language dependent sections from an external file. Based on code by
% Stefan Bj\"ork [2004/12/25], although heavily modified.
%    \begin{macrocode}
\AtBeginDocument{%
%    \end{macrocode}
% Both \pkg{babel} and \pkg{(n)german} use \cmd{\iflanguage} to check the main
% language. They both also use \cmd{\languagename}, but that gives more
% problems with ``dialects''. For example, if \cmd{\languagename} = |austrian|
% then |\iflanguage{german}{Yes}{No}| gives Yes. This allows us to provide only
% \fname{.apc} files for the language class without complicated code to check
% whether a certain ``dialect'' is used.
%
% Check whether \cmd{\iflanguage} is defined. If not, no language support
% is offered.
%    \begin{macrocode}
  \@ifundefined{iflanguage}%
    {\relax }%
    {%
%    \end{macrocode}
%     Some \TeX{} distributions automatically preload \pkg{babel} with default
%     language ``|nohyphenation|'', so this language should revert to doing
%     nothing. Strangely enough, \cmd{\iflanguage} does not work correctly, so
%     I'll use a trick. (Some trial and error, because \fname{babel.dtx} states
%     that there must be a ``\verb*+\string +'' before the ``|nohyphenation|'',
%     but apparently in this situation this is not the case.)
%    \begin{macrocode}
      \edef\APAC@tmp{nohyphenation}%
      \ifx\languagename\APAC@tmp
      \else
%    \end{macrocode}
%       Check whether $\langle$\cmd{\languagename}$\rangle$\fname{.apc} exists.
%       If so, load this file.
%    \begin{macrocode}
        \InputIfFileExists{\languagename.apc}{}{%
%    \end{macrocode}
%       Else, i.e., $\langle$\cmd{\languagename}$\rangle$\fname{.apc} does not
%       exist. Try whether the current language is a dialect of one of the
%       known languages. This is not perfect, because languages for which no
%       hyphenation patterns have been found revert to the default language,
%       so that the wrong language file may be loaded here in that case. Also,
%       |UKenglish| uses different hyphenation patterns from |english|. I have
%       to find a better way to solve this.
%
% \begin{macro}{\APAC@iflang}
%       Define a modification of \cmd{\iflanguage} that executes the ``true''
%       code if the language is defined and equal to the current language and
%       does nothing otherwise. (Just \cmd{\iflanguage} gives an error if the
%       language is not loaded.)
%    \begin{macrocode}
          \def\APAC@iflang##1##2{%
            \expandafter\ifx\csname l@##1\endcsname\relax
            \else
              \ifnum\csname l@##1\endcsname=\language
                {##2}%
              \fi
            \fi
          }%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APAC@apcfile}
%         Define the language support file. The \cmd{\def} instead of a direct
%         \cmd{\input} is done to provide a mechanism to check whether any
%         language file has been defined.
%    \begin{macrocode}
          \APAC@iflang{dutch}{\gdef\APAC@apcfile{dutch.apc}}%
          \APAC@iflang{finnish}{\gdef\APAC@apcfile{finnish.apc}}%
          \APAC@iflang{french}{\gdef\APAC@apcfile{french.apc}}%
          \APAC@iflang{german}{\gdef\APAC@apcfile{german.apc}}%
          \APAC@iflang{ngerman}{\gdef\APAC@apcfile{ngerman.apc}}%
          \APAC@iflang{greek}{\gdef\APAC@apcfile{greek.apc}}%
          \APAC@iflang{norsk}{\gdef\APAC@apcfile{norsk.apc}}%
          \APAC@iflang{spanish}{\gdef\APAC@apcfile{spanish.apc}}%
          \APAC@iflang{swedish}{\gdef\APAC@apcfile{swedish.apc}}%
%    \end{macrocode}
%         The hyphenation patterns for UK English are different from
%         US English, so this needs to be accommodated explicitly to avoid a
%         warning. Australian, New Zealand, and Canadian all use either the
%         British or American hyphenation patterns, so do not need to be
%         treated separately here.
%    \begin{macrocode}
          \APAC@iflang{UKenglish}{\gdef\APAC@apcfile{english.apc}}%
%    \end{macrocode}
%         The default English as the last one. If a language is loaded without
%         hyphenation patterns, the English hyphenation patterns are used by
%         default in \pkg{babel}. In such a case, both this particular
%         language and English give a hit. Having English as the last one
%         means that in such a case, \pkg{apacite} assigns English,
%         corresponding with \pkg{babel}'s default.
%    \begin{macrocode}
          \APAC@iflang{english}{\gdef\APAC@apcfile{english.apc}}%
%    \end{macrocode}
% \end{macro}
%
%         Give a warning if the process so far has not resulted in a target
%         language file, or if the target language file cannot be found.
%    \begin{macrocode}
          \@ifundefined{APAC@apcfile}{%
            \PackageWarningNoLine{apacite}{%
              No suitable language definition file (\languagename.apc) found}%
          }{%
             \InputIfFileExists{\APAC@apcfile}{}{%
               \PackageWarningNoLine{apacite}{%
                 Language definition file \APAC@apcfile\space not found}%
             }%
          }%
%    \end{macrocode}
%         Clear up some macros that are no longer needed.
%    \begin{macrocode}
          \let\APAC@apcfile\@undefined
        }%
      \fi
      \let\APAC@tmp\@undefined
    }%
    \let\APAC@iflang\@undefined
}
%%
%</package>
%    \end{macrocode}
%
%
% \section{Documentation package (\fname{apacdoc.sty})}
% The \pkg{apacdoc} package is written for generating the \pkg{apacite}
% user's manual. But it also contains a few commands that are too
% experimental or otherwise unsuitable to be included in \fname{apacite.sty},
% but which are necessary to format some examples from the APA manual
% correctly. As such, these commands may be useful for users if they
% encounter similar citation problems. In such a case, it is probably
% better to copy the definitions of the desired commands to the top
% of your \fname{.tex} document (before \verb+\begin{document}+) or
% to a tailor-made \fname{.sty} file, rather than loading the \pkg{apacdoc}
% package.
%
%    \begin{macrocode}
%<*docpkg>
%%
%% apacdoc.sty : Style package that is used for the apacite documentation.
%% Written by Erik Meijer
%    \end{macrocode}
% \subsection{Options}
% \begin{macro}{\if@APACdoc@AX}
% Generate author index?
%    \begin{macrocode}
\newif\if@APACdoc@AX
\DeclareOption{makeAX}{\@APACdoc@AXtrue}%
\@APACdoc@AXfalse
\ProcessOptions
%    \end{macrocode}
% \end{macro}
%
% \subsection{Document-specific definitions that may be useful for wider use}
% \begin{macro}{\bibliteral}
% \begin{macro}{\bibinitial}
% Echo argument literally. Can be used to define a certain author type
% (``Producer'') in a place where \BibTeX{} expects a first name.
% Using this command between a pair of braces makes sure that the text
% is not abbreviated into an initial.
% This is the result of lots of trial and error. If I change something
% in another part, I typically have to change something here as well.
% The \verb+\space+ is necessary because in the current setup, an additional
% space is inserted in the bibliography, and \MakeIndex{} is space-sensitive.
%    \begin{macrocode}
%% \DeclareRobustCommand{\bibliteral}[1]{\string\bibliteral{#1}}
%% \newcommand{\bibliteral}[1]{#1}
%% \newcommand{\bibliteral}[1]{\string\bibliteral{#1}}
\newcommand{\bibliteral}[1]{\string\bibliteral\space{#1}}
\DeclareRobustCommand{\bibinitial}[1]{\string#1}
%% \newcommand{\bibinitial}{\string\bibinitial\space}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\bibnodot}
% If the argument is a period (`|.|'), \BibTeX{} puts no period after it.
%    \begin{macrocode}
\newcommand{\bibnodot}[1]{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\SwapArgs}
% Reverse order of the two arguments. Can be used for various reasons,
% mostly related to sorting in the reference list.
%    \begin{macrocode}
\newcommand{\SwapArgs}[2]{#2#1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bibreftext}
% \begin{macro}{\Dutchvon}
% The following macro is especially useful if the \fieldname{year}
% field must be different in the text and the reference list,
% e.g., ``1992/1993'' in the text and ``1992'' in reference list.
% Then \fieldname{year} can be defined as |\bibreftext{1992}{1992/1993}|.
% The definition below displays only the second argument (``text'').
% Just before the reference list, this can then be redefined to
% display only the first argument (``ref'').
%    \begin{macrocode}
\newcommand{\bibreftext}[2]{#2}
%    \end{macrocode}
% The same command, but now intended for Dutch-style ``von'' parts,
% so in order to create some flexibility in formatting items from
% a \fname{.bib} file, it is useful to have a separate macro for
% this application.
%    \begin{macrocode}
\newcommand{\Dutchvon}[2]{#2}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APACredefineOnce}
% This macro takes two arguments: (1) the name of a command (without the
% backslash) and (2) arbitrary \TeX{} code. It then redefines the
% command (1) to the \TeX{} code (2) as a one-time change, so after the
% command (1) has been invoked once, it reverts to its definition before
% \cmd{\APACredefineOnce} was issued. This can be used to redefine, say,
% \cmd{\BRetrievedFrom} from ``Retrieved from'' to ``Retrieved from
% Poverty Alleviation website'' for a single reference but restore it
% to ``Retrieved from'' immediately afterwards.
%    \begin{macrocode}
\DeclareRobustCommand\APACredefineOnce[2]{%
    \global
    \expandafter\let
      \csname old#1\expandafter\endcsname
        \csname #1\endcsname
    \expandafter\gdef
      \csname #1\expandafter\endcsname
        {{#2}%
         \global
         \expandafter\let
           \csname #1\expandafter\endcsname
             \csname old#1\endcsname
        }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bibeditortype}
% \begin{macro}{\renewbibeditortype}
% The following macro changes the definitions of the macros \cmd{\BED}
% and \cmd{\BEDS} to the argument of this macro and then immediately
% changes the definitions back to their old definitions. So it makes a
% one-time change. Can be used to use ``Producer'' instead of ``Ed.''
% etc.
%    \begin{macrocode}
\DeclareRobustCommand{\bibeditortype}[1]{\relax }%
\def\renewbibeditortype{%
  \def\oldBED{}%
  \def\oldBEDS{}%
  \DeclareRobustCommand{\bibeditortype}[1]{%
    \global\let\oldBED\BED
    \global\let\oldBEDS\BEDS
    \global\def\BED{##1\global\let\BED\oldBED  \global\let\BEDS\oldBEDS}%
    \global\def\BEDS{##1\global\let\BED\oldBED \global\let\BEDS\oldBEDS}%
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\bibInstring}
% \begin{macro}{\BOn}
% The following macro changes the definition of the macro \cmd{\BIn} to the
% argument and then immediately changes the definition back to the old
% definition. So it makes a one-time change. Can be used to use ``On''
% instead of ``In'' for a CD-track, for which  \cmd{\BOn} is supplied.
%    \begin{macrocode}
\newcommand{\bibInstring}[1]{%
  \global\let\oldBIn\BIn
  \global\def\BIn{#1\global\let\BIn\oldBIn}%
}
\newcommand{\BOn}{On}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BAbstractRetrieved}
% \begin{macro}{\BmakeAbstractRetrieved}
% The following macros are used to change ``Retrieved'' into
% ``Abstract retrieved''. They use the same principle as
% \cmd{\renewbibeditortype}.
%    \begin{macrocode}
\global\def\BAbstractRetrieved#1{Abstract retrieved {#1}, from\ }%
\DeclareRobustCommand{\BmakeAbstractRetrieved}{%
  \global\def\oldBRetrieved{}%
  \global\let\oldBRetrieved\BRetrieved
  \global\def\BRetrieved##1{%
     \BAbstractRetrieved{##1}%
     \global\let\BRetrieved\oldBRetrieved%
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\noedition}
% Suppress ``ed.'' to format ``Version 4.0'' in an \fieldname{edition}
% field.
%    \begin{macrocode}
\DeclareRobustCommand{\noedition}{%
  \global\def\oldBEd{}%
  \global\let\oldBEd\BEd
  \global\def\BEd{%
     \unskip
     \global\let\BEd\oldBEd
  }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\swallownext}
% \begin{macro}{\swallowdot}
% \begin{macro}{\bibskipbracenodot}
% \begin{macro}{\indexskipbracenodot}
% The \cmd{\bibskipbracenodot} macro suppresses the period after a
% following closing brace. It does not work entirely well at the
% moment. In particular, it works differently in an \cmd{\AX} macro
% in text and an \cmd{\AX} macro in the reference list. This probably
% has something to do with robust vs.\ fragile macros and/or expansion
% of the macro. I have experimented a lot with many variations, but
% don't seem to get it right. I don't understand these issues well yet.
% \cmd{\swallownext} swallows its argument; \cmd{\swallowdot} swallows
% the next character if it's a period.
%    \begin{macrocode}
\def\swallownext#1{\relax}
\def\swallowdot{%
    \@ifnextchar.%
      {\swallownext}%
      {\relax}%
}
%    \end{macrocode}
% When the above does not work, \cmd{\bibskipbracenodot} should reduce
% to nothing. This is the current definition. Just before the
% bibliography, it is redefined. \cmd{\indexskipbracenodot} has the
% same purpose, but for the author index instead of the reference list.
%    \begin{macrocode}
%% \def\bibskipbracenodot{\string\bibskipbracenodot}
%% \def\bibskipbracenodot{\aftergroup\swallowdot}
%% \let\bibskipbracenodot\relax
\def\bibskipbracenodot{\noexpand\bibskipbracenodot}
\def\indexskipbracenodot{\noexpand\indexskipbracenodot}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APACmanBeforeBib}
% Redefine commands that should be different in the bibliography.
%    \begin{macrocode}
\newcommand{\APACmanBeforeBib}{%
    \renewcommand{\bibreftext}[2]{##1}%
    \renewcommand{\Dutchvon}[2]{##1}%
    \renewbibeditortype
    \global\let\oldbibskipbracenodot\bibskipbracenodot
    \global\def\bibskipbracenodot{\aftergroup\swallowdot}%
    \global\let\oldbibliteral\bibliteral
    \renewcommand{\bibliteral}[1]{##1}%
    \global\let\oldbibinitial\bibinitial
    \renewcommand{\bibinitial}[1]{##1}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACbibstyle}
% Dirty trick: request \fname{apacitex.bst} if \pkg{apacite} is loaded
% with one of the index options, and request \fname{apacite.bst}
% otherwise.
%    \begin{macrocode}
\def\APACbibstyle{%
  \if@APAC@index
    apacitex% with index option
  \else
    apacite% without index option
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACmanBeforeIndex}
% Redefine commands that should be different in the author index.
%    \begin{macrocode}
\newcommand{\APACmanBeforeIndex}{%
    \clearpage
    \renewcommand{\bibeditortype}[1]{}%
    \renewcommand{\bibliteral}[1]{\unskip}%
    \global\let\indexskipbracenodot\bibskipbracenodot
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACmanAfterIndex}
% Revert to the old definitions of commands after the index.
%    \begin{macrocode}
\newcommand{\APACmanAfterIndex}{%
    \global\let\bibskipbracenodot\oldbibskipbracenodot
    \global\def\indexskipbracenodot{\noexpand\indexskipbracenodot}%
    \APACdocindex
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\SetupAPACdocPrologues}
% Redefine some indexing-related commands from \fname{doc.sty} and
% \fname{ltxdoc.cls}. Unfortunately, I couldn't get the code index
% and change history working with the \pkg{index} package, so I have
% to tweak everything so that the \pkg{apacite} manual does not use the
% \pkg{index} package (which is loaded by apacite when an
% \pkgoption{index} option is requested).
%    \begin{macrocode}
\newcommand{\SetupAPACdocPrologues}{%
  \@ifundefined{IndexPrologue}{}{%
    \IndexPrologue{%
      \clearpage\section*{{Code Index}}%
      \addcontentsline{toc}{section}{Code Index}%
      \markboth{{Code Index}}{{Code Index}}%
      Numbers written in italic refer to the page where the corresponding
      entry is described; numbers underlined refer to the
      \ifcodeline@index
        code line of the
      \fi
      definition; numbers in roman refer to the
      \ifcodeline@index
        code lines
      \else
        pages
      \fi
      where the entry is used.
    }%
  }%
  \@ifundefined{GlossaryPrologue}{}{%
    \GlossaryPrologue{\section{{Change History}}%
      \markboth{{Change History}}{{Change History}}%
    }%
  }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACdocindex}
% From \fname{doc.dtx}.
%    \begin{macrocode}
\def\APACdocindex{%
    \ifhave@multicol
      \renewenvironment{theindex}
        {\begin{multicols}\c@IndexColumns[\index@prologue][\IndexMin]%
          \IndexParms \let\item\@idxitem \ignorespaces}%
        {\end{multicols}}
    \else
      \typeout{Can't find multicol.sty -- will use normal index layout if
         necessary.}
      \def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
        \columnseprule \z@  \columnsep 35\p@
        \twocolumn[\index@prologue]%
        \IndexParms \let\item\@idxitem \ignorespaces}
      \def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
    \fi
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Citations to the Bible}
% The \emph{APA manual} gives some rules how the Bible and other
% classic works should be cited. These rules are not implemented
% in standard \pkg{apacite}, so I provide a workaround here. This
% needs to be fixed and generalized because the \emph{APA manual}
% now also gives a Qur'an example.
%
% \begin{macro}{\bibleversion}
% \begin{macro}{\@bibleversion}
% To define which Bible version one has used.
%    \begin{macrocode}
\def\bibleversion#1{\gdef\@bibleversion{#1}}
\def\@bibleversion{Revised Standard Version}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\bibleciteA}
% \begin{macro}{\fullbibleciteA}
% \begin{macro}{\shortbibleciteA}
% \begin{macro}{\biblecite}
% \begin{macro}{\fullbiblecite}
% \begin{macro}{\shortbiblecite}
% \begin{macro}{\bibleciteNP}
% \begin{macro}{\fullbibleciteNP}
% \begin{macro}{\shortbibleciteNP}
% The Bible citation commands follow the same names and syntax as the
% ordinary citation commands, except that ``|bible|'' is inserted in
% the command names.
%    \begin{macrocode}
\def\bibleciteA#1{%
   {\@ifundefined{flag@bible}%
      {\fullbibleciteA{#1}}%
      {\shortbibleciteA{#1}}%
   }%
}
\def\fullbibleciteA#1{%
%    \end{macrocode}
% Insert chapter and verse.
%    \begin{macrocode}
   {#1}%
%    \end{macrocode}
% Add Bible version.
%    \begin{macrocode}
   { \BBOP\@bibleversion\BBCP}%
%    \end{macrocode}
% Flag that the Bible has been cited.
%    \begin{macrocode}
   {\global\expandafter\def\csname flag@bible\endcsname{DUMMY}}%
}
\def\shortbibleciteA#1{%
   {#1}%
%    \end{macrocode}
% Is this appropriate to flag that Bible has been cited, given that
% we don't give the version here?
%    \begin{macrocode}
   {\global\expandafter\def\csname flag@bible\endcsname{DUMMY}}%
}
\def\biblecite#1{%
   {\@ifundefined{flag@bible}%
      {\fullbiblecite{#1}}%
      {\shortbiblecite{#1}}%
   }%
}
\def\fullbiblecite#1{%
   {\BBOP}%
   {#1}%
   {\BBAY{} \@bibleversion}%
   {\BBCP}%
   {\global\expandafter\def\csname flag@bible\endcsname{DUMMY}}%
}
\def\shortbiblecite#1{%
   {\BBOP}%
   {#1}%
   {\BBCP}%
   {\global\expandafter\def\csname flag@bible\endcsname{DUMMY}}%
}
\def\bibleciteNP#1{%
   {\@ifundefined{flag@bible}%
      {\fullbibleciteNP{#1}}%
      {\shortbibleciteNP{#1}}%
   }%
}
\def\fullbibleciteNP#1{%
   {#1}%
   {\BBAY{} \@bibleversion}%
   {\global\expandafter\def\csname flag@bible\endcsname{DUMMY}}%
}
\def\shortbibleciteNP#1{%
   {#1}%
   {\global\expandafter\def\csname flag@bible\endcsname{DUMMY}}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Citing songs}
% The \emph{APA manual} gives some rules how songs should be cited.
% These rules require some tweaking of standard \pkg{apacite}. This is
% done here.
%
% \begin{macro}{\bibsong}
% \begin{macro}{\citeAsong}
% \begin{macro}{\fullciteAsong}
% \begin{macro}{\shortciteAsong}
% \begin{macro}{\citesong}
% \begin{macro}{\fullcitesong}
% \begin{macro}{\shortcitesong}
% \begin{macro}{\citesongNP}
% \begin{macro}{\fullcitesongNP}
% \begin{macro}{\shortcitesongNP}
% The names of these macros are a bit internally inconsistent and
% inconsistent with the \cmd{\biblecite} and \cmd{DSMcite} suites.
% Fix this in a next version.
%    \begin{macrocode}
\newcommand{\bibsong}[4]{}
\newcommand{\citeAsong}[1]{%
  \def\bibsong##1##2##3##4{%
    \APACciteatitle{##3} {\BBOP}{##1}{\BBAY}{##2}{\BBN}{##4}{\BBCP}%
  }%
  \citeauthor{#1}%
  \def\bibsong##1##2##3##4{}%
}
\newcommand{\fullciteAsong}[1]{%
  \def\bibsong##1##2##3##4{%
    \APACciteatitle{##3} {\BBOP}{##1}{\BBAY}{##2}{\BBN}{##4}{\BBCP}%
  }%
  \fullciteauthor{#1}%
  \def\bibsong##1##2##3##4{}%
}
\newcommand{\shortciteAsong}[1]{%
  \def\bibsong##1##2##3##4{%
    \APACciteatitle{##3} {\BBOP}{##1}{\BBAY}{##2}{\BBN}{##4}{\BBCP}%
  }%
  \shortciteauthor{#1}%
  \def\bibsong##1##2##3##4{}%
}
\newcommand{\citesong}[1]{%
  \def\bibsong##1##2##3##4{%
    {\BBOP}\APACciteatitle{##3},{\BAP}{##1}{\BBAY}{##2}{\BBN}{##4}%
    {\BBCP}%
  }%
  \citeauthor{#1}%
  \def\bibsong##1##2##3##4{}%
}
\newcommand{\fullcitesong}[1]{%
  \def\bibsong##1##2##3##4{%
    {\BBOP}\APACciteatitle{##3},{\BAP}{##1}{\BBAY}{##2}{\BBN}{##4}%
    {\BBCP}%
  }%
  \fullciteauthor{#1}%
  \def\bibsong##1##2##3##4{}%
}
\newcommand{\shortcitesong}[1]{%
  \def\bibsong##1##2##3##4{%
    {\BBOP}\APACciteatitle{##3},{\BAP}{##1}{\BBAY}{##2}{\BBN}{##4}%
    {\BBCP}%
  }%
  \shortciteauthor{#1}%
  \def\bibsong##1##2##3##4{}%
}
\newcommand{\citesongNP}[1]{%
  \def\bibsong##1##2##3##4{%
    \APACciteatitle{##3},{\BAP}{##1}{\BBAY}{##2}{\BBN}{##4}%
  }%
  \citeauthor{#1}%
  \def\bibsong##1##2##3##4{}%
}
\newcommand{\fullcitesongNP}[1]{%
  \def\bibsong##1##2##3##4{%
    \APACciteatitle{##3},{\BAP}{##1}{\BBAY}{##2}{\BBN}{##4}%
  }%
  \fullciteauthor{#1}%
  \def\bibsong##1##2##3##4{}%
}
\newcommand{\shortcitesongNP}[1]{%
  \def\bibsong##1##2##3##4{%
    \APACciteatitle{##3},{\BAP}{##1}{\BBAY}{##2}{\BBN}{##4}%
  }%
  \shortciteauthor{#1}%
  \def\bibsong##1##2##3##4{}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Commands to cite the \emph{DSM}}
% The \emph{APA manual} gives some rules how the \emph{DSM} should be
% cited, which is a bit different from ordinary citations. These rules
% are not implemented in standard \pkg{apacite}, so I provide a
% workaround here.
%
% \begin{macro}{\bibDSM}
% \begin{macro}{\origbibDSM}
% \begin{macro}{\DSMauthor}
% \begin{macro}{\DSMfulltitle}
% \begin{macro}{\DSMshorttitle}
% \begin{macro}{\DSMedition}
% The \cmd{\bibDSM} macro has four arguments: (1) author, (2) full
% title, (3) edition, (4) abbreviated title. The default definition
% prints the author, so this gives something decent if an ordinary
% citation command is used. The other macros extract the separate
% arguments.
%    \begin{macrocode}
\DeclareRobustCommand{\bibDSM}[4]{#1}
\newcommand\origbibDSM{}
\let\origbibDSM\bibDSM
\newcommand{\DSMauthor}[1]{%
  \def\bibDSM##1##2##3##4{##1}%
  \citeauthor{#1}%
  \let\bibDSM\origbibDSM
}
\newcommand{\DSMfulltitle}[1]{%
  \def\bibDSM##1##2##3##4{##2}%
  \citeauthor{#1}%
  \let\bibDSM\origbibDSM
}
\newcommand{\DSMshorttitle}[1]{%
  \def\bibDSM##1##2##3##4{##4}%
  \citeauthor{#1}%
  \let\bibDSM\origbibDSM
}
\newcommand{\DSMedition}[1]{%
  \def\bibDSM##1##2##3##4{##3}%
  \citeauthor{#1}%
  \let\bibDSM\origbibDSM
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DSMciteA}
% \begin{macro}{\DSMfullciteA}
% \begin{macro}{\DSMshortciteA}
% \begin{macro}{\DSMcite}
% \begin{macro}{\DSMfullcite}
% \begin{macro}{\DSMshortcite}
% \begin{macro}{\DSMciteNP}
% \begin{macro}{\DSMfullciteNP}
% \begin{macro}{\DSMshortciteNP}
% The \emph{DSM} citation commands follow the same names and syntax as the
% ordinary citation commands, except that ``|DSM|'' is inserted in
% the command names.
%    \begin{macrocode}
\newcommand{\DSMciteA}[1]{%
    \@for\@citeb:=#1\do{%
      \edef\@citeb{\expandafter\@firstofone\@citeb}%
      \@ifundefined{flag@\@citeb\APAC@extra@b@citeb}%
         {\DSMfullciteA{#1}}%
         {\DSMshortciteA{#1}}%
    }%
}
\newcommand{\DSMfullciteA}[1]{%
%    \end{macrocode}
% \emph{Full Title} (edition; \emph{Short Title}; author, year)
%    \begin{macrocode}
  \APACcitebtitle{\DSMfulltitle{#1}}
  \BBOP
  \DSMedition{#1};
  \APACcitebtitle{\DSMshorttitle{#1}};
  \citeNP{#1}%
  \BBCP
}
\newcommand{\DSMshortciteA}[1]{%
%    \end{macrocode}
% \emph{Short Title}
%    \begin{macrocode}
  \APACcitebtitle{\DSMshorttitle{#1}}%
}
\newcommand{\DSMcite}[1]{%
    \@for\@citeb:=#1\do{%
      \edef\@citeb{\expandafter\@firstofone\@citeb}%
      \@ifundefined{flag@\@citeb\APAC@extra@b@citeb}%
         {\DSMfullcite{#1}}%
         {\DSMshortcite{#1}}%
    }%
}
\newcommand{\DSMfullcite}[1]{%
  \BBOP
  \APACcitebtitle{\DSMfulltitle{#1}},
  \DSMedition{#1};
  \APACcitebtitle{\DSMshorttitle{#1}};
  \citeNP{#1}%
  \BBCP
}
\newcommand{\DSMshortcite}[1]{%
  \BBOP\APACcitebtitle{\DSMshorttitle{#1}}\BBCP
}
\newcommand{\DSMciteNP}[1]{%
    \@for\@citeb:=#1\do{%
      \edef\@citeb{\expandafter\@firstofone\@citeb}%
      \@ifundefined{flag@\@citeb\APAC@extra@b@citeb}%
         {\DSMfullciteNP{#1}}%
         {\DSMshortciteNP{#1}}%
    }%
}
\newcommand{\DSMfullciteNP}[1]{%
  \APACcitebtitle{\DSMfulltitle{#1}},
  \DSMedition{#1};
  \APACcitebtitle{\DSMshorttitle{#1}};
  \citeNP{#1}%
}
\newcommand{\DSMshortciteNP}[1]{%
  \APACcitebtitle{\DSMshorttitle{#1}}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Document-specific definitions}
%
% \begin{macro}{\SetupAPACdoc}
% These are some commands that are used in the \pkg{apacite} manual,
% but are presumably not especially relevant for users.
%
% \begin{macro}{\MiKTeX}
% \begin{macro}{\BibTeX}
% \begin{macro}{\MakeIndex}
% \begin{macro}{\latextohtml}
% \begin{macro}{\LaTeXrtf}
% \begin{macro}{\TeXht}
% \begin{macro}{\Perl}
% Names of programs and packages.
%    \begin{macrocode}
\newcommand{\SetupAPACdoc}{%
  \newcommand{\MiKTeX}{MiK\TeX}
  \@ifundefined{BibTeX}{%
    \def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
        T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}% from bibtex.web
  }{}
  \newcommand{\MakeIndex}{\textit{MakeIndex}}
  \newcommand{\latextohtml}{\textup{\LaTeX2\texttt{HTML}}}% from html.sty
  \newcommand{\LaTeXrtf}{\textup{\LaTeX2RTF}}%
  \newcommand{\TeXht}{\textup{\TeX4ht}}%
  \newcommand{\Perl}{\textsl{Perl}}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\EM}
% My comments accompanying the examples. To be removed with better
% source code documentation.
%    \begin{macrocode}
  \newcommand{\EM}{\ensuremath{\triangleright\quad}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACversiondate}
% The date of a version of \pkg{apacite}. Makes it easy to search the
% document for these dates. The \cmd{\relax} is a safety measure
% (probably not needed), which ensures that the square brackets are
% never interpreted as an optional argument.
%    \begin{macrocode}
  \newcommand{\APACversiondate}[1]{\relax [##1]}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\LC}
% \begin{macro}{\X}
% \begin{macro}{\Y}
% \begin{macro}{\A}
% Some symbols that are used in the \pkg{apacite} manual.
%    \begin{macrocode}
  \newcommand{\LC}{\mbox{${}^{\dag}$}}% \LaTeX{} Companion
  \newcommand{\X}{\ensuremath{\times}}% for one table
  \newcommand{\Y}{\ensuremath{c}}% for one table
  \newcommand{\A}{\ensuremath{a}}% for one table
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\pkg}
% \begin{macro}{\fname}
% \begin{macro}{\fieldname}
% \begin{macro}{\entryname}
% \begin{macro}{\pkgoption}
% \begin{macro}{\envirname}
% Formatting of package names, options, etc.
%    \begin{macrocode}
  \newcommand{\pkg}[1]{\textsf{##1}}% package name
  \newcommand{\fname}[1]{\texttt{##1}}% file name
  \newcommand{\fieldname}[1]{\texttt{##1}}% field name
  \newcommand{\entryname}[1]{\texttt{##1}}% entry type name
  \newcommand{\pkgoption}[1]{\texttt{##1}}% package option
  \newcommand{\envirname}[1]{\texttt{##1}}% environment name
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cmd}
% \begin{macro}{\bs}
% \begin{macro}{\opt}
% \begin{macro}{\cmdtwo}
% \begin{macro}{\cmdthree}
% \begin{macro}{\cmdthreepre}
% \begin{macro}{\cmdthreealt}
% \begin{macro}{\cmdfour}
% Formatting of macros.
%    \begin{macrocode}
  \AtBeginDocument{%
    \@ifundefined{cmd}{%
      \newcommand{\cmd}[1]{\texttt{\string##1}}% command, incl. `\'
    }{}%
  }
%    \end{macrocode}
% Some trickery with backslashes and |@| signs.
%    \begin{macrocode}
  \newcommand{\bs}{{\ttfamily \@backslashchar}}% backslash
  \newcommand{\opt}[1]{$\langle${\itshape ##1}$\rangle$}% generic text
%    \end{macrocode}
% For \cmdtwo{nocite}{keys}:
%    \begin{macrocode}
  \newcommand{\cmdtwo}[2]{{\mdseries\bs\texttt{##1\{}\opt{##2}%
                          \texttt{\}}}}%
%    \end{macrocode}
% For \cmdthree{cite}{post}{keys}:
%    \begin{macrocode}
  \newcommand{\cmdthree}[3]{{\mdseries\bs\texttt{##1[}\opt{##2}%
                          \texttt{]\{}\opt{##3}%
                          \texttt{\}}}}%
%    \end{macrocode}
% For \cmdthreepre{cite}{pre}{keys}:
%    \begin{macrocode}
  \newcommand{\cmdthreepre}[3]{{\mdseries\bs\texttt{##1<}\opt{##2}%
                          \texttt{>\{}\opt{##3}%
                          \texttt{\}}}}%
%    \end{macrocode}
% For \cmdthreealt{usepackage}{options}{apacite}:
%    \begin{macrocode}
  \newcommand{\cmdthreealt}[3]{{\mdseries\bs\texttt{##1[}\opt{##2}%
                          \texttt{]\{##3\}}}}%
%    \end{macrocode}
% For all \cmdfour{cite}{pre}{post}{keys} variants:
%    \begin{macrocode}
  \newcommand{\cmdfour}[4]{{\mdseries\bs\texttt{##1<}\opt{##2}%
                          \texttt{>[}\opt{##3}%
                          \texttt{]\{}\opt{##4}%
                          \texttt{\}}}}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\flqq}
% \begin{macro}{\frqq}
% \begin{macro}{\simpleguillemots}
% It is not clear where and how the \cmd{\flqq} command is defined, so
% provide an escape if it is not available. Use definitions from
% \fname{fguill.sty} included here to avoid requiring a package that
% may not be available. This can probably be improved by using
% \cmd{\providecommand}.
%    \begin{macrocode}
  \AtBeginDocument{%
    \@ifundefined{flqq}{%
      \newcommand{\flqq}{%
        {\fontencoding{T1}\fontfamily{cmr}\selectfont\symbol{19}}}%
      \newcommand{\frqq}{%
        {\fontencoding{T1}\fontfamily{cmr}\selectfont\symbol{20}}}%
    }{}%
  }%
  \newcommand{\simpleguillemots}{%
    \renewcommand{\flqq}{\raisebox{2.5pt}{%
      \tiny{\ensuremath{\mathord{<\!\!<}}}}}%
    \renewcommand{\frqq}{\raisebox{2.5pt}{%
      \tiny{\ensuremath{\mathord{>\!\!>}}}}}%
  }%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\APACdocPageLayout}
% The basic page setup of the \pkg{apacite} manual.
%    \begin{macrocode}
  \newcommand{\APACdocPageLayout}{%
      \normalsize
      \let\oldhoffset\hoffset
      \let\oldvoffset\voffset
      \let\oldoddsidemargin\oddsidemargin
      \let\oldevensidemargin\evensidemargin
      \let\oldtopmargin\topmargin
      \let\oldheadheight\headheight
      \let\oldheadsep\headsep
      \let\oldtextheight\textheight
      \let\oldfootskip\footskip
      \let\oldtextwidth\textwidth
      \let\oldlinewidth\linewidth
      \let\oldmarginparsep\marginparsep
      \let\oldmarginparwidth\marginparwidth
      \let\oldmarginparpush\marginparpush
      %%
      %% \setlength{\hoffset}{-1in} % top-left reference point is
      \setlength{\voffset}{-1in} % the top-left corner of the page
      %% \setlength{\oddsidemargin}{1.3in}
      %% \setlength{\evensidemargin}{1.3in}
      \setlength{\topmargin}{1.35in}
      %% %% \setlength{\headheight}{\baselineskip}
      \setlength{\headheight}{0.12in}
      \setlength{\headsep}{0.24in}
      \setlength{\textheight}{7.9in}
      \setlength{\footskip}{30pt}
      %% \setlength{\textwidth}{5.9in}
      %% \setlength{\linewidth}{\textwidth}
      %% \setlength{\marginparsep}{0pt}
      %% \setlength{\marginparwidth}{0pt}
      %% \setlength{\marginparpush}{0pt}
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\APACcodePageLayout}
% The page setup of the source code documentation part of the
% \pkg{apacite} manual.
%    \begin{macrocode}
  \newcommand{\APACcodePageLayout}{%
      \let\hoffset\oldhoffset
      \let\oddsidemargin\oldoddsidemargin
      \let\evensidemargin\oldevensidemargin
      \let\textwidth\oldtextwidth
      \let\linewidth\oldlinewidth
      \let\marginparsep\oldmarginparsep
      \let\marginparwidth\oldmarginparwidth
      \let\marginparpush\oldmarginparpush
  }
}
%%
%</docpkg>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \section{Language definition files}
%
% This section describes the code for the language-specific files
% supplied with \pkg{apacite}.
%
% \subsection{\fname{english.apc}}
%
% This file redefines the language-specific elements of \pkg{apacite}
% for the English language and its ``dialects'' in \pkg{babel}
% terminology.
%
%    \begin{macrocode}
%<*english>
%%
%% english.apc - english version of apacite elements
%% Written by Erik Meijer
%%
%    \end{macrocode}
% A fancy way to store and restore the category code of the |@| sign,
% per Heiko Oberdiek.
%    \begin{macrocode}
\edef\APACrestoreAtCode{%
   \catcode`@=\the\catcode`@\relax
}%
\makeatletter
\renewcommand{\onemaskedcitationmsg}[1]{%
    \emph{(#1\ citation removed for masked review)}}%
\renewcommand{\maskedcitationsmsg}[1]{%
    \emph{(#1\ citations removed for masked review)}}%
\renewcommand{\refname}{References}% Name of ref. list if it's a section.
\renewcommand{\bibname}{References}% Name of ref. list if it's a chapter.
\renewcommand{\authorindexname}{Author Index}% Name of Author Index
%%
%% A note before the references if a meta-analysis is reported.
\renewcommand{\APACmetaprenote}{%
  References marked with an asterisk indicate studies
  included in the meta-analysis.}%
%%
%% Commands for specific types of @misc entries.
\renewcommand{\bibmessage}{Msg}%
\renewcommand{\bibcomputerprogram}{Computer program}%
\renewcommand{\bibcomputerprogrammanual}{Computer program manual}%
\renewcommand{\bibcomputerprogramandmanual}{Computer program and manual}%
\renewcommand{\bibcomputersoftware}{Computer software}%
\renewcommand{\bibcomputersoftwaremanual}{Computer software manual}%
\renewcommand{\bibcomputersoftwareandmanual}{Computer software and manual}%
\renewcommand{\bibprogramminglanguage}{Programming language}%
%%
%% Other labels
\renewcommand{\bibnodate}{n.d.\hbox{}}%   % ``no date''
\renewcommand{\BIP}{in press}%            % ``in press''
\renewcommand{\BOthers}[1]{et al.\hbox{}}% ``and others''
\renewcommand{\BOthersPeriod}[1]{et al.\hbox{}}% ``and others'' with a period
\renewcommand{\BIn}{In}%                  % for ``In '' editor...
\renewcommand{\Bby}{by}%                  % for ``by '' editor... (in reprints)
\renewcommand{\BED}{Ed.\hbox{}}%          % editor
\renewcommand{\BEDS}{Eds.\hbox{}}%        % editors
\renewcommand{\BTRANS}{Trans.\hbox{}}%    % translator
\renewcommand{\BTRANSS}{Trans.\hbox{}}%   % translators
\renewcommand{\BTRANSL}{trans.\hbox{}}%   % translation, for the year field
\renewcommand{\BCHAIR}{Chair}%            % chair of symposium
\renewcommand{\BCHAIRS}{Chairs}%          % chairs
\renewcommand{\BVOL}{Vol.\hbox{}}%        % volume
\renewcommand{\BVOLS}{Vols.\hbox{}}%      % volumes
\renewcommand{\BNUM}{No.\hbox{}}%         % number
\renewcommand{\BNUMS}{Nos.\hbox{}}%       % numbers
\renewcommand{\BEd}{ed.\hbox{}}%          % edition
\renewcommand{\BCHAP}{chap.\hbox{}}%      % chapter
\renewcommand{\BCHAPS}{chap.\hbox{}}%     % chapters
\renewcommand{\BPG}{p.\hbox{}}%           % page
\renewcommand{\BPGS}{pp.\hbox{}}%         % pages
%% Default technical report type name.
\renewcommand{\BTR}{Tech.\ Rep.\hbox{}}
%% Default PhD thesis type name.
\renewcommand{\BPhD}{Doctoral dissertation}
%% Default unpublished PhD thesis type name.
\renewcommand{\BUPhD}{Unpublished doctoral dissertation}
%% Default master's thesis type name.
\renewcommand{\BMTh}{Master's thesis}
%% Default unpublished master's thesis type name.
\renewcommand{\BUMTh}{Unpublished master's thesis}
%%
\renewcommand{\BAuthor}{Author}% ``Author'' if publisher = author
\renewcommand{\BOWP}{Original work published}%
\renewcommand{\BREPR}{Reprinted from}%
\renewcommand{\BAvailFrom}{Available from\ }%        Websites; note the space.
%% The argument is the date on which it was last checked.
\renewcommand{\BRetrieved}[1]{Retrieved {#1}, from\ }% Websites; note the space.
\renewcommand{\BRetrievedFrom}{Retrieved from\ }% Websites; note the space.
\renewcommand{\BMsgPostedTo}{Message posted to\ }%     Messages; note the space.
%%
%% Punctuation
\renewcommand{\BBOP}{(}%   opening parenthesis
\renewcommand{\BBCP}{)}%   closing parenthesis
\renewcommand{\BBOQ}{}%    opening quote for article title
\renewcommand{\BBCQ}{}%    closing quote for article title
\renewcommand{\BBAA}{\&}%  between authors in parenthetical cites and ref. list
\renewcommand{\BBAB}{and}% between authors in in-text citation
\renewcommand{\BAnd}{\&}%  for ``Ed. \& Trans.'' in ref. list
\DeclareRobustCommand{\BPBI}{.~}% Period between initials
\DeclareRobustCommand{\BHBI}{.-}% Hyphen between initials
\renewcommand{\BAP}{ }%   after prefix, before first citation
\renewcommand{\BBAY}{, }% between author(s) and year
\renewcommand{\BBYY}{, }% between years of multiple citations with same author
\renewcommand{\BBC}{; }%  between cites
\renewcommand{\BBN}{, }%  before note
\renewcommand{\BCBT}{,}%  comma between authors in ref. list when no. of
                      %%  authors = 2
\renewcommand{\BCBL}{,}%  comma before last author when no. of authors > 2
%% Remove excess space with the natbibapa option
\if@APAC@natbib@apa
    \renewcommand{\BBAY}{,}%
    \renewcommand{\BBYY}{,}%
    \renewcommand{\BBC}{;}%
\fi
%%
%% Date formatting
\renewcommand{\APACmonth}[1]{\ifcase #1\or January\or February\or March\or
    April\or May\or June\or July\or August\or September\or October\or
    November\or December\or Winter\or Spring\or Summer\or Fall\else
    {#1}\fi}%
\renewcommand{\APACrefYearMonthDay}[3]{%
  {\BBOP}{#1}%           year (+ addendum); should not be empty
  \ifx\@empty#2\@empty
    \ifx\@empty#3\@empty
    \else
      \unskip, {#3}%     day
    \fi
  \else
    \unskip, {#2}%       month
    \ifx\@empty#3\@empty
    \else
      \unskip~{#3}%      day
    \fi
  \fi
  {\BBCP}%               closing parenthesis
}%
%% Some macros that transform a number (say, `2') to an ordinal one (`2nd')
\renewcommand{\PrintOrdinal}[1]{%
    \afterassignment\print@ordinal
    \count@ 0#1\relax\@nil
}%
\def\print@ordinal#1#2\@nil{%
    \ifx\relax#1\relax
        \ifnum\count@>\z@
            \CardinalNumeric\count@
        \else
            ??th%
        \fi
    \else
        \ifnum \count@>\z@ \number\count@ \fi
        #1#2\relax
    \fi
}%
\renewcommand{\CardinalNumeric}[1]{%
    \number#1\relax
    \if
        \ifnum#1<14
            \ifnum#1>\thr@@ T\else F\fi
        \else
            F%
        \fi
        T%
        th%
    \else
        \@xp\keep@last@digit\@xp#1\number#1\relax
        \ifcase#1th\or st\or nd\or rd\else th\fi
    \fi
}%
%    \end{macrocode}
% Differences between different versions of English, in particular British
% and Australian vs.\ the default American.
%    \begin{macrocode}
\def\APAC@tempb{US}%
\edef\APAC@tempa{\string UKenglish}%
\ifx\languagename\APAC@tempa
    \def\APAC@tempb{UK}%
\fi
\edef\APAC@tempa{\string british}%
\ifx\languagename\APAC@tempa
    \def\APAC@tempb{UK}%
\fi
\def\APAC@tempa{UK}
\ifx\APAC@tempa\APAC@tempb
    \renewcommand{\BCBT}{}% no comma before `\&' in British
    \renewcommand{\BCBL}{}% no comma before `\&' in British
%    \end{macrocode}
% According to \pkg{babel}'s \fname{english.dtx}, in UK English, the date
% is of the form 1st~January, although I thought January~1st was more common.
%    \begin{macrocode}
    \renewcommand{\APACrefYearMonthDay}[3]{%
      {\BBOP}{#1}%           year (+ addendum); should not be empty
      \ifx\@empty#3\@empty
        \ifx\@empty#2\@empty
        \else
          \unskip, {#2}%     month
        \fi
      \else
        \unskip, {\PrintOrdinal{#3}}%   day
        \ifx\@empty#2\@empty
        \else
          \unskip~{#2}%      month
        \fi
      \fi
      {\BBCP}%               closing parenthesis
    }%
\fi
%%
\edef\APAC@tempa{\string australian}%
\ifx\languagename\APAC@tempa
    \def\APAC@tempb{AU}%
\fi
%    \end{macrocode}
% New Zealand is equivalent to Australian for our purposes.
%    \begin{macrocode}
\edef\APAC@tempa{\string newzealand}%
\ifx\languagename\APAC@tempa
    \def\APAC@tempb{AU}%
\fi
\def\APAC@tempa{AU}
\ifx\APAC@tempa\APAC@tempb
    \renewcommand{\BCBT}{}% no comma before `\&' in AU/NZ (?)
    \renewcommand{\BCBL}{}% no comma before `\&' in AU/NZ (?)
%    \end{macrocode}
% According to \pkg{babel}'s \fname{english.dtx}, In Australian and New
% Zealand, the date is of the form 1~January.
%    \begin{macrocode}
    \renewcommand{\APACrefYearMonthDay}[3]{%
      {\BBOP}{#1}%           year (+ addendum); should not be empty
      \ifx\@empty#3\@empty
        \ifx\@empty#2\@empty
        \else
          \unskip, {#2}%     month
        \fi
      \else
        \unskip, {#3}%       day
        \ifx\@empty#2\@empty
        \else
          \unskip~{#2}%      month
        \fi
      \fi
      {\BBCP}%               closing parenthesis
    }%
\fi
%    \end{macrocode}
% Clear up some macros that are no longer needed.
%    \begin{macrocode}
\let\APAC@tempa\@undefined
\let\APAC@tempb\@undefined
%    \end{macrocode}
% Restore category code of |@| sign.
%    \begin{macrocode}
\APACrestoreAtCode
%</english>
%    \end{macrocode}
%
%
%
% \subsection{\fname{dutch.apc}}
%
% This file redefines the language-specific elements of \pkg{apacite}
% for the Dutch language. The \pkg{babel} package considers Afrikaans
% as a ``dialect'' of Dutch, but my limited knowledge of Afrikaans
% suggests that most words are spelt differently (though are phonetically
% similar), and many other words are simply different. So I doubt whether
% this file can be directly applied to Afrikaans.
%
% For compiling the translated elements, the following sources were
% used:
% \begin{enumerate}
% \item Instructions for the Dutch psychology journal ``De Psycholoog''
%       \cite{DePsych01}; indicated below as ``DP''.
% \item Instructions for the Dutch psychology journal ``Nederlands Tijdschrift
%       voor de Psychologie en haar Grensgebieden'' \cite{NTPG04};
%       indicated below as ``NTPG''.
% \item Instructions from the well-known book
%       \APACcitebtitle{Schrijfwijzer} \cite[pp.~404--410]{Renk02};
%       indicated below as ``SW''.
% \item The previous three all state that their rules are adapted from the
%       APA manual. For translations that are not explicitly mentioned in
%       these sources, I used the extensive reference list from \citeA{Schr04}.
% \item Finally, I consulted the \emph{Van Dale} English-Dutch dictionary
%       \cite{VanDale89}.
% \end{enumerate}
%
%    \begin{macrocode}
%<*dutch>
%%
%% dutch.apc - dutch translation of apacite elements
%% Written by Erik Meijer
%%
%% DP   = De Psycholoog
%% NTPG = Nederlands Tijdschrift voor de Psychologie en haar Grensgebieden
%% SW   = Schrijfwijzer
%%
%    \end{macrocode}
% A fancy way to store and restore the category code of the |@| sign,
% per Heiko Oberdiek.
%    \begin{macrocode}
\edef\APACrestoreAtCode{%
   \catcode`@=\the\catcode`@\relax
}%
\makeatletter
%%
%    \end{macrocode}
%
% Name of the reference list according to DP and NTPG.
% SW gives the following general names:
% \begin{itemize}
% \item
% ``Literatuuropgave'' [literally approx. ``Literature specification'']
% \item
% ``Literatuurlijst''  [literally ``Literature list'']
% \end{itemize}
% For more specific applications, SW gives the following names:
% \begin{itemize}
% \item
% ``Bibliografie'' [``Bibliography'', ``a more or less complete survey
%                  of publications in a certain area'']
% \item
% ``Geraadpleegde literatuur'' [``Consulted literature'']
% \item
% ``Aangehaalde literatuur'' [``Referenced literature'']
% \end{itemize}
%
%    \begin{macrocode}
\renewcommand{\onemaskedcitationmsg}[1]{%
    \emph{(#1\ citation removed for masked review)}}% !!! CHANGE
\renewcommand{\maskedcitationsmsg}[1]{%
    \emph{(#1\ citations removed for masked review)}}% !!! CHANGE
\renewcommand{\refname}{Literatuur}% Name of ref. list if it's a section.
\renewcommand{\bibname}{Literatuur}% Name of ref. list if it's a chapter.
\renewcommand{\authorindexname}{Auteursindex}% Name of author index
%%
%% A note before the references if a meta-analysis is reported.
%%
\renewcommand{\APACmetaprenote}{%
  Met een asterisk gemarkeerde referenties betreffen studies die in de
  meta-analyse zijn gebruikt.}%
%%
%% Commands for specific types of @misc entries.
\renewcommand{\bibmessage}{Bericht}%
\renewcommand{\bibcomputerprogram}{Computerprogramma}%
\renewcommand{\bibcomputerprogrammanual}{Handleiding van computerprogramma}%
\renewcommand{\bibcomputerprogramandmanual}{Computerprogramma en handleiding}%
\renewcommand{\bibcomputersoftware}{Computersoftware}%
\renewcommand{\bibcomputersoftwaremanual}{Handleiding van computersoftware}%
\renewcommand{\bibcomputersoftwareandmanual}{Computersoftware en handleiding}%
\renewcommand{\bibprogramminglanguage}{Programmeertaal}%
%%
%% Other labels
\renewcommand{\bibnodate}{z.~j.\hbox{}}% [SW] (``zonder jaartal'')
\renewcommand{\BIP}{te verschijnen}%   % [SW]
\renewcommand{\BOthers}[1]{et al.\hbox{}}%       % [DP]
\renewcommand{\BOthersPeriod}[1]{et al.\hbox{}}% % [DP]
%% NTPG requires the following, SW allows both variants:
%% \renewcommand{\BOthers}[1]{e.~a.\hbox{}}%       % [NTPG]
%% \renewcommand{\BOthersPeriod}[1]{e.~a.\hbox{}}% % [NTPG]
%%
\renewcommand{\BIn}{In}%    % for ``In '' editor...
\renewcommand{\Bby}{door}%  % for ``by '' editor... (in reprints)
%    \end{macrocode}
%
% ``Editor(s)'' is almost impossible to get right in Dutch, because SW
% and DP require the translation of ``editor(s)'' to be dependent on
% the language in which the referenced work is written:
% \begin{itemize}
% \item
% ``Red.'' (or ``red.'') for referenced works in Dutch
% \item
% ``Ed.''/``Eds.''       for referenced works in English
% \item
% ``Hrsg.''              for referenced works in German
% \item
% ``edt.''               for referenced works in French
% \end{itemize}
% NTPG does not give an explicit rule for this, but only an example
% in which an English work is referenced and ``Ed.'' is used.
%
% For the moment, I think it makes most sense to give the Dutch versions here:
%    \begin{macrocode}
\renewcommand{\BED}{red.\hbox{}}%          % [DP] (SW gives ``Red.'')
\renewcommand{\BEDS}{red.\hbox{}}%         % [DP] (SW gives ``Red.'')
%    \end{macrocode}
%
% Translators should not be mentioned according to DP.
% NTPG does not explain how to format this.
% SW gives a completely different format: ``Vertaald door:''
% [``Translated by:''] followed by the name of the translator, or if the
% translator is unknown: ``Vertaling van:'' [``Translation of:'']
% followed by the original title. This is much too complicated, so I'll
% choose a simple alternative.
%    \begin{macrocode}
\renewcommand{\BTRANS}{vert.\hbox{}}%   translator
\renewcommand{\BTRANSS}{vert.\hbox{}}%  translators
\renewcommand{\BTRANSL}{vert.\hbox{}}%  translation, for the year field
%%
\renewcommand{\BCHAIR}{voorz.\hbox{}}%  chair of symposium
\renewcommand{\BCHAIRS}{voorz.\hbox{}}% chairs
%    \end{macrocode}
%
% ``Volume'' according to SW. NTPG gives an example with ``Vol.'' but this is
% presumably dependent on the language of the referenced work as well.
%    \begin{macrocode}
\renewcommand{\BVOL}{Dl.\hbox{}}%       volume  [SW]
\renewcommand{\BVOLS}{Dl.\hbox{}}%      volumes [SW]
\renewcommand{\BNUM}{nr.\hbox{}}%       number  [SW]
\renewcommand{\BNUMS}{nr.\hbox{}}%      numbers [SW]
\renewcommand{\BEd}{dr.\hbox{}}%        edition [SW]
\renewcommand{\BCHAP}{hfdst.\hbox{}}%   chapter
\renewcommand{\BCHAPS}{hfdst.\hbox{}}%  chapters
\renewcommand{\BPG}{p.\hbox{}}%         page
\renewcommand{\BPGS}{pp.\hbox{}}% pages [SW]. DP gives ``p.'', NTPG both.
%    \end{macrocode}
% Literally translating ``Tech.'' as ``Technisch'' does not make sense.
%    \begin{macrocode}
%% Default technical report type name.
\renewcommand{\BTR}{Rapport}%
%    \end{macrocode}
% There is no Dutch ``DAI'' and the distinction between ``published'' and
% ``unpublished'' PhD theses would generally be interpreted as ``published as
% a book with an official publisher'' vs.\ ``privately published''. All PhD
% theses in the Netherlands are required to be published with an ISBN number.
% Therefore, in my view it is better to use the same term for ``published''
% and ``unpublished''. (\citeNP{Schr04} use ``dissertatie''.)
%    \begin{macrocode}
%% Default PhD thesis type name.
\renewcommand{\BUPhD}{Academisch proefschrift}% ``published''
\renewcommand{\BPhD}{Academisch proefschrift}%  ``unpublished''
%    \end{macrocode}
% There is no official forum to publish abstracts of master's theses either,
% but, unlike PhD theses, they are (generally) unpublished.
% The term used here refers to the Dutch educational system until ca. 2003.
% Since ca. 2004, universities are gradually converting to a
% bachelor--master system, so it's likely that this term will have to be
% adapted in the near future.
%    \begin{macrocode}
%% Default master's thesis type name.
\renewcommand{\BMTh}{Doctoraalscriptie}%  ``published''
\renewcommand{\BUMTh}{Doctoraalscriptie}% ``unpublished''
%%
\renewcommand{\BAuthor}{Auteur}% ``Author'' if publisher = author
%    \end{macrocode}
% From DP. They also require the original title after the
% \fieldname{originalyear}. This is not implemented here.
%    \begin{macrocode}
\renewcommand{\BOWP}{Oorspronkelijke editie}% Original work published
\renewcommand{\BREPR}{Overgenomen uit}%       Reprinted from
%%
%% THE NEXT FOUR ARE MY OWN TRANSLATIONS. CHECK!!!
%% Websites and newsgroups; note the spaces.
\renewcommand{\BAvailFrom}{Verkrijgbaar van\ }%
%% The argument is the date on which it was last checked.
\renewcommand{\BRetrieved}[1]{Op {#1} verkregen van\ }%
\renewcommand{\BRetrievedFrom}{Verkregen van\ }%
\renewcommand{\BMsgPostedTo}{Bericht geplaatst op\ }%
%%
%% Punctuation
\renewcommand{\BBOP}{(}% opening parenthesis
\renewcommand{\BBCP}{)}% closing parenthesis
\renewcommand{\BBOQ}{}%  opening quote for article title
\renewcommand{\BBCQ}{}%  closing quote for article title
\renewcommand{\BBAA}{\&}%  between authors in parenthetical cites and ref. list
\renewcommand{\BBAB}{en}%  between authors in in-text citation
\renewcommand{\BAnd}{\&}%  for ``Ed. \& Trans.'' in ref. list
\DeclareRobustCommand{\BPBI}{.~}% Period between initials
\DeclareRobustCommand{\BHBI}{.-}% Hyphen between initials
\renewcommand{\BAP}{ }%   after prefix, before first citation
\renewcommand{\BBAY}{, }% between author(s) and year
\renewcommand{\BBYY}{, }% between years of multiple citations with same author
\renewcommand{\BBC}{; }%  between cites
\renewcommand{\BBN}{, }%  before note
%%
%% No commas according to DP and SW. NTPG uses the US/APA comma.
\renewcommand{\BCBT}{}%  comma between authors in ref. list when no. of
                     %%  authors = 2
\renewcommand{\BCBL}{}%    comma before last author when no. of authors > 2
%% Remove excess space with the natbibapa option
\if@APAC@natbib@apa
    \renewcommand{\BBAY}{,}%
    \renewcommand{\BBYY}{,}%
    \renewcommand{\BBC}{;}%
\fi
%%
%% Date formatting
\renewcommand{\APACmonth}[1]{\ifcase #1\or januari\or februari\or maart\or
    april\or mei\or juni\or juli\or augustus\or september\or oktober\or
    november\or december\or winter\or lente\or zomer\or herfst\else
    {#1}\fi}%
\renewcommand{\APACrefYearMonthDay}[3]{%
  {\BBOP}{#1}%           year (+ addendum); should not be empty
  \ifx\@empty#3\@empty
    \ifx\@empty#2\@empty
    \else
      \unskip, {#2}%     month
    \fi
  \else
    \unskip, {#3}%       day
    \ifx\@empty#2\@empty
    \else
      \unskip~{#2}%      month
    \fi
  \fi
  {\BBCP}%               closing parenthesis
}%
%% Some macros that transform a number (say, `2') to a ordinal one (`2nd')
\renewcommand{\PrintOrdinal}[1]{%
    \afterassignment\print@ordinal
    \count@ 0#1\relax\@nil
}%
\def\print@ordinal#1#2\@nil{%
    \ifx\relax#1\relax
        \ifnum\count@>\z@
            \CardinalNumeric\count@
        \else
            ??e%
        \fi
    \else
        \ifnum \count@>\z@ \number\count@ \fi
        #1#2\relax
    \fi
}%
%    \end{macrocode}
% Dutch ordinal numbers are always obtained by simply putting an `e' after
% the number, so this (and perhaps the code above) can be significantly
% simplified. However, because I have trouble understanding this code (from
% the \pkg{amsrefs} package) and experimenting did not give the expected
% results, I won't mess with the code too much and stay close to the
% English code.
%    \begin{macrocode}
\renewcommand{\CardinalNumeric}[1]{%
    \number#1\relax
    \if
        \ifnum#1<14
            \ifnum#1>\thr@@ T\else F\fi
        \else
            F%
        \fi
        T%
        e%
    \else
        \@xp\keep@last@digit\@xp#1\number#1\relax
        \ifcase#1e\else e\fi
    \fi
}%
%    \end{macrocode}
% Restore category code of |@| sign.
%    \begin{macrocode}
\APACrestoreAtCode
%</dutch>
%    \end{macrocode}
%
%
%
% \subsection{\fname{finnish.apc}}
%
% This file redefines the language-specific elements of \pkg{apacite}
% for the Finnish language. Based on \citeA[Appendix~E]{KLO05}.
%
%    \begin{macrocode}
%<*finnish>
%%
%% finnish.apc - finnish version of apacite elements
%% Written by Kari Pyykk\"o, with some minor edits by Erik Meijer.
%%
%    \end{macrocode}
% A fancy way to store and restore the category code of the |@| sign,
% per Heiko Oberdiek.
%    \begin{macrocode}
\edef\APACrestoreAtCode{%
   \catcode`@=\the\catcode`@\relax
}%
\makeatletter
\renewcommand{\onemaskedcitationmsg}[1]{%
    \emph{(#1\ citation removed for masked review)}}% !!! CHANGE
\renewcommand{\maskedcitationsmsg}[1]{%
    \emph{(#1\ citations removed for masked review)}}% !!! CHANGE
\renewcommand{\refname}{Viitteet}% Name of ref. list if it's a section.
\renewcommand{\bibname}{Viitteet}% Name of ref. list if it's a chapter.
\renewcommand{\authorindexname}{Tekij\"ahakemisto}% Name of Author Index
%%
%% A note before the references if a meta-analysis is reported.
\renewcommand{\APACmetaprenote}{%
  Viitteet merkitty t\"ahtimerkeill\"a osoittaen opintojen
  sis\"altymist\"a meta-analyysiin.}%
%%
%% Commands for specific types of @misc entries.
%%
%% Msg
\renewcommand{\bibmessage}{Sanoma}%
%%
%% Computer program
\renewcommand{\bibcomputerprogram}{Tietokoneohjelma}%
%%
%% Computer program manual
\renewcommand{\bibcomputerprogrammanual}{Tietokoneohjelman k\"asikirja}%
%%
%% Computer program and manual
\renewcommand{\bibcomputerprogramandmanual}{Tietokoneohjelma ja k\"asikirja}%
%%
%% Computer software
\renewcommand{\bibcomputersoftware}{Ohjelmisto}%
%%
%% Computer software manual
\renewcommand{\bibcomputersoftwaremanual}{Ohjelmiston k\"asikirja}%
%%
%% Computer software and manual
\renewcommand{\bibcomputersoftwareandmanual}{Ohjelmisto ja k\"asikirja}%
%%
%% Programming language
\renewcommand{\bibprogramminglanguage}{Ohjelmointikieli}%
%%
%%
%% Other labels
%%
%% n.d.
\renewcommand{\bibnodate}{s.a.\hbox{}}%  ``no date'', ``sine anno''
%%
%% in press
\renewcommand{\BIP}{painossa}%        % used as year for in-press citations
%%
%% et al.: ``and others'', not necessarily with a period
\renewcommand{\BOthers}[1]{et al.\hbox{}}%
%%
%% et al.: ``and others'' with a period
\renewcommand{\BOthersPeriod}[1]{et al.\hbox{}}%
%%
%% In
\renewcommand{\BIn}{Teoksessa}%             ``In'' editor...
%%
%% by
\renewcommand{\Bby}{teoksesta}%             ``by'' editor... (in reprints)
%%
%% Ed.
\renewcommand{\BED}{toim.\hbox{}}%          editor
%%
%% Eds.
\renewcommand{\BEDS}{toim.\hbox{}}%         editors
%%
%% Trans.
\renewcommand{\BTRANS}{k\"a\"ant.\hbox{}}%  translator
%%
%% Trans.
\renewcommand{\BTRANSS}{k\"a\"ant.\hbox{}}% translators
%%
%% trans.
\renewcommand{\BTRANSL}{k\"a\"an.\hbox{}}%  translation, for the year field
%%
%% Chair
\renewcommand{\BCHAIR}{pj.\hbox{}}%         chair of symposium
%%
%% Chairs
\renewcommand{\BCHAIRS}{pj.\hbox{}}%        chairs
%%
%% Vol.
\renewcommand{\BVOL}{osa}%                  volume
%%
%% Vols.
\renewcommand{\BVOLS}{osat}%                volumes
%%
%% No.
\renewcommand{\BNUM}{nro}%                  number
%%
%% Nos.
\renewcommand{\BNUMS}{nro}%                 numbers
%%
%% ed.
\renewcommand{\BEd}{p.\hbox{}}%             edition
%%
%% chap.
\renewcommand{\BCHAP}{luku}%                chapter
%%
%% chap.
\renewcommand{\BCHAPS}{luvut}%              chapters
%%
%% p.
\renewcommand{\BPG}{s.\hbox{}}%             page
%%
%% pp.
\renewcommand{\BPGS}{s.\hbox{}}%            pages
%%
%% Tech.\ Rep.
\renewcommand{\BTR}{Tekn.\ rap.\hbox{}}%    (default) technical report type name
%%
%% (default) PhD thesis type name
\renewcommand{\BPhD}{V\"ait\"oskirja}%
%%
%% (default) unpublished PhD thesis type name
\renewcommand{\BUPhD}{Julkaisematon v\"ait\"oskirja}%
%%
%% (default) master's thesis type name
\renewcommand{\BMTh}{Pro gradu -tutkielma}%
%%
%% (default) unpublished master's thesis type name
\renewcommand{\BUMTh}{Julkaisematon pro gradu -tutkielma}%
%%
\renewcommand{\BAuthor}{Tekij\"a}% ``Author'' if publisher = author
%%
%% Original work published
\renewcommand{\BOWP}{Alkuaan julk.\hbox{}}%
%%
%% Reprinted from
\renewcommand{\BREPR}{Uudelleen julk.\hbox{}}%
%%
%% (websites) Available from; note the space.
\renewcommand{\BAvailFrom}{Saatavilla\ }%
%%
%% (websites) Retrieved ... from; note the space.
%% The argument is the date on which it was last checked.
\renewcommand{\BRetrieved}[1]{Lainattu {#1}, saatavilla\ }%
\renewcommand{\BRetrievedFrom}{Lainattu saatavilla\ }%
%%
%% (newsgroups \& forums) Message posted to; note the space.
\renewcommand{\BMsgPostedTo}{Viesti l\"ahetetty\ }%
%%
%% Punctuation
\renewcommand{\BBOP}{(}%   opening parenthesis
\renewcommand{\BBCP}{)}%   closing parenthesis
\renewcommand{\BBOQ}{}%    opening quote for article title
\renewcommand{\BBCQ}{}%    closing quote for article title
\renewcommand{\BBAA}{\&}%  between authors in parenthetical cites and ref. list
%%
%% and
\renewcommand{\BBAB}{ja}%  between authors in text
%%
\renewcommand{\BAnd}{\&}%  for ``Ed. \& Trans.'' in ref. list
\DeclareRobustCommand{\BPBI}{.~}% Period between initials
\DeclareRobustCommand{\BHBI}{.-}% Hyphen between initials
\renewcommand{\BAP}{ }%   after prefix, before first citation
\renewcommand{\BBAY}{, }% between author(s) and year
\renewcommand{\BBYY}{, }% between years of multiple citations with same author
\renewcommand{\BBC}{; }%  between cites
\renewcommand{\BBN}{, }%  before note
\renewcommand{\BCBT}{,}%  comma between authors in ref. list when no. of
                      %%  authors = 2
\renewcommand{\BCBL}{,}%  comma before last author when no. of authors > 2
%% Remove excess space with the natbibapa option
\if@APAC@natbib@apa
    \renewcommand{\BBAY}{,}%
    \renewcommand{\BBYY}{,}%
    \renewcommand{\BBC}{;}%
\fi
%%
%% Date formatting, adapted from babel's finnish.dtx
\renewcommand{\APACmonth}[1]{\ifcase #1\or
    tammikuuta\or helmikuuta\or maaliskuuta\or huhtikuuta\or
    toukokuuta\or kes\"akuuta\or hein\"akuuta\or elokuuta\or
    syyskuuta\or lokakuuta\or marraskuuta\or joulukuuta\or
%%  Winter    Spring         Summer       Fall
    talvea\or kev\"att\"a\or kes\"a\"a\or syksy\"a\else
    {#1}\fi}%
\renewcommand{\APACrefYearMonthDay}[3]{%
  {\BBOP}{#1}%             year (+ addendum); should not be empty
  \ifx\@empty#3\@empty
    \ifx\@empty#2\@empty
    \else
      \unskip, {#2}%       month
    \fi
  \else
    \unskip, {#3}.%        day
    \ifx\@empty#2\@empty
    \else
      \unskip~{#2}%        month
    \fi
  \fi
  {\BBCP}%                 closing parenthesis
}%
%%
%% Some macros that transform a number (say, `2') to an ordinal one (`2nd')
\renewcommand{\PrintOrdinal}[1]{%
    \afterassignment\print@ordinal
    \count@ 0#1\relax\@nil
}%
\def\print@ordinal#1#2\@nil{%
    \ifx\relax#1\relax
        \ifnum\count@>\z@
            \CardinalNumeric\count@
        \else
            ??.%
        \fi
    \else
        \ifnum \count@>\z@ \number\count@ \fi
        #1#2\relax
    \fi
}%
%    \end{macrocode}
% In Finnish, ordinal numbers are always obtained by simply
% putting a period after the number. So I am reusing the German code here.
% As mentioned in the section describing \fname{german.apc}, this (and perhaps
% the code above) can then be significantly simplified, but, because I (EM)
% have trouble understanding this code (from the \pkg{amsrefs} package) and
% experimenting did not give the expected results, I won't mess with the code
% too much and stay close to the English code.
%    \begin{macrocode}
\renewcommand{\CardinalNumeric}[1]{%
    \number#1\relax
    \if
        \ifnum#1<14
            \ifnum#1>\thr@@ T\else F\fi
        \else
            F%
        \fi
        T%
        .%
    \else
        \@xp\keep@last@digit\@xp#1\number#1\relax
        \ifcase#1.\else .\fi
    \fi
}%
%    \end{macrocode}
% Restore category code of |@| sign.
%    \begin{macrocode}
\APACrestoreAtCode
%</finnish>
%    \end{macrocode}
%
%
% \subsection{\fname{french.apc}}
%
% This file redefines the language-specific elements of \pkg{apacite}
% for the French language and its ``dialects'' in \pkg{babel}
% terminology.
%
%    \begin{macrocode}
%<*french>
%%
%% french.apc - french version of apacite elements
%% Adapted from english.apc by \'Eric Raufaste
%%
%    \end{macrocode}
% A fancy way to store and restore the category code of the |@| sign,
% per Heiko Oberdiek.
%    \begin{macrocode}
\edef\APACrestoreAtCode{%
   \catcode`@=\the\catcode`@\relax
}%
\makeatletter
\renewcommand{\onemaskedcitationmsg}[1]{%
    \emph{(#1\ citation removed for masked review)}}% !!! CHANGE
\renewcommand{\maskedcitationsmsg}[1]{%
    \emph{(#1\ citations removed for masked review)}}% !!! CHANGE
%%
\renewcommand{\refname}{R\'ef\'erences}% Name of ref. list if it's a section.
\renewcommand{\bibname}{R\'ef\'erences}% Name of ref. list if it's a chapter.
%% The name (heading) of the Author Index
\renewcommand{\authorindexname}{Index des auteurs}%
%%
%% A note before the references if a meta-analysis is reported.
\renewcommand{\APACmetaprenote}{%
  Les r\'ef\'erences marqu\'ees d'un ast\'erisque indiquent des \'etudes
  incluses dans la m\'eta-analyse.}%
%%
%% Commands for specific types of @misc entries.
\renewcommand{\bibmessage}{Msg}%
\renewcommand{\bibcomputerprogram}{Logiciel}%
\renewcommand{\bibcomputerprogrammanual}{Manuel de logiciel}%
\renewcommand{\bibcomputerprogramandmanual}{Logiciel et manuel}%
\renewcommand{\bibcomputersoftware}{Logiciel}%
\renewcommand{\bibcomputersoftwaremanual}{Manuel de logiciel}%
\renewcommand{\bibcomputersoftwareandmanual}{Logiciel et manuel}%
\renewcommand{\bibprogramminglanguage}{Langage de programmation}%
%%
%% Other labels
\renewcommand{\bibnodate}{s.~d.\hbox{}}%         ``no date''
\renewcommand{\BIP}{sous presse}%                ``in press''
\renewcommand{\BOthers}[1]{et al.\hbox{}}%       ``and others''
\renewcommand{\BOthersPeriod}[1]{et al.\hbox{}}% ``and others'' with a period
\renewcommand{\BIn}{In}%                 % for ``In'' editor...
\renewcommand{\Bby}{par}%                % for ``by'' editor... (in reprints)
\renewcommand{\BED}{Ed.\hbox{}}%            % editor
\renewcommand{\BEDS}{Eds.\hbox{}}%          % editors
\renewcommand{\BTRANS}{Trad.\hbox{}}%       % translator
\renewcommand{\BTRANSS}{Trad.\hbox{}}%      % translators
\renewcommand{\BTRANSL}{trad.\hbox{}}%      % translation, for the year field
\renewcommand{\BCHAIR}{Pr\'es.\hbox{}}%     % chair of symposium
\renewcommand{\BCHAIRS}{Pr\'es}%            % chairs
\renewcommand{\BVOL}{Vol.\hbox{}}%          % volume
\renewcommand{\BVOLS}{Vols.\hbox{}}%        % volumes
\renewcommand{\BNUM}{N\textsuperscript{o}}% % number
\renewcommand{\BNUMS}{N\textsuperscript{os}}% numbers
\renewcommand{\BEd}{\'ed.\hbox{}}%          % edition
\renewcommand{\BCHAP}{chap.\hbox{}}%        % chapter
\renewcommand{\BCHAPS}{chap.\hbox{}}%       % chapters
\renewcommand{\BPG}{p.\hbox{}}%             % page
\renewcommand{\BPGS}{pp.\hbox{}}%           % pages
%% Default technical report type name.
\renewcommand{\BTR}{Rapport technique}%
%% Default PhD thesis type name.
\renewcommand{\BPhD}{Th\`ese de doctorat}%
%% Default unpublished PhD thesis type name.
\renewcommand{\BUPhD}{Th\`ese de doctorat non publi\'ee}%
%% Default master's thesis type name.
\renewcommand{\BMTh}{M\'emoire de Master}%
%% Default unpublished master's thesis type name.
\renewcommand{\BUMTh}{M\'emoire de Master non publi\'e}%
%%
\renewcommand{\BAuthor}{Auteur}%% Used if publisher = author
\renewcommand{\BOWP}{\OE uvre originale publi\'ee en}%
\renewcommand{\BREPR}{R\'eimprim\'e \`a partir de}%
\renewcommand{\BAvailFrom}{Disponible sur\ }%      Websites; note the space.
%% Websites; note the space.
%% The argument is the date on which it was last checked.
\renewcommand{\BRetrieved}[1]{Consult\'e le {#1}, sur\ }%
\renewcommand{\BRetrievedFrom}{Consult\'e sur\ }%
\renewcommand{\BMsgPostedTo}{Message post\'e sur\ }% Messages; note the space.
%%
%% Punctuation
\renewcommand{\BBOP}{(}%   opening parenthesis
\renewcommand{\BBCP}{)}%   closing parenthesis
\renewcommand{\BBOQ}{}%    opening quote for article title
\renewcommand{\BBCQ}{}%    closing quote for article title
\renewcommand{\BBAA}{\&}%  between authors in parenthetical cites and ref. list
\renewcommand{\BBAB}{et}%  between authors in text
\renewcommand{\BAnd}{\&}%  for ``Ed. \& Trans.'' in ref. list
\DeclareRobustCommand{\BPBI}{.~}% Period between initials
\DeclareRobustCommand{\BHBI}{.-}% Hyphen between initials
\renewcommand{\BAP}{ }%   after prefix, before first citation
\renewcommand{\BBAY}{, }% between author(s) and year
\renewcommand{\BBYY}{, }% between years of multiple citations with same author
\renewcommand{\BBC}{~; }% between cites
\renewcommand{\BBN}{, }%  before note
\renewcommand{\BCBT}{,}%  comma between authors in ref. list when no. of
                      %%  authors = 2
\renewcommand{\BCBL}{,}%  comma before last author when no. of authors > 2
%% Remove excess space with the natbibapa option
\if@APAC@natbib@apa
    \renewcommand{\BBAY}{,}%
    \renewcommand{\BBYY}{,}%
    \renewcommand{\BBC}{~;}%
\fi
%%
%% Date formatting
\renewcommand{\APACmonth}[1]{\ifcase #1\or janvier\or f\'evrier\or mars\or
    avril\or mai\or juin\or juillet\or ao\^ut\or septembre\or octobre\or
    novembre\or d\'ecembre\or hiver\or printemps\or \'et\'e\or automne\else
    {#1}\fi}%
%% Structure taken from definition of \today in frenchb.dtx
\makeatletter
\renewcommand{\APACrefYearMonthDay}[3]{%
  {\BBOP}{#1}%          year (+ addendum); should not be empty
  \ifx\@empty#3\@empty
    \ifx\@empty#2\@empty
    \else
      \unskip, {#2}%    month
    \fi
  \else
    \unskip, {#3}%      day
    \edef\APAC@tempa{#3}%
    \edef\APAC@tempb{1}%
    \ifx\APAC@tempa\APAC@tempb\@empty {\ier}\fi
    \let\APAC@tempa\@undefined
    \let\APAC@tempb\@undefined
    %%
    \ifx\@empty#2\@empty
    \else
      \unskip~{#2}%     month
    \fi
  \fi
  {\BBCP}%              closing parenthesis
}%
%%
%% Some macros that transform a number (say, `2') to an ordinal one (`2nd')
%    \end{macrocode}
% Ordinal numbers should all be number + `\textsuperscript{e}',
% except if number = 1, then it is ``1\textsuperscript{er}'' or
% ``1\textsuperscript{re}''. \pkg{babel} provides the
% commands \cmd{\ieme}, \cmd{\ier}, and \cmd{\iere} for formatting this.
% We'll use these commands.
%
% \begin{macro}{\APACfirst}
% \begin{macro}{\PrintOrdinalMale}
% \pkg{apacite} only uses the ordinal numbers for edition numbers, and
% the gender of ``\'edition'' is feminine, so we use the feminine form
% ``1re'' by default. However, we put it in the macro \cmd{\APACfirst}.
% Then we define \cmd{\PrintOrdinalMale} to redefine \cmd{\APACfirst}
% to take the masculine form, then call \cmd{\PrintOrdinal}, and then
% revert again, so that users can use this function for masculine words
% (if desired).
%    \begin{macrocode}
\DeclareRobustCommand{\APACfirst}{1\iere}%
\DeclareRobustCommand{\PrintOrdinalMale}[1]{%
    \DeclareRobustCommand{\APACfirst}{1\ier}%
    \PrintOrdinal{#1}%
    \DeclareRobustCommand{\APACfirst}{1\iere}%
}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%    \begin{macrocode}
\renewcommand{\PrintOrdinal}[1]{%
    \afterassignment\print@ordinal
    \count@ 0#1\relax\@nil
}%
\def\print@ordinal#1#2\@nil{%
    \ifx\relax#1\relax
        \ifnum\count@>\@ne
            \CardinalNumeric\count@
        \else
            \ifnum1=\count@
                {\APACfirst}%
            \else
                ??{\ieme}%
            \fi
        \fi
    \else
        \ifnum \count@>\z@ \number\count@ \fi
        #1#2\relax
    \fi
}%
\renewcommand{\CardinalNumeric}[1]{%
    \number#1\relax
    \if
        \ifnum#1<14
            \ifnum#1>\thr@@ T\else F\fi
        \else
            F%
        \fi
        T%
        {\ieme}%
    \else
        \@xp\keep@last@digit\@xp#1\number#1\relax
        \ifcase#1{\ieme}\else {\ieme}\fi
    \fi
}%
%%
%% In French, there should be a space before a colon `:', so we have to
%% redefine a few macros that insert a colon.
\renewcommand{\APACaddressPublisher}[2]{%
  \ifx\@empty#1\@empty
      %% publisher
    \ifx\@empty#2\@empty
    \else
      {#2}%
    \fi
      %%
  \else
      %% address
    {#1}%
      %% publisher
    \ifx\@empty#2\@empty
    \else
      \unskip{} : {#2}%
    \fi
      %%
  \fi
}%
\let\APACaddressInstitution\APACaddressPublisher
\renewcommand{\APACaddressPublisherEqAuth}[2]{%
  \ifx\@empty#1\@empty
      %% Publisher. This cannot be empty, because it is equal to the
      %% author.
    {\BAuthor{}}%
      %%
  \else
      %% Address and publisher. These are not empty.
    {#1\unskip{} : \BAuthor{}}%
      %%
  \fi
}%
\let\APACaddressInstitutionEqAuth\APACaddressPublisherEqAuth
%    \end{macrocode}
% Restore category code of |@| sign.
%    \begin{macrocode}
\APACrestoreAtCode
%</french>
%    \end{macrocode}
%
%
% \subsection{\fname{german.apc} and \fname{ngerman.apc}}
%
% This file redefines the language-specific elements of \pkg{apacite}
% for the German language. These are based on the APA-inspired
% instructions from the \citeA{DGPs07}. There is the traditional orthography
% (`german') and the new orthography (`ngerman'), which are treated as
% completely different languages by \pkg{babel} (unlike, e.g., the two
% Norwegian languages), which presumably has technical reasons. We start
% with `german'.
%
%    \begin{macrocode}
%<*german>
%%
%% german.apc - Deutsche Uebersetzung der Apacite-Elemente
%%              (German version of apacite elements)
%% Written by Andreas Poege
%% Some additions and adaptations by Erik Meijer.
%%
%    \end{macrocode}
% A fancy way to store and restore the category code of the |@| sign,
% per Heiko Oberdiek.
%    \begin{macrocode}
\edef\APACrestoreAtCode{%
   \catcode`@=\the\catcode`@\relax
}%
\makeatletter
\renewcommand{\onemaskedcitationmsg}[1]{%
    \emph{(#1\ citation removed for masked review)}}% !!! CHANGE
\renewcommand{\maskedcitationsmsg}[1]{%
    \emph{(#1\ citations removed for masked review)}}% !!! CHANGE
%% Bezeichnung fuer das Literaturverzeichnis, falls Section
\renewcommand{\refname}{Literatur}%
%% Bezeichnung fuer das Literaturverzeichnis, falls Chapter
\renewcommand{\bibname}{Literaturverzeichnis}%
%% Bezeichnung (heading) des Autorenverzeichnisses
\renewcommand{\authorindexname}{Autorenregister}%
%%
%% Bemerkung vor Literaturangaben, falls eine Metaanalyse angegeben wurde
\renewcommand{\APACmetaprenote}{Literaturangaben mit Stern kennzeichnen
  Studien der Metaanalyse.}%
%%
%% Befehle fuer die speziellen @misc-Eintraege.
\renewcommand{\bibmessage}{Msg.\hbox{}}% Newsgroup-, Internet-Messages
\renewcommand{\bibcomputerprogram}{Computerprogramm}%
\renewcommand{\bibcomputerprogrammanual}{Programm-Handbuch}%
\renewcommand{\bibcomputerprogramandmanual}{Computerprogramm und Handbuch}%
\renewcommand{\bibcomputersoftware}{Software}%
\renewcommand{\bibcomputersoftwaremanual}{Software-Handbuch}%
\renewcommand{\bibcomputersoftwareandmanual}{Software und Handbuch}%
\renewcommand{\bibprogramminglanguage}{Programmiersprache}%
%%
%% Weitere Labels
\renewcommand{\bibnodate}{o.\,J.\hbox{}}% "`ohne Jahresangabe"'
\renewcommand{\BIP}{in Druck}%          % Jahresangabe bei im Druck bef. Werken
%%
%% "`und andere"', das Argument beinhaltet einen Punkt, um einen weiteren im
%% Literaturverzeichnis zu unterdruecken
\renewcommand{\BOthers}[1]{et al.\hbox{}}%
%% "`und andere"', das Argument beinhaltet einen Punkt, um einen weiteren im
%% Literaturverzeichnis zu unterdruecken.
\renewcommand{\BOthersPeriod}[1]{et al.\hbox{}}%
%%
\renewcommand{\BIn}{In}%            % fuer "`In"' Herausgeber...
\renewcommand{\Bby}{von}%           % fuer "`von"' Herausgeber... (Nachdruck)
\renewcommand{\BED}{Hrsg.\hbox{}}%      % Herausgeber(in)
\renewcommand{\BEDS}{Hrsg.\hbox{}}%     % Herausgeber(innen)
\renewcommand{\BTRANS}{\"Ubers.\hbox{}}%% Uebersetzer(in)
\renewcommand{\BTRANSS}{\"Ubers.\hbox{}}% Uebersetzer(innen)
\renewcommand{\BTRANSL}{\"Ubers.\hbox{}}% Uebersetzung (bei der Jahresangabe)
\renewcommand{\BCHAIR}{Chair}%          % Chair (bei Konferenzen)
\renewcommand{\BCHAIRS}{Chairs}%        % Chairs (bei Konferenzen)
\renewcommand{\BVOL}{Bd.\hbox{}}%       % Band
\renewcommand{\BVOLS}{Bde.\hbox{}}%     % Baende
\renewcommand{\BNUM}{Nr.\hbox{}}%       % Nummer
\renewcommand{\BNUMS}{Nr.\hbox{}}%      % Nummern
\renewcommand{\BEd}{Aufl.\hbox{}}%      % Auflage
\renewcommand{\BCHAP}{Kap.\hbox{}}%     % Kapitel
\renewcommand{\BCHAPS}{Kap.\hbox{}}%    % Kapitel
\renewcommand{\BPG}{S.\hbox{}}%         % Seite
\renewcommand{\BPGS}{S.\hbox{}}%        % Seiten
%%
%% (default) Bezeichnung fuer "`technical report"'
\renewcommand{\BTR}{Bericht}%
%% (default) Bezeichnung fuer Dissertation
\renewcommand{\BPhD}{Dissertation}%
%% (default) Bezeichnung fuer unveroeffentlichte Dissertation
\renewcommand{\BUPhD}{Unver\"offentlichte Dissertation}%
%% (default) Bezeichnung fuer Abschlussarbeit
\renewcommand{\BMTh}{Diplomarbeit}%
%% (default) Bezeichnung fuer unveroeffentlichte Abschlussarbeit
\renewcommand{\BUMTh}{Unver\"offentlichte Diplomarbeit}%
%%
\renewcommand{\BAuthor}{Autor}%      % ``Autor'' falls publisher = author
\renewcommand{\BOWP}{Originalausgabe}% Originalausgabe
\renewcommand{\BREPR}{Nachdruck von}%  Nachdruck von
%% Websites; note the spaces.
\renewcommand{\BAvailFrom}{Verf\"ugbar unter\ }%
%% The argument is the date on which it was last checked.
\renewcommand{\BRetrieved}[1]{Zugriff am {#1} auf\ }%
\renewcommand{\BRetrievedFrom}{Zugriff auf\ }%
%% Note that here the English phrase is left untranslated in German.
\renewcommand{\BMsgPostedTo}{Message posted to\ }%
%%
%% Deutsche Anpassung der Interpunktion und Formatierung
\renewcommand{\BBOP}{(}% % Einleitende Klammer (default "(")
\renewcommand{\BBCP}{)}% % Abschliessende Klammer (default ")")
\renewcommand{\BBOQ}{}%  % Einleitung v. Titel v. Artikel (default "")
\renewcommand{\BBCQ}{}%  % Abschluss v. Titel. von Artikel (default "")
\renewcommand{\BBAA}{\&}%% Zwischen Autoren in Klammern (default "\&")
\renewcommand{\BBAB}{und}% Zwischen Autoren im Text
\renewcommand{\BAnd}{\&}%% Zwischen Hg. und Uebers., falls gleich (default "\&")
\DeclareRobustCommand{\BPBI}{.~}% Period between initials
\DeclareRobustCommand{\BHBI}{.-}% Hyphen between initials
\renewcommand{\BAP}{ }%  % Zeichen zw. Prefix und Zitat (default Leerzeichen)
\renewcommand{\BBAY}{, }% Zwischen Autoren und Jahr(en) (default ", ")
\renewcommand{\BBYY}{, }% Zwischen Jahren, wenn ein Author und mehrere Jahre
\renewcommand{\BBC}{; }%  Zwischen Autoren (mehrere Zitate) (default "; ")
\renewcommand{\BBN}{, }%  Zwischen Zitat und Postfix (default ", ")
\renewcommand{\BCBT}{}%   Zwischen 2 Autoren (zus. zu "&", default ",")
\renewcommand{\BCBL}{}%   Zwischen 3 o. mehr Autoren (zus. zu "&", default ",")
%% Remove excess space with the natbibapa option
\if@APAC@natbib@apa
    \renewcommand{\BBAY}{,}%
    \renewcommand{\BBYY}{,}%
    \renewcommand{\BBC}{;}%
\fi
%%
%% Date formatting, adapted from babel's germanb.dtx
\renewcommand{\APACmonth}[1]{\ifcase #1\or
  Januar\or Februar\or M\"arz\or April\or Mai\or Juni\or
  Juli\or August\or September\or Oktober\or November\or Dezember\or
  Winter\or Fr\"uhjahr\or Sommer\or Herbst\else {#1}\fi}%
\renewcommand{\APACrefYearMonthDay}[3]{%
  {\BBOP}{#1}%            year (+ addendum); should not be empty
  \ifx\@empty#3\@empty
    \ifx\@empty#2\@empty
    \else
      \unskip, {#2}%      month
    \fi
  \else
    \unskip, {#3}.%       day
    \ifx\@empty#2\@empty
    \else
      \unskip~{#2}%       month
    \fi
  \fi
  {\BBCP}%                closing parenthesis
}%
%% Some macros that transform a number (say, `2') to an ordinal one (`2nd'),
%% adapted from amsrefs.dtx
\renewcommand{\PrintOrdinal}[1]{%
    \afterassignment\print@ordinal
    \count@ 0#1\relax\@nil
}%
\def\print@ordinal#1#2\@nil{%
    \ifx\relax#1\relax
        \ifnum\count@>\z@
            \CardinalNumeric\count@
        \else
            ??.%
        \fi
    \else
        \ifnum \count@>\z@ \number\count@ \fi
        #1#2\relax
    \fi
}%
%    \end{macrocode}
% German ordinal numbers are always obtained by simply putting a period after
% the number, so this (and perhaps the code above) can be significantly
% simplified. However, because I (EM) have trouble understanding this code (from
% the \pkg{amsrefs} package) and experimenting did not give the expected
% results, I won't mess with the code too much and stay close to the
% English code.
%    \begin{macrocode}
\renewcommand{\CardinalNumeric}[1]{%
    \number#1\relax
    \if
        \ifnum#1<14
            \ifnum#1>\thr@@ T\else F\fi
        \else
            F%
        \fi
        T%
        .%
    \else
        \@xp\keep@last@digit\@xp#1\number#1\relax
        \ifcase#1.\else .\fi
    \fi
}%
%    \end{macrocode}
% The DGPs puts a space between the volume and the issue number,
% unlike the APA. So we have to slightly adapt this command.
% (|#1| = journal, |#2| = volume, |#3| = number, |#4| = formatted pages).
%    \begin{macrocode}
\renewcommand{\APACjournalVolNumPages}[4]{%
  \Bem{#1}%             journal
  \ifx\@empty#2\@empty
  \else
    \unskip, \Bem{#2}%  volume
  \fi
  \ifx\@empty#3\@empty
  \else
    \unskip\ ({#3})%    issue number, with the added leading space
  \fi
  \ifx\@empty#4\@empty
  \else
    \unskip, {#4}%      pages
  \fi
}%
%    \end{macrocode}
% Presumably, for the original journal information of a reprint, a similar
% space needs to be added.
% Arguments: |#1| = year, |#2| = journal, |#3| = volume, |#4| = issue number,
%            |#5| = formatted pages, |#6| = note.
%    \begin{macrocode}
\renewcommand{\APACorigjournalnote}[6]{%
  (\BREPR{} %          ``(Reprinted from '' (note the space)
  \Bem{#2}%            Journal (should not be empty)
  \ifx\@empty#1\@empty
  \else
    \unskip, {#1}%     , year
  \fi
  \ifx\@empty#3\@empty
  \else
    \unskip, \Bem{#3}% , volume
  \fi
  \ifx\@empty#4\@empty
  \else
    \unskip\ {[#4]}%   \ [issue number]
  \fi
  \ifx\@empty#5\@empty
  \else
    \unskip, {#5}%     , pages
  \fi
  \ifx\@empty#6\@empty
  \else
    \unskip; {#6}%     ; note
  \fi
  )%                   Final parenthesis
}%
%    \end{macrocode}
% Differences between Austrian and German. (Apparently only the name of
% January---``J\"anner'' vs.\ ``Januar''.)
%    \begin{macrocode}
\edef\APACaustrian{\string austrian}%
\ifx\languagename\APACaustrian
  \renewcommand{\APACmonth}[1]{\ifcase #1\or
    J\"anner\or Februar\or M\"arz\or April\or Mai\or Juni\or
    Juli\or August\or September\or Oktober\or November\or Dezember\or
    Winter\or Fr\"uhjahr\or Sommer\or Herbst\else {#1}\fi}%
\fi
\let\APACaustrian\undefined
%    \end{macrocode}
% Restore category code of |@| sign.
%    \begin{macrocode}
\APACrestoreAtCode
%</german>
%    \end{macrocode}
%
%
% Now, the file for the new orthography. Apparently, \fname{german.apc}
% can also be used for the new orthography, so this is a very brief one:
%
%    \begin{macrocode}
%<*ngerman>
%%
%% ngerman.apc - german translation of apacite elements (new orthography)
%% Written by Erik Meijer, based on instructions of Andreas Poege.
%%
%% According to Andreas Poege, his file german.apc can also be used
%% for the new orthography, so I'll just do this:
%%
\input{german.apc}%
%%
%    \end{macrocode}
% Differences between Austrian and German. (Apparently only the name of
% January---``J\"anner'' vs.\ ``Januar''.) This is not picked up in
% \fname{german.apc}, because that file only checks for ``austrian'',
% not for ``naustrian'', so we have to copy it here.
%    \begin{macrocode}
\edef\APACaustrian{\string naustrian}%
\ifx\languagename\APACaustrian
  \renewcommand{\APACmonth}[1]{\ifcase #1\or
    J\"anner\or Februar\or M\"arz\or April\or Mai\or Juni\or
    Juli\or August\or September\or Oktober\or November\or Dezember\or
    Winter\or Fr\"uhjahr\or Sommer\or Herbst\else {#1}\fi}%
\fi
\let\APACaustrian\undefined
%%
%%
%</ngerman>
%    \end{macrocode}
%
%
% \subsection{\fname{greek.apc}}
%
% This file redefines the language-specific elements of \pkg{apacite}
% for the Greek language.
%
%    \begin{macrocode}
%<*greek>
%%
%% greek.apc - Greek version of apacite elements
%% Greek translations by Athanassios Protopapas and Ioannis Dimakos
%%
%    \end{macrocode}
% A fancy way to store and restore the category code of the |@| sign,
% per Heiko Oberdiek.
%    \begin{macrocode}
\edef\APACrestoreAtCode{%
   \catcode`@=\the\catcode`@\relax
}%
\makeatletter
\renewcommand{\onemaskedcitationmsg}[1]{%
    \emph{(#1\ citation removed for masked review)}}% !!! CHANGE
\renewcommand{\maskedcitationsmsg}[1]{%
    \emph{(#1\ citations removed for masked review)}}% !!! CHANGE
%% Name of ref. list if it's a section.
\renewcommand{\refname}{\textgreek{Bibliograf'ia}}%
%% Name of ref. list if it's a chapter.
\renewcommand{\bibname}{\textgreek{Bibliograf'ia}}%
%% The name (heading) of the Author Index
\renewcommand{\authorindexname}{\textgreek{Euret'hrio suggraf'ewn}}%
%%
%% A note before the references if a meta-analysis is reported.
\renewcommand{\APACmetaprenote}{%
    \textgreek{Oi ergas'iec pou sumperilamb'anontai sth meta-an'alush
    shmei'wnontai me aster'isko}.}%
%%
%% Commands for specific types of @misc entries.
\renewcommand{\bibmessage}{\textgreek{M'hnuma}}%
\renewcommand{\bibcomputerprogram}{\textgreek{Logismik'o}}%
\renewcommand{\bibcomputerprogrammanual}{%
  \textgreek{Egqeir'idio logismiko'u}}%
\renewcommand{\bibcomputerprogramandmanual}{%
  \textgreek{Logismik'o kai egqeir'idio}}%
\renewcommand{\bibcomputersoftware}{\textgreek{Logismik'o}}%
\renewcommand{\bibcomputersoftwaremanual}{%
  \textgreek{Egqeir'idio logismiko'u}}%
\renewcommand{\bibcomputersoftwareandmanual}{%
  \textgreek{Logismik'o kai egqeir'idio}}%
\renewcommand{\bibprogramminglanguage}{%
  \textgreek{Gl'wssa programmatismo'u}}%
%%
%% Other labels
\renewcommand{\bibnodate}{\textgreek{qwr'ic hmeromhn'ia}}% ``no date''
\renewcommand{\BIP}{\textgreek{up'o 'ekdosh}}%           % ``in press''
\renewcommand{\BOthers}[1]{\textgreek{k.\ sun.\hbox{}}}% ``and others''
%% ``and others'' with a period
\renewcommand{\BOthersPeriod}[1]{\textgreek{k.\ sun.\hbox{}}}%
\renewcommand{\BIn}{\textgreek{Sto}}%% for ``In'' editor...
%    \end{macrocode}
% The current command \cmd{\Bby} is problematic for application in Greek.
% If it is followed by 1 male editor, then it should be ``|\textgreek{toy}|'';
% in the case of 1 female editor, it should be ``|\textgreek{ths}|''; with
% multiple editors, ``|\textgreek{twn}|'' is the correct translation. For
% the moment, let's use the latter, which is gender-neutral and perhaps the
% most common one. Note that a user can apply the sort of tricks that we
% used in section~\ref{sec:xmpl} (Example~69) to make a one-time change to
% the definition of \cmd{\Bby}. See the command \cmd{\bibInstring} in
% section~\ref{sec:apacdoc}.
%    \begin{macrocode}
\renewcommand{\Bby}{\textgreek{twn}}%  for ``by'' editor... (in reprints)
\renewcommand{\BED}{\textgreek{Epim.\hbox{}}}%   % editor
\renewcommand{\BEDS}{\textgreek{Epim.\hbox{}}}%  % editors
\renewcommand{\BTRANS}{\textgreek{Mtf.\hbox{}}}% % translator
\renewcommand{\BTRANSS}{\textgreek{Mtf.\hbox{}}}%% translators
\renewcommand{\BTRANSL}{\textgreek{mtf.\hbox{}}}%% translation
\renewcommand{\BCHAIR}{\textgreek{Pr'oedroc}}%   % chair of symposium
\renewcommand{\BCHAIRS}{\textgreek{Pr'oedroi}}%  % chairs
\renewcommand{\BVOL}{\textgreek{t.\hbox{}}}%     % volume
\renewcommand{\BVOLS}{\textgreek{t.\hbox{}}}%    % volumes
\renewcommand{\BNUM}{\textgreek{ar.\hbox{}}}%    % number
\renewcommand{\BNUMS}{\textgreek{ar.\hbox{}}}%   % numbers
\renewcommand{\BEd}{\textgreek{'ekd.\hbox{}}}%   % edition
\renewcommand{\BCHAP}{\textgreek{kef.\hbox{}}}%  % chapter
\renewcommand{\BCHAPS}{\textgreek{kef.\hbox{}}}% % chapters
\renewcommand{\BPG}{\textgreek{sel.\hbox{}}}%    % page
\renewcommand{\BPGS}{\textgreek{sel.\hbox{}}}%   % pages
%% Default technical report type name.
\renewcommand{\BTR}{\textgreek{Teq.\ 'ekj.\hbox{}}}%
%% Default PhD thesis type name.
\renewcommand{\BPhD}{\textgreek{Didaktorik'h diatrib'h}}%
%% (default) unpublished PhD thesis type name
\renewcommand{\BUPhD}{\textgreek{Adhmos'ieuth didaktorik'h diatrib'h}}%
%% (default) master's thesis type name
\renewcommand{\BMTh}{\textgreek{Metaptuqiak'h diplwmatik'h ergas'ia}}%
%% (default) unpublished master's thesis type name
\renewcommand{\BUMTh}{%
  \textgreek{Adhmos'ieuth metaptuqiak'h diplwmatik'h ergas'ia}}%
%% ``Author'' if publisher = author
\renewcommand{\BAuthor}{\textgreek{Auto'ekdosh}}%
%% Original work published
\renewcommand{\BOWP}{\textgreek{'Ekdosh prwtot'upou}}%
%% Reprinted from
\renewcommand{\BREPR}{\textgreek{Anat'upwsh ap'o}}%
%% Websites; note the explicit spaces.
\renewcommand{\BAvailFrom}{\textgreek{Diaj'esimo ap'o}\ }% Available from
%% Retrieved ... from
%% The argument is the date on which it was last checked.
%% Correct only when ``date'' is full, not just month or year
\renewcommand{\BRetrieved}[1]{%
    \textgreek{Anakt'hjhke stis} {#1}, \textgreek{ap'o}\ }%
\renewcommand{\BRetrievedFrom}{%
    \textgreek{Anakt'hjhke stis} \textgreek{ap'o}\ }%
%    \end{macrocode}
% If a URL follows without any leading words/phrase then this string
% should be OK. If there is any other word before the URL then we
% need to know its gender and number in order to produce the correct
% translation. In the current \pkg{apacite} implementation, this is only
% used with a URL immediately following, so we should be OK.
%    \begin{macrocode}
%% Newsgroups, forums, etc.; ``Message posted to ''; note the space.
\renewcommand{\BMsgPostedTo}{\textgreek{M'hnyma anarthm'eno se}\ }%
%%
%% Punctuation
\renewcommand{\BBOP}{(}%   opening parenthesis
\renewcommand{\BBCP}{)}%   closing parenthesis
\renewcommand{\BBOQ}{}%    opening quote for article title
\renewcommand{\BBCQ}{}%    closing quote for article title
\renewcommand{\BBAA}{\&}%  between authors in parenthetical cites and ref. list
\renewcommand{\BBAB}{\textgreek{kai}}% between authors in text
\renewcommand{\BAnd}{\&}%  for ``Ed. \& Trans.'' in ref. list
\DeclareRobustCommand{\BPBI}{.~}% Period between initials
\DeclareRobustCommand{\BHBI}{.-}% Hyphen between initials
\renewcommand{\BAP}{ }%   after prefix, before first citation
\renewcommand{\BBAY}{, }% between author(s) and year
\renewcommand{\BBYY}{, }% between years of multiple citations with same author
\renewcommand{\BBC}{; }%  between cites
\renewcommand{\BBN}{, }%  before note
\renewcommand{\BCBT}{,}%  comma between authors in ref. list when no. of
                      %%  authors = 2
\renewcommand{\BCBL}{,}%  comma before last author when no. of authors > 2
%% Remove excess space with the natbibapa option
\if@APAC@natbib@apa
    \renewcommand{\BBAY}{,}%
    \renewcommand{\BBYY}{,}%
    \renewcommand{\BBC}{;}%
\fi
%%
%% Date formatting. Adapted from babel's greek.dtx
\renewcommand{\APACmonth}[1]{\textgreek{\ifcase #1\or
    Ianouar'iou\or Febrouar'iou\or Mart'iou\or April'iou\or
    Ma'"iou\or Ioun'iou\or Ioul'iou\or Augo'ustou\or
    Septembr'iou\or Oktwbr'iou\or Noembr'iou\or Dekembr'iou\or
    Qeim'wnas\or 'Anoixh\or Kaloka'iri\or Fjin'opwro\else
    {#1}\fi}}%
\renewcommand{\APACrefYearMonthDay}[3]{%
  {\BBOP}{#1}%             year (+ addendum); should not be empty
  \ifx\@empty#3\@empty
    \ifx\@empty#2\@empty
    \else
      \unskip, {#2}%       month
    \fi
  \else
    \unskip, {#3}%         day
    \ifx\@empty#2\@empty
    \else
      \unskip~{#2}%        month
    \fi
  \fi
  {\BBCP}%                 closing parenthesis
}%
%%
%    \end{macrocode}
% The ordinal numbers are used only for editions in the current version of
% \pkg{apacite}. Hence, we simply tag a ``|\textgreek{h}|'' to the number.
% We could provide alternative versions later on if desired (see, e.g.,
% \fname{french.apc}).
%    \begin{macrocode}
%% Some macros that transform a number (say, `2') to an ordinal one (`2h').
\renewcommand{\PrintOrdinal}[1]{%
    \afterassignment\print@ordinal
    \count@ 0#1\relax\@nil
}%
\def\print@ordinal#1#2\@nil{%
    \ifx\relax#1\relax
        \ifnum\count@>\z@
            \CardinalNumeric\count@
        \else
            ??\textgreek{h}%
        \fi
    \else
        \ifnum \count@>\z@ \number\count@ \fi
        #1#2\relax
    \fi
}%
\renewcommand{\CardinalNumeric}[1]{%
    \number#1\relax
    \if
        \ifnum#1<14
            \ifnum#1>\thr@@ T\else F\fi
        \else
            F%
        \fi
        T%
        \textgreek{h}%
    \else
        \@xp\keep@last@digit\@xp#1\number#1\relax
        \ifcase#1\textgreek{h}\or \textgreek{h}\else \textgreek{h}\fi
    \fi
}%
%    \end{macrocode}
% Restore category code of |@| sign.
%    \begin{macrocode}
\APACrestoreAtCode
%</greek>
%    \end{macrocode}
%
%
% \subsection{\fname{norsk.apc}}
%
% This file redefines the language-specific elements of \pkg{apacite}
% for both Norwegian languages (Bokm{\aa}l and Nynorsk). In \pkg{babel}'s
% setup, `norsk' is Bokm{\aa}l and `nynorsk' is a dialect of `norsk'.
% This does not seem to reflect the relation between these languages
% very well, but for compatibility with \pkg{babel} we use the same
% file structure, i.e., \fname{norsk.apc} defines both languages.
%
% There are no official Norwegian translations of APA style. Some ideas
% for this translation have been taken from \citeA{UIB08} and \citeA{UiO06}.
%
%    \begin{macrocode}
%<*norsk>
%%
%% norsk.apc - Norwegian Bokmal & Nynorsk versions of apacite elements.
%% Version 1.1.
%% Written by Karl Ove Hufthammer.
%%
%    \end{macrocode}
% A fancy way to store and restore the category code of the |@| sign,
% per Heiko Oberdiek.
%    \begin{macrocode}
\edef\APACrestoreAtCode{%
   \catcode`@=\the\catcode`@\relax
}%
\makeatletter
\renewcommand{\onemaskedcitationmsg}[1]{%
    \emph{(#1\ citation removed for masked review)}}% !!! CHANGE
\renewcommand{\maskedcitationsmsg}[1]{%
    \emph{(#1\ citations removed for masked review)}}% !!! CHANGE
\renewcommand{\refname}{Referanser}% Name of ref. list if it's a section.
\renewcommand{\bibname}{Referanser}% Name of ref. list if it's a chapter.
%% The name (heading) of the Author Index
\renewcommand{\authorindexname}{Forfatterregister}%
%%
%% A note before the references if a meta-analysis is reported.
\renewcommand{\APACmetaprenote}{%
    Referanser merket med en stjerne viser til studier som er med i
    metaanalysen.}
%%
%% Commands for specific types of @misc entries.
\renewcommand{\bibmessage}{innlegg}%
\renewcommand{\bibcomputerprogram}{dataprogram}%
\renewcommand{\bibcomputerprogrammanual}{dataprogramh\aa ndbok}%
\renewcommand{\bibcomputerprogramandmanual}{dataprogram og brukerh\aa ndbok}%
\renewcommand{\bibcomputersoftware}{programvare}%
\renewcommand{\bibcomputersoftwaremanual}{programvareh\aa ndbok}%
\renewcommand{\bibcomputersoftwareandmanual}{programvare og brukerh\aa ndbok}%
\renewcommand{\bibprogramminglanguage}{programmeringsspr\aa k}%
%%
%% Other labels
\renewcommand{\bibnodate}{u.d.\hbox{}}%    ``no date''
\renewcommand{\BIP}{under publisering}%    ``in press''
\renewcommand{\BOthers}[1]{et al.\hbox{}}% ``and others''
\renewcommand{\BOthersPeriod}[1]{et al.\hbox{}}% ``and others'', with a period
\renewcommand{\BIn}{I}%               %    for ``In'' editor...
\renewcommand{\Bby}{av}%              %    for ``by'' editor... (in reprints)
\renewcommand{\BED}{red.\hbox{}}%     % editor
\renewcommand{\BEDS}{red.\hbox{}}%    % editors
\renewcommand{\BTRANS}{oms.\hbox{}}%  % translator
\renewcommand{\BTRANSS}{oms.\hbox{}}% % translators
\renewcommand{\BTRANSL}{oms.\hbox{}}% % translation, for the year field
\renewcommand{\BCHAIR}{ordstyrer}%    % chair of symposium
\renewcommand{\BCHAIRS}{ordstyrere}%  % chairs
\renewcommand{\BVOL}{vol.\hbox{}}%    % volume
\renewcommand{\BVOLS}{vol.\hbox{}}%   % volumes
\renewcommand{\BNUM}{nr.\hbox{}}%     % number
\renewcommand{\BNUMS}{nr.\hbox{}}%    % numbers
\renewcommand{\BEd}{utg.\hbox{}}%     % edition
\renewcommand{\BCHAP}{kap.\hbox{}}%   % chapter
\renewcommand{\BCHAPS}{kap.\hbox{}}%  % chapters
\renewcommand{\BPG}{s.\hbox{}}%       % page
\renewcommand{\BPGS}{s.\hbox{}}%      % pages
%% Default technical report type name.
\renewcommand{\BTR}{Teknisk rapport}%
%% Default PhD thesis type name.
\renewcommand{\BPhD}{Akademisk avhandling}%
%% Default unpublished PhD thesis type name.
\renewcommand{\BUPhD}{Upublisert akademisk avhandling}%
%% Default master's thesis type name.
\renewcommand{\BMTh}{Masteroppgave}%
%% Default unpublished master's thesis type name.
\renewcommand{\BUMTh}{Upublisert masteroppgave}%
%%
\renewcommand{\BAuthor}{Forfatter}%  ``Author'' if publisher = author
\renewcommand{\BOWP}{Original publisert}% Original work published
\renewcommand{\BREPR}{Opptrykk fra}%      Reprinted from
\renewcommand{\BAvailFrom}{Tilgjengelig fra\ }% Websites; note the space.
%% The argument is the date on which it was last checked.
\renewcommand{\BRetrieved}[1]{Hentet {#1} fra\ }% Websites; note the space.
\renewcommand{\BRetrievedFrom}{Hentet fra\ }%     Websites; note the space.
\renewcommand{\BMsgPostedTo}{Innlegg p\aa \ }% Messages; note the space.
%    \end{macrocode}
% To be in line with Norwegian rules of punctuation, a comma is never
% used before `\&' or ``and'', and there is no space between initials.
%    \begin{macrocode}
%%
%% Punctuation
\renewcommand{\BBOP}{(}%  opening parenthesis
\renewcommand{\BBCP}{)}%  closing parenthesis
\renewcommand{\BBOQ}{}%   opening quote for article title
\renewcommand{\BBCQ}{}%   closing quote for article title
\renewcommand{\BBAA}{\&}% between authors in parenthetical cites and ref. list
\renewcommand{\BBAB}{og}% between authors in text
\renewcommand{\BAnd}{\&}% for ``Ed. \& Trans.'' in ref. list
\DeclareRobustCommand{\BPBI}{.}% Period between initials; no space
\DeclareRobustCommand{\BHBI}{.-}% Hyphen between initials
\renewcommand{\BAP}{ }%   after prefix, before first citation
\renewcommand{\BBAY}{, }% between author(s) and year
\renewcommand{\BBYY}{, }% between years of multiple citations with same author
\renewcommand{\BBC}{; }%  between cites
\renewcommand{\BBN}{, }%  before note
\renewcommand{\BCBT}{}%   no comma between authors in ref. list when no. of
                      %%  authors = 2
\renewcommand{\BCBL}{}%   no comma before last author when no. of authors > 2
%% Remove excess space with the natbibapa option
\if@APAC@natbib@apa
    \renewcommand{\BBAY}{,}%
    \renewcommand{\BBYY}{,}%
    \renewcommand{\BBC}{;}%
\fi
%%
%% Date formatting; adapted from babel's norsk.dtx
\renewcommand{\APACmonth}[1]{\ifcase #1\or
    januar\or februar\or mars\or april\or mai\or juni\or
    juli\or august\or september\or oktober\or november\or desember\or
    vinter\or v{\aa}r\or sommer\or h{\o}st\else
    {#1}\fi}%
\renewcommand{\APACrefYearMonthDay}[3]{%
  {\BBOP}{#1}%             year (+ addendum); should not be empty
  \ifx\@empty#3\@empty
    \ifx\@empty#2\@empty
    \else
      \unskip, {#2}%       month
    \fi
  \else
    \unskip, {#3}.%        day
    \ifx\@empty#2\@empty
    \else
      \unskip~{#2}%        month
    \fi
  \fi
  {\BBCP}%                 closing parenthesis
}%
%% Some macros that transform a number (say, `2') to an ordinal one (`2nd')
\renewcommand{\PrintOrdinal}[1]{%
    \afterassignment\print@ordinal
    \count@ 0#1\relax\@nil
}%
\def\print@ordinal#1#2\@nil{%
    \ifx\relax#1\relax
        \ifnum\count@>\z@
            \CardinalNumeric\count@
        \else
            ??.%
        \fi
    \else
        \ifnum \count@>\z@ \number\count@ \fi
        #1#2\relax
    \fi
}%
%    \end{macrocode}
% Norwegian ordinal numbers are always obtained by simply putting a period
% after the number, so this (and perhaps the code above) can be significantly
% simplified. However, because I (EM) have trouble understanding this code (from
% the \pkg{amsrefs} package) and experimenting did not give the expected
% results, I won't mess with the code too much and stay close to the
% English code.
%    \begin{macrocode}
\renewcommand{\CardinalNumeric}[1]{%
    \number#1\relax
    \if
        \ifnum#1<14
            \ifnum#1>\thr@@ T\else F\fi
        \else
            F%
        \fi
        T%
        .%
    \else
        \@xp\keep@last@digit\@xp#1\number#1\relax
        \ifcase#1.\else .\fi
    \fi
}%
%%
%% Differences between norsk (bokmal) and nynorsk.
\edef\APACnynorsk{\string nynorsk}%
\ifx\languagename\APACnynorsk
  \renewcommand{\refname}{Referansar}% Name of ref. list if it's a section.
  \renewcommand{\bibname}{Referansar}% Name of ref. list if it's a chapter.
  \renewcommand{\authorindexname}{Forfattarregister}%
  \renewcommand{\APACmetaprenote}{%
    Referansar merkte med ei stjerne viser til studiar som er med i
    metaanalysen.}%
  \renewcommand{\bibcomputerprogrammanual}{dataprogramhandbok}%
  \renewcommand{\bibcomputerprogramandmanual}{dataprogram og brukarhandbok}%
  \renewcommand{\bibcomputersoftwaremanual}{programvarehandbok}%
  \renewcommand{\bibcomputersoftwareandmanual}{programvare og brukarhandbok}%
  \renewcommand{\BCHAIR}{ordstyrar}%        % chair of symposium
  \renewcommand{\BCHAIRS}{ordstyrarar}%     % chairs
  %% Default master's thesis type name.
  \renewcommand{\BMTh}{Masteroppg\aa ve}%
  %% Default unpublished master's thesis type name.
  \renewcommand{\BUMTh}{Upublisert masteroppg\aa ve}%
  \renewcommand{\BAuthor}{Forfattar}% ``Author'' if publisher = author
  \renewcommand{\BREPR}{Opptrykk fr\aa }% Reprinted from
  \renewcommand{\BAvailFrom}{Tilgjengeleg fr\aa \ }% Websites; note the space.
  \renewcommand{\BRetrieved}[1]{Henta {#1} fr\aa \ }% Websites; note the space.
  \renewcommand{\APACmonth}[1]{\ifcase #1\or
      januar\or februar\or mars\or april\or mai\or juni\or
      juli\or august\or september\or oktober\or november\or desember\or
      vinter\or v{\aa}r\or sommar\or haust\else
      {#1}\fi}%
\fi
\let\APACnynorsk\undefined
%    \end{macrocode}
% Restore category code of |@| sign.
%    \begin{macrocode}
\APACrestoreAtCode
%</norsk>
%    \end{macrocode}
%
%
% \subsection{\fname{spanish.apc}}
%
% This file redefines the language-specific elements of \pkg{apacite}
% for the Spanish language. Note that \pkg{apacite}'s usage of |<| and
% |>| for pre-notes, as in |\cite<e.g.,>{jones06}| (inherited from its
% predecessor, \fname{theapa.sty}), conflicts with \pkg{babel}'s
% \pkgoption{spanish} option, which makes |<| and |>| active characters.
% Hence, either you must avoid using prenotes with \pkg{apacite}'s
% construction or you must disable \pkg{babel}'s behavior by inserting
% the command \cmd{\deactivatequoting} after loading \pkg{babel}.
%
%    \begin{macrocode}
%<*spanish>
%%
%% spanish.apc - Versi\'on espa\~nola de elementos en apacite
%% Escrito por Jorge L\'opez Puga
%%
%    \end{macrocode}
% A fancy way to store and restore the category code of the |@| sign,
% per Heiko Oberdiek.
%    \begin{macrocode}
\edef\APACrestoreAtCode{%
   \catcode`@=\the\catcode`@\relax
}%
\makeatletter
%% El nombre (del encabezado) de la Lista Referencias
%% Nombre de la lista de ref. si es una secci\'on.
\renewcommand{\refname}{Referencias}%
%% Nomber de la lista de refs. si es un cap\'{\i}tulo.
\renewcommand{\bibname}{Referencias}%
%% El nombre (del encabezado) del \'Indice de Autores.
\renewcommand{\authorindexname}{\'Indice de Autores}%
%% Nota previa usada justo antes de la lista de referencias si un
%% meta-an\'alisis es usado.
\renewcommand{\APACmetaprenote}{%
  Las referencias marcadas con un asterisco indican estudios incluidos en
  el meta-an\'alisis.}%
%% Comandos para tipos espec\'{\i}ficos de entradas @misc.
\renewcommand{\bibmessage}{Msj}%
\renewcommand{\bibcomputerprogram}{Programa inform\'atico}%
\renewcommand{\bibcomputerprogrammanual}{Manual de programa inform\'atico}%
\renewcommand{\bibcomputerprogramandmanual}{Programa inform\'atico y manual}%
\renewcommand{\bibcomputersoftware}{Software inform\'atico}%
\renewcommand{\bibcomputersoftwaremanual}{Manual de software inform\'atico}%
\renewcommand{\bibcomputersoftwareandmanual}{Manual y software inform\'atico}%
\renewcommand{\bibprogramminglanguage}{Lenguaje de programaci\'on}%
%%
%% Otras etiquetas
\renewcommand{\bibnodate}{s.f.\hbox{}}%  ``sin fecha''
\renewcommand{\BIP}{en prensa}% Usado como a\~no para citas ``en prensa''
%%
%% El argumento contiene un punto, por tanto, evita poner uno adicional en
%% la lista de referencias. No obstante algunas revistas aceptan ``et al.''
%% que es lo que aparece por defecto.
\renewcommand{\BOthers}[1]{y cols.\hbox{}}%       ``y colaboradores''
\renewcommand{\BOthersPeriod}[1]{y cols.\hbox{}}% ``y colaboradores''
%%
\renewcommand{\BIn}{En}%                   Para ``En'' editor...
\renewcommand{\Bby}{por}%                  ``by'' editor (in reprints)
\renewcommand{\BED}{Ed.\hbox{}}%           editor
\renewcommand{\BEDS}{Eds.\hbox{}}%         editors
\renewcommand{\BTRANS}{Traduc.\hbox{}}%    traductor
\renewcommand{\BTRANSS}{Traducs.\hbox{}}%  traductores
\renewcommand{\BTRANSL}{traduc.\hbox{}}%   traducci\'on, para el campo a\~no
\renewcommand{\BCHAIR}{Presidente}%        Presidente/a de congreso
\renewcommand{\BCHAIRS}{Presidencia}%      Presidencia
\renewcommand{\BVOL}{Vol.\hbox{}}%         volume
\renewcommand{\BVOLS}{Vols.\hbox{}}%       volumes
\renewcommand{\BNUM}{n\sptext{o}}%         number
\renewcommand{\BNUMS}{n\sptext{os}}%       numbers
\renewcommand{\BEd}{ed.\hbox{}}%           edition
\renewcommand{\BCHAP}{cap.\hbox{}}%        cap\'{\i}tulo
\renewcommand{\BCHAPS}{caps.\hbox{}}%      cap\'{\i}tulos
\renewcommand{\BPG}{p.\hbox{}}%            page
\renewcommand{\BPGS}{pp.\hbox{}}%          pages
%% Default technical report type name. --- Informe T\'ecnico
\renewcommand{\BTR}{Inf.\ T\'ec.\hbox{}}%
%% (por defecto) PhD thesis type name --- Tesis Doctoral
\renewcommand{\BPhD}{Tesis Doctoral}%
%% (por defecto) unpublished PhD thesis type name
%% --- Tesis Doctoral no publicada
\renewcommand{\BUPhD}{Tesis Doctoral no publicada}%
%% (por defecto) master's thesis type name --- Tesis de Master
\renewcommand{\BMTh}{Tesis de Master}%
%% (por defecto) unpublished master's thesis type name
%% --- Tesis de Master no publicada
\renewcommand{\BUMTh}{Tesis de Master no publicada}%
%%
\renewcommand{\BAuthor}{Autor}% ``Author'' if publisher = author
\renewcommand{\BOWP}{Trabajo original publicado en}% Original work published
\renewcommand{\BREPR}{Reimpresi\'on de}% Reprinted from
%%
%% Websites and messages to newsgroups, forums, etc.; note the spaces.
\renewcommand{\BAvailFrom}{Disponible en\ }% Available from
%% The argument is the date on which it was last checked.
\renewcommand{\BRetrieved}[1]{Descargado {#1}, de\ }% Retrieved ... from
\renewcommand{\BRetrievedFrom}{Descargado de\ }%      Retrieved from
\renewcommand{\BMsgPostedTo}{Mensaje colgado en\ }% Message posted to
%%
%% Punctuation
\renewcommand{\BBOP}{(}%   opening parenthesis
\renewcommand{\BBCP}{)}%   closing parenthesis
\renewcommand{\BBOQ}{}%    opening quote for article title
\renewcommand{\BBCQ}{}%    closing quote for article title

\renewcommand{\BBAA}{y}% Letra que va entre los autores en las referencias
\renewcommand{\BBAB}{y}% Entre autores en el texto
\renewcommand{\BAnd}{y}% for ``Ed. \& Trans.'' in ref. list
\DeclareRobustCommand{\BPBI}{.~}% Period between initials
\DeclareRobustCommand{\BHBI}{.-}% Hyphen between initials
\renewcommand{\BAP}{ }%   after prefix, before first citation
\renewcommand{\BBAY}{, }% between author(s) and year
\renewcommand{\BBYY}{, }% between years of multiple citations with same author
\renewcommand{\BBC}{; }%  between cites
\renewcommand{\BBN}{, }%  before note
\renewcommand{\BCBT}{,}%  comma between authors in ref. list when no. of
                      %%  authors = 2
\renewcommand{\BCBL}{,}%  comma before last author when no. of authors > 2
%% Remove excess space with the natbibapa option
\if@APAC@natbib@apa
    \renewcommand{\BBAY}{,}%
    \renewcommand{\BBYY}{,}%
    \renewcommand{\BBC}{;}%
\fi
%%
%% Date formatting; adapted from babel's spanish.dtx
\renewcommand{\APACmonth}[1]{\ifcase #1\or enero\or febrero\or
    marzo\or abril\or mayo\or junio\or julio\or agosto\or
    septiembre\or octubre\or noviembre\or diciembre\or
    invierno\or primavera\or verano\or oto\~no\else
    {#1}\fi}%
\renewcommand{\APACrefYearMonthDay}[3]{%
  {\BBOP}{#1}%           year (+ addendum); should not be empty
  \ifx\@empty#3\@empty
    \ifx\@empty#2\@empty
    \else
      \unskip, {#2}%     month --- mes
    \fi
  \else
    \unskip, {#3}%       day --- d\'ia
    \ifx\@empty#2\@empty
    \else
      \unskip~de {#2}%   month --- mes
    \fi
  \fi
  {\BBCP}%               closing parenthesis
}%
%% Some macros that transform a number (say, `2') to an ordinal one (`2nd')
\renewcommand{\PrintOrdinal}[1]{%
    \afterassignment\print@ordinal
    \count@ 0#1\relax\@nil
}%
\def\print@ordinal#1#2\@nil{%
    \ifx\relax#1\relax
        \ifnum\count@>\z@
            \CardinalNumeric\count@
        \else
            ??\sptext{a}%
        \fi
    \else
        \ifnum \count@>\z@ \number\count@ \fi
        #1#2\relax
    \fi
}%
%    \end{macrocode}
% Spanish ordinal numbers are always obtained by putting
% ``.\textsuperscript{a}'' after the number, at least for editions.
% Therefore, the code here can be significantly simplified. However,
% because I have trouble understanding this code (from the \pkg{amsrefs}
% package) and experimenting did not give the expected results, I won't
% mess with the code too much and stay close to the English code.
% We use the \cmd{\sptext} command from \pkg{babel}'s \fname{spanish.dtx},
% which formats the ``.\textsuperscript{a}'' slightly differently.
%    \begin{macrocode}
\renewcommand{\CardinalNumeric}[1]{%
    \number#1\relax
    \if
        \ifnum#1<14
            \ifnum#1>\thr@@ T\else F\fi
        \else
            F%
        \fi
        T%
        \sptext{a}%
    \else
        \@xp\keep@last@digit\@xp#1\number#1\relax
        \ifcase#1\sptext{a}\else \sptext{a}\fi
    \fi
}%
%    \end{macrocode}
% Some code for using `e' instead of `y' in Spanish if the following
% name starts with `I'.
%    \begin{macrocode}
\def\usespanishe#1{%
    \@bsphack
    \@for\@citeb:=#1\do{%
       \edef\@citeb{\expandafter\@firstofone\@citeb}%
       \@ifundefined{spanishe@\@citeb\APAC@extra@b@citeb}%
         {\global\expandafter
          \def\csname spanishe@\@citeb\APAC@extra@b@citeb\endcsname{DUMMY}%
         }%
         {}%
    }%
    \@esphack
}
\def\APACinsertmetastar#1{%
  \@for\@citeb:=#1\do{%
    \edef\@citeb{\expandafter\@firstofone\@citeb}%
    \@ifundefined{flagmeta@\@citeb\APAC@extra@b@citeb}%
      {}% skip
      {{\APACmetastar}}%
    \@ifundefined{spanishe@\@citeb\APAC@extra@b@citeb}%
      {}% skip
      {{% Use `e' instead of `y' in Spanish
       \global\let\oldBBA\BBA
       \global\def\BBA{e\global\let\BBA\oldBBA}%
      }}%
  }%
}%
\def\@ifauthorsunequalc@de#1{%
  \if@F@cite
     \@F@citefalse
  \else
     \if@Y@cite
        {\@BAY}%
     \fi
     {\@BBC}%
  \fi
  \edef\@cite@undefined{?}%
  \def\BBA{\@BBA}%
  \@ifundefined{spanishe@\@citeb\APAC@extra@b@citeb}%
    {}% skip
    {{% Use `e' instead of `y' in Spanish
     \global\let\oldBBA\BBA
     \global\def\BBA{e\global\let\BBA\oldBBA}%
    }}%
  \if@A@cite
     \hyper@natlinkstart{#1}%
     {\csname b@\@citeb\APAC@extra@b@citeb\endcsname}%
     \hyper@natlinkend
     \if@Y@cite
        {\@BBAY}%
     \fi
  \fi
  \if@Y@cite
     \hyper@natlinkstart{#1}%
     {\csname Y@\@citeb\APAC@extra@b@citeb\endcsname}%
     \hyper@natlinkend
  \fi
  \let\BBA\relax
}%
%    \end{macrocode}
% Restore category code of |@| sign.
%    \begin{macrocode}
\APACrestoreAtCode
%</spanish>
%    \end{macrocode}
%
%
% \subsection{\fname{swedish.apc}}
%
% This file redefines the language-specific elements of \pkg{apacite}
% for the Swedish language. Translation of APA elements into Swedish 
% is not obvious. Ideas of which terms to use have been taken from
% \citeA{Erik01}, \citeA{Johnsson}, and \citeA{GU94}.
%
%    \begin{macrocode}
%<*swedish>
%%
%% swedish.apc - swedish translation of apacite elements
%% Written by Stefan Bjork.
%% Small adaptations by Erik Meijer
%%
%    \end{macrocode}
% A fancy way to store and restore the category code of the |@| sign,
% per Heiko Oberdiek.
%    \begin{macrocode}
\edef\APACrestoreAtCode{%
   \catcode`@=\the\catcode`@\relax
}%
\makeatletter
\renewcommand{\onemaskedcitationmsg}[1]{%
    \emph{(#1\ citation removed for masked review)}}% !!! CHANGE
\renewcommand{\maskedcitationsmsg}[1]{%
    \emph{(#1\ citations removed for masked review)}}% !!! CHANGE
%%
%% Name of ref. list if it's a section.
\renewcommand{\refname}{Referenser}%
%% Name of ref. list if it's a chapter.
\renewcommand{\bibname}{Litteraturf\"orteckning}%
%% Author Index
\renewcommand{\authorindexname}{F\"orfattarindex}% 
%%
%% A note before the references if a meta-analysis is reported.
\renewcommand{\APACmetaprenote}{%
  Referenser markerade med stj\"arna avser studier inkluderade i
  metaanalys.}%
%%
%% Commands for specific types of @misc entries.
\renewcommand{\bibmessage}{meddelande}%
\renewcommand{\bibcomputerprogram}{datorprogram}%
\renewcommand{\bibcomputerprogrammanual}{handbok till datorprogram}%
\renewcommand{\bibcomputerprogramandmanual}{datorprogram och handbok}%
\renewcommand{\bibcomputersoftware}{mjukvara}%
\renewcommand{\bibcomputersoftwaremanual}{handbok till mjukvara}%
\renewcommand{\bibcomputersoftwareandmanual}{mjukvara och handbok}%
\renewcommand{\bibprogramminglanguage}{programmeringsspr{\aa}k}%
%%
%% Other labels
\renewcommand{\bibnodate}{u.~\aa{}.\hbox{}}% ``no date''
\renewcommand{\BIP}{i tryck}%                ``in press''
\renewcommand{\BOthers}[1]{m.~fl.\hbox{}}%   ``and others''
\renewcommand{\BOthersPeriod}[1]{m.~fl.\hbox{}}% ``and others'', with a period
\renewcommand{\BIn}{I}%  for ``In'' editor...
\renewcommand{\Bby}{av}% for ``by'' editor... (in reprints)
\renewcommand{\BED}{red.\hbox{}}%          editor
\renewcommand{\BEDS}{red.\hbox{}}%         editors
\renewcommand{\BTRANS}{\"overs.\hbox{}}%   translator
\renewcommand{\BTRANSS}{\"overs.\hbox{}}%  translators
\renewcommand{\BTRANSL}{\"overs.\hbox{}}%  translation, for the year field
\renewcommand{\BCHAIR}{ordf\"orande}%      chair of symposium
\renewcommand{\BCHAIRS}{ordf\"oranden}%    chairs
\renewcommand{\BVOL}{vol.\hbox{}}%         volume
\renewcommand{\BVOLS}{vol.\hbox{}}%        volumes
\renewcommand{\BNUM}{nr.\hbox{}}%          number
\renewcommand{\BNUMS}{nr.\hbox{}}%         numbers
\renewcommand{\BEd}{utg{\aa}van}%          edition
\renewcommand{\BCHAP}{kap.\hbox{}}%        chapter
\renewcommand{\BCHAPS}{kap.\hbox{}}%       chapters
\renewcommand{\BPG}{s.\hbox{}}%            page
\renewcommand{\BPGS}{s.\hbox{}}%          pages
%% Default technical report type name.
\renewcommand{\BTR}{forskningsrapport}%
%% Default PhD thesis type name.
\renewcommand{\BPhD}{doktorsavhandling}%
%% Default unpublished PhD thesis type name.
\renewcommand{\BUPhD}{opublicerad doktorsavhandling}%
%% Default master's thesis type name.
\renewcommand{\BMTh}{examensuppsats}%
%% Default unpublished master's thesis type name.
\renewcommand{\BUMTh}{opublicerad examensuppsats}%
%%
\renewcommand{\BAuthor}{F\"orfattare}%  ``Author'' if publisher = author
\renewcommand{\BOWP}{Original publicerat}% Original work published
\renewcommand{\BREPR}{{\AA}terutgivning fr{\aa}n}% Reprinted from
\renewcommand{\BAvailFrom}{Tillg\"anglig fr{\aa}n\ }% Websites; note the space.
%% The argument is the date on which it was last checked.
\renewcommand{\BRetrieved}[1]{H\"amtad {#1}, fr{\aa}n\ }% Websites; note the space.
\renewcommand{\BRetrievedFrom}{H\"amtad fr{\aa}n\ }% Websites; note the space.
\renewcommand{\BMsgPostedTo}{Meddelande postat till\ }% Messages; note the space.
%%
%% Punctuation
\renewcommand{\BBOP}{(}%   opening parenthesis
\renewcommand{\BBCP}{)}%   closing parenthesis
\renewcommand{\BBOQ}{}%    opening quote for article title
\renewcommand{\BBCQ}{}%    closing quote for article title
\renewcommand{\BBAA}{\&}%  between authors in parenthetical cites and ref. list
\renewcommand{\BBAB}{och}% between authors in text
\renewcommand{\BAnd}{\&}%  for ``Ed. \& Trans.'' in ref. list
\DeclareRobustCommand{\BPBI}{. }% Period between initials
\DeclareRobustCommand{\BHBI}{.-}% Hyphen between initials
\renewcommand{\BAP}{ }%   after prefix, before first citation
\renewcommand{\BBAY}{, }% between author(s) and year
\renewcommand{\BBYY}{, }% between years of multiple citations with same author
\renewcommand{\BBC}{; }%  between cites
\renewcommand{\BBN}{, }%  before note
\renewcommand{\BCBT}{}%   no comma between authors in ref. list when no. of 
                      %%  authors = 2
\renewcommand{\BCBL}{}%   no comma before last author when no. of authors > 2
%% Remove excess space with the natbibapa option
\if@APAC@natbib@apa
    \renewcommand{\BBAY}{,}%
    \renewcommand{\BBYY}{,}%
    \renewcommand{\BBC}{;}%
\fi
%%
%% Date formatting; adapted from babel's swedish.dtx
\renewcommand{\APACmonth}[1]{\ifcase #1\or
    januari\or februari\or mars\or april\or maj\or juni\or
    juli\or augusti\or september\or oktober\or november\or
    december\or
    vinter\or v{\aa}r\or sommar\or h\"ost\else
    {#1}\fi}%
%% Numbered version, which is preferred in the form ``(2008, 21/2)''.
\def\APACswedishnumberedmonth#1{\ifcase #1\or
    1\or 2\or 3\or 4\or 5\or 6\or
    7\or 8\or 9\or 10\or 11\or 12\or
    vinter\or v{\aa}r\or sommar\or h\"ost\else
    {#1}\fi}%
\renewcommand{\APACrefYearMonthDay}[3]{%
  {\BBOP}{#1}%             year (+ addendum); should not be empty
  \ifx\@empty#3\@empty
    \ifx\@empty#2\@empty 
    \else
      %% Use full month if there is no day.
      \unskip, {#2}%       month
    \fi
  \else
    \unskip, {#3}%         day
    \ifx\@empty#2\@empty 
    \else
      %% Use numbered month if there is a day as well.
      \let\APACorigmonth\APACmonth
      \let\APACmonth\APACswedishnumberedmonth
      \unskip{}/{#2}%      month
      \let\APACmonth\APACorigmonth
      \let\APACorigmonth\@undefined
    \fi
  \fi
  {\BBCP}%                 closing parenthesis
}%
%% Some macros that transform a number (say, `2') to an ordinal one (`2nd')
\renewcommand{\PrintOrdinal}[1]{%
    \afterassignment\print@ordinal
    \count@ 0#1\relax\@nil
}%
\def\print@ordinal#1#2\@nil{%
    \ifx\relax#1\relax
        \ifnum\count@>\z@
            \CardinalNumeric\count@
        \else
            ??:e%
        \fi
    \else
        \ifnum \count@>\z@ \number\count@ \fi
        #1#2\relax
    \fi
}%
%    \end{macrocode}
% In swedish, ``1st'' = ``1:a'', ``2nd'' = ``2:a'', everything else =
% ``:e''. From 20 onwards, if the last digit is 1 or 2, ``:a'' should
% be used, and otherwise ``:e''.
%    \begin{macrocode}
\renewcommand{\CardinalNumeric}[1]{%
    \number#1\relax
    \if
        \ifnum#1<14
            \ifnum#1>\thr@@ T\else F\fi
        \else
            F%
        \fi
        T%
        :e%
    \else
        \@xp\keep@last@digit\@xp#1\number#1\relax
        \ifcase#1:e\or :a\or :a\or :e\or :e\or :e\or :e\or :e\or :e\or
                 :e\else :e\fi
    \fi
}%
%    \end{macrocode}
% Restore category code of |@| sign.
%    \begin{macrocode}
\APACrestoreAtCode
%</swedish>
%    \end{macrocode}
%
% \section{Bibliography database (\fname{apa5ex.bib})}
%
% This file includes the reference entries of all examples in the
% APA manual, which are all formatted in the \pkg{apacite} reference
% manual. As such, it shows how ordinary and (especially) difficult
% items can be formatted.
%
% \subsection{References from the 5th edition of the Publication Manual}
%
% This includes some additional references that test some rules that are
% mentioned in the text.
%    \begin{macrocode}
%<*bibdb>
%%
%% apa5ex.bib: References from the 5th edition of the Publication Manual
%%             of the APA, plus a few additional references
%% Written by Erik Meijer

%% Entry labels are section number of the APA manual (5th ed.)
%% plus a sequence number within the section.

@misc{3.94-1,
  author = {Walker},
  year   = {2000},
  type   = {Unknown},
}

@misc{3.95-1,
  author = {Wasserstein and Zappulla and Rosen and Gerstman and Rock},
  year   = {1994},
  type   = {Unknown},
}

@misc{3.95-2,
  author = {Bradley and Ramirez and Soo},
  year   = {1994},
  type   = {Unknown},
}

@misc{3.95-3,
  author = {Bradley and Soo and Ramirez and Brown},
  year   = {1994},
  type   = {Unknown},
}

@misc{3.95-4,
  author = {Kosslyn and Koenig and Barrett and Cave and Tang and Gabrieli},
  year   = {1996},
  type   = {Unknown},
}

@misc{3.95-5,
  author = {Kosslyn and Koenig and Gabrieli and Tang and Marsolek and Daly},
  year   = {1996},
  type   = {Unknown},
}

@misc{3.95-6,
  author = {Nightlinger and Littlewood},
  year   = {1993},
  type   = {Unknown},
}

@book{3.95-7,
  author     = {J{\"{o}}reskog, K[arl] G. and S{\"{o}}rbom, D[ag]},
  year       = {1989},
  title      = {{LISREL} 7: {A} Guide to the Program and Applications},
  edition    = {2},
  address    = {Chicago},
  publisher  = {SPSS},
}

@misc{3.96-1,
  author   = {{\bibcorporate{National Institute of Mental Health}}},
  firstkey = {{National Institute of Mental Health [NIMH]}},
  key      = {{NIMH}},
  year     = {1999},
  type     = {Unknown},
}

@misc{3.96-2,
  author   = {{\bibcorporate{University of Pittsburgh}}},
  year     = {1993},
  type     = {Unknown},
}

@book{3.96-3,
  author       = {{\bibcorporate{Koninklijke Nederlandse Schaakbond}}},
  firstkey     = {{Koninklijke Nederlandse Schaakbond [KNSB]}},
  key          = {{KNSB}},
  year         = {2003},
  title        = {Jaarverslag 2002},
  englishtitle = {Annual Report 2002},
  address      = {Amsterdam},
  publisher    = {{\bibcorporate{Koninklijke Nederlandse Schaakbond}}},
  note         = {Fake entry to study sorting and citing of references with
                  same key, but with different firstkey.},
}

@book{3.96-4,
  author       = {{\bibcorporate{Koninklijke Nederlandse Schaakbond}}},
  firstkey     = {{Koninklijke Nederlandse Schaakbond [KNSB]}},
  key          = {{KNSB}},
  year         = {2004},
  title        = {Jaarverslag 2003},
  englishtitle = {Annual Report 2003},
  address      = {Amsterdam},
  publisher    = {{\bibcorporate{Koninklijke Nederlandse Schaakbond}}},
  note         = {Fake entry to study sorting and citing of references with
                  same key, but with different firstkey.},
}

@book{3.96-5,
  author       = {{\bibcorporate{Koninklijke Nederlandse Schaatsbond}}},
  firstkey     = {{Koninklijke Nederlandse Schaatsbond [KNSB]}},
  key          = {{KNSB}},
  year         = {2003},
  title        = {Jaarverslag 2002},
  englishtitle = {Annual Report 2002},
  address      = {Amsterdam},
  publisher    = {{\bibcorporate{Koninklijke Nederlandse Schaatsbond}}},
  note         = {Fake entry to study sorting and citing of references with
                  same key, but with different firstkey.},
}

@book{3.96-6,
  author       = {{\bibcorporate{Koninklijke Nederlandse Schaatsbond}}},
  firstkey     = {{Koninklijke Nederlandse Schaatsbond [KNSB]}},
  key          = {{KNSB}},
  year         = {2004},
  title        = {Jaarverslag 2003},
  englishtitle = {Annual Report 2003},
  address      = {Amsterdam},
  publisher    = {{\bibcorporate{Koninklijke Nederlandse Schaatsbond}}},
  note         = {Fake entry to study sorting and citing of references with
                  same key, but with different firstkey.},
}

@magazine{3.97-1,
  key     = {{\APACciteatitle{Study Finds}}},
  year    = {1982},
  month   = apr,
  title   = {Study Finds Free Care Used More},
  journal = {{APA} Monitor},
  pages   = {14},
}

@book{3.97-2,
  year      = {1979},
  title     = {College Bound Seniors},
  address   = {Princeton, NJ},
  publisher = {College Board Publications},
}

@misc{3.97-3,
  author = {Anonymous},
  year   = {1998},
  type   = {Unknown},
}

@newspaper{3.97-4,
  year    = {2002},
  month   = mar,
  day     = {3},
  title   = {Editorial},
  journal = {The Edited Newspaper},
  pages   = {2},
  note    = {Fake entry to study sorting and citing of references without
             author, but with the same title.},
}

@newspaper{3.97-5,
  year    = {2003},
  month   = feb,
  day     = {12},
  title   = {Editorial},
  journal = {The Edited Newspaper},
  pages   = {2},
  note    = {Fake entry to study sorting and citing of references without
             author, but with the same title.},
}

@newspaper{3.97-6,
  year    = {2003},
  month   = jan,
  day     = {24},
  title   = {Editorial},
  journal = {The Edited Newspaper},
  pages   = {2},
  note    = {Fake entry to study sorting and citing of references without
             author, but with the same title.},
}

@book{3.98-1,
  author    = {Luce, R. Duncan},
  year      = {1959},
  title     = {Individual Choice Behavior},
  address   = {New York},
  publisher = {Wiley},
}

@misc{3.98-2,
  author = {Luce, P. A.},
  year   = {1986},
  type   = {Unknown},
}

@misc{3.98-3,
  author = {Goldberg, J. M. and Neff},
  year   = {1961},
  type   = {Unknown},
}

@misc{3.98-4,
  author = {Goldberg, M. E. and Wurtz},
  year   = {1972},
  type   = {Unknown},
}

@misc{3.99-1,
  author = {Edeline and Weinberger},
  year   = {1991},
  type   = {Unknown},
}

@misc{3.99-2,
  author = {Edeline and Weinberger},
  year   = {1993},
  type   = {Unknown},
}

@misc{3.99-3,
  author = {Gogel},
  year   = {1984},
  type   = {Unknown},
}

@misc{3.99-4,
  author = {Gogel},
  year   = {1990},
  type   = {Unknown},
}

@misc{3.99-5,
  author = {Gogel},
  year   = {\BIP},
  type   = {Unknown},
}

@misc{3.99-6,
  author = {Johnson},
  year   = {1991},
  title  = {Aaa},
}

@misc{3.99-7,
  author = {Johnson},
  year   = {1991},
  title  = {Bbb},
}

@misc{3.99-8,
  author = {Johnson},
  year   = {1991},
  title  = {Ccc},
}

@misc{3.99-9,
  author = {Singh},
  year   = {1983},
  type   = {Unknown},
}

@misc{3.99-10,
  author = {Singh},
  year   = {\BIP},
  title  = {Aaa},
}

@misc{3.99-11,
  author = {Singh},
  year   = {\BIP},
  title  = {Bbb},
}

@misc{3.99-12,
  author = {Balda},
  year   = {1980},
  type   = {Unknown},
}

@misc{3.99-13,
  author = {Kamil},
  year   = {1988},
  type   = {Unknown},
}

@misc{3.99-14,
  author = {Pepperberg and Funk},
  year   = {1990},
  type   = {Unknown},
}

@misc{3.99-15,
  author = {Minor},
  year   = {2001},
  type   = {Unknown},
}

@misc{3.99-16,
  author = {Adams},
  year   = {1999},
  type   = {Unknown},
}

@misc{3.99-17,
  author = {Storandt},
  year   = {1997},
  type   = {Unknown},
}

@misc{3.100-1,
  author = {Author},
  year   = {\bibnodate},
  type   = {Unknown},
  note   = {no example, but rule given in text},
}

@misc{3.100-1b,
  author = {Author},
  year   = {2003 version},
  type   = {Unknown},
  note   = {no example, but rule given in text},
}

@book{3.100-2,
  author = {Aristotle},
  year   = {1931},
  title  = {Unknown},
  translator = {Someone},
  originalyear = {\bibnodate},
}

@book{3.100-3,
  author = {James},
  year   = {1983},
  title  = {Unknown},
  originalyear = {1890},
}

@misc{3.101-1,
  author = {Cheek and Buss},
  year   = {1981},
  type   = {Unknown},
}

@misc{3.101-2,
  author = {Shimamura},
  year   = {1989},
  type   = {Unknown},
}

@misc{3.101-3,
  author = {Myers},
  year   = {2000},
  type   = {Unknown},
}

@misc{3.101-4,
  author = {Beutler},
  year   = {2000},
  type   = {Unknown},
}

@misc{3.103-1,
  author = {Hashtroudi and Chrosniak and Schwartz},
  year   = {1991},
  type   = {Unknown},
}

@misc{4.04-t1,
  author = {Brown, J. R.},
  year   = {\bibnodate},
  type   = {Unknown},
}

@misc{4.04-t2,
  author = {Browning, A. R.},
  year   = {\bibnodate},
  type   = {Unknown},
}

@misc{4.04-t3,
  author = {MacArthur},
  year   = {\bibnodate},
  type   = {Unknown},
}

@misc{4.04-t4,
  author = {McAllister},
  year   = {\bibnodate},
  type   = {Unknown},
}

@misc{4.04-t5,
  author = {MacNeil},
  year   = {\bibnodate},
  type   = {Unknown},
}

@misc{4.04-t6,
  author = {M'Carthy},
  year   = {\bibnodate},
  type   = {Unknown},
}

@misc{4.04-t7,
  author = {DeBase},
  year   = {\bibnodate},
  type   = {Unknown},
}

@misc{4.04-t8,
  author = {De Vries, J.},
  year   = {\bibnodate},
  type   = {Unknown},
}

@misc{4.04-t9,
  author = {von Helmholtz, H. L. F.},
  year   = {\bibnodate},
  type   = {Unknown},
}

@article{4.04-t10,
  year    = {2003},
  title   = {{\APACSortNoop{Two-Thousand and Three}}2003 Hottest Summer Ever},
  journal = {Journal of Meteorology},
  note    = {This is a fake entry, used for didactical purposes.},
}

@misc{4.04-1,
  author = {Hewlett, L. S.},
  year   = {1996},
  type   = {Unknown},
}

@misc{4.04-2,
  author = {Hewlett, L. S.},
  year   = {1999},
  type   = {Unknown},
}

@misc{4.04-3,
  author = {Alleyne, R. L.},
  year   = {2001},
  type   = {Unknown},
}

@misc{4.04-4,
  author = {Alleyne, R. L. and Evans, A. J.},
  year   = {1999},
  type   = {Unknown},
}

@misc{4.04-5,
  author = {Gosling, J. R. and Jerald, K. and Belfar, S. F.},
  year   = {2000},
  type   = {Unknown},
}

@misc{4.04-6,
  author = {Gosling, J. R. and Tevlin, D. F.},
  year   = {1996},
  type   = {Unknown},
}

@misc{4.04-7,
  author = {Hayward, D. and Firsching, A. and Brown, J.},
  year   = {1999},
  type   = {Unknown},
}

@misc{4.04-8,
  author = {Hayward, D. and Firsching, A. and Smigel, J.},
  year   = {1999},
  type   = {Unknown},
}

@misc{4.04-9,
  author = {Cabading, J. R. and Wright, K.},
  year   = {2000},
  type   = {Unknown},
}

@misc{4.04-10,
  author = {Cabading, J. R. and Wright, K.},
  year   = {2001},
  type   = {Unknown},
}

@article{4.04-11,
  author = {Baheti, J. R.},
  year   = {2001},
  title  = {Control {\ldots}},
}

@article{4.04-12,
  author = {Baheti, J. R.},
  year   = {2001},
  title  = {Roles of {\ldots}},
}

@misc{4.04-13,
  author = {Mathur, A. L. and Wallston, J.},
  year   = {1999},
  type   = {Unknown},
}

@misc{4.04-14,
  author = {Mathur, S. E. and Ahlers, R. J.},
  year   = {1998},
  type   = {Unknown},
}

@book{4.05-1,
  author    = {Bandura, A. J.},
  year      = {1977},
  title     = {Social Learning Theory},
  address   = {Englewood Cliffs, NJ},
  publisher = {Prentice Hall},
}

@article{4.05-2,
  author = {Bretschneider, J. G. and McCoy, N. L.},
  year   = {1968},
  title  = {Sexual Interest and Behavior in Healthy
            80- to 102-Year-Olds},
  journal = {Archives of Sexual Behavior},
  volume  = {14},
  pages   = {343--350},
}

@article{4.08-1,
  author  = {Kernis, M. H. and Cornell, D. P. and Sun, C.-R.
             and Berry, A. and Harlow, T.},
  year    = {1993},
  title   = {There's More to Self-Esteem than Whether it is High
             or Low: The Importance of Stability of Self-Esteem},
  journal = {Journal of Personality and Social Psychology},
  volume  = {65},
  pages   = {1190--1204},
}

@book{4.08-2,
  editor    = {Robinson, D. N.},
  year      = {1992},
  title     = {Social Discourse and Moral Judgment},
  address   = {San Diego, CA},
  publisher = {Academic Press},
}

@misc{4.08-3,
  author    = {Bulatao, E. {\protect\bibliteral{(with
               Winford, C.~A.)}\protect\indexskipbracenodot}},
  year      = {\bibnodate},
  type      = {Unknown},
}

@article{4.09-1,
  author = {Fowers, B. J. and Olson, D. H.},
  year   = {1993},
  title  = {{ENRICH} {Marital} {Satisfaction} {Scale}:
            A Brief Research and Clinical Tool},
  journal = {Journal of Family Psychology},
  volume  = {7},
  pages   = {176--185},
}

@article{4.10-1,
  author  = {Deutsch, F. M. and Lussier, J. B. and Servis, L. J.},
  year    = {1993},
  title   = {Husbands At Home: Predictors of Paternal Participation
             in Childcare and Housework},
  journal = {Journal of Personality and Social Psychology},
  volume  = {65},
  pages   = {1154--1166},
}

@incollection{4.10-2,
  author    = {O'Neil, J. M. and Egan, J.},
  year      = {1992},
  title     = {Men's and Women's Gender Role Journeys:
               Metaphor for Healing, Transition, and Transformation},
  editor    = {Wainrib, B. R.},
  booktitle = {Gender Issues Across the Life Cycle},
  pages     = {107--123},
  address   = {New York},
  publisher = {Springer},
}

@article{4.11-1,
  author  = {Buss, D. M. and Schmitt, D. P.},
  year    = {1993},
  title   = {Sexual Strategies Theory: An Evolutionary Perspective
             on Human Mating},
  journal = {Psychological Review},
  volume  = {100},
  pages   = {204--232},
}

@magazine{4.11-2,
  author  = {Henry, III, W. A.},
  year    = {1990},
  month   = apr,
  day     = {9},
  title   = {Beyond the Melting Pot},
  journal = {Time},
  volume  = {135},
  pages   = {28--31},
}

@book{4.12-1,
  author    = {Saxe, G. B.},
  year      = {1991},
  title     = {Cultural and Cognitive Development: Studies in
               Mathematical Understanding},
  address   = {Hillsdale, NJ},
  publisher = {Erlbaum},
}

@incollection{4.13-1,
  author    = {Baker, F. M. and Lightfoot, O. B.},
  year      = {1993},
  title     = {Psychiatric Care of Ethnic Elders},
  editor    = {Gaw, A. C.},
  booktitle = {Culture, Ethnicity, and Mental Illness},
  pages     = {517--552},
  address   = {Washington, DC},
  publisher = {American Psychiatric Press},
}

@incollection{4.13-2,
  author    = {Merikle, Philip M.},
  year      = {2000},
  title     = {Subliminal Perception},
  editor    = {Kazdin, Alan E. and Blanchard, Edward B. and
               Bootzin, Richard R. and Bower, Gordon and
               Close Conoley, Jane and Deaux, Kay and Fox, Ronald E. and
               Harmon, Lenore W. and Howell, William C. and
               Marsella, Anthony J. and Price, Richard H. and
               Roediger, III, Henry L. and Rosenthal, Robert and
               Schmitt, Neal W. and Singer, Jerome L. and Squire, Larry R. and
               Zahn-Waxler, Carolyn},
  booktitle = {Encyclopedia of Psychology},
  volume    = {7},
  pages     = {497--499},
  address   = {New York},
  publisher = {Oxford University Press},
}

@misc{4.15-1,
  key         = {{\APACcitebtitle{Electronic Reference Formats}}},
  title       = {Electronic Reference Formats Recommended by the
                 {American} {Psychological} {Association}},
  year        = {2000},
  month       = oct,
  day         = {12},
  lastchecked = {October 23, 2000},
  URL         = {http://www.apa.org/journals/webref.html},
}

@article{4.15-2,
  author = {Eid, M. and Langeheine, R.},
  year   = {1999},
  title  = {The Measurement of Consistency and Occasion Specificity
            with Latent Class Models: A New Model and its
            Application to the Measurement of Affect},
  journal = {Psychological Methods},
  volume  = {4},
  pages   = {100--116},
  howpublished = {Retrieved November 19, 2000, from the PsycARTICLES database},
}

%
%  The rest is from section 4.16. Section number is omitted,
%  but A-I are used instead. For the numbered examples, these
%  letters are also omitted in favor of ``ex''.
%

@article{A-1,
  author  = {Herman, L. M. and Kuczaj, III, S. A. and Holder, M. D.},
  year    = {1993},
  title   = {Responses to Anomalous Gestural Sequences by a
             Language-Trained Dolphin: {E}vidence for Processing
             of Semantic Relations and Syntactic Information},
  journal = {Journal of Experimental Psychology: General},
  volume  = {122},
  pages   = {184--194},
}

@article{ex1,
  author  = {Mellers, B. A.},
  year    = {2000},
  title   = {Choice and the Relative Pleasure of Consequences},
  journal = {Psychological Bulletin},
  volume  = {126},
  pages   = {910--924},
}

@article{ex2,
  author  = {Klimoski, R. and Palmer, S.},
  year    = {1993},
  title   = {The {ADA} and the Hiring Process in Organizations},
  journal = {Consulting Psychology Journal: Practice and Research},
  volume  = {45},
  number  = {2},
  pages   = {10--36},
}

@article{ex3,
  author  = {Saywitz, K. J. and Mannarino, A. P. and Berliner, L.
             and Cohen, J. A.},
  year    = {2000},
  title   = {Treatment for Sexually Abused Children and Adolescents},
  journal = {American Psychologist},
  volume  = {55},
  pages   = {1040--1049},
}

@article{ex4,
  author  = {Wolchik, S. A. and West, S. G. and Sandler, I. N. and
             Tein, J. and Coatsworth, D. and Lengua, L. and others},
  year    = {2000},
  title   = {An Experimental Evaluation of Theory-Based Mother and
             Mother-Child Programs for Children of Divorce},
  journal = {Journal of Consulting and Clinical Psychology},
  volume  = {68},
  pages   = {843--856},
}

@article{ex4-2,
  author  = {Swait, Joffre and Adamowicz, Wiktor and Hanemann, Michael
             and Diederich, Adele and Krosnick, Jon and Layton, David
             and Provencher, William and Schkade, David and Tourangeau, Roger},
  year    = {2002},
  title   = {Context Dependence and Aggregation
             in Disaggregate Choice Analysis},
  journal = {Marketing Letters},
  volume  = {13},
  pages   = {195--205},
}

@article{ex5,
  author  = {Zuckerman, M. and Kieffer, S. C.},
  year    = {\BIP},
  title   = {Race Differences in Face-ism: {D}oes Facial Prominence
             Imply Dominance?},
  journal = {Journal of Personality and Social Psychology},
}

@magazine{ex6,
  author  = {Kandel, E. R. and Squire, L. R.},
  year    = {2000},
  month   = nov,
  day     = {10},
  title   = {Neuroscience: {B}reaking Down Scientific Barriers to the
             Study of Brain and Mind},
  journal = {Science},
  volume  = {290},
  pages   = {1113--1120},
}

@article{ex7,
  author  = {Brown, L. S.},
  year    = {1993},
  month   = spring,
  title   = {Antidomination Training as a Central Component of
             Diversity in Clinical Psychology Education},
  journal = {The Clinical Psychologist},
  volume  = {46},
  pages   = {83--87},
}

@article{ex8,
  year    = {1993},
  month   = aug # "/" # sep,
  title   = {The New Health-Care Lexicon},
  journal = {Copy Editor},
  volume  = {4},
  pages   = {1--2},
}

@newspaper{ex9,
  key     = {{\APACciteatitle{New Drug}}},
  year    = {1993},
  month   = jul,
  day     = {15},
  title   = {New Drug Appears to Sharply Cut Risk of Death from
             Heart Failure},
  journal = {The Washington Post},
  pages   = {A12},
}

@newspaper{ex10,
  author  = {Schwartz, J.},
  year    = {1993},
  month   = sep,
  day     = {30},
  title   = {Obesity Affects Economic, Social Status},
  journal = {The Washington Post},
  pages   = {A1, A4},
}

@newspaper{ex11,
  author  = {Berkowitz, A. D.},
  year    = {2000},
  month   = nov,
  day     = {24},
  title   = {How to Tackle the Problem of Student Drinking},
  type    = {Letter to the editor},
  journal = {The Chronicle of Higher Education},
  pages   = {B20},
}

@article{ex12,
  editor  = {Barlow, D. H.},
  year    = {1991},
  title   = {Diagnoses, Dimensions, and \emph{DSM-IV}:
             The Science of Classification},
  type    = {Special issue},
  journal = {Journal of Abnormal Psychology},
  volume  = {100},
  number  = {3},
}

@article{ex13,
  author  = {Harris, P. L. and Kavanaugh, R. D.},
  year    = {1993},
  title   = {Young Children's Understanding of Pretense},
  journal = {Monographs of the Society for Research in Child Development},
  volume  = {58},
  number  = {1, Serial No.~231},
}

@article{ex14,
  author  = {Battig, W. F. and Montague, W. E.},
  year    = {1969},
  title   = {Category Norms for Verbal Items in 56 Categories:
             A Replication and Extension of the {Connecticut}
             Category Norms},
  journal = {Journal of Experimental Psychology Monographs},
  volume  = {80},
  number  = {3, Pt.~2},
}

@article{ex15,
  author  = {Ganster, D. C. and Schaubroeck, J. and Sime, W. E.
             and Mayes, B. T.},
  year    = {1991},
  title   = {The Nomological Validity of the {Type}~{A} Personality
             Among Employed Adults},
  type    = {Monograph},
  journal = {Journal of Applied Psychology},
  volume  = {76},
  pages   = {143--168},
}

@article{ex16,
  author  = {Woolf, N. J. and Young, S. L. and Fanselow, M. S. and
             Butcher, L. L.},
  year    = {1991},
  title   = {{MAP}-2 Expression in Cholinoceptive Pyramidal Cells
             of Rodent Cortex and Hippocampus is Altered by
             {Pavlovian} Conditioning},
  type    = {Abstract},
  journal = {Society for Neuroscience Abstracts},
  volume  = {17},
  pages   = {480},
}

@article{ex17,
  author  = {Nakazato, K. and Shimonaka, Y. and Homma, A.},
  year    = {{\protect\bibreftext{1992}{1992/1993}}},
  title   = {Cognitive Functions of Centenarians: The {Tokyo}
             {Metropolitan} {Centenarian} {Study}},
  journal = {Japanese Journal of Developmental Psychology},
  volume  = {3},
  pages   = {9--16},
  howpublished = {Abstract obtained from
             {\APACcitebtitle{PsycSCAN: Neuropsychology}},
             1993, \emph{2}, Abstract No.~604},
}

@article{ex18,
  author  = {Regier, A. A. and Narrow, W. E. and Rae, D. S.},
  year    = {1990},
  title   = {The Epidemiology of Anxiety Disorders: The Epidemiologic
             Catchment Area ({ECA}) Experience},
  journal = {Journal of Psychiatric Research},
  volume  = {24},
  number  = {Suppl.~2},
  pages   = {3--14},
}

@article{ex19,
  author  = {Fiske, S. T.},
  year    = {1993},
  title   = {Social Cognition and Social Perception},
  journal = {Annual Review of Psychology},
  volume  = {44},
  pages   = {155--194},
}

@article{ex20,
  author  = {Ising, M.},
  year    = {2000},
  title   = {Intensit{\"{a}}tsabh{\"{a}}ngigkeit evozierter {Potenzial} im
             {EEG}: Sind impulsive {Personen} {Augmenter} oder
             {Reducer}?},
  englishtitle = {Intensity Dependence in Event-Related {EEG} Potentials:
             Are Impulsive Individuals Augmenters or Reducers?},
  journal = {Zeitschrift f{\"{u}}r Differentielle und Diagnostische
             Psychologie},
  volume  = {21},
  pages   = {208--217},
}

@article{ex21,
  author  = {Stutte, H.},
  year    = {1972},
  title   = {Transcultural Child Psychiatry},
  journal = {Acta Paedopsychiatrica},
  volume  = {38},
  number  = {9},
  pages   = {229--231},
}

@article{ex22,
  author  = {Coltheart, M. and Curtis, B. and Atkins, P. and Haller, M.},
  year    = {1993},
  title   = {Models of Reading Aloud: Dual-Route and
             Parallel-Distributed-Processing Approaches},
  journal = {Psychological Review},
  volume  = {100},
  pages   = {589--608},
}

@book{B-1,
  author    = {Beck, C. A. J. and Sales, B. D.},
  year      = {2001},
  title     = {Family Mediation: Facts, Myths, and Future Prospects},
  address   = {Washington, DC},
  publisher = {American Psychological Association},
}

@book{ex23,
  author    = {Mitchell, T. R. and Larson, Jr.\hbox{}, J. R.},
  year      = {1987},
  title     = {People in Organizations: An Introduction to
               Organizational Behavior},
  edition   = {3},
  address   = {New York},
  publisher = {McGraw-Hill},
}

@book{ex24,
  author    = {{\bibcorporate{Australian Bureau of Statistics}}},
  year      = {1991},
  title     = {Estimated Resident Population by Age and Sex in
               Statistical Local Areas, {New} {South} {Wales},
               {June} 1990},
  number    = {3209.1},
  address   = {Canberra, Australian Capital Territory},
  publisher = {{\bibcorporate{Australian Bureau of Statistics}}},
}

@book{ex25,
  editor    = {Gibbs, J. T. and Huang, L. N.},
  year      = {1991},
  title     = {Children of Color: Psychological Interventions with
               Minority Youth},
  address   = {San Francisco},
  publisher = {Jossey-Bass},
}

@book{ex25-t1,
  author         = {Vygotsky, L. S.},
  year           = {1978},
  title          = {Mind in Society: {T}he Development of Higher Mental
                    Processes},
  editor         = {Rice, Edgar},
  translator     = {Rice, Edgar},
  address        = {Cambridge, MA},
  publisher      = {Harvard University Press},
  originalyear   = {1930, 1933, 1935},
}

@book{ex25-t2,
  author         = {J{\"{o}}reskog, Karl G. and S{\"{o}}rbom, Dag},
  year           = {1979},
  title          = {Advances in Factor Analysis
                    and Structural Equation Models},
  editor         = {Magidson, Jay},
  address        = {Cambridge, MA},
  publisher      = {Abt Books},
}

@book{ex26,
  year      = {1993},
  title     = {Merriam-{Webster}'s Collegiate Dictionary},
  edition   = {10},
  address   = {Springfield, MA},
  publisher = {Merriam-Webster},
}

@book{ex27,
  author    = {Rosenthal, R.},
  year      = {1987},
  title     = {Meta-Analytic Procedures for Social Research},
  edition   = {Rev.\hbox{}},
  address   = {Newbury Park, CA},
  publisher = {Sage},
}

@book{ex28,
  editor    = {Koch, S.},
  year      = {1959--1963},
  title     = {Psychology: {A} Study of Science},
  volume    = {1--6},
  address   = {New York},
  publisher = {McGraw-Hill},
}

@book{ex29,
  key       = {{\bibDSM{American Psychiatric
               Association}{Diagnostic and Statistical Manual
               of Mental Disorders}{4th ed.\hbox{}}{DSM-IV}}},
  author    = {{\bibcorporate{American Psychiatric Association}}},
  year      = {1994},
  title     = {Diagnostic and Statistical Manual of Mental Disorders},
  edition   = {4},
  address   = {Washington, DC},
  publisher = {{\bibcorporate{American Psychiatric Association}}},
}

@book{ex30,
  editor    = {Sadie, S.},
  year      = {1980},
  title     = {The New {G}rove Dictionary of Music and Musicians},
  edition   = {6},
  volume    = {1--20},
  address   = {London},
  publisher = {Macmillan},
}

@book{ex30-2,
  editor    = {Kazdin, Alan E. and Blanchard, Edward B. and
               Bootzin, Richard R. and Bower, Gordon and
               Close Conoley, Jane and Deaux, Kay and Fox, Ronald E. and
               Harmon, Lenore W. and Howell, William C. and
               Marsella, Anthony J. and Price, Richard H. and
               Roediger, III, Henry L. and Rosenthal, Robert and
               Schmitt, Neal W. and Singer, Jerome L. and Squire, Larry R. and
               Zahn-Waxler, Carolyn},
  year      = {2000},
  title     = {Encyclopedia of Psychology},
  address   = {New York},
  publisher = {Oxford University Press},
}

@book{ex31,
  author    = {Piaget, J. and Inhelder, B.},
  year      = {1951},
  title     = {La Gen{\`{e}}se de l'Id{\'{e}}e de Hasard chez l'Enfant},
  englishtitle = {The Origin of the Idea of Chance in the Child},
  address   = {Paris},
  publisher = {Presses Universitaires de France},
}

@book{ex32,
  author    = {Laplace, P.-S.},
  year      = {1951},
  title     = {A Philosophical Essay on Probabilities},
  translator = {Truscott, F. W. and Emory, F. L.},
  address   = {New York},
  publisher = {Dover},
  originalyear = {1814},
}

@book{ex33,
  author    = {{\bibcorporate{Research and Training Center on
               Independent Living}}},
  firstkey  = {{Research and Training Center on Independent Living [RTCIL]}},
  key       = {RTCIL},
  year      = {1993},
  title     = {Guidelines for Reporting and Writing About People
               with Disabilities},
  edition   = {4},
  type      = {Brochure},
  address   = {Lawrence, KS},
  publisher = {{\bibcorporate{Research and Training Center on
               Independent Living}}},
}

@incollection{B-2,
  author    = {Massaro, D.},
  year      = {1992},
  title     = {Broadening the Domain of the Fuzzy Logical Model of Perception},
  editor    = {Pick, Jr.\hbox{}, H. L. and van den Broek, P. and Knill, D. C.},
  booktitle = {Cognition: Conceptual and Methodological Issues},
  pages     = {51--84},
  address   = {Washington, DC},
  publisher = {American Psychological Association},
}

@incollection{ex34,
  author    = {Bjork, R. A.},
  year      = {1989},
  title     = {Retrieval Inhibition as an Adaptive Mechanism in Human Memory},
  editor    = {Roediger, III, H. L. and Craik, F. I. M.},
  booktitle = {Varieties of Memory \& Consciousness},
  pages     = {309--330},
  address   = {Hillsdale, NJ},
  publisher = {Erlbaum},
}

@incollection{ex35,
  author    = {Auerbach, J. S.},
  year      = {\BIP},
  title     = {The Origins of Narcissism and Narcissistic Personality
               Disorder: A Theoretical and Empirical Reformulation},
  editor    = {Masling, J. M. and Bornstein, R. F.},
  booktitle = {Empirical Studies of Psychoanalytic Theories:
               {Vol}.~4. {Psychoanalytic} Perspectives on Psychopathology},
  address   = {Washington, DC},
  publisher = {American Psychological Association},
}

@incollection{ex36,
  author    = {Maccoby, E. E. and Martin, J.},
  year      = {1983},
  title     = {Socialization in the Context of the Family:
               Parent-Child Interaction},
  editor    = {Mussen (Series Ed.\hbox{}), P. H. and
               Hetherington{\bibeditortype{Vol.\ Ed.\hbox{}}}, E. M.},
  booktitle = {Handbook of Child Psychology:
               {Vol}.~4. {Socialization}, Personality, and Social Development},
  edition   = {4},
  pages     = {1--101},
  address   = {New York},
  publisher = {Wiley},
}

@incollection{ex37,
  author       = {Davydov, V. V.},
  year         = {1972},
  title        = {De Introductie van het Begrip Grootheid in de Eerste
                  Klas van de Basisschool: Een Experimenteel Onderzoek},
  englishtitle = {The Introduction of the Concept of Quantity in the
                  First Grade of the Primary School: An Experimental Study},
  editor       = {Van Parreren, C. F. and Carpay, J. A. M.},
  booktitle    = {Sovjetpsychologen aan het Woord},
  pages        = {227--289},
  address      = {Groningen, The Netherlands},
  publisher    = {Wolters-Noordhoff},
}

@incollection{ex38,
  author       = {Bergmann, P. G.},
  year         = {1993},
  title        = {Relativity},
  booktitle    = {The New Encyclopaedia {Britannica}},
  volume       = {26},
  pages        = {501--508},
  address      = {Chicago},
  publisher    = {Encyclopaedia Britannica},
}

@incollection{ex39,
    author       = {Freud, Sigmund},
    year         = {1961},
    title        = {The Ego and the Id},
    editor       = {Strachey, J.},
    translator   = {Strachey, J.},
    booktitle    = {The Standard Edition of the Complete Psychological
                    Works of {Sigmund} {Freud}},
    volume       = {19},
    pages        = {3--66},
    address      = {London},
    publisher    = {Hogarth Press},
    originalyear = {1923},
}

@incollection{ex40,
    author       = {Piaget, J.},
    year         = {1988},
    title        = {Extracts from {Piaget}'s Theory},
    translator   = {Gellerier, G. and Langer, J.},
    editor       = {Richardson, K. and Sheldon, S.},
    booktitle    = {Cognitive Development to Adolescence: A Reader},
    pages        = {3--18},
    address      = {Hillsdale, NJ},
    publisher    = {Erlbaum},
    originalbooktitle = {Manual of Child Psychology},
    originalpages     = {703--732},
    originaleditor    = {Mussen, P. H.},
    originalyear      = {1970},
    originaladdress   = {New York},
    originalpublisher = {Wiley},
}

@incollection{ex40-t1,
   author          = {Browne, M[ichael] W.},
   year            = {1977},
   title           = {Generalized Least Squares Estimators in the Analysis
                      of Covariance Structures},
   editor          = {Aigner, D[ennis] J. and Goldberger, A[rthur] S.},
   booktitle       = {Latent Variables in Socio-Economic Models},
   pages           = {205--226},
   address         = {Amsterdam},
   publisher       = {North Holland},
   originalyear    = {1974},
   originaljournal = {South African Statistical Journal},
   originalvolume  = {8},
   originalpages   = {1--24},
}


@techreport{C-1,
  author      = {Mazzeo, J. and Druesne, B. and Raffeld, P. C.
                 and Checketts, K. T. and Muhlstein, A.},
  year        = {1991},
  title       = {Comparability of Computer and Paper-and-Pencil Scores
                 for Two {CLEP} General Examinations},
  type        = {College Board Rep.},
  number      = {91-5},
  address     = {Princeton, NJ},
  institution = {Educational Testing Service},
}

@techreport{ex41,
  author      = {{\bibcorporate{National Institute of Mental Health}}},
  firstkey    = {{National Institute of Mental Health [NIMH]}},
  key         = {{NIMH}},
  year        = {1990},
  title       = {Clinical Training in Serious Mental Illness},
  type        = {{DHHS} Publication},
  number      = {ADM 90-1679},
  address     = {Washington, DC},
  institution = {U.S. Government Printing Office},
}

@techreport{ex42,
  author      = {Osgood, D. W. and Wilson, J. K.},
  year        = {1990},
  title       = {Covariation of Adolescent Health Problems},
  type        = {\bibnotype},
  address     = {Lincoln},
  institution = {University of Nebraska},
  note        = {NTIS No.\hbox{} PB~91-154~377/AS},
}

@techreport{ex43,
  author      = {Mead, J. V.},
  year        = {1992},
  title       = {Looking at Old Photographs: Investigating the Teacher
                 Tales that Novice Teachers Bring with Them},
  type        = {Report},
  number      = {NCRTL-RR-92-4},
  address     = {East Lansing, MI},
  institution = {National Center for Research on Teacher Learning},
  note        = {ERIC Document Reproduction Service No.\hbox{} ED346082},
}

@techreport{ex44,
  author      = {{\bibcorporate{U.S. Department of Health and
                 Human Services}}},
  firstkey    = {{U.S. Department of Health and Human Services [DHHS]}},
  key         = {{DHHS}},
  year        = {1992},
  title       = {Pressure Ulcers in Adults: Prediction and Prevention},
  type        = {AHCPR Publication},
  number      = {92-0047},
  address     = {Rockville, MD},
  institution = {{\bibcorporate{U.S. Department of Health and
                 Human Services}}},
}

@intechreport{ex45,
  author      = {Matthews, K. A.},
  year        = {1985},
  title       = {Assessment of {Type}~{A} Behavior, Anger, and Hostility
                 in Epidemiologic Studies of Cardiovascular Disease},
  editor      = {Ostfield, A. M. and Eaker, E. D.},
  booktitle   = {Measuring Psychological Variables in Epidemiologic Studies
                 of Cardiovascular Disease},
  type        = {NIH Publication},
  number      = {85-2270},
  pages       = {153--183},
  address     = {Washington, DC},
  institution = {U.S. Department of Health and Human Services},
}

@techreport{ex46,
  author      = {Broadhurst, R. G. and Maller, R. A.},
  year        = {1991},
  title       = {Sex Offending and Recidivism},
  number      = {3},
  address     = {Nedlands},
  institution = {University of Western Australia, Crime Research Centre},
}

@techreport{ex47,
  editor      = {Shuker, R. and Openshaw, R. and Soler, J.},
  year        = {1990},
  title       = {Youth, Media, and Moral Panic in {New} {Zealand}:
                 From Hooligans to Video Nasties},
  type        = {Delta Research Monograph},
  number      = {11},
  address     = {Palmerston North, New Zealand},
  institution = {Massey University, Department of Education},
}

@techreport{ex48,
  author      = {{\bibcorporate{Employee Benefit Research Institute}}},
  firstkey    = {{Employee Benefit Research Institute [EBRI]}},
  key         = {{EBRI}},
  year        = {1992},
  month       = feb,
  title       = {Sources of Health Insurance and Characteristics of the
                 Uninsured},
  type        = {Issue Brief},
  number      = {123},
  address     = {Washington, DC},
  institution = {{\bibcorporate{Employee Benefit Research Institute}}},
}

@incollection{ex49,
  author       = {Deci, E. L. and Ryan, R. M.},
  year         = {1991},
  title        = {A Motivational Approach to Self:
                  Integration in Personality},
  editor       = {Dienstbier, R.},
  booktitle    = {Nebraska {Symposium} on {Motivation}: Vol.~38.
                  {Perspectives} on Motivation},
  pages        = {237--288},
  address      = {Lincoln},
  publisher    = {University of Nebraska Press},
}

@article{ex50,
  author  = {Cynx, J. and Williams, H. and Nottebohm, F.},
  year    = {1992},
  title   = {Hemispheric Differences in Avian Song Discrimination},
  journal = {Proceedings of the National Academy of Sciences, USA},
  volume  = {89},
  pages   = {1372--1375},
}

@lecture{ex51,
  author       = {Lichstein, K. L. and Johnson, R. S. and Womack, T. D.
                  and Dean, J. E. and Childers, C. K.},
  year         = {1990},
  month        = jun,
  title        = {Relaxation Therapy for Polypharmacy Use in Elderly
                  Insomniacs and Noninsomniacs},
  chair        = {Rosenthal, T. L.},
  symposium    = {Reducing Medication in Geriatric Populations},
  howpublished = {Symposium conducted at the meeting of the First
                  International Congress of Behavioral Medicine},
  address      = {Uppsala, Sweden},
}

@lecture{ex52,
  author       = {Lanktree, C. and Briere, J.},
  year         = {1991},
  month        = jan,
  title        = {Early Data on the {Trauma} {Symptom} {Checklist}
                  for {Children} ({TSC-C})},
  howpublished = {Paper presented at the meeting of the American
                  Professional Society on the Abuse of Children},
  address      = {San Diego, CA},
}

@lecture{ex53,
  author       = {Ruby, J. and Fulton, C.},
  year         = {1993},
  month        = jun,
  title        = {Beyond Redlining: Editing Software that Works},
  howpublished = {Poster session presented at the annual meeting of the
                  Society for Scholarly Publishing},
  address      = {Washington, DC},
}

@phdthesis{ex54,
  author       = {Bower, D. L.},
  year         = {1993},
  title        = {Employee Assistant Programs Supervisory Referrals:
                  Characteristics of Referring and Nonreferring
                  Supervisors},
  journal      = {Dissertation Abstracts International},
  volume       = {54},
  number       = {01},
  pages        = {534B},
  note         = {UMI No.~9315947},
}

@phdthesis{ex55,
  author       = {Ross, D. F.},
  year         = {1990},
  title        = {Unconscious Transference and Mistaken Identity: When
                  a Witness Misidentifies a Familiar but Innocent Person
                  from a Lineup},
  school       = {Cornell University},
  originalyear = {1990},
  journal      = {Dissertation Abstracts International},
  volume       = {51},
  pages        = {417},
}

@phdthesis{ex56,
  author       = {Wilfley, D. E.},
  year         = {1989},
  title        = {Interpersonal Analyses of Bulimia: Normalweight
                  and Obese},
  school       = {University of Missouri},
  address      = {Columbia},
}

@mastersthesis{ex57,
  author       = {Almeida, D. M.},
  year         = {1990},
  title        = {Fathers' Participation in Family Work: Consequences
                  for Fathers' Stress and Father--Child Relations},
  school       = {University of Victoria},
  address      = {Victoria, British Columbia, Canada},
}

@unpublished{ex58,
  author       = {Stinson, C. and Milbrath, C. and Reidbord, S. and Bucci, W.},
  year         = {1992},
  title        = {Thematic Segmentation of Psychotherapy Transcripts for
                  Convergent Analyses},
  howpublished = {Unpublished manuscript},
}

@unpublished{ex59,
  author       = {D{\'{e}}pret, E. F. and Fiske, S. T.},
  year         = {1993},
  title        = {Perceiving the Powerful: Intriguing Individuals Versus
                  Threatening Groups},
  howpublished = {Unpublished manuscript},
  organization = {University of Massachusetts at Amherst},
}

@unpublished{ex60,
  author       = {McIntosh, D. N.},
  year         = {1993},
  title        = {Religion as Schema, with Implications for the Relation
                  Between Religion and Coping},
  howpublished = {Manuscript submitted for publication},
}

@unpublished{ex61,
  author       = {Bordi, F. and LeDoux, J. E.},
  year         = {1993},
  type         = {Auditory response latencies in rat auditory cortex},
  howpublished = {Unpublished raw data},
}

@misc{ex62,
  editor       = {Klombers, N.},
  year         = {1993},
  month        = spring,
  title        = {{ADAA} {Reporter}},
  note         = {Available from the Anxiety Disorders Association of
                  America, 6000 Executive Boulevard, Suite 513,
                  Rockville, MD 20852},
}

@article{G-1,
  author       = {Mroczek, D. K.},
  year         = {2000},
  title        = {The Emerging Study of Midlife},
  type         = {Review of the book {\APACcitebtitle{Life in the middle:
                  Psychological and social development in middle age}}},
  journal      = {Contemporary Psychology: APA Review of Books},
  volume       = {45},
  pages        = {482--485},
}

@article{ex63,
  author       = {Schatz, B. R.},
  year         = {2000},
  title        = {Learning by Text or Context?},
  type         = {Review of the book
                  {\APACcitebtitle{The social life of information}}},
  journal      = {Science},
  volume       = {290},
  pages        = {1304},
}

@article{ex64,
  author       = {Kraus, S. J.},
  year         = {1992},
  title        = {Visions of Psychology: A Videotext of Classic Studies},
  type         = {Review of the motion picture
                  {\APACcitebtitle{Discovering Psychology}}},
  journal      = {Contemporary Psychology},
  volume       = {37},
  pages        = {1146--1147},
}

@misc{ex65-1,
  author    = {Scorsese, M. {\protect\bibliteral{(Producer)}\protect\bibskipbracenodot}
               and Lonergan, K.
               {\protect\bibliteral{(Writer/Director)}\protect\indexskipbracenodot}},
  year      = {2000},
  title     = {You Can Count On Me},
  type      = {Motion picture},
  address   = {United States},
  publisher = {Paramount Pictures},
}

@misc{ex65-2,
  author    = {Harrison, J. {\protect\bibliteral{(Producer)}\protect\bibskipbracenodot}
               and Schmiechen, R.
               {\protect\bibliteral{(Director)}\protect\indexskipbracenodot}},
  year      = {1992},
  title     = {Changing Our Minds: The Story of {Evelyn} {Hooker}},
  type      = {Motion picture},
  note      = {Available from Changing Our Minds, Inc., 170 West End
               Avenue, Suite 25R, New York, NY 10023},
}

@misc{ex65-3,
  author    = {{\bibcorporate{American Psychological Association (Producer)}}},
  firstkey  = {{American Psychological Association [APA]}},
  key       = {{APA}},
  year      = {2000},
  title     = {Responding Therapeutically to Patient Expressions of
               Sexual Attraction: A Stimulus Training Tape},
  type      = {Motion picture},
  note      = {Available from the American Psychological Association,
               750 First Street, NE, Washington, DC 20002-4242},
}

@misc{ex66,
  author    = {Crystal, L. {\protect\bibliteral{(Executive
                            Producer)}\protect\indexskipbracenodot}},
  year      = {1993},
  month     = oct,
  day       = {11},
  title     = {The {MacNeil}/{Lehrer} News Hour},
  type      = {Television broadcast},
  address   = {New York and Washington, DC},
  publisher = {Public Broadcasting Service},
}

@misc{ex67,
  editor    = {Miller, {\bibinitial{R\bibeditortype{Producer}}}},
  year      = {1989},
  title     = {The Mind},
  type      = {Television series},
  address   = {New York},
  publisher = {WNET},
}

@incollection{ex68,
  author    = {Hall, B. {\protect\bibliteral{(Writer)}\protect\bibskipbracenodot}
               and Bender, J.
               {\protect\bibliteral{(Director)}\protect\indexskipbracenodot}},
  year      = {1991},
  title     = {The Rules of the Game},
  type      = {Television series episode},
  editor    = {Sander{\bibeditortype{Producer}}, J.},
  booktitle = {I'll Fly Away},
  address   = {New York},
  publisher = {New York Broadcasting Company},
}

@incollection{ex69-1,
  key       = {{\protect\bibsong{Shocked}{1992}{Over the
               Waterfall}{track~5}}},
  author    = {Shocked, Michelle},
  year      = {1992},
  title     = {Over the Waterfall{\bibInstring{\BOn}}},
  booktitle = {Arkansas Traveler {\upshape[\uppercase{CD}]}},
  address   = {New York},
  publisher = {PolyGram Music},
}

@incollection{ex69-2,
  key       = {{\protect\bibsong{Goodenough}{1982}{Tails
                and Trotters}{track~5}}},
  author    = {Goodenough, J. B.},
  year      = {1982},
  title     = {Tails and Trotters{\bibInstring{\BOn}}},
  type      = {Recorded by G. Bok, A. Mayo, \& E. Trickett},
  booktitle = {And So Will We Yet {\upshape[\uppercase{CD}]}},
  address   = {Sharon, CT},
  publisher = {Folk-Legacy Records},
  note      = {1990},
}

@misc{ex70,
  author    = {Costa, Jr.\hbox{} {\protect\bibliteral{(Speaker)}}, P. T.},
  year      = {1988},
  title     = {Personality, Continuity, and Changes of Adult Life},
  type      = {Cassette Recording},
  number    = {207-433-88A-B},
  address   = {Washington, DC},
  publisher = {American Psychological Association},
}

@article{ex71-1,
  author  = {VandenBos, G. and Knapp, S. and Doe, J.},
  year    = {2001},
  title   = {Role of Reference Elements in the Selection of Resources
             by Psychology Undergraduates},
  type    = {Electronic version},
  journal = {Journal of Bibliographic Research},
  volume  = {5},
  pages   = {117--123},
}

@article{ex71-2,
  author      = {VandenBos, G. and Knapp, S. and Doe, J.},
  year        = {2001},
  title       = {Role of Reference Elements in the Selection of Resources
                 by Psychology Undergraduates},
  journal     = {Journal of Bibliographic Research},
  volume      = {5},
  pages       = {117--123},
  lastchecked = {October 13, 2001},
  url         = {http://jbr.org/articles.html},
}

@article{ex72,
  author      = {Fredrickson, B. L.},
  year        = {2000},
  month       = mar,
  day         = {7},
  title       = {Cultivating Positive Emotions to Optimize Health
                 and Well-Being},
  journal     = {Prevention \& Treatment},
  volume      = {3},
  pages       = {Article 0001a},
  lastchecked = {November 20, 2000},
  url         = {http://journals.apa.org/prevention/volume3/pre0030001a.html},
}

@article{ex73,
  author      = {Crow, T. J.},
  year        = {2000},
  title       = {Did \emph{Homo} {\emph{Sapiens}} Speciate on the
                 {\emph{Y}} Chromosome?},
  journal     = {Psycoloquy},
  volume      = {11},
  lastchecked = {March 25, 2001},
  url         = {ftp://ftp.princeton.edu/harnad/Psycoloquy/
                 2000.volume.11/psyc.00.11.001.
                 language-sex-chromosomes.1.crow},
}

@article{ex74,
  author      = {Glueckauf, R. L. and Whitton, J. and Baxter, J. and Kain, J.
                 and Vogelgesang, S. and Hudson, M. and others},
  year        = {1998},
  month       = jul,
  title       = {Videocounseling for Families of Rural Teens with
                 Epilepsy---{P}roject Update},
  journal     = {Telehealth News},
  volume      = {2},
  number      = {2},
  lastchecked = {June 6, 2000},
  url         = {http://www.telehealth.net/subscribe/newslettr_4a.html#1},
}

@misc{ex75,
  author      = {{\bibcorporate{Greater New Milford (Ct) Area Healthy
                  Community 2000,
                  Task Force on Teen and Adolescent Issues}}},
  firstkey    = {{Greater New Milford (Ct) Area Healthy Community 2000,
                  Task Force on Teen and Adolescent Issues [TFTAI]}},
  key         = {{TFTAI}},
  year        = {\bibnodate},
  title       = {Who Has Time for a Family Meal? {You} Do!},
  lastchecked = {October 5, 2000},
  url         = {http://www.familymealtime.org},
}

@incollection{ex76,
  author      = {{\bibcorporate{Benton Foundation}}},
  year        = {1998},
  month       = jul,
  day         = {7},
  title       = {Barriers to Closing the Gap},
  booktitle   = {Losing Ground Bit by Bit: Low-Income Communities in the
                 Information Age},
  chapter     = {2},
  lastchecked = {August 18, 2001},
  url         = {http://www.benton.org/Library/Low-Income/two.html},
}

@misc{ex77,
  year        = {\bibnodate},
  title       = {{GVU}'s 8th {WWW} User Survey},
  lastchecked = {August 8, 2000},
  url         = {http://www.cc.gatech.edu/gvu/user_surveys/survey-1997-10/},
}

@misc{ex78,
  author    = {Chou, L. and McClintock, R. and Moretti, F. and Nix, D. H.},
  year      = {1993},
  title     = {Technology and Education: New Wine in New Bottles:
               Choosing Pasts and Imagining Educational Futures},
  howpublished   = {Retrieved August 24, 2000, from Columbia University,
               Institute for Learning Technologies Web site:
               \url{http://www.ilt.columbia.edu/
                    publications/papers/newwine1.html}\bibnodot{.}},
}

@misc{ex79,
  author    = {{\bibcorporate{University of California, San Francisco,
               Institute for Health and Aging}}},
  firstkey  = {{University of California, San Francisco, Institute for
                Health and Aging [UCSF-IHA]}},
  key       = {{UCSF-IHA}},
  year      = {1996},
  month     = nov,
  title     = {Chronic Care in {A}merica: {A} 21st Century Challenge},
  howpublished   = {Retrieved September 9, 2000, from the Robert Wood Johnson
               Foundation Web site:
               \url{http://www.rwjf.org/library/chrcare/}\bibnodot{.}},
}

@misc{ex80,
  author      = {{\bibcorporate{United States Sentencing Commission}}},
  firstkey    = {{United States Sentencing Commission [USSC]}},
  key         = {{USSC}},
  year        = {\bibnodate},
  title       = {{\APACSortNoop{Nineteen Ninety-Seven}}1997 Sourcebook of
                 Federal Sentencing Statistics},
  lastchecked = {December 8, 1999},
  url         = {http://www.ussc.gov/annrpt/1997/sbtoc97.htm},
}

@misc{ex81,
  author      = {{\bibcorporate{Canarie, Inc.}}},
  year        = {1997},
  month       = sep,
  day         = {27},
  title       = {Towards a {Canadian} Health {IWAY}: Vision, Opportunities
                 and Future Steps},
  lastchecked = {November 8, 2000},
  url         = {http://www.canarie.ca/press/publications/pdf/
                         health/healthvision.doc},
}

@techreport{ex82,
  author    = {Kruschke, J. K. and Bradley, A. L.},
  year      = {1995},
  title     = {Extensions to the Delta Rule of Associative Learning},
  type      = {Indiana University Cognitive Science Research Report},
  number    = {14\BmakeAbstractRetrieved},
  lastchecked = {October 21, 2000},
  url         = {http://www.indiana.edu/~kruschke/deltarule_abstract.html},
}

@lecture{ex83,
  author       = {Cutler, L. D. and Fr{\"{o}}lich, B. and Hanrahan, P.},
  year         = {1997},
  month        = jan,
  day          = {16},
  title        = {Two-Handed Direct Manipulation on the Responsive
                  Workbench},
  howpublished = {Paper presented at the 1997 Symposium on Interactive 3D
                  Graphics\BmakeAbstractRetrieved},
  lastchecked  = {June 12, 2000},
  url          = {http://www.graphics.stanford.edu/papers/twohanded/},
}

@lecture{ex84,
  author       = {Tan, G. and Lewandowsky, S.},
  year         = {1996},
  title        = {A Comparison of Operator Trust in Humans Versus Machines},
  howpublished = {Paper presented at the CybErg 96 virtual conference},
  lastchecked  = {May 16, 2000},
  url          = {http://www.curtin.edu.au/conference/cyberg/
                  centre/outline.cgi/frame?dir=tan},
}

@misc{ex85,
  author = {Chalmers, D.},
  year   = {2000},
  month  = nov,
  day    = {17},
  title  = {Seeing with Sound},
  type   = {\bibmessage},
  number = {1},
  url    = {news://sci.psychology.consciousness}
}

@misc{ex86,
  author = {Simons, D. J.},
  year   = {2000},
  month  = jul,
  day    = {14},
  title  = {News Resources for Visual Cognition},
  type   = {\bibmessage},
  number = {31},
  url    = {http://groups.yahoo.com/group/visualcognition/message/31},
}

@misc{ex87,
  author = {Hammond, T.},
  year   = {2000},
  month  = nov,
  day    = {20},
  title  = {{YAHC}: {Handle} {Parameters}, {DOI} {Genres}, etc.},
  type   = {\bibmessage},
  howpublished = {Message posted to Ref-Links electronic mailing list,
            archived at \url{http://www.doi.org/mail-archive/
                             ref-link/msg00088.html}\bibnodot{.}},
}

@article{ex88,
  author  = {Borman, W. C. and Hanson, M. A. and Oppler, S. H. and
             Pulakos, E. D. and White, L. A.},
  year    = {1993},
  title   = {Role of Early Supervisory Experience in Supervisor Performance},
  journal = {Journal of Applied Psychology},
  volume  = {78},
  pages   = {443--449},
  howpublished = {Retrieved October 23, 2000, from the PsycARTICLES database},
}

@newspaper{ex89,
  author      = {Hilts, P. J.},
  year        = {1999},
  month       = feb,
  day         = {16},
  title       = {In Forecasting Their Emotions, Most People Flunk Out},
  journal     = {New York Times},
  lastchecked = {November 21, 2000},
  url         = {http://www.nytimes.com},
}

@article{ex90,
  author  = {Fournier, M. and {\lowercase{D}}e Ridder, D. and Bensing, J.},
  year    = {1999},
  title   = {Optimism and Adaptation to Multiple Sclerosis: What Does
             Optimism Mean?},
  journal = {Journal of Behavioral Medicine},
  volume  = {22},
  pages   = {303--326},
  howpublished = {Abstract retrieved October 23, 2000, from PsycINFO database},
}

@techreport{ex91,
  author  = {{\bibcorporate{U.S. General Accounting Office}}},
  year    = {1997},
  month   = feb,
  title   = {Telemedicine: Federal Strategy is Needed to Guide Investments},
  type    = {Publication},
  number  = {GAO/NSAID/HEHS-97-67},
  howpublished = {Retrieved September 15, 2000, from General Accounting Office
             Reports Online via GPO Access:
             \url{http://www.access.gpo.gov/su_docs/aces/
                  aces160.shtml?/gao/index.html}\bibnodot{.}},
}

@misc{ex92,
  author    = {Miller, M. E.},
  year      = {1993},
  title     = {The {Interactive} {Tester}},
  edition   = {Version~4.0\noedition\ignorespaces},
  type      = {\bibcomputersoftware},
  address   = {Westminster, CA},
  publisher = {Psytek Services},
}

@misc{ex93,
  author      = {Schwarzer, R.},
  year        = {1989},
  title       = {Statistics Software for Meta-Analysis},
  type        = {\bibcomputersoftwareandmanual},
  lastchecked = {March 23, 2001},
  url         = {http://www.yorku.ca/faculty/academic/schwarze/meta_e.htm},
}

@manual{ex93-t1,
  author    = {{\bibcorporate{R Development Core Team}}},
  year      = {2004},
  title     = {R: A Language and Environment for Statistical Computing},
  address   = {Vienna, Austria},
  publisher = {R Foundation for Statistical Computing},
  url       = {http://www.r-project.org},
}

@misc{ex94,
  key       = {{\APACcitebtitle{National Health Interview Survey}}},
  title     = {National {Health} {Interview} {Survey}---{Current} Health
               Topics: 1991---{Longitudinal} Study of Aging},
  edition   = {Version~4\noedition\ignorespaces},
  type      = {Data file},
  year      = {\bibnodate},
  address   = {Hyattsville, MD},
  publisher = {National Center for Health Statistics},
}

@misc{ex95,
  author    = {{\bibcorporate{Department of Health and Human Services,
                National Center for Health Statistics}}},
  firstkey  = {{Department of Health and Human Services,
                National Center for Health Statistics [DHHS-NCHS]}},
  key       = {{DHHS-NCHS}},
  year      = {1991},
  title     = {National {Health} {Provider} {Inventory}: Home Health
               Agencies and Hospices, 1991},
  type      = {Data file},
  howpublished = {Available from National Technical Information Service
                  Web site, \url{http://www.ntis.gov}\bibnodot{.}},
}
%</bibdb>
%    \end{macrocode}
%
% \subsection{The examples \LaTeX{} file (\fname{apacxmpl.tex})}
%
% The file \fname{apacxmpl.tex} contains the \LaTeX{} code for formatting
% the examples from the APA manual. It can be studied to see how certain
% nonstandard references can be formatted according to the APA rules,
% to test \pkg{apacite}, and in particular to test compatibility with
% other packages. We start with a standard head.
%    \begin{macrocode}
%<*xmpl>
\documentclass{article}
\usepackage{url}
\usepackage{apacite}
\usepackage{apacdoc}

\title{Testing \textsf{apacite}: Examples from the APA manual}
\author{Erik Meijer\\
        \textsf{apacite at gmail.com}
}
\date{2013/07/21}

\begin{document}
\maketitle
\begin{abstract}
This document tests \textsf{apacite} [2013/07/21 v6.03]. See the
\textsf{apacite} documentation for more information.
\end{abstract}

%</xmpl>
%    \end{macrocode}
%
% \subsection{References from the 6th edition of the Publication Manual}
%
% These examples are from chapter~7 of the 6th edition of the APA manual.
%    \begin{macrocode}
%<*xmpl>
\section{Examples from chapter~7}

\begin{enumerate}
\item
\cite{apa6:ch7-ex1} \\
\cite{apa6:ch7-ex1} \\
\fullciteA{apa6:ch7-ex1} \\
\citeA{apa6:ch7-ex1}

\item
\cite{apa6:ch7-ex2} \\
\cite{apa6:ch7-ex2} \\
\fullciteA{apa6:ch7-ex2} \\
\citeA{apa6:ch7-ex2}
%</xmpl>
%<*bibdb>
@article{apa6:ch7-ex1,
  author  = {Herbst-Damm, Kathryn L. and Kulik, James A.},
  year    = {2005},
  title   = {Volunteer Support, Marital Status, and the Survival Times of
             Terminally Ill Patients},
  journal = {Health Psychology},
  volume  = {24},
  pages   = {225--229},
  doi     = {10.1037/0278-6133.24.2.225},
}

@article{apa6:ch7-ex2,
  author  = {Gilbert, David G. and McClernon, F. Joseph and
             Rabinovich, Norka E. and Sugai, Chihiro and
             Plath, Louisette C. and Asgaard, Greg and Zuo, Yantao and
             Huggenvik, Jodi and Botros, Nazeih},
  year    = {2004},
  title   = {Effects of Quitting Smoking on {EEG} Activation and Attention
             Last for More than 31 Days and are More Severe with Stress,
             Dependence, {DRD2~A1} Allele, and Depressive Traits},
  journal = {Nicotine \& Tobacco Research},
  volume  = {6},
  pages   = {249--267},
  doi     = {10.1080/14622200410001676305},
}
%</bibdb>
%    \end{macrocode}
% Note that the page heading of the article itself gives the journal name with
% an ampersand (`\&': \emph{Nicotine \& Tobacco Research}) and not with ``and''
% as in the APA manual.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex3-1} \\
\cite{apa6:ch7-ex3-1} \\
\fullciteA{apa6:ch7-ex3-1} \\
\citeA{apa6:ch7-ex3-1}\\
\mbox{}\\
\cite{apa6:ch7-ex3-2} \\
\cite{apa6:ch7-ex3-2} \\
\fullciteA{apa6:ch7-ex3-2} \\
\citeA{apa6:ch7-ex3-2}
%</xmpl>
%<*bibdb>
@article{apa6:ch7-ex3-1,
  author  = {Sillick, Tamra J. and Schutte, Nicola S.},
  year    = {2006},
  title   = {Emotional Intelligence and Self-Esteem Mediate Between Perceived
             Early Parental Love and Adult Happiness},
  journal = {E-Journal of Applied Psychology: Emotional Intelligence},
  volume  = {2},
  number  = {2},
  pages   = {38--48},
  url     = {http://ojs.lib.swin.edu.au/index.php/ejab},
}

@article{apa6:ch7-ex3-2,
  author  = {Light, Matthew A. and Light, Ivan H.},
  year    = {2008},
  title   = {The Geographic Expansion of {Mexican} Immigration in the
             {United} {States} and its Implications for Local Law
             Enforcement},
  journal = {Law Enforcement Executive Forum},
  volume  = {8},
  number  = {1},
  pages   = {73--82},
}
%</bibdb>
%    \end{macrocode}
% This journal appears to prefer the name \emph{Law Enforcement Executive
% Forum} over \emph{Law Enforcement Executive Forum Journal} (see
% \url{http://www.iletsbei.com/lee_forum/}).
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex4} \\
\cite{apa6:ch7-ex4} \\
\fullciteA{apa6:ch7-ex4} \\
\citeA{apa6:ch7-ex4}

\item
\cite{apa6:ch7-ex5} \\
\cite{apa6:ch7-ex5} \\
\fullciteA{apa6:ch7-ex5} \\
\citeA{apa6:ch7-ex5}
%</xmpl>
%<*bibdb>
@article{apa6:ch7-ex4,
  author  = {Guimard, Philippe and Florin, Agn\`es},
  year    = {2007},
  title   = {Les \'Evaluations des Enseignants en Grande Section de
             Maternelle Sont-Elles Pr\'edictives des Difficult\'es de
             Lecture au Cours Pr\'eparatoire?},
  englishtitle = {Are Teacher Ratings in Kindergarten Predictive of
             Reading Difficulties in First Grade?},
  journal = {Approche Neuropsychologique des Apprentissages chez l'Enfant},
  volume  = {19},
  pages   = {5--17},
}

@article{apa6:ch7-ex5,
  author       = {Von Ledebur, Sidonia C.},
  year         = {2007},
  title        = {Optimizing Knowledge Transfer by New Employees in Companies},
  journal      = {Knowledge Management Research \& Practice},
  howpublished = {Advance online publication},
  doi          = {10.1057/palgrave.kmrp.8500141},
}
%</bibdb>
%    \end{macrocode}
% Here again the page heading of the article itself gives the journal name with
% an ampersand (`\&') and not with ``and''. Note that the APA explicitly
% changes ``von'' to ``Von'' to satisfy U.S. conventions of names. In
% other languages, ``von'' would be retained. See elsewhere in this manual
% for a discussion of how to treat von-parts.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex6} \\
\cite{apa6:ch7-ex6} \\
\fullciteA{apa6:ch7-ex6} \\
\citeA{apa6:ch7-ex6}

\item
\cite{apa6:ch7-ex7} \\
\cite{apa6:ch7-ex7} \\
\fullciteA{apa6:ch7-ex7} \\
\citeA{apa6:ch7-ex7}
%</xmpl>
%<*bibdb>
@article{apa6:ch7-ex6,
  author  = {Briscoe, Robert},
  year    = {\BIP},
  title   = {Egocentric Spatial Representation in Action and Perception},
  journal = {Philosophy and Phenomenological Research},
  url     = {http://cogprints.org/5780/1/ECSRAP.F07.pdf},
}

@magazine{apa6:ch7-ex7,
  author    = {Chamberlin, J. and Novotney, A. and Packard, E.
               and Price, M.},
  year      = {2008},
  month     = may,
  title     = {Enhancing Worker Well-Being: Occupational Health
               Psychologists Convene to Share Their Research on Work,
               Stress, and Health},
  journal   = {Monitor on Psychology},
  volume    = {39},
  number    = {5},
  pages     = {26--29},
}
%</bibdb>
%    \end{macrocode}
% The online version (\url{http://www.apa.org/monitor/2008/05/workstress.aspx})
% does not have a comma in the title before the ``and''.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex8} \\
\cite{apa6:ch7-ex8} \\
\fullciteA{apa6:ch7-ex8} \\
\citeA{apa6:ch7-ex8}
%</xmpl>
%<*bibdb>
@magazine{apa6:ch7-ex8,
  author  = {Clay, Rebecca},
  year    = {2008},
  month   = jun,
  title   = {Science vs.\ Ideology: Psychologists Fight Back Against
             the Misuse of Research},
  journal = {Monitor on Psychology},
  volume  = {39},
  number  = {6},
  url     = {http://www.apa.org/monitor/},
}
%</bibdb>
%    \end{macrocode}
% The APA manual incorrectly says ``about'' instead of ``against''.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex9} \\
\cite{apa6:ch7-ex9} \\
\fullciteA{apa6:ch7-ex9} \\
\citeA{apa6:ch7-ex9}

\item
\cite{apa6:ch7-ex10} \\
\cite{apa6:ch7-ex10} \\
\fullciteA{apa6:ch7-ex10} \\
\citeA{apa6:ch7-ex10}

\item
\cite{apa6:ch7-ex11} \\
\cite{apa6:ch7-ex11} \\
\fullciteA{apa6:ch7-ex11} \\
\citeA{apa6:ch7-ex11}

\item
\cite{apa6:ch7-ex12-1} \\
\cite{apa6:ch7-ex12-1} \\
\fullciteA{apa6:ch7-ex12-1} \\
\citeA{apa6:ch7-ex12-1}\\
\mbox{}\\
\cite{apa6:ch7-ex12-2} \\
\cite{apa6:ch7-ex12-2} \\
\fullciteA{apa6:ch7-ex12-2} \\
\citeA{apa6:ch7-ex12-2}\\
%</xmpl>
%<*bibdb>
@article{apa6:ch7-ex9,
  key     = {{\APACciteatitle{Six Sites Meet}}},
  title   = {Six Sites Meet for Comprehensive Anti-Gang
             Initiative Conference},
  year    = {2006},
  month   = nov # "/" # dec,
  journal = {OJJDP News @ a Glance},
  url     =
    {http://www.ncjrs.gov/html/ojjdp/news_at_glance/216684/topstory.html},
}

@newspaper{apa6:ch7-ex10,
  author  = {Schwartz, John},
  year    = {1993},
  month   = sep,
  day     = {30},
  title   = {Obesity Affects Economic, Social Status},
  journal = {The Washington Post},
  pages   = {A1, A4},
}

@newspaper{apa6:ch7-ex11,
  author  = {Brody, Jane E.},
  year    = {2007},
  month   = dec,
  day     = {11},
  title   = {Mental Reserves Keep Brain Agile},
  journal = {The New York Times},
  url     = {http://www.nytimes.com},
}

@article{apa6:ch7-ex12-1,
  editor  = {Haney, Craig and Wiener, Richard L.},
  year    = {2004},
  title   = {Capital Punishment in the {United} {States}},
  type    = {Special issue},
  journal = {Psychology, Public Policy, and Law},
  volume  = {10},
  number  = {4},
}

@article{apa6:ch7-ex12-2,
  editor  = {Yan, Zheng and Greenfield, Patricia},
  year    = {2006},
  title   = {Children, Adolescents, and the {Internet}},
  type    = {Special section},
  journal = {Developmental Psychology},
  volume  = {42},
  pages   = {391--458},
}
%</bibdb>
%    \end{macrocode}
% The journal lists the editors as Yan and Greenfield (in this order),
% although the first article (editorial introduction/overview) has
% Greenfield and Yan.
%
% The following is an implementation of the second bullet point: a special
% issue with no editors.
%    \begin{macrocode}
%<*xmpl>
\mbox{}\\
\cite{apa6:ch7-ex12-3} \\
\cite{apa6:ch7-ex12-3} \\
\fullciteA{apa6:ch7-ex12-3} \\
\citeA{apa6:ch7-ex12-3}

\item
\cite{apa6:ch7-ex13-1} \\
\cite{apa6:ch7-ex13-1} \\
\fullciteA{apa6:ch7-ex13-1} \\
\citeA{apa6:ch7-ex13-1}\\
%</xmpl>
%<*bibdb>
@article{apa6:ch7-ex12-3,
  key     = {{\APACciteatitle{Capital Punishment}}},
  title   = {Capital Punishment in the {United} {States}},
  year    = {2004},
  type    = {Special issue},
  journal = {Psychology, Public Policy, and Law},
  volume  = {10},
  number  = {4},
}

@article{apa6:ch7-ex13-1,
  author  = {Ganster, Daniel C. and Schaubroeck, John and
             Sime, Wesley E. and Mayes, Bronston T.},
  year    = {1991},
  title   = {The Nomological Validity of the {Type~A} Personality Among
             Employed Adults},
  type    = {Monograph},
  journal = {Journal of Applied Psychology},
  volume  = {76},
  pages   = {143--168},
  doi     = {10.1037/0021-9010.76.1.143},
}
%</bibdb>
%    \end{macrocode}
% The bullet points given here were explicit examples in the 5th edition.
% We have to be liberal with what goes in the \fieldname{number} field
% for these:
%    \begin{macrocode}
%<*xmpl>
\mbox{}\\
\cite{apa6:ch7-ex13-2} \\
\cite{apa6:ch7-ex13-2} \\
\fullciteA{apa6:ch7-ex13-2} \\
\citeA{apa6:ch7-ex13-2}\\
\mbox{}\\
\cite{apa6:ch7-ex13-3} \\
\cite{apa6:ch7-ex13-3} \\
\fullciteA{apa6:ch7-ex13-3} \\
\citeA{apa6:ch7-ex13-3}
%</xmpl>
%<*bibdb>
@article{apa6:ch7-ex13-2,
  author  = {Harris, Paul L. and Kavanaugh, Robert D.},
  year    = {1993},
  title   = {Young Children's Understanding of Pretense},
  journal = {Monographs of the Society for Research in Child Development},
  volume  = {58},
  number  = {1, Serial No.~231},
}

@article{apa6:ch7-ex13-3,
  author  = {Battig, William F. and Montague, William E.},
  year    = {1969},
  title   = {Category Norms for Verbal Items in 56 Categories:
             A Replication and Extension of the {Connecticut}
             Category Norms},
  journal = {Journal of Experimental Psychology Monographs},
  volume  = {80},
  number  = {3, Pt.~2},
}
%</bibdb>
%    \end{macrocode}
% The 5th edition gives the journal as ``Journal of Experimental
% Psychology Monographs'' and its front cover says ``Journal of Experimental
% Psychology Monograph'', but the volume and issue number and online
% categorization (on JSTOR) suggests that this is just a special issue
% of \emph{Journal of Experimental Psychology}, which would argue in
% favor of dropping the ``Monographs''.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex14} \\
\cite{apa6:ch7-ex14} \\
\fullciteA{apa6:ch7-ex14} \\
\citeA{apa6:ch7-ex14}
%</xmpl>
%<*bibdb>
@article{apa6:ch7-ex14,
  key     = {{\APACciteatitle{Editorial}}},
  title   = {Editorial: ``{What} Is a Disaster'' and Why Does This
             Question Matter?},
  year    = {2006},
  type    = {Editorial},
  journal = {Journal of Contingencies and Crisis Management},
  volume  = {14},
  pages   = {1--2},
}
%</bibdb>
%    \end{macrocode}
% The doi is \doi{10.1111/j.1468-5973.2006.00475.x}; normally this would
% be added.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex15} \\
\cite{apa6:ch7-ex15} \\
\fullciteA{apa6:ch7-ex15} \\
\citeA{apa6:ch7-ex15}
%</xmpl>
%<*bibdb>
@article{apa6:ch7-ex15,
  author  = {Marshall-Pescini, Sarah and Whiten, Andrew},
  year    = {2008},
  title   = {Social Learning of Nut-Cracking Behavior in {East} {African}
             Sanctuary-Living Chimpanzees (\emph{Pan troglodytes
             schweinfurthii})},
  type    = {Supplemental material},
  journal = {Journal of Comparative Psychology},
  volume  = {122},
  pages   = {186--194},
  doi     = {10.1037/0735-7036.122.2.186.supp},
}
%</bibdb>
%    \end{macrocode}
% Enclosing ``\verb+Pan troglodytes schweinfurthii+'' in exactly one pair of
% braces (which happen to also be the delimiters for the \cmd{\emph} command)
% ensures that the correct capitalization is output.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex16-1} \\
\cite{apa6:ch7-ex16-1} \\
\fullciteA{apa6:ch7-ex16-1} \\
\citeA{apa6:ch7-ex16-1} \\
\mbox{}\\
\cite{apa6:ch7-ex16-2} \\
\cite{apa6:ch7-ex16-2} \\
\fullciteA{apa6:ch7-ex16-2} \\
\citeA{apa6:ch7-ex16-2}
%</xmpl>
%<*bibdb>
@article{apa6:ch7-ex16-1,
  author  = {Woolf, Nancy J. and Young, Stacey L. and Fanselow, Michael S.
             and Butcher, Larry L.},
  year    = {1991},
  title   = {{MAP-2} Expression in Cholinoceptive Pyramidal Cells of
             Rodent Cortex and Hippocampus is Altered by {Pavlovian}
             Conditioning},
  type    = {Abstract},
  journal = {Society for Neuroscience Abstracts},
  volume  = {17},
  pages   = {480},
}

@article{apa6:ch7-ex16-2,
  author  = {Lassen, Stephen R. and Steele, Michael M. and Sailor, Wayne},
  year    = {2006},
  title   = {The Relationship of School-Wide {Positive} {Behavior}
             {Support} to Academic Achievement in an Urban Middle School},
  journal = {Psychology in the Schools},
  volume  = {43},
  pages   = {701--712},
  url     = {http://www.interscience.wiley.com},
}
%</bibdb>
%    \end{macrocode}
% The doi is \doi{10.1002/pits.20177}; normally this would be added. In
% the title and the abstract, ``Positive Behavior Support'' is capitalized,
% so presumably this is the proper name of an experimental program.
% Therefore I have enclosed it in braces here as well, so that this
% capitalization is preserved.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex17} \\
\cite{apa6:ch7-ex17} \\
\fullciteA{apa6:ch7-ex17} \\
\citeA{apa6:ch7-ex17}
%</xmpl>
%<*bibdb>
@article{apa6:ch7-ex17,
  author  = {Hare, Linda R. and O'Neill, Kevin},
  year    = {2000},
  title   = {Effectiveness and Efficiency in Small Academic Peer Groups:
             A Case Study},
  journal = {Small Group Research},
  volume  = {31},
  pages   = {24--53},
  howpublished = {Abstract retrieved from {Sociological} {Abstracts}
             database},
  note    = {(Accession No.\ 200010185)},
}
%</bibdb>
%    \end{macrocode}
% The construction using the \fieldname{howpublished} and \fieldname{note}
% fields does the job, but is not very elegant.
% The doi (of the whole article) is \doi{10.1177/104649640003100102}, which
% presumably normally would be added. The abstract is also freely available
% on the Sage website (\url{http://sgr.sagepub.com/content/31/1/24} on
% July 10, 2010), which is a lot more accessible than this database.
% Note that the APA manual omits the subtitle. It is remarkable how
% many such small errors there are in the APA manual.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex18} \\
\cite{apa6:ch7-ex18} \\
\fullciteA{apa6:ch7-ex18} \\
\citeA{apa6:ch7-ex18}
%</xmpl>
%<*bibdb>
@book{apa6:ch7-ex18,
  author    = {Shotton, Margaret A.},
  year      = {1989},
  title     = {Computer Addiction? {A} Study of Computer Dependency},
  address   = {London, England},
  publisher = {Taylor \& Francis},
}
%</bibdb>
%    \end{macrocode}
% I am puzzled by ``England''; ``UK'' seems more appropriate to me and that's
% what I'm always using.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex19-1} \\
\cite{apa6:ch7-ex19-1} \\
\fullciteA{apa6:ch7-ex19-1} \\
\citeA{apa6:ch7-ex19-1} \\
\mbox{}\\
\cite{apa6:ch7-ex19-2} \\
\cite{apa6:ch7-ex19-2} \\
\fullciteA{apa6:ch7-ex19-2} \\
\citeA{apa6:ch7-ex19-2}
%</xmpl>
%<*bibdb>
@book{apa6:ch7-ex19-1,
  author    = {Shotton, Margaret A.},
  year      = {1989},
  title     = {Computer Addiction? {A} Study of Computer Dependency},
  type      = {DX Reader version},
  url       = {http://www.ebookstore.tandf.co.uk/html/index.asp},
}

@book{apa6:ch7-ex19-2,
  author    = {Schiraldi, Glenn R.},
  year      = {2000},
  title     = {The Post-Traumatic Stress Disorder Sourcebook:
               A Guide to Healing, Recovery, and Growth},
  type      = {Adobe Digital Editions version},
  doi       = {10.1036/0071393722},
}
%</bibdb>
%    \end{macrocode}
% The website that this doi refers to gives the publication date as 2000,
% so that's what I'm using here. (The APA uses 2001.) This is supposed to
% be a ``free eBook'', but even after installing the Adobe software, the
% link to the actual content gives a ``page not found'' error for me.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex20} \\
\cite{apa6:ch7-ex20} \\
\fullciteA{apa6:ch7-ex20} \\
\citeA{apa6:ch7-ex20}
%</xmpl>
%<*bibdb>
@book{apa6:ch7-ex20,
  author = {O'Keeffe, Elton},
  year   = {\bibnodate},
  title  = {Egoism \& the Crisis in {Western} Values},
  url    = {http://www.onlineoriginals.com/showitem.asp?itemID=135},
}
%</bibdb>
%    \end{macrocode}
% Note the typo in the last name of the author in the APA manual.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex21} \\
\cite{apa6:ch7-ex21} \\
\fullciteA{apa6:ch7-ex21} \\
\citeA{apa6:ch7-ex21}
%</xmpl>
%<*bibdb>
@incollection{apa6:ch7-ex21,
  author       = {Freud, Sigmund},
  year         = {1953},
  title        = {The Method of Interpreting Dreams:
                  An Analysis of a Specimen Dream},
  editor       = {Strachey, James},
  translator   = {Strachey, James},
  booktitle    = {The Standard Edition of the Complete Psychological
                  Works of {Sigmund} {Freud}},
  volume       = {4},
  pages        = {96--121},
  originalyear = {1900},
  url          = {http://books.google.com/books},
}
%</bibdb>
%    \end{macrocode}
% This url did not bring me very far. It took me quite some time and different
% search strings to find the volume referred to. Search for author =
% ``Strachey'', year = 1953, and then select ``The interpretation of dreams,
% first part (1900)''; this leads in my case to
% \url{http://books.google.com/books?id=moN_OQAACAAJ&
%    dq=inauthor:%22James+Strachey%22&hl=en&ei=9E1FTOyVOsHflgems_DrAw&
%    sa=X&oi=book_result&ct=result&resnum=8&ved=0CEcQ6AEwBw}, but there is
% no preview available, and there is no useful information other than the
% title and the author, so exactly what is ``retrieved'' is not clear to
% me. After some internet searching, I did find
% \url{http://www.pep-web.org/static.php?page=standardedition}, which has
% a clickable table of contents, and presumably if you have a registered
% IP address, the actual content. Apparently, my IP address is not registered,
% so I had no access to the actual content.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex22} \\
\cite{apa6:ch7-ex22} \\
\fullciteA{apa6:ch7-ex22} \\
\citeA{apa6:ch7-ex22}
%</xmpl>
%<*bibdb>
@book{apa6:ch7-ex22,
  editor    = {Thomas, Noreen},
  year      = {2002},
  title     = {Perspectives on the Community College: A Journey of Discovery},
  type      = {Monograph},
  url       = {http://eric.ed.gov},
}
%</bibdb>
%    \end{macrocode}
% The ERIC document number is ED\,463\,808.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex23} \\
\cite{apa6:ch7-ex23} \\
\fullciteA{apa6:ch7-ex23} \\
\citeA{apa6:ch7-ex23}
%</xmpl>
%<*bibdb>
@book{apa6:ch7-ex23,
  editor    = {Koch, Sigmund},
  year      = {1959--1963},
  title     = {Psychology: A Study of a Science},
  volume    = {1--6},
  address   = {New York, NY},
  publisher = {McGraw-Hill},
}
%</bibdb>
%    \end{macrocode}
% Note that the correct title has ``a'' before ``science''.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex24} \\
\cite{apa6:ch7-ex24} \\
\fullciteA{apa6:ch7-ex24} \\
\citeA{apa6:ch7-ex24}
%</xmpl>
%<*bibdb>
@incollection{apa6:ch7-ex24,
  author    = {Strong, Edward K., Jr. and Uhrbrock, Richard S.},
  year      = {1923},
  title     = {Bibliography on Job Analysis},
  editor    = {Outhwaite{\bibeditortype{Series Ed.\hbox{}}}, Leonard},
  booktitle = {Personnel {Research} {Series}: Vol.~1. {Job} Analysis and the
               Curriculum},
  pages     = {140--146},
  doi       = {10.1037/10762-000},
}
%</bibdb>
%    \end{macrocode}
% There are several notable things with this reference: (1) The whole book is
% written by the same authors, so I'd think we'd normally list the book title
% in the \fieldname{title} field and in the text refer to the specific chapter
% or pages, rather than single out the chapter in the reference list. (2)
% The doi of the chapter is \doi{10.1037/10762-006}; the doi given here
% is the one for the whole book. (3) It is unclear why we would mention the
% series in which the book appears or the series editor. My impression from
% earlier versions of the \emph{APA manual} is that this is only done if the
% ``series'' is to be considered a joint work (like an encyclopedia) where
% different volumes have different editors and there is a series editor. It is
% my impression that the current work is just a book in a series of books, like
% every publisher has its various series with their series editors. (Note that
% the series title has to be capitalized.) So in summary, I would normally
% format this example as
% \begin{verbatim}
% @book{apa6:ch7-ex24,
%   author    = {Strong, Edward K., Jr. and Uhrbrock, Richard S.},
%   year      = {1923},
%   title     = {Job Analysis and the Curriculum},
%   doi       = {10.1037/10762-000},
% }
% \end{verbatim}
% where I'm using the url for the whole book, because I refer to the whole book.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex25} \\
\cite{apa6:ch7-ex25} \\
\fullciteA{apa6:ch7-ex25} \\
\citeA{apa6:ch7-ex25}
%</xmpl>
%<*bibdb>
@incollection{apa6:ch7-ex25,
  author    = {Haybron, Daniel M.},
  year      = {2008},
  title     = {Philosophy and the Science of Subjective Well-Being},
  editor    = {Eid, Michael and Larsen, Randy J.},
  booktitle = {The Science of Subjective Well-Being},
  pages     = {17--43},
  address   = {New York, NY},
  publisher = {Guilford Press},
}
%</bibdb>
%    \end{macrocode}
% In previous versions of the \emph{APA manual} (e.g., 5th ed., p.~217), the
% states or countries of a list of cities ``well known for publishing'',
% including New York, were not given, but this has been abandoned in the 6th
% ed.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex26} \\
\cite{apa6:ch7-ex26} \\
\fullciteA{apa6:ch7-ex26} \\
\citeA{apa6:ch7-ex26}
%</xmpl>
%<*bibdb>
@incollection{apa6:ch7-ex26,
    author       = {Piaget, Jean},
    year         = {1988},
    title        = {Extracts from {Piaget}'s Theory},
    translator   = {Gellerier, Guy and Langer, Jonas},
    editor       = {Richardson, Ken and Sheldon, Sue},
    booktitle    = {Cognitive Development to Adolescence: A Reader},
    pages        = {3--18},
    address      = {Hillsdale, NJ},
    publisher    = {Erlbaum},
    originalbooktitle = {Manual of Child Psychology},
    originalpages     = {703--732},
    originaleditor    = {Mussen, Paul H.},
    originalyear      = {1970},
    originaladdress   = {New York, NY},
    originalpublisher = {Wiley},
}
%</bibdb>
%    \end{macrocode}
% It looks like the title of the Mussen book should be
% \emph{Carmichael's Manual of Child Psychology} and it's the third edition.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex27} \\
\cite{apa6:ch7-ex27} \\
\fullciteA{apa6:ch7-ex27} \\
\citeA{apa6:ch7-ex27}
%</xmpl>
%<*bibdb>
@book{apa6:ch7-ex27,
  editor    = {VandenBos, Gary R.},
  year      = {2007},
  title     = {{APA} Dictionary of Psychology},
  address   = {Washington, DC},
  publisher = {American Psychological Association},
}
%</bibdb>
%<*xmpl>
\item
\cite{apa6:ch7-ex28} \\
\cite{apa6:ch7-ex28} \\
\fullciteA{apa6:ch7-ex28} \\
\citeA{apa6:ch7-ex28}
%</xmpl>
%<*bibdb>
@book{apa6:ch7-ex28,
author    = {{\bibcorporate{Real Academia Espa\~{n}ola}}},
  year      = {2001},
  title     = {Diccionario de la Lengua Espa\~{n}ola},
  englishtitle = {Dictionary of the {Spanish} Language},
  edition   = {22},
  address   = {Madrid, Spain},
  publisher = {{\bibcorporate{Real Academia Espa\~{n}ola}}},
}
%</bibdb>
%<*xmpl>
\item
\cite{apa6:ch7-ex29} \\
\cite{apa6:ch7-ex29} \\
\fullciteA{apa6:ch7-ex29} \\
\citeA{apa6:ch7-ex29}
%</xmpl>
%<*bibdb>
@incollection{apa6:ch7-ex29,
    author       = {Graham, George},
    year         = {2007},
    title        = {Behaviorism},
    editor       = {Zalta, Edward N.},
	booktitle    =	{The {Stanford} Encyclopedia of Philosophy},
	edition      =	{Fall 2007},
    url          = {http://plato.stanford.edu/entries/behaviorism/},
}
%</bibdb>
%    \end{macrocode}
% At the time of this writing (June 2011), this url contains the Fall 2010
% version. The Fall 2007 version can be found at
% \url{http://plato.stanford.edu/archives/fall2007/entries/behaviorism/}.
% This is what the website itself says about citation:
% \begin{quote}
%     Please note that you are being asked to cite a URL that is in a fixed,
%     archived edition of the encyclopedia. The reason for this is that the
%     Stanford Encyclopedia of Philosophy recommends that readers use a stable
%     citation for scholarly purposes. You should not cite the dynamic portion
%     of the encyclopedia.
% \end{quote}
% Furthermore,
% \begin{quote}
%     There are over 50 \BibTeX{} styles and no standard format that is
%     guaranteed to work for all 50. So, we suggest you use our string as a
%     `useful suggestion' that might need to be adapted for your particular
%     \BibTeX{} file.
% \end{quote}
% \begin{verbatim}
% @InCollection{sep-behaviorism,
%     author       = {Graham, George},
%     title        = {Behaviorism},
%     booktitle    = {The Stanford Encyclopedia of Philosophy},
%     editor       = {Edward N. Zalta},
%     howpublished = {\url{http://plato.stanford.edu/archives/fall2007/entries/behaviorism/}},
%     year         = {2007},
%     edition      = {Fall 2007},
% }
% \end{verbatim}
% which is pretty similar to what I did above. The only big difference is that
% that they put the url in the \fieldname{howpublished} field, which should
% work fine with \pkg{apacite}, except that the APA wants the ``Retrieved from''
% string, which is generated by \pkg{apacite} if you put the url in the
% \fieldname{url} field but not if you put it in the \fieldname{howpublished}
% field, so you'll have to insert it yourself in the \fieldname{howpublished}
% field if you want to use that.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex30} \\
\cite{apa6:ch7-ex30} \\
\fullciteA{apa6:ch7-ex30} \\
\citeA{apa6:ch7-ex30}
%</xmpl>
%<*bibdb>
@incollection{apa6:ch7-ex30,
  title     = {Heuristic},
  booktitle = {Merriam-{Webster}'s Online Dictionary},
  edition   = {11},
  url       = {http://www.m-w.com/dictionary/heuristic},
}
%</bibdb>
%    \end{macrocode}
% One could argue that if the online edition refers to the 11th edition of
% the print version, the year should also be the year of the print version,
% instead of ``n.d.''.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex31} \\
\cite{apa6:ch7-ex31} \\
\fullciteA{apa6:ch7-ex31} \\
\citeA{apa6:ch7-ex31}
%</xmpl>
%<*bibdb>
@techreport{apa6:ch7-ex31,
  author = {{\bibcorporate{U.S. Department of Health and Human
            Services, National Institutes of Health, National Heart,
            Lung, and Blood Institute}}},
  firstkey = {{U.S. Department of Health and Human
            Services, National Institutes of Health, National Heart,
            Lung, and Blood Institute [NHLBI]}},
  key    = {{NHLBI}},
  year   = {2003},
  title  = {Managing Asthma: A Guide for Schools},
  type   = {NIH Publication},
  number = {02-2650},
  url    = {http://www.nhlbi.nih.gov/health/prof/lung/asthma/asth_sch.pdf},
}
%</bibdb>
%    \end{macrocode}
% This is an awfully long author name. In the 5th edition,
% section~3.96, example~1, only ``National Institute of Mental Health''
% was used, without all the higher levels in the hierarchy.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex32} \\
\cite{apa6:ch7-ex32} \\
\fullciteA{apa6:ch7-ex32} \\
\citeA{apa6:ch7-ex32}
%</xmpl>
%<*bibdb>
@techreport{apa6:ch7-ex32,
  author = {{\bibcorporate{American Psychological Association, Task
            Force on the Sexualization of Girls}}},
  firstkey = {{American Psychological Association, Task
            Force on the Sexualization of Girls [APA]}},
  key    = {{APA}},
  year   = {2007},
  title  = {Report of the {APA} {Task} {Force} on the {Sexualization}
            of {Girls}},
  type   = {\bibnotype},
  url    = {http://www.apa.org/pi/wpo/sexualization.html},
}
%</bibdb>
%    \end{macrocode}
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex33} \\
\cite{apa6:ch7-ex33} \\
\fullciteA{apa6:ch7-ex33} \\
\citeA{apa6:ch7-ex33}
%</xmpl>
%<*bibdb>
@techreport{apa6:ch7-ex33,
  author = {Kessy, Severine S. A. and Urio, Fratern M.},
  year   = {2006},
  title  = {The Contribution of Microfinance Institutions to
            Poverty Reduction in {Tanzania}},
  type   = {Research Report\APACredefineOnce{BRetrievedFrom}
            {Retrieved from Research on Poverty Alleviation
             website:\ }},
  number = {06.3},
  url    = {http://www.repoa.or.tz/documents_storage/Publications/Reports/06.3_Kessy_and_Urio.pdf},
}
%</bibdb>
%    \end{macrocode}
% Note the use of \cmd{\APACredefineOnce} from the \pkg{apacdoc}
% package to make a one-time change of the \cmd{\BRetrievedFrom}
% command to accommodate the ``Research on Poverty Alleviation
% website''.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex34} \\
\cite{apa6:ch7-ex34} \\
\fullciteA{apa6:ch7-ex34} \\
\citeA{apa6:ch7-ex34}
%</xmpl>
%<*bibdb>
@techreport{apa6:ch7-ex34,
  author = {McDaniel, Julie E. and Miskel, Cecil G.},
  year   = {2002},
  title  = {The Effect of Groups and Individuals on National
            Decisionmaking: Influence and Domination in the
            Reading Policymaking Environment},
  type   = {CIERA Report\APACredefineOnce{BRetrievedFrom}
            {Retrieved from University of Michigan, Center for
             Improvement of Early Reading Achievement website:\ }},
  number = {3-025},
  url    = {http://www.ciera.org/library/reports/inquiry-3/3-025/3-025.pdf},
}
%</bibdb>
%    \end{macrocode}
% The APA manual does not have a ``No.'' after ``CIERA Report'',
% which seems like an error in the manual to me.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex35} \\
\cite{apa6:ch7-ex35} \\
\fullciteA{apa6:ch7-ex35} \\
\citeA{apa6:ch7-ex35}
%</xmpl>
%<*bibdb>
@techreport{apa6:ch7-ex35,
  author      = {{\bibcorporate{Employee Benefit Research Institute}}},
  firstkey    = {{Employee Benefit Research Institute [EBRI]}},
  key         = {{EBRI}},
  year        = {1992},
  month       = feb,
  title       = {Sources of Health Insurance and Characteristics of the
                 Uninsured, Analysis of the {March} 1991 {Current}
                 {Population} {Survey}},
  type        = {Issue Brief},
  number      = {123},
  address     = {Washington, DC},
  institution = {{\bibcorporate{Employee Benefit Research Institute}}},
}
%</bibdb>
%    \end{macrocode}
% The APA manual does not include a url, perhaps for the sake of
% an example that shows address and publisher, but I was able to
% retrieve it from \url{http://www.ebri.org/publications/ib/}
% Also, the APA manual does not list the full title.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex36} \\
\cite{apa6:ch7-ex36} \\
\fullciteA{apa6:ch7-ex36} \\
\citeA{apa6:ch7-ex36}
%</xmpl>
%<*bibdb>
@lecture{apa6:ch7-ex36,
  author       = {Muellbauer, John},
  year         = {2007},
  month        = sep,
  title        = {Housing, Credit and Consumer Expenditure},
  chair        = {Ludvigson, Sydney C.},
  symposium    = {Housing and Consumer Behavior},
  howpublished = {Symposium conducted at the meeting of the {Federal}
                  {Reserve} {Bank} of {Kansas} {City}},
  address      = {Jackson Hole, WY},
}
%</bibdb>
%    \end{macrocode}
% There are several things not right about this entry. A minor point is
% that the title does not have a comma after ``Credit''. More
% importantly, the entry seems to misrepresent the symposium. On the
% website
% \url{http://www.kc.frb.org/publications/research/escp/escp-2007.cfm},
% the symposium is listed as ``Housing, Housing Finance, \& Monetary
% Policy, a symposium sponsored by the Federal Reserve Bank of Kansas
% City''. So the title of the symposium is different and it is not a
% ``meeting of'' but a ``symposium sponsored by''. ``Housing and
% Consumer Behavior'' is the title of the session, in which
% Muellbauer's paper is the only paper, so it appears this was simply
% a provisional title of the paper. Ludvigson is the discussant, which
% is not generally the same as the chair, and in fact Martin Feldstein
% is listed as the chair of the general discussion, who also gives the
% ``Overview and concluding remarks'' at the end of the symposium. The
% Kansas City Fed's website posts two versions of the paper (neither of
% which is listed in the APA manual): one downloadable from the website
% mentioned above, which is nicely typeset and starts at page 267, and
% thus looks like an edited published version, and one at
% \url{http://www.kc.frb.org/publicat/sympos/2007/pdf/2007.09.17.muellbauer.pdf},
% which looks like the accepted version from the author. The former
% lists the middle initial ``N.'' of the author, whereas the latter
% does not. Normally, one would cite the published version, but for the
% sake of this example, we cite the paper presented. Nevertheless, the
% description in the APA manual seems grossly inaccurate.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex37} \\
\cite{apa6:ch7-ex37} \\
\fullciteA{apa6:ch7-ex37} \\
\citeA{apa6:ch7-ex37}
%</xmpl>
%<*bibdb>
@lecture{apa6:ch7-ex37,
  author       = {Liu, Shuhua},
  year         = {2005},
  month        = may,
  title        = {Defending Against Business Crises with the Help of
                  Intelligent Agent Based Early Warning Solutions},
  howpublished = {Paper presented at the Seventh International
                  Conference on Enterprise Information Systems},
  address      = {Miami, FL\APACredefineOnce{BRetrievedFrom}{Abstract
                  retrieved from\ }},
  url          = {http://www.iceis.org/iceis2005/abstracts_2005.htm},
}
%</bibdb>
%    \end{macrocode}
% The website itself uses ``7th'' instead of ``Seventh''.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex38} \\
\cite{apa6:ch7-ex38} \\
\fullciteA{apa6:ch7-ex38} \\
\citeA{apa6:ch7-ex38}
%</xmpl>
%<*bibdb>
@article{apa6:ch7-ex38,
  author    = {Herculano-Houzel, Suzana and Collins, Christine E.
               and Wong, Peiyan and Kaas, Jon H. and Lent, Roberto},
  year      = {2008},
  title     = {The Basic Nonuniformity of the Cerebral Cortex},
  journal   = {Proceedings of the National Academy of Sciences, USA},
  volume    = {105},
  pages     = {12593--12598},
  doi       = {10.1073/pnas.0805417105},
}
%</bibdb>
%    \end{macrocode}
% Despite the name ``Proceedings'', this is an ordinary journal and
% thus there is nothing special about this reference. It is
% noteworthy, though, that in the first printing of the 6th edition
% of the APA manual, ``, USA,'' was missing, and this addition is
% listed as a correction in the errata on the APA website. Still this
% is an interesting case where the APA departs from its policy of not
% abbreviating journal titles: PNAS's website lists the name of the
% journal as ``Proceedings of the National Academy of Sciences of the
% United States of America'', and abbreviates it to PNAS.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex39} \\
\cite{apa6:ch7-ex39} \\
\fullciteA{apa6:ch7-ex39} \\
\citeA{apa6:ch7-ex39}
%</xmpl>
%<*bibdb>
@incollection{apa6:ch7-ex39,
  author    = {Katz, Itai and Gabayan, Kevin and Aghajan, Hamid},
  year      = {2007},
  title     = {A Multi-touch Surface Using Multiple Cameras},
  editor    = {Blanc-Talon, Jacques and Philips, Wilfried
               and Popescu, Dan and Scheunders, Paul},
  booktitle = {{Lecture} {Notes} in {Computer} {Science}: Vol.~4678.
               {Advanced} Concepts for Intelligent Vision Systems},
  pages     = {97--108},
  doi       = {10.1007/978-3-540-74607-2_9},
}
%</bibdb>
%    \end{macrocode}
% For references with a doi or url, the general rule in the 6th edition
% is to omit the publisher and its address, so this is what I did, and
% the example in the APA manual seems incorrect. Also, the
% capitalization of the book title seems incorrect (cf.\ example~24).
% From previous versions of the APA manual, I got the impression that
% ``series'' in APA speak was the title of a coherent multivolume work
% with possibly different volume editors, and not the name of a book
% series with unrelated works. Because the \fieldname{series} field in
% \BibTeX{} is intended for the latter, which would not normally be
% included in a reference in psychology, \pkg{apacite} has ignored it
% thus far. This example, however, falls in the latter category, and
% thus I may need to reconsider how \pkg{apacite} deals with this,
% especially because it seems more natural then to split what is now
% in the \fieldname{booktitle} field into \fieldname{series},
% \fieldname{volume}, and \fieldname{booktitle}. Note that the example
% does not mention the series editors, unlike series examples in
% previous editions of the APA manual.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex40} \\
\cite{apa6:ch7-ex40} \\
\fullciteA{apa6:ch7-ex40} \\
\citeA{apa6:ch7-ex40} \\
%</xmpl>
%<*bibdb>
@mastersthesis{apa6:ch7-ex40,
  author       = {McNiel, Donita S.},
  year         = {2006},
  title        = {Meaning Through Narrative: A Personal Narrative
                  Discussing Growing Up with an Alcoholic Mother},
  howpublished = {Available from ProQuest Dissertations and Theses
                  database},
  note         = {UMI No.\ 1434728},
}
%</bibdb>
%    \end{macrocode}
% The APA manual gives rules for unpublished theses, but provides no
% explicit examples. So let's reuse two examples from the 5th edition
% here. Note, however, that I obtained this information and the
% abstracts, though not the full text, from ProQuest, and it says that
% these are abstracted in \emph{DAI} (Series~B, Vol.~50, No.~11,
% p.~5303, 1990) and \emph{MAI} (Vol.~30, No.~3, p.~906, 1992),
% respectively. This also lists the title of the first one and the year
% of the second one differently from the 5th edition of the APA manual.
% I used the ProQuest information.
%    \begin{macrocode}
%<*xmpl>
\mbox{}\\
\cite{apa6:ch7-ex40-2} \\
\cite{apa6:ch7-ex40-2} \\
\fullciteA{apa6:ch7-ex40-2} \\
\citeA{apa6:ch7-ex40-2} \\
\mbox{}\\
\cite{apa6:ch7-ex40-3} \\
\cite{apa6:ch7-ex40-3} \\
\fullciteA{apa6:ch7-ex40-3} \\
\citeA{apa6:ch7-ex40-3}
%</xmpl>
%<*bibdb>
@phdthesis{apa6:ch7-ex40-2,
  author  = {Wilfley, Denise E.},
  year    = {1989},
  title   = {An Analysis of Psychological Distress, Self-concept,
             and Patterns of Family Interactions in Two Subgroups
             of Bulimia--Normal Weight and Obese},
  school  = {University of Missouri},
  address = {Columbia},
}
@mastersthesis{apa6:ch7-ex40-3,
  author  = {Almeida, David M.},
  year    = {1989},
  title   = {Fathers' Participation in Family Work: Consequences
             for Fathers' Stress and Father-Child Relations},
  school  = {University of Victoria},
  address = {Victoria, British Columbia, Canada},
}
%</bibdb>
%<*xmpl>
\item
\cite{apa6:ch7-ex41} \\
\cite{apa6:ch7-ex41} \\
\fullciteA{apa6:ch7-ex41} \\
\citeA{apa6:ch7-ex41}
%</xmpl>
%<*bibdb>
@phdthesis{apa6:ch7-ex41,
  author = {Adams, Ronald Jerry},
  year   = {1973},
  title  = {Building a Foundation for Evaluation of Instruction in
            Higher Education and Continuing Education},
  url    = {http://www.ohiolink.edu/etd/},
}
%</bibdb>
%    \end{macrocode}
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex42} \\
\cite{apa6:ch7-ex42} \\
\fullciteA{apa6:ch7-ex42} \\
\citeA{apa6:ch7-ex42}
%</xmpl>
%<*bibdb>
@phdthesis{apa6:ch7-ex42,
  author = {Bruckman, Amy},
  year   = {1997},
  title  = {{MOOSE} Crossing: Construction, Community, and
            Learning in a Networked Virtual World for Kids},
  school = {Massachusetts Institute of Technology},
  url    = {http://www-static.cc.gatech.edu/~asb/thesis/},
}
%</bibdb>
%    \end{macrocode}
% On the thesis, the author's given names are listed as ``Amy Susan'',
% but the APA manual only lists the first initial and the author cites
% only her first given name in her reference list as well. The format
% with MIT listed in parentheses fits neither rule on p.~207 of the
% APA manual. Presumably, this was done because of a combination of
% factors: thesis obtained from the web, but not a stable database,
% and from the author's website at her current affiliation, not the
% university where the degree was obtained.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex43} \\
\cite{apa6:ch7-ex43} \\
\fullciteA{apa6:ch7-ex43} \\
\citeA{apa6:ch7-ex43}
%</xmpl>
%<*bibdb>
@phdthesis{apa6:ch7-ex43,
  author       = {Appelbaum, Lawrence G.},
  year         = {2005},
  title        = {Three Studies of Human Information Processing:
                  Texture Amplification, Motion Representation, and
                  Figure-Ground Segregation},
  journal      = {Dissertation Abstracts International: Section B.
                  Sciences and Engineering},
  volume       = {65},
  number       = {10},
  pages        = {5428},
}
%</bibdb>
%    \end{macrocode}
% Unlike previous versions of the APA manual, where DAI abstracts had a
% parenthetical part like ``(Doctoral dissertation, University of
% California, Irvine, 2004)'', this is now formatted purely as a
% journal article, so I could have simply used the \entryname{@article}
% entry type. The \fieldname{school} and in particular
% \fieldname{originalyear} fields should now be omitted.
%    \begin{macrocode}
%<*xmpl>
\item
\cite{apa6:ch7-ex44} \\
\cite{apa6:ch7-ex44} \\
\fullciteA{apa6:ch7-ex44} \\
\citeA{apa6:ch7-ex44}
%</xmpl>
%<*bibdb>
@phdthesis{apa6:ch7-ex44,
  author  = {Carlbom, Pelle},
  year    = {2000},
  title   = {Carbody and Passengers in Rail Vehicle Dynamics},
  type    = {Doctoral thesis},
  school  = {Royal Institute of Technology},
  address = {Stockholm, Sweden},
  url     = {http://urn.kb.se/resolve?urn=urn:nbn:se:kth:diva-3029},
}
%</bibdb>
%    \end{macrocode}
% This follows the same pattern as example~42. ``Doctoral thesis'' is
% presumably an error; it should be ``Doctoral dissertation''.
%    \begin{macrocode}
%<*xmpl>
\end{enumerate}
\bibliographystyle{apacite}
\bibliography{apa5ex}
\end{document}
%</xmpl>
%    \end{macrocode}
%
%  \subsection{Additional references}
%
%    \begin{macrocode}
%<*bibdb>
@book{APAManual3,
  author    = {{\bibcorporate{American Psychological Association}}},
  firstkey  = {{American Psychological Association [APA]}},
  key       = {{APA}},
  year      = {1984},
  title     = {Publication Manual of the {American} {Psychological}
               {Association}},
  edition   = {3},
  address   = {Washington, DC},
  publisher = {{\bibcorporate{American Psychological Association}}},
  note      = {with revisions},
}

@book{APAManual5,
  author    = {{\bibcorporate{American Psychological Association}}},
  firstkey  = {{American Psychological Association [APA]}},
  key       = {{APA}},
  year      = {2001},
  title     = {Publication Manual of the {American} {Psychological}
               {Association}},
  edition   = {5},
  address   = {Washington, DC},
  publisher = {{\bibcorporate{American Psychological Association}}},
}

@book{APAManual6,
  author    = {{\bibcorporate{American Psychological Association}}},
  firstkey  = {{American Psychological Association [APA]}},
  key       = {{APA}},
  year      = {2009},
  title     = {Publication Manual of the {American} {Psychological}
               {Association}},
  edition   = {6},
  address   = {Washington, DC},
  publisher = {{\bibcorporate{American Psychological Association}}},
}

@book{chicago,
  title     = {The {Chicago} Manual of Style},
  edition   = {15},
  year      = {2003},
  address   = {Chicago},
  publisher = {The University of Chicago Press},
}

@misc{Pata88,
  author    = {Patashnik, Oren},
  year      = {1988},
  title     = {{\BibTeX ing}},
  url       = {http://www.ctan.org/tex-archive/biblio/
               bibtex/distribs/doc/btxdoc.tex},
  lastchecked = {October 4, 2008},
}

@book{LaTeXbook,
  author    = {Lamport, Leslie},
  year      = {1994},
  title     = {{\APACSortNoop{LaTeX}}{\LaTeX}: A Document Preparation System.
               {User}'s Guide and Reference Manual},
  edition   = {2},
  address   = {Reading, MA},
  publisher = {Addison-Wesley},
}

@book{KoDa04,
  author    = {Kopka, Helmut and Daly, Patrick W.},
  year      = {2004},
  title     = {Guide To {\APACSortNoop{LaTeX}}{\LaTeX}},
  edition   = {4},
  address   = {Boston, MA},
  publisher = {Addison-Wesley},
}

@book{TLC2,
  author    = {Mittelbach, Frank and Goossens, Michel},
  year      = {2004},
  title     = {The {\APACSortNoop{LaTeX}}{\LaTeX} Companion},
  edition   = {2},
  address   = {Boston, MA},
  publisher = {Addison-Wesley},
}

@book{dLMe08a,
  editor     = {De Leeuw, Jan and Meijer, Erik},
  year       = {2008},
  title      = {Handbook of Multilevel Analysis},
  address    = {New York, NY},
  publisher  = {Springer},
}

@book{meijer1998,
  author    = {Meijer, Erik},
  year      = {1998},
  title     = {Structural Equation Models for Nonnormal Data},
  address   = {Leiden, Netherlands},
  publisher = {DSWO Press},
}

@article{meijer07,
  author     = {Meijer, Erik},
  year       = {2007},
  title      = {Citations, Reference List, and Author Index with
                \textsf{apacite}},
  journal    = {Eutypon},
  volume     = {16--19},
  pages      = {1--31},
  url        = {http://www.eutypon.gr/eutypon/e-cont-16-19.html},
}

@book{WaMe00,
  author    = {Wansbeek, Tom and Meijer, Erik},
  year      = {2000},
  title     = {Measurement Error and Latent Variables in Econometrics},
  address   = {Amsterdam, Netherlands},
  publisher = {North-Holland},
}

@unpublished{APA-3rd-ed-ex53,
  author       = {Gottfredson, G. D.},
  year         = {1978},
  title        = {Why Don't Vocational Interests Predict Job
                  Satisfaction Better Than They Do?},
  howpublished = {Unpublished manuscript},
  organization = {Johns Hopkins University, Center for Social
                  Organization of Schools},
  address      = {Baltimore},
}

@misc{DePsych01,
  key          = {{\APACciteatitle{Uitgebreide Richtlijnen}}},
  title        = {Uitgebreide Richtlijnen voor het Aanleveren van Kopij},
  englishtitle = {Detailed Guidelines for the Submission of Manuscripts},
  year         = {2001},
  lastchecked  = {January~3, 2005},
  url = {http://upload.lectric.nl/data/nip7/Richtlijnen%20voor%20auteurs.pdf},
}

@article{NTPG04,
  title        = {Aanwijzingen voor Auteurs},
  englishtitle = {Instructions for Authors},
  year         = {2004},
  journal      = {Nederlands Tijdschrift voor de Psychologie en haar
                  Grensgebieden},
  volume       = {59},
  pages        = {inside back cover},
}

@book{Renk02,
  author       = {Renkema, J.},
  year         = {2002},
  title        = {Schrijfwijzer},
  englishtitle = {Writing Indicator},
  edition      = {4},
  address      = {Den Haag, The Netherlands},
  publisher    = {Sdu},
}

@article{Schr04,
  author       = {Schrooten, M. G. S. and Smulders, F. T. Y.},
  year         = {2004},
  title        = {Een Experimentele Kijk op Angst: Aandacht en Automatisme
                  in de Verwerking van Bedreigende Stimuli},
  englishtitle = {Anxiety from an Experimental Point of View: Attention and
                  Automaticity in the Processing of Threatening Stimuli},
  journal      = {Nederlands Tijdschrift voor de Psychologie en haar
                  Grensgebieden},
  volume       = {59},
  pages        = {135--149},
}

@book{VanDale89,
  key          = {{\APACcitebtitle{van Dale}}},
  title        = {van {Dale} Groot Woordenboek {Engels}-{Nederlands}},
  englishtitle = {van {Dale}'s Large Dictionary {English}-{Dutch}},
  edition      = {2},
  year         = {1989},
  address      = {Utrecht, The Netherlands},
  publisher    = {Van Dale},
}

@book{KLO05,
  author       = {Haapam\"aki, Tuula and Hedman, Arne
                  and H\"am\"al\"ainen, Esa and Kurvinen, Birgitta
                  and Lager, Lassi and Lindegren, Yrj\"o
                  and Murtomaa, Eeva and Vainikka, Eila},
  year         = {2005},
  title        = {Monografioiden kuvailu},
  englishtitle = {Description for Monographic Publications},
  address      = {Helsinki, Finland},
  publisher    = {Helsingin yliopiston kirjasto},
  url          = {http://www.kansalliskirjasto.fi/kirjastoala/
                  luettelointisaannot/Files/liitetiedosto2/
                  monografioiden_kuvailu.pdf},
  lastchecked  = {January 19, 2009},
}

@book{DGPs07,
  firstkey  = {Deutsche Gesellschaft f\"ur Psychologie [DGPs]},
  key       = {DGPs},
  author    = {\bibcorporate{Deutsche Gesellschaft f\"ur Psychologie}},
  year      = {2007},
  title     = {Richtlinien zur {Manuskriptgestaltung}},
  englishtitle = {Guidelines for Manuscript Preparation},
  edition   = {3},
  address   = {G\"ottingen, Germany},
  publisher = {Hogrefe-Verlag},
}

@misc{UIB08,
  author       = {{\bibcorporate{University of Bergen}}},
  year         = {2008},
  title        = {American {Psychological} {Association} ({APA})},
  url          = {http://www.sokogskriv.no/norsk/basis/sitering-etikk/APA.pdf},
  lastchecked  = {October 12, 2008},
  address      = {Bergen, Norway},
  publisher    = {University of Bergen, University Library},
}
%% Referenced from
%% \url{http://www.sokogskriv.no/norsk/basis/sitering-etikk/4-stiler.html}
%%
%% Original version:
%% \url{http://www.ub.uib.no/felles/IK/APA.pdf}
%% but this page does not exist anymore on 2008/10/12.
%%
%% Norwegian name:
%% Universitetsbiblioteket, Universitetet I Bergen, 2008

@misc{UiO06,
  author       = {{\bibcorporate{University of Oslo}}},
  year         = {2006},
  title        = {Normer for skriftlig arbeid},
  englishtitle = {Standards for Written Works},
  url          = {http://www.uio.no/studier/emner/medisin/isv/SYKVIT4400/v07/
                  REV_normer_skriftl_arb.pdf},
  lastchecked  = {October 12, 2008},
  address      = {Oslo, Norway},
  publisher    = {University of Oslo, Institute of Nursing and Health Sciences},
}
%% Referenced from
%% \url{http://www.uio.no/studier/emner/medisin/isv/SYKVIT4400/v07/}
%%
%% Norwegian name:
%% Universitetet i Oslo, Sykepleievitenskap, 28.06.06


@misc{Erik01,
  author      = {Erikson, Martin G.},
  year        = {2001},
  title       = {Att Skriva Litteraturreferenser Enligt {Harvard}-Systemet},
  englishtitle = {Citations According to the {Harvard} System},
  url         = {http://www.his.se/upload/10631/referenser.pdf},
  lastchecked = {October 18, 2008},
  Eriksremark = {Originally downloaded December 9, 2004, from
    \url{http://www.ida.his.se/ida/kurser/exjobb/kursmaterial/referenser.pdf},
    but this site does not exist anymore.},
}

@misc{Johnsson,
  author      = {Johnsson, Mattias},
  title       = {Lathund for Referensskrivning},
  englishtitle = {Cheat Sheet for Formatting of References},
  url         = {http://www.ped.gu.se/users/berner/htmarkiv/referens.html},
  lastchecked = {October 18, 2008},
  Eriksremark = {Originally downloaded December 9, 2004},
}

@misc{GU94,
  title  = {Referensskrivning},
  englishtitle = {Formatting of References},
  year   = {1994},
  url    = {http://www.ped.gu.se/forskarutbildning/Referens_skrivning.htm},
  lastchecked = {October 18, 2008},
  Eriksremark = {Originally downloaded December 9, 2004.
                 Site is Gothenburg University Web site, but reference seems
                 specific enough. Authors may be (?)
                 Informatorn/Dahlgren/Ottosson, but I don't know first
                 names.},
}

%%
%</bibdb>
%    \end{macrocode}
%
% \section{\BibTeX\ style (\fname{apacite.bst} and its siblings)}
% The program in \BibTeX's language that formats the reference list.
% Currently, this supplies four files: \fname{apacite.bst}, \fname{apacitex.bst}
% \fname{apacann.bst}, and \fname{apacannx.bst}.
% These files are almost identical, but \fname{apacitex.bst} and
% \fname{apacannx.bst} generate information that can be used to generate an
% author index, and \fname{apacann.bst} and \fname{apacannx.bst} use annotation
% when available for annotated bibliographies.
%
% We start with file headers and a function that prints the version number in
% the \fname{.blg} file.
%    \begin{macrocode}
%<*!annotated>
%<bibstyle>%% apacite.bst : reference list according to APA manual
%<xbibstyle>%% apacitex.bst : reference list according to APA manual
%<xbibstyle>%%                with author indexing information
%</!annotated>
%<*annotated>
%<bibstyle>%% apacann.bst : reference list according to APA manual
%<bibstyle>%%               with annotations
%<xbibstyle>%% apacannx.bst : reference list according to APA manual
%<xbibstyle>%%                with annotations and author indexing information
%</annotated>
%<*bibstyle|xbibstyle>
%% Written by Erik Meijer

FUNCTION {identify.apacite.version}
{ % Put identifying string in the .blg file
%</bibstyle|xbibstyle>
%<*!annotated>
%<bibstyle>  "apacite.bst"
%<xbibstyle>  "apacitex.bst"
%<bibstyle>  " [2013/07/21 v6.03 APA bibliography style]"
%<xbibstyle> " [2013/07/21 v6.03 APA bibl. style with author index info]"
%</!annotated>
%<*annotated>
%<bibstyle>  "apacann.bst"
%<xbibstyle>  "apacannx.bst"
%<bibstyle>  " [2013/07/21 v6.03 APA annotated bibliography style]"
%<*xbibstyle>
" [2013/07/21 v6.03 APA annotated bibl. style with author index info]"
%</xbibstyle>
%</annotated>
%<*bibstyle|xbibstyle>
  * top$
}
%    \end{macrocode}
% Declaration of fields, integers, and strings for each entry.
%    \begin{macrocode}
ENTRY
  { address
    annote
    annotate
    author
    booktitle
    chair
    chapter
    day
    doi
    edition
    editor
    englishtitle
    firstkey
    howpublished
    institution
    journal
    key
    lastchecked
    month
    nihms
    note
    number
    organization
    originaladdress
    originalbooktitle
    originaledition
    originaleditor
    originaljournal
    originalnumber
    originalpages
    originalpublisher
    originalvolume
    originalyear
    pages
    pmcid
    publisher
    school
    series
    symposium
    text
    title
    translator
    type
    url
    urldate
    volume
    year
  }
  { cite.order             %% order of first citation
    title.number           %% for sorting titles
    cite.initials          %% dummy (0-1) indicating whether or not
                           %% initials of the 1st author must
                           %% be used for citing
    cite.num.names.full    %% number of names to be cited for full and
    cite.num.names.short   %% short cite
    add.to.year            %% For a, b, c, etc. after year
                           %% in multiple citations with same author-year
  }
  { year.label             %% For sorting entries by year
    author.year.sort.label %% For sorting entries and checking whether
                           %% initials should be added, how many authors
                           %% should be cited and whether a, b, etc.
                           %% after year is necessary
    title.sort.label       %% for sorting titles
    citeorder.sort.label   %% for sorting by citation order
    type.2                 %% Replacement for type with misc entries and
                           %% entries that revert to misc.
  }
%    \end{macrocode}
% Declaration of global integers and strings.
%    \begin{macrocode}
INTEGERS { len  pos  name.max  old.number  numnames  numnames.old
           nameptr  lastname  format.num.names  cite.initials.old
           cite.num.names.old add.to.year.old  forward
           multiresult  dot brace.level
         }

STRINGS  { s  t  u old.label  field
           aut1f  aut1s  aut1f.old  aut1s.old
           aut2          aut2.old
           aut3          aut3.old
           aut4          aut4.old
           aut5          aut5.old
           aut6          aut6.old
           year.label.old
         }
%    \end{macrocode}
% Two functions that can be used for testing purposes.
%    \begin{macrocode}
FUNCTION {test} { #0 }
FUNCTION {dump.stack}
{ "---- STACK {" cite$ * "} ----" * top$
  stack$
  "---- END STACK {" cite$ * "} ----" * top$
}
%    \end{macrocode}
% A small function that indicates whether index entries must be generated.
% This is the only line that is different between \fname{apacite.bst} and
% \fname{apacitex.bst} (and between \fname{apacann.bst} and
% \fname{apacannx.bst}).
%    \begin{macrocode}
%</bibstyle|xbibstyle>
%<bibstyle>FUNCTION {make.index} { #0 }
%<xbibstyle>FUNCTION {make.index} { #1 }
%<*bibstyle|xbibstyle>
%    \end{macrocode}
% A small function that indicates whether the reference list must be
% sorted.
%    \begin{macrocode}
FUNCTION {unsorted} { #0 }
%    \end{macrocode}
% Month macros. We use numbers, along with a \LaTeX{} function, which
% translates them into words. This allows language-specific deviations.
%    \begin{macrocode}
MACRO {jan}    {"{\APACmonth{01}}"}
MACRO {feb}    {"{\APACmonth{02}}"}
MACRO {mar}    {"{\APACmonth{03}}"}
MACRO {apr}    {"{\APACmonth{04}}"}
MACRO {may}    {"{\APACmonth{05}}"}
MACRO {jun}    {"{\APACmonth{06}}"}
MACRO {jul}    {"{\APACmonth{07}}"}
MACRO {aug}    {"{\APACmonth{08}}"}
MACRO {sep}    {"{\APACmonth{09}}"}
MACRO {oct}    {"{\APACmonth{10}}"}
MACRO {nov}    {"{\APACmonth{11}}"}
MACRO {dec}    {"{\APACmonth{12}}"}
MACRO {winter} {"{\APACmonth{13}}"}
MACRO {spring} {"{\APACmonth{14}}"}
MACRO {summer} {"{\APACmonth{15}}"}
MACRO {fall}   {"{\APACmonth{16}}"}
%    \end{macrocode}
% Logical ``not'': If the top element on the stack is $A$ then this function
% does the following:
% \begin{verbatim}
%     push { #0 }
%     push { #1 }
% \end{verbatim}
% So now the first three elements of the stack are
%   \verb+{ #1 }+ \verb+{ #0 }+ $A$.
% These are popped and subjected to ``if'':
% If $A > 0$ then \verb+{ #0 }+ is executed, else \verb+{ #1 }+ is executed:
% \begin{verbatim}
%     if A > 0
%     then 0
%     else 1
% \end{verbatim}
% So consider integers as logicals, where 1 = true and 0 = false,
% then this does
% \begin{verbatim}
%     (if A then false else true)
% \end{verbatim}
% which is a logical ``not''.
%    \begin{macrocode}
FUNCTION {not}
{   { #0 }
    { #1 }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Logical 'and':
% If the first 2 elements on the stack are A B
% then this function does the following:
%     push 'skip$
%     push { pop$ #0 }
% So now first 4 elements are
%     { pop$ #0 } 'skip$ A B
% The first 3 are popped and subjected to 'if' (B is on top of
% the stack):
% If A > 0 then 'skip$ is executed, else { pop$ #0 } is executed:
%     if A > 0
%     then (B stays on top of stack)
%     else (B is popped and #0 is pushed)
% So consider integers as logicals, where 1 = true and 0 = false,
% then this does
%     (if A then B else false)
% which is a logical 'and'.

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Logical 'or':
% If the first 2 elements on the stack are A B
% then this function does the following:
%     push { pop$ #1 }
%     push 'skip$
% So now first 4 elements are
%     'skip$ { pop$ #1 } A B
% The first 3 are popped and subjected to 'if' (B is on top of
% the stack):
% If A > 0 then { pop$ #1 } is executed, else 'skip$ is executed:
%     if A > 0
%     then (B is popped and #1 is pushed)
%     else (B stays on top of stack)
% So consider integers as logicals, where 1 = true and 0 = false,
% then this does
%     (if A then true else B)
% which is a logical 'or'.

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


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  GENERAL PURPOSE FUNCTIONS FOR FORMATTING                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % issues warning if field is empty
    % call with
    %    "field"  field  warning.if.empty
    % Note that the first field must be between quotes
    % because it is the fieldname for use in the warning message.
    %
FUNCTION {warning.if.empty}
{ empty$
    { "No "  swap$ * " in " * cite$ * warning$ }
    { pop$ }
  if$
}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % issues warning if title, type, and howpublished are empty
    %
FUNCTION {check.relevant.fields}
{ title        empty$
  type         empty$ and
  howpublished empty$ and
    { "No title, type, and howpublished in " cite$ * warning$ }
    'skip$
  if$
}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % delivers 1 if (both editor and translator
    %                not empty and not equal to each other)
    %          0 if (editor or translator empty) or
    %               (editor = translator)
    %
FUNCTION {editor.ne.trans}
{ translator empty$
    { #0 }
    { editor empty$
        { #0 }
        { translator editor =
            { #0 }
            { #1 }
          if$
        }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Convert integer to string, assume that integer < 100,000

FUNCTION {conv.int.to.str}
{ duplicate$ #10 <
    { "0000" swap$ int.to.str$ * }
    { duplicate$ #100 <
        { "000" swap$ int.to.str$ * }
        { duplicate$ #1000 <
            { "00" swap$ int.to.str$ * }
            { duplicate$ #10000 <
                { "0" swap$ int.to.str$ * }
                { int.to.str$ }
              if$
            }
          if$
        }
      if$
    }
  if$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Delivers 1 if possibly editor in author position
%          2 if editor not in author position
%          3 if not applicable: use key
%          0 if unknown type

FUNCTION {ref.type}
{ type$ "article"      =
    type$ "magazine"     =
      type$ "newspaper"    =
        type$ "book"         =
          type$ "techreport"   =
            type$ "unpublished"  =
              type$ "misc"         =
                type$ "booklet"      =
                  type$ "manual"       =
                    type$ "proceedings"  =
                    or
                  or
                or
              or
            or
          or
        or
      or
    or
    { #1 }
    { type$ "incollection"   =
        type$ "phdthesis"      =
          type$ "mastersthesis"  =
            type$ "lecture"        =
              type$ "inbook"         =
                type$ "inproceedings"  =
                  type$ "conference"  =
                    type$ "intechreport"   =
                    or
                  or
                or
              or
            or
          or
        or
        { #2 }
        { type$ "literal" =
            { #3 }
            { #0 }
          if$
        }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Delivers 1 if title is formatted as an "article"-type,
%          0 otherwise

FUNCTION {is.atype}
{ type$ "article"        =
    type$ "magazine"       =
      type$ "newspaper"      =
        type$ "incollection"   =
          type$ "inbook"         =
            type$ "inproceedings"  =
              type$ "conference"  =
                type$ "intechreport"   =
                  type$ "manual"         =
                  or
                or
              or
            or
          or
        or
      or
    or
    { #1 }
    { journal empty$ not
        %
      type$ "phdthesis"      =
        type$ "mastersthesis"  =
        or
        %
      and
        { #1 }
        { type$ "misc" =
          type empty$ not and
            { type "\bibmessage" =
                type "\bibcomputerprogram" =
                  type "\bibcomputerprogrammanual" =
                    type "\bibcomputerprogramandmanual" =
                      type "\bibcomputersoftware" =
                        type "\bibcomputersoftwaremanual" =
                          type "\bibcomputersoftwareandmanual" =
                            type "\bibprogramminglanguage" =
                            or
                          or
                        or
                      or
                    or
                  or
                or
                { #1 }
                { #0 }
              if$
            }
            { #0 }
          if$
        }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % connects two strings with connect string
    % if one of them empty, then connect string
    % is left out
    %
    % call with S1 S2 connectstring connect.check
    %
FUNCTION {connect.check}
{ 'u :=
    %
    % if S2 = ""
    %
  duplicate$ empty$
      %
      % then remove S2
      %
    { pop$
        %
        % S1 is on top of stack.
        % if it is empty, it is replaced by the empty string ""
        %
      duplicate$ empty$
        { pop$ "" }
        'skip$
      if$
    }
      %
      % else swap S1 and S2 so that S1 can be checked
      %
    { swap$
        %
        % if S1 is empty, remove S1 so that S2 is left on the
        % stack and is the result is given
        %
      duplicate$ empty$
        { pop$ }
            %
            % now the real work starts:
            % push the connect string "C"
            % so that top of stack is "C" "S1" "S2"
            % concatenate, so that top of stack is
            % "S1+C" "S2"
            %
        { u *
            %
            % swap and concatenate
            %
          swap$ *
        }
      if$
    }
  if$
}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % connects two strings with space ("\ ")
    % if length of second is 4 or larger,
    % connects them with non-breaking space ("tie", "~")
    % if length of second smaller than 4
    %
    % call with S1 S2 tie.or.space.connect
    % result: "S1\ S2" or "S1~S2"
    %
FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #4 <
    { "~" }
    { "\ " }
  if$
  swap$ * *
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % connects two strings with comma (", ")
    % if one of them is empty, the comma is left out
    %
    % call with S1 S2 connect.with.comma.check
    % result: "S1, S2"
    %
FUNCTION {connect.with.comma.check}
{ ", " connect.check }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % connects two strings with semicolon ("; ")
    % if one of them is empty, semicolon is left out
    %
    % call with S1 S2 connect.with.semicolon.check
    % result: "S1; S2"
    %
FUNCTION {connect.with.semicolon.check}
{ "; " connect.check }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % connects two strings with colon (": ")
    % if one of them is empty, colon is left out
    %
    % call with S1 S2 connect.with.colon.check
    % result: "S1: S2"
    %
FUNCTION {connect.with.colon.check}
{ ": " connect.check }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % connects two strings with space ("\ ")
    %
    % call with S1 S2 connect.with.space.check
    % result: "S1\ S2"
    %
FUNCTION {connect.with.space.check}
{ "\ " connect.check }



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % encloses string in pre- and postfix string
    % call with
    %    prefix postfix  S  enclose.check
    % delivers empty string if S empty
    %
FUNCTION {enclose.check}
{ duplicate$ empty$
    { pop$ pop$ pop$
      ""
    }
    { swap$ * * }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % emphasizes top of stack
    % call with
    %     "string" emphasize.check
    %
FUNCTION {emphasize.check}
{ "\Bem{" swap$
  "}"     swap$
  enclose.check
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % brackets top of stack
    % call with
    %     "string" bracket
    %
FUNCTION {bracket.check}
{ "[" swap$
  "]" swap$
  enclose.check
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % parenthesizes top of stack
    % call with
    %     "string" parenthesize
    %
FUNCTION {parenthesize.check}
{ "(" swap$
  ")" swap$
  enclose.check
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % checks whether argument is "multiresult":
    % whether it contains '-', '+', or ',' characters
    % used with pages to check whether pp. or p. must be used
    %
FUNCTION {multi.result.check}
{ 't :=
  #0 'multiresult :=
  %
  % while (not multiresult) and (length(t) > 1) do
  %
    { multiresult not
      t text.length$ #1 >
      and
    }
        %
        % if t(1-2) = "--" or t(1) = "+" or ","
        % then  multiresult = 1
        % else  t = t(2-last)
        %
    { t #1 #2 substring$ 's :=
      "--" s =
        { #1 'multiresult := }
        { t #1 #1 substring$ 's :=
          "+" s =
            "," s =
            or
            { #1 'multiresult := }
            { t #2 global.max$ substring$ 't := }
          if$
        }
      if$
    }
  while$
  multiresult
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % Checks whether an author is a corporate author, i.e.,
    % whether the field starts with "{\bibcorporate".
    % Call with
    %   field is.bibcorporate
    %
FUNCTION {is.bibcorporate}
{ #1 #14 substring$ "{\bibcorporate" = }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  GENERAL PURPOSE FUNCTIONS FOR SORTING                    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Remove non-alphanumeric characters
% and change to lower case .

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Remove spaces from a string. Used for sorting.
%
% Call with
%     string remove.spaces
%
% E.g.,
%     "fine old day" remove.spaces
% gives "fineoldday" .

FUNCTION {remove.spaces}
{   % Remove spaces from string.
    % Works best if string only contains alphanumeric characters and spaces.
  's :=                    % The original string
  s text.length$ 'len :=   % Its length (no. of characters)
  "" 't :=                 % Initialize the transformed string
  #0 'pos :=
    %
    % while (pos < len) do
    %
  { pos len < }
    { pos #1 +  'pos :=
      s pos #1 substring$  'u :=
        %
        % u is the pos-th character in s
        % If it is a space, move to next character,
        % else copy character to output.
        %
      u " " =
        'skip$
        { t u *  't := }
      if$
    }
  while$
    %
    % Now push the result back on the stack
  t
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                BASIC OUTPUT FUNCTIONS                     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % end block by writing what's left on the stack and
    % starting a new line
    %
FUNCTION {output.end.block}
{ write$
  newline$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % end block by adding a period and writing what's left
    % on the stack and starting a new line
    %
FUNCTION {output.dot.end.block}
{ add.period$
  output.end.block
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % starting new block by writing what's left on the stack,
    % starting a new line and adding some extra space or
    % whatever is more defined in \newblock
    %
FUNCTION {output.new.block}
{ output.end.block
  "\newblock" write$ newline$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % starting new block by writing what's left on the stack,
    % starting a new line and adding some extra space or
    % whatever is more defined in \newblock
    %
FUNCTION {output.dot.new.block}
{ add.period$
  output.new.block
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Starting new block assuming that stack is empty.
% Starting a new line and adding some extra space or
% whatever is more defined in \newblock

FUNCTION {start.new.block}
{ "\unskip\ " write$ newline$
  "\newblock " write$ newline$
}
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Functions for sorting by author (or substitute),
% year, title}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The ``classic'' versions are the ones with the von part
% treated a in ``Beethoven, L. van'', whereas the nonclassic ones
% have the new approach with the von part always before the last
% name. The ``classic'' versions are not used in this version,
% but I keep them defined so it's easy to switch, and perhaps
% define an option in the future.
%    \begin{macrocode}

FUNCTION {sort.name.format.classic} { "{ll{}}{  f{}}{  vv{}}{  jj{}}" }

FUNCTION {cite.name.format.classic} { "{ll}" }

FUNCTION {author.name.format.classic} { "{ll}{, f{\BPBI }.}{ vv}{, jj}" }

FUNCTION {index.name.format.classic} { "{ll}{, f{\BPBI }.}{ vv}{, jj}" }

FUNCTION {sort.name.format} { "{vv{}}{ll{}}{  f{}}{  jj{}}" }

FUNCTION {cite.name.format} { "{vv }{ll}" }

FUNCTION {cite.initials.name.format} { "{f{\BPBI }.~~}{vv }{ll}{ jj}" }

FUNCTION {author.name.format} { "{vv }{ll}{, f{\BPBI }.}{, jj}" }

FUNCTION {editor.name.format} { "{f{\BPBI }.~~}{vv }{ll}{ jj}" }

FUNCTION {index.name.format} { "{vv }{ll}{, f{\BPBI }.}{, jj}" }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Check whether initials must be added (1).
% Initialization.

FUNCTION {init.initials}
{ "yyyyy"  'aut1f.old :=
  "yyyyy"  'aut1s.old :=
  #0       'cite.initials.old :=
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Check whether initials must be added (2).
% Update when author, editor, and key fields are not used.
%
% Call with
%   field  update.no.initials

FUNCTION {update.no.initials}
{ 'field :=
  field  'aut1f.old :=
  field  'aut1s.old :=
  #0     'cite.initials.old :=
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Check whether initials must be added (3).

FUNCTION {check.add.initials.aut}
{   %
    % If last name is equal to previous last name
    % but initials are different, then initials should
    % be cited. If initials are also the same, initials
    % should be cited if that is the case for the previous
    % author .
    %
  aut1s aut1s.old =
    { aut1f aut1f.old =
        { cite.initials.old  'cite.initials := }
        { #1             'cite.initials :=
          aut1f          'aut1f.old :=
          aut1s          'aut1s.old :=
          cite.initials  'cite.initials.old :=
        }
      if$
    }
    {  %
       % Different last name.
      aut1f          'aut1f.old :=
      aut1s          'aut1s.old :=
      cite.initials  'cite.initials.old :=
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Check whether initials must be added (4).
% Call with
%   field  check.add.initials.field

FUNCTION {check.add.initials.field}
{ 'field :=
  field #1 cite.initials.name.format format.name$  'aut1f :=
  field #1 cite.name.format          format.name$  'aut1s :=
    %
    % Now do the actual work
    %
  check.add.initials.aut
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Check whether initials must be added (4).

FUNCTION {check.add.initials}
{   %
    % Check whether author or editor or other field acts as author.
    % Initials are only relevant with author or editor.
    %
  firstkey empty$ not
    { key empty$ not
        {   %
            % Both key and firstkey are nonempty.
            % Then, key is treated as last name of first author,
            % and firstkey is treated as last name + initials of
            % first author .
            %
          firstkey  sortify  remove.spaces  'aut1f :=
          key       sortify  remove.spaces  'aut1s :=
          check.add.initials.aut
        }
        { firstkey  sortify  remove.spaces  update.no.initials }
      if$
    }
    { key empty$ not
        { key  sortify  remove.spaces  update.no.initials }
        {   %
            % No key or firstkey, so find out which field
            % to use as author.
            %
            % Check reference type:
            %   if result is 1 then possibly editor acts as author
            %                2 then editor does not act as author
            %                3 then key should have been used
            %                0 then unknown reference type
          ref.type  #2 =
            {   %
                % Format first author with and without initials
              author empty$
                { title.sort.label  update.no.initials }
                { author  check.add.initials.field }
              if$
            }
            {   %
                % Format first author with and without initials
              author empty$
                { editor empty$
                    { title.sort.label  update.no.initials }
                    { editor check.add.initials.field }
                  if$
                }
                { author check.add.initials.field }
              if$
            }
          if$
        }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute tentative number of names that must be cited (1).
% Call with
%   field  tentative.cite.num.names.field

FUNCTION {tentative.cite.num.names.field}
{ 'field :=
  field num.names$  'numnames :=
  numnames #3 <
    {   %
        % 1 or 2 names: always cite all of them.
      numnames  'cite.num.names.full  :=
      numnames  'cite.num.names.short :=
    }
    { numnames #6 <
        {   %
            % 3-5 names: cite all of them the first time,
            % only the first name later times
          numnames  'cite.num.names.full  :=
          #1        'cite.num.names.short :=
        }
        {   %
            % 6 or more names: cite only the first name
          #1  'cite.num.names.full  :=
          #1  'cite.num.names.short :=
        }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute tentative number of names that must be cited (2).

FUNCTION {tentative.cite.num.names}
{   %
    % Check whether author or editor or other field acts as author.
    % Number of names is only relevant with author or editor.
    %
  firstkey empty$ not
    {
      #1 'cite.num.names.full  :=
      #1 'cite.num.names.short :=
    }
    { key empty$ not
        {
          #1 'cite.num.names.full  :=
          #1 'cite.num.names.short :=
        }
        {   %
            % No key or firstkey, so find out which field
            % to use as author.
            %
            % Check reference type:
            %   if result is 1 then possibly editor acts as author
            %                2 then editor does not act as author
            %                3 then key should have been used
            %                0 then unknown reference type
          ref.type  #2 =
            {   %
                % Format first author with and without initials
              author empty$
                {
                  #1 'cite.num.names.full  :=
                  #1 'cite.num.names.short :=
                }
                { author tentative.cite.num.names.field }
              if$
            }
            {   %
                % Format first author with and without initials
              author empty$
                { editor empty$
                    {
                      #1 'cite.num.names.full  :=
                      #1 'cite.num.names.short :=
                    }
                    { editor tentative.cite.num.names.field }
                  if$
                }
                { author tentative.cite.num.names.field }
              if$
            }
          if$
        }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Initialize "number of names to be cited" before
% looping over entries.

FUNCTION {init.cite.num.names}
{ #0      'cite.num.names.old  :=
  #0      'numnames.old        :=
  "yyyy"  'year.label.old      :=
  #0      'add.to.year.old     :=
  ""      'aut1f.old           :=
  ""      'aut2.old            :=
  ""      'aut3.old            :=
  ""      'aut4.old            :=
  ""      'aut5.old            :=
  ""      'aut6.old            :=
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Update "number of names to be cited" .

FUNCTION {update.cite.num.names}
{ cite.num.names.short  'cite.num.names.old  :=
  numnames              'numnames.old        :=
  year.label            'year.label.old      :=
  add.to.year           'add.to.year.old     :=
  aut1f                 'aut1f.old           :=
  aut2                  'aut2.old            :=
  aut3                  'aut3.old            :=
  aut4                  'aut4.old            :=
  aut5                  'aut5.old            :=
  aut6                  'aut6.old            :=
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Format (maximally) 6 authors for comparison issues
% to determine number of authors that must be cited.
% It is assumed that the 'field' and 'numnames' variables
% have already been defined.

FUNCTION {format.6.authors}
{   %
    % First author: with initials.
    %
  field #1 cite.initials.name.format format.name$  'aut1f :=
    %
    % Second and later authors: without initials.
    %
  numnames #1 >
    name.max #1 >
      and
    {   %
        % 2nd author
      field #2 cite.name.format format.name$  'aut2 :=
        %
      numnames #2 >
        name.max #2 >
          and
        {   %
            % 3nd author
          field #3 cite.name.format format.name$  'aut3 :=
            %
          numnames #3 >
            name.max #3 >
              and
            {   %
                % 4th author
              field #4 cite.name.format format.name$  'aut4 :=
                %
              numnames #4 >
                name.max #4 >
                  and
                {   %
                    % 5th author
                  field #5 cite.name.format format.name$  'aut5 :=
                    %
                  numnames #5 >
                    name.max #5 >
                      and
                    {   %
                        % 6th author
                      field #6 cite.name.format format.name$  'aut6 :=
                    }
                    {   %
                        % 5 authors: 6 is empty
                        %
                      "" 'aut6 :=
                    }
                  if$
                }
                {   %
                    % 4 authors: 5-6 are empty
                    %
                  "" 'aut5 :=
                  "" 'aut6 :=
                }
              if$
            }
            {   %
                % 3 authors: 4-6 are empty
                %
              "" 'aut4 :=
              "" 'aut5 :=
              "" 'aut6 :=
            }
          if$
        }
        {   %
            % 2 authors: 3-6 are empty
            %
          "" 'aut3 :=
          "" 'aut4 :=
          "" 'aut5 :=
          "" 'aut6 :=
        }
      if$
    }
    {   %
        % Only 1 author: 2-6 are empty
        %
      "" 'aut2 :=
      "" 'aut3 :=
      "" 'aut4 :=
      "" 'aut5 :=
      "" 'aut6 :=
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute definitive number of names that must be cited
% and whether a's or b's must be added to year (1).
% a's or b's are necessary: update add.to.year variable

FUNCTION {change.add.to.year}
{
  forward  #1  =
    {   %
        % Moving forward: this add.to.year number must be 1 higher than
        % previous.
        %
      add.to.year.old  #0  >
        { add.to.year.old  #1 +    'add.to.year  := }
        { #2  'add.to.year  := }
      if$
    }
    {   %
        % Moving backward: this add.to.year number must be 1 lower than
        % previous.
        %
      add.to.year.old  #1 -    'add.to.year  :=
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute definitive number of names that must be cited
% and whether a's or b's must be added to year (1).
% Current and/or previous entry has 1 or 2 authors
% or editors acting as authors and they are published in the
% same year. The number of authors does not need to be changed
% in this case, but a's or b's may be necessary.

FUNCTION {definitive.cite.num.names.1.or.2}
{   %
  numnames  numnames.old  =
    {   %
        % Same number of names: ambiguity could arise. Check whether current
        % and previous have the same author(s).
        %
      aut1f aut1f.old =
        {   %
            % Same first author: if the second author is also the same or if
            % there is only one author, a's and b's should be added.
            %
          aut2  aut2.old  =
            numnames  #2  =
              and
                %
          numnames  #1  =
            or
            {   %
                % Same author(s): add to year.
                %
              change.add.to.year
            }
            {   %
                % Different second author: no ambiguity possible.
                %
              skip$
            }
          if$
        }
        {   %
            % Different first author: no ambiguity possible.
            %
          skip$
        }
      if$
    }
    {   %
        % Different number of names: no ambiguity possible.
        %
      skip$
    }
  if$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute definitive number of names that must be cited
% and whether a's or b's must be added to year (2).
% Both current and previous entries have 3 or more authors
% or editors acting as authors and they are published in the
% same year.

FUNCTION {definitive.cite.num.names.3.or.more}
{   %
    % Check whether current and previous have the same first author.
    %
  aut1f aut1f.old =
    {   %
        % Same first author: check second author
        %
      aut2 aut2.old =
        {   %
            % Same 1st & 2nd author: check 3rd.
            %
          aut3 aut3.old =
            {   %
                % Same 1st-3rd authors: check 4th.
                %
              numnames.old #3 =
                { numnames #3 =
                    {   %
                        % Both current and previous have 3 authors, which are
                        % the same, so both have identical author-year
                        % combinations, so ambiguity should be resolved by
                        % a's and b's. Check whether more authors were
                        % necessary for previous one.
                        %
                      change.add.to.year
                      cite.num.names.short  cite.num.names.old  <
                        { cite.num.names.old
                            'cite.num.names.short :=
                        }
                        'skip$
                      if$
                    }
                    {   %
                        % Previous has 3 authors, current has more, with same
                        % first 3, so at least 4 must be used for current to
                        % make a difference.
                        %
                      cite.num.names.short  #4  <
                        { #4  'cite.num.names.short := }
                        'skip$
                      if$
                    }
                  if$
                }
                { numnames #3 =
                    {   %
                        % Current has 3 authors, previous has more, with same
                        % first 3, so all 3 of current must be used.
                        %
                      numnames  'cite.num.names.short :=
                    }
                    {   %
                        % Same 1st-3rd author and both current and previous
                        % have at least 4 authors: check 4th.
                        %
                      aut4 aut4.old =
                        {   %
                            % Same 1st-4th authors: check 5th.
                            %
                          numnames.old #4 =
                            { numnames #4 =
                                {   %
                                    % Both current and previous have 4 authors,
                                    % which are the same, so both have
                                    % identical author-year combinations, so
                                    % ambiguity should be resolved by a's and
                                    % b's. Check whether more authors were
                                    % necessary for previous one.
                                    %
                                  change.add.to.year
                                  cite.num.names.short cite.num.names.old  <
                                    { cite.num.names.old
                                        'cite.num.names.short :=
                                    }
                                    'skip$
                                  if$
                                }
                                {   %
                                    % Previous has 4 authors, current has more,
                                    % with same first 4, so at least 5 must be
                                    % used for current to make a difference.
                                    %
                                  cite.num.names.short  #5  <
                                    { #5  'cite.num.names.short := }
                                    'skip$
                                  if$
                                }
                              if$
                            }
                            { numnames #4 =
                                {   %
                                    % Current has 4 authors, previous has more,
                                    % with same first 4, so all 4 of current
                                    % must be used.
                                    %
                                  numnames  'cite.num.names.short :=
                                }
                                {   %
                                    % Same 1st-4th author and both current and
                                    % previous have at least 5 authors: check
                                    % 5th.
                                    %
                                  aut5 aut5.old =
                                    {   %
                                        % Same 1st-5th authors: check 6th.
                                        %
                                      numnames.old #5 =
                                        { numnames #5 =
                                            {   %
                                                % Both current and previous
                                                % have 5 authors, which are the
                                                % same, so both have identical
                                                % author-year combinations, so
                                                % ambiguity should be resolved
                                                % by a's and b's. Check whether
                                                % more authors were necessary
                                                % for previous one.
                                                %
                                              change.add.to.year
                                              cite.num.names.short
                                                cite.num.names.old  <
                                                { cite.num.names.old
                                                    'cite.num.names.short  :=
                                                }
                                                'skip$
                                              if$
                                            }
                                            {   %
                                                % Previous has 5 authors,
                                                % current has more, with same
                                                % first 5, so at least 6 must
                                                % be used for current to make
                                                % a difference.
                                                %
                                              cite.num.names.short #6 <
                                                { #6 'cite.num.names.short := }
                                                'skip$
                                              if$
                                            }
                                          if$
                                        }
                                        { numnames #5 =
                                            {   %
                                                % Current has 5 authors,
                                                % previous has more, with same
                                                % first 5, so all 5 of current
                                                % must be used.
                                                %
                                              numnames 'cite.num.names.short :=
                                            }
                                            {   %
                                                % Same 1st-5th author and both
                                                % current and previous have at
                                                % least 6 authors. If one has
                                                % 6 authors and the other has
                                                % more or the 6th is different,
                                                % 6 should be used (which is
                                                % the maximum).
                                                %
                                              numnames #6 >
                                                numnames.old #6 =
                                                  and
                                                %
                                              numnames #6 =
                                                numnames.old #6 >
                                                  and
                                                %
                                              or
                                                %
                                              aut6 aut6.old =
                                                not
                                                %
                                              or
                                                { #6 cite.num.names.short <
                                                    { #6
                                                        'cite.num.names.short
                                                          :=
                                                    }
                                                    'skip$
                                                  if$
                                                }
                                                {   %
                                                    % The first 6 authors are
                                                    % the same and either both
                                                    % have 6 or both have more.
                                                    % So for all practical
                                                    % purposes they have
                                                    % identical author-year
                                                    % combination, so ambiguity
                                                    % should be resolved by a's
                                                    % and b's. Check whether
                                                    % more authors were
                                                    % necessary for previous
                                                    % one.
                                                    %
                                                  change.add.to.year
                                                  cite.num.names.short
                                                    cite.num.names.old
                                                      <
                                                    { cite.num.names.old
                                                        'cite.num.names.short
                                                          :=
                                                    }
                                                    'skip$
                                                  if$
                                                }
                                              if$
                                            }
                                          if$
                                        }
                                      if$
                                    }
                                    {   %
                                        % Different 5th author: citing 5 authors is
                                        % sufficient for this comparison.
                                        %
                                      cite.num.names.short #5 <
                                        { #5 'cite.num.names.short := }
                                        'skip$
                                      if$
                                    }
                                  if$
                                }
                              if$
                            }
                          if$
                        }
                        {   %
                            % Different 4th author: citing 4 authors is
                            % sufficient for this comparison.
                            %
                          cite.num.names.short #4 <
                            { #4 'cite.num.names.short := }
                            'skip$
                          if$
                        }
                      if$
                    }
                  if$
                }
              if$
            }
            {   %
                % Different 3rd author: citing 3 authors is sufficient for this
                % comparison.
                %
              cite.num.names.short #3 <
                { #3 'cite.num.names.short := }
                'skip$
              if$
            }
          if$
        }
        {   %
            % Different 2nd author: citing 2 authors is sufficient for this
            % comparison.
            %
          cite.num.names.short #2 <
            { #2 'cite.num.names.short := }
            'skip$
          if$
        }
      if$
    }
    {   %
        % Different first author: no ambiguity, move to next entry.
        %
      skip$
    }
  if$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute definitive number of names that must be cited
% and whether a's or b's must be added to year (3).
% Current entry has an author or editor acting as author.
%
% Call with
%   field  definitive.cite.num.names.field
%
% What should we do with explicit "others"? Is now ignored.
% If this causes ambiguity that could be resolved, the user
% should have added additional author names.

FUNCTION {definitive.cite.num.names.field}
{ 'field :=
  field num.names$  'numnames :=
    %
    % Format authors
    %
  format.6.authors
    %
    % Now compare authors with authors of previous entry.
    %
  cite.num.names.short   numnames.old    >
    {   %
        % The previous entry has less authors than already defined
        % necessary to be cited. No ambiguity is possible and we're ready.
        %
      skip$
    }
    {   %
        % Both previous and current entry have at least one author .
        %
      year.label   year.label.old  =
        {   %
            % Same year label: possibly ambiguous citation.
            %
            % First check: current and/or previous have 1 or
            % 2 authors.
            %
          numnames  #3  <
            numnames.old  #3  <
              or
               %
            { definitive.cite.num.names.1.or.2 }
            { definitive.cite.num.names.3.or.more }
          if$
        }
        {   %
            % Different year label: everything's fine,
            % move to next entry.
            %
          skip$
        }
      if$
    }
  if$
    %
    % If during the previous process the name maximum is exceeded
    % (which was not checked), correct this. NOTE: If the name
    % maximum is smaller than 6, this could lead to ambiguous
    % citations if, e.g., the year and the first 5 authors are
    % the same, but the 6th author is different.
    %
  cite.num.names.short   name.max   >
    { name.max  'cite.num.names.short  := }
    'skip$
  if$
    %
    % For a "full" cite, the number of names should always be at least
    % as large as for a "short" cite.
    %
  cite.num.names.full   cite.num.names.short   <
    { cite.num.names.short 'cite.num.names.full := }
    'skip$
  if$
    %
    % Update "old" variables for next entry.
    %
  update.cite.num.names
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute definitive number of names that must be cited (4)
% and especially whether a's and b's should be added.
% This function is for the situation when author or editor
% are not used and firstkey, key, or something else is
% used to cite the referenced work.
%
% Call with
%   formatted.field   definitive.cite.no.names

FUNCTION {definitive.cite.no.names}
{   %
    % The formatted field that acts as author is on top
    % of the stack.
      'aut1f :=
  ""  'aut2 :=
  ""  'aut3 :=
  ""  'aut4 :=
  ""  'aut5 :=
  ""  'aut6 :=
  #1  'numnames  :=
    %
  year.label   year.label.old  =
    {   %
        % Same year label: possibly ambiguous citation.
        %
      definitive.cite.num.names.1.or.2
    }
    {   %
        % Different year label: everything's fine,
        % move to next entry.
        %
      skip$
    }
  if$
    %
    % Update "old" variables for next entry.
    %
  update.cite.num.names
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute definitive number of names that must be cited (5).

FUNCTION {definitive.cite.num.names}
{   %
    % Check whether author or editor or other field acts as author.
    % Number of names is only relevant with author or editor.
    %
  firstkey empty$ not
    { firstkey  sortify  remove.spaces  definitive.cite.no.names }
    { key empty$ not
        { key  sortify  remove.spaces  definitive.cite.no.names }
        {   %
            % No key or firstkey, so find out which field
            % to use as author.
            %
            % Check reference type:
            %   if result is 1 then possibly editor acts as author
            %                2 then editor does not act as author
            %                3 then key should have been used
            %                0 then unknown reference type
          ref.type  #2 =
            {   %
                % Format first author with and without initials
              author empty$
                { title.sort.label  definitive.cite.no.names }
                { author  definitive.cite.num.names.field }
              if$
            }
            {   %
                % Format first author with and without initials
              author empty$
                { editor empty$
                    { title.sort.label  definitive.cite.no.names }
                    { editor definitive.cite.num.names.field }
                  if$
                }
                { author definitive.cite.num.names.field }
              if$
            }
          if$
        }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make a tentative year sorting label (without `a' and `b').

FUNCTION {make.tentative.year.sort.label}
{   %
    % Implicit or explicit ``no date'' is put at the front
    % (the year zero; years B.C. will imply complications)
    % because these are possibly old works.
    % ``In press'' is put at the end.
    %
  year empty$
    { "0000" 'year.label := }
    { year "\bibnodate" =
      year "l" change.case$ "no date" = or
      year "l" change.case$ "n.d."    = or
        { "0000" 'year.label := }
        { year "\BIP" =
          year "l" change.case$ "in press"    =  or
          year "l" change.case$ "forthcoming" =  or
            { "9999" 'year.label := }
            {   % It is not checked whether the year field
                % makes sense.
              year  sortify  remove.spaces  'year.label :=
            }
          if$
        }
      if$
    }
  if$
    %
    % Push year sort label on the stack
  year.label
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Give month and day when available.

FUNCTION {month.number.day}
{ month empty$
    { "" }
    { month sortify remove.spaces
        %
        % Add the day when available.
      day empty$
        'skip$
        { "/" *
          day  sortify  remove.spaces  *
        }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make tentative sort label with names in field on top of
% the stack.
%
% Call with
%   field make.name.sort.label
% where 'field' is the field that takes the author-role.

FUNCTION {make.name.sort.label}
{   %
    % Author or editor-acting-as-author available.
    % => Make tentative "short cite with initials" author
    %    label (L1) of one of the forms
    %     "Last1  F1"
    %     "Last1  F1   Last2"
    %     "Last1  F1   zzzz"  ("zzzz" representing et al.)
    % => If more than 2 'authors': make label (L2) for 2nd-6th authors
    %    of one of the forms
    %     "Last2   Last3"
    %     "Last2   Last3   Last4"
    %     "Last2   Last3   Last4   Last5"
    %     "Last2   Last3   Last4   Last5   Last6"
    %     "Last2   Last3   Last4   Last5   Last6   zzzz"
    %
    % Then format year label (L3) of one of the forms:
    %     "0000"  (missing year or explicit 'no date')
    %     "9999"  ('in press')
    %     year    (otherwise; don't use originalyear here yet)
    %
    % From earlier sorting of titles, we have title number. Convert
    % to string, which gives title label (L4) .
    %
    % Then tentative sorting label (author.year.sort.label) is a
    % concatenation of
    %     L1
    %     "    "
    %     L3
    %     "    "
    %     L2
    %     "    "
    %     L4
    %
    % The name field is on top of the stack.
  'field :=
    %
    % numnames is the total number of names contained in field
  field num.names$ 'numnames :=
    %
    % Format first author
  field  #1  sort.name.format  format.name$
    %
    % Format the second author if there are two, or else "zzzz" = et al.
  numnames #1 =
    'skip$
    { numnames #2 =
        {   %
            % Two authors: format second author
          field  #2  "{ll{}}"  format.name$  's :=
          s "others" =
            { "   zzzz" * }    % Add "et al."-substitute
            { "   " * s * }    % Add second author
          if$
        }
        { "   zzzz" * } % 3 or more authors: add "et al."-substitute
      if$
    }
  if$
  "    "  *                          % Add spaces
  make.tentative.year.sort.label *   % Add year (L3).
  "    "  *                          % Add spaces
    %
    % Now build up L2 if applicable
  numnames #3 <
    'skip$
    {   %
        % Treat last author slightly differently
      numnames name.max >
        { name.max  'lastname  :=
          "   zzzz"                 % Push "et al."-substitute on stack
        }
        { numnames  'lastname  :=
          ""                        % Push empty string on stack
        }
      if$
        %
        % Names 2 to "last" - 1
      ""                            % Push empty string on stack
      #2 'nameptr :=
      { nameptr lastname < }
        {   % Add name no. nameptr
          field  nameptr  "{ll{}}"  format.name$ *
          "   " *
          nameptr #1 +  'nameptr :=
        }
      while$
        %
        % "Last" author
      field  lastname  "{ll{}}"  format.name$  's :=
      s "others" =
        { "zzzz" * }    % Add "et al."-substitute
        { s * }         % Add last author
      if$
        %
      swap$ *  % Add the previously formatted empty string or
               % "et al."-substitute if there are many authors.
      *        % Add L2 to the earlier labels.
    }
  if$
    %
  "    "  *                          % Add spaces
  title.number  conv.int.to.str  *   % Add sorted title number (L4).
  sortify                            % Clean up and convert to lowercase
  "    "  *                          % Add spaces
  month.number.day  *                % Add month and day when available
  'author.year.sort.label :=         % Assign result to sort label.
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Called by make.tentative.sort.label to make tentative
% sort label if key or firstkey is available or author and
% editor are empty or unusable.
%
% Call with
%   field make.field.year.sort.label
% where 'field' is the field that takes the author-role,
% perhaps already subjected to removing articles from the
% beginning.

FUNCTION {make.field.year.sort.label}
{   %
    % 'field' acts as first author (L1), subsequent authors
    % are empty (L2).
    %
    % Then format year label (L3) of one of the forms:
    %     "0000"  (missing year or explicit 'no date')
    %     "9999"  ('in press')
    %     year    (otherwise; don't use originalyear here yet)
    %
    % From earlier sorting of titles, we have title number. Convert
    % to string, which gives title label (L4) .
    %
    % Then tentative sorting label (author.year.sort.label) is a
    % concatenation of
    %     L1
    %     "    "
    %     L3
    %     "    "
    %     L2
    %     "    "
    %     L4
    %
    % 'field' is on top of the stack. It is already supposed to be cleaned
    % (i.e., sortified and space-removed), so this is already L1.
  "    "  *                          % Add spaces to L1
  make.tentative.year.sort.label *   % Add year (L3).
  "    "  *                          % Add spaces
  "    "  *                          % L2 is empty, add spaces
  title.number  conv.int.to.str  *   % Add sorted title number (L4).
  sortify                            % Clean up and convert to lowercase
  "    "  *                          % Add spaces
  month.number.day  *                % Add month and day when available
  'author.year.sort.label :=         % Assign result to sort label.
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Called by make.tentative.sort.label to make tentative
% sort label if key or firstkey are not available and
% author or editor may be used

FUNCTION {make.author.editor.sort.label}
{ author empty$
    { editor empty$
        {   %
            % Use what has previously been stored in title.sort.label
            % as author substitute .
          title.sort.label   make.field.year.sort.label
        }
        { editor make.name.sort.label }
      if$
    }
    { author make.name.sort.label }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Called by make.tentative.sort.label to make tentative
% sort label if key or firstkey are not available and
% author (but not editor) may be used

FUNCTION {make.author.sort.label}
{ author empty$
    {   %
        % Use what has previously been stored in title.sort.label
        % as author substitute .
      title.sort.label   make.field.year.sort.label
    }
    { author make.name.sort.label }
  if$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make tentative label for citing and sorting and do some
% preprocessing.

FUNCTION {make.tentative.sort.label}
{   %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % General strategy:
    %
    % Ordinary situation: author or editor-acting-as-author
    % available.
    % => Make tentative "short cite with initials" author
    %    label (L1) of one of the forms
    %     "Last1  F1"
    %     "Last1  F1   Last2"
    %     "Last1  F1   zzzz"  ("zzzz" representing et al.)
    % => If more than 2 'authors': make label (L2) for 2nd-6th authors
    %    of one of the forms
    %     "Last2   Last3"
    %     "Last2   Last3   Last4"
    %     "Last2   Last3   Last4   Last5"
    %     "Last2   Last3   Last4   Last5   Last6"
    %     "Last2   Last3   Last4   Last5   Last6   zzzz"
    % When key is available (overrules author and editor fields):
    % => L1 = key, L2 = ""
    % No author, editor, and key: define title or substitute as key
    % and format as key.
    %
    % Then format year label (L3) of one of the forms:
    %     "0000"  (missing year or explicit 'no date')
    %     "9999"  ('in press')
    %     year    (otherwise; don't use originalyear here yet)
    %
    % From earlier sorting of titles, we have title number. Convert
    % to string, which gives title label (L4) .
    %
    % Then tentative sorting label (author.year.sort.label) is a
    % concatenation of
    %     L1
    %     "    "
    %     L3
    %     "    "
    %     L2
    %     "    "
    %     L4
    %
    % This can then be sorted, from which it can be derived
    % whether initials are necessary, how many names must
    % be used for short and full citations, and whether "a"'s and
    % "b"'s etc. are necessary behind the year labels.
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % key and firstkey overrule author information
    %
  firstkey empty$ not
    { key empty$ not
        {   %
            % Both key and firstkey available:
            % for sorting and checking initials, treat key as last
            % name and firstkey as initials.
            %
          key       sortify  remove.spaces
          "  " *
          firstkey  sortify  remove.spaces *
          make.field.year.sort.label
        }
        { firstkey  sortify  remove.spaces make.field.year.sort.label }
      if$
    }
    { key empty$ not
        { key   sortify  remove.spaces make.field.year.sort.label }
        {   %
            % No key or firstkey, so find out which field
            % to use as author.
            %
            % Check reference type:
            %   if result is 1 then possibly editor acts as author
            %                2 then editor does not act as author
            %                3 then key should have been used
            %                0 then unknown reference type
          ref.type
          duplicate$ #1 =
            { pop$
              make.author.editor.sort.label
            }
            { duplicate$ #2 =
                { pop$
                  make.author.sort.label
                }
                { #3 =
                    { "no key in " cite$ * warning$
                      make.author.editor.sort.label
                    }
                    { make.author.editor.sort.label }
                  if$
                }
              if$
            }
          if$
        }
      if$
    }
  if$
    %
  author.year.sort.label  'sort.key$ :=
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make final sort label with names in field on top of
% the stack.
%
% Call with
%   field  make.definitive.name.sort.label
%
% where 'field' is the field that takes the author-role.

FUNCTION {make.definitive.name.sort.label}
{   %
    % Author or editor-acting-as-author available.
    % => Make author-with-initials label (L1) of one of the forms
    %     "Last1  F1   Last2  F2   ...   LastN  FN"
    %     "Last1  F1   Last2  F2   ...   Last6  F6   zzzz"
    %     (where N <= 6 is the total number of authors, and
    %      "zzzz" represents et al. if there are more than 6 authors)
    % No author, editor, and key: define title or substitute as sort key.
    %
    % The name field is on top of the stack.
  'field :=
    %
    % numnames is the total number of names contained in field
  field num.names$ 'numnames :=
    %
    % If there are more than 6 authors, only 6 are mentioned.
  numnames  name.max  >
    { name.max  'format.num.names  := }
    { numnames  'format.num.names  := }
  if$
    % Initialize stack with empty string
  ""
    %
    % Cycle over authors.
  #1  'nameptr  :=
    { nameptr  format.num.names  < }
    { % Format author and add spaces
       field  nameptr  sort.name.format  format.name$  *
       "   " *
       nameptr #1 + 'nameptr :=
    }
  while$
    % Format last author that must be formatted
  field  nameptr  sort.name.format  format.name$  *
    % Add et al. if necessary
  nameptr numnames  <
    { "   zzzz" * }
    'skip$
  if$
  sortify                            % Clean up and change case
  "    "  *                          % Add spaces
  year.label *                       % Add year
  "    "  *                          % Add spaces
  title.number  conv.int.to.str  *   % Add sorted title number
  "    "  *                          % Add spaces
  month.number.day  *                % Add month and day when available
  'author.year.sort.label :=         % Assign result to sort label.
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Called to make definitive sort label if author and
% editor are empty or unusable.
%
% Call with
%   field make.definitive.field.year.sort.label
% where 'field' is the field that takes the author-role,
% perhaps already subjected to removing articles from the
% beginning.

FUNCTION {make.definitive.field.year.sort.label}
{   %
    % 'field' acts as author (L1).
    %
    % Then format year label (L2) of one of the forms:
    %     "0000"  (missing year or explicit `no date')
    %     "9999"  (`in press')
    %     year    (otherwise; don't use originalyear here yet)
    %
    % From earlier sorting of titles, we have title number. Convert
    % to string, which gives title label (L3) .
    %
    % Then tentative sorting label (author.year.sort.label) is a
    % concatenation of
    %     L1
    %     "    "
    %     L2
    %     "    "
    %     L3
    %
    % 'field' is on top of the stack. It is already supposed to be cleaned
    % (i.e., sortified and space-removed), so this is already L1.
  "    "  *                          % Add spaces
  year.label *                       % Add year
  "    "  *                          % Add spaces
  title.number  conv.int.to.str  *   % Add sorted title number
  "    "  *                          % Add spaces
  month.number.day  *                % Add month and day when available
  'author.year.sort.label :=         % Assign result to sort label.
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Called by make.final.sort.key if author or editor
% may be used.

FUNCTION {make.definitive.author.editor.sort.label}
{ author empty$
    { editor empty$
        {   %
            % Use what has previously been stored in title.sort.label
            % as author substitute .
          title.sort.label   make.definitive.field.year.sort.label
        }
        { editor  make.definitive.name.sort.label }
      if$
    }
    { author  make.definitive.name.sort.label }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Called by make.final.sort.key if author but not editor
% may be used.

FUNCTION {make.definitive.author.sort.label}
{ author empty$
    {   %
        % Use what has previously been stored in title.sort.label
        % as author substitute .
      title.sort.label   make.definitive.field.year.sort.label
    }
    { author  make.definitive.name.sort.label }
  if$
}
%    \end{macrocode}
% Make the final sort key. The general strategy is the following. The
% ordinary situation is that an author or editor-acting-as-author
% is available. In this case, make an author-with-initials label (L1)
% of one of the forms
% \begin{verbatim}
%     "Last1  F1   Last2  F2   ...   LastN  FN"
%     "Last1  F1   Last2  F2   ...   Last6  F6   zzzz"
% \end{verbatim}
% where $N \leq 6$ is the total number of authors, and ``|zzzz|''
% represents et al.\ if there are more than 6 authors. If there is
% no author, editor, and key, define the title or its substitute as a
% sort key. Note that there are two spaces between last name and first
% name and three spaces between authors.
%
% Next format a year label (L2) that is equal to the \fieldname{year}
% field, unless that is missing or an explicit ``no date'', in which
% case it is |0000| (and thus comes first) or if it is an explicit
% in press (|\BIP|), in which case the year label is |9999| (and thus
% it comes last). We don't use the \fieldname{originalyear} field here
% yet. We add |/|\fieldname{month}|/|\fieldname{day} to the year label
% when available.
%
% From earlier sorting of titles, we have the sorted title number. This
% is converted to a string, which gives title label (L3).
%
% Then the final sorting label (|author.year.sort.label|) is a
% concatenation of L1, L2, and L3, with four spaces between them. This
% can then be sorted.
%
% If the reference type is 1, then possibly the editor acts as author;
% if it is 2, then editor does not act as author; if it is 3, then the
% \fieldname{key} field should have been used; if it is 0, this is an
% unknown reference type.
%    \begin{macrocode}
FUNCTION {make.final.sort.key}
{ ref.type  #2 =
    { make.definitive.author.sort.label }
    { make.definitive.author.editor.sort.label }
  if$
%    \end{macrocode}
% With the \pkgoption{unsorted} option, the reference listed is sorted
% in the order in which \BibTeX{} reads the references, that is, in
% order of first citation.
%    \begin{macrocode}
  unsorted
    { citeorder.sort.label    'sort.key$ := }
    { author.year.sort.label  'sort.key$ := }
  if$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  FUNCTIONS THAT ALLOW SORTING BY TITLE                    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Remove first N characters of string if they are equal to
% teststring .
%
% Call with
%     teststring N string chop.word
%
% E.g.,
%     "A " #2 "A fine old day" chop.word
% gives "fine old day"
% and
%     "A " #2 "The fine old day" chop.word
% gives "The fine old day".

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Remove "a ", "an ", and "the " from beginning of string.
%
% Call with
%     string chop.articles

FUNCTION {chop.articles}
{ 's :=
  "a " #2
    "an " #3
      "the " #4
        s
      chop.word
    chop.word
  chop.word
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Format title and other non-name/date entries for sort key.
%
% Call with
%    field format.sort.title
%
% Make sure that field is not empty, this is not checked here!

FUNCTION {format.sort.title}
{   %
    % Remove non-alphanumeric characters and change to lower case .
  sortify
    %
    % Remove "a ", "an ", and "the " from the front .
  chop.articles #1 entry.max$ substring$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make title sorting label or substitute.

FUNCTION {make.sort.title}
{ title empty$
    { text empty$
        { type empty$
            { howpublished empty$
                { note empty$
                    { url empty$
                        { " " }
                        { url  format.sort.title }
                      if$
                    }
                    { note  format.sort.title }
                  if$
                }
                { howpublished  format.sort.title }
              if$
            }
            { type  format.sort.title }
          if$
        }
        { text format.sort.title }
      if$
    }
    { title  format.sort.title }
  if$
  remove.spaces
  'title.sort.label :=
  title.sort.label 'sort.key$ :=
}
%    \end{macrocode}
% Make title number: rank number of sorted title.
%    \begin{macrocode}
FUNCTION {make.title.number}
{ title.sort.label  old.label  =
    {
%    \end{macrocode}
% A tie: old and new label are the same.
%    \begin{macrocode}
      old.number  'title.number :=
    }
    {
%    \end{macrocode}
% The usual situation: titles are different.
%    \begin{macrocode}
      old.number  #1  +  'title.number :=
      title.number       'old.number   :=
      title.sort.label   'old.label    :=
    }
  if$
}
%    \end{macrocode}
% Order in which reference was first cited (integer and conversion to string).
%    \begin{macrocode}
FUNCTION {make.citeorder.number}
{ old.number  #1  +  'cite.order :=
  cite.order       'old.number   :=
  cite.order conv.int.to.str 'citeorder.sort.label :=
}
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  \subsection{Name formatting}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% In order to support removal of spaces between the initials,
% we have to split the formatting of the constituent parts,
% because something like |"{ll}{, f{\BPBI }.}{ vv}{, jj}"| removes
% the hyphens between initials as well. The ``classic'' versions
% treat the von part differently. They were used in pervious versions
% of \pkg{apacite}.
%
%    \begin{macrocode}

FUNCTION {last.part.name.format.classic} { "{ll}" }

FUNCTION {von.junior.name.format.classic} { "{ vv}{, jj}" }

FUNCTION {last.part.name.format} { "{vv }{ll}" }

FUNCTION {initials.with.space.name.format} { "{f.}" }

FUNCTION {von.last.junior.name.format} { "{vv }{ll}{ jj}" }

FUNCTION {von.junior.name.format} { "{, jj}" }

FUNCTION {one.complete.name.format} { "{vv }{ll}{, jj}{, ff}" }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% text.length$ views "special characters" as 1, whereas
% substring$ looks at the number of actual characters.
% So
%  "{\TeX}" text.length$   = 1
%  "{TeX}"  text.length$   = 3
% but
%  "{\TeX}" #4 #2 substring$ = "eX"
%  "{TeX}"  #4 #2 substring$ = "X}"
% Therefore, it is convenient to have a string length function
% that uses the same numbering as substring$:
%  "{\TeX}" string.length  = 6
%  "{TeX}"  string.length  = 5

FUNCTION {string.length}
{ #0 'pos :=
  % If the next character exists, i.e., is not empty,
  % add 1 to the string length.
  % We cannot use empty$ because " " empty$ is true.
  { duplicate$ pos #1 + #1 substring$ "" = not }
    { pos #1 + 'pos := }
  while$
  pop$ pos
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Replace ". " and ".~" with "\BPBI " (period between initials)
% and     ".-" with "\BHBI " (hyphen between initials)
% but only at brace level 0.

FUNCTION {transform.spaces.and.hyphens}
{ 's :=                    % The original string
  s string.length 'len :=  % Its length (no. of characters)
  "" 't :=                 % Initialize the transformed string
  #1 'pos :=
  #0 'brace.level :=
    %
    % while (pos < len) do
    %
  { pos len < }
    { % First, check whether we are at brace level 0
      brace.level #0 =
        {
          % At least two characters left: check for ". ", ".~", and ".-".
          % If so, replace and shift two positions.
          s pos #2 substring$  ". " =
          s pos #2 substring$  ".~" = or
            { t "\BPBI " *  't :=
              pos #2 +  'pos :=
            }
            { s pos #2 substring$  ".-" =
                { t "\BHBI " *  't :=
                  pos #2 +  'pos :=
                }
                { % neither is true, copy one character and shift one position
                  t   s pos #1 substring$   *   't :=
                  % Check whether we need to increase brace level.
                  % Note that this is not sophisticated: it does not capture
                  % \{, \verb+}+, etc.
                  % Note also that unbalanced braces cause problems.
                  s pos #1 substring$ "{" =
                    { brace.level #1 + 'brace.level := }
                    'skip$
                  if$
                  pos #1 +  'pos :=
                }
              if$
            }
          if$
        }
        { % Not at brace level 0: copy result literally
          t   s pos #1 substring$   *   't :=
          % Check whether we need to increase or decrease brace level.
          % Note that this is not sophisticated: it does not capture
          % \{, \verb+}+, etc.
          s pos #1 substring$ "{" =
            { brace.level #1 + 'brace.level := }
            { s pos #1 substring$ "}" =
                { brace.level #1 - 'brace.level := }
                'skip$
              if$
            }
          if$
          pos #1 +  'pos :=
        }
      if$
    }
  while$
    %
  pos len =
    { % Last character, copy
      t   s pos #1 substring$   *   't :=
    }
    { % pos = len + 1, so s ends with ". " or ".-"
      % This should not have happened, but make the best out of it.
      % Push last two characters of s on the stack, i.e., ". " or ".-".
      s len #1 - #2 substring$
      % Remove "\BPBI " or "\BHBI " from t
      t text.length$ 'len :=   % Length of t (no. of characters)
      t #1 len #6 - substring$
      % Concatenate and assign to t
      swap$ * 't :=
    }
  if$
    %
    % Now push the result back on the stack
  t
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Format only the initials of a name, retaining hyphens, but
% removing spaces between first names. So "Jean Pierre" becomes "J.P."
% and "Jean-Pierre" becomes "J.-P.".

FUNCTION {format.initials.with.hyphen}
{ % Format initials.
  % Call with
  %   field authornumber format.initials.with.hyphen
  % e.g.
  %   author #1 format.initials.with.hyphen
  % Instead of field, a string may also be used.
  %
  % First, format initials in the default way, retaining spaces
  % and hyphens.
  initials.with.space.name.format format.name$
  transform.spaces.and.hyphens
}

FUNCTION {format.last.part.name}
{ % Format a name with last.part.name.format,
  % as part of more complicated things.
  % Call with
  %   field authornumber format.last.part.name
  % e.g.
  %   author #1 format.last.part.name
  % Instead of field, a string may also be used.
  last.part.name.format  format.name$
}

FUNCTION {format.von.last.junior.name}
{ % Format a name with von.last.junior.name.format,
  % for citing or as part of more complicated things.
  % Call with
  %   field authornumber format.von.last.junior.name
  % e.g.
  %   author #1 format.von.last.junior.name
  % Instead of field, a string may also be used.
  von.last.junior.name.format  format.name$
}

FUNCTION {format.von.junior.name}
{ % Format a name with von.last.junior.name.format,
  % for citing or as part of more complicated things.
  % Call with
  %   field authornumber format.von.junior.name
  % e.g.
  %   author #1 format.von.junior.name
  % Instead of field, a string may also be used.
  von.junior.name.format  format.name$
}

FUNCTION {format.cite.initials.name}
{ % Format a name for citing with initials.
  % Call with
  %   field authornumber format.cite.initials.name
  % e.g.
  %   author #1 format.cite.initials.name
  % Instead of field, a string may also be used.
  %
  % First, extract the complete name, format it in the canonical form,
  % and push on the stack.
  one.complete.name.format format.name$
  %
  % Format the initials and push on the stack.
  duplicate$ #1 format.initials.with.hyphen
  %
  % Format the von-last-junior part and push on the stack.
  swap$ #1 format.von.last.junior.name
  %
  % Connect with "~" hyphen (if they're both non-empty).
  "~" connect.check
}

FUNCTION {format.author.name}
{ % Format an author name for the reference list.
  % Call with
  %   field authornumber format.author.name
  % e.g.
  %   author #1 format.author.name
  % Instead of field, a string may also be used.
  %
  % First, extract the complete name, format it in the canonical form,
  % and push on the stack.
  one.complete.name.format format.name$
  %
  % Make two copies of the name, format the last name and push on the stack.
  duplicate$ duplicate$ #1 format.last.part.name
  %
  % Format the initials and push on the stack.
  swap$ #1 format.initials.with.hyphen
  %
  % Connect with last name.
  connect.with.comma.check
  %
  % Format the von-junior part and connect with initials.
  swap$ #1 format.von.junior.name "" connect.check
}

FUNCTION {format.editor.name}
{ % Format a name for the reference list as an editor.
  % Call with
  %   field authornumber format.editor.name
  % e.g.
  %   author #1 format.editor.name
  % Instead of field, a string may also be used.
  %
  format.cite.initials.name
}

FUNCTION {format.index.name}
{ % Format an author name for the index.
  % Call with
  %   field authornumber format.index.name
  % e.g.
  %   author #1 format.index.name
  % Instead of field, a string may also be used.
  %
  format.author.name
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  CITATION LABELS                                          %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%    \end{macrocode}
%
% \begin{macro}{comma.between.two}
% \begin{macro}{comma.between.names}
% \begin{macro}{comma.before.last}
% \begin{macro}{dots.before.last}
% \begin{macro}{and.before.last}
% \begin{macro}{et.al.string.cite}
% \begin{macro}{et.al.string}
% \begin{macro}{et.al.string.period}
% Some macro strings about commas etc.\ between authors.
%    \begin{macrocode}
FUNCTION {comma.between.two} { "\BCBT {}" }

FUNCTION {comma.between.names} { ", " }

FUNCTION {comma.before.last} { "\BCBL {}" }

FUNCTION {dots.before.last} { "\BDBL {}" }

FUNCTION {and.before.last} { "\ \BBA {} " }

FUNCTION {et.al.string.cite} { "\ \protect \BOthers {.}" }

FUNCTION {et.al.string} { "\ \BOthers {.}" }

FUNCTION {et.al.string.period} { "\ \BOthersPeriod {.}" }

%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Add author index entry when desired.
% "field" must have been defined before and must contain the
%   contents of the relevant author field.
% "nameptr" must also have been defined before. It is the
%   number of the author that must be formatted. (So if it is
%   #2, then the 2nd author must be formatted.)
% What's on top of the stack (the formatted author) is written
% to the .bbl file.

FUNCTION {add.name.index}
{   %
    %
  make.index
    { "%" * write$ newline$
        % Check for corporate author
      field is.bibcorporate
        { "\corporateAX{" }
        { "\AX{" }
      if$
      write$
      field nameptr sort.name.format  format.name$  sortify  write$ newline$
      "@"  write$
      field nameptr format.index.name
      "}%"  *   write$ newline$
    }
    { "%" * write$ newline$ }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Citation labels when author or editor may be used.
% Field is on top of the stack.
%
% Call with
%   format.num.names  field  make.name.cite.label

FUNCTION {make.name.cite.label}
{ 'field  :=
  'format.num.names  :=
    %
  field  num.names$  'numnames :=   % numnames is the total number of names
                                    %   contained in field
    %
    % It is implicit in the APA manual that if "et al." would refer
    % to exactly one author, then this author should be named
    % instead of "et al."
    %
  format.num.names  numnames  #1  -  =
    { numnames  'format.num.names  := }
    'skip$
  if$
    %
    % Format first author: with or without initials
    %
  #1 'nameptr :=
  cite.initials  #1  =
    { field  nameptr  format.cite.initials.name     }
    { field  nameptr  cite.name.format format.name$ }
  if$
  add.name.index  % Add index entry when desired.
    %
  numnames  #1  =
    'skip$
    { format.num.names  #1  =
        {   %
            % First author et al.
            %
          et.al.string.cite write$
        }
        { numnames  #2  =
            {   %
                % Given that  format.num.names > 1, it is 2.
                % Format second author.
                %
              #2  'nameptr :=
              field  nameptr  cite.name.format  format.name$  's :=
                %
                % Check if 2nd author is explicit "others".
                % If so, insert "et al." string.
                %
              s "others" =
                { et.al.string.cite write$ }  % First et al.
                {   %
                    % First \& Second
                    %
                  and.before.last write$
                  s
                  add.name.index  % Add index entry when desired.
                }
              if$
            }
            {   %
                % 3 or more names, 2 or more must be cited
                %
                % for nameptr := 2  to  format.num.names - 1  do
                %
              #2  'nameptr  :=
                { nameptr  format.num.names  < }
                {   %
                    % Put comma between consecutive authors
                    %
                  comma.between.names  write$
                    %
                    % Format and add next author
                    %
                  field  nameptr  cite.name.format  format.name$
                  add.name.index  % Add index entry when desired.
                    %
                    % Move to next author
                    %
                  nameptr  #1  +  'nameptr :=
                }
              while$
                %
                % nameptr  =  format.num.names
                % Format this author.
                %
              field  nameptr  cite.name.format  format.name$  's :=
                %
              format.num.names  numnames  =
                {   %
                    % This is also the last author. Add (optional) comma.
                    %
                  comma.before.last  write$
                    %
                    % Check if this author is explicit "others".
                    % If so, insert "et al." string.
                    %
                  s "others" =
                    { et.al.string.cite  write$ }
                    { and.before.last    write$
                      s
                      add.name.index  % Add index entry when desired.
                    }
                  if$
                }
                {   %
                    % This is not the last author.
                    % Add comma, author name, and "et al."
                    %
                  comma.between.names  write$
                  s
                  add.name.index  % Add index entry when desired.
                    %
                  comma.before.last  et.al.string.cite  *  write$
                }
              if$
            }
          if$
        }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Citation labels when no author, editor, firstkey or key
% is available.

FUNCTION {make.title.cite.label}
{   %
    % Formatting: check if formatted as article title or
    % as book title, and insert this formatting.
    %
  is.atype
    { "\APACciteatitle {" }
    { "\APACcitebtitle {" }
  if$
    %
  title empty$
    { text empty$
        { type empty$
            { howpublished empty$
                { note empty$
                    { url empty$
                        { cite$ }
                        { url   }
                      if$
                    }
                    { note  }
                  if$
                }
                { howpublished }
              if$
            }
            { type }
          if$
        }
        { text }
      if$
    }
    { title }
  if$
    %
    % Connect with formatting.
    %
  * "}" *
    %
    % Write to output
    %
  write$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Citation labels when author or editor may be used.

FUNCTION {make.author.editor.cite.label}
{ author empty$
    { editor empty$
        {   %
            % No author or editor:
            % Use title or other description as citation label.
            %
          make.title.cite.label
          "}{%"  write$ newline$
          make.title.cite.label
        }
        { cite.num.names.full   editor  make.name.cite.label
          "}{%"  write$ newline$
          cite.num.names.short  editor  make.name.cite.label
        }
      if$
    }
    { cite.num.names.full   author  make.name.cite.label
      "}{%"  write$ newline$
      cite.num.names.short  author  make.name.cite.label
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Citation labels when author (but not editor) may be used.

FUNCTION {make.author.cite.label}
{ author empty$
    {   %
        % No author:
        % Use title or other description as citation label.
        %
      make.title.cite.label
      "}{%"  write$ newline$
      make.title.cite.label
    }
    { cite.num.names.full   author  make.name.cite.label
      "}{%"  write$ newline$
      cite.num.names.short  author  make.name.cite.label
    }
  if$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make "a" or "b" supplement to year label when necessary.

FUNCTION {make.definitive.year.supplement}
{   %
    % Add "a", "b", etc. when necessary.
    %
  add.to.year  #0  =
    { "" }
    { "{\protect "
      year empty$
        { "\BCntND " * }
        { year "\bibnodate" =
          year "l" change.case$ "no date" = or
          year "l" change.case$ "n.d."    = or
            { "\BCntND " * }
            { year "\BIP" =
              year "l" change.case$ "in press"    =  or
              year "l" change.case$ "forthcoming" =  or
                { "\BCntIP " * }
                { "\BCnt " * }
              if$
            }
          if$
        }
      if$
      "{" * add.to.year int.to.str$ * "}}" *
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Add \protect if year is \BIP or \bibnodate.

FUNCTION {protect.year}
{ year empty$
    { "{\protect \bibnodate {}}" }
    { year "\bibnodate" =
      year "l" change.case$ "no date" = or
      year "l" change.case$ "n.d."    = or
        { "{\protect \bibnodate {}}" }
        { year "\BIP" =
          year "l" change.case$ "in press"    =  or
          year "l" change.case$ "forthcoming" =  or
            { "{\protect \BIP {}}" }
            { year }
          if$
        }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make year label that is used for citations in text.

FUNCTION {make.definitive.year.label}
{ "{\protect \APACyear {"
  originalyear empty$
    { protect.year }
    { originalyear "\bibnodate" =    % date of original publication unknown
      originalyear "l" change.case$ "no date" = or
      originalyear "l" change.case$ "n.d."    = or
        { translator empty$
            { protect.year }
            { "{\protect \BTRANSL {}}~" protect.year * }
          if$
        }
        { year empty$
            { originalyear "/{\protect \bibnodate {}}"   * }  % 1923/n.d.
            { originalyear year =
                { protect.year }
                { originalyear  "/"  *  protect.year * }    % 1923/1961
              if$
            }
          if$
        }
      if$
    }
  if$
  * "}}%" * write$ newline$
    %
    % Add "a", "b", etc. when necessary.
    %
  "{\protect \APACexlab {" "}}"
  make.definitive.year.supplement enclose.check
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make citation labels:
% - Full formatted author list (or substitute if no author
%   available) for first citation;
% - Short formatted author list (ditto) for subsequent
%   citations;
% - Year, with originalyear when applicable, and "a" or "b"
%   etc. addendum when necessary.

FUNCTION {make.cite.labels}
{ newline$
    %
    % Write a few lines for testing purposes.
    %
  test
    { "\bibitem [] {} \fullciteA {" cite$ * "}" *  write$ newline$
      "\bibitem [] {} \citeA {"     cite$ * "}" *  write$ newline$
    }
    'skip$
  if$
    %
  "\bibitem [\protect \citeauthoryear {%" write$ newline$
    %
    % When key or firstkey is available, this takes precedence.
    %
  firstkey  empty$  not
    {   %
        % Full cite: firstkey.
        %
      firstkey  write$
      "}{%"     write$ newline$
        %
        % Short cite: if key is not empty and cite.initials is 0,
        % then key, else firstkey.
        %
      cite.initials  #0  =
        key empty$ not
          and
        { key      }
        { firstkey }
      if$
      write$
    }
    { key empty$ not
        {   %
            % No firstkey, but key available:
            % Both full and short labels are key.
            %
          key    write$
          "}{%"  write$ newline$
          key    write$
        }
        {   % No key or firstkey, so find out which field
            % to use as author.
            %
            % Check reference type:
            %   if result is 1 then possibly editor acts as author
            %                2 then editor does not act as author
            %                3 then key should have been used
            %                0 then unknown reference type
          ref.type  #2  =
            { make.author.cite.label }
            { make.author.editor.cite.label }
          if$
        }
      if$
    }
  if$
  "}{%"  write$ newline$
    %
    % Make year label that's used for citations
    %
  make.definitive.year.label  write$
  "}]{%"                      write$ newline$
  cite$                       write$
  "} "                        write$ newline$
  % author.year.sort.label      write$ newline$ % for testing purposes
  % year.label                  write$ newline$ % for testing purposes
    %
    % If the item is used in a meta-analysis, indicate this with
    % a star.
    %
  "\APACinsertmetastar {%"    write$ newline$
  cite$                       write$
  "}%"                        write$ newline$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  FORMATTING OF REFERENCE LIST                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% "(Ed.)" or "(Eds.)" postfix.
% editor must not be empty

FUNCTION {editor.postfix}
{ editor num.names$ #1 >
    { "(\BEDS)" }
    { "(\BED)"  }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% "(Ed. \& Trans.)" postfix
% editor must not be empty

FUNCTION {editor.trans.postfix}
{ editor num.names$ #1 >
    { "(\BEDS{} \BAnd{} \BTRANSS)" }
    { "(\BED{} \BAnd{} \BTRANS)"   }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % "(Trans.)" postfix
    % translator must not be empty
    %
FUNCTION {trans.postfix}
{ translator num.names$ #1 >
    { "(\BTRANSS)" }
    { "(\BTRANS)" }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Format authors (or editors acting as authors) for the
% reference list, according to APA 5th ed. rules.
%
% Call with
%    dot  field  authors.editors.reflist.apa5
% where field is the field (string) that contains the authors
% (or editors acting as authors) that must be formatted and
% dot is 1 or 0 indicating whether or not a period must end
% the formatting.

FUNCTION {authors.editors.reflist.apa5}
{ 'field  :=
  'dot    :=
    %
  field  num.names$  'numnames :=   % numnames is the total number of names
                                    %   contained in field
  numnames  'format.num.names  :=   % Format all authors
  format.num.names   name.max  >    % Unless this exceeds the maximum of 6.
    { dot
        { name.max             'format.num.names := } % Format 6 authors
        { cite.num.names.full  'format.num.names := } % Format 1 editor
      if$
    }
    'skip$
  if$
    %
    % Enclose authors in APACrefauthors environment to allow crude style
    % options in \LaTeX.
  "\begin{APACrefauthors}%"
  write$ newline$
    %
    % It is kind of explicit in the APA manual that if "et al." would
    % refer to exactly one author (the 7th), then this author should
    % still be replaced by "et al.", unlike with citations.
    % So format.num.names is not adapted.
    %
    % Format first author
    %
  #1  'nameptr :=
  field  nameptr  format.author.name
    %
    % Add period if required and if this is the only author.
    %
  numnames  #1  =
    dot
    and
    { add.period$ }
    'skip$
  if$
  add.name.index  % Add index entry when desired.
    %
  numnames  #1  =
    'skip$
    { format.num.names  #1  =
        {   %
            % First author et al.
            %
          comma.between.two
            %
            % Add period if required.
            %
          dot
            { et.al.string.period * }
            { et.al.string * }
          if$
          write$
        }
        { numnames  #2  =
            {   %
                % Given that  format.num.names > 1, it is 2.
                %
              comma.between.two  write$
                %
                % Format second author.
                %
              #2  'nameptr :=
              field  nameptr  format.author.name  's :=
                %
                % Check if 2nd author is explicit "others".
                % If so, insert "et al." string.
                %
              s "others" =
                {   %
                    % First et al.
                    % Add period if required.
                    %
                  dot
                    { et.al.string.period }
                    { et.al.string }
                  if$
                  write$
                }
                {   %
                    % First \& Second
                    %
                  and.before.last write$
                    %
                    % Add period if required.
                    %
                  dot
                    { s add.period$ }
                    { s }
                  if$
                  add.name.index  % Add index entry when desired.
                }
              if$
            }
            {   %
                % 3 or more names, 2 or more must be cited
                %
                % for nameptr := 2  to  format.num.names - 1  do
                %
              #2  'nameptr  :=
                { nameptr  format.num.names  < }
                {   %
                    % Put comma between consecutive authors
                    %
                  comma.between.names  write$
                    %
                    % Format and add next author
                    %
                  field  nameptr  format.author.name
                  add.name.index  % Add index entry when desired.
                    %
                    % Move to next author
                    %
                  nameptr  #1  +  'nameptr :=
                }
              while$
                %
                % nameptr  =  format.num.names
                % Format this author.
                %
              field  nameptr  format.author.name  's :=
                %
              format.num.names  numnames  =
                {   %
                    % This is also the last author. Add (optional) comma.
                    %
                  comma.before.last  write$
                    %
                    % Check if this author is explicit "others".
                    % If so, insert "et al." string.
                    %
                  s "others" =
                    {   %
                        % Add period if required.
                        %
                      dot
                        { et.al.string.period }
                        { et.al.string }
                      if$
                      write$
                    }
                    { and.before.last  write$
                        %
                        % Add period if required.
                        %
                      dot
                        { s add.period$ }
                        { s }
                      if$
                      add.name.index  % Add index entry when desired.
                    }
                  if$
                }
                {   %
                    % This is not the last author.
                    % Add comma, author name, and "et al."
                    %
                  comma.between.names  write$
                  s
                  add.name.index  % Add index entry when desired.
                    %
                  comma.before.last
                    %
                    % Add period if required.
                    %
                  dot
                    { et.al.string.period * }
                    { et.al.string * }
                  if$
                  write$
                }
              if$
            }
          if$
        }
      if$
    }
  if$
    %
    % End APACrefauthors environment.
  "\end{APACrefauthors}%"
  write$ newline$
}

%
% \begin{macro}{authors.reflist.apa6}
% Format authors for the reference list according to the rules of the
% 6th edition of the \emph{APA Manual}, i.e., if there are more than 7
% authors, list the first 6, then dots, and then the last.
% Call with
% \begin{verbatim}
%    dot  field  authors.reflist.apa6
% \end{verbatim}
% where \texttt{field} is the field (string) that contains the authors
% (or editors acting as authors) that must be formatted and \texttt{dot}
% is 1 or 0 indicating whether or not a period must end the formatting.
%    \begin{macrocode}
FUNCTION {authors.reflist.apa6}
{ 'field  :=
  'dot    :=
%    \end{macrocode}
% \texttt{numnames} is the total number of names in the \texttt{field}.
% \texttt{format.num.names} is the number of names to be formatted,
% which is \texttt{numnames} or 7, whichever is smaller
%    \begin{macrocode}
  field  num.names$  'numnames :=
  numnames  #7  >
    { #7        'format.num.names := }
    { numnames  'format.num.names := }
  if$
%    \end{macrocode}
% Enclose authors in \envirname{APACrefauthors} environment to allow crude
% style options in \LaTeX.
%    \begin{macrocode}
  "\begin{APACrefauthors}%"
  write$ newline$
%    \end{macrocode}
% Format first author.
%    \begin{macrocode}
  #1  'nameptr :=
  field  nameptr  format.author.name
  numnames  #1  =
%    \end{macrocode}
% Add period if required and if this is the only author, and add index
% entry when desired.
%    \begin{macrocode}
    { dot
        { add.period$ }
        'skip$
      if$
      add.name.index
    }
    { add.name.index
      numnames  #2  =
%    \end{macrocode}
% Optional comma between two authors; format second author and store in
% \texttt{s}.
%    \begin{macrocode}
        { comma.between.two write$
          #2  'nameptr :=
          field  nameptr  format.author.name  's :=
          s "others" =
%    \end{macrocode}
% Second author is explicit ``|others|''. Therefore, insert
% ``et al.'' string. Note that this does not correspond with the
% 6th edition of the \emph{APA manual}, so give a warning here,
% but after that format the authors as in the 5th edition:
% ``First, et al.''. Add a period if required.
%    \begin{macrocode}
            { "`others' not consistent with 6th ed. of the APA Manual"
              warning$
              dot
                { et.al.string.period }
                { et.al.string }
              if$
              write$ newline$
            }
%    \end{macrocode}
% There really are two authors: ``First, \& Second'', with a period
% after the latter if required.
%    \begin{macrocode}
            { and.before.last write$
              dot
                { s add.period$ }
                { s }
              if$
              add.name.index
            }
          if$
        }
%    \end{macrocode}
% Three or more authors, Format all the ones that need to be formatted,
% except the last one, which needs special treatment.
%    \begin{macrocode}
        { %% for nameptr := 2  to  format.num.names - 1  do
          #2  'nameptr  :=
            { nameptr  format.num.names  < }
%    \end{macrocode}
% Put comma between consecutive authors and format and add the next
% author and the optional index entry, and increase the loop variable.
%    \begin{macrocode}
            { comma.between.names write$
              field  nameptr  format.author.name
              add.name.index
              nameptr  #1  +  'nameptr :=
            }
          while$
%    \end{macrocode}
% Format the last author. If all authors are formatted, add an
% ampersand; otherwise, add dots (new in 6th ed.).
%    \begin{macrocode}
          field  numnames  format.author.name  's :=
          format.num.names  numnames  =
            { comma.before.last write$
%    \end{macrocode}
% Check if this author is an explicit ``|others|''. If so, insert
% ``et al.'' string. Note that this does not correspond with the
% 6th edition of the \emph{APA manual}, so give a warning here. Add
% a period if required.
%    \begin{macrocode}
              s "others" =
                { "`others' not consistent with 6th ed. of the APA "
                  "Manual" *
                  warning$
                  dot
                    { et.al.string.period }
                    { et.al.string }
                  if$
                  write$
                }
                { and.before.last  write$
                  dot
                    { s add.period$ }
                    { s }
                  if$
                  add.name.index
                }
              if$
            }
%    \end{macrocode}
% We skipped some authors. Indicate by dots.
%    \begin{macrocode}
            { dots.before.last write$
              s
              add.name.index
            }
          if$
        }
      if$
    }
  if$
%    \end{macrocode}
% End \envirname{APACrefauthors} environment.
%    \begin{macrocode}
  "\end{APACrefauthors}%"
  write$ newline$
}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{format.author.names}
% Format authors (or editors acting as authors) for the reference list.
% Call with
% \begin{verbatim}
%    dot  field  format.author.names
% \end{verbatim}
% where \texttt{field} is the field (string) that contains the authors
% (or editors acting as authors) that must be formatted and \texttt{dot}
% is 1 or 0 indicating whether or not a period must end the formatting.
%    \begin{macrocode}
FUNCTION {format.author.names}
{ 'field  :=
  'dot    :=
%    \end{macrocode}
% This is a temporary trick, which needs to be cleaned up. We
% now check whether |dot| is 1, which indicates it's an author
% field. If it's not, it's an editor field. In the former case,
% if there are more than 7 authors, the first 6 plus dots plus
% the last author must be given, whereas in the latter case,
% only the first and ``et al.'' needs to be given. The latter
% is the same behavior as in the 5th edition, so we use that
% function, whereas we use an adapted function for authors in
% the 6th edition.
%    \begin{macrocode}
  dot
    { dot  field  authors.reflist.apa6 }
    { dot  field  authors.editors.reflist.apa5 }
  if$
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Format authors in reference list, where it is given that
% the author field is not empty.

FUNCTION {format.authors}
{ #1 author format.author.names }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Format editors in reference list in case editors act as
% authors (such as reference to entire edited book)
%
% Letheridge, S., \& Cannon, C. R. (Eds.).
%     or
% Letheridge, S. (Ed.).    (if only 1 editor)
%
% editor must not be empty

FUNCTION {format.editors.as.authors}
{ #0  editor  format.author.names
  "\ " editor.postfix * add.period$ write$ newline$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Format editors in reference list in case editors are also
% translators and act as authors (such as reference to entire
% edited book of translated articles)
%
% Letheridge, S., \& Cannon, C. R. (Eds. and Trans.).
%     or
% Letheridge, S. (Ed. and Trans.).    (if only 1 editor)
%
% editor must not be empty

FUNCTION {format.ed.trans.as.authors}
{ #0  editor  format.author.names
  "\ " editor.trans.postfix * add.period$ write$ newline$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Format a list of names with the initials before the
% last names (i.e., names in the editor position),
% commas between names (not between 2),
% and ampersand (\&) before last name.
% These names are not put in the author index.
%
% Call with
%     field format.editor.names

FUNCTION {format.editor.names}
{ 'field  :=
    %
  field  num.names$  'numnames :=   % numnames is the total number of names
                                    %   contained in field
  numnames  'format.num.names  :=   % Format all authors
  format.num.names   name.max  >    % Unless this exceeds the maximum of 6.
    { #1 'format.num.names := }     % Then it becomes 1 (First et al.)
    'skip$
  if$
    %
    % Format first editor
    %
  field  #1  format.editor.name
    %
  numnames  #1  =
    'skip$
    { format.num.names  #1  =
        { et.al.string * } % First editor et al., no comma.
        { numnames  #2  =
            {   %
                % Given that  format.num.names > 1, it is 2.
                % No comma. Format second editor.
                %
              field  #2  format.editor.name  's :=
                %
                % Check if 2nd editor is explicit "others".
                % If so, insert "et al." string.
                %
              s "others" =
                { et.al.string  * }          % First et al.
                { and.before.last  *  s * }  % First \& Second
              if$
            }
            {   %
                % 3 or more names, 2 or more must be cited
                %
                % for nameptr := 2  to  format.num.names - 1  do
                %
              #2  'nameptr  :=
                { nameptr  format.num.names  < }
                {   %
                    % Put comma between consecutive editors
                    %
                  comma.between.names  *
                    %
                    % Format and add next editor
                    %
                  field  nameptr  format.editor.name  *
                    %
                    % Move to next editor
                    %
                  nameptr  #1  +  'nameptr :=
                }
              while$
                %
                % nameptr  =  format.num.names
                % Format this editor.
                %
              field  nameptr  format.editor.name  's :=
                %
              format.num.names  numnames  =
                {   %
                    % This is also the last editor. Add (optional) comma.
                    %
                  comma.before.last  *
                    %
                    % Check if this editor is explicit "others".
                    % If so, insert "et al." string.
                    %
                  s "others" =
                    { et.al.string     *     }
                    { and.before.last  * s * }
                  if$
                }
                {   %
                    % This is not the last editor.
                    % Add comma, editor name, and "et al."
                    %
                  comma.between.names  * s *
                  comma.before.last    * et.al.string  *
                }
              if$
            }
          if$
        }
      if$
    }
  if$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format editors in case editors do not act as authors
    % (such as reference to chapter in edited book)
    %
    % L. W. Poon (Ed.)                         (1 editor)
    %    or
    % A. S. Gurman \& D. P. Kniskern (Eds.)    (2 editors)
    %    or
    % L. Poon, A. Jones, \& D. P. Smith (Eds.) (>2 editors)
    %
    % editor must not be empty
    %
FUNCTION {format.editors.in.line}
{ editor           format.editor.names
  editor.postfix   connect.with.space.check
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format editors in case editors are also translators
    % and do not act as authors
    % (such as reference to chapter in edited book
    %  of translated articles)
    %
    % L. W. Poon (Ed. and Trans.)                         (1 editor)
    %    or
    % A. S. Gurman \& D. P. Kniskern (Eds. and Trans.)    (2 editors)
    %    or
    % L. Poon, A. Jones, \& D. P. Smith (Eds. and Trans.) (>2 editors)
    %
    % editor must not be empty
    %
FUNCTION {format.editors.trans.in.line}
{ editor                 format.editor.names
  editor.trans.postfix   connect.with.space.check
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format translators in case translators act as editors
    % (such as reference to chapter in translated book)
    %
    % L. W. Poon (Trans.)                         (1 translator)
    %    or
    % A. S. Gurman \& D. P. Kniskern (Trans.)    (2 translators)
    %    or
    % L. Poon, A. Jones, \& D. P. Smith (Trans.) (>2 translators)
    %
    % translator must not be empty
    %
FUNCTION {format.translators.in.line}
{ translator      format.editor.names
  trans.postfix   connect.with.space.check
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format translators in case translator does not act as editor
    % (such as reference to translated book)
    %
    % L. Solotaroff, Trans.
    %
FUNCTION {format.translators.in.paren.check}
{ translator empty$
    { "" }
    { translator format.editor.names
      translator num.names$ #1 >
        { ", \BTRANSS{}" * }
        { ", \BTRANS{}" * }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format editors and translators in case neither act as editor
    % (such as reference to edited or translated book with a
    % a single author)
    %
    % L. Solotaroff, Ed.
    % L. Solotaroff, Ed. \& Trans.
    % L. Solotaroff, Trans.
    % L. Solotaroff, Ed. \& S. Prokofieff, Trans.
    %
FUNCTION {format.editors.translators.in.paren.check}
{ editor empty$
    { translator empty$
        { "" }
        { translator format.editor.names
          translator num.names$ #1 >
            { ", \BTRANSS{}" * }
            { ", \BTRANS{}" * }
          if$
        }
      if$
    }
    { editor format.editor.names
      editor num.names$ #1 >
        { ", \BEDS{}" * }
        { ", \BED{}" * }
      if$
      translator empty$
        'skip$
        { editor translator =
            { editor num.names$ #1 >
                { " \BAnd{} \BTRANSS" * }
                { " \BAnd{} \BTRANS" * }
              if$
            }
            { " \BAnd{} " *
              translator format.editor.names *
              translator num.names$ #1 >
                { ", \BTRANSS{}" * }
                { ", \BTRANS{}" * }
              if$
            }
          if$
        }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % translator of article
    %
FUNCTION {format.atrans.check}
{ format.translators.in.paren.check   parenthesize.check }




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format "In editor (Ed.), "
    %
FUNCTION {format.in.editors}
{ "\BIn{} "
  editor empty$
    'skip$
    { format.editors.in.line * ", " * }
  if$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format "In translator (Trans.),"
    %
FUNCTION {format.in.trans}
{ "\BIn{} "
  translator empty$
    'skip$
    { format.translators.in.line * ", " * }
  if$
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format "In editor (Ed. and Trans.)"
    %  or "In editor (Ed.)" if editor not equal to translator
    %
FUNCTION {format.in.editors.trans}
{ "\BIn{} "
  editor empty$
    { translator empty$
        'skip$
        { format.translators.in.line * ", " * }
      if$
    }
    { translator empty$
        { format.editors.in.line * }
        { editor translator =
            { format.editors.trans.in.line * }
            { format.editors.in.line * }
          if$
        }
      if$
      ", " *
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                            DATE                           %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Formats year (+ extra label) between parentheses (which
% may be redefined by \BBOP and \BBCP).
% Extra label can be used for
% Bentler, P. M. (1983a) <article 1>
% Bentler, P. M. (1983b) <article 2>

FUNCTION {format.year.check}
{ "\APACrefYear{"
  protect.year *
    %
    % Add "a", "b", etc. when necessary.
    %
  make.definitive.year.supplement *
  "}" *
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Formats year (+ extra label)  + month + day between
% parentheses (which may be redefined by \BBOP and \BBCP).
% Extra label can be used for
% Bentler, P. M. (1983a, June 7)  <article 1>
% Bentler, P. M. (1983b, April 4) <article 2>

FUNCTION {format.year.month.day.check}
{ "\APACrefYearMonthDay{"
  protect.year *
    %
    % Add "a", "b", etc. when necessary.
    %
  make.definitive.year.supplement *
  "}{" *
    %
    % Add month and day when present.
    %
  month empty$
    'skip$
    { month * }
  if$
  "}{" *
  day empty$
    'skip$
    { day * }
  if$
  "}" *
}

%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Title formatting}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \begin{macro}{format.atitle.no.dot}
% Title of article in journal or book, without finishing period.
% The field must be on top of stack (so \fieldname{englishtitle} can
% be handled as well).
%    \begin{macrocode}
FUNCTION {format.atitle.no.dot}
{ "{\BBOQ}" swap$
  "{\BBCQ}" swap$
  duplicate$ empty$
    'skip$
    { duplicate$
      % Two arguments: Title twice: (1) don't change case; (2) change case
      "\APACrefatitle {" swap$ * "} {" * swap$
      "t" change.case$
      * "}" *
    }
  if$
  enclose.check
}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{format.atitle.dot}
% Title of article in journal or book, with finishing period.
% The field must be on top of stack (so \fieldname{englishtitle} can
% be handled as well).
%    \begin{macrocode}
FUNCTION {format.atitle.dot}
{ "{\BBOQ}" swap$
  "{\BBCQ}" swap$
  duplicate$ empty$
    'skip$
    { duplicate$
      % Two arguments: Title twice: (1) don't change case; (2) change case
      "\APACrefatitle {" swap$ * "} {" * swap$
      "t" change.case$
      * "}" * add.period$
    }
  if$
  enclose.check
}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{format.atitle.connect}
% Title of article in journal or book. The field must be on top of stack.
% The second element on stack must be connected: if that is empty, then
% |format.atitle.dot|, else |format.atitle.no.dot|, connect, and add a
% period.
%    \begin{macrocode}
FUNCTION {format.atitle.connect}
{ swap$
  duplicate$ empty$
    { pop$
      format.atitle.dot
    }
    { swap$
      format.atitle.no.dot
      swap$ connect.with.space.check
      add.period$
    }
  if$
}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{format.btitle.no.dot}
% Title of a book or so, without period. Call with
% \begin{verbatim}
%   field  format.btitle.no.dot
% \end{verbatim}
%    \begin{macrocode}
FUNCTION {format.btitle.no.dot}
{ duplicate$ empty$
    { pop$
      ""
    }
    { duplicate$
      % Two arguments: Title twice: (1) don't change case; (2) change case
      "\APACrefbtitle {" swap$ * "} {" * swap$
      "t" change.case$
      * "}" *
    }
  if$
}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{format.btitle.dot}
% Title of book or so, with period. Call with
% \begin{verbatim}
%   field  format.btitle.dot
% \end{verbatim}
%    \begin{macrocode}
FUNCTION {format.btitle.dot}
{ duplicate$ empty$
    { pop$
      ""
    }
    { add.period$ format.btitle.no.dot }
  if$
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % title of book and similar
    % field must be on top of stack
    % second element on stack must be connected:
    %   if that is empty, then btitle.dot
    %   else btitle.no.dot, connect, and add period
    %
FUNCTION {format.btitle.connect}
{ swap$
  duplicate$ empty$
    { pop$
      format.btitle.dot
    }
    { swap$
      format.btitle.no.dot
      swap$   connect.with.space.check
      add.period$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % title of book and similar
    % field must be on top of stack
    % second element on stack must be connected
    %
FUNCTION {format.btitle.connect.no.dot}
{ swap$
  duplicate$ empty$
    { pop$
      format.btitle.no.dot
    }
    { swap$
      format.btitle.no.dot
      swap$   connect.with.space.check
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format englishtitle (of nonenglish article, etc.)
    %
FUNCTION {format.aetitle.check}
{ englishtitle empty$
    { "" }
    { % Two arguments: Title twice: (1) don't change case; (2) change case
      "\APACrefaetitle {" englishtitle * "} {" *
                         englishtitle "t" change.case$ * "}" *
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format englishtitle (of nonenglish book, etc.)
    %
FUNCTION {format.betitle.check}
{ englishtitle empty$
    { "" }
    { % Two arguments: Title twice: (1) don't change case; (2) change case
      "\APACrefbetitle {" englishtitle * "} {" *
                         englishtitle "t" change.case$ * "}" *
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format type (of article, etc.)
    %
FUNCTION {format.atype.check}
{ type bracket.check }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format title and englishtitle (of article, etc.)
    %
FUNCTION {format.atitle.check}
{ format.aetitle.check
  title format.atitle.connect
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format title, englishtitle, and type
    % (of article, etc.)
    %
FUNCTION {format.atitle.type.check}
{ format.aetitle.check
  format.atype.check   connect.with.space.check
  title format.atitle.connect
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format title, englishtitle,
    % and translator (of article, etc.)
    %
FUNCTION {format.atitle.trans.check}
{ format.aetitle.check
  format.atrans.check  connect.with.space.check
  title format.atitle.connect
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format title, englishtitle, type,
    % and translator (of article, etc.)
    %
FUNCTION {format.atitle.type.trans.check}
{ format.aetitle.check
  format.atype.check   connect.with.space.check
  format.atrans.check  connect.with.space.check
  title format.atitle.connect
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                    JOURNAL FORMATTING                     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format journal, volume, number and pages
    % call with
    %   formatted.pages format.journal.vol.num.pages.check
    %
FUNCTION { format.journal.vol.num.pages.check }
{ "journal" journal warning.if.empty
  duplicate$ empty$
  journal    empty$ and
  volume     empty$ and
  number     empty$ and
    { pop$ "" }
    { "\APACjournalVolNumPages{" journal "" connect.check
      "}{" *                     volume  "" connect.check
      "}{" *                     number  "" connect.check
      "}{" *                     swap$   "" connect.check
      "}"  *
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%    BOOK VOLUME, EDITION, AND OTHER SUPPLEMENTARY INFO     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % volume of book, checks whether
    % "Volume" or "Volumes"
    %
    % call with
    %   field format.bvolume.check
    %
FUNCTION {format.bvolume.check}
{ duplicate$ empty$
    'skip$
    { duplicate$ multi.result.check
        { "\BVOLS" swap$ tie.or.space.connect }
        { "\BVOL"  swap$ tie.or.space.connect }
      if$
    }
  if$
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % edition of book, must not be empty
    % call with
    %   field format.edition.check
    %
FUNCTION {format.edition.check}
{ duplicate$ empty$
    'skip$
    { "\PrintOrdinal{" swap$ * "}" *
      "\BEd" connect.with.space.check
    }
  if$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % volume and edition of book
    %
FUNCTION {format.bvol.edition.check}
{ edition format.edition.check
  volume  format.bvolume.check
  connect.with.comma.check
}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % volume and edition of book
    %
FUNCTION {format.bvol.edition}
{ format.bvol.edition.check
  parenthesize.check
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % volume and edition and translator of translated book
    %
FUNCTION {format.bvol.edition.trans}
{ format.bvol.edition.check
  format.translators.in.paren.check connect.with.semicolon.check
  parenthesize.check
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % volume, edition, editor, and translator of (translated) book
    %
FUNCTION {format.bvol.edition.editor.trans}
{ format.bvol.edition.check
  format.editors.translators.in.paren.check connect.with.semicolon.check
  parenthesize.check
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % formats pages by first checking if 1 or more pages
    % and prefixing pages with "p." or "pp." (these strings
    % are given in the commands \BPG and \BPGS, respectively),
    % whichever is applicable, and do a tie or space connect
    %
    % call with
    %   field format.bpages.check
    %
FUNCTION {format.bpages.check}
{ duplicate$ empty$
    'skip$
    { duplicate$ multi.result.check
        { "\BPGS" swap$ tie.or.space.connect }
        { "\BPG~" swap$ * }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % formats chapters by first checking if 1 or more chapters
    % and prefixing pages with "chap." (this string
    % is given in the commands \BCHAP and \BCHAPS, respectively),
    % whichever is applicable, and do a tie or space connect
    %
    % call with
    %   field format.bchapter.check
    %
FUNCTION {format.bchapter.check}
{ duplicate$ empty$
    'skip$
    { duplicate$ multi.result.check
        { "\BCHAPS" swap$ tie.or.space.connect }
        { "\BCHAP"  swap$ tie.or.space.connect }
      if$
    }
  if$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % volume, edition, and pages or chapter of article in book etc.
    %
FUNCTION {format.bvol.edition.pages}
{ format.bvol.edition.check
  pages empty$
    { chapter format.bchapter.check  connect.with.comma.check }
    { pages   format.bpages.check    connect.with.comma.check }
  if$
  parenthesize.check
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % title, volume, edition of book
    %
FUNCTION {format.btitle.vol.edition}
{ format.betitle.check
  format.bvol.edition  connect.with.space.check
  title  format.btitle.connect.no.dot
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % title, volume, edition, and translator of book
    %
FUNCTION {format.btitle.vol.edition.trans}
{ format.betitle.check
  format.bvol.edition.trans  connect.with.space.check
  title  format.btitle.connect.no.dot
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % title, volume, edition, editor, and translator of book
    %
FUNCTION {format.btitle.vol.edition.editor.trans}
{ format.betitle.check
  format.bvol.edition.editor.trans  connect.with.space.check
  title  format.btitle.connect.no.dot
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                 ADDRESS AND PUBLISHER                     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format address and publisher of book etc.
    %
    % New York: Wiley
    %      or
    % Wiley      (if address empty)
    %      or
    % New York   (if publisher empty)
    %
FUNCTION {format.address.publisher}
{   %
    % If publisher = author or publisher = "author" or publisher = "Author"
    % then hand over the final choice how to format this to \LaTeX.
    % (I could imagine similar code for editors, but the APA manual does
    % not mention it and then we'd have to check whether the editor is in
    % the author position, so let's keep it simple until someone complains.)
    %
  author empty$
  publisher empty$ or
    { publisher "\APACaddressPublisher{" }
    { author   publisher =
      "author" publisher =  or
      "Author" publisher =  or
        { author    "\APACaddressPublisherEqAuth{" }
        { publisher "\APACaddressPublisher{"       }
      if$
    }
  if$
  address "" connect.check  "}{" *
    % Recover publisher that was pushed onto the stack previously.
  swap$   "" connect.check  "}"  *
}

%    \end{macrocode}
%
% \begin{macro}{format.address.publisher.check}
% Format \fieldname{address} and \fieldname{publisher} of a book etc.:
% ``New York, NY: Wiley'' or ``Wiley'' (if \fieldname{address} is empty)
% or ``New York, NY'' (if \fieldname{publisher} is empty), or do nothing
% if both are empty.
%    \begin{macrocode}
FUNCTION {format.address.publisher.check}
{ publisher empty$
  address   empty$
  and
    'skip$
    {
%    \end{macrocode}
% Clear the stack.
%    \begin{macrocode}
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.address.publisher
    }
  if$
}

%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%            TYPE AND NUMBER OF A REPORT                    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format number as in reports: No. 2017
    % call with
    %   field format.rnumber.check
    %
FUNCTION {format.rnumber.check}
{ duplicate$ empty$
    'skip$
    { duplicate$ multi.result.check
        { "\BNUMS" swap$ tie.or.space.connect }
        { "\BNUM"  swap$ tie.or.space.connect }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format type and number of a standalone item
    % call with
    %   format.type.number
    %
FUNCTION { format.type.number }
{ type empty$
    { type.2 }
    { type   }
  if$
  number empty$
    { bracket.check }
    { number format.rnumber.check connect.with.space.check
      parenthesize.check
    }
  if$
}

%    \end{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \paragraph{Howpublished formatting functions}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The third function is a cleaner version. The first one is used with
% various entry types; the second one with \entryname{@misc}, the
% third one in v6.03 only with theses.
%    \begin{macrocode}
FUNCTION {format.howpublished}
{ howpublished empty$
    'skip$
    { % clear the stack
      duplicate$ empty$
        'pop$
        { output.dot.new.block }
      if$
      "\APAChowpublished {" howpublished * "}" *
    }
  if$
}
FUNCTION {output.howpublished}
{ howpublished empty$
    'skip$
    { "\APAChowpublished {" howpublished * "}" *
      output.dot.new.block
    }
  if$
}
FUNCTION {howpublished.block}
{ howpublished empty$
    'skip$
    { start.new.block
      "\APAChowpublished {" howpublished * "}" *
      output.dot.end.block
    }
  if$
}
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{URL and DOI formatting functions}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \begin{macro}{begin.end.url.env}
% Begin and end of a URL environment.
%    \begin{macrocode}
FUNCTION {begin.end.url.env}
{ "\begin{APACrefURL} "
%    \end{macrocode}
% For ``Retrieved $\langle$\textit{date}$\rangle$, from''
%    \begin{macrocode}
  lastchecked empty$
    { urldate empty$
        'skip$
        { "[{" * urldate * "}]" * }
      if$
    }
    { "[{" * lastchecked * "}]" * }
  if$
  " \end{APACrefURL} "
}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{begin.end.doi.env}
% Begin and end of a DOI environment.
%    \begin{macrocode}
FUNCTION {begin.end.doi.env}
{ "\begin{APACrefDOI} "
  " \end{APACrefDOI} "
}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{begin.end.msg.env}
% Begin and end of a message environment.
%    \begin{macrocode}
FUNCTION {begin.end.msg.env}
{ "\begin{APACrefURLmsg} "
  " \end{APACrefURLmsg} "
}
%    \end{macrocode}
% \end{macro}
% Format \fieldname{url} given that it is not empty.
%    \begin{macrocode}
FUNCTION {format.url}
%    \end{macrocode}
% First format begin and end of the enclosing environment.
% With posted messages, a different environment is used.
%    \begin{macrocode}
{ type.2 empty$
    { begin.end.url.env }
    { type.2 "\bibmessage" =
        { begin.end.msg.env }
        { begin.end.url.env }
      if$
    }
  if$
  "\url{" url * "}" *
%    \end{macrocode}
% Enclose url string in begin and end environment.
%    \begin{macrocode}
  enclose.check
}
%    \end{macrocode}
% Process a whole url block. Skip if a \fieldname{doi} is also present
% because then \fieldname{doi} has precedence.
%    \begin{macrocode}
FUNCTION {url.block}
{ doi empty$
    { url empty$
        'skip$
        { start.new.block
          format.url
          output.end.block
        }
      if$
    }
    'skip$
  if$
}
%    \end{macrocode}
% Format \fieldname{doi} given that it is not empty.
%    \begin{macrocode}
FUNCTION {format.doi}
%    \end{macrocode}
% Format begin and end of the enclosing environment.
%    \begin{macrocode}
{ begin.end.doi.env
  "\doi{" doi * "}" *
%    \end{macrocode}
% Enclose doi string in begin and end environment.
%    \begin{macrocode}
  enclose.check
}
%    \end{macrocode}
% Process a whole doi block.
%    \begin{macrocode}
FUNCTION {doi.block}
{ doi empty$
    'skip$
    { start.new.block
      format.doi
      output.end.block
    }
  if$
}
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Note formatting functions}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Format optional note.
%    \begin{macrocode}
FUNCTION {format.note}
{ "\APACrefnote{"  "}"  note  enclose.check }
%    \end{macrocode}
% Process a whole note block (only \fieldname{note}).
%    \begin{macrocode}
FUNCTION {note.block}
{ note empty$
    'skip$
    { start.new.block
      format.note
      output.end.block
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format original year of publication and note
    % (reprint or translation)
    %
FUNCTION {format.orig.year.note}
{ originalyear empty$
    { format.note }
    { "\APACorigyearnote{"
      originalyear    "" connect.check "}{" *
      note            "" connect.check "}"  *
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format original journal of publication and note
    % (reprint or translation)
    %
FUNCTION {format.orig.journal.note}
{ "\APACorigjournalnote{"
  originalyear    "" connect.check "}{" *
  originaljournal "" connect.check "}{" *
  originalvolume  "" connect.check "}{" *
  originalnumber  "" connect.check "}{" *
  originalpages   "" connect.check "}{" *
  note            "" connect.check "}"  *
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format original book of publication and note
    % (reprint or translation)
    %
FUNCTION {format.orig.book.note}
{ "\APACorigbooknote{" originalyear  ""  connect.check "}{" *
    %
  originaleditor empty$
    'skip$
    { originaleditor num.names$ #1 >
        { "\APACorigEDS {" * originaleditor format.editor.names * "}" * }
        { "\APACorigED {"  * originaleditor format.editor.names * "}" * }
      if$
    }
  if$
    %
  "}{" *
  originalbooktitle format.btitle.no.dot "" connect.check "} {" *
  originaledition   format.edition.check "" connect.check "} {" *
  originalvolume    format.bvolume.check "" connect.check "} {" *
  originalpages     format.bpages.check  "" connect.check "} {" *
  originaladdress   "" connect.check "} {" *
  originalpublisher "" connect.check "} {" *
  note              "" connect.check "}"  *
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format information about original publication of reprint
    % and format optional note
    %
FUNCTION {format.orig.note}
{ originaljournal empty$
    { originalbooktitle empty$
        { note empty$
            { originalyear empty$
                'skip$
                { originalyear "\bibnodate" =
                  originalyear "l" change.case$ "no date" = or
                  originalyear "l" change.case$ "n.d."    = or
                    'skip$
                    { output.new.block
                      format.orig.year.note
                    }
                  if$
                }
              if$
            }
            { output.new.block
              format.orig.year.note
            }
          if$
        }
        { output.new.block
          format.orig.book.note
        }
      if$
    }
    { output.new.block
      format.orig.journal.note
    }
  if$
}
%    \end{macrocode}
% Finish current entry by writing what's left on the stack and starting
% a new line.
%    \begin{macrocode}
FUNCTION {fin.entry}
{ doi empty$
    'skip$
    { output.new.block
      format.doi
    }
  if$
  output.end.block
  "\PrintBackRefs{\CurrentBib}" write$ newline$
  test
    { "\vspace{\baselineskip}" write$ newline$ }
    'skip$
  if$
%<*annotated>
    %
    % According to TLC2, pp. 810-811, both annote and annotate fields are
    % known, so support them both, but do not print them both, in case
    % someone wants to make a file that is compatible with both the annotate
    % and annotation styles and thus duplicates the information. Instead, we
    % give annote priority.
    %
  annote empty$
    {% Try annotate
      annotate empty$
        'skip$
        { % add annotation
          "\begin{APACrefannotation}" write$ newline$
          annotate write$ newline$
          "\end{APACrefannotation}" write$ newline$
        }
      if$
    }
    { % add annotation
      "\begin{APACrefannotation}" write$ newline$
      annote write$ newline$
      "\end{APACrefannotation}" write$ newline$
    }
  if$
%</annotated>
}
%    \end{macrocode}
% Finish current entry: process \fieldname{doi}, back references, and
% annotation if requested.
%    \begin{macrocode}
FUNCTION {fin.entry.2}
{ doi.block
  "\PrintBackRefs{\CurrentBib}" write$ newline$
  test
    { "\vspace{\baselineskip}" write$ newline$ }
    'skip$
  if$
%<*annotated>
%    \end{macrocode}
% According to TLC2, pp. 810--811, both \fieldname{annote} and
% \fieldname{annotate} fields are known, so support them both, but do
% not print them both, in case someone wants to make a \fname{.bib}
% file that is compatible with both the \pkg{annotate} and
% and \pkg{annotation} styles and thus duplicates the information.
% Instead, we give \fieldname{annote} priority.
%    \begin{macrocode}
  annote empty$
    {% Try annotate
      annotate empty$
        'skip$
        { % add annotation
          "\begin{APACrefannotation}" write$ newline$
          annotate write$ newline$
          "\end{APACrefannotation}" write$ newline$
        }
      if$
    }
    { % add annotation
      "\begin{APACrefannotation}" write$ newline$
      annote write$ newline$
      "\end{APACrefannotation}" write$ newline$
    }
  if$
%</annotated>
}
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Top-level and near-top level functions for formatting complete
% entries}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Article in periodical: \entryname{journal}, \entryname{magazine},
% \entryname{newspaper}. Call with
% \begin{verbatim}
%   formatted.pages  formatted.date   periodical
% \end{verbatim}
%    \begin{macrocode}
FUNCTION {periodical}
{
%    \end{macrocode}
% \fieldname{author} or \fieldname{editor}, \fieldname{year},
% \fieldname{title}, \fieldname{englishtitle}, \fieldname{type}.
%    \begin{macrocode}
  author empty$
        %
        % no author: possibly special issue with editors as authors
        % (APA manual, ex. 11, p. 121)
        %
    { editor empty$
            %
            % no author or editor: title serves as author.
            % title formatted as article title (APA manual not consistent in this,
            % compare statement on p. 119: ``treat as book title'' and
            % example 8, p. 121: no underlining => article title)
            %
        { format.atitle.type.trans.check output.new.block
            %
            % now formatted date on top of stack
            %
          output.dot.new.block
        }
            %
            % format editor and year, and check if year is present
            % format article title and check if title or type present
            %
        { format.editors.as.authors   start.new.block
            %
            % now formatted date on top of stack
            %
          output.dot.new.block
          format.atitle.type.trans.check output.new.block
        }
      if$
    }
        %
        % format author and year, and check if year is present
        % format article title and check if title or type present
        %
    { format.authors   start.new.block
            %
            % now formatted date on top of stack
            %
      output.dot.new.block
      format.atitle.type.trans.check output.new.block
    }
  if$
    %
    % format journal name, volume and issue number, and pages
    %   and check if journal not empty
    %
  format.journal.vol.num.pages.check
    %
    % if not empty, insert howpublished.
    % (used if article is retrieved from the internet)
    %
  format.howpublished  add.period$
      %
      % format url
      %
  url empty$
    'skip$
    { % Clear the stack
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.url
    }
  if$
    %
    % possible reprint and optional note
    %
  format.orig.note
  fin.entry
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % journal article
    %
FUNCTION {article}
{ pages  format.year.month.day.check  periodical }



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % magazine article
    %
FUNCTION {magazine}
{ pages  format.year.month.day.check  periodical }



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % newspaper article
    %
FUNCTION {newspaper}
{ pages  format.bpages.check  format.year.month.day.check  periodical }



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % (translation of) entire book
    %
FUNCTION {book}
{     %
      % author or editor,
      % year, title, englishtitle, translator
      %
  author empty$
        %
        % no author: possibly edited book with editors as authors
        %
    { editor empty$
            %
            % no author or editor: title serves as author.
            % title formatted as book title
            %
        { format.btitle.vol.edition.trans
          format.type.number               connect.with.space.check
          output.dot.new.block
          format.year.check                add.period$
        }
            %
            % format editor and year, and check if year is present
            % format booktitle, volume, and edition and check if title present
            %
        { translator empty$
            { format.editors.as.authors  start.new.block
              format.year.check          output.dot.new.block
              format.btitle.vol.edition
            }
                %
                % format translator correctly
                %
            { translator editor =
              not
                { format.editors.as.authors        start.new.block
                  format.year.check                output.dot.new.block
                  format.btitle.vol.edition.trans
                }
                { format.ed.trans.as.authors  start.new.block
                  format.year.check           output.dot.new.block
                  format.btitle.vol.edition
                }
              if$
            }
          if$
          format.type.number     connect.with.space.check
          add.period$
        }
      if$
    }
        %
        % format author and year, and check if year is present
        % format booktitle, volume, and edition and check if title present
        %
    { format.authors                          start.new.block
      format.year.check                       output.dot.new.block
      format.btitle.vol.edition.editor.trans
      format.type.number                      connect.with.space.check
      add.period$
    }
  if$
      %
      % format address and publisher
      %
  format.address.publisher.check
      %
      % if not empty, insert howpublished.
      % (used if book is retrieved from the internet)
      %
  format.howpublished  add.period$
      %
      % format url
      %
  url empty$
    'skip$
    { % Clear the stack
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.url
    }
  if$
      %
      % format original publication (of reprint/translation)
      % and optional note
      %
  format.orig.note
  fin.entry
}
%
%    \end{macrocode}
% Article or chapter in edited book.
%    \begin{macrocode}
FUNCTION {incollection}
{ author empty$
%    \end{macrocode}
% No \fieldname{author}: \fieldname{title} serves as author. The title is
% formatted as an article title.
%    \begin{macrocode}
    { editor.ne.trans
        { format.atitle.type.trans.check }
        { format.atitle.type.check }
      if$
      output.new.block
%    \end{macrocode}
% Format \fieldname{month} and \fieldname{day} as well when available,
% esp.\ for ``collections'' that are not books, such as parts of internet
% documents.
%    \begin{macrocode}
      format.year.month.day.check   add.period$
    }
%    \end{macrocode}
% Format \fieldname{author} and \fieldname{year}, and check whether
% \fieldname{year} is present. Format article title and check whether
% \fieldname{title} or \fieldname{type} are present.
%    \begin{macrocode}
    { format.authors                start.new.block
      format.year.month.day.check   output.dot.new.block
      editor.ne.trans
        { format.atitle.type.trans.check }
        { format.atitle.type.check }
      if$
    }
  if$
%    \end{macrocode}
% Format ``In '' \fieldname{editor} `` (Ed.\ \& Trans.), ''
% \fieldname{booktitle}, \fieldname{volume}, \fieldname{edition},
% \fieldname{pages}. Leave empty if all these fields are missing.
%    \begin{macrocode}
  editor     empty$
  translator empty$ and
  edition    empty$ and
  volume     empty$ and
  pages      empty$ and
  chapter    empty$ and
  booktitle  empty$ and
    'skip$
    {
      output.new.block
      format.in.editors.trans
      format.bvol.edition.pages
      booktitle  format.btitle.connect * add.period$
    }
  if$
%    \end{macrocode}
% Format \fieldname{address} and \fieldname{publisher}.
%    \begin{macrocode}
  format.address.publisher.check
%    \end{macrocode}
% If not empty, insert \fieldname{howpublished}.
%    \begin{macrocode}
  format.howpublished  add.period$
%    \end{macrocode}
% Format \fieldname{url}.
%    \begin{macrocode}
  url empty$
    'skip$
    {
%    \end{macrocode}
% Clear the stack.
%    \begin{macrocode}
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.url
    }
  if$
%    \end{macrocode}
% Format original publication (of reprint/translation) and optional note.
%    \begin{macrocode}
  format.orig.note
  fin.entry
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                       REPORTS                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % technical report number
    %
FUNCTION {format.tr.number}
{ type empty$
    { "\BTR{}" }
    { type "\bibnotype" =
        { ""   }
        { type }
      if$
    }
  if$
  number format.rnumber.check   connect.with.space.check
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % title, volume, edition, report number
    %
FUNCTION {format.tr.title.number}
{ format.betitle.check
    % Single out the situation in which there is no number
    % and type = {\bibnotype}, i.e., no type as well.
    % (Why not use book then?)
  type empty$
    { % Now, we're in the regular situation with at least a
      % number, a type, a volume, or an edition.
      "\APACbVolEdTR{" format.bvol.edition.check * "}{" *
      format.tr.number *  "}" *
    }
    { type "\bibnotype" =
        number empty$
          volume empty$
            edition empty$
            and
          and
        and
        { "" }
        { % Now, we're in the regular situation with at least a
          % number, a type, a volume, or an edition.
          "\APACbVolEdTR {" format.bvol.edition.check * "}{" *
          format.tr.number *  "}" *
        }
      if$
    }
  if$
  connect.with.space.check
  title  format.btitle.connect
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % format address and institution of reports etc.
    %
    % Washington, DC: National Institute of Education
    %      or
    % National Institute of Education (if address empty)
    %
    % warning if no institution
    %
FUNCTION {format.address.institution.check}
{ url empty$
  doi empty$ and
    { "institution" institution warning.if.empty
      "address"     address     warning.if.empty
    }
    'skip$
  if$
  institution empty$
  address     empty$
  and
    'skip$
    { % Clear the stack
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
        %
        % If institution = author or institution = "author"
        % or institution = "Author" then hand over the final choice how to
        % format this to \LaTeX. See also format.address.publisher
        %
      author empty$
      institution empty$ or
        { institution "\APACaddressInstitution{" }
        { author   institution =
          "author" institution =  or
          "Author" institution =  or
            { author      "\APACaddressInstitutionEqAuth{" }
            { institution "\APACaddressInstitution{"       }
          if$
        }
      if$
      address "" connect.check  "}{" *
        % Recover institution that was pushed onto the stack previously.
      swap$   "" connect.check  "}"  *
    }
  if$
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % reports
    %
FUNCTION {techreport}
{ author empty$
        %
        % no author: possibly edited report with editors as authors
        %
    { editor empty$
            %
            % no author or editor: title serves as author.
            % title formatted as book title
            %
        { format.tr.title.number      output.dot.new.block
          format.year.month.day.check add.period$
        }
            %
            % format editor and year, and check if year is present
            % format report title and check if title present
            % format volume, edition, type, and number
            %
        { format.editors.as.authors   start.new.block
          format.year.month.day.check output.dot.new.block
          format.tr.title.number      add.period$
        }
      if$
    }
        %
        % format author and year, and check if year is present
        % format report title and check if title present
        % format volume, edition, type, and number
        %
    { format.authors              start.new.block
      format.year.month.day.check output.dot.new.block
      format.tr.title.number      add.period$
    }
  if$
    %
    % format address and institution, check if institution present
    %
  format.address.institution.check
    %
    % if not empty, insert howpublished.
    % (used if report is retrieved from the internet)
    %
  format.howpublished add.period$
      %
      % format url
      %
  url empty$
    'skip$
    { % Clear the stack
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.url
    }
  if$
    %
    % format optional note
    %
  note empty$
    'skip$
    { % Clear the stack
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.note
    }
  if$
  fin.entry
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % (translated) article or chapter in report
    %
FUNCTION {intechreport}
{ author empty$
        %
        % no author: title serves as author.
        % title formatted as article title (APA manual not consistent in this,
        % compare statement on p. 119: ``treat as book title'' and
        % example 8, p. 121: no underlining => article title)
        %
    { editor.ne.trans
        { format.atitle.trans.check }
        { format.atitle.check }
      if$
      output.new.block
      format.year.month.day.check output.dot.new.block
    }
        %
        % format author and year, and check if year is present
        % format article title and check if title or type present
        %
    { format.authors                start.new.block
      format.year.month.day.check   output.dot.new.block
      editor.ne.trans
        { format.atitle.trans.check }
        { format.atitle.check }
      if$
      output.new.block
    }
  if$
      %
      % format "In " editor " (Ed. \& Trans.), "
      % booktitle, volume, edition, pages
      %
  format.in.editors.trans
      %
      % volume, edition, report type and number, pages
      %
  "\APACbVolEdTRpgs {" format.bvol.edition.check * "} {" *
  format.tr.number *
  "} {" * pages format.bpages.check *
  "}" *
      %
  booktitle format.btitle.connect *
  add.period$
      %
      % format address and publisher
      %
  format.address.institution.check
    %
    % if not empty, insert howpublished.
    % (used if report is retrieved from the internet)
    %
  format.howpublished add.period$
      %
      % format url
      %
  url empty$
    'skip$
    { % Clear the stack
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.url
    }
  if$
      %
      % format original publication (of reprint/translation)
      % and optional note
      %
  format.orig.note
  fin.entry
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % papers presented at conferences etc.
    %
FUNCTION {lecture}
{ author empty$
    { "author" author warning.if.empty }
    { format.authors  start.new.block  }
  if$
      %
      % format year, month, and day, and check if year present
      % format title and check if title present
      % format howpublished and check if howpublished present
      %
  format.year.month.day.check output.dot.new.block
  symposium empty$
    { format.betitle.check
      title  format.btitle.connect  output.new.block
      howpublished empty$
        { "symposium and howpublished missing in " cite$ * warning$
          ""
        }
        { "\APAChowpublished {" howpublished * "}" * }
      if$
      address connect.with.comma.check
    }
    { format.atitle.type.check output.new.block
      "\BIn{} "
      chair empty$
        'skip$
        { chair  format.editor.names
          chair num.names$ #1 >
            { "(\BCHAIRS)" }
            { "(\BCHAIR)" }
          if$
          connect.with.space.check * ", " *
        }
      if$
      symposium format.btitle.no.dot *
      format.howpublished
      address connect.with.comma.check
    }
  if$
  add.period$
      %
      % format url
      %
  url empty$
    'skip$
    { % Clear the stack
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.url
    }
  if$
      %
      % format optional note
      %
  note empty$
    'skip$
    { % Clear the stack
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.note
    }
  if$
  fin.entry
}

%    \end{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \paragraph{Theses}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Format thesis title, with \fieldname{type} and \fieldname{school},
% if necessary. Call with
% \begin{verbatim}
%   "default.published.thesis" "default.unpublished.thesis" format.ttitle.type.school
% \end{verbatim}
% The type now needs to be done here, and the school as well if the
% dissertation was retrieved from the internet, which we'll take to
% be the same as \fieldname{url} non-empty. Note that \pkg{apacite}
% cannot distinguish between institutional databases (ex.~41 in the
% 6th ed.\ of the APA manual) and ordinary websites (ex.~42), so the
% user should provide the \fieldname{school} if it's necessary but
% not otherwise. If both \fieldname{url} and \fieldname{howpublished}
% are empty, the type is taken to be the unpublished thesis type
% (unless overridden by the \fieldname{type} field); otherwise, the
% published type is used (unless overridden).
%    \begin{macrocode}
FUNCTION {format.ttitle.type.school}
{ doi empty$ not
  url empty$ not or
  howpublished empty$ not or
    { pop$ }
    { swap$ pop$ }
  if$
%    \end{macrocode}
% Single out the situation in which |type = {\bibnotype}|, i.e.,
% no type.
%    \begin{macrocode}
  type empty$
    'skip$
    { type "\bibnotype" =
        { pop$
          ""
        }
        { pop$
          type
        }
      if$
    }
  if$
%    \end{macrocode}
% The desired type is on top of the stack. Build \LaTeX{} command.
%    \begin{macrocode}
  duplicate$ empty$
  doi empty$
    url empty$ and
    howpublished empty$ and
  address empty$
    school empty$ and or and
    { 'pop$
      title empty$ not
      englishtitle empty$ not or
        { start.new.block }
        'skip$
      if$
      ""
    }
    { start.new.block
      "\APACtypeAddressSchool {" swap$ * "}{" *
%    \end{macrocode}
% If unpublished, school and location are listed in the next block.
%    \begin{macrocode}
      doi empty$
      url empty$ and
      howpublished empty$ and
        { "}{}" * }
        { address "" connect.check "}{" *
          school  "" connect.check "}" *
        }
      if$
    }
  if$
%    \end{macrocode}
% Format english translation of title, if present, title itself, and
% connect everything.
%    \begin{macrocode}
  format.betitle.check swap$
  connect.with.space.check
  "title" title warning.if.empty
  title  format.btitle.connect
}
%    \end{macrocode}
% Block that indicates school and location for unpublished theses.
%    \begin{macrocode}
FUNCTION {unpub.address.school.block}
%    \end{macrocode}
% Determine whether this is an unpublished thesis (no \fieldname{url},
% \fieldname{doi}, or \fieldname{howpublished}.
%    \begin{macrocode}
{ doi empty$
  url empty$ and
  howpublished empty$ and
%    \end{macrocode}
% If so, there should be a \fieldname{school}, so issue a warning if
% it's empty.
%    \begin{macrocode}
    { "school" school warning.if.empty
      school empty$
      address empty$ and
        'skip$
        { start.new.block
          "\APACaddressSchool {" address "" connect.check "}{" *
          school "" connect.check "}" *
          output.dot.end.block
        }
      if$
    }
%    \end{macrocode}
% Do nothing if it's not an unpublished thesis.
%    \begin{macrocode}
    'skip$
  if$
}
%    \end{macrocode}
% Format theses. Call with
% \begin{verbatim}
%   "default.published.thesis" "default.unpublished.thesis" thesis
% \end{verbatim}
%    \begin{macrocode}
FUNCTION {thesis}
%    \end{macrocode}
% DAI and similar are now formatted purely as articles, so remove
% the two default types on top of the stack and redirect to the
% |article| function.
%    \begin{macrocode}
{ journal empty$ not
    { pop$ pop$
      article
    }
    { author empty$
        { "author" author warning.if.empty }
        { format.authors  start.new.block  }
      if$
%    \end{macrocode}
% Check if \fieldname{year} is present and format year. Ditto for
% \fieldname{title} with \fieldname{type} (and \fieldname{school}
% if the dissertation was obtained from a website).
%    \begin{macrocode}
      format.year.check          output.dot.end.block
      format.ttitle.type.school  output.dot.end.block
%    \end{macrocode}
% Put name of institution (\fieldname{school}) and its address here if
% it's an unpublished thesis.
%    \begin{macrocode}
      unpub.address.school.block
%    \end{macrocode}
% If not empty, insert \fieldname{howpublished}. This is used if the
% thesis was retrieved from a database.
%    \begin{macrocode}
      howpublished.block
%    \end{macrocode}
% Format \fieldname{url}, in case the thesis was downloaded from a
% webpage, optional \fieldname{note}, and finalize with the standard
% parts (\fieldname{doi}, back references).
%    \begin{macrocode}
      url.block
      note.block
      fin.entry.2
    }
  if$
}
%    \end{macrocode}
% PhD theses and master's these, respectively. These set the default
% published and unpublished thesis types and then call |thesis|.
%    \begin{macrocode}
FUNCTION {phdthesis}
{ "\BPhD"  "\BUPhD"  thesis }
FUNCTION {mastersthesis}
{ "\BMTh"  "\BUMTh"  thesis }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                        OTHER                              %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % title of something (used in unpublished and misc)
    % english translation of title
    % type and number of something
    %
FUNCTION {format.btitle.type.num}
{ format.betitle.check
  format.bvol.edition  connect.with.space.check
  format.type.number
  connect.with.space.check
  title empty$
    { add.period$ }
    { title format.btitle.connect }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % title of message or software-related thing (used in misc)
    % english translation of title
    % type and number of something
    %
FUNCTION {format.mtitle.type.num}
{ format.aetitle.check
  format.bvol.edition  connect.with.space.check
  type.2 "\bibmessage" =
    { number empty$
        'skip$
        { type.2 number tie.or.space.connect
          bracket.check
          connect.with.space.check
        }
      if$
    }
    { format.type.number
      connect.with.space.check
    }
  if$
  title empty$
    { add.period$ }
    { title format.atitle.connect }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % title, english translation of title,
    % type and number of something (used in misc)
    %
FUNCTION {output.misctitle.type.num}
{ type.2 empty$
    { format.btitle.type.num }
    { type.2 "\bibmessage"                    =
      type.2 "\bibcomputerprogram"            =  or
      type.2 "\bibcomputerprogrammanual"      =  or
      type.2 "\bibcomputerprogramandmanual"   =  or
      type.2 "\bibcomputersoftware"           =  or
      type.2 "\bibcomputersoftwaremanual"     =  or
      type.2 "\bibcomputersoftwareandmanual"  =  or
      type.2 "\bibprogramminglanguage"        =  or
        { format.mtitle.type.num }
        { format.btitle.type.num }
      if$
    }
  if$
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % unpublished manuscripts, etc.
    %
FUNCTION {unpublished}
{ check.relevant.fields
  author empty$
        %
        % no author: possibly edited book with editors as authors
        %
    { editor empty$
            %
            % no author or editor: title serves as author.
            % title formatted as book title
            %
        { format.btitle.type.num       output.new.block
          format.year.month.day.check  add.period$
        }
            %
            % format editor and year, and check if year is present
            % format book title, volume, and edition and check if title present
            %
        { format.editors.as.authors    start.new.block
          format.year.month.day.check  output.dot.new.block
          format.btitle.type.num
        }
      if$
    }
        %
        % format author and year, and check if year is present
        % format book title, volume, and edition
        % and check if title or type present
        %
    { format.authors               start.new.block
      format.year.month.day.check  output.dot.new.block
      format.btitle.type.num
    }
  if$
  howpublished empty$
  organization empty$ and
  address      empty$ and
    'skip$
    { output.new.block
      "\APAChowpublished{" "}" howpublished enclose.check
      organization    connect.with.comma.check
      address         connect.with.comma.check
      add.period$
    }
  if$
      %
      % format url
      %
  url empty$
    'skip$
    { % Clear the stack
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.url
    }
  if$
      %
      % format optional note
      %
  note empty$
    'skip$
    { % Clear the stack
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.note
    }
  if$
  fin.entry
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % nonprint media and other things that don't fit
    %
FUNCTION {misc}
{   %
    % To handle @manual: use type.2 instead of type.
  type.2 empty$
  type   empty$ not and
    { type 'type.2 := }
    'skip$
  if$
    %
  author empty$
        %
        % no author: possibly edited item with editors as authors
        %
    { editor empty$
            %
            % no author or editor: title/type serves as author.
            % title formatted as book title
            %
            % if no title and no type, howpublished is title
            %
        { title  empty$
          type.2 empty$ and
            { howpublished empty$
                { "No author, editor, title, type, and howpublished in "
                  cite$ * warning$
                  ""
                }
                { "\APAChowpublished{" howpublished * "}" * add.period$ }
              if$
              format.year.month.day.check  add.period$
            }
            { output.misctitle.type.num    output.new.block
              format.year.month.day.check  add.period$
              format.howpublished          add.period$
            }
          if$
        }
            %
            % format editor and year, and check if year is present
            % format book title, volume, and edition and check if title present
            %
        { format.editors.as.authors        start.new.block
          format.year.month.day.check      output.dot.new.block
          output.misctitle.type.num
          format.howpublished              add.period$
        }
      if$
    }
        %
        % format author and year, and check if year is present
        % format book title, volume, and edition
        % and check if title or type present
        %
    { format.authors                   start.new.block
      format.year.month.day.check      output.dot.new.block
      output.misctitle.type.num
      format.howpublished              add.period$
    }
  if$
      %
  address   empty$
  publisher empty$ and
      'skip$
      { % Clear the stack
        duplicate$ empty$
          'skip$
          { output.new.block }
        if$
        format.address.publisher add.period$
      }
  if$
      %
      % format url
      %
  url empty$
    'skip$
    { % Clear the stack
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.url
    }
  if$
      %
      % format optional note
      %
  note empty$
    'skip$
    { % Clear the stack
      duplicate$ empty$
        'skip$
        { output.new.block }
      if$
      format.note
    }
  if$
  fin.entry
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % for legal cases and other cases that need to be
    % done by hand
    %
FUNCTION {literal}
{ "key"  key  warning.if.empty
  "text" text warning.if.empty
  text empty$
    { "" }
    { text }
  if$
  fin.entry
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % technical documentation
    %
FUNCTION {manual}
{ %
  % If type is empty, assume that it is a computer software manual.
  %
  type empty$
    { "\bibcomputersoftwaremanual"  'type.2 := }
    'skip$
  if$
  misc
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % booklet
    %
FUNCTION {booklet}
{ misc }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % part of a book
    %
FUNCTION {inbook}
{ incollection }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % article in proceedings
    %
FUNCTION {inproceedings}
{ incollection }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % article in proceedings (Kopka & Daly, 2004, p. 230)
    %
FUNCTION {conference}
{ inproceedings }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % proceedings
    %
FUNCTION {proceedings}
{ misc }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % unknown types
    %
FUNCTION {default.type}
{ misc }

%    \end{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Initialization functions}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This currently only defines the maximum number of names to be
% formatted and this is not even used. This is something that I may
% want to revisit in order to make it more flexible.
%    \begin{macrocode}
FUNCTION {initialize}
{
  #6  'name.max :=
%%  #250  'entry.max$ :=
%%  #5000  'global.max$ :=
}
%    \end{macrocode}
% For numbering the entries according to current sorting order.
%    \begin{macrocode}
FUNCTION {init.old.number}
{ #0  'old.number := }
%    \end{macrocode}
% For comparing labels across entries.
%    \begin{macrocode}
FUNCTION {init.old.label}
{ "zzzzzz"   'old.label  := }
%    \end{macrocode}
% For all entries, initialize flags whether initials must be cited and
% whether an `a', `b', etc.\ needs to be added to the year. Both are
% initialized as not needed.
%    \begin{macrocode}
FUNCTION {init.cite.initials.add.to.year}
{ #0  'cite.initials :=
  #0  'add.to.year :=
}
%    \end{macrocode}
% Functions that indicate whether we're moving forward (|ITERATE|) or
% backward (|REVERSE|) through the entry list.
%    \begin{macrocode}
FUNCTION {move.forward}
{ #1 'forward := }
FUNCTION {move.backward}
{ #0 'forward := }
%    \end{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Basic bibliography output functions}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Beginning of the \envirname{thebibliography} environment: Write
% preamble if there is one, write |\begin| command.
%    \begin{macrocode}
FUNCTION {begin.bib}
{ preamble$ empty$
    'skip$
    { preamble$ write$ newline$ }
  if$
  "\begin{thebibliography}{}"  write$ newline$
}
%    \end{macrocode}
% Write |\end{thebibliography}| command.
%    \begin{macrocode}
FUNCTION {end.bib}
{ newline$
  "\end{thebibliography}"  write$ newline$
}
%    \end{macrocode}
% Write the citation labels and reference list entry to the
% \fname{.bbl} file.
%    \begin{macrocode}
FUNCTION {write.bbl.entry}
{
%    \end{macrocode}
% Output \cmd{\bibitem} and \cmd{\citeauthoryear} commands.
%    \begin{macrocode}
  make.cite.labels
%    \end{macrocode}
% Format and output reference list entry.
%    \begin{macrocode}
  call.type$
}
%    \end{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Read and process entries and make the bibliography}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Read citations from \fname{.aux} file and extract corresponding
% entries from \fname{.bib} file.
%    \begin{macrocode}
READ
%    \end{macrocode}
% Write version info to \fname{.blg} file.
%    \begin{macrocode}
EXECUTE { identify.apacite.version }
%    \end{macrocode}
% Some initializations.
%    \begin{macrocode}
EXECUTE { initialize }
%    \end{macrocode}
% Store the citation order in an integer variable, and a corresponding
% string variable that can be used for sorting.
%    \begin{macrocode}
EXECUTE { init.old.number }
ITERATE { make.citeorder.number }
%    \end{macrocode}
% Sort items by title in order to replace each title by its number in
% later sorting.
%    \begin{macrocode}
ITERATE { make.sort.title }
SORT
EXECUTE { init.old.number }
EXECUTE { init.old.label }
ITERATE { make.title.number }
%    \end{macrocode}
% Generate some tentative author-year labels and do some
% preprocessing for the later definitive author and year labels.
%    \begin{macrocode}
ITERATE { make.tentative.sort.label }
SORT
%    \end{macrocode}
% Check whether initials must be added to first author, how many
% authors must be formatted, whether an `a', `b', etc., must be added
% to the year label.
%    \begin{macrocode}
ITERATE { init.cite.initials.add.to.year }
EXECUTE { init.initials }
ITERATE { check.add.initials }
EXECUTE { init.initials }
REVERSE { check.add.initials }
ITERATE { tentative.cite.num.names }
EXECUTE { init.cite.num.names }
EXECUTE { move.forward }
ITERATE { definitive.cite.num.names }
EXECUTE { init.cite.num.names }
EXECUTE { move.backward }
REVERSE { definitive.cite.num.names }
%    \end{macrocode}
% Make final sorting label and do definitive sorting.
%    \begin{macrocode}
ITERATE { make.final.sort.key }
SORT
%    \end{macrocode}
% Write preamble and |\begin{thebibliography}{}| statement.
%    \begin{macrocode}
EXECUTE { begin.bib }
%    \end{macrocode}
% Make final cite labels, format reference list entry, and write to
% \fname{.bbl} file.
%    \begin{macrocode}
ITERATE { write.bbl.entry }
%    \end{macrocode}
% Write |\end{thebibliography}| statement.
%    \begin{macrocode}
EXECUTE { end.bib }

%</bibstyle|xbibstyle>
%    \end{macrocode}
%
%
% \Finale
\endinput
%
