[luatex] How to change hyphenation codes with the change of \language in LuaTeX?

Igor Liferenko igor.liferenko at gmail.com
Fri Oct 9 23:42:41 CEST 2015


In different languages, one and the same character may and may not be
used in hyphenation. For example: in English, quote (') can not be
part of word, whereas in French it is part of word.

Normally, one has to do \lccode`\'=`\' and \lccode`\'=0 manually each
time when changing language. By using \savinghyphcodes=1 this is done
automatically.

By compiling the following examples, we show that the word *is*
hyphenated in the second case, in spite of the fact that \lccode`\' is
zero. This is because \savinghyphcodes=1 is used.

    $ cat `kpsewhich hyph-fr.tex` | iconv -f utf8 -t cp1252 > hyphfr.tex

Create myfmt.ini:

    \input plain
    \newlanguage\french
    \language\french
    \begingroup
    \savinghyphcodes=1
    \lccode`\'=`\'
    \newcount\n \n=128 \loop\ifnum\n<255 \lccode\n=\n \advance\n by1\repeat
    \input hyphfr
    \endgroup
    \chardef\english=0
    \language\english
    \dump

Generate new format:

    $ etex -ini -etex myfmt.ini

Create test.tex:

    \hsize=1pt
    \hfuzz=10em
    \parindent=0pt
    \language\french
    \the\lccode`\'\ l'installation
    \hbox to 10em {\hrulefill}
    \language\english
    \the\lccode`\'\ l'installation
    \hbox to 10em {\hrulefill}
    \language\french
    \the\lccode`\'\ l'installation
    \bye

Compile test.tex with new format:

    $ etex -fmt myfmt test.tex

Show the output:

    $ xdvi test.dvi

How to achieve with LuaTeX the same functionality as was demonstrated
with e-TeX?


More information about the luatex mailing list