Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 7 down vote accepted

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

share|improve this answer
    
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 '13 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 '13 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 '13 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 '13 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 '13 at 19:21

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)

share|improve this answer
    
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 '13 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 '13 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 '13 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 '13 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 '13 at 20:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.