%% apa.cbx v2.4 %% Copyright 2010 Philip Kime %% %% This work 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. %% %% This work has the LPPL maintenance status `maintained'. %% %% The Current Maintainer of this work is Philip Kime. %% %% This work consists of the files: %% %% apa.cbx (biblatex citation style) %% apa.bbx (biblatex references style) %% *.lbx (localisation files for APA-specific strings) %% biblatex-apa.pdf (Style documentation) %% biblatex-apa.tex (Style documentation source) %% biblatex-apa-test.pdf (Style examples) %% biblatex-apa-test.tex (Style examples source) %% biblatex-apa-test-citations.bib (Style examples - citations) %% biblatex-apa-test-references.bib (Style examples - references) \ProvidesFile{apa.cbx} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (APA 6.16) year postfix is not emphasised or italic \DeclareFieldFormat{extrayear}{\mknumalph{#1}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (APA 6.11) requires comma separator between authors and years \renewcommand*{\nameyeardelim}{\addcomma\space} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (APA 6.12) ampersand separator in parenthetical cites \DeclareCiteCommand{\parencite}[\mkbibparens] {\renewcommand{\finalnamedelim}{\ifnum\value{liststop}>2 \finalandcomma\fi\addspace\&\space}% \usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \usebibmacro{cite}} {} {\usebibmacro{postnote}} \DeclareCiteCommand*{\parencite}[\mkbibparens] {\renewcommand{\finalnamedelim}{\ifnum\value{liststop}>2 \finalandcomma\fi\addspace\&\space}% \usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \usebibmacro{citeyear}} {} {\usebibmacro{postnote}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (APA 6.12) 3-5 authors have "et al." after first cite. This doesn't % work properly in general with disambiguation of "et al"s % due to BibTeX limitations, see docs. % #1 = last name % #2 = last name (initials) % #3 = first name % #4 = first name (initials) % #5 = name prefix, a.k.a. 'von part' % #6 = name prefix (initials) % #7 = name affix, a.k.a. 'junior part' % #8 = name affix (initials) \newbibmacro*{labelname:doname}[8]{% \ifcase\value{uniquename}% \usebibmacro{name:last}{#1}{#3}{#5}{#7}% \or \usebibmacro{name:first-last}{#1}{#4}{#5}{#8}% \or \usebibmacro{name:first-last}{#1}{#3}{#5}{#7}% \fi \usebibmacro{name:andothers}} \DeclareNameFormat{labelname}{% \ifthenelse{\value{listcount}=1\OR\value{listtotal}=2} {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}} {\ifthenelse{\value{listtotal}>5} {\ifnum\value{listcount}=2 \andothersdelim\bibstring{andothers}\fi \ifnum\value{listcount}>2 \relax\fi} {\ifciteseen {\ifnum\value{listcount}=2 \andothersdelim\bibstring{andothers}\fi \ifnum\value{listcount}=3 \relax\fi \ifnum\value{listcount}=4 \relax\fi \ifnum\value{listcount}=5 \relax\fi} {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%% % (APA 6.13) Groups as names % SHORTAUTHOR brackets in parencites \DeclareNameFormat{sabrackets}{\ifciteseen {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}} {\mkbibbrackets{\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}} \DeclareFieldFormat{shorthand}{\ifciteseen {#1} {\mkbibbrackets{#1}}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (APA 6.13) Deal with SHORTAUTHOR fields % (APA 6.16) Multiple same author cites in a compact citation call do not % need to be repeated but the full years must be repeated with % their extrayear postfixes % "in press" extrayear needs a short dash to join to label % (APA 6.28) If no date, use "(n.d.)" % (APA 6.18) Cite ORIGYEAR/YEAR if ORIGYEAR present \newbibmacro*{cite}{% \iffieldequals{namehash}{\cbx@lasthash} % Multiple cites in one command {\setunit{\compcitedelim}% \printtext[bibhyperref]{\usebibmacro{cite:plabelyear+extrayear}}}% % Single cite {\ifthenelse{\ifnameundef{labelname}\OR\equal{\thefield{entrytype}}{patent}} % No author/editor {\printtext[bibhyperref]{% \usebibmacro{cite:noname}% \setunit{\nameyeardelim}% \iffieldundef{labelyear} {\usebibmacro{cite:noyear}} {\usebibmacro{cite:plabelyear+extrayear}% \savefield{namehash}{\cbx@lasthash}}}} % Normal cite {\cbx@tempa \printtext[bibhyperref]{% \ifnameundef{shortauthor} {\printnames{labelname}} {\ifciteseen {\printnames{shortauthor}} {\printnames{author}\addspace\printnames[sabrackets]{shortauthor}}}% \setunit{\nameyeardelim}% \iffieldundef{labelyear} {\usebibmacro{cite:noyear}} {\usebibmacro{cite:plabelyear+extrayear}% \savefield{namehash}{\cbx@lasthash}}% \global\let\cbx@tempa=\multicitedelim}}}} \newbibmacro*{textcite}{% \iffieldequals{namehash}{\cbx@lasthash} % Compact cite - more than one thing for same author {\compcitedelim% \printtext[bibhyperref]{\bibopenparen\usebibmacro{cite:plabelyear+extrayear}\bibcloseparen\global\boolfalse{cbx:parens}}} % Single cite {\cbx@tempa \printtext[bibhyperref]{% \ifthenelse{\ifnameundef{labelname}\OR\equal{\thefield{entrytype}}{patent}} % No author/editor or patent {\iffieldundef{shorthand}% % Cite using title {\usebibmacro{cite:noname}% \setunit{\ifbool{cbx:np}% {\nameyeardelim}% {\global\booltrue{cbx:parens}\addspace\bibopenparen}}% \usebibmacro{cite:plabelyear+extrayear}\bibcloseparen\global\boolfalse{cbx:parens}} % Cite using shorthand {\usebibmacro{cite:shorthand}}} % Normal cite with author/editor % Normal full cite {\ifnameundef{shortauthor}% % Normal full cite {\printnames{labelname}} % Cite using short author {\ifciteseen {\printnames{shortauthor}} {\printnames{author}}}% % Year \setunit{\ifbool{cbx:np} {\nameyeardelim} {\global\booltrue{cbx:parens}\addspace\bibopenparen}}% % Put the shortauthor inside the year brackets if necessary \ifnameundef{shortauthor} {} {\ifciteseen {} {\printnames{shortauthor}\setunit{\nameyeardelim}}}% \iffieldundef{labelyear}% {\usebibmacro{cite:noyear}% \ifbool{cbx:parens} {\bibcloseparen\global\boolfalse{cbx:parens}} {}} % Actual year printing {\usebibmacro{cite:plabelyear+extrayear}% \iffieldundef{postnote} {} % Postnote printing {\postnotedelim\printfield{postnote}}% \ifbool{cbx:parens} {\bibcloseparen\global\boolfalse{cbx:parens}} {}}% \savefield{namehash}{\cbx@lasthash}}}}% \global\let\cbx@tempa=\multicitedelim} \newcommand{\apashortdash}{-} \newbibmacro*{cite:plabelyear+extrayear}{% \iffieldundef{labelyear} {} {\printfield[noformat]{origyear}\setunit*{\addslash}% \printfield{labelyear}% \iffieldequalstr{labelyear}{in press} {\iffieldundef{extrayear} {\setunit{\relax}} {\setunit{\apashortdash}}% \printfield{extrayear}} {\printfield{extrayear}}}}% \newbibmacro*{cite:shorthand}{% \ifciteseen {\printfield{shorthand}} {\printnames{labelname}% \setunit{\nameyeardelim}% \printfield{title}\space\printfield{shorthand}}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (APA 6.15) Fall back to title for citations without authors \DeclareFieldFormat{citetitle}{\mkbibquote{#1}} \DeclareFieldFormat[book]{citetitle}{\mkbibemph{#1}} \DeclareFieldFormat[inbook]{citetitle}{\mkbibemph{#1}} \DeclareFieldFormat[report]{citetitle}{\mkbibemph{#1}} \DeclareFieldFormat[periodical]{citetitle}{\mkbibemph{#1}} \DeclareFieldFormat[patent]{citetitle}{#1} \newbibmacro*{cite:noname}{% \printfield[citetitle]{labeltitle}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (APA 6.22) Fall back to "n.d." for citations without dates % Strings defined in apa.bbx \newbibmacro*{cite:noyear}{% \ifnameundef{shortauthor} {} {\ifciteseen {} {\printnames{shortauthor}\setunit{\nameyeardelim}}}% \printtext{\biblcstring{nodate}}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (APA 6.21) No parens round year for cites when the cite is in % parentheses. Use new command \nptextcite for such cites. \DeclareMultiCiteCommand{\nptextcites}{\nptextcite}{\multicitedelim} \DeclareCiteCommand{\nptextcite} {\renewcommand{\finalnamedelim}{\ifnum\value{liststop}>2 \finalandcomma\fi\addspace\&\space}% \usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \global\booltrue{cbx:np}% \usebibmacro{textcite}% \global\boolfalse{cbx:np}}% {} {\iffieldundef{postnote} {} {\nameyeardelim \printfield{postnote}}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % No shorthand % \newbibmacro*{citeyear}{% \iffieldundef{labelyear} {\cbx@tempa \usebibmacro{cite:noyear}% \usebibmacro{cite:init}} {\iffieldequals{namehash}{\cbx@lasthash} {\setunit{\compcitedelim}% \usebibmacro{cite:labelyear+extrayear}} {\cbx@tempa \usebibmacro{cite:labelyear+extrayear}% \savefield{namehash}{\cbx@lasthash}}} \global\let\cbx@tempa=\multicitedelim} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newbool{cbx:parens} % boolean to say we're inside parens \newbool{cbx:np} % boolean to say we're using a non-parentheses text cite \newbibmacro*{cite:init}{% \global\boolfalse{cbx:parens}% \global\let\cbx@tempa=\empty \global\undef\cbx@lasthash} \newbibmacro*{cite:labelyear}{% \printfield{labelyear}} \newbibmacro*{cite:extrayear}{% \printfield{extrayear}} \newbibmacro*{cite:labelyear+extrayear}{% \iffieldundef{labelyear} {} {\printfield{labelyear}% \printfield{extrayear}}} \DeclareCiteCommand{\citeyear} {\boolfalse{citetracker}% \boolfalse{pagetracker}% \usebibmacro{prenote}} {\usebibmacro{cite:labelyear+extrayear}} {\multinamedelim} {\usebibmacro{postnote}} \DeclareCiteCommand{\cite} {\usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \usebibmacro{cite}} {} {\usebibmacro{postnote}} \DeclareCiteCommand*{\cite} {\usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \usebibmacro{citeyear}} {} {\usebibmacro{postnote}} \DeclareCiteCommand{\footcite}[\mkbibfootnote] {\bibsentence \usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \usebibmacro{cite}} {} {\usebibmacro{postnote}} \DeclareCiteCommand{\textcite} {\usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \usebibmacro{textcite}} {} {} \endinput