# Adding a date to disambiguate books with same title in biblatex

I am working on my PhD thesis and am using biblatex. Now I have several books by the same author with exactly the same title (but different publication years). When I cite these works, there is no way for the reader to know to which work I am referring.

I realise that I could edit their shorttitle fields to include the date, but then the date gets italicised together with the title. I could then de-italicise it, etc. etc. But I was hoping that there was a simpler/smarter/more elegant solution.

Attached is a minimal example:

\documentclass[11pt,oneside]{memoir}

\usepackage[
style=authortitle,
hyperref,
useprefix=false,
maxnames=2,
firstinits=true,
sortcites=true,
uniquename=init,
abbreviate=true
]{biblatex}

\begin{filecontents}{\jobname.bib}
@book{tom1,
author = {Author, A.},
year = {2001},
title = {This is a very long title that I definitely do not want in a footnote},
shorttitle = {A better title},
}
@book{tom2,
author = {Author, A.},
year = {1999},
title = {This is a very long title that I definitely do not want in a footnote},
shorttitle = {A better title},
}
\end{filecontents}

\begin{document}
Lorem ipsum dolor sit amet.\footnote{\Cite{tom1}, \Cite{tom2}.}

\end{document}

-
 Please see answer here. This has been implemented in the latest biblatex/biber betas – PLK May 15 '12 at 15:09

Two bibliography entries with the same author and title are rather uncommon, and this seems to be the reason that the autortitle style family is (to the best of my knowledge) missing an "extratitle" feature similar to authoryear's extrayear field. While it should be possible to add such a feature, this is above my abilities. I do have a suggestion that at least does away with manually adding tailored shorttitle fields to the bibliography:

• Declare a new bibliography category "ambigtitle" and add the respective entries to this category in your main document;

• Define a bibmacro dateifambigtitle that will print the contents of the date field for entries belonging to the "ambigtitle" category;

• Add the above bibmacro to the format definition of the citetitle field.

\documentclass{article}

\usepackage[style=authortitle]{biblatex}

\DeclareBibliographyCategory{ambigtitle}

\newbibmacro*{dateifambigtitle}{%
\ifcategory{ambigtitle}{%
\printtext[parens]{\usebibmacro{date}}%
}{%
}%
}

\DeclareFieldFormat{citetitle}{\mkbibemph{#1}\usebibmacro{dateifambigtitle}}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{citetitle}{\mkbibquote{#1\isdot}\usebibmacro{dateifambigtitle}}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
@misc{A02,
author = {Author, A.},
year = {2002},
title = {Alpha},
}
@misc{C03,
author = {Cuthor, C.},
year = {2003},
title = {Charlie},
}
\end{filecontents}

\begin{document}

Some text \parencite{A01}.

Some text \parencite{A02}.

Some text \parencite{C03}.

\printbibliography

\end{document}


-

Citation labels in the author-title styles are formed by the labelname and labeltitle fields. The namehash field uniquely identifies the name list in labelname.

Using the \AtDataInput hook you can count the number of entries per namehash-labeltitle value. Years can then be added to ambiguous citation labels in the cite:title macro.

\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authortitle-comp]{biblatex}
\usepackage{hyperref}

\makeatletter

\AtDataInput{%
\iftoggle{blx@skiplab}{}
{\csnumgdef{cbx@\strfield{namehash}@\strfield{labeltitle}}
{\csuse{cbx@\strfield{namehash}@\strfield{labeltitle}}+1}}}

\renewbibmacro*{cite:title}{%
\printtext[bibhyperref]{%
\printfield[citetitle]{labeltitle}%
\ifnumgreater{\csuse{cbx@\strfield{namehash}@\strfield{labeltitle}}}{1}
{}}}

\makeatother

\begin{filecontents}{\jobname.bib}
@book{key1,
author = {Author, A.},
year = {2001},
title = {Original title},
shorttitle = {Title}}
@book{key2,
author = {Author, A.},
year = {1999},
title = {Title}}
@book{key3,
author = {Author, A. and Buthor, B.},
year = {1998},
title = {Book title}}
@book{key4,
author = {Author, A. and Buthor, B. and Cuthor, C. and Duthor, D.},
year = {1998},
title = {Book title}}
\end{filecontents}

\begin{document}
\textcite{key1,key2,key3,key4}
\printbibliography
\end{document}


This approach should be general enough for each of the authortitle variants. It also works with biber as the backend and various option settings related to minnames/maxnames and labelname disambiguation (uniquename, uniquelist).

Refinements can be made to perform disambiguation independently between reference sections. The \AtDataInput hook executes its code for every entry in the bbl auxiliary file(s). So disambiguation doesn't discount entries filtered out of the bibliography. Years could be added selectively, but this depends on the filter.

-
 This seems great, but I cannot figure out how to use biber with TeXShop on my mac. I'm getting the feeling that that is going to be a whole new issue and question... Oh my. – Tom de Bruin May 3 '12 at 9:58 @TomdeBruin biber isn't really needed for the solution. I've made an edit to give a "more minimal" example. The uniquename setting in your MWE does need biber as the backend. I'm not familiar with TeXShop, but you might find this post helpful. – Audrey May 3 '12 at 13:42

This is not a fully automatic solution: it does require you to enter an extra field.

Redefine cite:title as follows in the preamble:

\renewbibmacro*{cite:title}{%
\printtext[bibhyperref]{%
\printfield[citetitle]{labeltitle}%
\iffieldundef{usera}
{}


Now include a usera field with the year you want to be used:

@book{tom1,
author = {Author, A.},
year = {2001},
title = {This is a very long title that I definitely do not want in a footnote},
shorttitle = {A better title},
usera = {2001},
}
@book{tom2,
author = {Author, A.},
year = {1999},
title = {This is a very long title that I definitely do not want in a footnote},
shorttitle = {A better title},
usera = {1999},
}


That then produces Author, A better title (2001) and Author, A better title (1999). The additional year is added only if a usera field is present. A bit hacky, but less hacky than actually adding it in the shorttitle field.

-