[Tex/LaTex] Use autocite=footnote with style=authoryear-ibid in biblatex and enclose only the year in parentheses

biblatexcitingfootnotes

I'm using the following configuration to cite sources:

\usepackage[backend=bibtex, style=authoryear-ibid, autocite=footnote]{biblatex}

One of my indirect citations looks like this:

\autocite[Vgl.][123]{ruschmeyer}

I get this result:

Vgl. Ruschmeyer u. a. 1995, S. 123

I'd rather like to get this result, according to my university's guidelines:

Vgl. Ruschmeyer u. a. (1995), S. 123

How can I enclose the year in brackets and keep everything else as it is? I've read about \DeclareAutoCiteCommand, but it seems to do a lot more than what I need.

I had a look at this solution, but it does not work for indirect citations and the parentheses also include the pagenumbers.

Thank you for your help!

Best Answer

One solution is to redefine the macro cite:labelyear+extrayear to always wrap the labelyear (and extrayear, if applicable) in parentheses.

\renewbibmacro*{cite:labelyear+extrayear}{%
  \iffieldundef{labelyear}
    {}
    {\printtext[parens]{%
     \printtext[bibhyperref]{%
       \printfield{labelyear}%
       \printfield{extrayear}}}}}

This will make \textcite and \citeyear look weird though, so we can also go for a slightly longer redefinition of the cite macro (along with a definition of a new macro):

\newbibmacro*{cite:labelyear+extrayear:paren}{%
  \iffieldundef{labelyear}
    {}
    {\printtext[parens]{\usebibmacro{cite:labelyear+extrayear}}}}

\renewbibmacro*{cite}{%
  \global\boolfalse{cbx:loccit}%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
          {\usebibmacro{cite:label}%
           \setunit{\addspace}}
          {\printnames{labelname}%
           \setunit{\nameyeardelim}}%
        \usebibmacro{cite:labelyear+extrayear:paren}}}
    {\usebibmacro{cite:shorthand}}}

or (to put everything into one macro)

\renewbibmacro*{cite}{%
  \global\boolfalse{cbx:loccit}%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
          {\usebibmacro{cite:label}%
           \setunit{\addspace}}
          {\printnames{labelname}%
           \setunit{\nameyeardelim}}%
        \iffieldundef{labelyear}
          {}
          {\printtext[parens]{\usebibmacro{cite:labelyear+extrayear}}}}}
    {\usebibmacro{cite:shorthand}}}

MWE with the second solution

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[backend=bibtex, style=authoryear-ibid, autocite=footnote]{biblatex}
\addbibresource{biblatex-examples.bib}

\newbibmacro*{cite:labelyear+extrayear:paren}{%
  \iffieldundef{labelyear}
    {}
    {\printtext[parens]{\usebibmacro{cite:labelyear+extrayear}}}}

\renewbibmacro*{cite}{%
  \global\boolfalse{cbx:loccit}%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
          {\usebibmacro{cite:label}%
           \setunit{\addspace}}
          {\printnames{labelname}%
           \setunit{\nameyeardelim}}%
        \usebibmacro{cite:labelyear+extrayear:paren}}}
    {\usebibmacro{cite:shorthand}}}

\begin{document}
Lorem\autocite[Vgl.][123]{markey} ipsum\autocite{knuth:ct:a} dolor\autocite{knuth:ct:b} sit\autocite{knuth:ct:a,knuth:ct:b} amet.

\Textcite{wilde} consecetur.

\printbibliography
\end{document}

enter image description here

Related Question