1

I am using biblatex with the chicago-authordate option. I would like to have hyperlinks not only on the years, but also on the authors names. The answer given in hyperlink name with biblatex authoryear (biblatex 1.4b) nearly works, but some brackets are broken.

Minimal broken example:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[authordate, backend=biber]{biblatex-chicago}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book{levi-strauss1981,
    Address = {New York},
    Author = {Levi-Strauss, Claude},
    Publisher = {Harper \& Row},
    Title = {The Naked Man: Mythologiques, Vol. 4},
    Year = {1981}}
@book{levi-strauss1968,
    Address = {New York},
    Author = {Levi-Strauss, Claude},
    Publisher = {Harper \& Row},
    Title = {The Raw and the Cooked: Mythologiques, Vol. 1},
    Year = {1968}}
@book{nimuendaju1952,
    Address = {Berkeley \& Los Angeles},
    Author = {Nimuendaju, Curt},
    Publisher = {University of California Press},
    Title = {The Tukuna},
    Year = {1952}}
\end{filecontents}
\addbibresource{\jobname.bib}

\ExecuteBibliographyOptions{maxcitenames=1}

\DeclareFieldFormat{citehyperref}{%
  \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
  \bibhyperref{#1}}

\DeclareFieldFormat{textcitehyperref}{%
  \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
  \bibhyperref{%
    #1%
    \ifbool{cbx:parens}
      {\bibcloseparen\global\boolfalse{cbx:parens}}
      {}}}

\savebibmacro{cite}
\savebibmacro{textcite}

\renewbibmacro*{cite}{%
  \printtext[citehyperref]{%
    \restorebibmacro{cite}%
    \usebibmacro{cite}}}

\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}}}

\addbibresource{test.bib}

\usepackage{hyperref}

\begin{document}

The work by  \textcite{levi-strauss1981}  \\

The works by \textcite{levi-strauss1981,levi-strauss1968} \emph{$<$= incorrect brackets} \\

The works by \textcite{levi-strauss1981,nimuendaju1952} 

\printbibliography
\end{document}

gives the output: broken example screenshot

obviously, the second line should have Levi-Strauss (1981, 1968) instead of Levi-Strauss (1981), 1968.

How can this be fixed?

2
  • How should the link work in this case? Should it revert to the default behaviour? Feb 23, 2019 at 3:11
  • Yes - I think the best solution would be for the name not to be linked, only the years.
    – Karalga
    Feb 25, 2019 at 10:56

0

You must log in to answer this question.

Browse other questions tagged .