biblatex:带撇号的标签构造

biblatex:带撇号的标签构造

如何自定义 biblatex 标签以显示未更改的作者姓氏?在下面的 LaTeX 示例中,我定义了自定义字母标签样式:

\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}

这几乎给了我想要的结果:

在此处输入图片描述

但是,我希望标签中显示的作者姓名准确,即“O'Toole”(带撇号),而不是示例中的“OToole”(不带撇号)。对于带破折号的双名,如“Miller-Brown”,也会出现同样的问题,显示为“MillerBrown”。

我如何构建所需的 biblatex 标签?

答案1

biblatex这一问题在和 Biber(分别为版本 3.1 和 2.2)的最新更新中已得到解决。

现在\DeclareNolabel ,我们可以精确选择要从标签创建中删除的字符,默认值为\p{P}\p{S}\p{C}。为了保留撇号,您可以使用

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

平均能量损失

\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}

示例输出

相关内容