# Ignore Spaces in Author Name

I am using the alphabetic biblatex style together with the option maxalphanames=1. How can I make biblatex ignore any spaces in the author name during label generation?

% arara: pdflatex
% arara: biber
% arara: pdflatex
% arara: pdflatex

\documentclass{article}
\usepackage[american]{babel}
\usepackage[strict]{csquotes}
\usepackage[backend=biber, style=alphabetic, maxalphanames=1]{biblatex}

\begin{filecontents*}{test.bib}
@Article{DeLorca2015,
Title   = {Article title},
Author  = {De Lorca, Antonio and Jekyll, Martin},
Journal = {Journal title},
Year    = {2015}
}
\end{filecontents*}

\renewcommand*{\labelalphaothers}{}

\bibliography{test}

\begin{document}
\cite{DeLorca2015}
\end{document}


The above MWE produces the label [De 15], but I'd rather like the label to be [DeL15].

• I guess there is nothing to do with TeX. It is Biber.pm, a perl script, doing most of jobs. It should contains something like take 3 character from this string and save to that string. And you need to modify it. – Symbol 1 Jan 22 '15 at 9:58
• As far as I can tell there are two lines ( $label,$sortlabel ) = @{ $self->_genlabel($citekey) }; $be->set_field('labelalpha',$label); generating the label. But I cannot find the definition of _genlabel. – Symbol 1 Jan 22 '15 at 10:02
• @Symbol 1: Well, this might be a way, but I don't particularly like it as it drastically reduces the documents portability. – Bloops Feb 3 '15 at 8:58
• See Alphabetic Labels: Better Control over Non-Alphanumeric Characters #333 over at the biblatex tracker – moewe Aug 17 '15 at 6:26

Starting with biblatex 3.1/Biber 2.2 there is \DeclareNolabel which we can use to ignore certain characters when creating the label.

The default is to ignore [\p{P}\p{S}\p{C}]+. If we want to ignore space characters as well, we only need to add \p{Z} (you can read more about these Unicode properties on perldoc.perl.org Unicode Character Properties and for general RegEx in Perl perlre)

\DeclareNolabel{
\nolabel{\regexp{[\p{Z}\p{P}\p{S}\p{C}]+}}
}


MWE

\documentclass{article}
\usepackage[american]{babel}
\usepackage[strict]{csquotes}
\usepackage[backend=biber, style=alphabetic, maxalphanames=1]{biblatex}

\begin{filecontents*}{\jobname.bib}
@Article{DeLorca2015,
Title   = {Article title},
Author  = {De Lorca, Antonio and Jekyll, Martin},
Journal = {Journal title},
Year    = {2015}
}
\end{filecontents*}

\renewcommand*{\labelalphaothers}{}

\bibliography{\jobname}

\DeclareNolabel{
\nolabel{\regexp{[\p{Z}\p{P}\p{S}\p{C}]+}}
}

\begin{document}
\cite{DeLorca2015}
\end{document}


• @Bloops Well, all credits go to PLK for implementing this feature. – moewe Nov 6 '15 at 8:30