View on GitHub


The multilingual framework for localizing LaTeX, LuaLaTeX, XeLaTeX

Using \babelprovide to modify or extend locales

As explained in the manual, \babelprovide is an all-purpose command to both define a new language and modify an existing language. This article provides examples on how to modify a language loaded as a package option. It assumes there isn’t a previous \babelprovide or provide=* for that language.

All the examples assume:


Changing the hyphenation rules

Because there are several criteria, or you must follow and editorial style. The following example just uses the default Spanish rules in English


Native digits

The required ones are already defined in the corresponding ini files, but they can be modified and even added as shown:


This example is somewhat absurd, but now \englishdigits{264} will print cge. ⚠ It doesn’t work with pdftex yet, only xetex and luatex.


Currently they can be changed only with imported data:

\babelprovide[import, date.gregorian/date.long = {[d] ([MMMM]) [y]}]{english}

Set the hyphen to none

Only with luatex:

\babelprovide[typography/prehyphenchar = 0]{english}

This setting may work with xetex, but getting rid of the hyphen char in this engine is not trivial, because you must rely on the font, and not all fonts behave the same, but babel 3.46 will do its best.

New counters

You can define new counters freely, and assign them to \alph:

\babelprovide[counters/alphabetic = á é í ó ú, % Define a counter named `alphabetic`
              alph = alphabetic                % Assign it to `\alph`

You can choose the name and instead of alphabetic it can be another one.