7

My biblatex preamble is like this:

\usepackage[bibstyle=authoryear,
citestyle=authoryear, 
firstinits=true, 
maxbibnames=5,
minbibnames=3, 
maxcitenames=2, 
sorting=nyt, 
url=false, 
isbn=false, 
eprint=false, 
doi=false, 
dashed=false, 
natbib=true]{biblatex}

When I cite two papers by the same author in the same year (\citet{Einstein1905a, Einstein1905b}), they appear as follows:

Einstein (1905a); Einstein (1905b)

Instead, I would like for them to appear as:

Einstein (1905a,b).

How can I accomplish this?

2 Answers 2

9

biblatex doesn't feature a built-in style which compresses only papers by the same author and in the same year. If compressing of same author/different year is fine with you, simply use the authoryear-comp style.

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=authoryear-comp,natbib]{biblatex}
\addbibresource{\jobname.bib}
\begin{filecontents}{\jobname.bib}
@article{one,
author = "Last, First",
title = {Title},
journal = {A Journal},
year = {2011},
}  
@article{two,
author = "Last, First",
title = {Title},
journal = {B Journal},
year = {2012},
}  
@article{three,
author = "Surname, Given",
title = {Title},
journal = {C Journal},
year = {2013},
}  
@article{four,
author = "Surname, Given",
title = {Title},
Journal = {D Journal},
year = {2013},
}  
\end{filecontents}

\begin{document}
\citet{one,two,three,four}
\printbibliography
\end{document}

enter image description here

17
  • I have tried this solution, but it does not work either. My biblatex version is 1.7. I get no errors, but the output remains the same. In fact now, its putting the 2013b before 2013a which is not desirable.
    – cryptic0
    Feb 19, 2013 at 15:02
  • @cryptic0 Your version of biblatex is outdated (the current one is 2.5). That said, authoryear-comp has been working for me since v0.7. Without a complete example, it's hard to say what's going on.
    – lockstep
    Feb 19, 2013 at 15:05
  • I will do a MWE shortly. The version number baffles me because I have the latest Texlive. Can I update the biblatex manually?
    – cryptic0
    Feb 19, 2013 at 15:33
  • This is a bit unrelated, but I tried to update my biblatex version (tlmgr update biblatex), and now no citation commands are being found by bibtex. I am getting error messages.
    – cryptic0
    Feb 19, 2013 at 16:35
  • I had some revelation. This authoryear-comp style for grouping papers for an author by the year works only if the co-authors on both the papers match. If you added two more authors to one of the 2013 reference, it would not show up as author et al (20131,b). Now the important question is whether this is the norm and the correct way of writing citations.
    – cryptic0
    Feb 19, 2013 at 19:21
0

Here is a solution redefining \textcite.

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=authoryear,natbib]{biblatex}
\addbibresource{\jobname.bib}
\begin{filecontents}{\jobname.bib}
@article{one,
author = "Last, First",
title = {Title},
journal = {A Journal},
year = {2012},
}  
@article{two,
author = "Last, First",
title = {Title},
journal = {B Journal},
year = {2012},
}  
@article{three,
author = "Surname, Given",
title = {Title},
journal = {C Journal},
year = {2013},
}  
@article{four,
author = "Surname, Given",
title = {Title},
Journal = {D Journal},
year = {2013},
}  
\end{filecontents}

\makeatletter
\DeclareCiteCommand{\textcite}
  {}
  {\iffieldequals{namehash}{\cbx@lasthash}
    {\iffieldequals{year}{\cbx@lastyear}
      {\addcomma\printfield{extrayear}}
      {\addcomma\addspace\printfield{labelyear}\printfield{extrayear}}%
      \ifnumequal{\value{citecount}}{\value{citetotal}}
        {\bibcloseparen}
        {}%
    }
    {\ifnumequal{\value{citecount}}{1}
      {}
      {\bibcloseparen\multicitedelim\addspace}%
     \printnames{labelname}
     \bibopenparen\printfield{labelyear}\printfield{extrayear}%
    }%
    \savefield{namehash}{\cbx@lasthash}%
    \savefield{year}{\cbx@lastyear}%
  }
  {}
  {}
\makeatother

\begin{document}
\citet{one,two,three,four}
\printbibliography
\end{document}

Producing

enter image description here

EDIT corrected problem with same author different year (missing comma and space between years)

5
  • Guido: Thanks for the solution. Unfortunately, the lines with 'cbx' in them are appearing with a red background in the text editor. Also, when I compile, there are numerous errors, all referring to too deeply nested something.
    – cryptic0
    Feb 19, 2013 at 7:11
  • red background in the editor is harmless, it should tells that they are not know to the editor (as they should be, you can use any new name for them, they are for "local" variables). In my system the code compile without errors (just the filecontents waring, but this is expected if use file contents.) What version of biblatex do you have? and what are the errors?
    – Guido
    Feb 19, 2013 at 8:09
  • In its current form, this will lead to wrong output for works of the same author, but with different year. Change the year of entry one in your example to 2011 and see what happens.
    – lockstep
    Feb 19, 2013 at 9:05
  • This version doesn't result in wrong output, but it seems identical to simply using the authoryear-comp style. An intermediate style would be to display same author/different year as "Last (2011), Last (2012)".
    – lockstep
    Feb 19, 2013 at 12:38
  • @lockstep I was sure to have seen a style to achieve the required output, but I was not able to remember which one :-(. I can modify the solution for an intermediate style.
    – Guido
    Feb 19, 2013 at 20:13

You must log in to answer this question.

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