9

I am citing two articles by the same author in the same year, referenced by the keys auth00a and auth00b. With the authoryear-comp style, I can use textcite{auth00a,auth00b} but this gives me "Author (2000a,b)" in the result. I would much rather have "Author (2000a, 2000b)"; that is, the years in full. Is there an easy way to do this? Thanks!

3

3 Answers 3

14

Add the following lines in the preamble (package xpatch is needed):

\usepackage{xpatch}
\xpatchbibmacro{textcite}
  {\setunit{\addcomma}\usebibmacro{cite:extrayear}}
  {\setunit{\compcitedelim}\usebibmacro{cite:labelyear+extrayear}}
  {}
  {}

MWE:

\documentclass{article}

\usepackage[backend=biber,style=authoryear-comp]{biblatex}

\usepackage{xpatch}
\xpatchbibmacro{textcite}
  {\setunit{\addcomma}\usebibmacro{cite:extrayear}}
  {\setunit{\compcitedelim}\usebibmacro{cite:labelyear+extrayear}}
  {}
  {}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{auth00a,
  author = {Author},
  title = {MyBook A},
  date = {2000}
}
@article{auth00b,
  author = {Author},
  title = {MyBook B},
  date = {2000}
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
\textcite{auth00a,auth00b}
\end{document} 

Output:

enter image description here

4
  • 1
    That looks like a very comprehensive solution - thank you very much. Is this sort of fine-tuning described in the Biblatex documentation?
    – Alasdair
    Jan 29, 2014 at 8:38
  • 1
    @Alasdair unfortunately not. I've learned how to do similar things in this site... Jan 29, 2014 at 8:42
  • 1
    @Alasdair BTW, remember that you can accept (and upvote) the answer if it solves your problem :-) Jan 29, 2014 at 8:44
  • 1
    Just a quick heads-up: Some of the bibmacros involved here were renamed a while ago. cite:extrayear is now cite:extradate and cite:labelyear+extrayear is cite:labeldate+extradate. The patch needs to be changed accordingly to work correctly.
    – moewe
    Mar 14, 2022 at 6:34
2

Assuming you want this behaviour for all \...cite commands and not just \textcite (the question only mentions the \textcite output), you can try the following. The idea relies on the fact that in order to suppress the year and print only the extradate letter, biblatex needs to remember the last year. If we make biblatex forget the last year, the year will never be omitted.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear-comp]{biblatex}

\makeatletter
\AtEveryCitekey{\global\undef\cbx@lastyear}
\makeatother

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{knuth:ct:b,knuth:ct:c}

ipsum \autocite{knuth:ct:a,knuth:ct:c}

\printbibliography
\end{document}

Lorem (Knuth 1986a, 1986b)
ipsum (Knuth 1984, 1986b)

0

So, about the xpatch solution. After Moewe pointed out that we should replace -year by -date in the names of the macros, here is the result. But I'm warning you, this will not work with ext-authoryear-comp, only with authoryear-comp, which really should make Moewe's "3-line solution" (see above) your favorite call.

   \documentclass{article}

\usepackage[backend=biber,style=authoryear-comp]{biblatex}

\usepackage{xpatch}

\xpatchbibmacro{textcite}
  {\setunit{\addcomma}\usebibmacro{cite:extradate}}
  {\setunit{\compcitedelim}\usebibmacro{cite:labeldate+extradate}}
  {}
  {}

\xpatchbibmacro{cite}
  {\setunit{\addcomma}\usebibmacro{cite:extradate}}
  {\setunit{\compcitedelim}\usebibmacro{cite:labeldate+extradate}}
  {}
  {}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{auth00a,
  author = {Author},
  title = {MyBook A},
  date = {2000}
}
@article{auth00b,
  author = {Author},
  title = {MyBook B},
  date = {2000}
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
\textcite[cf.][56]{auth00a,auth00b}

\cite[cf.][56]{auth00a,auth00b}

\parencite[cf.][56]{auth00a,auth00b}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .