latex3 / babel

The babel system for LaTeX, LuaLaTeX and XeLaTeX
LaTeX Project Public License v1.3c
124 stars 34 forks source link

Overriding hyphenation rules #226

Closed greleigh closed 1 year ago

greleigh commented 1 year ago

I believe this is more of an issue with documentation, though I found great confusion in the way babel handles/ignores overrides through \babelprovide.

Example in case. Main language should be UKenglish but with USenglish hyphenations (UKenglish hyphenation rules are for “Oxford” English and are far from common British English but that’s another matter).

Expected solution based on https://latex3.github.io/babel/guides/using-babelprovide-to-modify-or-extend-locales.html would be

\documentclass{minimal}
\usepackage[UKenglish]{babel}
\babelprovide[hyphenrules=USenglish]{UKenglish} % or
% \babelprovide[hyphenrules=english]{UKenglish} % or even
% \babelprovide[hyphenrules=USenglish,main]{UKenglish}
\showhyphens{versatile acknowledge} % gives ver-sat-ile ac-know-ledge

Working solution is to load babel with nil language and set UKenglish as main language:

\documentclass{minimal}
\usepackage{babel} % load `nil` language
\babelprovide[import,hyphenrules=USenglish,main]{UKenglish} % option `import` provides \today etc.
\showhyphens{versatile acknowledge} % gives ver-sa-tile ac-knowl-edge

I could find no comparable documentation in the babel.pdf (version 3.86) for setting hyphenation patterns.

jbezos commented 1 year ago

I think it’s related to https://github.com/latex3/babel/issues/122#issuecomment-800248692.