4

I'm using biblatex and want to add an 's to an author's name when using the command \textcite{}. The "problem" is that I already adjusted the command so that \textcite is printed as a complete hyperref. See the code down below. Is there an easy way to implement a solution to my problem? I only found some posts on the theme that were quite old and was hoping there now exists a more smooth solution.

I already tried to create a new command with:

\newcommand{\possessivecite}[1]{\citeauthor{#1}'s \citeyear{#1}}

But how can I combine it with the following so the hyperref is still intact?

 % Citation
\ExecuteBibliographyOptions{maxcitenames=2}

\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}}}
gusbrs
  • 13,740
Jasmin
  • 73
  • Are you using bibtex or biblatex? Please clarify. – Mico May 10 '18 at 18:33
  • Sorry, I'm using biblatex. I've corrected the mistake. – Jasmin May 10 '18 at 19:29
  • You still do not offer sufficient information as to how we could help you. For example, which style do you use? biblatex-chicago offers a \gentextcite out of the box. – gusbrs May 10 '18 at 19:34
  • 1
    Did your possessivecite came from https://tex.stackexchange.com/a/22279/105447? If so, why were the other answers not sufficient for you? – gusbrs May 10 '18 at 19:35
  • \usepackage[bibstyle=authoryear, citestyle=authoryear, backend=bibtex8]{biblatex} 2. Yes, it came from tex.stackexchange.com/a/22279/105447. Maybe, it is sufficient, but I couldn't manage to connect the solution to hyperref, so that it's displayed as a link. And I thought maybe there is a solution more straight forward. I will check out \gentextcite.
  • – Jasmin May 10 '18 at 19:49
  • The other answers work with hyperlinks, you only have to load hyperref (as I assume you already do). If you don't have a really, really old biblatex version, take the care to use Psychonaut's version of Audrey's answer. – gusbrs May 10 '18 at 19:52
  • 1
    It would greatly help me to investigate your problem if you could add a complete MWE/MWEB to your question that I can just copy, paste and compile. Ideally that MWE would show the code you have posted already in context. You could also show how Psychonaut's answer did not work for you. – moewe May 10 '18 at 19:59
  • Related: https://tex.stackexchange.com/q/299050/105447 – gusbrs May 10 '18 at 20:19