diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex-apa/apa.cbx')
-rw-r--r-- | Master/texmf-dist/tex/latex/biblatex-apa/apa.cbx | 129 |
1 files changed, 90 insertions, 39 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex-apa/apa.cbx b/Master/texmf-dist/tex/latex/biblatex-apa/apa.cbx index 1f6f4cfc5c7..f5c608ccb12 100644 --- a/Master/texmf-dist/tex/latex/biblatex-apa/apa.cbx +++ b/Master/texmf-dist/tex/latex/biblatex-apa/apa.cbx @@ -1,4 +1,4 @@ -%% Copyright 2013 Philip Kime +%% Copyright 2016 Philip Kime %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -12,7 +12,7 @@ %% %% The Current Maintainer of this work is Philip Kime. -\ProvidesFile{apa.cbx}[2015/01/23\space v6.7\space APA biblatex citation style] +\ProvidesFile{apa.cbx}[2016/03/01\space v6.8\space APA biblatex citation style] \RequireBiber[3] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -72,31 +72,22 @@ % (APA 6.12) 3-5 authors have "et al." after first cite % (Blog http://blog.apastyle.org/apastyle/2014/01/when-to-use-author-initials-for-text-citations.html) Initials only for primary author -% #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]{% \ifnumcomp{\value{listcount}}{>}{1} {\setcounter{uniquename}{0}} {}% \ifcase\value{uniquename}% \ifuseprefix - {\usebibmacro{name:last}{#1}{#3}{#5}{}} - {\usebibmacro{name:last}{#1}{#3}{}{}}% + {\usebibmacro{name:family}{#1}{#3}{#5}{}} + {\usebibmacro{name:family}{#1}{#3}{}{}}% \or - \ifuseprefix - {\usebibmacro{name:first-last}{#1}{#4}{#5}{}} - {\usebibmacro{name:first-last}{#1}{#4}{}{}}% + \ifuseprefix + {\usebibmacro{name:given-family}{#1}{#4}{#5}{}} + {\usebibmacro{name:given-family}{#1}{#4}{}{}}% \or - \ifuseprefix - {\usebibmacro{name:first-last}{#1}{#3}{#5}{}} - {\usebibmacro{name:first-last}{#1}{#3}{}{}}% + \ifuseprefix + {\usebibmacro{name:given-family}{#1}{#3}{#5}{}} + {\usebibmacro{name:given-family}{#1}{#3}{}{}}% \fi \usebibmacro{name:andothers}} @@ -113,16 +104,33 @@ % all of the names in the list to work on here \DeclareNameFormat{labelname}{% + \nameparts{#1}% \ifthenelse{\value{uniquelist}>1} {\numdef\cbx@min{\value{uniquelist}}} {\numdef\cbx@min{\value{minnames}}}% \ifboolexpr{test {\ifnumcomp{\value{listcount}}{=}{1}} or test {\ifnumcomp{\value{listtotal}}{=}{2}}} - {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}} + {\usebibmacro{labelname:doname}% + {\namepartfamily}% + {\namepartfamilyi}% + {\namepartgiven}% + {\namepartgiveni}% + {\namepartprefix}% + {\namepartprefixi}% + {\namepartsuffix}% + {\namepartsuffixi}} {\ifboolexpr{test {\ifnumcomp{\value{listtotal}}{>}{5}} or test {\ifciteseen}} {\ifnumcomp{\value{listcount}}{<}{\cbx@min + 1}% normal name - {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}% + {\usebibmacro{labelname:doname}% + {\namepartfamily}% + {\namepartfamilyi}% + {\namepartgiven}% + {\namepartgiveni}% + {\namepartprefix}% + {\namepartprefixi}% + {\namepartsuffix}% + {\namepartsuffixi}} {}% \ifnumcomp{\value{listcount}}{=}{\cbx@min + 1}% first past ul is et al % but enforce plurality of et al - only truncate here if there is at @@ -130,12 +138,28 @@ % so that "et al" covers at least two elements. {\ifnumcomp{\value{listcount}}{<}{\value{listtotal}} {\andothersdelim\bibstring{andothers}} - {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}% + {\usebibmacro{labelname:doname}% + {\namepartfamily}% + {\namepartfamilyi}% + {\namepartgiven}% + {\namepartgiveni}% + {\namepartprefix}% + {\namepartprefixi}% + {\namepartsuffix}% + {\namepartsuffixi}}} {}% \ifnumcomp{\value{listcount}}{>}{\cbx@min + 1}% nothing thereafter {\relax}% {}}% - {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}} + {\usebibmacro{labelname:doname}% + {\namepartfamily}% + {\namepartfamilyi}% + {\namepartgiven}% + {\namepartgiveni}% + {\namepartprefix}% + {\namepartprefixi}% + {\namepartsuffix}% + {\namepartsuffixi}}}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -144,9 +168,27 @@ % (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}}}} +\DeclareNameFormat{sabrackets}{% + \nameparts{#1}% + \ifciteseen + {\usebibmacro{labelname:doname}% + {\namepartfamily}% + {\namepartfamilyi}% + {\namepartgiven}% + {\namepartgiveni}% + {\namepartprefix}% + {\namepartprefixi}% + {\namepartsuffix}% + {\namepartsuffixi}} + {\mkbibbrackets{\usebibmacro{labelname:doname}% + {\namepartfamily}% + {\namepartfamilyi}% + {\namepartgiven}% + {\namepartgiveni}% + {\namepartprefix}% + {\namepartprefixi}% + {\namepartsuffix}% + {\namepartsuffixi}}}} \DeclareFieldFormat{shorthand}{\ifciteseen {#1} @@ -166,12 +208,12 @@ \def\citeresetapa{\global\let\cbx@apa@names\@empty} \citeresetapa \def\cbx@apa@ifnamesaved{% - \xifinlist{\thefield{namehash}}{\cbx@apa@names} + \xifinlist{\thefield{fullhash}}{\cbx@apa@names} {\@firstoftwo} {\@secondoftwo}} \newbibmacro*{cite:author}{% - \iffieldequals{namehash}{\cbx@lasthash} + \iffieldequals{fullhash}{\cbx@lasthash} % Multiple cites in one command {\setunit{\compcitedelim}% \usebibmacro{cite:plabelyear+extrayear}}% @@ -179,18 +221,27 @@ {\ifthenelse{\ifnameundef{labelname}\OR\iffieldequalstr{entrytype}{patent}} % No author/editor {\usebibmacro{cite:noname}% - \savefield{namehash}{\cbx@lasthash}} + \savefield{fullhash}{\cbx@lasthash}} % Normal cite {\ifnameundef{shortauthor} {\printnames[labelname][-\value{listtotal}]{labelname}}% {\cbx@apa@ifnamesaved {\printnames{shortauthor}} {\printnames[labelname][-\value{listtotal}]{author}\addspace\printnames[sabrackets]{shortauthor}}}% - \savefield{namehash}{\cbx@lasthash}}}% + \savefield{fullhash}{\cbx@lasthash}}}% \setunit{\multicitedelim}} +% Using fullhash instead of namehash otherwise we may omit namelist for +% lists which are equal only because of minnames truncation i.e: +% +% X and Y and Z (2009) +% X and W and V (2010) +% +% which have the same namehash due to minnames visibility truncation to 1 +% would be printed incorrectly as +% \cite{one, two} -> X, Y & Z 2009, 2010 \newbibmacro*{cite}{% - \iffieldequals{namehash}{\cbx@lasthash} + \iffieldequals{fullhash}{\cbx@lasthash} % Multiple cites in one command {\setunit{\compcitedelim}% \usebibmacro{cite:plabelyear+extrayear}}% @@ -200,7 +251,7 @@ {\usebibmacro{cite:noname}% \setunit{\nameyeardelim}% \usebibmacro{cite:plabelyear+extrayear}% - \savefield{namehash}{\cbx@lasthash}} + \savefield{fullhash}{\cbx@lasthash}} % Normal cite {\ifnameundef{shortauthor} {\printnames[labelname][-\value{listtotal}]{labelname}}% @@ -209,11 +260,11 @@ {\printnames[labelname][-\value{listtotal}]{author}\addspace\printnames[sabrackets]{shortauthor}}}% \setunit{\nameyeardelim}% \usebibmacro{cite:plabelyear+extrayear}% - \savefield{namehash}{\cbx@lasthash}}}% + \savefield{fullhash}{\cbx@lasthash}}}% \setunit{\multicitedelim}} \newbibmacro*{textcite}{% - \iffieldequals{namehash}{\cbx@lasthash} + \iffieldequals{fullhash}{\cbx@lasthash} % Compact cite - more than one thing for same author {\setunit{\compcitedelim}% \usebibmacro{cite:plabelyear+extrayear}} @@ -256,7 +307,7 @@ % Actual year printing \usebibmacro{cite:plabelyear+extrayear}% % Save name hash for checks later - \savefield{namehash}{\cbx@lasthash}}}} + \savefield{fullhash}{\cbx@lasthash}}}} \newbibmacro*{cite:plabelyear+extrayear}{% \iffieldundef{labelyear} @@ -325,11 +376,11 @@ \newbibmacro*{citeyear}{% \iffieldundef{labelyear} {\usebibmacro{cite:init}} - {\iffieldequals{namehash}{\cbx@lasthash} + {\iffieldequals{fullhash}{\cbx@lasthash} {\setunit{\compcitedelim}% \usebibmacro{cite:plabelyear+extrayear}} {\usebibmacro{cite:plabelyear+extrayear}% - \savefield{namehash}{\cbx@lasthash}}}% + \savefield{fullhash}{\cbx@lasthash}}}% \setunit{\multicitedelim}} % @@ -391,9 +442,9 @@ \global\undef\cbx@lasthash} \newbibmacro*{cite:post}{% - \xifinlist{\thefield{namehash}}{\cbx@apa@names} + \xifinlist{\thefield{fullhash}}{\cbx@apa@names} {} - {\listxadd{\cbx@apa@names}{\thefield{namehash}}}} + {\listxadd{\cbx@apa@names}{\thefield{fullhash}}}} \newbibmacro*{cite:labelyear}{% \printfield{labelyear}} |