11

Some guy has written a few books, but he is inconsistent from book to book when it comes to including and/or abbreviating his middle name. When I cite this author in the text, I would like biblatex to treat all different versions of his name as the same author. I can enforce this for the sorting in the bibliography with sortname, but what do I do to enforce this for text citations?

The following example illustrates how the text citation treats "Paul J[ohn] Smith" as a different author from "Paul John Smith" and "Paul Smith". The first citation should appear as (Smith 2002), and the second citation should appear as (2001a, 2001b, 2002).

\documentclass{article}
\usepackage{csquotes}
\usepackage[
        bibstyle = authoryear,
        citestyle = authoryear-comp,
        dashed = false,
        sorting = nyt,
        sortcites = false,
        language = american,
        abbreviate = false,
        backend = biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{smith2001a,
    AUTHOR = "Paul John Smith",
    TITLE = "My first book",  
    YEAR = "2001"}

@BOOK{smith2001b,
    AUTHOR = "Paul Smith",
    TITLE = "My second book",  
    YEAR = "2001",
    SORTNAME = "Paul John Smith"}

@BOOK{smith2002,
    AUTHOR = "Paul J[ohn] Smith",
    TITLE = "My third book",  
    YEAR = "2002",
    SORTNAME = "Paul John Smith"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\noindent
Some clever guy said that \parencite{smith2002}.
In fact, Paul Smith has talked about this several times \parencite*{smith2001a,smith2001b,smith2002}.
\printbibliography
\end{document}

enter image description here

4
  • Just to verify the premise: Paul Smith, Paul J. Smith, and Paul John Smith are indeed one and the same person, right? It's just that this author isn't all that punctilious about always providing his middle name (or even the middle initial) in every publication, right?
    – Mico
    Commented Aug 26, 2012 at 21:14
  • 3
    You can put a consistent name for Paul Smith in the shortauthor field, as discussed in this previous post.
    – Audrey
    Commented Aug 27, 2012 at 0:26
  • See last example in section 4.5.2 in the biblatex manual. The sourcemap feature is designed to help with this.
    – PLK
    Commented Aug 27, 2012 at 5:25
  • @PLK This last example in 4.5.2, I add that to the file biber.conf? Anywhere in that file? Could you or someone provide a working example for my example above?
    – Sverre
    Commented Aug 27, 2012 at 12:22

2 Answers 2

11

There is now a biblatex macro interface to the sourcemapping feature, you can put this in your preamble:

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite]{
       \step[fieldsource=author, match=\regexp{Paul\s+(?:J\S+\s+)?Smith}, final]
       \step[fieldset=shortauthor, fieldvalue={Smith, Paul John}]
       \step[fieldset=sortname, fieldvalue={Smith, Paul John}]
    }
  }
}

You may want to tune the regular expression, I made it quite specific so as not to catch anything it shouldn't.

4
  • I added this to my preamble, but I got this error when I compiled: ! Undefined control sequence. \blx@tempf ...="author" map\string _match="Paul\s +J\S +\s +Smith" map\strin... l.40 }
    – Sverre
    Commented Aug 27, 2012 at 17:06
  • Ah, sorry, forgot the \regexp{} wrapper - fixed now.
    – PLK
    Commented Aug 27, 2012 at 18:47
  • Great. I especially like the fact that I can put this in the preamble of my document instead of having to mess with biber's config files.
    – Sverre
    Commented Aug 27, 2012 at 19:59
  • The biber config file route is useful if you want such mappings to apply to all documents, not just the current one.
    – PLK
    Commented Aug 28, 2012 at 5:26
0

This is just to show how PLK's solution above does the trick in practice:

\documentclass{article}
\usepackage{csquotes}
\usepackage[
        bibstyle = authoryear,
        citestyle = authoryear-comp,
        dashed = false,
        sorting = nyt,
        sortcites = false,
        language = american,
        abbreviate = false,
        backend = biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{smith2001a,
    AUTHOR = "Paul John Smith",
    TITLE = "My first book",  
    YEAR = "2001"}

@BOOK{smith2001b,
    AUTHOR = "Paul Smith",
    TITLE = "My second book",  
    YEAR = "2001",
    SORTNAME = "Paul John Smith"}

@BOOK{smith2002,
    AUTHOR = "Paul J[ohn] Smith",
    TITLE = "My third book",  
    YEAR = "2002",
    SORTNAME = "Paul John Smith"}
\end{filecontents}
\addbibresource{\jobname.bib}
\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite]{
       \step[fieldsource=author, match=\regexp{Paul\s+(?:J\S+\s+)?Smith}, final]
       \step[fieldset=shortauthor, fieldvalue={Smith, Paul John}]
       \step[fieldset=sortname, fieldvalue={Smith, Paul John}]
    }
  }
}
\begin{document}
\noindent
Some clever guy said that \parencite{smith2002}.
In fact, Paul Smith has talked about this several times \parencite*{smith2001a,smith2001b,smith2002}.
\printbibliography
\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 .