.png)
我想使用biblatex
引用風格引用同一作者的兩篇文章biblatex-aer
引用同一作者的兩篇文章(https://github.com/dmsul/biblatex-aer)。但是,當我使用時\textcite{key1,key2}
,我得到例如
格利和肖 (1955), 1966
代替
格利和肖 (1955, 1966)
進入 的程式碼biblatex-aer
,可以歸結為以下程式碼片段:
\renewbibmacro*{textcite}{%
\ifboolexpr{
( not test {\iffieldundef{prenote}} and
test {\ifnumequal{\value{citecount}}{1}} )
or
( not test {\iffieldundef{postnote}} and
test {\ifnumequal{\value{citecount}}{\value{citetotal}}} )
}
{\DeclareFieldAlias{textcitehyperref}{noformat}}
{}%
\printtext[textcitehyperref]{%
\restorebibmacro{textcite}%
\usebibmacro{textcite}}}
如果我刪除這些行,我會收到正確的引文,但是,hyperref
不再對整個名稱進行著色,而僅對出版年份進行著色。
你知道如何解決這個問題嗎?
答案1
中使用的程式碼https://github.com/dmsul/biblatex-aer/blob/master/biblatex-aer.tex獲取引文中的完整連結取自奧黛麗的回答帶有 biblatex 作者年份的超連結名稱 (biblatex 1.4b)。這個答案是在style=authoryear,
考慮到的情況下編寫的(它也適用於其他一些樣式),但biblatex-aer
基於biblatex-chicago
的authordate
樣式,它更類似於更複雜的樣式style=authoryear-comp,
(此外biblatex-chicago
它本身也是非常複雜的)。
這意味著您需要不同的連結策略。以下變體的靈感來自 Audrey 的程式碼帶有 biblatex 作者年份的超連結名稱 (biblatex 1.4b)根據我的回答如何更改引文中括號前半部的顏色?。
我還更新了粗體名稱的程式碼,biblatex-aer.tex
以便以下序言完全biblatex-aer.tex
替換https://github.com/dmsul/biblatex-aer/blob/master/biblatex-aer.tex。
\documentclass[american]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[authordate, backend=biber, uniquename=false, noibid]{biblatex-chicago}
\usepackage[colorlinks]{hyperref}
\makeatletter
\newrobustcmd{\blx@imc@transparentprinttext}[2][]{%
\ifblank{#2}
{}
{\ifblank{#1}
{\let\blx@theformat\@firstofone}
{\blx@getformat\blx@theformat{ffd}{#1}{}}%
\ifdefvoid\blx@theformat
{}
{\blx@theformat{#2}}}}
\newcommand*{\blx@imc@iffieldequalstr@swap}[2]{\iffieldequalstr{#2}{#1}}
\newcommand*{\blx@imc@iffieldequalsdefstring}[2]{%
\expandafter\blx@imc@iffieldequalstr@swap\expandafter{#2}{#1}}
\blx@regimcs{\transparentprinttext \iffieldequalsdefstring}
\makeatother
\DeclareFieldFormat{citehyperref}{%
\DeclareFieldAlias{bibhyperref}{noformat}%
\bibhyperref{#1}}
\letbibmacro{orig:cite}{cite}
\renewbibmacro*{cite}{%
\transparentprinttext[citehyperref]{%
\usebibmacro{orig:cite}}}
\letbibmacro{orig:textcite}{textcite}
\letbibmacro{orig:textcite:postnote}{textcite:postnote}
\renewbibmacro*{textcite:postnote}{}
\renewbibmacro*{textcite}{%
\transparentprinttext[citehyperref]{%
\usebibmacro{orig:textcite}%
\ifnumequal{\value{citecount}}{\value{citetotal}}
{\usebibmacro{orig:textcite:postnote}}
{}%
}%
}
\newcommand\ifmknamebold{%
\ifboolexpr{test {\ifcurrentname{labelname}}
or
test {\iffieldequalsdefstring{labelnamesource}{\currentname}}}}
\DeclareNameWrapperFormat{default}{\ifmknamebold{\mkbibbold{#1}}{#1}}
\DeclareNameWrapperFormat{labelname}{#1}
\addbibresource{biblatex-examples.bib}
\begin{document}
\textcite{knuth:ct:a,knuth:ct:b}
\cite{sigfridsson,gaonkar:in,westfahl:space,westfahl:frontier,companion}
\printbibliography
\end{document}