Consider the following MWE:




This compiles fine with pdflatex but not with lualatex. Why is there an error when using the latest hyphenation patterns? Can I make them work with lualatex?

This is LuaTeX, Version beta-0.70.1-2011061410 (rev 4277) 
 restricted \write18 enabled.
LaTeX2e <2011/06/27>
LuaTeX adaptation of babel <v3.8l-luatex-1.5> and hyphenation patterns for engl
ish, dumylang, nohyphenation, loaded.
Document Class: scrbook 2012/03/08 v3.10a KOMA-Script document class (book)
Package scrlfile, 2011/03/09 v3.09 KOMA-Script package (loading files)
                  Copyright (C) Markus Kohm

))) (/usr/local/texlive/2011/texmf-dist/tex/latex/koma-script/tocbasic.sty)
Package typearea, 2012/03/08 v3.10a KOMA-Script package (type area)
                  Copyright (C) Frank Neukam, 1992-1994
                  Copyright (C) Markus Kohm, 1994-

)) (/usr/local/texlive/2011/texmf-dist/tex/generic/babel/babel.sty
! LuaTeX error ...11/texmf-dist/tex/luatex/hyph-utf8/luatex-hyphen.lua:60: luat
ex-hyphen: \language0 should be dumped in the format
stack traceback:
    [C]: in function 'error'
    ...11/texmf-dist/tex/luatex/hyph-utf8/luatex-hyphen.lua:22: in function 'err'
    ...11/texmf-dist/tex/luatex/hyph-utf8/luatex-hyphen.lua:60: in function 'loadl
    <\directlua >:1: in main chunk.
\bbl@patterns ...pestring {#1}", \the \language )}
                                                  \fi \fi \fi 
l.131 \main@language{english}
  • 1
    No errors here, what is the version of Babel printed in the top of your log? Here I've LuaTeX adaptation of babel <v3.8l-luatex-1.5>, I suspect earlier versions to cause an error (recently the issue with Babel aliases was fixed). Commented May 4, 2012 at 18:33
  • I am sorry, I put in the wrong documentclass. It now turns out it just does not work with the KOMA Script classes. Can you compile the above code as well? See also the error message.
    – Ingo
    Commented May 4, 2012 at 22:25
  • Still no error here. Commented May 4, 2012 at 22:35

3 Answers 3


To answer the last question of the OP "Can I make them work with lualatex?":

Patterns from package dehyph-exptl are already included in package hyph-utf8 and those patterns are activated for UTF-8 aware TeX engines, e.g., LuaTeX and XeTeX. Because German patterns for TeX and pdfTeX are frozen, package hyph-utf8 contains conventional German patterns, too, but activates those only for said 8 bit TeX engines.

That is, when using LuaLaTeX you don't need to care about packages dehyph-exptl and hyph-subst at all. This example

% \usepackage[ngerman]{babel}

when compiled with LaTeX and LuaLaTeX should show the following results:

             german           ngerman

LaTeX        mo-d-ern-ste     mo-d-erns-te
LuaLaTeX     mo-dern-ste      mo-derns-te

You can find out what version of experimental German patterns are shipped with package hyph-utf8 (usually the latest) by typing

$head `kpsewhich hyph-de-1901.lic.txt`

on the shell. Windows users type

>for /F "usebackq" %f in (`kpsewhich hyph-de-1901.lic.txt`) do more "%f"

on the command-line. Note the backquotes surrounding the kpsewhich calls!


I've got no error when compiling with LuaTeX, but hyphsubst doesn't seem to work with LuaTeX. You can verify by running the following document with LuaTeX:


It should report Meis-ter but reports Mei-ster. With luatex -recorder test.tex you can look into the generated .fls file and see that only the file hyph-de-1901.pat.txt gets loaded.

  • 1
    No wonder, loading hyphenation patterns is completely different under lualatex. Commented May 4, 2012 at 19:49
  • @KhaledHosny And why shouldn't hyphsubst be able to switch between different backends as it does now with LaTeX and TeX? I don't see a technical difficulty.
    – topskip
    Commented May 4, 2012 at 19:58
  • 1
    I’ve no idea how hyphsubst works, but without it’s author explicitly adding support for LuaTeX, it is unlikely to work out of box. We have LuaTeX specific version of Babel’s hyphen.cfg to handle loading patterns in a LuaTeX specific way. Commented May 4, 2012 at 20:10
  • @PatrickGundlach I've added some code; can you point to a word that's hyphenated differently with ngerman and ngerman-x-latest?
    – egreg
    Commented May 5, 2012 at 13:43
  • @egreg ab-fal-lauf-be-rei-tung (ngerman) and ab-fall-auf-be-rei-tung (latest)
    – topskip
    Commented May 5, 2012 at 14:56

hyphsubst simply changes the number associated to the control sequence that LaTeX uses when choosing a language.

For instance \selectlanguage{ngerman} executes, among other things, \language\l@ngerman and \l@ngerman is defined at format creation to be the number "1E (on my machine, it can vary according to the language.dat file).

The number corresponding to ngerman-x-latest is (on my machine) "4.

When one says


the basic action is to change the meaning of \l@ngerman into "4; more precisely, the action is

\chardef\l@ngerman=\csname l@ngerman-x-latest\endcsname

Of course, if the languages are not preloaded, as it happens with LuaLaTeX, this can't work (precautions are taken in the package so as a correct assignment is performed even if the meaning of \csname l@ngerman-x-latest\endcsname was \relax). That's why we end with the patterns for English, I guess.

A possible step towards a solution

Apparently, LuaLaTeX knows about the correct numbers, so what's needed is to force loading the correct language. A test:


%% print the numbers
\typeout{ngerman: \number\csname l@ngerman\endcsname}
\typeout{ngerman-x-latest: \number\csname l@ngerman-x-latest\endcsname}




\typeout{Current language: \number\language}


\typeout{Current language: \number\language}


The relevant part of the log file shows

ngerman: 30
ngerman-x-latest: 4
Current language: 30
Current language: 4

so the value of \language seems to be correctly set. However the .fls file reports only

INPUT /usr/local/texlive/2011/texmf-dist/tex/generic/hyph-utf8/patterns/txt/hyph-de-1996.pat.txt
INPUT /usr/local/texlive/2011/texmf-dist/tex/generic/hyph-utf8/patterns/txt/hyph-de-1996.pat.txt
INPUT /usr/local/texlive/2011/texmf-dist/tex/generic/hyph-utf8/patterns/txt/hyph-de-1996.hyp.txt

which seems to mean that the hyphenation patterns for ngerman-x-latest are not loaded.

I've tried to add something like

%% Load the new language

in the preamble or in the document, in order to see if the patterns are loaded, but this doesn't seem so.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .