避免 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}}

相關內容