diff options
author | Karl Berry <karl@freefriends.org> | 2010-03-08 01:16:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-03-08 01:16:47 +0000 |
commit | f8781b660c74ce51709b40d75de1d58597a54eaa (patch) | |
tree | bc5c72c372ceaa786bd6bb29c543306aa9e87dfe /Master/texmf-dist/tex/latex/biblatex-apa/apa.cbx | |
parent | 4e7ace252f5bb59a3813d0d829a5343667755499 (diff) |
biblatex-apa .09 (7mar10)
git-svn-id: svn://tug.org/texlive/trunk@17375 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex-apa/apa.cbx')
-rw-r--r-- | Master/texmf-dist/tex/latex/biblatex-apa/apa.cbx | 389 |
1 files changed, 389 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex-apa/apa.cbx b/Master/texmf-dist/tex/latex/biblatex-apa/apa.cbx new file mode 100644 index 00000000000..da1b4b5621b --- /dev/null +++ b/Master/texmf-dist/tex/latex/biblatex-apa/apa.cbx @@ -0,0 +1,389 @@ +%% apa.cbx +%% 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}% + \printtext[bibhyperref]{\usebibmacro{cite}}} + {} + {\usebibmacro{postnote}} + +\DeclareCiteCommand*{\parencite}[\mkbibparens] + {\renewcommand{\finalnamedelim}{\ifnum\value{liststop}>2 \finalandcomma\fi\addspace\&\space}% + \usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \printtext[bibhyperref]{\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." without parentheses and with a comma +% and space before. +% (APA 6.18) Cite ORIGYEAR/YEAR if ORIGYEAR present + +\newbibmacro*{cite}{% + \iffieldequals{namehash}{\cbx@lasthash} +% Multiple cites in one command + {\setunit{\compcitedelim}% + \usebibmacro{cite:plabelyear+extrayear}}% +% Single cite + {\ifthenelse{\ifnameundef{labelname}\OR\equal{\thefield{entrytype}}{patent}} +% No author/editor + {\usebibmacro{cite:noname}% + \setunit{\nameyeardelim}% + \iffieldundef{labelyear} + {\usebibmacro{cite:noyear}} + {\usebibmacro{cite:plabelyear+extrayear}% + \savefield{namehash}{\cbx@lasthash}}} +% Normal cite + {\cbx@tempa + \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 + {\setunit{\compcitedelim}% + \usebibmacro{cite:plabelyear+extrayear}} +% Single cite + {\cbx@tempa + \ifthenelse{\ifnameundef{labelname}\OR\equal{\thefield{entrytype}}{patent}} + % No author/editor or patent + {\iffieldundef{shorthand} + % Cite using title + {\usebibmacro{cite:noname}% + \setunit{\global\booltrue{cbx:parens}\addspace\bibleftparen}% + \usebibmacro{cite:plabelyear+extrayear}} + % 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{\iffieldundef{labelyear} + {\nameyeardelim} + {\global\booltrue{cbx:parens}\addspace\bibleftparen}} + % Put the shortauthor inside the year brackets if necessary + \ifnameundef{shortauthor} + {} + {\ifciteseen + {} + {\printnames{shortauthor}\setunit{\nameyeardelim}}}% + \iffieldundef{labelyear}% + {\usebibmacro{cite:noyear}}% + {\usebibmacro{cite:plabelyear+extrayear}}% + \savefield{namehash}{\cbx@lasthash}}}% + \gdef\cbx@tempa{\ifbool{cbx:parens} + {\bibrightparen\global\boolfalse{cbx:parens}} + {}% + \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[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. + +\DeclareCiteCommand{\nptextcite} + {\renewcommand{\finalnamedelim}{\ifnum\value{liststop}>2 \finalandcomma\fi\addspace\&\space}% + \usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \printtext[bibhyperref]{\usebibmacro{nptextcite}}} + {} + {\iffieldundef{postnote} + {} + {\ifbool{cbx:parens} + {\postnotedelim} + {\nameyeardelim}% + \printfield{postnote}}} + +\newbibmacro*{nptextcite}{% + \iffieldequals{namehash}{\cbx@lasthash} + {\setunit{\compcitedelim}% + \usebibmacro{cite:plabelyear+extrayear}} + {\cbx@tempa + \ifthenelse{\ifnameundef{labelname}\OR\equal{\thefield{entrytype}}{patent}} + {\usebibmacro{cite:noname}% + \setunit{% + \global\booltrue{cbx:parens}% + \nameyeardelim}% + \usebibmacro{cite:plabelyear+extrayear}} + {\printnames{labelname}% + \setunit{% + \global\booltrue{cbx:parens}% + \nameyeardelim}% + \iffieldundef{labelyear} + {\usebibmacro{cite:noyear}} + {\usebibmacro{cite:plabelyear+extrayear}}}% + \savefield{namehash}{\cbx@lasthash}}% + \gdef\cbx@tempa{% + \ifbool{cbx:parens} + {\addcomma\global\boolfalse{cbx:parens}} + {}% + \multicitedelim}} + +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% 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} + +\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{\cite} + {\usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \printtext[bibhyperref]{\usebibmacro{cite}}} + {} + {\usebibmacro{postnote}} + +\DeclareCiteCommand*{\cite} + {\usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \printtext[bibhyperref]{\usebibmacro{citeyear}}} + {} + {\usebibmacro{postnote}} + +\DeclareCiteCommand{\footcite}[\mkbibfootnote] + {\bibsentence + \usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \printtext[bibhyperref]{\usebibmacro{cite}}} + {} + {\usebibmacro{postnote}} + +\DeclareCiteCommand{\textcite} + {\usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \printtext[bibhyperref]{\usebibmacro{textcite}}} + {} + {\iffieldundef{postnote} + {\ifbool{cbx:parens} + {\bibrightparen} + {}} + {\ifbool{cbx:parens} + {\postnotedelim} + {\addspace\bibleftparen}% + \printfield{postnote}\bibrightparen}} + +\endinput |