6

After a recent update, the hyphenrules environment causes an error when used with polyglossia. I've been using it for a few years to specify the hyphenation of certain words by language. Here's a MWE:

\documentclass{article}
%\usepackage{fontspec}

\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\setotherlanguage{german}

\begin{hyphenrules}{german}
\hyphenation{Ü-ber-lief-er-ung}
\end{hyphenrules}

\begin{document}
Test
\end{document}

With TeX Live 2016 (fully updated), XeLaTeX typesets this document. With TeX Live 2017 as of today, it fails thus:

! Undefined control sequence.
<argument> ...nguageshorthands {none}\bbl@ifunset 
                                                  {\bbl@tempf hyphenmins}{\s...
l.11 \begin{hyphenrules}{german}

Am I doing something wrong? When I search for information on hyphenrules, everything I can find talks about babel. Should the language for \hyphenation be specified in another way with polyglossia?

Or is this a polyglossia bug? If so, that would make three that affect my document, and it has been a relatively long time since the last release. I might consider converting my long document to babel.

  • Did the example work a few days ago with TeX live 2017? It could have to do with a recent fontspec update (some parts of fontspec are still loaded, even though the package is commented out), but it could help to narrow down the culprit exactly if we know when the problem started. – moewe Nov 12 '17 at 19:39
  • 1
    Imho it is a babel bug. It just changed hyphenrules and seems to use an undefined command (with polyglossia) in the new definition. – Ulrike Fischer Nov 12 '17 at 20:03
  • 1
    I noticed today that it failed, and I last updated TeX Live last week, probably early in the week, so I wouldn't have gotten the 9 Nov. 2017 fontspec update, but I did notice that I got a babel update (3 Nov. 2017). – jcr Nov 12 '17 at 20:42
  • Yup, looks like a babel issue. My redefinition from tex.stackexchange.com/a/396614/35864 works (it was a copy of the code in 3.14 with one command renamed). But the new code in 3.15 is slightly different. – moewe Nov 12 '17 at 20:51
6

You can load babel with the base option to get the core definitions defined:

\documentclass{article}
\usepackage[base]{babel}
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\setotherlanguage{german}

\begin{hyphenrules}{german}
\hyphenation{Ü-ber-lief-er-ung}
\end{hyphenrules}

\textwidth=3mm
\begin{document}
Überlieferung Überlieferung Überlieferung Überlieferung

\selectlanguage{german}
Überlieferung Überlieferung Überlieferung Überlieferung


\end{document}
  • With this addition, XeLaTeX will now typeset my full document (as well as the MWE) with TeX Live 2017. – jcr Nov 12 '17 at 20:55
  • Does polyglossia take the definition of hyphenrules from babel? And why does it not take the other definitions as well? I noticed that my slight redefinition of 3.14's hyphenrules in tex.stackexchange.com/a/396614/35864 would still work. So it is indeed the use of the new commands \bbl@ifunset and friends that is problematic here. – moewe Nov 12 '17 at 20:57
  • 3
    @moewe: yes, hyphenrules and a few other commands are already defined in the format. But imho it is not good that they use commands which aren't (pre-)defined in switch.def too. I think I will write Javier. – Ulrike Fischer Nov 12 '17 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.