如果在 biblatex 中使用前缀作为书目标签,则经常需要在前缀和实际书目标签之间使用连字符,尤其是对于较长的前缀。
如何避免这种情况?
此处提供的解决方案没有任何效果。我确信微型在大多数情况下都会修复它,但我并不总是使用它,而且我想要一个更安全的解决方案。
我也知道\mbox{...}
,但我不想手动将每个引用命令放在那里。
\begin{filecontents}{references.bib}
@InProceedings{Baader1989,
Title = {Direct self control of inverter-fed induction machine, a basis for speed control without speed-measurement},
Author = {Baader, U. and Depenbrock, M. and Gierse, Georg},
Booktitle = {Industry Applications Society Annual Meeting, 1989., Conference Record of the 1989 IEEE},
Year = {1989},
Month = {Oct},
Pages = {486-492 vol.1},
}
\end{filecontents}
\documentclass{article}
\usepackage[style=alphabetic,%
backend=biber,
maxnames=99,
maxalphanames=1,
backref=true,
doi=false,isbn=false,url=false,
backref=false,
]{biblatex}
\renewcommand*{\labelalphaothers}{}
\bibliography{references.bib}
\begin{document}
\noindent This is a looong sentence which will lead to hyphenation in the bib label: \cite{Baader1989}
\printbibliography[prefixnumbers = P-]
\end{document}
答案1
prefixnumbers
最新版本的 不再支持biblatex
。
\begin{filecontents}{\jobname.bib}
@InProceedings{Baader1989,
Title = {Direct self control of inverter-fed induction machine, a basis for speed control without speed-measurement},
Author = {Baader, U. and Depenbrock, M. and Gierse, Georg},
Booktitle = {Industry Applications Society Annual Meeting, 1989., Conference Record of the 1989 IEEE},
Year = {1989},
Month = {Oct},
Pages = {486-492 vol.1},
}
\end{filecontents}
\documentclass{article}
\usepackage[style=alphabetic,%
backend=biber,
maxnames=99,
maxalphanames=1,
backref=true,
doi=false,isbn=false,url=false,
backref=false,
]{biblatex}
\renewcommand*{\labelalphaothers}{}
\addbibresource{\jobname.bib}
\newrobustcmd{\safehyphen}{\ifincsname-\else\mbox{-}\fi}
\begin{document}
\newrefcontext[labelprefix=P\safehyphen]
\noindent This is a looong sentence which will lead to
hyphenation in the bib label: \cite{Baader1989}
\printbibliography
\end{document}
我相信同样的策略在旧方法下也能奏效。问题是前缀在两个不同的地方使用:用于打印和用于形成控制序列名称,因此除非我们使用技巧,否则在那里添加宏将不起作用\ifincsname
。
注意:我使用 TeX Live 2014 进行测试,
\newrobustcmd{\safehyphen}{\ifincsname-\else\mbox{-}\fi}
在序言中
\printbibliography[prefixnumbers = P\safehyphen]
作品。