Запретить переносы между меткой biblatatex bib и префиксными номерами

Запретить переносы между меткой biblatatex bib и префиксными номерами

Если в 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]

работает.

Связанный контент