Why Doesn’t hyphsubst Work with LuaTeX?
At a glance
- 1. Check the pattern set
Confirm that the alternative hyphenation patterns are actually available in the LuaLaTeX format.
- 2. Check language names
Use the LaTeX language names that the format and language package recognize.
- 3. Check the alias
Make sure hyphsubst maps the language you select to the language containing the desired patterns.
- 4. Test the output
Use \showhyphens and inspect the log to see where the word can break.
hyphsubst is used to make a LaTeX language use another language’s hyphenation patterns. With LuaLaTeX, it can seem ineffective when the replacement pattern set is not present in the format, or when the document selects a different language name from the one you remapped.
The key distinction is between choosing patterns and loading patterns. A substitution can redirect a language to an available pattern set; it does not, by itself, guarantee that an arbitrary pattern file is loaded into LuaTeX.
What hyphsubst changes
LaTeX languages are associated with engine language identifiers. Those identifiers have hyphenation data—patterns and exceptions—available to the TeX engine. hyphsubst provides a way to make one language name use the patterns associated with another language.
For example, conceptually, you might want the language selected as A to use the patterns associated with B. This only works if the format already contains the pattern data for B, and if your language package uses the language name you have redirected.
That qualification matters under LuaLaTeX just as it does under other engines: a name in the document is not itself a pattern file, and a substitution is not a general-purpose pattern loader.
Why it can appear not to work with LuaTeX
The most common causes are:
- The replacement patterns are not loaded. LuaLaTeX normally uses the patterns configured for its format. If the alternative set was not included when the format was built, substituting its name cannot make those patterns available.
- The wrong language name is being changed. The name passed to
hyphsubstmust correspond to the LaTeX language identifier used by your setup. Package-specific names and format names are not always interchangeable. - The document selects a different language. Babel or another language package controls which language is active in a paragraph. A substitution for one identifier will not affect text set under another.
- The test word has no useful alternative break. A change may be working without changing the breakpoints of the particular word you checked. Hyphenation also depends on exceptions, language settings, and penalties.
So LuaTeX is not inherently unable to use substituted patterns. The practical limitation is that the requested pattern data must be available to the engine, and the document must select the language identifier that has been redirected.
A practical diagnostic
First verify what the current language setup does without substitution. This small document asks LaTeX to report possible hyphenation points in the log:
\documentclass{article}
\usepackage[english]{babel}
\begin{document}
\showhyphens{hyphenation representation extraordinary}
\end{document}
Compile it with LuaLaTeX and inspect the .log file. \showhyphens is diagnostic: it reports candidate breakpoints, rather than inserting visible hyphens into the typeset paragraph. Try the same test after configuring the substitution. If the reported points do not change, first verify that the alternative patterns were loaded and that the intended language is active.
When using hyphsubst, follow its documented command syntax and ordering for your version. In particular, check the exact language identifiers supplied by your TeX distribution and language package; do not assume that a pattern-file name is also the LaTeX language name.
How to make the replacement patterns available
If the intended patterns are missing, configure them in the pattern list used to build the LuaLaTeX format. The exact configuration file and rebuild procedure depend on the TeX distribution. After making the change, rebuild the format and verify that the language appears in the format’s hyphenation data. Alternatively, choose a pattern set already loaded by your installation.
If you use Babel, check its documentation for the supported language and hyphenation configuration for your version. Let Babel select the language normally, then ensure the substitution targets that language’s actual LaTeX identifier. Avoid manually changing the engine’s language number unless you have a specific reason; it can leave the language package and the engine out of sync.
Common mistakes
- Expecting
hyphsubstto load an arbitrary file. Its substitution feature is not a substitute for adding patterns to the format configuration. - Using a name from the wrong layer. A name in a pattern configuration file, a Babel option, and a LaTeX language control sequence may differ.
- Testing before the relevant language is selected. The active language determines which patterns apply to a paragraph. Test within text where that language is actually active.
- Assuming unchanged output proves failure. Compare diagnostic breakpoints for words known to differ between the two pattern sets, and check exceptions as well as patterns.
In short, check the loaded pattern data first, then check the alias and the active language. If the replacement patterns are not present in the LuaLaTeX format, make them available there before expecting hyphsubst to select them.
References
- The hyphsubst package documentation
- The Babel package documentation
- The LuaTeX Reference Manual
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.