.png)
Quero citar dois artigos do mesmo autor usando biblatex
o estilo de citação biblatex-aer
(https://github.com/dmsul/biblatex-aer). No entanto, quando eu uso \textcite{key1,key2}
, recebo, por exemplo
Gurley e Shaw (1955), 1966
em vez de
Gurley e Shaw (1955, 1966)
Indo para o código de biblatex-aer
, tudo se resume a este trecho de código:
\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}}}
Se eu deletar essas linhas, recebo a citação correta, porém, hyperref
não colore mais o nome completo e sim apenas o ano de publicação.
Você sabe como consertar isso?
Responder1
O código usado emhttps://github.com/dmsul/biblatex-aer/blob/master/biblatex-aer.texpara obter links completos nas citações foi retirado da resposta de Audrey anome do hiperlink com autorano do biblatex (biblatex 1.4b). Essa resposta foi escrita style=authoryear,
pensando (também funciona para alguns outros estilos), mas biblatex-aer
é baseada no estilo biblatex-chicago
de authordate
, que é mais parecido com o muito mais complexo style=authoryear-comp,
(além disso, biblatex-chicago
ele próprio também émuitocomplexo).
Isso significa que você precisa de uma estratégia diferente para os links. A variação a seguir é inspirada no código de Audrey emnome do hiperlink com autorano do biblatex (biblatex 1.4b)e pela minha resposta aComo mudar a cor da primeira metade dos parênteses na citação?.
Também atualizei o código para nomes em negrito biblatex-aer.tex
para que o preâmbulo a seguir substitua completamente biblatex-aer.tex
dehttps://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}