6

How can I customize biblatex labels to show the unaltered author's last name? In the following LaTeX example I define a custom alphabetic label style:

\documentclass{scrbook}

\usepackage[ngerman]{babel} 
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}

\usepackage[%
  citestyle = alphabetic, 
  bibstyle = alphabetic, 
  labelalpha = true,
  backend = biber,
  hyperref = true, 
  maxalphanames = 1,
  firstinits = true,
  abbreviate = true,
  backref = false,
  doi = false,
  url = false,
  isbn = false,
  bibwarn = true,
  bibencoding = utf8,
  dateabbrev = true,
  maxbibnames = 10,
  minbibnames = 3
]{biblatex}%

\bibliography{./Literatur.bib}

% Abbrev. for et. al.
\renewcommand*{\labelalphaothers}{+}

%% Biblatex Label
\DeclareLabelalphaTemplate{
  \labelelement{
    \field[final]{shorthand}
    \field[compound=false]{labelname}
    \field{label}
  }
  \labelelement{
    \literal{\addnbthinspace}
  }
  \labelelement{
    \field[strwidth=2,strside=right]{year}
    %\field{year}
  }
}

% bibliography
\begin{filecontents}{./Literatur.bib}
@article{otoole_optical_2010,
  title =    {Optical computing for fast light transport analysis},
  pages =    {1-12},
  journaltitle = {ACM Transactions on Graphics (TOG)},
  series =   {SIGGRAPH ASIA '10},
  library =  {Seoul, South Korea},
  author =   {{O'Toole}, Matthew and Kutulakos, Kiriakos N},
  date =     2010,
  note =     {ACM ID: 1866165}
}
\end{filecontents}


\begin{document}

In the literature  \cite{otoole_optical_2010} a very interesting 
approach ...

\printbibliography

\end{document}

This nearly gives me the desired result:

enter image description here

However, I want the exact author's name in the label, which is "O'Toole" (with apostrophe) and not "OToole" (without apostrophe) as in the example. The same issue can be observed for double names with dashes like "Miller-Brown" which are shown as "MillerBrown".

How can I construct the desired biblatex label?

  • Your MWE doesn't give me the result you posted. Are you sure the code corresponds to that output? – han-tyumi Aug 13 '14 at 13:07
  • I double checked the MWE (local MikTeX and online writeLaTeX), it gives me the posted result. What's your result? – Robinaut Aug 13 '14 at 17:48
  • 1
    I do get the same output with a recent biblatex 2.9/Biber 1.9 set-up. I think that this is an issue you might want the developers to notify about in the bug tracker (either github.com/plk/biblatex/issues or github.com/plk/biber/issues). – moewe Aug 14 '14 at 7:53
  • @Robinaut Have you ever filed a report? Where there any changes, any news to report here? – Johannes_B Jun 1 '15 at 21:29
  • Very distantly related: Ignore Spaces in Author Name. – moewe Aug 16 '15 at 7:31
2

This has been addressed in the recent update to biblatex and Biber (version 3.1 and 2.2 respectively).

With \DeclareNolabel we can now choose exactly those characters to be dropped from label creation, the default is \p{P}\p{S}\p{C}. In order to preserve apostrophes you can use

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

MWE

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel} 
\usepackage{csquotes} 
\usepackage[%
  style = alphabetic, 
  backend = biber,
  maxalphanames = 1,
  firstinits = true,
  abbreviate = true,
  maxbibnames = 10,
  minbibnames = 3
]{biblatex}%

\begin{filecontents}{\jobname.bib}
@article{otoole_optical_2010,
  title =    {Optical computing for fast light transport analysis},
  pages =    {1-12},
  journaltitle = {ACM Transactions on Graphics (TOG)},
  series =   {SIGGRAPH ASIA '10},
  library =  {Seoul, South Korea},
  author =   {{O'Toole}, Matthew and Kutulakos, Kiriakos N},
  date =     2010,
  note =     {ACM ID: 1866165}
}
\end{filecontents}

\bibliography{\jobname.bib}

\renewcommand*{\labelalphaothers}{+}

\DeclareLabelalphaTemplate{
  \labelelement{
    \field[final]{shorthand}
    \field[compound=false]{labelname}
    \field{label}
  }
  \labelelement{
    \literal{\addnbthinspace}
  }
  \labelelement{
    \field[strwidth=2,strside=right]{year}
  }
}

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


\begin{document}
In the literature  \cite{otoole_optical_2010} a very interesting 
approach.

\printbibliography
\end{document}

example output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.