避免使用连字符连接 BibLaTeX 标签

避免使用连字符连接 BibLaTeX 标签

根据labelalpha样式,我定义了自己的 BibLaTeX 标签,它由第一作者的全名和出版日期组成。但是,如果作者的名字很长并且引用靠近行尾,则标签会用连字符连接。MWE 如下所示:

\documentclass[%
   12pt,             
   english        
   paper = A4          
]{scrbook}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{Verylongname_74,
  author = {Verylongname, Tom S. and Longname, Bob C.},
  year = {1974},
  title = {The economics of brushing teeth},
  journal = {Journal of Political Economy},
  volume = {82},
  number = {4},
  pages = {887--891},
}
\end{filecontents}

\usepackage[%
  citestyle = alphabetic, 
  labelalpha = true,
  defernumbers = true,
  backend = biber, 
  maxalphanames = 1,
  firstinits = true
]{biblatex}%

% own BibLaTeX label definition -------------------------------

\renewcommand*{\labelalphaothers}{+}

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

\DeclareFieldFormat{labelalphawidth}{\mkbibbrackets{#1}}

% avoid hyphenation, not working!
\DeclareFieldFormat{labelalpha}{\nohyphenation #1}

%--------------------------------------------------------------

\addbibresource{\jobname.bib}

\begin{document}

This is a  line of text. This is a line of text. An example citation here is
\cite{Verylongname_74}.  The BibLaTeX  label, which is the
author's name, is hyphenated!

\end{document}

我怎样才能告诉 BibLaTeX 不要用连字符连接标签?

在此处输入图片描述

答案1

\AtEveryCitekey{\hyphenrules{nohyphenation}}序言中,可以为所有 BibLaTeX 键禁用连字符(语言nohyphenation必须在 中定义babel)。

答案2

我尝试了 Robinaut 的解决方案,但无法在MikTeX 2.9Windows 10 上运行。我总是收到以下错误:

Package babel Error: You haven't defined the language nohyphenation yet.

我也没有设法编辑languages.ini建议的内容这里

不过,我找到了一个可行的解决方案。如果你看一下,你会发现languages.ini有些语言没有连字符(它们用作zerohyph.tex加载器)。基于此,你可以使用以下语言之一(例如阿拉伯语):

\AtEveryCitekey{\hyphenrules{arabic}}

相关内容