# [luatex] MWE now failing with recent TeX Live update

Ulrike Fischer luatex at nililand.de
Fri Mar 18 10:21:11 CET 2016

Am Thu, 17 Mar 2016 13:01:09 -0600 schrieb Luis Rivera:

>>> Babel at all cost; how do think I should explain to them that they
>>> should load it after all?

>> As I said, the base' option in babel just preloads the
>> patterns. That's all -- it loads them and exits immediately.
>> The babel core is not loaded at all (well, except the parts
>> which are, unfortunately, preloaded when the format is built).
>>
>
> Correct me if I'm wrong, but
>
> 1. the babel core (the language hyphenation pattern switching
> mechanism) is *not* _unfortunately_ loaded with babel: it is part of
> the core functionality of a multilingual LaTeX.
>
> 2. Does your remark imply that you ask the user to call _both_ babel
> (babel.sty, not only the kernel part, even if but with one option)
> _and_ polyglossia (sty, plus language options), even though you don't
> mean to use babel? Isn't that first call completely redundant?

The problem is only with luatex. With other engines you can load
hyphenation patterns e.g. like this (assuming that ngerman patterns
have been dumped in the format):

\documentclass{article}
\textwidth=0.5cm
\begin{document}
\makeatletter\bbl at patterns{ngerman}\makeatother
Minister Minister
\end{document}

This will still use babel code (e.g. from hyphen.cfg) but code that
is part of the format.

lua(la)tex doesn't need to preload patterns in the format but can
load them on-the-fly. That's what the package luatex-hyphen,
polylgossia and the new babel code are doing.  But this needs
lua-code, and it is not so easy to dump lua code in the format
(see e.g.
http://tex.stackexchange.com/questions/121728/how-can-i-dump-lua-code-to-a-format-file)
(and perhaps if the code were in the format the clash would be
greater ...)
so it is now loaded when at least the base part of the babel package

So this is a similar minimal example to the one above for lualatex

\documentclass{article}
\usepackage[base]{babel}

\textwidth=0.5cm
\begin{document}
\makeatletter\bbl at patterns@lua{ngerman}\makeatother
Minister Minister
\end{document}

this: only luababel.def and around 30 lines of helper definitions (I
didn't try to find out if all are necessary):

\input luababel.def

\@ifundefined{\expandafter\@gobble\string#1}%
{\def#1{#2}}%
{\expandafter\def\expandafter#1\expandafter{#1#2}}}
\def\bbl at csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}%
\long\def\bbl at afterelse#1\else#2\fi{\fi#1}
\long\def\bbl at afterfi#1\fi{\fi#1}
\def\bbl at loop#1#2#3{\bbl@@loop#1{#3}#2,\@nnil,}
\def\bbl at loopx#1#2{\expandafter\bbl at loop\expandafter#1\expandafter{#2}}
\def\bbl@@loop#1#2#3,{%
\ifx\@nnil#3\relax\else
\def#1{#3}#2\bbl at afterfi\bbl@@loop#1{#2}%
\fi}
\def\bbl at for#1#2#3{\bbl at loopx#1{#2}{\ifx#1\@empty\else#3\fi}}
\def\AfterBabelLanguage#1{%
\ifx\bbl at languages\@undefined\else
\begingroup
\catcode\^^I=12
\@ifpackagewith{babel}{showlanguages}{%
\begingroup
\def\bbl at elt#1#2#3#4{\wlog{#2^^I#1^^I#3^^I#4}}%
\wlog{<*languages>}%
\bbl at languages
\wlog{</languages>}%
\endgroup}{}
\endgroup
\def\bbl at elt#1#2#3#4{%
\ifnum#2=\z@
\gdef\bbl at nulllanguage{#1}%
\def\bbl at elt##1##2##3##4{}%
\fi}%
\bbl at languages
\fi

(But imho it would be better to pack this base code in some
standalone file. Part of it could probably also go in the format.
That would make things clearer and better separate "babel core" from
"babel style".)

--
Ulrike Fischer
http://www.troubleshooting-tex.de/