禁止 biblalatex 書目標簽和前綴編號之間的連字符

禁止 biblalatex 書目標簽和前綴編號之間的連字符

如果在 biblatex 中使用前綴作為書目標簽,那麼前綴和實際書目標簽之間經常會出現連字符,特別是對於較長的前綴。

在此輸入影像描述

如何避免這種情況?

這裡提供的解決方案沒有任何影響。我敢肯定在大多數情況下會修復它,但我並不總是使用它,我想要一個更安全的解決方案。

我也知道\mbox{...},但我不想手動將每個 cite 命令放在那裡。

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

作品。

相關內容