# Initials in the bibliography. firstinits/uniquename not working correctly in biblatex?

Consider two MWEs (minimum working examples):

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Delbaen1998,
year={1998},
title={Title3},
author={Delbaen, F.},
}
@article{Delbaen1994,
year={1994},
title={Title2},
author={Delbaen, Freddy},
}
@article{Delbaen1993,
year={1993},
title={Title1},
author={Delbaen, Freddy},
}
\end{filecontents}

\documentclass{article}
\usepackage[latin9]{inputenc}
\usepackage[style=authoryear
,uniquename=init
,firstinits=true
,backend=biber]{biblatex}
\bibliography{\jobname}

\begin{document}

\cite{Delbaen1993,Delbaen1994,Delbaen1998}

\printbibliography
\end{document}


and

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Delbaen1998,
year={1998},
title={Title3},
author={Delbaen, Freddy},  % <----- THIS IS THE ONLY DIFFERENCE !
}
@article{Delbaen1994,
year={1994},
title={Title2},
author={Delbaen, Freddy},
}
@article{Delbaen1993,
year={1993},
title={Title1},
author={Delbaen, Freddy},
}
\end{filecontents}

\documentclass{article}
\usepackage[latin9]{inputenc}
\usepackage[style=authoryear
,uniquename=init
,firstinits=true
,backend=biber]{biblatex}
\bibliography{\jobname}

\begin{document}

\cite{Delbaen1993,Delbaen1994,Delbaen1998}

\printbibliography
\end{document}


The effect of the option uniquename=init is that a name with the same initials uniquely identifies a citation. The optionfirstinits=true makes the bibliography display only initials.

Somehow I think, that these two names (Freddy Delbaen and F. Delbaen) should also be considered to be "the same" in the bibliogrpahy. This would mean, that sorting and dashes in the first MWE should be as in the second example.

How can I achieve this, without manually editing my bibtex database?

(Do you think this should be expected behavior?)

-
Welcome to TeX.SX! –  Adam Liter Feb 25 '14 at 3:05

I think there are good reasons for this behaviour. Imagine you were citing works by Frank Delbaen, Freddy Delbaen, and Frannie Delbaen. It is good that they get sorted separately, and it could not be clear to biber who yet a fourth "F. Delbaen" actually is (one of those three, or someone else?). With long enough bibliography and using only first initials, some level of ambiguity may be unavoidable, either on the output side or on the (computer-generated) input side...

If you don't want to 'fix' your bibliography database, you could use \DeclareSourceMap to do the replacement for you. Something like:

\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite=true]{
\step[fieldsource=author,
match=\regexp{Delbaen,\s+F\.},
replace=\regexp{Delbaen,\x20Freddy}]
}
}
}


should do the trick. It searches for 'Delbaen,<+1 or more spaces>F.' and replaces it with 'Delbaen, Freddy' (with exactly one space).

-
Note also that there is a lengthy discussion in § 4.11.4 of the biblatex manual, which, if nothing else, shows how complicated good name disambiguation can be. –  jon Feb 25 '14 at 3:46
Thanks @jon. This is exactly, what I wanted to avoid, as I need to do this with every author. I think, there should be an option to treat names depending on their initials only and thus sort and use dash accordingly. Why would I want uniquename=init for my citations and then not treat it this way in the Bibliography? (esp. as many only Bibtex sources only include the initials.). PS: If I were citing works of Frank and Freddy Delbaen, uniquename=init would make no sense. –  user4514 Feb 25 '14 at 16:04
@user4514 -- The way I read the uniquename counter description is that biblatex 'gives up' when things are too impossibly ambiguous for it to cope: The counter is set to 0 if the last name is unique, 1 if adding the first name will make it unique, 2 if the full name will make it unique. But if init (or variants) are given as the option, the counter is limited to 0 and 1 and if adding initials is not enough to disambiguate, it is set to 0. There may be a way to fix it, but I don't know where to find the details of how biblatex uses biber-generated \name and \labelname. –  jon Feb 25 '14 at 17:41
In other words: 'F. Delbaen' and 'Freddy Delbaen' are treated as different authors by default, and I think that is the correct behaviour. (I'm also in favour of maintaining 'correct' databases by default, even though that comes at the cost of manual intervention. But I realize that sometimes output is automatically generated and manual intervention becomes problematic.) Anyway, maybe you should consider a feature request. I guess you want to tell biblatex to treat "different" people as the same person even if it looks like they are different people in the .bib file. –  jon Feb 25 '14 at 17:50

Authors frequently publish under multiple variants of their name (e.g., PhD dissertations are often published under the author's full legal name), and in these cases I want a single author's publications to be sorted together in the bibliography and grouped together in my in-text citations. I also agree that it's best to make the author field represent the published form of the name.

Here's my solution in cases like these:

1. Use the sortname field in the .bib entry to establish the form of the name that you want to be used when sorting entries in the bibliography. Your first entry would be:

@article{Delbaen1998,
year={1998},
title={Title3},
author={Delbaen, F.},
sortname={Delbaen, Freddy},
}

2. Add the following code to your preamble. This determines the order of fields that biblatex looks to when creating the labelname field. By putting sortname at the top, whatever you put in your sortname field will override the author field for the purposes of your in-text citations and bibliography dashes. (You can rearrange the order of the other fields to suit your needs; sortname just needs to be at the top.)

\DeclareLabelname{%
\field{sortname}
\field{shortauthor}
\field{author}
\field{shorteditor}
\field{editor}
\field{translator}
}


This solution allows you to impose authority control without removing information from the author field, and it also allows you to use the full range of uniquename options if you do want to take advantage of biblatex's disambiguation capabilities.

I should note that I generally use a style where authors' names are spelled out in full in the bibliography. The method I described works for those styles as well as initials-only styles as in the MWE. In a spelled-out style, the author field will be displayed in full in the bibliography, but the sortname governs sorting and what appears in in-text citations.

EDIT: Per @Christian Hupfer's suggestion, here's a full example based on @user4514's MWE.

    \RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Delbaen1998,
year={1998},
title={Title3},
author={Delbaen, F.},
sortname={Delbaen, Freddy}, % This author is really Freddy Delbaen, not some other F. Delbaen.
}
@article{Delbaen1994,
year={1994},
title={Title2},
author={Delbaen, Freddy},
}
@article{Delbaen1993,
year={1993},
title={Title1},
author={Delbaen, Freddy},
}
\end{filecontents}

\documentclass{article}
\usepackage[latin9]{inputenc}
\usepackage[style=authoryear
,uniquename=init
,firstinits=true
,backend=biber]{biblatex}

\DeclareLabelname{%
\field{sortname} % sortname takes precedence over author for grouping/dashing
\field{shortauthor}
\field{author}
\field{shorteditor}
\field{editor}
\field{translator}
}

\bibliography{\jobname}

\begin{document}

\cite{Delbaen1993,Delbaen1994,Delbaen1998}

\printbibliography
\end{document}


Output:

With the following biblatex options for a spelled-out style:

    \usepackage[style=authoryear-comp % compact citations (authors' names are not repeated if identical)
,dashed=false % no dash in bibliography
,uniquename=init % we can still disambiguate names in citations
,firstinits=false % full names are used in bibliography
,backend=biber]{biblatex}


You get this output:

-
Welcome to TeX.SX! A full example is sometimes quite nice ;-) –  Christian Hupfer Sep 24 '14 at 3:52