我正在使用 biblatex APA 样式,并尝试更改 textcite 中倒数第二个和最后一个引用之间的分隔符。
平均能量损失
\documentclass{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage[style=spanish]{csquotes}
\usepackage[backend=biber,style=apa,sortcites]{biblatex}
\DeclareLanguageMapping{spanish}{spanish-apa}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{Atkinson1999,
author = {Atkinson, Anthony Barnes},
title = {The economic consequences of rolling back the {W}elfare {S}tate},
year = {1999},
publisher = {MIT press},
location = {Londres},
}
@Article{Atkinson1995,
author = {Atkinson, Anthony Barnes},
title = {The {W}elfare {S}tate and economic performance},
journal = {National Tax Journal},
year = {1995},
volume = {48},
number = {2},
pages = {171--198},
}
@Book{Tuning2003,
author = {Gonz{\'a}lez, Julia and Wagenaar, Robert},
title = {\emph{{T}uning {E}ducational {S}tructures in {E}urope}. Informe final. Fase 1},
year = {2003},
publisher = {Universidad de Deusto},
location = {Bilbao},
}
@Book{Tuning2006,
author = {Gonz{\'a}lez, Julia and Wagenaar, Robert},
title = {\emph{{T}uning {E}ducational {S}tructures in {E}urope}. Informe final. Fase 2},
year = {2006},
publisher = {Universidad de Deusto},
location = {Bilbao},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\textcite{Atkinson1995, Atkinson1999, Tuning2003, Tuning2006}
\printbibliography
\end{document}
基本上,我想获得
Atkinson(1995、1999)以及 González 和 Wagenaar(2003、2006)。
然而,我只能得到
Atkinson (1995, 1999), González 和 Wagenaar (2003, 2006)。
答案1
biblatex-apa
不使用\textcitedelim
,而是到处都有\compcitedelim
。为了启用 ,\textcitedelim
我们需要实现 的两遍结构,\textcite
如 中所示authoryear-icomp.cbx
。因此代码相当不错。
\documentclass{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage[style=spanish]{csquotes}
\usepackage[backend=biber,style=apa,sortcites]{biblatex}
\DeclareLanguageMapping{spanish}{spanish-apa}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{Atkinson1999,
author = {Atkinson, Anthony Barnes},
title = {The economic consequences of rolling back the {W}elfare {S}tate},
year = {1999},
publisher = {MIT press},
location = {Londres},
}
@Article{Atkinson1995,
author = {Atkinson, Anthony Barnes},
title = {The {W}elfare {S}tate and economic performance},
journal = {National Tax Journal},
year = {1995},
volume = {48},
number = {2},
pages = {171--198},
}
@Book{Tuning2003,
author = {Gonz{\'a}lez, Julia and Wagenaar, Robert},
title = {\emph{{T}uning {E}ducational {S}tructures in {E}urope}. Informe final. Fase 1},
year = {2003},
publisher = {Universidad de Deusto},
location = {Bilbao},
}
@Book{Tuning2006,
author = {Gonz{\'a}lez, Julia and Wagenaar, Robert},
title = {\emph{{T}uning {E}ducational {S}tructures in {E}urope}. Informe final. Fase 2},
year = {2006},
publisher = {Universidad de Deusto},
location = {Bilbao},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\makeatletter
% from authoryear-icomp.cbx
\renewcommand*{\iffinalcitedelim}{%
\ifnumequal{\value{textcitecount}}{\value{textcitetotal}-1}}
% from apa.cbx with only \stepcounter{textcitecount} added in the second-to-last line
\renewbibmacro*{textcite}{%
\iffieldequals{fullhash}{\cbx@lasthash}
% Compact cite - more than one thing for same author
{\setunit{\compcitedelim}%
\usebibmacro{cite:plabelyear+extrayear}}
% New cite
{%
\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}%
\setunit{\textcitedelim}%
\ifthenelse{\ifnameundef{labelname}\OR\iffieldequalstr{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}}
% Cite using shorthand
{\usebibmacro{cite:shorthand}}}
% Normal cite with author/editor
% Normal full cite
{\ifnameundef{shortauthor}%
% Normal full cite
{\printnames[labelname][-\value{listtotal}]{labelname}}
% Cite using short author
{\cbx@apa@ifnamesaved
{\printnames{shortauthor}}
{\printnames[labelname][-\value{listtotal}]{author}}}%
% Year
\setunit{\ifbool{cbx:np}
{\nameyeardelim}
{\global\booltrue{cbx:parens}\addspace\bibopenparen}}%
% Put the shortauthor inside the year brackets if necessary
\ifnameundef{shortauthor}
{}
{\cbx@apa@ifnamesaved
{}
{\printnames{shortauthor}\setunit{\nameyeardelim}}}%
% Actual year printing
\usebibmacro{cite:plabelyear+extrayear}%
% Save name hash for checks later
\stepcounter{textcitecount}%
\savefield{fullhash}{\cbx@lasthash}}}}
% this is \textcite from apa.cbx renamed
\DeclareCiteCommand{\cbx@textcite}
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{textcite}}
{}
{\usebibmacro{textcite:postnote}%
\usebibmacro{cite:post}}
% this is cite:init from authoryear-icomp.cbx renamed to avoid name clashes
\newbibmacro*{textcite:init}{%
\ifnumless{\value{multicitecount}}{2}
{\global\boolfalse{cbx:parens}%
\global\undef\cbx@lasthash
\global\undef\cbx@lastyear}
{\iffieldundef{prenote}
{}
{\global\undef\cbx@lasthash
\global\undef\cbx@lastyear}}}
% from authoryear-icomp.cbx with cite:init -> textcite:init
\DeclareCiteCommand{\textcite}[\cbx@textcite@init\cbx@textcite]
{\gdef\cbx@savedkeys{}%
\citetrackerfalse%
\pagetrackerfalse%
\DeferNextCitekeyHook%
\usebibmacro{textcite:init}}
{\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
{\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}%
\global\clearfield{multipostnote}}
{}%
\xappto\cbx@savedkeys{\thefield{entrykey},}%
\iffieldequals{namehash}{\cbx@lasthash}
{}
{\stepcounter{textcitetotal}%
\savefield{namehash}{\cbx@lasthash}}}
{}
{\protected@xappto\cbx@savedcites{%
[\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}
% textcite has nested \DeclareCiteCommand definitions for textcite and we want to use
% the normal textcite context
\DeclareDelimcontextAlias{cbx@textcite}{textcite}
\newrobustcmd{\cbx@textcite@init}[2]{%
\setcounter{textcitetotal}{0}%
\setcounter{textcitecount}{0}%
\def\cbx@savedcites{#1}#2\cbx@savedcites\empty}
\makeatother
\begin{document}
\textcite{Atkinson1995, Atkinson1999, Tuning2003, Tuning2006}
\printbibliography
\end{document}