根据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.9
Windows 10 上运行。我总是收到以下错误:
Package babel Error: You haven't defined the language nohyphenation yet.
我也没有设法编辑languages.ini
建议的内容这里。
不过,我找到了一个可行的解决方案。如果你看一下,你会发现languages.ini
有些语言没有连字符(它们用作zerohyph.tex
加载器)。基于此,你可以使用以下语言之一(例如阿拉伯语):
\AtEveryCitekey{\hyphenrules{arabic}}