# Abbreviate Troy McClure's surname in biblatex

Imagine Troy McClure wrote a book and his surname funnily enough now appears abbreviated in a biblatex+biber bibliography. The output of this is "M., Troy", but imho should better be "McC., Troy".

## Question

How can I make biblatex detect prefixes like this (or at least this particular one) and get the correct abbreviated surname?

## MWE

\documentclass{article}
\usepackage{biblatex}
\usepackage{filecontents}
\begin{filecontents}{bib.bib}
@book{mcd,
author={McClure, Troy},
title={Abbreviating My Surname In Biblatex Doesn't Work Well}}
\end{filecontents}
\DeclareNameFormat{author}{%
\usebibmacro{name:last-first}{#2}{#3}{#5}{#7}}
\begin{document}
\nocite{*}
\printbibliography
\end{document}


## Output

Should be "McC., Troy. (…)".

PS: For biblatex 3.3 the \DeclareNameFormat command should be (untested):

\DeclareNameFormat{author}{\nameparts{#1}%
\usebibmacro{name:given-family}{\namepartfamilyi}{\namepartgiven}{\namepartpre‌​fix}{\namepartsuffix}}

• Your code doesn't compile: On the line \usebibmacro{name:last-first}{#2}{#3}{#5}{#7}}, I get an "Illegal parameter number in definition of \blx@defformat@d." message. – Mico Apr 7 '16 at 17:11
• i'm not a biblatex user, but in bibtex, i would expect that {McC}lure would do what you want. – barbara beeton Apr 7 '16 at 17:14
• I'd be very surprised to get, from McClure, Troy the author's name printed as “M. Troy”, but rather “T. McClure”. Please, explain. – egreg Apr 7 '16 at 17:38
• It makes no sense, in my opinion. Since when authors are identified by given name? – egreg Apr 7 '16 at 17:49
• It makes no sense either. Before the colon you have the identifier used in the document, after it the essential data for specifying the reference. – egreg Apr 7 '16 at 17:58

Changing the author field to

author={{\relax McC}lure, Troy},


lets you achieve your objective, viz., make the surname show up as McC.

The full MWE (used with biblatex v. 3.3) -- note that I had to remove {\namepartpre‌​fix}:

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{bib.bib}
@book{mcd,
author={{\relax McC}lure, Troy},
title={Abbreviating My Surname \dots},
}
\end{filecontents}

\usepackage{biblatex}

• Under certain circumstances this produces an unwanted extra space before the last name, this can be resolved using {\relax{}McC}lure. – dessert Apr 7 '16 at 18:11
• @dessert - Please be a bit more specific as to what the "certain circumstances" may entail. TeX should be eating up the space after \relax. If that's not the case, something odd may be going on. – Mico Apr 7 '16 at 18:22