# Use autocite=footnote with style=authoryear-ibid in biblatex and enclose only the year in parentheses

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.

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

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


• Wow, thank you. How can I figure something like that out on my own? I know how to print macro definitions (e.g. with \meaning), but how did you manage to get all that information? – Xiphias Apr 23 '14 at 6:24
• @Tobias You're welcome. The definitions can be found in biblatex.def, standard.bbx as well as <style>.bbx and <style>.cbx, the macros here were hidden in authoryear-ibid.cbx (sometimes these files link to other ones via \RequireCitationStyle/RequireBibliographyStyle). – moewe Apr 23 '14 at 6:56
• I'll have a look at that! – Xiphias Apr 23 '14 at 7:20
• I tried to use this with the Bib-style style=authoryear and with \footcite instat of \autocite. This doesn't work for me. After deleting the line with: \global\boolfalse{cbx:loccit} there are no errors produced anymore, but I don't know if this is the correct answer. – Latex_NOOB Nov 20 '14 at 13:32
• @Latex_NOOB As this answer was specifically tailored to authoryear-ibid it is not guaranteed to work with other styles, authoryear should be close enough, but you can run into trouble with certain macros or other things not being defined (\global\boolfalse{cbx:loccit} did not work because authoryear does not know about the bool value cbx:loccit). Du to biblatex's structure deleting this line should work, but the only way to really judge whether this is what you want is by looking at the output... – moewe Nov 21 '14 at 15:32