texlive[60757] Master/texmf-dist: babel (13oct21)

commits+karl at tug.org commits+karl at tug.org
Wed Oct 13 22:33:20 CEST 2021


Revision: 60757
          http://tug.org/svn/texlive?view=revision&revision=60757
Author:   karl
Date:     2021-10-13 22:33:19 +0200 (Wed, 13 Oct 2021)
Log Message:
-----------
babel (13oct21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/babel/README.md
    trunk/Master/texmf-dist/doc/latex/babel/babel.pdf
    trunk/Master/texmf-dist/source/latex/babel/babel.dtx
    trunk/Master/texmf-dist/source/latex/babel/babel.ins
    trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
    trunk/Master/texmf-dist/source/latex/babel/locale.zip
    trunk/Master/texmf-dist/tex/generic/babel/babel.def
    trunk/Master/texmf-dist/tex/generic/babel/babel.sty
    trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
    trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-de-CH-1901.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-de-CH-1996.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-de-CH.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-AU.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-CA.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-GB.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-NZ.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-US.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-fr-CA.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-fr-CH.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-fr-LU.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/ja/babel-ja.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/ko/babel-ko-Hani.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/ko/babel-ko.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/nb/babel-nb.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl-BA.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl-ME.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl-XK.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Latn-ME.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Latn-XK.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Latn.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans-HK.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans-MO.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans-SG.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hant-HK.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hant-MO.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hant.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh.ini
    trunk/Master/texmf-dist/tex/generic/babel/luababel.def
    trunk/Master/texmf-dist/tex/generic/babel/nil.ldf
    trunk/Master/texmf-dist/tex/generic/babel/xebabel.def

Added Paths:
-----------
    trunk/Master/texmf-dist/tex/generic/babel/locale/no/
    trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-no.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-norsk.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-norwegian.tex

Removed Paths:
-------------
    trunk/Master/texmf-dist/tex/generic/babel/locale/nb/babel-norsk.tex

Modified: trunk/Master/texmf-dist/doc/latex/babel/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/babel/README.md	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/doc/latex/babel/README.md	2021-10-13 20:33:19 UTC (rev 60757)
@@ -1,4 +1,4 @@
-## Babel 3.63
+## Babel 3.64
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages. Many
@@ -8,9 +8,9 @@
 
 The latest stable version is available on <https://ctan.org/pkg/babel>.
 
-Changes in version 3.63 are described in:
+Changes in version 3.64 are described in:
 
-https://latex3.github.io/babel/news/whats-new-in-babel-3.63.html
+https://latex3.github.io/babel/news/whats-new-in-babel-3.64.html
 
 Apart from the manual, you can find information on some aspects of babel at:
 
@@ -46,6 +46,16 @@
 
 ### Summary of Latest changes
 ```
+3.64   2021-10-13
+       * Added a few counters to CJK.
+       * Restored the previous behavior of \selectlanguage with
+         relation to \write (see #114).
+       * Fixes:
+         - babel errors on document option 'chinese' (#141).
+         - name.babel in ini files set inconsistently (#149).
+       * Now babel.def and babel.sty are separate files (for
+         Plain-based formats and LaTeX, respectively).
+         
 3.63   2021-07-22
        * Fixes a severe bug with CJK and XeTeX introduced in 3.62.
        

Modified: trunk/Master/texmf-dist/doc/latex/babel/babel.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2021-10-13 20:33:19 UTC (rev 60757)
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2021/07/22 v3.63 The Babel package]
+\ProvidesFile{babel.dtx}[2021/10/13 v3.64 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -788,9 +788,11 @@
   |\text...| is heavily overloaded in \LaTeX{} and conflicts with
   existing macros may arise (|\textlatin|, |\textbar|, |\textit|,
   |\textcolor| and many others). The same applies to environments,
-  because |arabic| conflicts with |\arabic|. Except if there is a
-  reason for this ‘syntactical sugar’, the best option is to stick to
-  the default selectors or to define your own alternatives. 
+  because |arabic| conflicts with |\arabic|. Furthermore, and because of
+  this overloading, detecting the language of a chunk of text by
+  external tools can become unfeasible. Except if there is a reason for
+  this ‘syntactical sugar’, the best option is to stick to the default
+  selectors or to define your own alternatives.
 \end{warning}
 
 \begin{example}
@@ -2278,7 +2280,7 @@
   \textit{Package fontspec Warning: 'Language 'LANG' not available for
   font 'FONT' with script 'SCRIPT' 'Default' language used instead'}.
 
-  \textbf{This is \textit{not} and error.} This warning is shown by
+  \textbf{This is \textit{not} an error.} This warning is shown by
   \textsf{fontspec}, not by \babel. It can be irrelevant for English,
   but not for many other languages, including Urdu and Turkish. This is
   a useful and harmless warning, and if everything is fine with your
@@ -2290,7 +2292,7 @@
   standard families} \textit{Package babel Info: The following fonts
   are not babel standard families}.
 
-  \textbf{This is \textit{not} and error.} \babel{} assumes that if you
+  \textbf{This is \textit{not} an error.} \babel{} assumes that if you
   are using |\babelfont| for a family, very likely you want to define
   the rest of them. If you don't, you can find some inconsistencies
   between families. This checking is done at the beginning of the
@@ -4859,7 +4861,7 @@
 \item Active chars where not reset at the end of language options, and
   that lead to incompatibilities between languages.
 
-\item |\textormath| raised and error with a conditional.
+\item |\textormath| raised an error with a conditional.
 
 \item |\aliasshorthand| didn't work (or only in a few and very specific
   cases).
@@ -5024,8 +5026,8 @@
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.63>>
-%<<date=2021/07/22>>
+%<<version=3.64>>
+%<<date=2021/10/13>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -5111,9 +5113,13 @@
 \def\bbl at exp#1{%
   \begingroup
     \let\\\noexpand
-    \def\<##1>{\expandafter\noexpand\csname##1\endcsname}%
+    \let\<\bbl at exp@en
+    \let\[\bbl at exp@ue
     \edef\bbl at exp@aux{\endgroup#1}%
   \bbl at exp@aux}
+\def\bbl at exp@en#1>{\expandafter\noexpand\csname#1\endcsname}%
+\def\bbl at exp@ue#1]{%
+  \unexpanded\expandafter\expandafter\expandafter{\csname#1\endcsname}}%
 %    \end{macrocode}
 % \end{macro}
 %
@@ -5146,7 +5152,7 @@
 % \begin{macro}{\bbl at ifunset}
 %   To check if a macro is defined, we create a new macro, which does
 %   the same as |\@ifundefined|. However, in an $\epsilon$-tex engine,
-%   it is based on |\ifcsname|, which is more efficient, and do not
+%   it is based on |\ifcsname|, which is more efficient, and does not
 %   waste memory.
 %
 %    \begin{macrocode}
@@ -5157,7 +5163,7 @@
     \else
       \expandafter\@secondoftwo
     \fi}
-  \bbl at ifunset{ifcsname}%
+  \bbl at ifunset{ifcsname}% TODO. A better test?
     {}%
     {\gdef\bbl at ifunset#1{%
        \ifcsname#1\endcsname
@@ -5358,7 +5364,8 @@
 %
 % The following adds some code to |\extras...| both before and after,
 % while avoiding doing it twice. It's somewhat convoluted, to deal with
-% |#|'s.
+% |#|'s. Used to deal with alph, Alph and frenchspacing when there are
+% already changes (with |\babel at save|). 
 %
 %    \begin{macrocode}  
 \def\bbl at extras@wrap#1#2#3{% 1:in-test, 2:before, 3:after
@@ -5446,21 +5453,16 @@
 %
 % \subsection{The Package File (\LaTeX, \texttt{babel.sty})}
 %
-% This file also takes care of a number of compatibility issues with
-% other packages an defines a few aditional package options. Apart from
-% all the language options below we also have a few options that
-% influence the behavior of language definition files.
-%
-% Many of the following options don't do anything themselves, they are
-% just defined in order to make it possible for babel and language
-% definition files to check if one of them was specified by the user.
-%
-% The first two options are for debugging.
-%
 %    \begin{macrocode}
 %<*package>
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
 \ProvidesPackage{babel}[<@date@> <@version@> The Babel package]
+%    \end{macrocode}
+% 
+% Start with some “private” debugging tool, and then define macros for
+% errors.
+%
+%    \begin{macrocode}
 \@ifpackagewith{babel}{debug}
   {\providecommand\bbl at trace[1]{\message{^^J[ #1 ]}}%
    \let\bbl at debug\@firstofone
@@ -5475,64 +5477,43 @@
      \directlua{ Babel = Babel or {}
        Babel.debug = false }%
    \fi}
+\def\bbl at error#1#2{%
+  \begingroup
+    \def\\{\MessageBreak}%
+    \PackageError{babel}{#1}{#2}%
+  \endgroup}
+\def\bbl at warning#1{%
+  \begingroup
+    \def\\{\MessageBreak}%
+    \PackageWarning{babel}{#1}%
+  \endgroup}
+\def\bbl at infowarn#1{%
+  \begingroup
+    \def\\{\MessageBreak}%
+    \GenericWarning
+      {(babel) \@spaces\@spaces\@spaces}%
+      {Package babel Info: #1}%
+  \endgroup}
+\def\bbl at info#1{%
+  \begingroup
+    \def\\{\MessageBreak}%
+    \PackageInfo{babel}{#1}%
+  \endgroup}
+%    \end{macrocode}
+%
+% This file also takes care of a number of compatibility issues with
+% other packages an defines a few aditional package options. Apart from
+% all the language options below we also have a few options that
+% influence the behavior of language definition files.
+%
+% Many of the following options don’t do anything themselves, they are
+% just defined in order to make it possible for babel and language
+% definition files to check if one of them was specified by the user.
+%
+% But first, include here the \textit{Basic macros} defined above.
+%
+%    \begin{macrocode}
 <@Basic macros@>
-  % Temporarily repeat here the code for errors. TODO.
-  \def\bbl at error#1#2{%
-    \begingroup
-      \def\\{\MessageBreak}%
-      \PackageError{babel}{#1}{#2}%
-    \endgroup}
-  \def\bbl at warning#1{%
-    \begingroup
-      \def\\{\MessageBreak}%
-      \PackageWarning{babel}{#1}%
-    \endgroup}
-  \def\bbl at infowarn#1{%
-    \begingroup
-      \def\\{\MessageBreak}%
-      \GenericWarning
-        {(babel) \@spaces\@spaces\@spaces}%
-        {Package babel Info: #1}%
-    \endgroup}
-  \def\bbl at info#1{%
-    \begingroup
-      \def\\{\MessageBreak}%
-      \PackageInfo{babel}{#1}%
-    \endgroup}
-\def\bbl at nocaption{\protect\bbl at nocaption@i}
-% TODO - Wrong for \today !!! Must be a separate macro.
-\def\bbl at nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
-  \global\@namedef{#2}{\textbf{?#1?}}%
-  \@nameuse{#2}%
-  \edef\bbl at tempa{#1}%
-  \bbl at sreplace\bbl at tempa{name}{}%
-  \bbl at warning{%
-    \@backslashchar#1 not set for '\languagename'. Please,\\%
-    define it after the language has been loaded\\%
-    (typically in the preamble) with\\% 
-    \string\setlocalecaption{\languagename}{\bbl at tempa}{..}\\%
-    Reported}}
-\def\bbl at tentative{\protect\bbl at tentative@i}
-\def\bbl at tentative@i#1{%
-  \bbl at warning{%
-    Some functions for '#1' are tentative.\\%
-    They might not work as expected and their behavior\\%
-    may change in the future.\\%
-    Reported}}
-\def\@nolanerr#1{%
-  \bbl at error
-    {You haven't defined the language '#1' yet.\\%
-     Perhaps you misspelled it or your installation\\%
-     is not complete}%
-    {Your command will be ignored, type <return> to proceed}}
-\def\@nopatterns#1{%
-  \bbl at warning
-    {No hyphenation patterns were preloaded for\\%
-     the language '#1' into the format.\\%
-     Please, configure your TeX system to add them and\\%
-     rebuild the format. Now I will use the patterns\\%
-     preloaded for \bbl at nulllanguage\space instead}}
-    % End of errors
 \@ifpackagewith{babel}{silent}
   {\let\bbl at info\@gobble
    \let\bbl at infowarn\@gobble
@@ -5601,7 +5582,7 @@
   \global\let\@ifl at ter@@\@ifl at ter
   \def\@ifl at ter#1#2#3#4#5{\global\let\@ifl at ter\@ifl at ter@@}%
   \endinput}{}%
-% \end{macrocode}
+%    \end{macrocode}
 %
 % \subsection{\texttt{key=value} options and other general option}
 %
@@ -5714,8 +5695,12 @@
   \bbl at xin@{\string=}{\CurrentOption}%
   \ifin@
     \expandafter\bbl at tempa\CurrentOption\bbl at tempa
-  \else
-    \bbl at add@list\bbl at language@opts{\CurrentOption}%
+  \else  
+    \bbl at xin@{,\CurrentOption,}{,\bbl at language@opts,}%
+    \ifin@
+      \bbl at exp{\\\bbl at replace\\\bbl at language@opts{,\CurrentOption,}{}}%
+    \fi
+    \edef\bbl at language@opts{\bbl at language@opts,\CurrentOption,}
   \fi}
 %    \end{macrocode}
 %
@@ -5726,8 +5711,16 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\ifx\bbl at opt@provide\@nnil\else % Tests. Ignore.
+\ifx\bbl at opt@provide\@nnil
+  \let\bbl at opt@provide\@empty  % %%% MOVE above
+\else 
   \chardef\bbl at iniflag\@ne
+  \bbl at exp{\\\bbl at forkv{\@nameuse{@raw at opt@babel.sty}}}{%
+    \in@{,provide,}{,#1,}%
+    \ifin@
+      \def\bbl at opt@provide{#2}%
+      \bbl at replace\bbl at opt@provide{;}{,}%
+    \fi}
 \fi
 % 
 %    \end{macrocode}
@@ -5813,10 +5806,13 @@
 \ifx\bbl at opt@safe\@undefined
   \def\bbl at opt@safe{BR}
 \fi
+%    \end{macrocode}
+%
+% Make sure the language set with `main` is the last one. 
+%
+%    \begin{macrocode}
 \ifx\bbl at opt@main\@nnil\else
-  \edef\bbl at language@opts{%
-    \ifx\bbl at language@opts\@empty\else\bbl at language@opts,\fi
-      \bbl at opt@main}
+  \edef\bbl at language@opts{\bbl at language@opts,\bbl at opt@main,}
 \fi
 %    \end{macrocode}
 %
@@ -5837,1286 +5833,36 @@
       \expandafter\@secondoftwo
     \fi}
 \fi
-%    \end{macrocode}
-%
-% \textbf{Common definitions.} \textit{In progress.} Still based on
-% |babel.def|, but the code should be moved here.
-%
-%    \begin{macrocode}
-\input babel.def
-%    \end{macrocode}
-%
-% \subsection{Cross referencing macros}
-%
-% The \LaTeX\ book states:
-% \begin{quote}
-%   The \emph{key} argument is any sequence of letters, digits, and
-%   punctuation symbols; upper- and lowercase letters are regarded as
-%   different.
-% \end{quote}
-% When the above quote should still be true when a document is
-% typeset in a language that has active characters, special care
-% has to be taken of the category codes of these characters when
-% they appear in an argument of the cross referencing macros.
-%
-% When a cross referencing command processes its argument, all
-% tokens in this argument should be character tokens with category
-% `letter' or `other'.
-%
-% The following package options control which macros are to be
-% redefined.
-%
-%    \begin{macrocode}
-%<<*More package options>>
-\DeclareOption{safe=none}{\let\bbl at opt@safe\@empty}
-\DeclareOption{safe=bib}{\def\bbl at opt@safe{B}}
-\DeclareOption{safe=ref}{\def\bbl at opt@safe{R}}
-%<</More package options>>
-%    \end{macrocode}
-%
-% \begin{macro}{\@newl at bel}
-%
-% First we open a new group to keep the changed setting of
-% |\protect| local and then we set the |@safe at actives| switch to
-% true to make sure that any shorthand that appears in any of the
-% arguments immediately expands to its non-active self.
-%
-%    \begin{macrocode}
-\bbl at trace{Cross referencing macros}
-\ifx\bbl at opt@safe\@empty\else
-  \def\@newl at bel#1#2#3{%
-   {\@safe at activestrue
-    \bbl at ifunset{#1@#2}%
-       \relax
-       {\gdef\@multiplelabels{%
-          \@latex at warning@no at line{There were multiply-defined labels}}%
-        \@latex at warning@no at line{Label `#2' multiply defined}}%
-    \global\@namedef{#1@#2}{#3}}}
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-%  \begin{macro}{\@testdef}
-%
-% An internal \LaTeX\ macro used to test if the labels that have
-% been written on the |.aux| file have changed.  It is called by
-% the |\enddocument| macro.
-%
-%    \begin{macrocode}
-  \CheckCommand*\@testdef[3]{%
-    \def\reserved at a{#3}%
-    \expandafter\ifx\csname#1@#2\endcsname\reserved at a
-    \else
-      \@tempswatrue
-    \fi}
-%    \end{macrocode}
-%
-% Now that we made sure that |\@testdef| still has the same definition
-% we can rewrite it. First we make the shorthands `safe'. Then we use
-% |\bbl at tempa| as an `alias' for the macro that contains the label
-% which is being checked. Then we define |\bbl at tempb| just as
-% |\@newl at bel| does it. When the label is defined we replace the
-% definition of |\bbl at tempa| by its meaning. If the label didn't
-% change, |\bbl at tempa| and |\bbl at tempb| should be identical macros.
-%
-%    \begin{macrocode}
-  \def\@testdef#1#2#3{%  TODO. With @samestring?
-    \@safe at activestrue
-    \expandafter\let\expandafter\bbl at tempa\csname #1@#2\endcsname
-    \def\bbl at tempb{#3}%
-    \@safe at activesfalse
-    \ifx\bbl at tempa\relax
-    \else
-      \edef\bbl at tempa{\expandafter\strip at prefix\meaning\bbl at tempa}%
-    \fi
-    \edef\bbl at tempb{\expandafter\strip at prefix\meaning\bbl at tempb}%
-    \ifx\bbl at tempa\bbl at tempb
-    \else
-      \@tempswatrue
-    \fi}
-\fi
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-% \begin{macro}{\ref}
-% \begin{macro}{\pageref}
-%
-% The same holds for the macro |\ref| that references a label and
-% |\pageref| to reference a page. We make them robust as well (if
-% they weren't already) to prevent problems if they should become
-% expanded at the wrong moment.
-%
-%    \begin{macrocode}
-\bbl at xin@{R}\bbl at opt@safe
-\ifin@
-  \bbl at redefinerobust\ref#1{%
-    \@safe at activestrue\org at ref{#1}\@safe at activesfalse}
-  \bbl at redefinerobust\pageref#1{%
-    \@safe at activestrue\org at pageref{#1}\@safe at activesfalse}
-\else
-  \let\org at ref\ref
-  \let\org at pageref\pageref
-\fi
-%    \end{macrocode}
-%
-%  \end{macro}
-%  \end{macro}
-%
-% \begin{macro}{\@citex}
-%
-% The macro used to cite from a bibliography, |\cite|, uses an
-% internal macro, |\@citex|.
-% It is this internal macro that picks up the argument(s),
-% so we redefine this internal macro and leave |\cite| alone. The
-% first argument is used for typesetting, so the shorthands need
-% only be deactivated in the second argument.
-%
-%    \begin{macrocode}
-\bbl at xin@{B}\bbl at opt@safe
-\ifin@
-  \bbl at redefine\@citex[#1]#2{%
-    \@safe at activestrue\edef\@tempa{#2}\@safe at activesfalse
-    \org@@citex[#1]{\@tempa}}
-%    \end{macrocode}
-%
-% Unfortunately, the packages \pkg{natbib} and \pkg{cite} need a
-% different definition of |\@citex|...
-% To begin with, \pkg{natbib} has a definition for |\@citex| with
-% \emph{three} arguments... We only know that a package is loaded
-% when |\begin{document}| is executed, so we need to postpone the
-% different redefinition.
-%
-%    \begin{macrocode}
-  \AtBeginDocument{%
-    \@ifpackageloaded{natbib}{%
-%    \end{macrocode}
-%
-% Notice that we use |\def| here instead of |\bbl at redefine| because
-% |\org@@citex| is already defined and we don't want to overwrite
-% that definition (it would result in parameter stack overflow
-% because of a circular definition).
-%
-% (Recent versions of \pkg{natbib} change dynamically |\@citex|, so PR4087
-% doesn't seem fixable in a simple way. Just load \pkg{natbib} before.)
-%
-%    \begin{macrocode}
-    \def\@citex[#1][#2]#3{%
-      \@safe at activestrue\edef\@tempa{#3}\@safe at activesfalse
-      \org@@citex[#1][#2]{\@tempa}}%
-    }{}}
-%    \end{macrocode}
-%
-% The package \pkg{cite} has a definition of |\@citex| where the
-% shorthands need to be turned off in both arguments.
-%
-%    \begin{macrocode}
-  \AtBeginDocument{%
-    \@ifpackageloaded{cite}{%
-      \def\@citex[#1]#2{%
-        \@safe at activestrue\org@@citex[#1]{#2}\@safe at activesfalse}%
-      }{}}
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-% \begin{macro}{\nocite}
-%
-% The macro |\nocite| which is used to instruct BiB\TeX\ to
-% extract uncited references from the database.
-%
-%    \begin{macrocode}
-  \bbl at redefine\nocite#1{%
-    \@safe at activestrue\org at nocite{#1}\@safe at activesfalse}
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-% \begin{macro}{\bibcite}
-%
-% The macro that is used in the |.aux| file to
-% define citation labels. When packages such as \pkg{natbib} or
-% \pkg{cite} are not loaded its second argument is used to typeset the
-% citation label. In that case, this second argument can contain
-% active characters but is used in an environment where
-% |\@safe at activestrue| is in effect. This switch needs to be reset
-% inside the |\hbox| which contains the citation label. In order to
-% determine during \file{.aux} file processing which definition of
-% |\bibcite| is needed we define |\bibcite| in such a way that it
-% redefines itself with the proper definition. We call
-% |\bbl at cite@choice| to select the proper definition for |\bibcite|.
-% This new definition is then activated.
-%
-%    \begin{macrocode}
-  \bbl at redefine\bibcite{%
-    \bbl at cite@choice
-    \bibcite}
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-% \begin{macro}{\bbl at bibcite}
-%
-% The macro |\bbl at bibcite| holds the definition of |\bibcite|
-% needed when neither \pkg{natbib} nor \pkg{cite} is loaded.
-%
-%    \begin{macrocode}
-  \def\bbl at bibcite#1#2{%
-    \org at bibcite{#1}{\@safe at activesfalse#2}}
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-% \begin{macro}{\bbl at cite@choice}
-%
-% The macro |\bbl at cite@choice| determines which definition of
-% |\bibcite| is needed. First we give |\bibcite| its default
-% definition.
-%
-%    \begin{macrocode}
-  \def\bbl at cite@choice{%
-    \global\let\bibcite\bbl at bibcite
-    \@ifpackageloaded{natbib}{\global\let\bibcite\org at bibcite}{}%
-    \@ifpackageloaded{cite}{\global\let\bibcite\org at bibcite}{}%
-    \global\let\bbl at cite@choice\relax}
-%    \end{macrocode}
-%
-% When a document is run for the first time, no \file{.aux} file is
-% available, and |\bibcite| will not yet be properly defined. In
-% this case, this has to happen before the document starts.
-%
-%    \begin{macrocode}
-  \AtBeginDocument{\bbl at cite@choice}
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-% \begin{macro}{\@bibitem}
-%
-% One of the two internal \LaTeX\ macros called by |\bibitem|
-% that write the citation label on the |.aux| file.
-%
-%    \begin{macrocode}
-  \bbl at redefine\@bibitem#1{%
-    \@safe at activestrue\org@@bibitem{#1}\@safe at activesfalse}
-\else
-  \let\org at nocite\nocite
-  \let\org@@citex\@citex
-  \let\org at bibcite\bibcite
-  \let\org@@bibitem\@bibitem
-\fi
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-% \subsection{Marks}
-%
-% \begin{macro}{\markright}
-% Because the output routine is asynchronous, we must pass the
-% current language attribute to the head lines. To achieve this we
-% need to adapt the definition of |\markright| and |\markboth|
-% somewhat. However, headlines and footlines can contain text
-% outside marks; for that we must take some actions in the output
-% routine if the 'headfoot' options is used. 
-%
-% We need to make some redefinitions to the output routine
-% to avoid an endless loop and to correctly handle the page number
-% in bidi documents.
-%
-%    \begin{macrocode}
-\bbl at trace{Marks}
-\IfBabelLayout{sectioning}
-  {\ifx\bbl at opt@headfoot\@nnil
-     \g at addto@macro\@resetactivechars{%
-       \set at typeset@protect
-       \expandafter\select at language@x\expandafter{\bbl at main@language}%
-       \let\protect\noexpand
-       \ifcase\bbl at bidimode\else % Only with bidi. See also above
-         \edef\thepage{%
-           \noexpand\babelsublr{\unexpanded\expandafter{\thepage}}}%
-       \fi}%
-   \fi}
-  {\ifbbl at single\else
-     \bbl at ifunset{markright }\bbl at redefine\bbl at redefinerobust
-     \markright#1{%
-       \bbl at ifblank{#1}%
-         {\org at markright{}}%
-         {\toks@{#1}%
-          \bbl at exp{%
-            \\\org at markright{\\\protect\\\foreignlanguage{\languagename}%
-              {\\\protect\\\bbl at restore@actives\the\toks@}}}}}%
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-%  \begin{macro}{\markboth}
-%  \begin{macro}{\@mkboth}
-%    The definition of |\markboth| is equivalent to that of
-%    |\markright|, except that we need two token registers. The
-%    documentclasses \cls{report} and \cls{book} define and set the
-%    headings for the page. While doing so they also store a copy of
-%    |\markboth| in |\@mkboth|. Therefore we need to check whether
-%    |\@mkboth| has already been set. If so we neeed to do that again
-%    with the new definition of |\markboth|. (As of Oct 2019, \LaTeX{}
-%    stores the definition in an intermediate macro, so it's not
-%    necessary anymore, but it's preserved for older versions.)
-%
-%    \begin{macrocode}
-     \ifx\@mkboth\markboth
-       \def\bbl at tempc{\let\@mkboth\markboth}
-     \else
-       \def\bbl at tempc{}
-     \fi
-     \bbl at ifunset{markboth }\bbl at redefine\bbl at redefinerobust
-     \markboth#1#2{%
-       \protected at edef\bbl at tempb##1{%
-         \protect\foreignlanguage
-         {\languagename}{\protect\bbl at restore@actives##1}}%
-       \bbl at ifblank{#1}%
-         {\toks@{}}%
-         {\toks@\expandafter{\bbl at tempb{#1}}}%
-       \bbl at ifblank{#2}%
-         {\@temptokena{}}%
-         {\@temptokena\expandafter{\bbl at tempb{#2}}}%
-       \bbl at exp{\\\org at markboth{\the\toks@}{\the\@temptokena}}}
-       \bbl at tempc
-     \fi}  % end ifbbl at single, end \IfBabelLayout
-%    \end{macrocode}
-%
-%  \end{macro}
-%  \end{macro}
-%
-% \subsection{Preventing clashes with other packages}
-%
-% \subsubsection{\pkg{ifthen}}
-%
-% \begin{macro}{\ifthenelse}
-%
-% Sometimes a document writer wants to create a special effect
-% depending on the page a certain fragment of text appears on. This
-% can be achieved by the following piece of code:
-%\begin{verbatim}
-%    \ifthenelse{\isodd{\pageref{some:label}}}
-%               {code for odd pages}
-%               {code for even pages}
-%\end{verbatim}
-% In order for this to work the argument of |\isodd| needs to be
-% fully expandable. With the above redefinition of |\pageref| it is
-% not in the case of this example. To overcome that, we add some
-% code to the definition of |\ifthenelse| to make things work.
-%
-% We want to revert the definition of |\pageref| and |\ref| to
-% their original definition for the first argument of |\ifthenelse|,
-% so we first need to store their current meanings.
-%
-% Then we can set the |\@safe at actives| switch and call the original
-% |\ifthenelse|. In order to be able to use shorthands in the
-% second and third arguments of |\ifthenelse| the resetting of the
-% switch \emph{and} the definition of |\pageref| happens inside
-% those arguments. 
-%
-%    \begin{macrocode}
-\bbl at trace{Preventing clashes with other packages}
-\bbl at xin@{R}\bbl at opt@safe
-\ifin@
-  \AtBeginDocument{%
-    \@ifpackageloaded{ifthen}{%
-      \bbl at redefine@long\ifthenelse#1#2#3{%
-        \let\bbl at temp@pref\pageref
-        \let\pageref\org at pageref
-        \let\bbl at temp@ref\ref
-        \let\ref\org at ref
-        \@safe at activestrue
-        \org at ifthenelse{#1}%
-          {\let\pageref\bbl at temp@pref
-           \let\ref\bbl at temp@ref
-           \@safe at activesfalse
-           #2}%
-          {\let\pageref\bbl at temp@pref
-           \let\ref\bbl at temp@ref
-           \@safe at activesfalse
-           #3}%
-        }%
-      }{}%
-    }
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-% \subsubsection{\pkg{varioref}}
-%
-% \begin{macro}{\@@vpageref}
-% \begin{macro}{\vrefpagenum}
-% \begin{macro}{\Ref}
-%
-% When the package varioref is in use we need to modify its
-% internal command |\@@vpageref| in order to prevent problems when
-% an active character ends up in the argument of |\vref|. The same
-% needs to happen for |\vrefpagenum|.
-%
-%    \begin{macrocode}
-  \AtBeginDocument{%
-    \@ifpackageloaded{varioref}{%
-      \bbl at redefine\@@vpageref#1[#2]#3{%
-        \@safe at activestrue
-        \org@@@vpageref{#1}[#2]{#3}%
-        \@safe at activesfalse}%
-      \bbl at redefine\vrefpagenum#1#2{%
-        \@safe at activestrue
-        \org at vrefpagenum{#1}{#2}%
-        \@safe at activesfalse}%
-%    \end{macrocode}
-%
-% The package \pkg{varioref} defines |\Ref| to be a robust command
-% wich uppercases the first character of the reference text. In
-% order to be able to do that it needs to access the expandable form
-% of |\ref|. So we employ a little trick here. We redefine the
-% (internal) command \verb*|\Ref | to call |\org at ref| instead of
-% |\ref|. The disadvantage of this solution is that whenever the
-% definition of |\Ref| changes, this definition needs to be updated
-% as well.
-%
-%    \begin{macrocode}
-      \expandafter\def\csname Ref \endcsname#1{%
-        \protected at edef\@tempa{\org at ref{#1}}\expandafter\MakeUppercase\@tempa}
-      }{}%
-    }
-\fi
-%    \end{macrocode}
-%
-%  \end{macro}
-%  \end{macro}
-%  \end{macro}
-%
-% \subsubsection{\pkg{hhline}}
-%
-% \begin{macro}{\hhline}
-%
-% Delaying the activation of the shorthand characters has introduced
-% a problem with the \pkg{hhline} package. The reason is that it
-% uses the `:' character which is made active by the french support
-% in \babel. Therefore we need to \emph{reload} the package when
-% the `:' is an active character. Note that this happens
-% \emph{after} the category code of the @-sign has been changed to
-% other, so we need to temporarily change it to letter again.
-%
-%    \begin{macrocode}
-\AtEndOfPackage{%
-  \AtBeginDocument{%
-    \@ifpackageloaded{hhline}%
-      {\expandafter\ifx\csname normal at char\string:\endcsname\relax
-       \else
-         \makeatletter
-         \def\@currname{hhline}\input{hhline.sty}\makeatother
-       \fi}%
-      {}}}
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-% \subsubsection{\pkg{hyperref}}
-%
-% \begin{macro}{\pdfstringdefDisableCommands}
-%
-% A number of interworking problems between \pkg{babel} and
-% \pkg{hyperref} are tackled by \pkg{hyperref} itself. The
-% following code was introduced to prevent some annoying warnings
-% but it broke bookmarks. This was quickly fixed in \pkg{hyperref},
-% which essentially made it no-op. However, it will not removed for
-% the moment because \pkg{hyperref} is expecting it. TODO. Still
-% true? Commented out in 2020/07/27.
-%
-%    \begin{macrocode}
-% \AtBeginDocument{%
-%   \ifx\pdfstringdefDisableCommands\@undefined\else
-%     \pdfstringdefDisableCommands{\languageshorthands{system}}%
-%   \fi}
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-% \subsubsection{\pkg{fancyhdr}}
-%
-% \begin{macro}{\FOREIGNLANGUAGE}
-%
-% The package \pkg{fancyhdr} treats the running head and fout lines
-% somewhat differently as the standard classes. A symptom of this is
-% that the command |\foreignlanguage| which \babel\ adds to the
-% marks can end up inside the argument of |\MakeUppercase|. To
-% prevent unexpected results we need to define |\FOREIGNLANGUAGE|
-% here.
-%
-%    \begin{macrocode}
-\DeclareRobustCommand{\FOREIGNLANGUAGE}[1]{%
-  \lowercase{\foreignlanguage{#1}}}
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-% \begin{macro}{\substitutefontfamily}
-%
-% This command is deprecated. Use the tools provides by \LaTeX.
-% The command |\substitutefontfamily| creates an
-% \file{.fd} file on the fly. The first argument is an encoding
-% mnemonic, the second and third arguments are font family names.
-%
-%    \begin{macrocode}
-\def\substitutefontfamily#1#2#3{%
-  \lowercase{\immediate\openout15=#1#2.fd\relax}%
-  \immediate\write15{%
-    \string\ProvidesFile{#1#2.fd}%
-    [\the\year/\two at digits{\the\month}/\two at digits{\the\day}
-     \space generated font description file]^^J
-    \string\DeclareFontFamily{#1}{#2}{}^^J
-    \string\DeclareFontShape{#1}{#2}{m}{n}{<->ssub * #3/m/n}{}^^J
-    \string\DeclareFontShape{#1}{#2}{m}{it}{<->ssub * #3/m/it}{}^^J
-    \string\DeclareFontShape{#1}{#2}{m}{sl}{<->ssub * #3/m/sl}{}^^J
-    \string\DeclareFontShape{#1}{#2}{m}{sc}{<->ssub * #3/m/sc}{}^^J
-    \string\DeclareFontShape{#1}{#2}{b}{n}{<->ssub * #3/bx/n}{}^^J
-    \string\DeclareFontShape{#1}{#2}{b}{it}{<->ssub * #3/bx/it}{}^^J
-    \string\DeclareFontShape{#1}{#2}{b}{sl}{<->ssub * #3/bx/sl}{}^^J
-    \string\DeclareFontShape{#1}{#2}{b}{sc}{<->ssub * #3/bx/sc}{}^^J
-    }%
-  \closeout15
-  }
-\@onlypreamble\substitutefontfamily
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-% \subsection{Encoding and fonts}
-%
-%  Because documents may use non-ASCII font encodings, we make sure
-%  that the logos of \TeX\ and \LaTeX\ always come out in the right
-%  encoding. There is a list of non-ASCII encodings. Requested
-%  encodings are currently stored in |\@fontenc at load@list|. If a
-%  non-ASCII has been loaded, we define versions of |\TeX| and |\LaTeX|
-%  for them using |\ensureascii|. The default ASCII encoding is set,
-%  too (in reverse order): the ``main'' encoding (when the document
-%  begins), the last loaded, or |OT1|.
-%
-%  \begin{macro}{\ensureascii}
-%
-%    \begin{macrocode}
-\bbl at trace{Encoding and fonts}
-\newcommand\BabelNonASCII{LGR,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU}
-\newcommand\BabelNonText{TS1,T3,TS3}
-\let\org at TeX\TeX
-\let\org at LaTeX\LaTeX
-\let\ensureascii\@firstofone
-\AtBeginDocument{%
-  \def\@elt#1{,#1,}%
-  \edef\bbl at tempa{\expandafter\@gobbletwo\@fontenc at load@list}%
-  \let\@elt\relax
-  \let\bbl at tempb\@empty
-  \def\bbl at tempc{OT1}%
-  \bbl at foreach\BabelNonASCII{% LGR loaded in a non-standard way
-    \bbl at ifunset{T@#1}{}{\def\bbl at tempb{#1}}}%
-  \bbl at foreach\bbl at tempa{%
-    \bbl at xin@{#1}{\BabelNonASCII}%
-    \ifin@
-      \def\bbl at tempb{#1}% Store last non-ascii
-    \else\bbl at xin@{#1}{\BabelNonText}% Pass
-      \ifin@\else
-        \def\bbl at tempc{#1}% Store last ascii
-      \fi
-    \fi}%
-  \ifx\bbl at tempb\@empty\else
-    \bbl at xin@{,\cf at encoding,}{,\BabelNonASCII,\BabelNonText,}%
-    \ifin@\else
-      \edef\bbl at tempc{\cf at encoding}% The default if ascii wins
-    \fi
-    \edef\ensureascii#1{%
-      {\noexpand\fontencoding{\bbl at tempc}\noexpand\selectfont#1}}%
-    \DeclareTextCommandDefault{\TeX}{\ensureascii{\org at TeX}}%
-    \DeclareTextCommandDefault{\LaTeX}{\ensureascii{\org at LaTeX}}%
-  \fi}
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-%  Now comes the old deprecated stuff (with a little change in 3.9l,
-%  for \textsf{fontspec}).  The first thing we need to do is to
-%  determine, at |\begin{document}|, which latin fontencoding to use.
-%
-%  \begin{macro}{\latinencoding}
-%    When text is being typeset in an encoding other than `latin'
-%    (\texttt{OT1} or \texttt{T1}), it would be nice to still have
-%    Roman numerals come out in the Latin encoding.
-%    So we first assume that the current encoding at the end
-%    of processing the package is the Latin encoding.
-%
-%    \begin{macrocode}
-\AtEndOfPackage{\edef\latinencoding{\cf at encoding}}
-%    \end{macrocode}
-%
-%    But this might be overruled with a later loading of the package
-%    \pkg{fontenc}. Therefore we check at the execution of
-%    |\begin{document}| whether it was loaded with the \Lopt{T1}
-%    option. The normal way to do this (using |\@ifpackageloaded|) is
-%    disabled for this package. Now we have to revert to parsing the
-%    internal macro |\@filelist| which contains all the filenames
-%    loaded.
-%
-%    \begin{macrocode}
-\AtBeginDocument{%
-  \@ifpackageloaded{fontspec}%
-    {\xdef\latinencoding{%
-       \ifx\UTFencname\@undefined
-         EU\ifcase\bbl at engine\or2\or1\fi
-       \else
-         \UTFencname
-       \fi}}%
-    {\gdef\latinencoding{OT1}%
-     \ifx\cf at encoding\bbl at t@one
-       \xdef\latinencoding{\bbl at t@one}%
-     \else
-       \def\@elt#1{,#1,}%
-       \edef\bbl at tempa{\expandafter\@gobbletwo\@fontenc at load@list}%
-       \let\@elt\relax
-       \bbl at xin@{,T1,}\bbl at tempa
-       \ifin@
-         \xdef\latinencoding{\bbl at t@one}%
-       \fi
-     \fi}}
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-%  \begin{macro}{\latintext}
-%    Then we can define the command |\latintext| which is a
-%    declarative switch to a latin font-encoding. Usage of this macro
-%    is deprecated.
-%
-%    \begin{macrocode}
-\DeclareRobustCommand{\latintext}{%
-  \fontencoding{\latinencoding}\selectfont
-  \def\encodingdefault{\latinencoding}}
-%    \end{macrocode}
-%
-%  \end{macro}
-%
-%  \begin{macro}{\textlatin}
-%    This command takes an argument which is then typeset using the
-%    requested font encoding. In order to avoid many encoding switches
-%    it operates in a local scope.
-%
-%    \begin{macrocode}
-\ifx\@undefined\DeclareTextFontCommand
-  \DeclareRobustCommand{\textlatin}[1]{\leavevmode{\latintext #1}}
-\else
-  \DeclareTextFontCommand{\textlatin}{\latintext}
-\fi
-%    \end{macrocode}
-%
-% For several functions, we need to execute some code with
-% |\selectfont|. With \LaTeX\ 2021-06-01, there is a hook for this
-% purpose, but in older versions the \LaTeX{} command is patched (the
-% latter solution will be eventually removed).
-%
-%    \begin{macrocode}
-\bbl at ifformatlater{2021-06-01}%
-  {\def\bbl at patchfont#1{\AddToHook{selectfont}{#1}}}
-  {\def\bbl at patchfont#1{%
-     \expandafter\bbl at add\csname selectfont \endcsname{#1}%
-     \expandafter\bbl at toglobal\csname selectfont \endcsname}}
-%    \end{macrocode}
-%
-% \end{macro}
-%
-% \subsection{Basic bidi support}
-%
-% \textbf{Work in progress.} This code is currently placed here for
-% practical reasons. It will be moved to the correct place soon, I
-% hope.
-%
-% It is loosely based on |rlbabel.def|, but most of it has been
-% developed from scratch. This \babel{} module (by Johannes Braams and
-% Boris Lavva) has served the purpose of typesetting R documents for
-% two decades, and despite its flaws I think it is still a good starting
-% point (some parts have been copied here almost verbatim), partly
-% thanks to its simplicity. I've also looked at \textsc{arabi} (by
-% Youssef Jabri), which is compatible with \babel{}.
-%
-% There are two ways of modifying macros to make them “bidi”, namely,
-% by patching the internal low-level macros (which is what I have done
-% with lists, columns, counters, tocs, much like |rlbabel| did), and
-% by introducing a “middle layer” just below the user interface
-% (sectioning, footnotes).
-%
-% \begin{itemize}
-% \item pdftex provides a minimal support for bidi text, and it
-%   must be done by hand. Vertical typesetting is not possible.
-% \item \xetex{} is somewhat better, thanks to its font engine
-%   (even if not always reliable) and a few additional tools. However,
-%   very little is done at the paragraph level. Another challenging
-%   problem is text direction does not honour \TeX{} grouping.
-% \item \luatex{} can provide the most complete solution, as we can
-%   manipulate almost freely the node list, the generated lines,
-%   and so on, but bidi text does not work out of the box and some
-%   development is necessary. It also provides tools to properly
-%   set left-to-right and right-to-left page layouts. As Lua\TeX-ja
-%   shows, vertical typesetting is possible, too.
-% \end{itemize}
-%
-%    \begin{macrocode}
-\bbl at trace{Loading basic (internal) bidi support}
-\ifodd\bbl at engine
-\else % TODO. Move to txtbabel
-  \ifnum\bbl at bidimode>100 \ifnum\bbl at bidimode<200
-    \bbl at error
-      {The bidi method 'basic' is available only in\\%
-       luatex. I'll continue with 'bidi=default', so\\%
-       expect wrong results}%
-      {See the manual for further details.}%
-    \let\bbl at beforeforeign\leavevmode
-    \AtEndOfPackage{%
-      \EnableBabelHook{babel-bidi}%
-      \bbl at xebidipar}
-  \fi\fi
-  \def\bbl at loadxebidi#1{%
-    \ifx\RTLfootnotetext\@undefined
-      \AtEndOfPackage{%
-        \EnableBabelHook{babel-bidi}%
-        \ifx\fontspec\@undefined
-          \bbl at loadfontspec % bidi needs fontspec
-        \fi
-        \usepackage#1{bidi}}%
-    \fi}
-  \ifnum\bbl at bidimode>200
-    \ifcase\expandafter\@gobbletwo\the\bbl at bidimode\or
-      \bbl at tentative{bidi=bidi}
-      \bbl at loadxebidi{}
-    \or
-      \bbl at loadxebidi{[rldocument]}
-    \or
-      \bbl at loadxebidi{}
-    \fi
-  \fi
-\fi
-% TODO? Separate:
-\ifnum\bbl at bidimode=\@ne
-  \let\bbl at beforeforeign\leavevmode
-  \ifodd\bbl at engine
-    \newattribute\bbl at attr@dir
-    \directlua{ Babel.attr_dir = luatexbase.registernumber'bbl at attr@dir' }
-    \bbl at exp{\output{\bodydir\pagedir\the\output}}
-  \fi
-  \AtEndOfPackage{%
-    \EnableBabelHook{babel-bidi}%
-    \ifodd\bbl at engine\else
-      \bbl at xebidipar
-    \fi}
-\fi
-%    \end{macrocode}
-%
-% Now come the macros used to set the direction when a language is
-% switched. First the (mostly) common macros.
-%
-%    \begin{macrocode}
-\bbl at trace{Macros to switch the text direction}
-\def\bbl at alscripts{,Arabic,Syriac,Thaana,}
-\def\bbl at rscripts{% TODO. Base on codes ??
-  ,Imperial Aramaic,Avestan,Cypriot,Hatran,Hebrew,%
-  Old Hungarian,Old Hungarian,Lydian,Mandaean,Manichaean,%
-  Manichaean,Meroitic Cursive,Meroitic,Old North Arabian,%
-  Nabataean,N'Ko,Orkhon,Palmyrene,Inscriptional Pahlavi,%
-  Psalter Pahlavi,Phoenician,Inscriptional Parthian,Samaritan,%
-  Old South Arabian,}%
-\def\bbl at provide@dirs#1{%
-  \bbl at xin@{\csname bbl at sname@#1\endcsname}{\bbl at alscripts\bbl at rscripts}%
-  \ifin@
-    \global\bbl at csarg\chardef{wdir@#1}\@ne
-    \bbl at xin@{\csname bbl at sname@#1\endcsname}{\bbl at alscripts}%
-    \ifin@
-      \global\bbl at csarg\chardef{wdir@#1}\tw@  % useless in xetex
-    \fi
-  \else
-    \global\bbl at csarg\chardef{wdir@#1}\z@
-  \fi
-  \ifodd\bbl at engine
-    \bbl at csarg\ifcase{wdir@#1}%
-      \directlua{ Babel.locale_props[\the\localeid].textdir = 'l' }%
-    \or
-      \directlua{ Babel.locale_props[\the\localeid].textdir = 'r' }%
-    \or
-      \directlua{ Babel.locale_props[\the\localeid].textdir = 'al' }%
-    \fi
-  \fi}
-\def\bbl at switchdir{%
-  \bbl at ifunset{bbl at lsys@\languagename}{\bbl at provide@lsys{\languagename}}{}%
-  \bbl at ifunset{bbl at wdir@\languagename}{\bbl at provide@dirs{\languagename}}{}%
-  \bbl at exp{\\\bbl at setdirs\bbl at cl{wdir}}}
-\def\bbl at setdirs#1{% TODO - math
-  \ifcase\bbl at select@type % TODO - strictly, not the right test
-    \bbl at bodydir{#1}%
-    \bbl at pardir{#1}%
-  \fi
-  \bbl at textdir{#1}}
-% TODO. Only if \bbl at bidimode > 0?:
-\AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
-\DisableBabelHook{babel-bidi}
-%    \end{macrocode}
-%
-% Now the engine-dependent macros. TODO. Must be moved to the engine
-% files.
-%
-%    \begin{macrocode} 
-\ifodd\bbl at engine  % luatex=1
-\else % pdftex=0, xetex=2
-  \newcount\bbl at dirlevel
-  \chardef\bbl at thetextdir\z@
-  \chardef\bbl at thepardir\z@
-  \def\bbl at textdir#1{%
-    \ifcase#1\relax
-       \chardef\bbl at thetextdir\z@
-       \bbl at textdir@i\beginL\endL
-     \else
-       \chardef\bbl at thetextdir\@ne
-       \bbl at textdir@i\beginR\endR
-    \fi}
-  \def\bbl at textdir@i#1#2{%
-    \ifhmode
-      \ifnum\currentgrouplevel>\z@
-        \ifnum\currentgrouplevel=\bbl at dirlevel
-          \bbl at error{Multiple bidi settings inside a group}%
-            {I'll insert a new group, but expect wrong results.}%
-          \bgroup\aftergroup#2\aftergroup\egroup
-        \else
-          \ifcase\currentgrouptype\or % 0 bottom
-            \aftergroup#2% 1 simple {}
-          \or
-            \bgroup\aftergroup#2\aftergroup\egroup % 2 hbox
-          \or
-            \bgroup\aftergroup#2\aftergroup\egroup % 3 adj hbox
-          \or\or\or % vbox vtop align
-          \or
-            \bgroup\aftergroup#2\aftergroup\egroup % 7 noalign
-          \or\or\or\or\or\or % output math disc insert vcent mathchoice
-          \or
-            \aftergroup#2% 14 \begingroup
-          \else
-            \bgroup\aftergroup#2\aftergroup\egroup % 15 adj
-          \fi
-        \fi
-        \bbl at dirlevel\currentgrouplevel
-      \fi
-      #1%
-    \fi}
-  \def\bbl at pardir#1{\chardef\bbl at thepardir#1\relax}
-  \let\bbl at bodydir\@gobble
-  \let\bbl at pagedir\@gobble
-  \def\bbl at dirparastext{\chardef\bbl at thepardir\bbl at thetextdir}
-%    \end{macrocode}
-%
-% The following command is executed only if there is a right-to-left
-% script (once). It activates the |\everypar| hack for \xetex, to
-% properly handle the par direction. Note text and par dirs are
-% decoupled to some extent (although not completely).
-%
-%    \begin{macrocode}
-  \def\bbl at xebidipar{%
-    \let\bbl at xebidipar\relax
-    \TeXXeTstate\@ne
-    \def\bbl at xeeverypar{%
-      \ifcase\bbl at thepardir
-        \ifcase\bbl at thetextdir\else\beginR\fi
-      \else
-        {\setbox\z@\lastbox\beginR\box\z@}%
-      \fi}%
-    \let\bbl at severypar\everypar
-    \newtoks\everypar
-    \everypar=\bbl at severypar
-    \bbl at severypar{\bbl at xeeverypar\the\everypar}}
-  \ifnum\bbl at bidimode>200
-    \let\bbl at textdir@i\@gobbletwo
-    \let\bbl at xebidipar\@empty
-    \AddBabelHook{bidi}{foreign}{%
-      \def\bbl at tempa{\def\BabelText####1}%
-      \ifcase\bbl at thetextdir
-        \expandafter\bbl at tempa\expandafter{\BabelText{\LR{##1}}}%
-      \else
-        \expandafter\bbl at tempa\expandafter{\BabelText{\RL{##1}}}%
-      \fi}
-    \def\bbl at pardir#1{\ifcase#1\relax\setLR\else\setRL\fi}
-  \fi
-\fi
-%    \end{macrocode}
-%
-% A tool for weak L (mainly digits). We also disable warnings with
-% \textsf{hyperref}.
-%
-%    \begin{macrocode}
-\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl at textdir\z@#1}}
-\AtBeginDocument{%
-  \ifx\pdfstringdefDisableCommands\@undefined\else
-    \ifx\pdfstringdefDisableCommands\relax\else
-      \pdfstringdefDisableCommands{\let\babelsublr\@firstofone}%
-    \fi
-  \fi}
-%    \end{macrocode}
-%
-% \subsection{Local Language Configuration}
-%
-% \begin{macro}{\loadlocalcfg}
-%
-% At some sites it may be necessary to add site-specific actions to
-% a language definition file. This can be done by creating a file
-% with the same name as the language definition file, but with the
-% extension \file{.cfg}. For instance the file \file{norsk.cfg}
-% will be loaded when the language definition file \file{norsk.ldf}
-% is loaded. 
-%
-% For plain-based formats we don't want to override the definition
-% of |\loadlocalcfg| from \file{plain.def}.
-%
-%    \begin{macrocode}
-\bbl at trace{Local Language Configuration}
-\ifx\loadlocalcfg\@undefined
-  \@ifpackagewith{babel}{noconfigs}%
-    {\let\loadlocalcfg\@gobble}%
-    {\def\loadlocalcfg#1{%
-      \InputIfFileExists{#1.cfg}%
-        {\typeout{*************************************^^J%
-                       * Local config file #1.cfg used^^J%
-                       *}}%
-        \@empty}}
-\fi
-%    \end{macrocode}%
-%    \end{macro}
-%
-% \subsection{Language options}
-%
-% Languages are loaded when processing the corresponding option
-% \textit{except} if a |main| language has been set. In such a
-% case, it is not loaded until all options has been processed.
-% The following macro inputs the ldf file and does some additional
-% checks (|\input| works, too, but possible errors are not catched).
-%
-%    \begin{macrocode}
-\bbl at trace{Language options}
-\let\bbl at afterlang\relax
-\let\BabelModifiers\relax
-\let\bbl at loaded\@empty
-\def\bbl at load@language#1{%
-  \InputIfFileExists{#1.ldf}%
-    {\edef\bbl at loaded{\CurrentOption
-       \ifx\bbl at loaded\@empty\else,\bbl at loaded\fi}%
-     \expandafter\let\expandafter\bbl at afterlang
-        \csname\CurrentOption.ldf-h@@k\endcsname
-     \expandafter\let\expandafter\BabelModifiers
-        \csname bbl at mod@\CurrentOption\endcsname}%
-    {\bbl at error{%
-       Unknown option '\CurrentOption'. Either you misspelled it\\%
-       or the language definition file \CurrentOption.ldf was not found}{%
-       Valid options are, among others: shorthands=, KeepShorthandsActive,\\%
-       activeacute, activegrave, noconfigs, safe=, main=, math=\\%
-       headfoot=, strings=, config=, hyphenmap=, or a language name.}}}
-%    \end{macrocode}
-%
-% Now, we set a few language options whose names are different from
-% |ldf| files. These declarations are preserved for backwards
-% compatibility, but they must be eventually removed. Use proxy files
-% instead.
-%
-%    \begin{macrocode}
-\def\bbl at try@load at lang#1#2#3{%
-  \IfFileExists{\CurrentOption.ldf}%
-    {\bbl at load@language{\CurrentOption}}%
-    {#1\bbl at load@language{#2}#3}}
-\DeclareOption{hebrew}{%
-  \input{rlbabel.def}%
-  \bbl at load@language{hebrew}}
-\DeclareOption{hungarian}{\bbl at try@load at lang{}{magyar}{}}
-\DeclareOption{lowersorbian}{\bbl at try@load at lang{}{lsorbian}{}}
-\DeclareOption{nynorsk}{\bbl at try@load at lang{}{norsk}{}}
-\DeclareOption{polutonikogreek}{%
-  \bbl at try@load at lang{}{greek}{\languageattribute{greek}{polutoniko}}}
-\DeclareOption{russian}{\bbl at try@load at lang{}{russianb}{}}
-\DeclareOption{ukrainian}{\bbl at try@load at lang{}{ukraineb}{}}
-\DeclareOption{uppersorbian}{\bbl at try@load at lang{}{usorbian}{}}
-%    \end{macrocode}
-%
-% Another way to extend the list of `known' options for \babel\ was
-% to create the file \file{bblopts.cfg} in which one can add option
-% declarations. However, this mechanism is deprecated -- if you
-% want an alternative name for a language, just create a new |.ldf|
-% file loading the actual one. You can also set the name
-% of the file with the package option |config=<name>|, which will
-% load |<name>.cfg| instead.
-%
-%    \begin{macrocode}
-\ifx\bbl at opt@config\@nnil
-  \@ifpackagewith{babel}{noconfigs}{}%
-    {\InputIfFileExists{bblopts.cfg}%
-      {\typeout{*************************************^^J%
-               * Local config file bblopts.cfg used^^J%
-               *}}%
-      {}}%
-\else
-  \InputIfFileExists{\bbl at opt@config.cfg}%
-    {\typeout{*************************************^^J%
-             * Local config file \bbl at opt@config.cfg used^^J%
-             *}}%
-    {\bbl at error{%
-       Local config file '\bbl at opt@config.cfg' not found}{%
-       Perhaps you misspelled it.}}%
-\fi
-%    \end{macrocode}
-%
-% Recognizing global options in packages not having a closed set of
-% them is not trivial, as for them to be processed they must be
-% defined explicitly. So, package options not yet taken into
-% account and stored in |bbl at language@opts| are assumed to be
-% languages (note this list also contains the language given with
-% |main|). If not declared above, the names of the option and the
-% file are the same.
-%
-%    \begin{macrocode}
-\let\bbl at tempc\relax
-\bbl at foreach\bbl at language@opts{%
-  \ifcase\bbl at iniflag  % Default
-    \bbl at ifunset{ds@#1}%
-      {\DeclareOption{#1}{\bbl at load@language{#1}}}%
-      {}%
-  \or    % provide=*
-    \@gobble % case 2 same as 1
-  \or    % provide+=*
-    \bbl at ifunset{ds@#1}%
-      {\IfFileExists{#1.ldf}{}%
-        {\IfFileExists{babel-#1.tex}{}{\@namedef{ds@#1}{}}}}%
-      {}%
-    \bbl at ifunset{ds@#1}%
-      {\def\bbl at tempc{#1}%
-       \DeclareOption{#1}{%
-         \ifnum\bbl at iniflag>\@ne
-           \bbl at ldfinit
-           \babelprovide[import]{#1}%
-           \bbl at afterldf{}%
-         \else
-           \bbl at load@language{#1}%
-         \fi}}%
-      {}%
-  \or    % provide*=*
-    \def\bbl at tempc{#1}%
-    \bbl at ifunset{ds@#1}%
-      {\DeclareOption{#1}{%
-         \bbl at ldfinit
-         \babelprovide[import]{#1}%
-         \bbl at afterldf{}}}%
-      {}%
-  \fi}
-%    \end{macrocode}
-%
-% Now, we make sure an option is explicitly declared for any language
-% set as global option, by checking if an |ldf| exists. The previous
-% step was, in fact, somewhat redundant, but that way we minimize
-% accessing the file system just to see if the option could be a
-% language.
-%
-%    \begin{macrocode}
-\let\bbl at tempb\@nnil
-\bbl at foreach\@classoptionslist{%
-  \bbl at ifunset{ds@#1}%
-    {\IfFileExists{#1.ldf}%
-      {\def\bbl at tempb{#1}%
-       \DeclareOption{#1}{%
-         \ifnum\bbl at iniflag>\@ne
-           \bbl at ldfinit
-           \babelprovide[import]{#1}%
-           \bbl at afterldf{}%
-         \else
-           \bbl at load@language{#1}%
-         \fi}}%
-      {\IfFileExists{babel-#1.tex}% TODO. Copypaste pattern
-        {\def\bbl at tempb{#1}%
-         \DeclareOption{#1}{%
-           \ifnum\bbl at iniflag>\@ne
-             \bbl at ldfinit
-             \babelprovide[import]{#1}%
-             \bbl at afterldf{}%
-           \else
-             \bbl at load@language{#1}%
-           \fi}}%
-         {}}}%
-    {}}
-%    \end{macrocode}
-%
-%    If a main language has been set, store it for the third pass.
-%
-%    \begin{macrocode}
-\ifnum\bbl at iniflag=\z@\else
-  \ifx\bbl at opt@main\@nnil
-    \ifx\bbl at tempc\relax
-      \let\bbl at opt@main\bbl at tempb
-    \else
-      \let\bbl at opt@main\bbl at tempc
-    \fi
-  \fi
-\fi
-\ifx\bbl at opt@main\@nnil\else
-  \expandafter
-  \let\expandafter\bbl at loadmain\csname ds@\bbl at opt@main\endcsname
-  \expandafter\let\csname ds@\bbl at opt@main\endcsname\@empty
-\fi
-%    \end{macrocode}
-%
-% And we are done, because all options for this pass has been
-% declared. Those already processed in the first pass are just
-% ignored.
-%
-% The options have to be processed in the order in which the user
-% specified them (except, of course, global options, which \LaTeX{}
-% processes before):
-%
-%    \begin{macrocode}
-\def\AfterBabelLanguage#1{%
-  \bbl at ifsamestring\CurrentOption{#1}{\global\bbl at add\bbl at afterlang}{}}
-\DeclareOption*{}
-\ProcessOptions*
-%    \end{macrocode}
-%
-% This finished the second pass. Now the third one begins, which
-% loads the main language set with the key |main|. A warning is
-% raised if the main language is not the same as the last named
-% one, or if the value of the key |main| is not a language. Then
-% execute directly the option (because it could be used only in
-% |main|). After loading all languages, we deactivate
-% |\AfterBabelLanguage|.
-%
-%    \begin{macrocode}
-\bbl at trace{Option 'main'}
-\ifx\bbl at opt@main\@nnil
-  \edef\bbl at tempa{\@classoptionslist,\bbl at language@opts}
-  \let\bbl at tempc\@empty
-  \bbl at for\bbl at tempb\bbl at tempa{%
-    \bbl at xin@{,\bbl at tempb,}{,\bbl at loaded,}%
-    \ifin@\edef\bbl at tempc{\bbl at tempb}\fi}
-  \def\bbl at tempa#1,#2\@nnil{\def\bbl at tempb{#1}}
-  \expandafter\bbl at tempa\bbl at loaded,\@nnil
-  \ifx\bbl at tempb\bbl at tempc\else
-    \bbl at warning{%
-      Last declared language option is '\bbl at tempc',\\%
-      but the last processed one was '\bbl at tempb'.\\%
-      The main language can't be set as both a global\\%
-      and a package option. Use 'main=\bbl at tempc' as\\%
-      option. Reported}%
-  \fi
-\else
-  \ifodd\bbl at iniflag  % case 1,3
-    \bbl at ldfinit
-    \let\CurrentOption\bbl at opt@main
-    \ifx\bbl at opt@provide\@nnil
-      \bbl at exp{\\\babelprovide[import,main]{\bbl at opt@main}}%
-    \else
-      \bbl at exp{\\\bbl at forkv{\@nameuse{@raw at opt@babel.sty}}}{%
-        \bbl at xin@{,provide,}{,#1,}%
-        \ifin@
-          \def\bbl at opt@provide{#2}%
-          \bbl at replace\bbl at opt@provide{;}{,}%
-        \fi}%
-      \bbl at exp{%
-        \\\babelprovide[\bbl at opt@provide,import,main]{\bbl at opt@main}}%
-    \fi
-    \bbl at afterldf{}%
-  \else % case 0,2
-    \chardef\bbl at iniflag\z@  % Force ldf 
-    \expandafter\let\csname ds@\bbl at opt@main\endcsname\bbl at loadmain
-    \ExecuteOptions{\bbl at opt@main}
-    \DeclareOption*{}%
-    \ProcessOptions*
-  \fi
-\fi
-\def\AfterBabelLanguage{%
-  \bbl at error
-    {Too late for \string\AfterBabelLanguage}%
-    {Languages have been loaded, so I can do nothing}}
-%    \end{macrocode}
-%      
-% In order to catch the case where the user forgot to specify a
-% language we check whether |\bbl at main@language|, has become
-% defined. If not, no language has been loaded and an error
-% message is displayed.
-%
-%    \begin{macrocode}
-\ifx\bbl at main@language\@undefined
-  \bbl at info{%
-    You haven't specified a language. I'll use 'nil'\\%
-    as the main language. Reported}
-    \bbl at load@language{nil}
-\fi
 %</package>
 %<*core>
 %    \end{macrocode}
 %
-% \section{The kernel of Babel (\texttt{babel.def}, common)}
+% \subsection{Interlude for Plain}
 %
-% The kernel of the \babel\ system is currently stored in
-% \file{babel.def}. The file \file{babel.def} contains most of the
-% code. The file \file{hyphen.cfg} is a file that can be loaded into
-% the format, which is necessary when you want to be able to switch
-% hyphenation patterns.
+% Because of the way \pkg{docstrip} works, we need to insert some code
+% for Plain here. However, the tools provided by the \babel{}
+% installer for literate programming makes this section a short
+% interlude, because the actual code is below, tagged as
+% \textit{Emulate LaTeX}.
 %
-% Because plain \TeX\ users might want to use some of the features of
-% the \babel{} system too, care has to be taken that plain \TeX\ can
-% process the files. For this reason the current format will have to
-% be checked in a number of places. Some of the code below is common
-% to plain \TeX\ and \LaTeX, some of it is for the \LaTeX\ case only.
-%
-% Plain formats based on etex (etex, xetex, luatex) don't load
-% |hyphen.cfg| but |etex.src|, which follows a different naming
-% convention, so we need to define the babel names. It presumes
-% |language.def| exists and it is the same file used when formats were
-% created.
-%
-% \subsection{Tools}
-%
 %    \begin{macrocode}
 \ifx\ldf at quit\@undefined\else
 \endinput\fi % Same line!
 <@Make sure ProvidesFile is defined@>
 \ProvidesFile{babel.def}[<@date@> <@version@> Babel common definitions]
+\ifx\AtBeginDocument\@undefined  % TODO. change test.
+  <@Emulate LaTeX@>
+\fi
 %    \end{macrocode}
 %
-% The file |babel.def| expects some definitions made in the \LaTeXe{}
-% style file. So, in Plain{} we must provide at least
-% some predefined values as well some tools to set them (even if not
-% all options are available). There are no package options, and
-% therefore and alternative mechanism is provided. For the moment,
-% only |\babeloptionstrings| and |\babeloptionmath| are provided,
-% which can be defined before loading \babel. |\BabelModifiers| can be
-% set too (but not sure it works).
+% That is all for the moment. Now follows some common stuff, for both
+% Plain and \LaTeX{}. After it, we will resume the \LaTeX-only stuff.
 %
 %    \begin{macrocode}
-\ifx\AtBeginDocument\@undefined  % TODO. change test.
-  <@Emulate LaTeX@>
-  \def\languagename{english}%
-  \let\bbl at opt@shorthands\@nnil
-  \def\bbl at ifshorthand#1#2#3{#2}%
-  \let\bbl at language@opts\@empty
-  \ifx\babeloptionstrings\@undefined
-    \let\bbl at opt@strings\@nnil
-  \else
-    \let\bbl at opt@strings\babeloptionstrings
-  \fi
-  \def\BabelStringsDefault{generic}
-  \def\bbl at tempa{normal}
-  \ifx\babeloptionmath\bbl at tempa
-    \def\bbl at mathnormal{\noexpand\textormath}
-  \fi
-  \def\AfterBabelLanguage#1#2{}
-  \ifx\BabelModifiers\@undefined\let\BabelModifiers\relax\fi
-  \let\bbl at afterlang\relax
-  \def\bbl at opt@safe{BR}
-  \ifx\@uclclist\@undefined\let\@uclclist\@empty\fi
-  \ifx\bbl at trace\@undefined\def\bbl at trace#1{}\fi
-  \expandafter\newif\csname ifbbl at single\endcsname
-  \chardef\bbl at bidimode\z@
-\fi
+%</core>
+%<*package|core>
 %    \end{macrocode}
 %
-% And continue.
-%
 % \section{Multiple languages}
 %
 % This is not a separate file (\texttt{switch.def}) anymore.
@@ -7127,6 +5873,8 @@
 % counter.
 %
 %    \begin{macrocode}
+\def\bbl at version{<@version@>}
+\def\bbl at date{<@date@>}
 <@Define core switching macros@>
 %    \end{macrocode}
 %
@@ -7136,8 +5884,6 @@
 % table can be used.
 %
 %    \begin{macrocode}
-\def\bbl at version{<@version@>}
-\def\bbl at date{<@date@>}
 \def\adddialect#1#2{%
   \global\chardef#1#2\relax
   \bbl at usehooks{adddialect}{{#1}{#2}}%
@@ -7158,7 +5904,7 @@
 %  \end{macro}
 %
 %    |\bbl at iflanguage| executes code only if the language |l@|
-%    exists. Otherwise raises and error.
+%    exists. Otherwise raises an error.
 %
 %    The argument of |\bbl at fixname| has to be a macro name, as it may get
 %    ``fixed'' if casing (lc/uc) is wrong. It's an attempt to fix a
@@ -7526,18 +6272,7 @@
   \fi}
 %
 \let\bbl at restorelastskip\relax
-\def\bbl at savelastskip{%
-  \let\bbl at restorelastskip\relax
-  \ifvmode
-    \ifdim\lastskip=\z@
-      \let\bbl at restorelastskip\nobreak
-    \else
-      \bbl at exp{%
-        \def\\\bbl at restorelastskip{%
-          \skip@=\the\lastskip
-          \\\nobreak \vskip-\skip@ \vskip\skip@}}%
-    \fi
-  \fi}
+\let\bbl at savelastskip\relax
 %
 \newif\ifbbl at bcpallowed
 \bbl at bcpallowedfalse
@@ -8044,27 +6779,6 @@
 %
 %    \begin{macrocode}
 \edef\bbl at nulllanguage{\string\language=0}
-\ifx\PackageError\@undefined  % TODO. Move to Plain
-  \def\bbl at error#1#2{%
-    \begingroup
-      \newlinechar=`\^^J
-      \def\\{^^J(babel) }%
-      \errhelp{#2}\errmessage{\\#1}%
-    \endgroup}
-  \def\bbl at warning#1{%
-    \begingroup
-      \newlinechar=`\^^J
-      \def\\{^^J(babel) }%
-      \message{\\#1}%
-    \endgroup}
-  \let\bbl at infowarn\bbl at warning
-  \def\bbl at info#1{%
-    \begingroup
-      \newlinechar=`\^^J
-      \def\\{^^J}%
-      \wlog{#1}%
-    \endgroup}
-\fi
 \def\bbl at nocaption{\protect\bbl at nocaption@i}
 \def\bbl at nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
   \global\@namedef{#2}{\textbf{?#1?}}%
@@ -8102,7 +6816,8 @@
   % Here ended switch.def
 %    \end{macrocode}
 %
-% Here ended |switch.def|.
+% Here ended the now discarded |switch.def|. Here also (currently) ends
+% the \textsf{base} option.
 %
 %    \begin{macrocode}
 \ifx\directlua\@undefined\else
@@ -8248,12 +6963,12 @@
 \newcommand\EnableBabelHook[1]{\bbl at csarg\let{hk@#1}\@firstofone}
 \newcommand\DisableBabelHook[1]{\bbl at csarg\let{hk@#1}\@gobble}
 \def\bbl at usehooks#1#2{%
-  \ifx\UseHook\@undefined\else\UseHook{babel/#1}\fi
+  \ifx\UseHook\@undefined\else\UseHook{babel/*/#1}\fi
   \def\bbl at elth##1{%
     \bbl at cs{hk@##1}{\bbl at cs{ev@##1@#1@}#2}}%
   \bbl at cs{ev@#1@}%
   \ifx\languagename\@undefined\else % Test required for Plain (?)
-    \ifx\UseHook\@undefined\else\UseHook{babel/#1/\languagename}\fi
+    \ifx\UseHook\@undefined\else\UseHook{babel/\languagename/#1}\fi
     \def\bbl at elth##1{%
       \bbl at cs{hk@##1}{\bbl at cl{ev@##1@#1}#2}}%
     \bbl at cl{ev@#1}%
@@ -8886,7 +7601,7 @@
 %
 %    \begin{macrocode}
 \begingroup
-\bbl at ifunset{ifincsname}% TODO. Ugly. Correct?
+\bbl at ifunset{ifincsname}% TODO. Ugly. Correct? Only Plain?
   {\gdef\active at prefix#1{%
      \ifx\protect\@typeset at protect
      \else
@@ -10908,9 +9623,8 @@
   \ifx\bbl at KVP@captions\@nil\else
     \bbl at ifunset{bbl at extracaps@#2}%
       {\bbl at exp{\\\babelensure[exclude=\\\today]{#2}}}%
-      {\toks@\expandafter\expandafter\expandafter
-        {\csname bbl at extracaps@#2\endcsname}%
-       \bbl at exp{\\\babelensure[exclude=\\\today,include=\the\toks@}]{#2}}%
+      {\bbl at exp{\\\babelensure[exclude=\\\today,
+                include=\[bbl at extracaps@#2]}]{#2}}%
     \bbl at ifunset{bbl at ensure@\languagename}%
       {\bbl at exp{%
         \\\DeclareRobustCommand\<bbl at ensure@\languagename>[1]{%
@@ -11783,24 +10497,18 @@
 \else
   \def\bbl at patchchapter{%
     \global\let\bbl at patchchapter\relax
+    \gdef\bbl at chfmt{%
+      \bbl at ifunset{bbl@\bbl at chaptype fmt@\languagename}%
+        {\@chapapp\space\thechapter}
+        {\@nameuse{bbl@\bbl at chaptype fmt@\languagename}}}
     \bbl at add\appendix{\def\bbl at chaptype{appendix}}% Not harmful, I hope
+    \bbl at sreplace\ps at headings{\@chapapp\ \thechapter}{\bbl at chfmt}%
+    \bbl at sreplace\chaptermark{\@chapapp\ \thechapter}{\bbl at chfmt}%
+    \bbl at sreplace\@makechapterhead{\@chapapp\space\thechapter}{\bbl at chfmt}%
     \bbl at toglobal\appendix
-    \bbl at sreplace\ps at headings
-      {\@chapapp\ \thechapter}%
-      {\bbl at chapterformat}%  
     \bbl at toglobal\ps at headings
-    \bbl at sreplace\chaptermark
-      {\@chapapp\ \thechapter}%
-      {\bbl at chapterformat}%  
     \bbl at toglobal\chaptermark
-    \bbl at sreplace\@makechapterhead
-      {\@chapapp\space\thechapter}%
-      {\bbl at chapterformat}%
-    \bbl at toglobal\@makechapterhead
-    \gdef\bbl at chapterformat{%
-      \bbl at ifunset{bbl@\bbl at chaptype fmt@\languagename}%
-        {\@chapapp\space\thechapter}
-        {\@nameuse{bbl@\bbl at chaptype fmt@\languagename}}}}
+    \bbl at toglobal\@makechapterhead}
   \let\bbl at patchappendix\bbl at patchchapter
 \fi\fi\fi
 \ifx\@part\@undefined
@@ -11808,14 +10516,12 @@
 \else
   \def\bbl at patchpart{%
     \global\let\bbl at patchpart\relax
-    \bbl at sreplace\@part
-      {\partname\nobreakspace\thepart}%
-      {\bbl at partformat}%
-    \bbl at toglobal\@part
     \gdef\bbl at partformat{%
       \bbl at ifunset{bbl at partfmt@\languagename}%
         {\partname\nobreakspace\thepart}
-        {\@nameuse{bbl at partfmt@\languagename}}}}
+        {\@nameuse{bbl at partfmt@\languagename}}}
+    \bbl at sreplace\@part{\partname\nobreakspace\thepart}{\bbl at partformat}%
+    \bbl at toglobal\@part}
 \fi
 %    \end{macrocode}
 %
@@ -11938,7 +10644,7 @@
 \@namedef{bbl at inikv@transforms.posthyphenation}{%
   \bbl at transforms\babelposthyphenation}
 \def\bbl at transforms@aux#1#2#3,#4\relax{#1{#2}{#3}{#4}}
-\begingroup
+\begingroup %  A hack. TODO. Don't require an specific order
   \catcode`\%=12
   \catcode`\&=14
   \gdef\bbl at transforms#1#2#3{&%
@@ -12281,6 +10987,26 @@
   \directlua{ Babel.ignore_pre_char = function(node)
       return false
     end }}
+\@namedef{bbl at ADJ@select.write at shift}{%
+  \let\bbl at restorelastskip\relax
+  \def\bbl at savelastskip{%
+    \let\bbl at restorelastskip\relax
+    \ifvmode
+      \ifdim\lastskip=\z@
+        \let\bbl at restorelastskip\nobreak
+      \else
+        \bbl at exp{%
+          \def\\\bbl at restorelastskip{%
+            \skip@=\the\lastskip
+            \\\nobreak \vskip-\skip@ \vskip\skip@}}%
+      \fi
+    \fi}}
+\@namedef{bbl at ADJ@select.write at keep}{%
+  \let\bbl at restorelastskip\relax
+  \let\bbl at savelastskip\relax}
+\@namedef{bbl at ADJ@select.write at omit}{%
+  \let\bbl at restorelastskip\relax
+  \def\bbl at savelastskip##1\bbl at restorelastskip{}}
 %    \end{macrocode}
 %
 % As the final task, load the code for lua. TODO: use babel name, override 
@@ -12291,9 +11017,1171 @@
     \input luababel.def
   \fi
 \fi
-%</core>
 %    \end{macrocode}
 %
+% Continue with \LaTeX{}.
+%
+%    \begin{macrocode}
+%</package|core>
+%<*package>
+%    \end{macrocode}
+%
+% \subsection{Cross referencing macros}
+%
+% The \LaTeX\ book states:
+% \begin{quote}
+%   The \emph{key} argument is any sequence of letters, digits, and
+%   punctuation symbols; upper- and lowercase letters are regarded as
+%   different.
+% \end{quote}
+% When the above quote should still be true when a document is
+% typeset in a language that has active characters, special care
+% has to be taken of the category codes of these characters when
+% they appear in an argument of the cross referencing macros.
+%
+% When a cross referencing command processes its argument, all
+% tokens in this argument should be character tokens with category
+% `letter' or `other'.
+%
+% The following package options control which macros are to be
+% redefined.
+%
+%    \begin{macrocode}
+%<<*More package options>>
+\DeclareOption{safe=none}{\let\bbl at opt@safe\@empty}
+\DeclareOption{safe=bib}{\def\bbl at opt@safe{B}}
+\DeclareOption{safe=ref}{\def\bbl at opt@safe{R}}
+%<</More package options>>
+%    \end{macrocode}
+%
+% \begin{macro}{\@newl at bel}
+%
+% First we open a new group to keep the changed setting of
+% |\protect| local and then we set the |@safe at actives| switch to
+% true to make sure that any shorthand that appears in any of the
+% arguments immediately expands to its non-active self.
+%
+%    \begin{macrocode}
+\bbl at trace{Cross referencing macros}
+\ifx\bbl at opt@safe\@empty\else
+  \def\@newl at bel#1#2#3{%
+   {\@safe at activestrue
+    \bbl at ifunset{#1@#2}%
+       \relax
+       {\gdef\@multiplelabels{%
+          \@latex at warning@no at line{There were multiply-defined labels}}%
+        \@latex at warning@no at line{Label `#2' multiply defined}}%
+    \global\@namedef{#1@#2}{#3}}}
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+%  \begin{macro}{\@testdef}
+%
+% An internal \LaTeX\ macro used to test if the labels that have
+% been written on the |.aux| file have changed.  It is called by
+% the |\enddocument| macro.
+%
+%    \begin{macrocode}
+  \CheckCommand*\@testdef[3]{%
+    \def\reserved at a{#3}%
+    \expandafter\ifx\csname#1@#2\endcsname\reserved at a
+    \else
+      \@tempswatrue
+    \fi}
+%    \end{macrocode}
+%
+% Now that we made sure that |\@testdef| still has the same definition
+% we can rewrite it. First we make the shorthands `safe'. Then we use
+% |\bbl at tempa| as an `alias' for the macro that contains the label
+% which is being checked. Then we define |\bbl at tempb| just as
+% |\@newl at bel| does it. When the label is defined we replace the
+% definition of |\bbl at tempa| by its meaning. If the label didn't
+% change, |\bbl at tempa| and |\bbl at tempb| should be identical macros.
+%
+%    \begin{macrocode}
+  \def\@testdef#1#2#3{%  TODO. With @samestring?
+    \@safe at activestrue
+    \expandafter\let\expandafter\bbl at tempa\csname #1@#2\endcsname
+    \def\bbl at tempb{#3}%
+    \@safe at activesfalse
+    \ifx\bbl at tempa\relax
+    \else
+      \edef\bbl at tempa{\expandafter\strip at prefix\meaning\bbl at tempa}%
+    \fi
+    \edef\bbl at tempb{\expandafter\strip at prefix\meaning\bbl at tempb}%
+    \ifx\bbl at tempa\bbl at tempb
+    \else
+      \@tempswatrue
+    \fi}
+\fi
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+% \begin{macro}{\ref}
+% \begin{macro}{\pageref}
+%
+% The same holds for the macro |\ref| that references a label and
+% |\pageref| to reference a page. We make them robust as well (if
+% they weren't already) to prevent problems if they should become
+% expanded at the wrong moment.
+%
+%    \begin{macrocode}
+\bbl at xin@{R}\bbl at opt@safe
+\ifin@
+  \bbl at redefinerobust\ref#1{%
+    \@safe at activestrue\org at ref{#1}\@safe at activesfalse}
+  \bbl at redefinerobust\pageref#1{%
+    \@safe at activestrue\org at pageref{#1}\@safe at activesfalse}
+\else
+  \let\org at ref\ref
+  \let\org at pageref\pageref
+\fi
+%    \end{macrocode}
+%
+%  \end{macro}
+%  \end{macro}
+%
+% \begin{macro}{\@citex}
+%
+% The macro used to cite from a bibliography, |\cite|, uses an
+% internal macro, |\@citex|.
+% It is this internal macro that picks up the argument(s),
+% so we redefine this internal macro and leave |\cite| alone. The
+% first argument is used for typesetting, so the shorthands need
+% only be deactivated in the second argument.
+%
+%    \begin{macrocode}
+\bbl at xin@{B}\bbl at opt@safe
+\ifin@
+  \bbl at redefine\@citex[#1]#2{%
+    \@safe at activestrue\edef\@tempa{#2}\@safe at activesfalse
+    \org@@citex[#1]{\@tempa}}
+%    \end{macrocode}
+%
+% Unfortunately, the packages \pkg{natbib} and \pkg{cite} need a
+% different definition of |\@citex|...
+% To begin with, \pkg{natbib} has a definition for |\@citex| with
+% \emph{three} arguments... We only know that a package is loaded
+% when |\begin{document}| is executed, so we need to postpone the
+% different redefinition.
+%
+%    \begin{macrocode}
+  \AtBeginDocument{%
+    \@ifpackageloaded{natbib}{%
+%    \end{macrocode}
+%
+% Notice that we use |\def| here instead of |\bbl at redefine| because
+% |\org@@citex| is already defined and we don't want to overwrite
+% that definition (it would result in parameter stack overflow
+% because of a circular definition).
+%
+% (Recent versions of \pkg{natbib} change dynamically |\@citex|, so PR4087
+% doesn't seem fixable in a simple way. Just load \pkg{natbib} before.)
+%
+%    \begin{macrocode}
+    \def\@citex[#1][#2]#3{%
+      \@safe at activestrue\edef\@tempa{#3}\@safe at activesfalse
+      \org@@citex[#1][#2]{\@tempa}}%
+    }{}}
+%    \end{macrocode}
+%
+% The package \pkg{cite} has a definition of |\@citex| where the
+% shorthands need to be turned off in both arguments.
+%
+%    \begin{macrocode}
+  \AtBeginDocument{%
+    \@ifpackageloaded{cite}{%
+      \def\@citex[#1]#2{%
+        \@safe at activestrue\org@@citex[#1]{#2}\@safe at activesfalse}%
+      }{}}
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+% \begin{macro}{\nocite}
+%
+% The macro |\nocite| which is used to instruct BiB\TeX\ to
+% extract uncited references from the database.
+%
+%    \begin{macrocode}
+  \bbl at redefine\nocite#1{%
+    \@safe at activestrue\org at nocite{#1}\@safe at activesfalse}
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+% \begin{macro}{\bibcite}
+%
+% The macro that is used in the |.aux| file to
+% define citation labels. When packages such as \pkg{natbib} or
+% \pkg{cite} are not loaded its second argument is used to typeset the
+% citation label. In that case, this second argument can contain
+% active characters but is used in an environment where
+% |\@safe at activestrue| is in effect. This switch needs to be reset
+% inside the |\hbox| which contains the citation label. In order to
+% determine during \file{.aux} file processing which definition of
+% |\bibcite| is needed we define |\bibcite| in such a way that it
+% redefines itself with the proper definition. We call
+% |\bbl at cite@choice| to select the proper definition for |\bibcite|.
+% This new definition is then activated.
+%
+%    \begin{macrocode}
+  \bbl at redefine\bibcite{%
+    \bbl at cite@choice
+    \bibcite}
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+% \begin{macro}{\bbl at bibcite}
+%
+% The macro |\bbl at bibcite| holds the definition of |\bibcite|
+% needed when neither \pkg{natbib} nor \pkg{cite} is loaded.
+%
+%    \begin{macrocode}
+  \def\bbl at bibcite#1#2{%
+    \org at bibcite{#1}{\@safe at activesfalse#2}}
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+% \begin{macro}{\bbl at cite@choice}
+%
+% The macro |\bbl at cite@choice| determines which definition of
+% |\bibcite| is needed. First we give |\bibcite| its default
+% definition.
+%
+%    \begin{macrocode}
+  \def\bbl at cite@choice{%
+    \global\let\bibcite\bbl at bibcite
+    \@ifpackageloaded{natbib}{\global\let\bibcite\org at bibcite}{}%
+    \@ifpackageloaded{cite}{\global\let\bibcite\org at bibcite}{}%
+    \global\let\bbl at cite@choice\relax}
+%    \end{macrocode}
+%
+% When a document is run for the first time, no \file{.aux} file is
+% available, and |\bibcite| will not yet be properly defined. In
+% this case, this has to happen before the document starts.
+%
+%    \begin{macrocode}
+  \AtBeginDocument{\bbl at cite@choice}
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+% \begin{macro}{\@bibitem}
+%
+% One of the two internal \LaTeX\ macros called by |\bibitem|
+% that write the citation label on the |.aux| file.
+%
+%    \begin{macrocode}
+  \bbl at redefine\@bibitem#1{%
+    \@safe at activestrue\org@@bibitem{#1}\@safe at activesfalse}
+\else
+  \let\org at nocite\nocite
+  \let\org@@citex\@citex
+  \let\org at bibcite\bibcite
+  \let\org@@bibitem\@bibitem
+\fi
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+% \subsection{Marks}
+%
+% \begin{macro}{\markright}
+% Because the output routine is asynchronous, we must pass the
+% current language attribute to the head lines. To achieve this we
+% need to adapt the definition of |\markright| and |\markboth|
+% somewhat. However, headlines and footlines can contain text
+% outside marks; for that we must take some actions in the output
+% routine if the 'headfoot' options is used. 
+%
+% We need to make some redefinitions to the output routine
+% to avoid an endless loop and to correctly handle the page number
+% in bidi documents.
+%
+%    \begin{macrocode}
+\bbl at trace{Marks}
+\IfBabelLayout{sectioning}
+  {\ifx\bbl at opt@headfoot\@nnil
+     \g at addto@macro\@resetactivechars{%
+       \set at typeset@protect
+       \expandafter\select at language@x\expandafter{\bbl at main@language}%
+       \let\protect\noexpand
+       \ifcase\bbl at bidimode\else % Only with bidi. See also above
+         \edef\thepage{%
+           \noexpand\babelsublr{\unexpanded\expandafter{\thepage}}}%
+       \fi}%
+   \fi}
+  {\ifbbl at single\else
+     \bbl at ifunset{markright }\bbl at redefine\bbl at redefinerobust
+     \markright#1{%
+       \bbl at ifblank{#1}%
+         {\org at markright{}}%
+         {\toks@{#1}%
+          \bbl at exp{%
+            \\\org at markright{\\\protect\\\foreignlanguage{\languagename}%
+              {\\\protect\\\bbl at restore@actives\the\toks@}}}}}%
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+%  \begin{macro}{\markboth}
+%  \begin{macro}{\@mkboth}
+%    The definition of |\markboth| is equivalent to that of
+%    |\markright|, except that we need two token registers. The
+%    documentclasses \cls{report} and \cls{book} define and set the
+%    headings for the page. While doing so they also store a copy of
+%    |\markboth| in |\@mkboth|. Therefore we need to check whether
+%    |\@mkboth| has already been set. If so we neeed to do that again
+%    with the new definition of |\markboth|. (As of Oct 2019, \LaTeX{}
+%    stores the definition in an intermediate macro, so it's not
+%    necessary anymore, but it's preserved for older versions.)
+%
+%    \begin{macrocode}
+     \ifx\@mkboth\markboth
+       \def\bbl at tempc{\let\@mkboth\markboth}
+     \else
+       \def\bbl at tempc{}
+     \fi
+     \bbl at ifunset{markboth }\bbl at redefine\bbl at redefinerobust
+     \markboth#1#2{%
+       \protected at edef\bbl at tempb##1{%
+         \protect\foreignlanguage
+         {\languagename}{\protect\bbl at restore@actives##1}}%
+       \bbl at ifblank{#1}%
+         {\toks@{}}%
+         {\toks@\expandafter{\bbl at tempb{#1}}}%
+       \bbl at ifblank{#2}%
+         {\@temptokena{}}%
+         {\@temptokena\expandafter{\bbl at tempb{#2}}}%
+       \bbl at exp{\\\org at markboth{\the\toks@}{\the\@temptokena}}}
+       \bbl at tempc
+     \fi}  % end ifbbl at single, end \IfBabelLayout
+%    \end{macrocode}
+%
+%  \end{macro}
+%  \end{macro}
+%
+% \subsection{Preventing clashes with other packages}
+%
+% \subsubsection{\pkg{ifthen}}
+%
+% \begin{macro}{\ifthenelse}
+%
+% Sometimes a document writer wants to create a special effect
+% depending on the page a certain fragment of text appears on. This
+% can be achieved by the following piece of code:
+%\begin{verbatim}
+%    \ifthenelse{\isodd{\pageref{some:label}}}
+%               {code for odd pages}
+%               {code for even pages}
+%\end{verbatim}
+% In order for this to work the argument of |\isodd| needs to be
+% fully expandable. With the above redefinition of |\pageref| it is
+% not in the case of this example. To overcome that, we add some
+% code to the definition of |\ifthenelse| to make things work.
+%
+% We want to revert the definition of |\pageref| and |\ref| to
+% their original definition for the first argument of |\ifthenelse|,
+% so we first need to store their current meanings.
+%
+% Then we can set the |\@safe at actives| switch and call the original
+% |\ifthenelse|. In order to be able to use shorthands in the
+% second and third arguments of |\ifthenelse| the resetting of the
+% switch \emph{and} the definition of |\pageref| happens inside
+% those arguments. 
+%
+%    \begin{macrocode}
+\bbl at trace{Preventing clashes with other packages}
+\bbl at xin@{R}\bbl at opt@safe
+\ifin@
+  \AtBeginDocument{%
+    \@ifpackageloaded{ifthen}{%
+      \bbl at redefine@long\ifthenelse#1#2#3{%
+        \let\bbl at temp@pref\pageref
+        \let\pageref\org at pageref
+        \let\bbl at temp@ref\ref
+        \let\ref\org at ref
+        \@safe at activestrue
+        \org at ifthenelse{#1}%
+          {\let\pageref\bbl at temp@pref
+           \let\ref\bbl at temp@ref
+           \@safe at activesfalse
+           #2}%
+          {\let\pageref\bbl at temp@pref
+           \let\ref\bbl at temp@ref
+           \@safe at activesfalse
+           #3}%
+        }%
+      }{}%
+    }
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+% \subsubsection{\pkg{varioref}}
+%
+% \begin{macro}{\@@vpageref}
+% \begin{macro}{\vrefpagenum}
+% \begin{macro}{\Ref}
+%
+% When the package varioref is in use we need to modify its
+% internal command |\@@vpageref| in order to prevent problems when
+% an active character ends up in the argument of |\vref|. The same
+% needs to happen for |\vrefpagenum|.
+%
+%    \begin{macrocode}
+  \AtBeginDocument{%
+    \@ifpackageloaded{varioref}{%
+      \bbl at redefine\@@vpageref#1[#2]#3{%
+        \@safe at activestrue
+        \org@@@vpageref{#1}[#2]{#3}%
+        \@safe at activesfalse}%
+      \bbl at redefine\vrefpagenum#1#2{%
+        \@safe at activestrue
+        \org at vrefpagenum{#1}{#2}%
+        \@safe at activesfalse}%
+%    \end{macrocode}
+%
+% The package \pkg{varioref} defines |\Ref| to be a robust command
+% wich uppercases the first character of the reference text. In
+% order to be able to do that it needs to access the expandable form
+% of |\ref|. So we employ a little trick here. We redefine the
+% (internal) command \verb*|\Ref | to call |\org at ref| instead of
+% |\ref|. The disadvantage of this solution is that whenever the
+% definition of |\Ref| changes, this definition needs to be updated
+% as well.
+%
+%    \begin{macrocode}
+      \expandafter\def\csname Ref \endcsname#1{%
+        \protected at edef\@tempa{\org at ref{#1}}\expandafter\MakeUppercase\@tempa}
+      }{}%
+    }
+\fi
+%    \end{macrocode}
+%
+%  \end{macro}
+%  \end{macro}
+%  \end{macro}
+%
+% \subsubsection{\pkg{hhline}}
+%
+%
+% \begin{macro}{\hhline}
+%
+% Delaying the activation of the shorthand characters has introduced
+% a problem with the \pkg{hhline} package. The reason is that it
+% uses the `:' character which is made active by the french support
+% in \babel. Therefore we need to \emph{reload} the package when
+% the `:' is an active character. Note that this happens
+% \emph{after} the category code of the @-sign has been changed to
+% other, so we need to temporarily change it to letter again.
+%
+%    \begin{macrocode}
+\AtEndOfPackage{%
+  \AtBeginDocument{%
+    \@ifpackageloaded{hhline}%
+      {\expandafter\ifx\csname normal at char\string:\endcsname\relax
+       \else
+         \makeatletter
+         \def\@currname{hhline}\input{hhline.sty}\makeatother
+       \fi}%
+      {}}}
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+% \begin{macro}{\substitutefontfamily}
+%
+% Deprecated. Use the tools provides by \LaTeX. The command
+% |\substitutefontfamily| creates an \file{.fd} file on the fly. The
+% first argument is an encoding mnemonic, the second and third
+% arguments are font family names.
+%
+%    \begin{macrocode}
+\def\substitutefontfamily#1#2#3{%
+  \lowercase{\immediate\openout15=#1#2.fd\relax}%
+  \immediate\write15{%
+    \string\ProvidesFile{#1#2.fd}%
+    [\the\year/\two at digits{\the\month}/\two at digits{\the\day}
+     \space generated font description file]^^J
+    \string\DeclareFontFamily{#1}{#2}{}^^J
+    \string\DeclareFontShape{#1}{#2}{m}{n}{<->ssub * #3/m/n}{}^^J
+    \string\DeclareFontShape{#1}{#2}{m}{it}{<->ssub * #3/m/it}{}^^J
+    \string\DeclareFontShape{#1}{#2}{m}{sl}{<->ssub * #3/m/sl}{}^^J
+    \string\DeclareFontShape{#1}{#2}{m}{sc}{<->ssub * #3/m/sc}{}^^J
+    \string\DeclareFontShape{#1}{#2}{b}{n}{<->ssub * #3/bx/n}{}^^J
+    \string\DeclareFontShape{#1}{#2}{b}{it}{<->ssub * #3/bx/it}{}^^J
+    \string\DeclareFontShape{#1}{#2}{b}{sl}{<->ssub * #3/bx/sl}{}^^J
+    \string\DeclareFontShape{#1}{#2}{b}{sc}{<->ssub * #3/bx/sc}{}^^J
+    }%
+  \closeout15
+  }
+\@onlypreamble\substitutefontfamily
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+% \subsection{Encoding and fonts}
+%
+%  Because documents may use non-ASCII font encodings, we make sure
+%  that the logos of \TeX\ and \LaTeX\ always come out in the right
+%  encoding. There is a list of non-ASCII encodings. Requested
+%  encodings are currently stored in |\@fontenc at load@list|. If a
+%  non-ASCII has been loaded, we define versions of |\TeX| and |\LaTeX|
+%  for them using |\ensureascii|. The default ASCII encoding is set,
+%  too (in reverse order): the ``main'' encoding (when the document
+%  begins), the last loaded, or |OT1|.
+%
+%  \begin{macro}{\ensureascii}
+%
+%    \begin{macrocode}
+\bbl at trace{Encoding and fonts}
+\newcommand\BabelNonASCII{LGR,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU}
+\newcommand\BabelNonText{TS1,T3,TS3}
+\let\org at TeX\TeX
+\let\org at LaTeX\LaTeX
+\let\ensureascii\@firstofone
+\AtBeginDocument{%
+  \def\@elt#1{,#1,}%
+  \edef\bbl at tempa{\expandafter\@gobbletwo\@fontenc at load@list}%
+  \let\@elt\relax
+  \let\bbl at tempb\@empty
+  \def\bbl at tempc{OT1}%
+  \bbl at foreach\BabelNonASCII{% LGR loaded in a non-standard way
+    \bbl at ifunset{T@#1}{}{\def\bbl at tempb{#1}}}%
+  \bbl at foreach\bbl at tempa{%
+    \bbl at xin@{#1}{\BabelNonASCII}%
+    \ifin@
+      \def\bbl at tempb{#1}% Store last non-ascii
+    \else\bbl at xin@{#1}{\BabelNonText}% Pass
+      \ifin@\else
+        \def\bbl at tempc{#1}% Store last ascii
+      \fi
+    \fi}%
+  \ifx\bbl at tempb\@empty\else
+    \bbl at xin@{,\cf at encoding,}{,\BabelNonASCII,\BabelNonText,}%
+    \ifin@\else
+      \edef\bbl at tempc{\cf at encoding}% The default if ascii wins
+    \fi
+    \edef\ensureascii#1{%
+      {\noexpand\fontencoding{\bbl at tempc}\noexpand\selectfont#1}}%
+    \DeclareTextCommandDefault{\TeX}{\ensureascii{\org at TeX}}%
+    \DeclareTextCommandDefault{\LaTeX}{\ensureascii{\org at LaTeX}}%
+  \fi}
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+%  Now comes the old deprecated stuff (with a little change in 3.9l,
+%  for \textsf{fontspec}).  The first thing we need to do is to
+%  determine, at |\begin{document}|, which latin fontencoding to use.
+%
+%  \begin{macro}{\latinencoding}
+%    When text is being typeset in an encoding other than `latin'
+%    (\texttt{OT1} or \texttt{T1}), it would be nice to still have
+%    Roman numerals come out in the Latin encoding.
+%    So we first assume that the current encoding at the end
+%    of processing the package is the Latin encoding.
+%
+%    \begin{macrocode}
+\AtEndOfPackage{\edef\latinencoding{\cf at encoding}}
+%    \end{macrocode}
+%
+%    But this might be overruled with a later loading of the package
+%    \pkg{fontenc}. Therefore we check at the execution of
+%    |\begin{document}| whether it was loaded with the \Lopt{T1}
+%    option. The normal way to do this (using |\@ifpackageloaded|) is
+%    disabled for this package. Now we have to revert to parsing the
+%    internal macro |\@filelist| which contains all the filenames
+%    loaded.
+%
+%    \begin{macrocode}
+\AtBeginDocument{%
+  \@ifpackageloaded{fontspec}%
+    {\xdef\latinencoding{%
+       \ifx\UTFencname\@undefined
+         EU\ifcase\bbl at engine\or2\or1\fi
+       \else
+         \UTFencname
+       \fi}}%
+    {\gdef\latinencoding{OT1}%
+     \ifx\cf at encoding\bbl at t@one
+       \xdef\latinencoding{\bbl at t@one}%
+     \else
+       \def\@elt#1{,#1,}%
+       \edef\bbl at tempa{\expandafter\@gobbletwo\@fontenc at load@list}%
+       \let\@elt\relax
+       \bbl at xin@{,T1,}\bbl at tempa
+       \ifin@
+         \xdef\latinencoding{\bbl at t@one}%
+       \fi
+     \fi}}
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+%  \begin{macro}{\latintext}
+%    Then we can define the command |\latintext| which is a
+%    declarative switch to a latin font-encoding. Usage of this macro
+%    is deprecated.
+%
+%    \begin{macrocode}
+\DeclareRobustCommand{\latintext}{%
+  \fontencoding{\latinencoding}\selectfont
+  \def\encodingdefault{\latinencoding}}
+%    \end{macrocode}
+%
+%  \end{macro}
+%
+%  \begin{macro}{\textlatin}
+%    This command takes an argument which is then typeset using the
+%    requested font encoding. In order to avoid many encoding switches
+%    it operates in a local scope.
+%
+%    \begin{macrocode}
+\ifx\@undefined\DeclareTextFontCommand
+  \DeclareRobustCommand{\textlatin}[1]{\leavevmode{\latintext #1}}
+\else
+  \DeclareTextFontCommand{\textlatin}{\latintext}
+\fi
+%    \end{macrocode}
+%
+% For several functions, we need to execute some code with
+% |\selectfont|. With \LaTeX\ 2021-06-01, there is a hook for this
+% purpose, but in older versions the \LaTeX{} command is patched (the
+% latter solution will be eventually removed).
+%
+%    \begin{macrocode}
+\bbl at ifformatlater{2021-06-01}%
+  {\def\bbl at patchfont#1{\AddToHook{selectfont}{#1}}}
+  {\def\bbl at patchfont#1{%
+     \expandafter\bbl at add\csname selectfont \endcsname{#1}%
+     \expandafter\bbl at toglobal\csname selectfont \endcsname}}
+%    \end{macrocode}
+%
+% \end{macro}
+%
+% \subsection{Basic bidi support}
+%
+% \textbf{Work in progress.} This code is currently placed here for
+% practical reasons. It will be moved to the correct place soon, I
+% hope.
+%
+% It is loosely based on |rlbabel.def|, but most of it has been
+% developed from scratch. This \babel{} module (by Johannes Braams and
+% Boris Lavva) has served the purpose of typesetting R documents for
+% two decades, and despite its flaws I think it is still a good starting
+% point (some parts have been copied here almost verbatim), partly
+% thanks to its simplicity. I've also looked at \textsc{arabi} (by
+% Youssef Jabri), which is compatible with \babel{}.
+%
+% There are two ways of modifying macros to make them “bidi”, namely,
+% by patching the internal low-level macros (which is what I have done
+% with lists, columns, counters, tocs, much like |rlbabel| did), and
+% by introducing a “middle layer” just below the user interface
+% (sectioning, footnotes).
+%
+% \begin{itemize}
+% \item pdftex provides a minimal support for bidi text, and it
+%   must be done by hand. Vertical typesetting is not possible.
+% \item \xetex{} is somewhat better, thanks to its font engine
+%   (even if not always reliable) and a few additional tools. However,
+%   very little is done at the paragraph level. Another challenging
+%   problem is text direction does not honour \TeX{} grouping.
+% \item \luatex{} can provide the most complete solution, as we can
+%   manipulate almost freely the node list, the generated lines,
+%   and so on, but bidi text does not work out of the box and some
+%   development is necessary. It also provides tools to properly
+%   set left-to-right and right-to-left page layouts. As Lua\TeX-ja
+%   shows, vertical typesetting is possible, too.
+% \end{itemize}
+%
+%    \begin{macrocode}
+\bbl at trace{Loading basic (internal) bidi support}
+\ifodd\bbl at engine
+\else % TODO. Move to txtbabel
+  \ifnum\bbl at bidimode>100 \ifnum\bbl at bidimode<200
+    \bbl at error
+      {The bidi method 'basic' is available only in\\%
+       luatex. I'll continue with 'bidi=default', so\\%
+       expect wrong results}%
+      {See the manual for further details.}%
+    \let\bbl at beforeforeign\leavevmode
+    \AtEndOfPackage{%
+      \EnableBabelHook{babel-bidi}%
+      \bbl at xebidipar}
+  \fi\fi
+  \def\bbl at loadxebidi#1{%
+    \ifx\RTLfootnotetext\@undefined
+      \AtEndOfPackage{%
+        \EnableBabelHook{babel-bidi}%
+        \ifx\fontspec\@undefined
+          \bbl at loadfontspec % bidi needs fontspec
+        \fi
+        \usepackage#1{bidi}}%
+    \fi}
+  \ifnum\bbl at bidimode>200
+    \ifcase\expandafter\@gobbletwo\the\bbl at bidimode\or
+      \bbl at tentative{bidi=bidi}
+      \bbl at loadxebidi{}
+    \or
+      \bbl at loadxebidi{[rldocument]}
+    \or
+      \bbl at loadxebidi{}
+    \fi
+  \fi
+\fi
+% TODO? Separate:
+\ifnum\bbl at bidimode=\@ne
+  \let\bbl at beforeforeign\leavevmode
+  \ifodd\bbl at engine
+    \newattribute\bbl at attr@dir
+    \directlua{ Babel.attr_dir = luatexbase.registernumber'bbl at attr@dir' }
+    \bbl at exp{\output{\bodydir\pagedir\the\output}}
+  \fi
+  \AtEndOfPackage{%
+    \EnableBabelHook{babel-bidi}%
+    \ifodd\bbl at engine\else
+      \bbl at xebidipar
+    \fi}
+\fi
+%    \end{macrocode}
+%
+% Now come the macros used to set the direction when a language is
+% switched. First the (mostly) common macros.
+%
+%    \begin{macrocode}
+\bbl at trace{Macros to switch the text direction}
+\def\bbl at alscripts{,Arabic,Syriac,Thaana,}
+\def\bbl at rscripts{% TODO. Base on codes ??
+  ,Imperial Aramaic,Avestan,Cypriot,Hatran,Hebrew,%
+  Old Hungarian,Old Hungarian,Lydian,Mandaean,Manichaean,%
+  Manichaean,Meroitic Cursive,Meroitic,Old North Arabian,%
+  Nabataean,N'Ko,Orkhon,Palmyrene,Inscriptional Pahlavi,%
+  Psalter Pahlavi,Phoenician,Inscriptional Parthian,Samaritan,%
+  Old South Arabian,}%
+\def\bbl at provide@dirs#1{%
+  \bbl at xin@{\csname bbl at sname@#1\endcsname}{\bbl at alscripts\bbl at rscripts}%
+  \ifin@
+    \global\bbl at csarg\chardef{wdir@#1}\@ne
+    \bbl at xin@{\csname bbl at sname@#1\endcsname}{\bbl at alscripts}%
+    \ifin@
+      \global\bbl at csarg\chardef{wdir@#1}\tw@  % useless in xetex
+    \fi
+  \else
+    \global\bbl at csarg\chardef{wdir@#1}\z@
+  \fi
+  \ifodd\bbl at engine
+    \bbl at csarg\ifcase{wdir@#1}%
+      \directlua{ Babel.locale_props[\the\localeid].textdir = 'l' }%
+    \or
+      \directlua{ Babel.locale_props[\the\localeid].textdir = 'r' }%
+    \or
+      \directlua{ Babel.locale_props[\the\localeid].textdir = 'al' }%
+    \fi
+  \fi}
+\def\bbl at switchdir{%
+  \bbl at ifunset{bbl at lsys@\languagename}{\bbl at provide@lsys{\languagename}}{}%
+  \bbl at ifunset{bbl at wdir@\languagename}{\bbl at provide@dirs{\languagename}}{}%
+  \bbl at exp{\\\bbl at setdirs\bbl at cl{wdir}}}
+\def\bbl at setdirs#1{% TODO - math
+  \ifcase\bbl at select@type % TODO - strictly, not the right test
+    \bbl at bodydir{#1}%
+    \bbl at pardir{#1}%
+  \fi
+  \bbl at textdir{#1}}
+% TODO. Only if \bbl at bidimode > 0?:
+\AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
+\DisableBabelHook{babel-bidi}
+%    \end{macrocode}
+%
+% Now the engine-dependent macros. TODO. Must be moved to the engine
+% files.
+%
+%    \begin{macrocode} 
+\ifodd\bbl at engine  % luatex=1
+\else % pdftex=0, xetex=2
+  \newcount\bbl at dirlevel
+  \chardef\bbl at thetextdir\z@
+  \chardef\bbl at thepardir\z@
+  \def\bbl at textdir#1{%
+    \ifcase#1\relax
+       \chardef\bbl at thetextdir\z@
+       \bbl at textdir@i\beginL\endL
+     \else
+       \chardef\bbl at thetextdir\@ne
+       \bbl at textdir@i\beginR\endR
+    \fi}
+  \def\bbl at textdir@i#1#2{%
+    \ifhmode
+      \ifnum\currentgrouplevel>\z@
+        \ifnum\currentgrouplevel=\bbl at dirlevel
+          \bbl at error{Multiple bidi settings inside a group}%
+            {I'll insert a new group, but expect wrong results.}%
+          \bgroup\aftergroup#2\aftergroup\egroup
+        \else
+          \ifcase\currentgrouptype\or % 0 bottom
+            \aftergroup#2% 1 simple {}
+          \or
+            \bgroup\aftergroup#2\aftergroup\egroup % 2 hbox
+          \or
+            \bgroup\aftergroup#2\aftergroup\egroup % 3 adj hbox
+          \or\or\or % vbox vtop align
+          \or
+            \bgroup\aftergroup#2\aftergroup\egroup % 7 noalign
+          \or\or\or\or\or\or % output math disc insert vcent mathchoice
+          \or
+            \aftergroup#2% 14 \begingroup
+          \else
+            \bgroup\aftergroup#2\aftergroup\egroup % 15 adj
+          \fi
+        \fi
+        \bbl at dirlevel\currentgrouplevel
+      \fi
+      #1%
+    \fi}
+  \def\bbl at pardir#1{\chardef\bbl at thepardir#1\relax}
+  \let\bbl at bodydir\@gobble
+  \let\bbl at pagedir\@gobble
+  \def\bbl at dirparastext{\chardef\bbl at thepardir\bbl at thetextdir}
+%    \end{macrocode}
+%
+% The following command is executed only if there is a right-to-left
+% script (once). It activates the |\everypar| hack for \xetex, to
+% properly handle the par direction. Note text and par dirs are
+% decoupled to some extent (although not completely).
+%
+%    \begin{macrocode}
+  \def\bbl at xebidipar{%
+    \let\bbl at xebidipar\relax
+    \TeXXeTstate\@ne
+    \def\bbl at xeeverypar{%
+      \ifcase\bbl at thepardir
+        \ifcase\bbl at thetextdir\else\beginR\fi
+      \else
+        {\setbox\z@\lastbox\beginR\box\z@}%
+      \fi}%
+    \let\bbl at severypar\everypar
+    \newtoks\everypar
+    \everypar=\bbl at severypar
+    \bbl at severypar{\bbl at xeeverypar\the\everypar}}
+  \ifnum\bbl at bidimode>200
+    \let\bbl at textdir@i\@gobbletwo
+    \let\bbl at xebidipar\@empty
+    \AddBabelHook{bidi}{foreign}{%
+      \def\bbl at tempa{\def\BabelText####1}%
+      \ifcase\bbl at thetextdir
+        \expandafter\bbl at tempa\expandafter{\BabelText{\LR{##1}}}%
+      \else
+        \expandafter\bbl at tempa\expandafter{\BabelText{\RL{##1}}}%
+      \fi}
+    \def\bbl at pardir#1{\ifcase#1\relax\setLR\else\setRL\fi}
+  \fi
+\fi
+%    \end{macrocode}
+%
+% A tool for weak L (mainly digits). We also disable warnings with
+% \textsf{hyperref}.
+%
+%    \begin{macrocode}
+\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl at textdir\z@#1}}
+\AtBeginDocument{%
+  \ifx\pdfstringdefDisableCommands\@undefined\else
+    \ifx\pdfstringdefDisableCommands\relax\else
+      \pdfstringdefDisableCommands{\let\babelsublr\@firstofone}%
+    \fi
+  \fi}
+%    \end{macrocode}
+%
+% \subsection{Local Language Configuration}
+%
+% \begin{macro}{\loadlocalcfg}
+%
+% At some sites it may be necessary to add site-specific actions to
+% a language definition file. This can be done by creating a file
+% with the same name as the language definition file, but with the
+% extension \file{.cfg}. For instance the file \file{norsk.cfg}
+% will be loaded when the language definition file \file{norsk.ldf}
+% is loaded. 
+%
+% For plain-based formats we don't want to override the definition
+% of |\loadlocalcfg| from \file{plain.def}.
+%
+%    \begin{macrocode}
+\bbl at trace{Local Language Configuration}
+\ifx\loadlocalcfg\@undefined
+  \@ifpackagewith{babel}{noconfigs}%
+    {\let\loadlocalcfg\@gobble}%
+    {\def\loadlocalcfg#1{%
+      \InputIfFileExists{#1.cfg}%
+        {\typeout{*************************************^^J%
+                       * Local config file #1.cfg used^^J%
+                       *}}%
+        \@empty}}
+\fi
+%    \end{macrocode}%
+%    \end{macro}
+%
+% \subsection{Language options}
+%
+% Languages are loaded when processing the corresponding option
+% \textit{except} if a |main| language has been set. In such a
+% case, it is not loaded until all options has been processed.
+% The following macro inputs the ldf file and does some additional
+% checks (|\input| works, too, but possible errors are not catched).
+%
+%    \begin{macrocode}
+\bbl at trace{Language options}
+\let\bbl at afterlang\relax
+\let\BabelModifiers\relax
+\let\bbl at loaded\@empty
+\def\bbl at load@language#1{%
+  \InputIfFileExists{#1.ldf}%
+    {\edef\bbl at loaded{\CurrentOption
+       \ifx\bbl at loaded\@empty\else,\bbl at loaded\fi}%
+     \expandafter\let\expandafter\bbl at afterlang
+        \csname\CurrentOption.ldf-h@@k\endcsname
+     \expandafter\let\expandafter\BabelModifiers
+        \csname bbl at mod@\CurrentOption\endcsname}%
+    {\bbl at error{%
+       Unknown option '\CurrentOption'. Either you misspelled it\\%
+       or the language definition file \CurrentOption.ldf was not found}{%
+       Valid options are, among others: shorthands=, KeepShorthandsActive,\\%
+       activeacute, activegrave, noconfigs, safe=, main=, math=\\%
+       headfoot=, strings=, config=, hyphenmap=, or a language name.}}}
+%    \end{macrocode}
+%
+% Now, we set a few language options whose names are different from
+% |ldf| files. These declarations are preserved for backwards
+% compatibility, but they must be eventually removed. Use proxy files
+% instead.
+%
+%    \begin{macrocode}
+\def\bbl at try@load at lang#1#2#3{%
+  \IfFileExists{\CurrentOption.ldf}%
+    {\bbl at load@language{\CurrentOption}}%
+    {#1\bbl at load@language{#2}#3}}
+%
+\DeclareOption{hebrew}{%
+  \input{rlbabel.def}%
+  \bbl at load@language{hebrew}}
+\DeclareOption{hungarian}{\bbl at try@load at lang{}{magyar}{}}
+\DeclareOption{lowersorbian}{\bbl at try@load at lang{}{lsorbian}{}}
+\DeclareOption{nynorsk}{\bbl at try@load at lang{}{norsk}{}}
+\DeclareOption{polutonikogreek}{%
+  \bbl at try@load at lang{}{greek}{\languageattribute{greek}{polutoniko}}}
+\DeclareOption{russian}{\bbl at try@load at lang{}{russianb}{}}
+\DeclareOption{ukrainian}{\bbl at try@load at lang{}{ukraineb}{}}
+\DeclareOption{uppersorbian}{\bbl at try@load at lang{}{usorbian}{}}
+%    \end{macrocode}
+%
+% Another way to extend the list of `known' options for \babel\ was
+% to create the file \file{bblopts.cfg} in which one can add option
+% declarations. However, this mechanism is deprecated -- if you
+% want an alternative name for a language, just create a new |.ldf|
+% file loading the actual one. You can also set the name
+% of the file with the package option |config=<name>|, which will
+% load |<name>.cfg| instead.
+%
+%    \begin{macrocode}
+\ifx\bbl at opt@config\@nnil
+  \@ifpackagewith{babel}{noconfigs}{}%
+    {\InputIfFileExists{bblopts.cfg}%
+      {\typeout{*************************************^^J%
+               * Local config file bblopts.cfg used^^J%
+               *}}%
+      {}}%
+\else
+  \InputIfFileExists{\bbl at opt@config.cfg}%
+    {\typeout{*************************************^^J%
+             * Local config file \bbl at opt@config.cfg used^^J%
+             *}}%
+    {\bbl at error{%
+       Local config file '\bbl at opt@config.cfg' not found}{%
+       Perhaps you misspelled it.}}%
+\fi
+%    \end{macrocode}
+%
+% Recognizing global options in packages not having a closed set of
+% them is not trivial, as for them to be processed they must be defined
+% explicitly. So, package options not yet taken into account and stored
+% in |bbl at language@opts| are assumed to be existing languages (note
+% this list also contains the language given with |main| as the last
+% element). If not declared above, the names of the option and the file
+% are the same. There are two steps -- first process option names and
+% collect the result, which then do the actual declarations.
+%
+% To allow multiple overlapping replacements, commas in
+% |\bbl at language@opts| are doubled.
+%
+%    \begin{macrocode}
+\let\bbl at elt\relax
+\let\bbl at tempe\@empty
+\bbl at foreach\@classoptionslist{%
+  \bbl at xin@{,#1,$}{\bbl at language@opts$}% Match last
+  \ifin@\else
+    \bbl at xin@{,#1,}{\bbl at language@opts}% Match non-last
+    \ifin@
+      \bbl at replace\bbl at language@opts{,#1,}{,,}%
+      \edef\bbl at tempe{\bbl at tempe\bbl at elt{3}{#1}}%
+    \else
+      \babel at savecnt\z@ % Use as temp
+      \ifnum\bbl at iniflag<\thr@@ % Optimization: 3 = always ini
+        \IfFileExists{#1.ldf}{\advance\babel at savecnt\@ne}{}%
+      \fi
+      \ifnum\bbl at iniflag>\z@ % Optimization: 0 = always ldf
+        \IfFileExists{babel-#1.tex}{\advance\babel at savecnt\tw@}{}%
+      \fi
+      \ifnum\babel at savecnt>\z@
+        \edef\bbl at tempe{\bbl at tempe\bbl at elt{\the\babel at savecnt}{#1}}%
+      \fi
+    \fi
+  \fi}
+%
+\let\bbl at savemain\@empty
+\bbl at foreach\bbl at language@opts{%
+  \edef\bbl at tempe{\bbl at tempe\bbl at elt{3}{#1}}}
+\def\bbl at elt#1#2#3{%
+  \ifx#3\relax % if last
+    \bbl at ifunset{ds@#2}{}%
+      {\bbl at exp{\def\\\bbl at savemain{\\\DeclareOption{#2}{\[ds@#2]}}}}%
+    \bbl at add\bbl at savemain{\bbl at elt{#1}{#2}}% Save main
+    \DeclareOption{#2}{}% 
+  \else
+    \ifnum\bbl at iniflag<\tw@ % other as ldf
+      \ifodd#1\relax % Class: if ldf exists 1,3. Package: always 3
+        \bbl at ifunset{ds@#2}%
+         {\DeclareOption{#2}{\bbl at load@language{#2}}}%
+         {}%
+      \fi
+    \else % other as ini  
+      \ifnum#1>\@ne %  % Class: if ini exists 2,3. Package: always 3
+        \DeclareOption{#2}{%
+          \bbl at ldfinit
+          \babelprovide[import]{#2}%
+          \bbl at afterldf{}}%
+       \fi
+    \fi
+  \fi
+  #3}
+\bbl at tempe\relax % \relax catches last
+%    \end{macrocode}
+%
+% Now, we make sure an option is explicitly declared for any language
+% set as global option, by checking if an |ldf| exists. The previous
+% step was, in fact, somewhat redundant, but that way we minimize
+% accessing the file system just to see if the option could be a
+% language.
+%
+%    If a main language has been set, store it for the third pass.
+% And we are done, because all options for this pass has been
+% declared. Those already processed in the first pass are just
+% ignored.
+%
+% The options have to be processed in the order in which the user
+% specified them (except, of course, global options, which \LaTeX{}
+% processes before):
+%
+%    \begin{macrocode}
+\def\AfterBabelLanguage#1{%
+  \bbl at ifsamestring\CurrentOption{#1}{\global\bbl at add\bbl at afterlang}{}}
+\DeclareOption*{}
+\ProcessOptions*
+%    \end{macrocode}
+%
+% This finished the second pass. Now the third one begins, which
+% loads the main language set with the key |main|. A warning is
+% raised if the main language is not the same as the last named
+% one, or if the value of the key |main| is not a language. Then
+% execute directly the option (because it could be used only in
+% |main|). After loading all languages, we deactivate
+% |\AfterBabelLanguage|.
+%
+%    \begin{macrocode}
+\bbl at trace{Option 'main'}
+\ifx\bbl at opt@main\@nnil
+  \edef\bbl at tempa{\@classoptionslist,\bbl at language@opts}
+  \let\bbl at tempc\@empty
+  \bbl at for\bbl at tempb\bbl at tempa{%
+    \bbl at xin@{,\bbl at tempb,}{,\bbl at loaded,}%
+    \ifin@\edef\bbl at tempc{\bbl at tempb}\fi}
+  \def\bbl at tempa#1,#2\@nnil{\def\bbl at tempb{#1}}
+  \expandafter\bbl at tempa\bbl at loaded,\@nnil
+  \ifx\bbl at tempb\bbl at tempc\else
+    \bbl at warning{%
+      Last declared language option is '\bbl at tempc',\\%
+      but the last processed one was '\bbl at tempb'.\\%
+      The main language can't be set as both a global\\%
+      and a package option. Use 'main=\bbl at tempc' as\\%
+      option. Reported}%
+  \fi
+\fi
+\def\bbl at elt#1#2{% main
+  \ifodd\bbl at iniflag % as ini = 1(=), 3(*=)
+    \ifnum#1>\@ne %  % Class: if ini exists 2,3. Package: always 3
+      \def\CurrentOption{#2}% Directly, because luatexbase
+      \bbl at ldfinit
+      \babelprovide[\bbl at opt@provide,main,import]{#2}%
+      \bbl at afterldf{}%    
+      \DeclareOption{#2}{}%
+    \fi
+  \else % as ldf = 0(no), 2(+=)
+    \ifodd#1\relax % Class: if ldf exists 1,3. Package: always 3
+      \bbl at ifunset{ds@#2}%
+        {\DeclareOption{#2}{\bbl at load@language{#2}}}%
+        {}%
+      \ExecuteOptions{#2}%
+    \fi
+  \fi}
+\bbl at savemain
+\DeclareOption*{}%
+\ProcessOptions*
+\def\AfterBabelLanguage{%
+  \bbl at error
+    {Too late for \string\AfterBabelLanguage}%
+    {Languages have been loaded, so I can do nothing}}
+%    \end{macrocode}
+%      
+% In order to catch the case where the user forgot to specify a
+% language we check whether |\bbl at main@language|, has become
+% defined. If not, no language has been loaded and an error
+% message is displayed.
+%
+%    \begin{macrocode}
+\ifx\bbl at main@language\@undefined
+  \bbl at info{%
+    You haven't specified a language. I'll use 'nil'\\%
+    as the main language. Reported}
+    \bbl at load@language{nil}
+\fi
+%</package>
+%    \end{macrocode}
+%
+% \section{The kernel of Babel (\texttt{babel.def}, common)}
+%
+% The kernel of the \babel\ system is currently stored in
+% \file{babel.def}. The file \file{babel.def} contains most of the
+% code. The file \file{hyphen.cfg} is a file that can be loaded into
+% the format, which is necessary when you want to be able to switch
+% hyphenation patterns.
+%
+% Because plain \TeX\ users might want to use some of the features of
+% the \babel{} system too, care has to be taken that plain \TeX\ can
+% process the files. For this reason the current format will have to
+% be checked in a number of places. Some of the code below is common
+% to plain \TeX\ and \LaTeX, some of it is for the \LaTeX\ case only.
+%
+% Plain formats based on etex (etex, xetex, luatex) don't load
+% |hyphen.cfg| but |etex.src|, which follows a different naming
+% convention, so we need to define the babel names. It presumes
+% |language.def| exists and it is the same file used when formats were
+% created.
+%
 % A proxy file for switch.def
 %
 %    \begin{macrocode}
@@ -12891,7 +12779,7 @@
     \<keys_if_exist:nnF>{fontspec-opentype}{Language/\bbl at cl{lname}}%
       {\\\newfontlanguage{\bbl at cl{lname}}{\bbl at cl{lotf}}}%
     \\\renewfontfamily\\#4%
-      [\bbl at cs{lsys@\languagename},#2]}{#3}% ie \bbl at exp{..}{#3}
+      [\bbl at cl{lsys},#2]}{#3}% ie \bbl at exp{..}{#3}
   \begingroup
      #4%
      \xdef#1{\f at family}%     eg, \bbl at rmdflt@lang{FreeSerif(0)}
@@ -14635,6 +14523,7 @@
      {\ifx\tikz at atbegin@node\@undefined\else
         \ifx\AddToHook\@undefined\else % TODO. Still tentative.
           \AddToHook{env/pgfpicture/begin}{\bbl at pictsetdir\@ne}%
+          % \AddToHook{env/tikzpicture/begin}{\bbl at pictsetdir\z@}%
           \bbl at add\pgfinterruptpicture{\bbl at pictresetdir}%
         \fi
         \let\bbl at OL@pgfpicture\pgfpicture
@@ -22462,12 +22351,17 @@
 %
 % \subsection{Emulating some \LaTeX{} features}
 %
-% The following code duplicates or emulates parts of \LaTeXe\ that
-% are needed for \babel.
+% The file |babel.def| expects some definitions made in the \LaTeXe{}
+% style file. So, in Plain{} we must provide at least
+% some predefined values as well some tools to set them (even if not
+% all options are available). There are no package options, and
+% therefore and alternative mechanism is provided. For the moment,
+% only |\babeloptionstrings| and |\babeloptionmath| are provided,
+% which can be defined before loading \babel. |\BabelModifiers| can be
+% set too (but not sure it works).
 %
 %    \begin{macrocode}
 %<<*Emulate LaTeX>>
-  % == Code for plain ==
 \def\@empty{}
 \def\loadlocalcfg#1{%
   \openin0#1.cfg
@@ -22525,6 +22419,25 @@
   \ifx#2\@empty\else\expandafter\zap at space\fi
   #2}
 \let\bbl at trace\@gobble
+\def\bbl at error#1#2{%
+  \begingroup
+    \newlinechar=`\^^J
+    \def\\{^^J(babel) }%
+    \errhelp{#2}\errmessage{\\#1}%
+  \endgroup}
+\def\bbl at warning#1{%
+  \begingroup
+    \newlinechar=`\^^J
+    \def\\{^^J(babel) }%
+    \message{\\#1}%
+  \endgroup}
+\let\bbl at infowarn\bbl at warning
+\def\bbl at info#1{%
+  \begingroup
+    \newlinechar=`\^^J
+    \def\\{^^J}%
+    \wlog{#1}%
+  \endgroup}
 %    \end{macrocode}
 %
 %    \LaTeXe\ has the command |\@onlypreamble| which adds commands to
@@ -22879,7 +22792,7 @@
 \def\cf at encoding{OT1}
 %    \end{macrocode}
 %
-%    Currently we only use the \LaTeXe\ method for accents for those
+% Currently we only use the \LaTeXe\ method for accents for those
 %    that are known to be made active in \emph{some} language
 %    definition file.
 %
@@ -22903,20 +22816,47 @@
 \DeclareTextSymbol{\ss}{OT1}{25}
 %    \end{macrocode}
 %
-%    For a couple of languages we need the \LaTeX-control sequence
-%    |\scriptsize| to be available. Because plain \TeX\ doesn't have
-%    such a sofisticated font mechanism as \LaTeX\ has, we just |\let|
-%    it to |\sevenrm|.
+% For a couple of languages we need the \LaTeX-control sequence
+% |\scriptsize| to be available. Because plain \TeX\ doesn't have such
+% a sofisticated font mechanism as \LaTeX\ has, we just |\let| it to
+% |\sevenrm|.
 %
 %    \begin{macrocode}
 \ifx\scriptsize\@undefined
   \let\scriptsize\sevenrm
 \fi
-  % End of code for plain
+%    \end{macrocode}
+%
+%    And a few more “dummy” definitions.
+%
+%    \begin{macrocode}
+\def\languagename{english}%
+\let\bbl at opt@shorthands\@nnil
+\def\bbl at ifshorthand#1#2#3{#2}%
+\let\bbl at language@opts\@empty
+\ifx\babeloptionstrings\@undefined
+  \let\bbl at opt@strings\@nnil
+\else
+  \let\bbl at opt@strings\babeloptionstrings
+\fi
+\def\BabelStringsDefault{generic}
+\def\bbl at tempa{normal}
+\ifx\babeloptionmath\bbl at tempa
+  \def\bbl at mathnormal{\noexpand\textormath}
+\fi
+\def\AfterBabelLanguage#1#2{}
+\ifx\BabelModifiers\@undefined\let\BabelModifiers\relax\fi
+\let\bbl at afterlang\relax
+\def\bbl at opt@safe{BR}
+\ifx\@uclclist\@undefined\let\@uclclist\@empty\fi
+\ifx\bbl at trace\@undefined\def\bbl at trace#1{}\fi
+\expandafter\newif\csname ifbbl at single\endcsname
+\chardef\bbl at bidimode\z@
 %<</Emulate LaTeX>>
 %    \end{macrocode}
 %
 % A proxy file:
+%
 %    \begin{macrocode}
 %<*plain>
 \input babel.def

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.ins	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.ins	2021-10-13 20:33:19 UTC (rev 60757)
@@ -26,7 +26,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 %%
-\def\filedate{2021/07/22}
+\def\filedate{2021/10/13}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 

Modified: trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2021-10-13 20:33:19 UTC (rev 60757)
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2021/07/22 v3.63]
+\ProvidesFile{bbcompat.dtx}[2021/10/13 v3.64]
 %</dtx>
 %
 %% File 'bbcompat.dtx'

Modified: trunk/Master/texmf-dist/source/latex/babel/locale.zip
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.def	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.def	2021-10-13 20:33:19 UTC (rev 60757)
@@ -40,10 +40,9 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{babel.def}[2021/07/22 3.63 Babel common definitions]
+\ProvidesFile{babel.def}[2021/10/13 3.64 Babel common definitions]
 \ifx\AtBeginDocument\@undefined  % TODO. change test.
-    % == Code for plain ==
-\def\@empty{}
+  \def\@empty{}
 \def\loadlocalcfg#1{%
   \openin0#1.cfg
   \ifeof0
@@ -93,6 +92,25 @@
   \ifx#2\@empty\else\expandafter\zap at space\fi
   #2}
 \let\bbl at trace\@gobble
+\def\bbl at error#1#2{%
+  \begingroup
+    \newlinechar=`\^^J
+    \def\\{^^J(babel) }%
+    \errhelp{#2}\errmessage{\\#1}%
+  \endgroup}
+\def\bbl at warning#1{%
+  \begingroup
+    \newlinechar=`\^^J
+    \def\\{^^J(babel) }%
+    \message{\\#1}%
+  \endgroup}
+\let\bbl at infowarn\bbl at warning
+\def\bbl at info#1{%
+  \begingroup
+    \newlinechar=`\^^J
+    \def\\{^^J}%
+    \wlog{#1}%
+  \endgroup}
 \ifx\@preamblecmds\@undefined
   \def\@preamblecmds{}
 \fi
@@ -365,37 +383,36 @@
 \ifx\scriptsize\@undefined
   \let\scriptsize\sevenrm
 \fi
-  % End of code for plain
-  \def\languagename{english}%
-  \let\bbl at opt@shorthands\@nnil
-  \def\bbl at ifshorthand#1#2#3{#2}%
-  \let\bbl at language@opts\@empty
-  \ifx\babeloptionstrings\@undefined
-    \let\bbl at opt@strings\@nnil
-  \else
-    \let\bbl at opt@strings\babeloptionstrings
-  \fi
-  \def\BabelStringsDefault{generic}
-  \def\bbl at tempa{normal}
-  \ifx\babeloptionmath\bbl at tempa
-    \def\bbl at mathnormal{\noexpand\textormath}
-  \fi
-  \def\AfterBabelLanguage#1#2{}
-  \ifx\BabelModifiers\@undefined\let\BabelModifiers\relax\fi
-  \let\bbl at afterlang\relax
-  \def\bbl at opt@safe{BR}
-  \ifx\@uclclist\@undefined\let\@uclclist\@empty\fi
-  \ifx\bbl at trace\@undefined\def\bbl at trace#1{}\fi
-  \expandafter\newif\csname ifbbl at single\endcsname
-  \chardef\bbl at bidimode\z@
+\def\languagename{english}%
+\let\bbl at opt@shorthands\@nnil
+\def\bbl at ifshorthand#1#2#3{#2}%
+\let\bbl at language@opts\@empty
+\ifx\babeloptionstrings\@undefined
+  \let\bbl at opt@strings\@nnil
+\else
+  \let\bbl at opt@strings\babeloptionstrings
 \fi
+\def\BabelStringsDefault{generic}
+\def\bbl at tempa{normal}
+\ifx\babeloptionmath\bbl at tempa
+  \def\bbl at mathnormal{\noexpand\textormath}
+\fi
+\def\AfterBabelLanguage#1#2{}
+\ifx\BabelModifiers\@undefined\let\BabelModifiers\relax\fi
+\let\bbl at afterlang\relax
+\def\bbl at opt@safe{BR}
+\ifx\@uclclist\@undefined\let\@uclclist\@empty\fi
+\ifx\bbl at trace\@undefined\def\bbl at trace#1{}\fi
+\expandafter\newif\csname ifbbl at single\endcsname
+\chardef\bbl at bidimode\z@
+\fi
+\def\bbl at version{3.64}
+\def\bbl at date{2021/10/13}
 \ifx\language\@undefined
   \csname newcount\endcsname\language
 \fi
 \countdef\last at language=19
 \def\addlanguage{\csname newlanguage\endcsname}
-\def\bbl at version{3.63}
-\def\bbl at date{2021/07/22}
 \def\adddialect#1#2{%
   \global\chardef#1#2\relax
   \bbl at usehooks{adddialect}{{#1}{#2}}%
@@ -599,18 +616,7 @@
     \fi
   \fi}
 \let\bbl at restorelastskip\relax
-\def\bbl at savelastskip{%
-  \let\bbl at restorelastskip\relax
-  \ifvmode
-    \ifdim\lastskip=\z@
-      \let\bbl at restorelastskip\nobreak
-    \else
-      \bbl at exp{%
-        \def\\\bbl at restorelastskip{%
-          \skip@=\the\lastskip
-          \\\nobreak \vskip-\skip@ \vskip\skip@}}%
-    \fi
-  \fi}
+\let\bbl at savelastskip\relax
 \newif\ifbbl at bcpallowed
 \bbl at bcpallowedfalse
 \def\select at language#1{% from set@, babel at aux
@@ -868,27 +874,6 @@
 \let\textlanguage\setlocale
 \let\languagetext\setlocale
 \edef\bbl at nulllanguage{\string\language=0}
-\ifx\PackageError\@undefined  % TODO. Move to Plain
-  \def\bbl at error#1#2{%
-    \begingroup
-      \newlinechar=`\^^J
-      \def\\{^^J(babel) }%
-      \errhelp{#2}\errmessage{\\#1}%
-    \endgroup}
-  \def\bbl at warning#1{%
-    \begingroup
-      \newlinechar=`\^^J
-      \def\\{^^J(babel) }%
-      \message{\\#1}%
-    \endgroup}
-  \let\bbl at infowarn\bbl at warning
-  \def\bbl at info#1{%
-    \begingroup
-      \newlinechar=`\^^J
-      \def\\{^^J}%
-      \wlog{#1}%
-    \endgroup}
-\fi
 \def\bbl at nocaption{\protect\bbl at nocaption@i}
 \def\bbl at nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
   \global\@namedef{#2}{\textbf{?#1?}}%
@@ -957,9 +942,13 @@
 \def\bbl at exp#1{%
   \begingroup
     \let\\\noexpand
-    \def\<##1>{\expandafter\noexpand\csname##1\endcsname}%
+    \let\<\bbl at exp@en
+    \let\[\bbl at exp@ue
     \edef\bbl at exp@aux{\endgroup#1}%
   \bbl at exp@aux}
+\def\bbl at exp@en#1>{\expandafter\noexpand\csname#1\endcsname}%
+\def\bbl at exp@ue#1]{%
+  \unexpanded\expandafter\expandafter\expandafter{\csname#1\endcsname}}%
 \def\bbl at tempa#1{%
   \long\def\bbl at trim##1##2{%
     \futurelet\bbl at trim@a\bbl at trim@c##2\@nil\@nil#1\@nil\relax{##1}}%
@@ -980,7 +969,7 @@
     \else
       \expandafter\@secondoftwo
     \fi}
-  \bbl at ifunset{ifcsname}%
+  \bbl at ifunset{ifcsname}% TODO. A better test?
     {}%
     {\gdef\bbl at ifunset#1{%
        \ifcsname#1\endcsname
@@ -1180,12 +1169,12 @@
 \newcommand\EnableBabelHook[1]{\bbl at csarg\let{hk@#1}\@firstofone}
 \newcommand\DisableBabelHook[1]{\bbl at csarg\let{hk@#1}\@gobble}
 \def\bbl at usehooks#1#2{%
-  \ifx\UseHook\@undefined\else\UseHook{babel/#1}\fi
+  \ifx\UseHook\@undefined\else\UseHook{babel/*/#1}\fi
   \def\bbl at elth##1{%
     \bbl at cs{hk@##1}{\bbl at cs{ev@##1@#1@}#2}}%
   \bbl at cs{ev@#1@}%
   \ifx\languagename\@undefined\else % Test required for Plain (?)
-    \ifx\UseHook\@undefined\else\UseHook{babel/#1/\languagename}\fi
+    \ifx\UseHook\@undefined\else\UseHook{babel/\languagename/#1}\fi
     \def\bbl at elth##1{%
       \bbl at cs{hk@##1}{\bbl at cl{ev@##1@#1}#2}}%
     \bbl at cl{ev@#1}%
@@ -1470,7 +1459,7 @@
     \bbl at afterfi\csname#1 at sh@#2 at sel\endcsname
   \fi}
 \begingroup
-\bbl at ifunset{ifincsname}% TODO. Ugly. Correct?
+\bbl at ifunset{ifincsname}% TODO. Ugly. Correct? Only Plain?
   {\gdef\active at prefix#1{%
      \ifx\protect\@typeset at protect
      \else
@@ -2492,9 +2481,8 @@
   \ifx\bbl at KVP@captions\@nil\else
     \bbl at ifunset{bbl at extracaps@#2}%
       {\bbl at exp{\\\babelensure[exclude=\\\today]{#2}}}%
-      {\toks@\expandafter\expandafter\expandafter
-        {\csname bbl at extracaps@#2\endcsname}%
-       \bbl at exp{\\\babelensure[exclude=\\\today,include=\the\toks@}]{#2}}%
+      {\bbl at exp{\\\babelensure[exclude=\\\today,
+                include=\[bbl at extracaps@#2]}]{#2}}%
     \bbl at ifunset{bbl at ensure@\languagename}%
       {\bbl at exp{%
         \\\DeclareRobustCommand\<bbl at ensure@\languagename>[1]{%
@@ -3232,24 +3220,18 @@
 \else
   \def\bbl at patchchapter{%
     \global\let\bbl at patchchapter\relax
+    \gdef\bbl at chfmt{%
+      \bbl at ifunset{bbl@\bbl at chaptype fmt@\languagename}%
+        {\@chapapp\space\thechapter}
+        {\@nameuse{bbl@\bbl at chaptype fmt@\languagename}}}
     \bbl at add\appendix{\def\bbl at chaptype{appendix}}% Not harmful, I hope
+    \bbl at sreplace\ps at headings{\@chapapp\ \thechapter}{\bbl at chfmt}%
+    \bbl at sreplace\chaptermark{\@chapapp\ \thechapter}{\bbl at chfmt}%
+    \bbl at sreplace\@makechapterhead{\@chapapp\space\thechapter}{\bbl at chfmt}%
     \bbl at toglobal\appendix
-    \bbl at sreplace\ps at headings
-      {\@chapapp\ \thechapter}%
-      {\bbl at chapterformat}%
     \bbl at toglobal\ps at headings
-    \bbl at sreplace\chaptermark
-      {\@chapapp\ \thechapter}%
-      {\bbl at chapterformat}%
     \bbl at toglobal\chaptermark
-    \bbl at sreplace\@makechapterhead
-      {\@chapapp\space\thechapter}%
-      {\bbl at chapterformat}%
-    \bbl at toglobal\@makechapterhead
-    \gdef\bbl at chapterformat{%
-      \bbl at ifunset{bbl@\bbl at chaptype fmt@\languagename}%
-        {\@chapapp\space\thechapter}
-        {\@nameuse{bbl@\bbl at chaptype fmt@\languagename}}}}
+    \bbl at toglobal\@makechapterhead}
   \let\bbl at patchappendix\bbl at patchchapter
 \fi\fi\fi
 \ifx\@part\@undefined
@@ -3257,14 +3239,12 @@
 \else
   \def\bbl at patchpart{%
     \global\let\bbl at patchpart\relax
-    \bbl at sreplace\@part
-      {\partname\nobreakspace\thepart}%
-      {\bbl at partformat}%
-    \bbl at toglobal\@part
     \gdef\bbl at partformat{%
       \bbl at ifunset{bbl at partfmt@\languagename}%
         {\partname\nobreakspace\thepart}
-        {\@nameuse{bbl at partfmt@\languagename}}}}
+        {\@nameuse{bbl at partfmt@\languagename}}}
+    \bbl at sreplace\@part{\partname\nobreakspace\thepart}{\bbl at partformat}%
+    \bbl at toglobal\@part}
 \fi
 \let\bbl at calendar\@empty
 \DeclareRobustCommand\localedate[1][]{\bbl at localedate{#1}}
@@ -3364,7 +3344,7 @@
 \@namedef{bbl at inikv@transforms.posthyphenation}{%
   \bbl at transforms\babelposthyphenation}
 \def\bbl at transforms@aux#1#2#3,#4\relax{#1{#2}{#3}{#4}}
-\begingroup
+\begingroup %  A hack. TODO. Don't require an specific order
   \catcode`\%=12
   \catcode`\&=14
   \gdef\bbl at transforms#1#2#3{&%
@@ -3638,6 +3618,26 @@
   \directlua{ Babel.ignore_pre_char = function(node)
       return false
     end }}
+\@namedef{bbl at ADJ@select.write at shift}{%
+  \let\bbl at restorelastskip\relax
+  \def\bbl at savelastskip{%
+    \let\bbl at restorelastskip\relax
+    \ifvmode
+      \ifdim\lastskip=\z@
+        \let\bbl at restorelastskip\nobreak
+      \else
+        \bbl at exp{%
+          \def\\\bbl at restorelastskip{%
+            \skip@=\the\lastskip
+            \\\nobreak \vskip-\skip@ \vskip\skip@}}%
+      \fi
+    \fi}}
+\@namedef{bbl at ADJ@select.write at keep}{%
+  \let\bbl at restorelastskip\relax
+  \let\bbl at savelastskip\relax}
+\@namedef{bbl at ADJ@select.write at omit}{%
+  \let\bbl at restorelastskip\relax
+  \def\bbl at savelastskip##1\bbl at restorelastskip{}}
 \ifx\directlua\@undefined\else
   \ifx\bbl at luapatterns\@undefined
     \input luababel.def

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2021-10-13 20:33:19 UTC (rev 60757)
@@ -34,7 +34,7 @@
 %%
 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
-\ProvidesPackage{babel}[2021/07/22 3.63 The Babel package]
+\ProvidesPackage{babel}[2021/10/13 3.64 The Babel package]
 \@ifpackagewith{babel}{debug}
   {\providecommand\bbl at trace[1]{\message{^^J[ #1 ]}}%
    \let\bbl at debug\@firstofone
@@ -49,6 +49,28 @@
      \directlua{ Babel = Babel or {}
        Babel.debug = false }%
    \fi}
+\def\bbl at error#1#2{%
+  \begingroup
+    \def\\{\MessageBreak}%
+    \PackageError{babel}{#1}{#2}%
+  \endgroup}
+\def\bbl at warning#1{%
+  \begingroup
+    \def\\{\MessageBreak}%
+    \PackageWarning{babel}{#1}%
+  \endgroup}
+\def\bbl at infowarn#1{%
+  \begingroup
+    \def\\{\MessageBreak}%
+    \GenericWarning
+      {(babel) \@spaces\@spaces\@spaces}%
+      {Package babel Info: #1}%
+  \endgroup}
+\def\bbl at info#1{%
+  \begingroup
+    \def\\{\MessageBreak}%
+    \PackageInfo{babel}{#1}%
+  \endgroup}
 \bbl at trace{Basic macros}
 \def\bbl at stripslash{\expandafter\@gobble\string}
 \def\bbl at add#1#2{%
@@ -77,9 +99,13 @@
 \def\bbl at exp#1{%
   \begingroup
     \let\\\noexpand
-    \def\<##1>{\expandafter\noexpand\csname##1\endcsname}%
+    \let\<\bbl at exp@en
+    \let\[\bbl at exp@ue
     \edef\bbl at exp@aux{\endgroup#1}%
   \bbl at exp@aux}
+\def\bbl at exp@en#1>{\expandafter\noexpand\csname#1\endcsname}%
+\def\bbl at exp@ue#1]{%
+  \unexpanded\expandafter\expandafter\expandafter{\csname#1\endcsname}}%
 \def\bbl at tempa#1{%
   \long\def\bbl at trim##1##2{%
     \futurelet\bbl at trim@a\bbl at trim@c##2\@nil\@nil#1\@nil\relax{##1}}%
@@ -100,7 +126,7 @@
     \else
       \expandafter\@secondoftwo
     \fi}
-  \bbl at ifunset{ifcsname}%
+  \bbl at ifunset{ifcsname}% TODO. A better test?
     {}%
     {\gdef\bbl at ifunset#1{%
        \ifcsname#1\endcsname
@@ -233,62 +259,6 @@
     \toks@\expandafter{\bbl at tempc#3}%
     \expandafter\edef\csname extras\languagename\endcsname{\the\toks@}%
   \fi}
-  % Temporarily repeat here the code for errors. TODO.
-  \def\bbl at error#1#2{%
-    \begingroup
-      \def\\{\MessageBreak}%
-      \PackageError{babel}{#1}{#2}%
-    \endgroup}
-  \def\bbl at warning#1{%
-    \begingroup
-      \def\\{\MessageBreak}%
-      \PackageWarning{babel}{#1}%
-    \endgroup}
-  \def\bbl at infowarn#1{%
-    \begingroup
-      \def\\{\MessageBreak}%
-      \GenericWarning
-        {(babel) \@spaces\@spaces\@spaces}%
-        {Package babel Info: #1}%
-    \endgroup}
-  \def\bbl at info#1{%
-    \begingroup
-      \def\\{\MessageBreak}%
-      \PackageInfo{babel}{#1}%
-    \endgroup}
-\def\bbl at nocaption{\protect\bbl at nocaption@i}
-\def\bbl at nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
-  \global\@namedef{#2}{\textbf{?#1?}}%
-  \@nameuse{#2}%
-  \edef\bbl at tempa{#1}%
-  \bbl at sreplace\bbl at tempa{name}{}%
-  \bbl at warning{%
-    \@backslashchar#1 not set for '\languagename'. Please,\\%
-    define it after the language has been loaded\\%
-    (typically in the preamble) with\\%
-    \string\setlocalecaption{\languagename}{\bbl at tempa}{..}\\%
-    Reported}}
-\def\bbl at tentative{\protect\bbl at tentative@i}
-\def\bbl at tentative@i#1{%
-  \bbl at warning{%
-    Some functions for '#1' are tentative.\\%
-    They might not work as expected and their behavior\\%
-    may change in the future.\\%
-    Reported}}
-\def\@nolanerr#1{%
-  \bbl at error
-    {You haven't defined the language '#1' yet.\\%
-     Perhaps you misspelled it or your installation\\%
-     is not complete}%
-    {Your command will be ignored, type <return> to proceed}}
-\def\@nopatterns#1{%
-  \bbl at warning
-    {No hyphenation patterns were preloaded for\\%
-     the language '#1' into the format.\\%
-     Please, configure your TeX system to add them and\\%
-     rebuild the format. Now I will use the patterns\\%
-     preloaded for \bbl at nulllanguage\space instead}}
-    % End of errors
 \@ifpackagewith{babel}{silent}
   {\let\bbl at info\@gobble
    \let\bbl at infowarn\@gobble
@@ -375,9 +345,6 @@
 \DeclareOption{provide@=*}{\def\bbl at autoload@options{import}}
 \newif\ifbbl at single
 \DeclareOption{selectors=off}{\bbl at singletrue}
-\DeclareOption{safe=none}{\let\bbl at opt@safe\@empty}
-\DeclareOption{safe=bib}{\def\bbl at opt@safe{B}}
-\DeclareOption{safe=ref}{\def\bbl at opt@safe{R}}
 \DeclareOption{math=active}{}
 \DeclareOption{math=normal}{\def\bbl at mathnormal{\noexpand\textormath}}
 \DeclareOption{nocase}{}
@@ -390,6 +357,9 @@
 \DeclareOption{hyphenmap=select}{\chardef\bbl at opt@hyphenmap\tw@}
 \DeclareOption{hyphenmap=other}{\chardef\bbl at opt@hyphenmap\thr@@}
 \DeclareOption{hyphenmap=other*}{\chardef\bbl at opt@hyphenmap4\relax}
+\DeclareOption{safe=none}{\let\bbl at opt@safe\@empty}
+\DeclareOption{safe=bib}{\def\bbl at opt@safe{B}}
+\DeclareOption{safe=ref}{\def\bbl at opt@safe{R}}
 \chardef\bbl at bidimode\z@
 \DeclareOption{bidi=default}{\chardef\bbl at bidimode=\@ne}
 \DeclareOption{bidi=basic}{\chardef\bbl at bidimode=101 }
@@ -420,11 +390,23 @@
   \ifin@
     \expandafter\bbl at tempa\CurrentOption\bbl at tempa
   \else
-    \bbl at add@list\bbl at language@opts{\CurrentOption}%
+    \bbl at xin@{,\CurrentOption,}{,\bbl at language@opts,}%
+    \ifin@
+      \bbl at exp{\\\bbl at replace\\\bbl at language@opts{,\CurrentOption,}{}}%
+    \fi
+    \edef\bbl at language@opts{\bbl at language@opts,\CurrentOption,}
   \fi}
 \ProcessOptions*
-\ifx\bbl at opt@provide\@nnil\else % Tests. Ignore.
+\ifx\bbl at opt@provide\@nnil
+  \let\bbl at opt@provide\@empty  % %%% MOVE above
+\else
   \chardef\bbl at iniflag\@ne
+  \bbl at exp{\\\bbl at forkv{\@nameuse{@raw at opt@babel.sty}}}{%
+    \in@{,provide,}{,#1,}%
+    \ifin@
+      \def\bbl at opt@provide{#2}%
+      \bbl at replace\bbl at opt@provide{;}{,}%
+    \fi}
 \fi
 \bbl at trace{Conditional loading of shorthands}
 \def\bbl at sh@string#1{%
@@ -464,9 +446,7 @@
   \def\bbl at opt@safe{BR}
 \fi
 \ifx\bbl at opt@main\@nnil\else
-  \edef\bbl at language@opts{%
-    \ifx\bbl at language@opts\@empty\else\bbl at language@opts,\fi
-      \bbl at opt@main}
+  \edef\bbl at language@opts{\bbl at language@opts,\bbl at opt@main,}
 \fi
 \bbl at trace{Defining IfBabelLayout}
 \ifx\bbl at opt@layout\@nnil
@@ -480,7 +460,3243 @@
       \expandafter\@secondoftwo
     \fi}
 \fi
-\input babel.def
+\def\bbl at version{3.64}
+\def\bbl at date{2021/10/13}
+\ifx\language\@undefined
+  \csname newcount\endcsname\language
+\fi
+\countdef\last at language=19
+\def\addlanguage{\csname newlanguage\endcsname}
+\def\adddialect#1#2{%
+  \global\chardef#1#2\relax
+  \bbl at usehooks{adddialect}{{#1}{#2}}%
+  \begingroup
+    \count@#1\relax
+    \def\bbl at elt##1##2##3##4{%
+      \ifnum\count@=##2\relax
+        \edef\bbl at tempa{\expandafter\@gobbletwo\string#1}%
+        \bbl at info{Hyphen rules for '\expandafter\@gobble\bbl at tempa'
+                  set to \expandafter\string\csname l@##1\endcsname\\%
+                  (\string\language\the\count@). Reported}%
+        \def\bbl at elt####1####2####3####4{}%
+      \fi}%
+    \bbl at cs{languages}%
+  \endgroup}
+\def\bbl at fixname#1{%
+  \begingroup
+    \def\bbl at tempe{l@}%
+    \edef\bbl at tempd{\noexpand\@ifundefined{\noexpand\bbl at tempe#1}}%
+    \bbl at tempd
+      {\lowercase\expandafter{\bbl at tempd}%
+         {\uppercase\expandafter{\bbl at tempd}%
+           \@empty
+           {\edef\bbl at tempd{\def\noexpand#1{#1}}%
+            \uppercase\expandafter{\bbl at tempd}}}%
+         {\edef\bbl at tempd{\def\noexpand#1{#1}}%
+          \lowercase\expandafter{\bbl at tempd}}}%
+      \@empty
+    \edef\bbl at tempd{\endgroup\def\noexpand#1{#1}}%
+  \bbl at tempd
+  \bbl at exp{\\\bbl at usehooks{languagename}{{\languagename}{#1}}}}
+\def\bbl at iflanguage#1{%
+  \@ifundefined{l@#1}{\@nolanerr{#1}\@gobble}\@firstofone}
+\def\bbl at bcpcase#1#2#3#4\@@#5{%
+  \ifx\@empty#3%
+    \uppercase{\def#5{#1#2}}%
+  \else
+    \uppercase{\def#5{#1}}%
+    \lowercase{\edef#5{#5#2#3#4}}%
+  \fi}
+\def\bbl at bcplookup#1-#2-#3-#4\@@{%
+  \let\bbl at bcp\relax
+  \lowercase{\def\bbl at tempa{#1}}%
+  \ifx\@empty#2%
+    \IfFileExists{babel-\bbl at tempa.ini}{\let\bbl at bcp\bbl at tempa}{}%
+  \else\ifx\@empty#3%
+    \bbl at bcpcase#2\@empty\@empty\@@\bbl at tempb
+    \IfFileExists{babel-\bbl at tempa-\bbl at tempb.ini}%
+      {\edef\bbl at bcp{\bbl at tempa-\bbl at tempb}}%
+      {}%
+    \ifx\bbl at bcp\relax
+      \IfFileExists{babel-\bbl at tempa.ini}{\let\bbl at bcp\bbl at tempa}{}%
+    \fi
+  \else
+    \bbl at bcpcase#2\@empty\@empty\@@\bbl at tempb
+    \bbl at bcpcase#3\@empty\@empty\@@\bbl at tempc
+    \IfFileExists{babel-\bbl at tempa-\bbl at tempb-\bbl at tempc.ini}%
+      {\edef\bbl at bcp{\bbl at tempa-\bbl at tempb-\bbl at tempc}}%
+      {}%
+    \ifx\bbl at bcp\relax
+      \IfFileExists{babel-\bbl at tempa-\bbl at tempc.ini}%
+        {\edef\bbl at bcp{\bbl at tempa-\bbl at tempc}}%
+        {}%
+    \fi
+    \ifx\bbl at bcp\relax
+      \IfFileExists{babel-\bbl at tempa-\bbl at tempc.ini}%
+        {\edef\bbl at bcp{\bbl at tempa-\bbl at tempc}}%
+        {}%
+    \fi
+    \ifx\bbl at bcp\relax
+      \IfFileExists{babel-\bbl at tempa.ini}{\let\bbl at bcp\bbl at tempa}{}%
+    \fi
+  \fi\fi}
+\let\bbl at initoload\relax
+\def\bbl at provide@locale{%
+  \ifx\babelprovide\@undefined
+    \bbl at error{For a language to be defined on the fly 'base'\\%
+               is not enough, and the whole package must be\\%
+               loaded. Either delete the 'base' option or\\%
+               request the languages explicitly}%
+              {See the manual for further details.}%
+  \fi
+  \let\bbl at auxname\languagename % Still necessary. TODO
+  \bbl at ifunset{bbl at bcp@map@\languagename}{}% Move uplevel??
+    {\edef\languagename{\@nameuse{bbl at bcp@map@\languagename}}}%
+  \ifbbl at bcpallowed
+    \expandafter\ifx\csname date\languagename\endcsname\relax
+      \expandafter
+      \bbl at bcplookup\languagename-\@empty-\@empty-\@empty\@@
+      \ifx\bbl at bcp\relax\else  % Returned by \bbl at bcplookup
+        \edef\languagename{\bbl at bcp@prefix\bbl at bcp}%
+        \edef\localename{\bbl at bcp@prefix\bbl at bcp}%
+        \expandafter\ifx\csname date\languagename\endcsname\relax
+          \let\bbl at initoload\bbl at bcp
+          \bbl at exp{\\\babelprovide[\bbl at autoload@bcpoptions]{\languagename}}%
+          \let\bbl at initoload\relax
+        \fi
+        \bbl at csarg\xdef{bcp at map@\bbl at bcp}{\localename}%
+      \fi
+    \fi
+  \fi
+  \expandafter\ifx\csname date\languagename\endcsname\relax
+    \IfFileExists{babel-\languagename.tex}%
+      {\bbl at exp{\\\babelprovide[\bbl at autoload@options]{\languagename}}}%
+      {}%
+  \fi}
+\def\iflanguage#1{%
+  \bbl at iflanguage{#1}{%
+    \ifnum\csname l@#1\endcsname=\language
+      \expandafter\@firstoftwo
+    \else
+      \expandafter\@secondoftwo
+    \fi}}
+\let\bbl at select@type\z@
+\edef\selectlanguage{%
+  \noexpand\protect
+  \expandafter\noexpand\csname selectlanguage \endcsname}
+\ifx\@undefined\protect\let\protect\relax\fi
+\let\xstring\string
+\def\bbl at language@stack{}
+\def\bbl at push@language{%
+  \ifx\languagename\@undefined\else
+    \ifx\currentgrouplevel\@undefined
+      \xdef\bbl at language@stack{\languagename+\bbl at language@stack}%
+    \else
+      \ifnum\currentgrouplevel=\z@
+        \xdef\bbl at language@stack{\languagename+}%
+      \else
+        \xdef\bbl at language@stack{\languagename+\bbl at language@stack}%
+      \fi
+    \fi
+  \fi}
+\def\bbl at pop@lang#1+#2\@@{%
+  \edef\languagename{#1}%
+  \xdef\bbl at language@stack{#2}}
+\let\bbl at ifrestoring\@secondoftwo
+\def\bbl at pop@language{%
+  \expandafter\bbl at pop@lang\bbl at language@stack\@@
+  \let\bbl at ifrestoring\@firstoftwo
+  \expandafter\bbl at set@language\expandafter{\languagename}%
+  \let\bbl at ifrestoring\@secondoftwo}
+\chardef\localeid\z@
+\def\bbl at id@last{0}    % No real need for a new counter
+\def\bbl at id@assign{%
+  \bbl at ifunset{bbl at id@@\languagename}%
+    {\count@\bbl at id@last\relax
+     \advance\count@\@ne
+     \bbl at csarg\chardef{id@@\languagename}\count@
+     \edef\bbl at id@last{\the\count@}%
+     \ifcase\bbl at engine\or
+       \directlua{
+         Babel = Babel or {}
+         Babel.locale_props = Babel.locale_props or {}
+         Babel.locale_props[\bbl at id@last] = {}
+         Babel.locale_props[\bbl at id@last].name = '\languagename'
+        }%
+      \fi}%
+    {}%
+    \chardef\localeid\bbl at cl{id@}}
+\expandafter\def\csname selectlanguage \endcsname#1{%
+  \ifnum\bbl at hymapsel=\@cclv\let\bbl at hymapsel\tw@\fi
+  \bbl at push@language
+  \aftergroup\bbl at pop@language
+  \bbl at set@language{#1}}
+\def\BabelContentsFiles{toc,lof,lot}
+\def\bbl at set@language#1{% from selectlanguage, pop@
+  % The old buggy way. Preserved for compatibility.
+  \edef\languagename{%
+    \ifnum\escapechar=\expandafter`\string#1\@empty
+    \else\string#1\@empty\fi}%
+  \ifcat\relax\noexpand#1%
+    \expandafter\ifx\csname date\languagename\endcsname\relax
+      \edef\languagename{#1}%
+      \let\localename\languagename
+    \else
+      \bbl at info{Using '\string\language' instead of 'language' is\\%
+                deprecated. If what you want is to use a\\%
+                macro containing the actual locale, make\\%
+                sure it does not not match any language.\\%
+                Reported}%
+      \ifx\scantokens\@undefined
+         \def\localename{??}%
+      \else
+        \scantokens\expandafter{\expandafter
+          \def\expandafter\localename\expandafter{\languagename}}%
+      \fi
+    \fi
+  \else
+    \def\localename{#1}% This one has the correct catcodes
+  \fi
+  \select at language{\languagename}%
+  % write to auxs
+  \expandafter\ifx\csname date\languagename\endcsname\relax\else
+    \if at filesw
+      \ifx\babel at aux\@gobbletwo\else % Set if single in the first, redundant
+        \bbl at savelastskip
+        \protected at write\@auxout{}{\string\babel at aux{\bbl at auxname}{}}%
+        \bbl at restorelastskip
+      \fi
+      \bbl at usehooks{write}{}%
+    \fi
+  \fi}
+\let\bbl at restorelastskip\relax
+\let\bbl at savelastskip\relax
+\newif\ifbbl at bcpallowed
+\bbl at bcpallowedfalse
+\def\select at language#1{% from set@, babel at aux
+  % set hymap
+  \ifnum\bbl at hymapsel=\@cclv\chardef\bbl at hymapsel4\relax\fi
+  % set name
+  \edef\languagename{#1}%
+  \bbl at fixname\languagename
+  % TODO. name at map must be here?
+  \bbl at provide@locale
+  \bbl at iflanguage\languagename{%
+     \expandafter\ifx\csname date\languagename\endcsname\relax
+      \bbl at error
+        {Unknown language '\languagename'. Either you have\\%
+         misspelled its name, it has not been installed,\\%
+         or you requested it in a previous run. Fix its name,\\%
+         install it or just rerun the file, respectively. In\\%
+         some cases, you may need to remove the aux file}%
+        {You may proceed, but expect wrong results}%
+    \else
+      % set type
+      \let\bbl at select@type\z@
+      \expandafter\bbl at switch\expandafter{\languagename}%
+    \fi}}
+\def\babel at aux#1#2{%
+  \select at language{#1}%
+  \bbl at foreach\BabelContentsFiles{% \relax -> don't assume vertical mode
+    \@writefile{##1}{\babel at toc{#1}{#2}\relax}}}% TODO - plain?
+\def\babel at toc#1#2{%
+  \select at language{#1}}
+\newif\ifbbl at usedategroup
+\def\bbl at switch#1{%  from select@, foreign@
+  % make sure there is info for the language if so requested
+  \bbl at ensureinfo{#1}%
+  % restore
+  \originalTeX
+  \expandafter\def\expandafter\originalTeX\expandafter{%
+    \csname noextras#1\endcsname
+    \let\originalTeX\@empty
+    \babel at beginsave}%
+  \bbl at usehooks{afterreset}{}%
+  \languageshorthands{none}%
+  % set the locale id
+  \bbl at id@assign
+  % switch captions, date
+  % No text is supposed to be added here, so we remove any
+  % spurious spaces.
+  \bbl at bsphack
+    \ifcase\bbl at select@type
+      \csname captions#1\endcsname\relax
+      \csname date#1\endcsname\relax
+    \else
+      \bbl at xin@{,captions,}{,\bbl at select@opts,}%
+      \ifin@
+        \csname captions#1\endcsname\relax
+      \fi
+      \bbl at xin@{,date,}{,\bbl at select@opts,}%
+      \ifin@  % if \foreign... within \<lang>date
+        \csname date#1\endcsname\relax
+      \fi
+    \fi
+  \bbl at esphack
+  % switch extras
+  \bbl at usehooks{beforeextras}{}%
+  \csname extras#1\endcsname\relax
+  \bbl at usehooks{afterextras}{}%
+  %  > babel-ensure
+  %  > babel-sh-<short>
+  %  > babel-bidi
+  %  > babel-fontspec
+  % hyphenation - case mapping
+  \ifcase\bbl at opt@hyphenmap\or
+    \def\BabelLower##1##2{\lccode##1=##2\relax}%
+    \ifnum\bbl at hymapsel>4\else
+      \csname\languagename @bbl at hyphenmap\endcsname
+    \fi
+    \chardef\bbl at opt@hyphenmap\z@
+  \else
+    \ifnum\bbl at hymapsel>\bbl at opt@hyphenmap\else
+      \csname\languagename @bbl at hyphenmap\endcsname
+    \fi
+  \fi
+  \let\bbl at hymapsel\@cclv
+  % hyphenation - select rules
+  \ifnum\csname l@\languagename\endcsname=\l at unhyphenated
+    \edef\bbl at tempa{u}%
+  \else
+    \edef\bbl at tempa{\bbl at cl{lnbrk}}%
+  \fi
+  % linebreaking - handle u, e, k (v in the future)
+  \bbl at xin@{/u}{/\bbl at tempa}%
+  \ifin@\else\bbl at xin@{/e}{/\bbl at tempa}\fi % elongated forms
+  \ifin@\else\bbl at xin@{/k}{/\bbl at tempa}\fi % only kashida
+  \ifin@\else\bbl at xin@{/v}{/\bbl at tempa}\fi % variable font
+  \ifin@
+    % unhyphenated/kashida/elongated = allow stretching
+    \language\l at unhyphenated
+    \babel at savevariable\emergencystretch
+    \emergencystretch\maxdimen
+    \babel at savevariable\hbadness
+    \hbadness\@M
+  \else
+    % other = select patterns
+    \bbl at patterns{#1}%
+  \fi
+  % hyphenation - mins
+  \babel at savevariable\lefthyphenmin
+  \babel at savevariable\righthyphenmin
+  \expandafter\ifx\csname #1hyphenmins\endcsname\relax
+    \set at hyphenmins\tw@\thr@@\relax
+  \else
+    \expandafter\expandafter\expandafter\set at hyphenmins
+      \csname #1hyphenmins\endcsname\relax
+  \fi}
+\long\def\otherlanguage#1{%
+  \ifnum\bbl at hymapsel=\@cclv\let\bbl at hymapsel\thr@@\fi
+  \csname selectlanguage \endcsname{#1}%
+  \ignorespaces}
+\long\def\endotherlanguage{%
+  \global\@ignoretrue\ignorespaces}
+\expandafter\def\csname otherlanguage*\endcsname{%
+  \@ifnextchar[\bbl at otherlanguage@s{\bbl at otherlanguage@s[]}}
+\def\bbl at otherlanguage@s[#1]#2{%
+  \ifnum\bbl at hymapsel=\@cclv\chardef\bbl at hymapsel4\relax\fi
+  \def\bbl at select@opts{#1}%
+  \foreign at language{#2}}
+\expandafter\let\csname endotherlanguage*\endcsname\relax
+\providecommand\bbl at beforeforeign{}
+\edef\foreignlanguage{%
+  \noexpand\protect
+  \expandafter\noexpand\csname foreignlanguage \endcsname}
+\expandafter\def\csname foreignlanguage \endcsname{%
+  \@ifstar\bbl at foreign@s\bbl at foreign@x}
+\providecommand\bbl at foreign@x[3][]{%
+  \begingroup
+    \def\bbl at select@opts{#1}%
+    \let\BabelText\@firstofone
+    \bbl at beforeforeign
+    \foreign at language{#2}%
+    \bbl at usehooks{foreign}{}%
+    \BabelText{#3}% Now in horizontal mode!
+  \endgroup}
+\def\bbl at foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par
+  \begingroup
+    {\par}%
+    \let\bbl at select@opts\@empty
+    \let\BabelText\@firstofone
+    \foreign at language{#1}%
+    \bbl at usehooks{foreign*}{}%
+    \bbl at dirparastext
+    \BabelText{#2}% Still in vertical mode!
+    {\par}%
+  \endgroup}
+\def\foreign at language#1{%
+  % set name
+  \edef\languagename{#1}%
+  \ifbbl at usedategroup
+    \bbl at add\bbl at select@opts{,date,}%
+    \bbl at usedategroupfalse
+  \fi
+  \bbl at fixname\languagename
+  % TODO. name at map here?
+  \bbl at provide@locale
+  \bbl at iflanguage\languagename{%
+    \expandafter\ifx\csname date\languagename\endcsname\relax
+      \bbl at warning   % TODO - why a warning, not an error?
+        {Unknown language '#1'. Either you have\\%
+         misspelled its name, it has not been installed,\\%
+         or you requested it in a previous run. Fix its name,\\%
+         install it or just rerun the file, respectively. In\\%
+         some cases, you may need to remove the aux file.\\%
+         I'll proceed, but expect wrong results.\\%
+         Reported}%
+    \fi
+    % set type
+    \let\bbl at select@type\@ne
+    \expandafter\bbl at switch\expandafter{\languagename}}}
+\let\bbl at hyphlist\@empty
+\let\bbl at hyphenation@\relax
+\let\bbl at pttnlist\@empty
+\let\bbl at patterns@\relax
+\let\bbl at hymapsel=\@cclv
+\def\bbl at patterns#1{%
+  \language=\expandafter\ifx\csname l@#1:\f at encoding\endcsname\relax
+      \csname l@#1\endcsname
+      \edef\bbl at tempa{#1}%
+    \else
+      \csname l@#1:\f at encoding\endcsname
+      \edef\bbl at tempa{#1:\f at encoding}%
+    \fi
+  \@expandtwoargs\bbl at usehooks{patterns}{{#1}{\bbl at tempa}}%
+  %  > luatex
+  \@ifundefined{bbl at hyphenation@}{}{% Can be \relax!
+    \begingroup
+      \bbl at xin@{,\number\language,}{,\bbl at hyphlist}%
+      \ifin@\else
+        \@expandtwoargs\bbl at usehooks{hyphenation}{{#1}{\bbl at tempa}}%
+        \hyphenation{%
+          \bbl at hyphenation@
+          \@ifundefined{bbl at hyphenation@#1}%
+            \@empty
+            {\space\csname bbl at hyphenation@#1\endcsname}}%
+        \xdef\bbl at hyphlist{\bbl at hyphlist\number\language,}%
+      \fi
+    \endgroup}}
+\def\hyphenrules#1{%
+  \edef\bbl at tempf{#1}%
+  \bbl at fixname\bbl at tempf
+  \bbl at iflanguage\bbl at tempf{%
+    \expandafter\bbl at patterns\expandafter{\bbl at tempf}%
+    \ifx\languageshorthands\@undefined\else
+      \languageshorthands{none}%
+    \fi
+    \expandafter\ifx\csname\bbl at tempf hyphenmins\endcsname\relax
+      \set at hyphenmins\tw@\thr@@\relax
+    \else
+      \expandafter\expandafter\expandafter\set at hyphenmins
+      \csname\bbl at tempf hyphenmins\endcsname\relax
+    \fi}}
+\let\endhyphenrules\@empty
+\def\providehyphenmins#1#2{%
+  \expandafter\ifx\csname #1hyphenmins\endcsname\relax
+    \@namedef{#1hyphenmins}{#2}%
+  \fi}
+\def\set at hyphenmins#1#2{%
+  \lefthyphenmin#1\relax
+  \righthyphenmin#2\relax}
+\ifx\ProvidesFile\@undefined
+  \def\ProvidesLanguage#1[#2 #3 #4]{%
+    \wlog{Language: #1 #4 #3 <#2>}%
+    }
+\else
+  \def\ProvidesLanguage#1{%
+    \begingroup
+      \catcode`\ 10 %
+      \@makeother\/%
+      \@ifnextchar[%]
+        {\@provideslanguage{#1}}{\@provideslanguage{#1}[]}}
+  \def\@provideslanguage#1[#2]{%
+    \wlog{Language: #1 #2}%
+    \expandafter\xdef\csname ver@#1.ldf\endcsname{#2}%
+    \endgroup}
+\fi
+\ifx\originalTeX\@undefined\let\originalTeX\@empty\fi
+\ifx\babel at beginsave\@undefined\let\babel at beginsave\relax\fi
+\providecommand\setlocale{%
+  \bbl at error
+    {Not yet available}%
+    {Find an armchair, sit down and wait}}
+\let\uselocale\setlocale
+\let\locale\setlocale
+\let\selectlocale\setlocale
+\let\localename\setlocale
+\let\textlocale\setlocale
+\let\textlanguage\setlocale
+\let\languagetext\setlocale
+\edef\bbl at nulllanguage{\string\language=0}
+\def\bbl at nocaption{\protect\bbl at nocaption@i}
+\def\bbl at nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
+  \global\@namedef{#2}{\textbf{?#1?}}%
+  \@nameuse{#2}%
+  \edef\bbl at tempa{#1}%
+  \bbl at sreplace\bbl at tempa{name}{}%
+  \bbl at warning{% TODO.
+    \@backslashchar#1 not set for '\languagename'. Please,\\%
+    define it after the language has been loaded\\%
+    (typically in the preamble) with:\\%
+    \string\setlocalecaption{\languagename}{\bbl at tempa}{..}\\%
+    Reported}}
+\def\bbl at tentative{\protect\bbl at tentative@i}
+\def\bbl at tentative@i#1{%
+  \bbl at warning{%
+    Some functions for '#1' are tentative.\\%
+    They might not work as expected and their behavior\\%
+    could change in the future.\\%
+    Reported}}
+\def\@nolanerr#1{%
+  \bbl at error
+    {You haven't defined the language '#1' yet.\\%
+     Perhaps you misspelled it or your installation\\%
+     is not complete}%
+    {Your command will be ignored, type <return> to proceed}}
+\def\@nopatterns#1{%
+  \bbl at warning
+    {No hyphenation patterns were preloaded for\\%
+     the language '#1' into the format.\\%
+     Please, configure your TeX system to add them and\\%
+     rebuild the format. Now I will use the patterns\\%
+     preloaded for \bbl at nulllanguage\space instead}}
+\let\bbl at usehooks\@gobbletwo
+\ifx\bbl at onlyswitch\@empty\endinput\fi
+  % Here ended switch.def
+\ifx\directlua\@undefined\else
+  \ifx\bbl at luapatterns\@undefined
+    \input luababel.def
+  \fi
+\fi
+\bbl at trace{Basic macros}
+\def\bbl at stripslash{\expandafter\@gobble\string}
+\def\bbl at add#1#2{%
+  \bbl at ifunset{\bbl at stripslash#1}%
+    {\def#1{#2}}%
+    {\expandafter\def\expandafter#1\expandafter{#1#2}}}
+\def\bbl at xin@{\@expandtwoargs\in@}
+\def\bbl at csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}%
+\def\bbl at cs#1{\csname bbl@#1\endcsname}
+\def\bbl at cl#1{\csname bbl@#1@\languagename\endcsname}
+\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\bbl at add@list#1#2{%
+  \edef#1{%
+    \bbl at ifunset{\bbl at stripslash#1}%
+      {}%
+      {\ifx#1\@empty\else#1,\fi}%
+    #2}}
+\long\def\bbl at afterelse#1\else#2\fi{\fi#1}
+\long\def\bbl at afterfi#1\fi{\fi#1}
+\def\bbl at exp#1{%
+  \begingroup
+    \let\\\noexpand
+    \let\<\bbl at exp@en
+    \let\[\bbl at exp@ue
+    \edef\bbl at exp@aux{\endgroup#1}%
+  \bbl at exp@aux}
+\def\bbl at exp@en#1>{\expandafter\noexpand\csname#1\endcsname}%
+\def\bbl at exp@ue#1]{%
+  \unexpanded\expandafter\expandafter\expandafter{\csname#1\endcsname}}%
+\def\bbl at tempa#1{%
+  \long\def\bbl at trim##1##2{%
+    \futurelet\bbl at trim@a\bbl at trim@c##2\@nil\@nil#1\@nil\relax{##1}}%
+  \def\bbl at trim@c{%
+    \ifx\bbl at trim@a\@sptoken
+      \expandafter\bbl at trim@b
+    \else
+      \expandafter\bbl at trim@b\expandafter#1%
+    \fi}%
+  \long\def\bbl at trim@b#1##1 \@nil{\bbl at trim@i##1}}
+\bbl at tempa{ }
+\long\def\bbl at trim@i#1\@nil#2\relax#3{#3{#1}}
+\long\def\bbl at trim@def#1{\bbl at trim{\def#1}}
+\begingroup
+  \gdef\bbl at ifunset#1{%
+    \expandafter\ifx\csname#1\endcsname\relax
+      \expandafter\@firstoftwo
+    \else
+      \expandafter\@secondoftwo
+    \fi}
+  \bbl at ifunset{ifcsname}% TODO. A better test?
+    {}%
+    {\gdef\bbl at ifunset#1{%
+       \ifcsname#1\endcsname
+         \expandafter\ifx\csname#1\endcsname\relax
+           \bbl at afterelse\expandafter\@firstoftwo
+         \else
+           \bbl at afterfi\expandafter\@secondoftwo
+         \fi
+       \else
+         \expandafter\@firstoftwo
+       \fi}}
+\endgroup
+\def\bbl at ifblank#1{%
+  \bbl at ifblank@i#1\@nil\@nil\@secondoftwo\@firstoftwo\@nil}
+\long\def\bbl at ifblank@i#1#2\@nil#3#4#5\@nil{#4}
+\def\bbl at ifset#1#2#3{%
+  \bbl at ifunset{#1}{#3}{\bbl at exp{\\\bbl at ifblank{#1}}{#3}{#2}}}
+\def\bbl at forkv#1#2{%
+  \def\bbl at kvcmd##1##2##3{#2}%
+  \bbl at kvnext#1,\@nil,}
+\def\bbl at kvnext#1,{%
+  \ifx\@nil#1\relax\else
+    \bbl at ifblank{#1}{}{\bbl at forkv@eq#1=\@empty=\@nil{#1}}%
+    \expandafter\bbl at kvnext
+  \fi}
+\def\bbl at forkv@eq#1=#2=#3\@nil#4{%
+  \bbl at trim@def\bbl at forkv@a{#1}%
+  \bbl at trim{\expandafter\bbl at kvcmd\expandafter{\bbl at forkv@a}}{#2}{#4}}
+\def\bbl at vforeach#1#2{%
+  \def\bbl at forcmd##1{#2}%
+  \bbl at fornext#1,\@nil,}
+\def\bbl at fornext#1,{%
+  \ifx\@nil#1\relax\else
+    \bbl at ifblank{#1}{}{\bbl at trim\bbl at forcmd{#1}}%
+    \expandafter\bbl at fornext
+  \fi}
+\def\bbl at foreach#1{\expandafter\bbl at vforeach\expandafter{#1}}
+\def\bbl at replace#1#2#3{% in #1 -> repl #2 by #3
+  \toks@{}%
+  \def\bbl at replace@aux##1#2##2#2{%
+    \ifx\bbl at nil##2%
+      \toks@\expandafter{\the\toks@##1}%
+    \else
+      \toks@\expandafter{\the\toks@##1#3}%
+      \bbl at afterfi
+      \bbl at replace@aux##2#2%
+    \fi}%
+  \expandafter\bbl at replace@aux#1#2\bbl at nil#2%
+  \edef#1{\the\toks@}}
+\ifx\detokenize\@undefined\else % Unused macros if old Plain TeX
+  \bbl at exp{\def\\\bbl at parsedef##1\detokenize{macro:}}#2->#3\relax{%
+    \def\bbl at tempa{#1}%
+    \def\bbl at tempb{#2}%
+    \def\bbl at tempe{#3}}
+  \def\bbl at sreplace#1#2#3{%
+    \begingroup
+      \expandafter\bbl at parsedef\meaning#1\relax
+      \def\bbl at tempc{#2}%
+      \edef\bbl at tempc{\expandafter\strip at prefix\meaning\bbl at tempc}%
+      \def\bbl at tempd{#3}%
+      \edef\bbl at tempd{\expandafter\strip at prefix\meaning\bbl at tempd}%
+      \bbl at xin@{\bbl at tempc}{\bbl at tempe}% If not in macro, do nothing
+      \ifin@
+        \bbl at exp{\\\bbl at replace\\\bbl at tempe{\bbl at tempc}{\bbl at tempd}}%
+        \def\bbl at tempc{%     Expanded an executed below as 'uplevel'
+           \\\makeatletter % "internal" macros with @ are assumed
+           \\\scantokens{%
+             \bbl at tempa\\\@namedef{\bbl at stripslash#1}\bbl at tempb{\bbl at tempe}}%
+           \catcode64=\the\catcode64\relax}%  Restore @
+      \else
+        \let\bbl at tempc\@empty  % Not \relax
+      \fi
+      \bbl at exp{%      For the 'uplevel' assignments
+    \endgroup
+      \bbl at tempc}}  % empty or expand to set #1 with changes
+\fi
+\def\bbl at ifsamestring#1#2{%
+  \begingroup
+    \protected at edef\bbl at tempb{#1}%
+    \edef\bbl at tempb{\expandafter\strip at prefix\meaning\bbl at tempb}%
+    \protected at edef\bbl at tempc{#2}%
+    \edef\bbl at tempc{\expandafter\strip at prefix\meaning\bbl at tempc}%
+    \ifx\bbl at tempb\bbl at tempc
+      \aftergroup\@firstoftwo
+    \else
+      \aftergroup\@secondoftwo
+    \fi
+  \endgroup}
+\chardef\bbl at engine=%
+  \ifx\directlua\@undefined
+    \ifx\XeTeXinputencoding\@undefined
+      \z@
+    \else
+      \tw@
+    \fi
+  \else
+    \@ne
+  \fi
+\def\bbl at bsphack{%
+  \ifhmode
+    \hskip\z at skip
+    \def\bbl at esphack{\loop\ifdim\lastskip>\z@\unskip\repeat\unskip}%
+  \else
+    \let\bbl at esphack\@empty
+  \fi}
+\def\bbl at cased{%
+  \ifx\oe\OE
+    \expandafter\in@\expandafter
+      {\expandafter\OE\expandafter}\expandafter{\oe}%
+    \ifin@
+      \bbl at afterelse\expandafter\MakeUppercase
+    \else
+      \bbl at afterfi\expandafter\MakeLowercase
+    \fi
+  \else
+    \expandafter\@firstofone
+  \fi}
+\ifx\IfFormatAtLeastTF\@undefined
+  \def\bbl at ifformatlater{\@ifl at t@r\fmtversion}
+\else
+  \let\bbl at ifformatlater\IfFormatAtLeastTF
+\fi
+\def\bbl at extras@wrap#1#2#3{% 1:in-test, 2:before, 3:after
+  \toks@\expandafter\expandafter\expandafter{%
+    \csname extras\languagename\endcsname}%
+  \bbl at exp{\\\in@{#1}{\the\toks@}}%
+  \ifin@\else
+    \@temptokena{#2}%
+    \edef\bbl at tempc{\the\@temptokena\the\toks@}%
+    \toks@\expandafter{\bbl at tempc#3}%
+    \expandafter\edef\csname extras\languagename\endcsname{\the\toks@}%
+  \fi}
+\bbl at trace{Compatibility with language.def}
+\ifx\bbl at languages\@undefined
+  \ifx\directlua\@undefined
+    \openin1 = language.def % TODO. Remove hardcoded number
+    \ifeof1
+      \closein1
+      \message{I couldn't find the file language.def}
+    \else
+      \closein1
+      \begingroup
+        \def\addlanguage#1#2#3#4#5{%
+          \expandafter\ifx\csname lang@#1\endcsname\relax\else
+            \global\expandafter\let\csname l@#1\expandafter\endcsname
+              \csname lang@#1\endcsname
+          \fi}%
+        \def\uselanguage#1{}%
+        \input language.def
+      \endgroup
+    \fi
+  \fi
+  \chardef\l at english\z@
+\fi
+\def\addto#1#2{%
+  \ifx#1\@undefined
+    \def#1{#2}%
+  \else
+    \ifx#1\relax
+      \def#1{#2}%
+    \else
+      {\toks@\expandafter{#1#2}%
+       \xdef#1{\the\toks@}}%
+    \fi
+  \fi}
+\def\bbl at withactive#1#2{%
+  \begingroup
+    \lccode`~=`#2\relax
+    \lowercase{\endgroup#1~}}
+\def\bbl at redefine#1{%
+  \edef\bbl at tempa{\bbl at stripslash#1}%
+  \expandafter\let\csname org@\bbl at tempa\endcsname#1%
+  \expandafter\def\csname\bbl at tempa\endcsname}
+\@onlypreamble\bbl at redefine
+\def\bbl at redefine@long#1{%
+  \edef\bbl at tempa{\bbl at stripslash#1}%
+  \expandafter\let\csname org@\bbl at tempa\endcsname#1%
+  \expandafter\long\expandafter\def\csname\bbl at tempa\endcsname}
+\@onlypreamble\bbl at redefine@long
+\def\bbl at redefinerobust#1{%
+  \edef\bbl at tempa{\bbl at stripslash#1}%
+  \bbl at ifunset{\bbl at tempa\space}%
+    {\expandafter\let\csname org@\bbl at tempa\endcsname#1%
+     \bbl at exp{\def\\#1{\\\protect\<\bbl at tempa\space>}}}%
+    {\bbl at exp{\let\<org@\bbl at tempa>\<\bbl at tempa\space>}}%
+    \@namedef{\bbl at tempa\space}}
+\@onlypreamble\bbl at redefinerobust
+\bbl at trace{Hooks}
+\newcommand\AddBabelHook[3][]{%
+  \bbl at ifunset{bbl at hk@#2}{\EnableBabelHook{#2}}{}%
+  \def\bbl at tempa##1,#3=##2,##3\@empty{\def\bbl at tempb{##2}}%
+  \expandafter\bbl at tempa\bbl at evargs,#3=,\@empty
+  \bbl at ifunset{bbl at ev@#2@#3@#1}%
+    {\bbl at csarg\bbl at add{ev@#3@#1}{\bbl at elth{#2}}}%
+    {\bbl at csarg\let{ev@#2@#3@#1}\relax}%
+  \bbl at csarg\newcommand{ev@#2@#3@#1}[\bbl at tempb]}
+\newcommand\EnableBabelHook[1]{\bbl at csarg\let{hk@#1}\@firstofone}
+\newcommand\DisableBabelHook[1]{\bbl at csarg\let{hk@#1}\@gobble}
+\def\bbl at usehooks#1#2{%
+  \ifx\UseHook\@undefined\else\UseHook{babel/*/#1}\fi
+  \def\bbl at elth##1{%
+    \bbl at cs{hk@##1}{\bbl at cs{ev@##1@#1@}#2}}%
+  \bbl at cs{ev@#1@}%
+  \ifx\languagename\@undefined\else % Test required for Plain (?)
+    \ifx\UseHook\@undefined\else\UseHook{babel/\languagename/#1}\fi
+    \def\bbl at elth##1{%
+      \bbl at cs{hk@##1}{\bbl at cl{ev@##1@#1}#2}}%
+    \bbl at cl{ev@#1}%
+  \fi}
+\def\bbl at evargs{,% <- don't delete this comma
+  everylanguage=1,loadkernel=1,loadpatterns=1,loadexceptions=1,%
+  adddialect=2,patterns=2,defaultcommands=0,encodedcommands=2,write=0,%
+  beforeextras=0,afterextras=0,stopcommands=0,stringprocess=0,%
+  hyphenation=2,initiateactive=3,afterreset=0,foreign=0,foreign*=0,%
+  beforestart=0,languagename=2}
+\ifx\NewHook\@undefined\else
+  \def\bbl at tempa#1=#2\@@{\NewHook{babel/#1}}
+  \bbl at foreach\bbl at evargs{\bbl at tempa#1\@@}
+\fi
+\bbl at trace{Defining babelensure}
+\newcommand\babelensure[2][]{%  TODO - revise test files
+  \AddBabelHook{babel-ensure}{afterextras}{%
+    \ifcase\bbl at select@type
+      \bbl at cl{e}%
+    \fi}%
+  \begingroup
+    \let\bbl at ens@include\@empty
+    \let\bbl at ens@exclude\@empty
+    \def\bbl at ens@fontenc{\relax}%
+    \def\bbl at tempb##1{%
+      \ifx\@empty##1\else\noexpand##1\expandafter\bbl at tempb\fi}%
+    \edef\bbl at tempa{\bbl at tempb#1\@empty}%
+    \def\bbl at tempb##1=##2\@@{\@namedef{bbl at ens@##1}{##2}}%
+    \bbl at foreach\bbl at tempa{\bbl at tempb##1\@@}%
+    \def\bbl at tempc{\bbl at ensure}%
+    \expandafter\bbl at add\expandafter\bbl at tempc\expandafter{%
+      \expandafter{\bbl at ens@include}}%
+    \expandafter\bbl at add\expandafter\bbl at tempc\expandafter{%
+      \expandafter{\bbl at ens@exclude}}%
+    \toks@\expandafter{\bbl at tempc}%
+    \bbl at exp{%
+  \endgroup
+  \def\<bbl at e@#2>{\the\toks@{\bbl at ens@fontenc}}}}
+\def\bbl at ensure#1#2#3{% 1: include 2: exclude 3: fontenc
+  \def\bbl at tempb##1{% elt for (excluding) \bbl at captionslist list
+    \ifx##1\@undefined % 3.32 - Don't assume the macro exists
+      \edef##1{\noexpand\bbl at nocaption
+        {\bbl at stripslash##1}{\languagename\bbl at stripslash##1}}%
+    \fi
+    \ifx##1\@empty\else
+      \in@{##1}{#2}%
+      \ifin@\else
+        \bbl at ifunset{bbl at ensure@\languagename}%
+          {\bbl at exp{%
+            \\\DeclareRobustCommand\<bbl at ensure@\languagename>[1]{%
+              \\\foreignlanguage{\languagename}%
+              {\ifx\relax#3\else
+                \\\fontencoding{#3}\\\selectfont
+               \fi
+               ########1}}}}%
+          {}%
+        \toks@\expandafter{##1}%
+        \edef##1{%
+           \bbl at csarg\noexpand{ensure@\languagename}%
+           {\the\toks@}}%
+      \fi
+      \expandafter\bbl at tempb
+    \fi}%
+  \expandafter\bbl at tempb\bbl at captionslist\today\@empty
+  \def\bbl at tempa##1{% elt for include list
+    \ifx##1\@empty\else
+      \bbl at csarg\in@{ensure@\languagename\expandafter}\expandafter{##1}%
+      \ifin@\else
+        \bbl at tempb##1\@empty
+      \fi
+      \expandafter\bbl at tempa
+    \fi}%
+  \bbl at tempa#1\@empty}
+\def\bbl at captionslist{%
+  \prefacename\refname\abstractname\bibname\chaptername\appendixname
+  \contentsname\listfigurename\listtablename\indexname\figurename
+  \tablename\partname\enclname\ccname\headtoname\pagename\seename
+  \alsoname\proofname\glossaryname}
+\bbl at trace{Macros for setting language files up}
+\def\bbl at ldfinit{%
+  \let\bbl at screset\@empty
+  \let\BabelStrings\bbl at opt@string
+  \let\BabelOptions\@empty
+  \let\BabelLanguages\relax
+  \ifx\originalTeX\@undefined
+    \let\originalTeX\@empty
+  \else
+    \originalTeX
+  \fi}
+\def\LdfInit#1#2{%
+  \chardef\atcatcode=\catcode`\@
+  \catcode`\@=11\relax
+  \chardef\eqcatcode=\catcode`\=
+  \catcode`\==12\relax
+  \expandafter\if\expandafter\@backslashchar
+                 \expandafter\@car\string#2\@nil
+    \ifx#2\@undefined\else
+      \ldf at quit{#1}%
+    \fi
+  \else
+    \expandafter\ifx\csname#2\endcsname\relax\else
+      \ldf at quit{#1}%
+    \fi
+  \fi
+  \bbl at ldfinit}
+\def\ldf at quit#1{%
+  \expandafter\main at language\expandafter{#1}%
+  \catcode`\@=\atcatcode \let\atcatcode\relax
+  \catcode`\==\eqcatcode \let\eqcatcode\relax
+  \endinput}
+\def\bbl at afterldf#1{% TODO. Merge into the next macro? Unused elsewhere
+  \bbl at afterlang
+  \let\bbl at afterlang\relax
+  \let\BabelModifiers\relax
+  \let\bbl at screset\relax}%
+\def\ldf at finish#1{%
+  \loadlocalcfg{#1}%
+  \bbl at afterldf{#1}%
+  \expandafter\main at language\expandafter{#1}%
+  \catcode`\@=\atcatcode \let\atcatcode\relax
+  \catcode`\==\eqcatcode \let\eqcatcode\relax}
+\@onlypreamble\LdfInit
+\@onlypreamble\ldf at quit
+\@onlypreamble\ldf at finish
+\def\main at language#1{%
+  \def\bbl at main@language{#1}%
+  \let\languagename\bbl at main@language % TODO. Set localename
+  \bbl at id@assign
+  \bbl at patterns{\languagename}}
+\def\bbl at beforestart{%
+  \def\@nolanerr##1{%
+    \bbl at warning{Undefined language '##1' in aux.\\Reported}}%
+  \bbl at usehooks{beforestart}{}%
+  \global\let\bbl at beforestart\relax}
+\AtBeginDocument{%
+  {\@nameuse{bbl at beforestart}}%  Group!
+  \if at filesw
+    \providecommand\babel at aux[2]{}%
+    \immediate\write\@mainaux{%
+      \string\providecommand\string\babel at aux[2]{}}%
+    \immediate\write\@mainaux{\string\@nameuse{bbl at beforestart}}%
+  \fi
+  \expandafter\selectlanguage\expandafter{\bbl at main@language}%
+  \ifbbl at single  % must go after the line above.
+    \renewcommand\selectlanguage[1]{}%
+    \renewcommand\foreignlanguage[2]{#2}%
+    \global\let\babel at aux\@gobbletwo  % Also as flag
+  \fi
+  \ifcase\bbl at engine\or\pagedir\bodydir\fi} % TODO - a better place
+\def\select at language@x#1{%
+  \ifcase\bbl at select@type
+    \bbl at ifsamestring\languagename{#1}{}{\select at language{#1}}%
+  \else
+    \select at language{#1}%
+  \fi}
+\bbl at trace{Shorhands}
+\def\bbl at add@special#1{% 1:a macro like \", \?, etc.
+  \bbl at add\dospecials{\do#1}% test @sanitize = \relax, for back. compat.
+  \bbl at ifunset{@sanitize}{}{\bbl at add\@sanitize{\@makeother#1}}%
+  \ifx\nfss at catcodes\@undefined\else % TODO - same for above
+    \begingroup
+      \catcode`#1\active
+      \nfss at catcodes
+      \ifnum\catcode`#1=\active
+        \endgroup
+        \bbl at add\nfss at catcodes{\@makeother#1}%
+      \else
+        \endgroup
+      \fi
+  \fi}
+\def\bbl at remove@special#1{%
+  \begingroup
+    \def\x##1##2{\ifnum`#1=`##2\noexpand\@empty
+                 \else\noexpand##1\noexpand##2\fi}%
+    \def\do{\x\do}%
+    \def\@makeother{\x\@makeother}%
+  \edef\x{\endgroup
+    \def\noexpand\dospecials{\dospecials}%
+    \expandafter\ifx\csname @sanitize\endcsname\relax\else
+      \def\noexpand\@sanitize{\@sanitize}%
+    \fi}%
+  \x}
+\def\bbl at active@def#1#2#3#4{%
+  \@namedef{#3#1}{%
+    \expandafter\ifx\csname#2 at sh@#1@\endcsname\relax
+      \bbl at afterelse\bbl at sh@select#2#1{#3 at arg#1}{#4#1}%
+    \else
+      \bbl at afterfi\csname#2 at sh@#1@\endcsname
+    \fi}%
+  \long\@namedef{#3 at arg#1}##1{%
+    \expandafter\ifx\csname#2 at sh@#1@\string##1@\endcsname\relax
+      \bbl at afterelse\csname#4#1\endcsname##1%
+    \else
+      \bbl at afterfi\csname#2 at sh@#1@\string##1@\endcsname
+    \fi}}%
+\def\initiate at active@char#1{%
+  \bbl at ifunset{active at char\string#1}%
+    {\bbl at withactive
+      {\expandafter\@initiate at active@char\expandafter}#1\string#1#1}%
+    {}}
+\def\@initiate at active@char#1#2#3{%
+  \bbl at csarg\edef{oricat@#2}{\catcode`#2=\the\catcode`#2\relax}%
+  \ifx#1\@undefined
+    \bbl at csarg\def{oridef@#2}{\def#1{\active at prefix#1\@undefined}}%
+  \else
+    \bbl at csarg\let{oridef@@#2}#1%
+    \bbl at csarg\edef{oridef@#2}{%
+      \let\noexpand#1%
+      \expandafter\noexpand\csname bbl at oridef@@#2\endcsname}%
+  \fi
+  \ifx#1#3\relax
+    \expandafter\let\csname normal at char#2\endcsname#3%
+  \else
+    \bbl at info{Making #2 an active character}%
+    \ifnum\mathcode`#2=\ifodd\bbl at engine"1000000 \else"8000 \fi
+      \@namedef{normal at char#2}{%
+        \textormath{#3}{\csname bbl at oridef@@#2\endcsname}}%
+    \else
+      \@namedef{normal at char#2}{#3}%
+    \fi
+    \bbl at restoreactive{#2}%
+    \AtBeginDocument{%
+      \catcode`#2\active
+      \if at filesw
+        \immediate\write\@mainaux{\catcode`\string#2\active}%
+      \fi}%
+    \expandafter\bbl at add@special\csname#2\endcsname
+    \catcode`#2\active
+  \fi
+  \let\bbl at tempa\@firstoftwo
+  \if\string^#2%
+    \def\bbl at tempa{\noexpand\textormath}%
+  \else
+    \ifx\bbl at mathnormal\@undefined\else
+      \let\bbl at tempa\bbl at mathnormal
+    \fi
+  \fi
+  \expandafter\edef\csname active at char#2\endcsname{%
+    \bbl at tempa
+      {\noexpand\if at safe@actives
+         \noexpand\expandafter
+         \expandafter\noexpand\csname normal at char#2\endcsname
+       \noexpand\else
+         \noexpand\expandafter
+         \expandafter\noexpand\csname bbl at doactive#2\endcsname
+       \noexpand\fi}%
+     {\expandafter\noexpand\csname normal at char#2\endcsname}}%
+  \bbl at csarg\edef{doactive#2}{%
+    \expandafter\noexpand\csname user at active#2\endcsname}%
+  \bbl at csarg\edef{active@#2}{%
+    \noexpand\active at prefix\noexpand#1%
+    \expandafter\noexpand\csname active at char#2\endcsname}%
+  \bbl at csarg\edef{normal@#2}{%
+    \noexpand\active at prefix\noexpand#1%
+    \expandafter\noexpand\csname normal at char#2\endcsname}%
+  \expandafter\let\expandafter#1\csname bbl at normal@#2\endcsname
+  \bbl at active@def#2\user at group{user at active}{language at active}%
+  \bbl at active@def#2\language at group{language at active}{system at active}%
+  \bbl at active@def#2\system at group{system at active}{normal at char}%
+  \expandafter\edef\csname\user at group @sh@#2@@\endcsname
+    {\expandafter\noexpand\csname normal at char#2\endcsname}%
+  \expandafter\edef\csname\user at group @sh@#2@\string\protect@\endcsname
+    {\expandafter\noexpand\csname user at active#2\endcsname}%
+  \if\string'#2%
+    \let\prim at s\bbl at prim@s
+    \let\active at math@prime#1%
+  \fi
+  \bbl at usehooks{initiateactive}{{#1}{#2}{#3}}}
+\@ifpackagewith{babel}{KeepShorthandsActive}%
+  {\let\bbl at restoreactive\@gobble}%
+  {\def\bbl at restoreactive#1{%
+     \bbl at exp{%
+       \\\AfterBabelLanguage\\\CurrentOption
+         {\catcode`#1=\the\catcode`#1\relax}%
+       \\\AtEndOfPackage
+         {\catcode`#1=\the\catcode`#1\relax}}}%
+   \AtEndOfPackage{\let\bbl at restoreactive\@gobble}}
+\def\bbl at sh@select#1#2{%
+  \expandafter\ifx\csname#1 at sh@#2 at sel\endcsname\relax
+    \bbl at afterelse\bbl at scndcs
+  \else
+    \bbl at afterfi\csname#1 at sh@#2 at sel\endcsname
+  \fi}
+\begingroup
+\bbl at ifunset{ifincsname}% TODO. Ugly. Correct? Only Plain?
+  {\gdef\active at prefix#1{%
+     \ifx\protect\@typeset at protect
+     \else
+       \ifx\protect\@unexpandable at protect
+         \noexpand#1%
+       \else
+         \protect#1%
+       \fi
+       \expandafter\@gobble
+     \fi}}
+  {\gdef\active at prefix#1{%
+     \ifincsname
+       \string#1%
+       \expandafter\@gobble
+     \else
+       \ifx\protect\@typeset at protect
+       \else
+         \ifx\protect\@unexpandable at protect
+           \noexpand#1%
+         \else
+           \protect#1%
+         \fi
+         \expandafter\expandafter\expandafter\@gobble
+       \fi
+     \fi}}
+\endgroup
+\newif\if at safe@actives
+\@safe at activesfalse
+\def\bbl at restore@actives{\if at safe@actives\@safe at activesfalse\fi}
+\chardef\bbl at activated\z@
+\def\bbl at activate#1{%
+  \chardef\bbl at activated\@ne
+  \bbl at withactive{\expandafter\let\expandafter}#1%
+    \csname bbl at active@\string#1\endcsname}
+\def\bbl at deactivate#1{%
+  \chardef\bbl at activated\tw@
+  \bbl at withactive{\expandafter\let\expandafter}#1%
+    \csname bbl at normal@\string#1\endcsname}
+\def\bbl at firstcs#1#2{\csname#1\endcsname}
+\def\bbl at scndcs#1#2{\csname#2\endcsname}
+
+\def\babel at texpdf#1#2#3#4{%
+  \ifx\texorpdfstring\@undefined
+    \textormath{#1}{#3}%
+  \else
+    \texorpdfstring{\textormath{#1}{#3}}{#2}%
+    % \texorpdfstring{\textormath{#1}{#3}}{\textormath{#2}{#4}}%
+  \fi}
+\def\declare at shorthand#1#2{\@decl at short{#1}#2\@nil}
+\def\@decl at short#1#2#3\@nil#4{%
+  \def\bbl at tempa{#3}%
+  \ifx\bbl at tempa\@empty
+    \expandafter\let\csname #1 at sh@\string#2 at sel\endcsname\bbl at scndcs
+    \bbl at ifunset{#1 at sh@\string#2@}{}%
+      {\def\bbl at tempa{#4}%
+       \expandafter\ifx\csname#1 at sh@\string#2@\endcsname\bbl at tempa
+       \else
+         \bbl at info
+           {Redefining #1 shorthand \string#2\\%
+            in language \CurrentOption}%
+       \fi}%
+    \@namedef{#1 at sh@\string#2@}{#4}%
+  \else
+    \expandafter\let\csname #1 at sh@\string#2 at sel\endcsname\bbl at firstcs
+    \bbl at ifunset{#1 at sh@\string#2@\string#3@}{}%
+      {\def\bbl at tempa{#4}%
+       \expandafter\ifx\csname#1 at sh@\string#2@\string#3@\endcsname\bbl at tempa
+       \else
+         \bbl at info
+           {Redefining #1 shorthand \string#2\string#3\\%
+            in language \CurrentOption}%
+       \fi}%
+    \@namedef{#1 at sh@\string#2@\string#3@}{#4}%
+  \fi}
+\def\textormath{%
+  \ifmmode
+    \expandafter\@secondoftwo
+  \else
+    \expandafter\@firstoftwo
+  \fi}
+\def\user at group{user}
+\def\language at group{english} % TODO. I don't like defaults
+\def\system at group{system}
+\def\useshorthands{%
+  \@ifstar\bbl at usesh@s{\bbl at usesh@x{}}}
+\def\bbl at usesh@s#1{%
+  \bbl at usesh@x
+    {\AddBabelHook{babel-sh-\string#1}{afterextras}{\bbl at activate{#1}}}%
+    {#1}}
+\def\bbl at usesh@x#1#2{%
+  \bbl at ifshorthand{#2}%
+    {\def\user at group{user}%
+     \initiate at active@char{#2}%
+     #1%
+     \bbl at activate{#2}}%
+    {\bbl at error
+       {I can't declare a shorthand turned off (\string#2)}
+       {Sorry, but you can't use shorthands which have been\\%
+        turned off in the package options}}}
+\def\user at language@group{user@\language at group}
+\def\bbl at set@user at generic#1#2{%
+  \bbl at ifunset{user at generic@active#1}%
+    {\bbl at active@def#1\user at language@group{user at active}{user at generic@active}%
+     \bbl at active@def#1\user at group{user at generic@active}{language at active}%
+     \expandafter\edef\csname#2 at sh@#1@@\endcsname{%
+       \expandafter\noexpand\csname normal at char#1\endcsname}%
+     \expandafter\edef\csname#2 at sh@#1@\string\protect@\endcsname{%
+       \expandafter\noexpand\csname user at active#1\endcsname}}%
+  \@empty}
+\newcommand\defineshorthand[3][user]{%
+  \edef\bbl at tempa{\zap at space#1 \@empty}%
+  \bbl at for\bbl at tempb\bbl at tempa{%
+    \if*\expandafter\@car\bbl at tempb\@nil
+      \edef\bbl at tempb{user@\expandafter\@gobble\bbl at tempb}%
+      \@expandtwoargs
+        \bbl at set@user at generic{\expandafter\string\@car#2\@nil}\bbl at tempb
+    \fi
+    \declare at shorthand{\bbl at tempb}{#2}{#3}}}
+\def\languageshorthands#1{\def\language at group{#1}}
+\def\aliasshorthand#1#2{%
+  \bbl at ifshorthand{#2}%
+    {\expandafter\ifx\csname active at char\string#2\endcsname\relax
+       \ifx\document\@notprerr
+         \@notshorthand{#2}%
+       \else
+         \initiate at active@char{#2}%
+         \expandafter\let\csname active at char\string#2\expandafter\endcsname
+           \csname active at char\string#1\endcsname
+         \expandafter\let\csname normal at char\string#2\expandafter\endcsname
+           \csname normal at char\string#1\endcsname
+         \bbl at activate{#2}%
+       \fi
+     \fi}%
+    {\bbl at error
+       {Cannot declare a shorthand turned off (\string#2)}
+       {Sorry, but you cannot use shorthands which have been\\%
+        turned off in the package options}}}
+\def\@notshorthand#1{%
+  \bbl at error{%
+    The character '\string #1' should be made a shorthand character;\\%
+    add the command \string\useshorthands\string{#1\string} to
+    the preamble.\\%
+    I will ignore your instruction}%
+   {You may proceed, but expect unexpected results}}
+\newcommand*\shorthandon[1]{\bbl at switch@sh\@ne#1\@nnil}
+\DeclareRobustCommand*\shorthandoff{%
+  \@ifstar{\bbl at shorthandoff\tw@}{\bbl at shorthandoff\z@}}
+\def\bbl at shorthandoff#1#2{\bbl at switch@sh#1#2\@nnil}
+\def\bbl at switch@sh#1#2{%
+  \ifx#2\@nnil\else
+    \bbl at ifunset{bbl at active@\string#2}%
+      {\bbl at error
+         {I can't switch '\string#2' on or off--not a shorthand}%
+         {This character is not a shorthand. Maybe you made\\%
+          a typing mistake? I will ignore your instruction.}}%
+      {\ifcase#1%   off, on, off*
+         \catcode`#212\relax
+       \or
+         \catcode`#2\active
+         \bbl at ifunset{bbl at shdef@\string#2}%
+           {}%
+           {\bbl at withactive{\expandafter\let\expandafter}#2%
+              \csname bbl at shdef@\string#2\endcsname
+            \bbl at csarg\let{shdef@\string#2}\relax}%
+         \ifcase\bbl at activated\or
+           \bbl at activate{#2}%
+         \else
+           \bbl at deactivate{#2}%
+         \fi
+       \or
+         \bbl at ifunset{bbl at shdef@\string#2}%
+           {\bbl at withactive{\bbl at csarg\let{shdef@\string#2}}#2}%
+           {}%
+         \csname bbl at oricat@\string#2\endcsname
+         \csname bbl at oridef@\string#2\endcsname
+       \fi}%
+    \bbl at afterfi\bbl at switch@sh#1%
+  \fi}
+\def\babelshorthand{\active at prefix\babelshorthand\bbl at putsh}
+\def\bbl at putsh#1{%
+  \bbl at ifunset{bbl at active@\string#1}%
+     {\bbl at putsh@i#1\@empty\@nnil}%
+     {\csname bbl at active@\string#1\endcsname}}
+\def\bbl at putsh@i#1#2\@nnil{%
+  \csname\language at group @sh@\string#1@%
+    \ifx\@empty#2\else\string#2@\fi\endcsname}
+\ifx\bbl at opt@shorthands\@nnil\else
+  \let\bbl at s@initiate at active@char\initiate at active@char
+  \def\initiate at active@char#1{%
+    \bbl at ifshorthand{#1}{\bbl at s@initiate at active@char{#1}}{}}
+  \let\bbl at s@switch at sh\bbl at switch@sh
+  \def\bbl at switch@sh#1#2{%
+    \ifx#2\@nnil\else
+      \bbl at afterfi
+      \bbl at ifshorthand{#2}{\bbl at s@switch at sh#1{#2}}{\bbl at switch@sh#1}%
+    \fi}
+  \let\bbl at s@activate\bbl at activate
+  \def\bbl at activate#1{%
+    \bbl at ifshorthand{#1}{\bbl at s@activate{#1}}{}}
+  \let\bbl at s@deactivate\bbl at deactivate
+  \def\bbl at deactivate#1{%
+    \bbl at ifshorthand{#1}{\bbl at s@deactivate{#1}}{}}
+\fi
+\newcommand\ifbabelshorthand[3]{\bbl at ifunset{bbl at active@\string#1}{#3}{#2}}
+\def\bbl at prim@s{%
+  \prime\futurelet\@let at token\bbl at pr@m at s}
+\def\bbl at if@primes#1#2{%
+  \ifx#1\@let at token
+    \expandafter\@firstoftwo
+  \else\ifx#2\@let at token
+    \bbl at afterelse\expandafter\@firstoftwo
+  \else
+    \bbl at afterfi\expandafter\@secondoftwo
+  \fi\fi}
+\begingroup
+  \catcode`\^=7  \catcode`\*=\active  \lccode`\*=`\^
+  \catcode`\'=12 \catcode`\"=\active  \lccode`\"=`\'
+  \lowercase{%
+    \gdef\bbl at pr@m at s{%
+      \bbl at if@primes"'%
+        \pr@@@s
+        {\bbl at if@primes*^\pr@@@t\egroup}}}
+\endgroup
+\initiate at active@char{~}
+\declare at shorthand{system}{~}{\leavevmode\nobreak\ }
+\bbl at activate{~}
+\expandafter\def\csname OT1dqpos\endcsname{127}
+\expandafter\def\csname T1dqpos\endcsname{4}
+\ifx\f at encoding\@undefined
+  \def\f at encoding{OT1}
+\fi
+\bbl at trace{Language attributes}
+\newcommand\languageattribute[2]{%
+  \def\bbl at tempc{#1}%
+  \bbl at fixname\bbl at tempc
+  \bbl at iflanguage\bbl at tempc{%
+    \bbl at vforeach{#2}{%
+      \ifx\bbl at known@attribs\@undefined
+        \in at false
+      \else
+        \bbl at xin@{,\bbl at tempc-##1,}{,\bbl at known@attribs,}%
+      \fi
+      \ifin@
+        \bbl at warning{%
+          You have more than once selected the attribute '##1'\\%
+          for language #1. Reported}%
+      \else
+        \bbl at exp{%
+          \\\bbl at add@list\\\bbl at known@attribs{\bbl at tempc-##1}}%
+        \edef\bbl at tempa{\bbl at tempc-##1}%
+        \expandafter\bbl at ifknown@ttrib\expandafter{\bbl at tempa}\bbl at attributes%
+        {\csname\bbl at tempc @attr@##1\endcsname}%
+        {\@attrerr{\bbl at tempc}{##1}}%
+     \fi}}}
+\@onlypreamble\languageattribute
+\newcommand*{\@attrerr}[2]{%
+  \bbl at error
+    {The attribute #2 is unknown for language #1.}%
+    {Your command will be ignored, type <return> to proceed}}
+\def\bbl at declare@ttribute#1#2#3{%
+  \bbl at xin@{,#2,}{,\BabelModifiers,}%
+  \ifin@
+    \AfterBabelLanguage{#1}{\languageattribute{#1}{#2}}%
+  \fi
+  \bbl at add@list\bbl at attributes{#1-#2}%
+  \expandafter\def\csname#1 at attr@#2\endcsname{#3}}
+\def\bbl at ifattributeset#1#2#3#4{%
+  \ifx\bbl at known@attribs\@undefined
+    \in at false
+  \else
+    \bbl at xin@{,#1-#2,}{,\bbl at known@attribs,}%
+  \fi
+  \ifin@
+    \bbl at afterelse#3%
+  \else
+    \bbl at afterfi#4%
+  \fi}
+\def\bbl at ifknown@ttrib#1#2{%
+  \let\bbl at tempa\@secondoftwo
+  \bbl at loopx\bbl at tempb{#2}{%
+    \expandafter\in@\expandafter{\expandafter,\bbl at tempb,}{,#1,}%
+    \ifin@
+      \let\bbl at tempa\@firstoftwo
+    \else
+    \fi}%
+  \bbl at tempa}
+\def\bbl at clear@ttribs{%
+  \ifx\bbl at attributes\@undefined\else
+    \bbl at loopx\bbl at tempa{\bbl at attributes}{%
+      \expandafter\bbl at clear@ttrib\bbl at tempa.
+      }%
+    \let\bbl at attributes\@undefined
+  \fi}
+\def\bbl at clear@ttrib#1-#2.{%
+  \expandafter\let\csname#1 at attr@#2\endcsname\@undefined}
+\AtBeginDocument{\bbl at clear@ttribs}
+\bbl at trace{Macros for saving definitions}
+\def\babel at beginsave{\babel at savecnt\z@}
+\newcount\babel at savecnt
+\babel at beginsave
+\def\babel at save#1{%
+  \expandafter\let\csname babel@\number\babel at savecnt\endcsname#1\relax
+  \toks@\expandafter{\originalTeX\let#1=}%
+  \bbl at exp{%
+    \def\\\originalTeX{\the\toks@\<babel@\number\babel at savecnt>\relax}}%
+  \advance\babel at savecnt\@ne}
+\def\babel at savevariable#1{%
+  \toks@\expandafter{\originalTeX #1=}%
+  \bbl at exp{\def\\\originalTeX{\the\toks@\the#1\relax}}}
+\def\bbl at frenchspacing{%
+  \ifnum\the\sfcode`\.=\@m
+    \let\bbl at nonfrenchspacing\relax
+  \else
+    \frenchspacing
+    \let\bbl at nonfrenchspacing\nonfrenchspacing
+  \fi}
+\let\bbl at nonfrenchspacing\nonfrenchspacing
+\let\bbl at elt\relax
+\edef\bbl at fs@chars{%
+  \bbl at elt{\string.}\@m{3000}\bbl at elt{\string?}\@m{3000}%
+  \bbl at elt{\string!}\@m{3000}\bbl at elt{\string:}\@m{2000}%
+  \bbl at elt{\string;}\@m{1500}\bbl at elt{\string,}\@m{1250}}
+\def\bbl at pre@fs{%
+  \def\bbl at elt##1##2##3{\sfcode`##1=\the\sfcode`##1\relax}%
+  \edef\bbl at save@sfcodes{\bbl at fs@chars}}%
+\def\bbl at post@fs{%
+  \bbl at save@sfcodes
+  \edef\bbl at tempa{\bbl at cl{frspc}}%
+  \edef\bbl at tempa{\expandafter\@car\bbl at tempa\@nil}%
+  \if u\bbl at tempa          % do nothing
+  \else\if n\bbl at tempa     % non french
+    \def\bbl at elt##1##2##3{%
+      \ifnum\sfcode`##1=##2\relax
+        \babel at savevariable{\sfcode`##1}%
+        \sfcode`##1=##3\relax
+      \fi}%
+    \bbl at fs@chars
+  \else\if y\bbl at tempa     % french
+    \def\bbl at elt##1##2##3{%
+      \ifnum\sfcode`##1=##3\relax
+        \babel at savevariable{\sfcode`##1}%
+        \sfcode`##1=##2\relax
+      \fi}%
+    \bbl at fs@chars
+  \fi\fi\fi}
+\bbl at trace{Short tags}
+\def\babeltags#1{%
+  \edef\bbl at tempa{\zap at space#1 \@empty}%
+  \def\bbl at tempb##1=##2\@@{%
+    \edef\bbl at tempc{%
+      \noexpand\newcommand
+      \expandafter\noexpand\csname ##1\endcsname{%
+        \noexpand\protect
+        \expandafter\noexpand\csname otherlanguage*\endcsname{##2}}
+      \noexpand\newcommand
+      \expandafter\noexpand\csname text##1\endcsname{%
+        \noexpand\foreignlanguage{##2}}}
+    \bbl at tempc}%
+  \bbl at for\bbl at tempa\bbl at tempa{%
+    \expandafter\bbl at tempb\bbl at tempa\@@}}
+\bbl at trace{Hyphens}
+\@onlypreamble\babelhyphenation
+\AtEndOfPackage{%
+  \newcommand\babelhyphenation[2][\@empty]{%
+    \ifx\bbl at hyphenation@\relax
+      \let\bbl at hyphenation@\@empty
+    \fi
+    \ifx\bbl at hyphlist\@empty\else
+      \bbl at warning{%
+        You must not intermingle \string\selectlanguage\space and\\%
+        \string\babelhyphenation\space or some exceptions will not\\%
+        be taken into account. Reported}%
+    \fi
+    \ifx\@empty#1%
+      \protected at edef\bbl at hyphenation@{\bbl at hyphenation@\space#2}%
+    \else
+      \bbl at vforeach{#1}{%
+        \def\bbl at tempa{##1}%
+        \bbl at fixname\bbl at tempa
+        \bbl at iflanguage\bbl at tempa{%
+          \bbl at csarg\protected at edef{hyphenation@\bbl at tempa}{%
+            \bbl at ifunset{bbl at hyphenation@\bbl at tempa}%
+              {}%
+              {\csname bbl at hyphenation@\bbl at tempa\endcsname\space}%
+            #2}}}%
+    \fi}}
+\def\bbl at allowhyphens{\ifvmode\else\nobreak\hskip\z at skip\fi}
+\def\bbl at t@one{T1}
+\def\allowhyphens{\ifx\cf at encoding\bbl at t@one\else\bbl at allowhyphens\fi}
+\newcommand\babelnullhyphen{\char\hyphenchar\font}
+\def\babelhyphen{\active at prefix\babelhyphen\bbl at hyphen}
+\def\bbl at hyphen{%
+  \@ifstar{\bbl at hyphen@i @}{\bbl at hyphen@i\@empty}}
+\def\bbl at hyphen@i#1#2{%
+  \bbl at ifunset{bbl at hy@#1#2\@empty}%
+    {\csname bbl@#1usehyphen\endcsname{\discretionary{#2}{}{#2}}}%
+    {\csname bbl at hy@#1#2\@empty\endcsname}}
+\def\bbl at usehyphen#1{%
+  \leavevmode
+  \ifdim\lastskip>\z@\mbox{#1}\else\nobreak#1\fi
+  \nobreak\hskip\z at skip}
+\def\bbl@@usehyphen#1{%
+  \leavevmode\ifdim\lastskip>\z@\mbox{#1}\else#1\fi}
+\def\bbl at hyphenchar{%
+  \ifnum\hyphenchar\font=\m at ne
+    \babelnullhyphen
+  \else
+    \char\hyphenchar\font
+  \fi}
+\def\bbl at hy@soft{\bbl at usehyphen{\discretionary{\bbl at hyphenchar}{}{}}}
+\def\bbl at hy@@soft{\bbl@@usehyphen{\discretionary{\bbl at hyphenchar}{}{}}}
+\def\bbl at hy@hard{\bbl at usehyphen\bbl at hyphenchar}
+\def\bbl at hy@@hard{\bbl@@usehyphen\bbl at hyphenchar}
+\def\bbl at hy@nobreak{\bbl at usehyphen{\mbox{\bbl at hyphenchar}}}
+\def\bbl at hy@@nobreak{\mbox{\bbl at hyphenchar}}
+\def\bbl at hy@repeat{%
+  \bbl at usehyphen{%
+    \discretionary{\bbl at hyphenchar}{\bbl at hyphenchar}{\bbl at hyphenchar}}}
+\def\bbl at hy@@repeat{%
+  \bbl@@usehyphen{%
+    \discretionary{\bbl at hyphenchar}{\bbl at hyphenchar}{\bbl at hyphenchar}}}
+\def\bbl at hy@empty{\hskip\z at skip}
+\def\bbl at hy@@empty{\discretionary{}{}{}}
+\def\bbl at disc#1#2{\nobreak\discretionary{#2-}{}{#1}\bbl at allowhyphens}
+\bbl at trace{Multiencoding strings}
+\def\bbl at toglobal#1{\global\let#1#1}
+\def\bbl at recatcode#1{% TODO. Used only once?
+  \@tempcnta="7F
+  \def\bbl at tempa{%
+    \ifnum\@tempcnta>"FF\else
+      \catcode\@tempcnta=#1\relax
+      \advance\@tempcnta\@ne
+      \expandafter\bbl at tempa
+    \fi}%
+  \bbl at tempa}
+\@ifpackagewith{babel}{nocase}%
+  {\let\bbl at patchuclc\relax}%
+  {\def\bbl at patchuclc{%
+    \global\let\bbl at patchuclc\relax
+    \g at addto@macro\@uclclist{\reserved at b{\reserved at b\bbl at uclc}}%
+    \gdef\bbl at uclc##1{%
+      \let\bbl at encoded\bbl at encoded@uclc
+      \bbl at ifunset{\languagename @bbl at uclc}% and resumes it
+        {##1}%
+        {\let\bbl at tempa##1\relax % Used by LANG at bbl@uclc
+         \csname\languagename @bbl at uclc\endcsname}%
+      {\bbl at tolower\@empty}{\bbl at toupper\@empty}}%
+    \gdef\bbl at tolower{\csname\languagename @bbl at lc\endcsname}%
+    \gdef\bbl at toupper{\csname\languagename @bbl at uc\endcsname}}}
+\@onlypreamble\StartBabelCommands
+\def\StartBabelCommands{%
+  \begingroup
+  \bbl at recatcode{11}%
+  \def\SetStringLoop##1##2{%
+    \def\bbl at templ####1{\expandafter\noexpand\csname##1\endcsname}%
+    \count@\z@
+    \bbl at loop\bbl at tempa{##2}{% empty items and spaces are ok
+      \advance\count@\@ne
+      \toks@\expandafter{\bbl at tempa}%
+      \bbl at exp{%
+        \\\SetString\bbl at templ{\romannumeral\count@}{\the\toks@}%
+        \count@=\the\count@\relax}}}%
+  \newcommand\SetCase[3][]{%
+    \bbl at patchuclc
+    \bbl at forlang\bbl at tempa{%
+      \expandafter\bbl at encstring
+        \csname\bbl at tempa @bbl at uclc\endcsname{\bbl at tempa##1}%
+      \expandafter\bbl at encstring
+        \csname\bbl at tempa @bbl at uc\endcsname{##2}%
+      \expandafter\bbl at encstring
+        \csname\bbl at tempa @bbl at lc\endcsname{##3}}}%
+  \newcommand\SetHyphenMap[1]{%
+    \bbl at forlang\bbl at tempa{%
+      \expandafter\bbl at stringdef
+        \csname\bbl at tempa @bbl at hyphenmap\endcsname{##1}}}%
+  \def\bbl at provstring##1##2{%
+    \providecommand##1{##2}%
+    \bbl at toglobal##1}%
+  \global\let\bbl at scafter\@empty
+  \let\StartBabelCommands\bbl at startcmds
+  \ifx\BabelLanguages\relax
+     \let\BabelLanguages\CurrentOption
+  \fi
+  \begingroup
+  \let\bbl at screset\@nnil % local flag - disable 1st stopcommands
+  \StartBabelCommands}
+\def\bbl at startcmds{%
+  \ifx\bbl at screset\@nnil\else
+    \bbl at usehooks{stopcommands}{}%
+  \fi
+  \endgroup
+  \begingroup
+  \@ifstar
+    {\ifx\bbl at opt@strings\@nnil
+       \let\bbl at opt@strings\BabelStringsDefault
+     \fi
+     \bbl at startcmds@i}%
+    \bbl at startcmds@i}
+\def\bbl at startcmds@i#1#2{%
+  \edef\bbl at L{\zap at space#1 \@empty}%
+  \edef\bbl at G{\zap at space#2 \@empty}%
+  \bbl at startcmds@ii}
+\let\bbl at startcommands\StartBabelCommands
+\newcommand\bbl at startcmds@ii[1][\@empty]{%
+  \let\SetString\@gobbletwo
+  \let\bbl at stringdef\@gobbletwo
+  \let\AfterBabelCommands\@gobble
+  \ifx\@empty#1%
+    \def\bbl at sc@label{generic}%
+    \def\bbl at encstring##1##2{%
+      \ProvideTextCommandDefault##1{##2}%
+      \bbl at toglobal##1%
+      \expandafter\bbl at toglobal\csname\string?\string##1\endcsname}%
+    \let\bbl at sctest\in at true
+  \else
+    \let\bbl at sc@charset\space % <- zapped below
+    \let\bbl at sc@fontenc\space % <-   "      "
+    \def\bbl at tempa##1=##2\@nil{%
+      \bbl at csarg\edef{sc@\zap at space##1 \@empty}{##2 }}%
+    \bbl at vforeach{label=#1}{\bbl at tempa##1\@nil}%
+    \def\bbl at tempa##1 ##2{% space -> comma
+      ##1%
+      \ifx\@empty##2\else\ifx,##1,\else,\fi\bbl at afterfi\bbl at tempa##2\fi}%
+    \edef\bbl at sc@fontenc{\expandafter\bbl at tempa\bbl at sc@fontenc\@empty}%
+    \edef\bbl at sc@label{\expandafter\zap at space\bbl at sc@label\@empty}%
+    \edef\bbl at sc@charset{\expandafter\zap at space\bbl at sc@charset\@empty}%
+    \def\bbl at encstring##1##2{%
+      \bbl at foreach\bbl at sc@fontenc{%
+        \bbl at ifunset{T@####1}%
+          {}%
+          {\ProvideTextCommand##1{####1}{##2}%
+           \bbl at toglobal##1%
+           \expandafter
+           \bbl at toglobal\csname####1\string##1\endcsname}}}%
+    \def\bbl at sctest{%
+      \bbl at xin@{,\bbl at opt@strings,}{,\bbl at sc@label,\bbl at sc@fontenc,}}%
+  \fi
+  \ifx\bbl at opt@strings\@nnil         % ie, no strings key -> defaults
+  \else\ifx\bbl at opt@strings\relax    % ie, strings=encoded
+    \let\AfterBabelCommands\bbl at aftercmds
+    \let\SetString\bbl at setstring
+    \let\bbl at stringdef\bbl at encstring
+  \else       % ie, strings=value
+  \bbl at sctest
+  \ifin@
+    \let\AfterBabelCommands\bbl at aftercmds
+    \let\SetString\bbl at setstring
+    \let\bbl at stringdef\bbl at provstring
+  \fi\fi\fi
+  \bbl at scswitch
+  \ifx\bbl at G\@empty
+    \def\SetString##1##2{%
+      \bbl at error{Missing group for string \string##1}%
+        {You must assign strings to some category, typically\\%
+         captions or extras, but you set none}}%
+  \fi
+  \ifx\@empty#1%
+    \bbl at usehooks{defaultcommands}{}%
+  \else
+    \@expandtwoargs
+    \bbl at usehooks{encodedcommands}{{\bbl at sc@charset}{\bbl at sc@fontenc}}%
+  \fi}
+\def\bbl at forlang#1#2{%
+  \bbl at for#1\bbl at L{%
+    \bbl at xin@{,#1,}{,\BabelLanguages,}%
+    \ifin@#2\relax\fi}}
+\def\bbl at scswitch{%
+  \bbl at forlang\bbl at tempa{%
+    \ifx\bbl at G\@empty\else
+      \ifx\SetString\@gobbletwo\else
+        \edef\bbl at GL{\bbl at G\bbl at tempa}%
+        \bbl at xin@{,\bbl at GL,}{,\bbl at screset,}%
+        \ifin@\else
+          \global\expandafter\let\csname\bbl at GL\endcsname\@undefined
+          \xdef\bbl at screset{\bbl at screset,\bbl at GL}%
+        \fi
+      \fi
+    \fi}}
+\AtEndOfPackage{%
+  \def\bbl at forlang#1#2{\bbl at for#1\bbl at L{\bbl at ifunset{date#1}{}{#2}}}%
+  \let\bbl at scswitch\relax}
+\@onlypreamble\EndBabelCommands
+\def\EndBabelCommands{%
+  \bbl at usehooks{stopcommands}{}%
+  \endgroup
+  \endgroup
+  \bbl at scafter}
+\let\bbl at endcommands\EndBabelCommands
+\def\bbl at setstring#1#2{% eg, \prefacename{<string>}
+  \bbl at forlang\bbl at tempa{%
+    \edef\bbl at LC{\bbl at tempa\bbl at stripslash#1}%
+    \bbl at ifunset{\bbl at LC}% eg, \germanchaptername
+      {\bbl at exp{%
+         \global\\\bbl at add\<\bbl at G\bbl at tempa>{\\\bbl at scset\\#1\<\bbl at LC>}}}%
+      {}%
+    \def\BabelString{#2}%
+    \bbl at usehooks{stringprocess}{}%
+    \expandafter\bbl at stringdef
+      \csname\bbl at LC\expandafter\endcsname\expandafter{\BabelString}}}
+\ifx\bbl at opt@strings\relax
+  \def\bbl at scset#1#2{\def#1{\bbl at encoded#2}}
+  \bbl at patchuclc
+  \let\bbl at encoded\relax
+  \def\bbl at encoded@uclc#1{%
+    \@inmathwarn#1%
+    \expandafter\ifx\csname\cf at encoding\string#1\endcsname\relax
+      \expandafter\ifx\csname ?\string#1\endcsname\relax
+        \TextSymbolUnavailable#1%
+      \else
+        \csname ?\string#1\endcsname
+      \fi
+    \else
+      \csname\cf at encoding\string#1\endcsname
+    \fi}
+\else
+  \def\bbl at scset#1#2{\def#1{#2}}
+\fi
+\def\bbl at aftercmds#1{%
+  \toks@\expandafter{\bbl at scafter#1}%
+  \xdef\bbl at scafter{\the\toks@}}
+\newcommand\BabelLower[2]{% one to one.
+  \ifnum\lccode#1=#2\else
+    \babel at savevariable{\lccode#1}%
+    \lccode#1=#2\relax
+  \fi}
+\newcommand\BabelLowerMM[4]{% many-to-many
+  \@tempcnta=#1\relax
+  \@tempcntb=#4\relax
+  \def\bbl at tempa{%
+    \ifnum\@tempcnta>#2\else
+      \@expandtwoargs\BabelLower{\the\@tempcnta}{\the\@tempcntb}%
+      \advance\@tempcnta#3\relax
+      \advance\@tempcntb#3\relax
+      \expandafter\bbl at tempa
+    \fi}%
+  \bbl at tempa}
+\newcommand\BabelLowerMO[4]{% many-to-one
+  \@tempcnta=#1\relax
+  \def\bbl at tempa{%
+    \ifnum\@tempcnta>#2\else
+      \@expandtwoargs\BabelLower{\the\@tempcnta}{#4}%
+      \advance\@tempcnta#3
+      \expandafter\bbl at tempa
+    \fi}%
+  \bbl at tempa}
+\AtEndOfPackage{%
+  \ifx\bbl at opt@hyphenmap\@undefined
+    \bbl at xin@{,}{\bbl at language@opts}%
+    \chardef\bbl at opt@hyphenmap\ifin at 4\else\@ne\fi
+  \fi}
+\newcommand\setlocalecaption{%  TODO. Catch typos. What about ensure?
+  \@ifstar\bbl at setcaption@s\bbl at setcaption@x}
+\def\bbl at setcaption@x#1#2#3{%  language caption-name string
+  \bbl at trim@def\bbl at tempa{#2}%
+  \bbl at xin@{.template}{\bbl at tempa}%
+  \ifin@
+    \bbl at ini@captions at template{#3}{#1}%
+  \else
+    \edef\bbl at tempd{%
+      \expandafter\expandafter\expandafter
+      \strip at prefix\expandafter\meaning\csname captions#1\endcsname}%
+    \bbl at xin@
+      {\expandafter\string\csname #2name\endcsname}%
+      {\bbl at tempd}%
+    \ifin@ % Renew caption
+      \bbl at xin@{\string\bbl at scset}{\bbl at tempd}%
+      \ifin@
+        \bbl at exp{%
+          \\\bbl at ifsamestring{\bbl at tempa}{\languagename}%
+            {\\\bbl at scset\<#2name>\<#1#2name>}%
+            {}}%
+      \else % Old way converts to new way
+        \bbl at ifunset{#1#2name}%
+          {\bbl at exp{%
+            \\\bbl at add\<captions#1>{\def\<#2name>{\<#1#2name>}}%
+            \\\bbl at ifsamestring{\bbl at tempa}{\languagename}%
+              {\def\<#2name>{\<#1#2name>}}%
+              {}}}%
+          {}%
+      \fi
+    \else
+      \bbl at xin@{\string\bbl at scset}{\bbl at tempd}% New
+      \ifin@ % New way
+        \bbl at exp{%
+          \\\bbl at add\<captions#1>{\\\bbl at scset\<#2name>\<#1#2name>}%
+          \\\bbl at ifsamestring{\bbl at tempa}{\languagename}%
+            {\\\bbl at scset\<#2name>\<#1#2name>}%
+            {}}%
+      \else  % Old way, but defined in the new way
+        \bbl at exp{%
+          \\\bbl at add\<captions#1>{\def\<#2name>{\<#1#2name>}}%
+          \\\bbl at ifsamestring{\bbl at tempa}{\languagename}%
+            {\def\<#2name>{\<#1#2name>}}%
+            {}}%
+      \fi%
+    \fi
+    \@namedef{#1#2name}{#3}%
+    \toks@\expandafter{\bbl at captionslist}%
+    \bbl at exp{\\\in@{\<#2name>}{\the\toks@}}%
+    \ifin@\else
+      \bbl at exp{\\\bbl at add\\\bbl at captionslist{\<#2name>}}%
+      \bbl at toglobal\bbl at captionslist
+    \fi
+  \fi}
+\bbl at trace{Macros related to glyphs}
+\def\set at low@box#1{\setbox\tw@\hbox{,}\setbox\z@\hbox{#1}%
+    \dimen\z@\ht\z@ \advance\dimen\z@ -\ht\tw@%
+    \setbox\z@\hbox{\lower\dimen\z@ \box\z@}\ht\z@\ht\tw@ \dp\z@\dp\tw@}
+\def\save at sf@q#1{\leavevmode
+  \begingroup
+    \edef\@SF{\spacefactor\the\spacefactor}#1\@SF
+  \endgroup}
+\ProvideTextCommand{\quotedblbase}{OT1}{%
+  \save at sf@q{\set at low@box{\textquotedblright\/}%
+    \box\z@\kern-.04em\bbl at allowhyphens}}
+\ProvideTextCommandDefault{\quotedblbase}{%
+  \UseTextSymbol{OT1}{\quotedblbase}}
+\ProvideTextCommand{\quotesinglbase}{OT1}{%
+  \save at sf@q{\set at low@box{\textquoteright\/}%
+    \box\z@\kern-.04em\bbl at allowhyphens}}
+\ProvideTextCommandDefault{\quotesinglbase}{%
+  \UseTextSymbol{OT1}{\quotesinglbase}}
+\ProvideTextCommand{\guillemetleft}{OT1}{%
+  \ifmmode
+    \ll
+  \else
+    \save at sf@q{\nobreak
+      \raise.2ex\hbox{$\scriptscriptstyle\ll$}\bbl at allowhyphens}%
+  \fi}
+\ProvideTextCommand{\guillemetright}{OT1}{%
+  \ifmmode
+    \gg
+  \else
+    \save at sf@q{\nobreak
+      \raise.2ex\hbox{$\scriptscriptstyle\gg$}\bbl at allowhyphens}%
+  \fi}
+\ProvideTextCommand{\guillemotleft}{OT1}{%
+  \ifmmode
+    \ll
+  \else
+    \save at sf@q{\nobreak
+      \raise.2ex\hbox{$\scriptscriptstyle\ll$}\bbl at allowhyphens}%
+  \fi}
+\ProvideTextCommand{\guillemotright}{OT1}{%
+  \ifmmode
+    \gg
+  \else
+    \save at sf@q{\nobreak
+      \raise.2ex\hbox{$\scriptscriptstyle\gg$}\bbl at allowhyphens}%
+  \fi}
+\ProvideTextCommandDefault{\guillemetleft}{%
+  \UseTextSymbol{OT1}{\guillemetleft}}
+\ProvideTextCommandDefault{\guillemetright}{%
+  \UseTextSymbol{OT1}{\guillemetright}}
+\ProvideTextCommandDefault{\guillemotleft}{%
+  \UseTextSymbol{OT1}{\guillemotleft}}
+\ProvideTextCommandDefault{\guillemotright}{%
+  \UseTextSymbol{OT1}{\guillemotright}}
+\ProvideTextCommand{\guilsinglleft}{OT1}{%
+  \ifmmode
+    <%
+  \else
+    \save at sf@q{\nobreak
+      \raise.2ex\hbox{$\scriptscriptstyle<$}\bbl at allowhyphens}%
+  \fi}
+\ProvideTextCommand{\guilsinglright}{OT1}{%
+  \ifmmode
+    >%
+  \else
+    \save at sf@q{\nobreak
+      \raise.2ex\hbox{$\scriptscriptstyle>$}\bbl at allowhyphens}%
+  \fi}
+\ProvideTextCommandDefault{\guilsinglleft}{%
+  \UseTextSymbol{OT1}{\guilsinglleft}}
+\ProvideTextCommandDefault{\guilsinglright}{%
+  \UseTextSymbol{OT1}{\guilsinglright}}
+\DeclareTextCommand{\ij}{OT1}{%
+  i\kern-0.02em\bbl at allowhyphens j}
+\DeclareTextCommand{\IJ}{OT1}{%
+  I\kern-0.02em\bbl at allowhyphens J}
+\DeclareTextCommand{\ij}{T1}{\char188}
+\DeclareTextCommand{\IJ}{T1}{\char156}
+\ProvideTextCommandDefault{\ij}{%
+  \UseTextSymbol{OT1}{\ij}}
+\ProvideTextCommandDefault{\IJ}{%
+  \UseTextSymbol{OT1}{\IJ}}
+\def\crrtic@{\hrule height0.1ex width0.3em}
+\def\crttic@{\hrule height0.1ex width0.33em}
+\def\ddj@{%
+  \setbox0\hbox{d}\dimen@=\ht0
+  \advance\dimen at 1ex
+  \dimen at .45\dimen@
+  \dimen at ii\expandafter\rem at pt\the\fontdimen\@ne\font\dimen@
+  \advance\dimen at ii.5ex
+  \leavevmode\rlap{\raise\dimen@\hbox{\kern\dimen at ii\vbox{\crrtic@}}}}
+\def\DDJ@{%
+  \setbox0\hbox{D}\dimen@=.55\ht0
+  \dimen at ii\expandafter\rem at pt\the\fontdimen\@ne\font\dimen@
+  \advance\dimen at ii.15ex %            correction for the dash position
+  \advance\dimen at ii-.15\fontdimen7\font %     correction for cmtt font
+  \dimen\thr@@\expandafter\rem at pt\the\fontdimen7\font\dimen@
+  \leavevmode\rlap{\raise\dimen@\hbox{\kern\dimen at ii\vbox{\crttic@}}}}
+\DeclareTextCommand{\dj}{OT1}{\ddj@ d}
+\DeclareTextCommand{\DJ}{OT1}{\DDJ@ D}
+\ProvideTextCommandDefault{\dj}{%
+  \UseTextSymbol{OT1}{\dj}}
+\ProvideTextCommandDefault{\DJ}{%
+  \UseTextSymbol{OT1}{\DJ}}
+\DeclareTextCommand{\SS}{OT1}{SS}
+\ProvideTextCommandDefault{\SS}{\UseTextSymbol{OT1}{\SS}}
+\ProvideTextCommandDefault{\glq}{%
+  \textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
+\ProvideTextCommand{\grq}{T1}{%
+  \textormath{\kern\z@\textquoteleft}{\mbox{\textquoteleft}}}
+\ProvideTextCommand{\grq}{TU}{%
+  \textormath{\textquoteleft}{\mbox{\textquoteleft}}}
+\ProvideTextCommand{\grq}{OT1}{%
+  \save at sf@q{\kern-.0125em
+    \textormath{\textquoteleft}{\mbox{\textquoteleft}}%
+    \kern.07em\relax}}
+\ProvideTextCommandDefault{\grq}{\UseTextSymbol{OT1}\grq}
+\ProvideTextCommandDefault{\glqq}{%
+  \textormath{\quotedblbase}{\mbox{\quotedblbase}}}
+\ProvideTextCommand{\grqq}{T1}{%
+  \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
+\ProvideTextCommand{\grqq}{TU}{%
+  \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
+\ProvideTextCommand{\grqq}{OT1}{%
+  \save at sf@q{\kern-.07em
+    \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}%
+    \kern.07em\relax}}
+\ProvideTextCommandDefault{\grqq}{\UseTextSymbol{OT1}\grqq}
+\ProvideTextCommandDefault{\flq}{%
+  \textormath{\guilsinglleft}{\mbox{\guilsinglleft}}}
+\ProvideTextCommandDefault{\frq}{%
+  \textormath{\guilsinglright}{\mbox{\guilsinglright}}}
+\ProvideTextCommandDefault{\flqq}{%
+  \textormath{\guillemetleft}{\mbox{\guillemetleft}}}
+\ProvideTextCommandDefault{\frqq}{%
+  \textormath{\guillemetright}{\mbox{\guillemetright}}}
+\def\umlauthigh{%
+  \def\bbl at umlauta##1{\leavevmode\bgroup%
+      \expandafter\accent\csname\f at encoding dqpos\endcsname
+      ##1\bbl at allowhyphens\egroup}%
+  \let\bbl at umlaute\bbl at umlauta}
+\def\umlautlow{%
+  \def\bbl at umlauta{\protect\lower at umlaut}}
+\def\umlautelow{%
+  \def\bbl at umlaute{\protect\lower at umlaut}}
+\umlauthigh
+\expandafter\ifx\csname U at D\endcsname\relax
+  \csname newdimen\endcsname\U at D
+\fi
+\def\lower at umlaut#1{%
+  \leavevmode\bgroup
+    \U at D 1ex%
+    {\setbox\z@\hbox{%
+      \expandafter\char\csname\f at encoding dqpos\endcsname}%
+      \dimen@ -.45ex\advance\dimen@\ht\z@
+      \ifdim 1ex<\dimen@ \fontdimen5\font\dimen@ \fi}%
+    \expandafter\accent\csname\f at encoding dqpos\endcsname
+    \fontdimen5\font\U at D #1%
+  \egroup}
+\AtBeginDocument{%
+  \DeclareTextCompositeCommand{\"}{OT1}{a}{\bbl at umlauta{a}}%
+  \DeclareTextCompositeCommand{\"}{OT1}{e}{\bbl at umlaute{e}}%
+  \DeclareTextCompositeCommand{\"}{OT1}{i}{\bbl at umlaute{\i}}%
+  \DeclareTextCompositeCommand{\"}{OT1}{\i}{\bbl at umlaute{\i}}%
+  \DeclareTextCompositeCommand{\"}{OT1}{o}{\bbl at umlauta{o}}%
+  \DeclareTextCompositeCommand{\"}{OT1}{u}{\bbl at umlauta{u}}%
+  \DeclareTextCompositeCommand{\"}{OT1}{A}{\bbl at umlauta{A}}%
+  \DeclareTextCompositeCommand{\"}{OT1}{E}{\bbl at umlaute{E}}%
+  \DeclareTextCompositeCommand{\"}{OT1}{I}{\bbl at umlaute{I}}%
+  \DeclareTextCompositeCommand{\"}{OT1}{O}{\bbl at umlauta{O}}%
+  \DeclareTextCompositeCommand{\"}{OT1}{U}{\bbl at umlauta{U}}}
+\ifx\l at english\@undefined
+  \chardef\l at english\z@
+\fi
+\ifx\l at unhyphenated\@undefined
+  \newlanguage\l at unhyphenated
+\fi
+\bbl at trace{Bidi layout}
+\providecommand\IfBabelLayout[3]{#3}%
+\newcommand\BabelPatchSection[1]{%
+  \@ifundefined{#1}{}{%
+    \bbl at exp{\let\<bbl at ss@#1>\<#1>}%
+    \@namedef{#1}{%
+      \@ifstar{\bbl at presec@s{#1}}%
+              {\@dblarg{\bbl at presec@x{#1}}}}}}
+\def\bbl at presec@x#1[#2]#3{%
+  \bbl at exp{%
+    \\\select at language@x{\bbl at main@language}%
+    \\\bbl at cs{sspre@#1}%
+    \\\bbl at cs{ss@#1}%
+      [\\\foreignlanguage{\languagename}{\unexpanded{#2}}]%
+      {\\\foreignlanguage{\languagename}{\unexpanded{#3}}}%
+    \\\select at language@x{\languagename}}}
+\def\bbl at presec@s#1#2{%
+  \bbl at exp{%
+    \\\select at language@x{\bbl at main@language}%
+    \\\bbl at cs{sspre@#1}%
+    \\\bbl at cs{ss@#1}*%
+      {\\\foreignlanguage{\languagename}{\unexpanded{#2}}}%
+    \\\select at language@x{\languagename}}}
+\IfBabelLayout{sectioning}%
+  {\BabelPatchSection{part}%
+   \BabelPatchSection{chapter}%
+   \BabelPatchSection{section}%
+   \BabelPatchSection{subsection}%
+   \BabelPatchSection{subsubsection}%
+   \BabelPatchSection{paragraph}%
+   \BabelPatchSection{subparagraph}%
+   \def\babel at toc#1{%
+     \select at language@x{\bbl at main@language}}}{}
+\IfBabelLayout{captions}%
+  {\BabelPatchSection{caption}}{}
+\bbl at trace{Input engine specific macros}
+\ifcase\bbl at engine
+  \input txtbabel.def
+\or
+  \input luababel.def
+\or
+  \input xebabel.def
+\fi
+\bbl at trace{Creating languages and reading ini files}
+\let\bbl at extend@ini\@gobble
+\newcommand\babelprovide[2][]{%
+  \let\bbl at savelangname\languagename
+  \edef\bbl at savelocaleid{\the\localeid}%
+  % Set name and locale id
+  \edef\languagename{#2}%
+  \bbl at id@assign
+  % Initialize keys
+  \let\bbl at KVP@captions\@nil
+  \let\bbl at KVP@date\@nil
+  \let\bbl at KVP@import\@nil
+  \let\bbl at KVP@main\@nil
+  \let\bbl at KVP@script\@nil
+  \let\bbl at KVP@language\@nil
+  \let\bbl at KVP@hyphenrules\@nil
+  \let\bbl at KVP@linebreaking\@nil
+  \let\bbl at KVP@justification\@nil
+  \let\bbl at KVP@mapfont\@nil
+  \let\bbl at KVP@maparabic\@nil
+  \let\bbl at KVP@mapdigits\@nil
+  \let\bbl at KVP@intraspace\@nil
+  \let\bbl at KVP@intrapenalty\@nil
+  \let\bbl at KVP@onchar\@nil
+  \let\bbl at KVP@transforms\@nil
+  \global\let\bbl at release@transforms\@empty
+  \let\bbl at KVP@alph\@nil
+  \let\bbl at KVP@Alph\@nil
+  \let\bbl at KVP@labels\@nil
+  \bbl at csarg\let{KVP at labels*}\@nil
+  \global\let\bbl at inidata\@empty
+  \global\let\bbl at extend@ini\@gobble
+  \gdef\bbl at key@list{;}%
+  \bbl at forkv{#1}{%  TODO - error handling
+    \in@{/}{##1}%
+    \ifin@
+      \global\let\bbl at extend@ini\bbl at extend@ini at aux
+      \bbl at renewinikey##1\@@{##2}%
+    \else
+      \bbl at csarg\def{KVP@##1}{##2}%
+    \fi}%
+  \chardef\bbl at howloaded=% 0:none; 1:ldf without ini; 2:ini
+    \bbl at ifunset{date#2}\z@{\bbl at ifunset{bbl at llevel@#2}\@ne\tw@}%
+  % == init ==
+  \ifx\bbl at screset\@undefined
+    \bbl at ldfinit
+  \fi
+  % ==
+  \let\bbl at lbkflag\relax % \@empty = do setup linebreak
+  \ifcase\bbl at howloaded
+    \let\bbl at lbkflag\@empty % new
+  \else
+    \ifx\bbl at KVP@hyphenrules\@nil\else
+       \let\bbl at lbkflag\@empty
+    \fi
+    \ifx\bbl at KVP@import\@nil\else
+      \let\bbl at lbkflag\@empty
+    \fi
+  \fi
+  % == import, captions ==
+  \ifx\bbl at KVP@import\@nil\else
+    \bbl at exp{\\\bbl at ifblank{\bbl at KVP@import}}%
+      {\ifx\bbl at initoload\relax
+         \begingroup
+           \def\BabelBeforeIni##1##2{\gdef\bbl at KVP@import{##1}\endinput}%
+           \bbl at input@texini{#2}%
+         \endgroup
+       \else
+         \xdef\bbl at KVP@import{\bbl at initoload}%
+       \fi}%
+      {}%
+  \fi
+  \ifx\bbl at KVP@captions\@nil
+    \let\bbl at KVP@captions\bbl at KVP@import
+  \fi
+  % ==
+  \ifx\bbl at KVP@transforms\@nil\else
+    \bbl at replace\bbl at KVP@transforms{ }{,}%
+  \fi
+  % == Load ini ==
+  \ifcase\bbl at howloaded
+    \bbl at provide@new{#2}%
+  \else
+    \bbl at ifblank{#1}%
+      {}%  With \bbl at load@basic below
+      {\bbl at provide@renew{#2}}%
+  \fi
+  % Post tasks
+  % ----------
+  % == subsequent calls after the first provide for a locale ==
+  \ifx\bbl at inidata\@empty\else
+    \bbl at extend@ini{#2}%
+  \fi
+  % == ensure captions ==
+  \ifx\bbl at KVP@captions\@nil\else
+    \bbl at ifunset{bbl at extracaps@#2}%
+      {\bbl at exp{\\\babelensure[exclude=\\\today]{#2}}}%
+      {\bbl at exp{\\\babelensure[exclude=\\\today,
+                include=\[bbl at extracaps@#2]}]{#2}}%
+    \bbl at ifunset{bbl at ensure@\languagename}%
+      {\bbl at exp{%
+        \\\DeclareRobustCommand\<bbl at ensure@\languagename>[1]{%
+          \\\foreignlanguage{\languagename}%
+          {####1}}}}%
+      {}%
+    \bbl at exp{%
+       \\\bbl at toglobal\<bbl at ensure@\languagename>%
+       \\\bbl at toglobal\<bbl at ensure@\languagename\space>}%
+  \fi
+  % ==
+  % At this point all parameters are defined if 'import'. Now we
+  % execute some code depending on them. But what about if nothing was
+  % imported? We just set the basic parameters, but still loading the
+  % whole ini file.
+  \bbl at load@basic{#2}%
+  % == script, language ==
+  % Override the values from ini or defines them
+  \ifx\bbl at KVP@script\@nil\else
+    \bbl at csarg\edef{sname@#2}{\bbl at KVP@script}%
+  \fi
+  \ifx\bbl at KVP@language\@nil\else
+    \bbl at csarg\edef{lname@#2}{\bbl at KVP@language}%
+  \fi
+   % == onchar ==
+  \ifx\bbl at KVP@onchar\@nil\else
+    \bbl at luahyphenate
+    \directlua{
+      if Babel.locale_mapped == nil then
+        Babel.locale_mapped = true
+        Babel.linebreaking.add_before(Babel.locale_map)
+        Babel.loc_to_scr = {}
+        Babel.chr_to_loc = Babel.chr_to_loc or {}
+      end}%
+    \bbl at xin@{ ids }{ \bbl at KVP@onchar\space}%
+    \ifin@
+      \ifx\bbl at starthyphens\@undefined % Needed if no explicit selection
+        \AddBabelHook{babel-onchar}{beforestart}{{\bbl at starthyphens}}%
+      \fi
+      \bbl at exp{\\\bbl at add\\\bbl at starthyphens
+        {\\\bbl at patterns@lua{\languagename}}}%
+      % TODO - error/warning if no script
+      \directlua{
+        if Babel.script_blocks['\bbl at cl{sbcp}'] then
+          Babel.loc_to_scr[\the\localeid] =
+            Babel.script_blocks['\bbl at cl{sbcp}']
+          Babel.locale_props[\the\localeid].lc = \the\localeid\space
+          Babel.locale_props[\the\localeid].lg = \the\@nameuse{l@\languagename}\space
+        end
+      }%
+    \fi
+    \bbl at xin@{ fonts }{ \bbl at KVP@onchar\space}%
+    \ifin@
+      \bbl at ifunset{bbl at lsys@\languagename}{\bbl at provide@lsys{\languagename}}{}%
+      \bbl at ifunset{bbl at wdir@\languagename}{\bbl at provide@dirs{\languagename}}{}%
+      \directlua{
+        if Babel.script_blocks['\bbl at cl{sbcp}'] then
+          Babel.loc_to_scr[\the\localeid] =
+            Babel.script_blocks['\bbl at cl{sbcp}']
+        end}%
+      \ifx\bbl at mapselect\@undefined  % TODO. almost the same as mapfont
+        \AtBeginDocument{%
+          \bbl at patchfont{{\bbl at mapselect}}%
+          {\selectfont}}%
+        \def\bbl at mapselect{%
+          \let\bbl at mapselect\relax
+          \edef\bbl at prefontid{\fontid\font}}%
+        \def\bbl at mapdir##1{%
+          {\def\languagename{##1}%
+           \let\bbl at ifrestoring\@firstoftwo % To avoid font warning
+           \bbl at switchfont
+           \directlua{
+             Babel.locale_props[\the\csname bbl at id@@##1\endcsname]%
+                     ['/\bbl at prefontid'] = \fontid\font\space}}}%
+      \fi
+      \bbl at exp{\\\bbl at add\\\bbl at mapselect{\\\bbl at mapdir{\languagename}}}%
+    \fi
+    % TODO - catch non-valid values
+  \fi
+  % == mapfont ==
+  % For bidi texts, to switch the font based on direction
+  \ifx\bbl at KVP@mapfont\@nil\else
+    \bbl at ifsamestring{\bbl at KVP@mapfont}{direction}{}%
+      {\bbl at error{Option '\bbl at KVP@mapfont' unknown for\\%
+                  mapfont. Use 'direction'.%
+                 {See the manual for details.}}}%
+    \bbl at ifunset{bbl at lsys@\languagename}{\bbl at provide@lsys{\languagename}}{}%
+    \bbl at ifunset{bbl at wdir@\languagename}{\bbl at provide@dirs{\languagename}}{}%
+    \ifx\bbl at mapselect\@undefined % TODO. See onchar.
+      \AtBeginDocument{%
+        \bbl at patchfont{{\bbl at mapselect}}%
+        {\selectfont}}%
+      \def\bbl at mapselect{%
+        \let\bbl at mapselect\relax
+        \edef\bbl at prefontid{\fontid\font}}%
+      \def\bbl at mapdir##1{%
+        {\def\languagename{##1}%
+         \let\bbl at ifrestoring\@firstoftwo % avoid font warning
+         \bbl at switchfont
+         \directlua{Babel.fontmap
+           [\the\csname bbl at wdir@##1\endcsname]%
+           [\bbl at prefontid]=\fontid\font}}}%
+    \fi
+    \bbl at exp{\\\bbl at add\\\bbl at mapselect{\\\bbl at mapdir{\languagename}}}%
+  \fi
+  % == Line breaking: intraspace, intrapenalty ==
+  % For CJK, East Asian, Southeast Asian, if interspace in ini
+  \ifx\bbl at KVP@intraspace\@nil\else % We can override the ini or set
+    \bbl at csarg\edef{intsp@#2}{\bbl at KVP@intraspace}%
+  \fi
+  \bbl at provide@intraspace
+  % == Line breaking: CJK quotes ==
+  \ifcase\bbl at engine\or
+    \bbl at xin@{/c}{/\bbl at cl{lnbrk}}%
+    \ifin@
+      \bbl at ifunset{bbl at quote@\languagename}{}%
+        {\directlua{
+           Babel.locale_props[\the\localeid].cjk_quotes = {}
+           local cs = 'op'
+           for c in string.utfvalues(%
+               [[\csname bbl at quote@\languagename\endcsname]]) do
+             if Babel.cjk_characters[c].c == 'qu' then
+               Babel.locale_props[\the\localeid].cjk_quotes[c] = cs
+             end
+             cs = ( cs == 'op') and 'cl' or 'op'
+           end
+        }}%
+    \fi
+  \fi
+  % == Line breaking: justification ==
+  \ifx\bbl at KVP@justification\@nil\else
+     \let\bbl at KVP@linebreaking\bbl at KVP@justification
+  \fi
+  \ifx\bbl at KVP@linebreaking\@nil\else
+    \bbl at xin@{,\bbl at KVP@linebreaking,}{,elongated,kashida,cjk,unhyphenated,}%
+    \ifin@
+      \bbl at csarg\xdef
+        {lnbrk@\languagename}{\expandafter\@car\bbl at KVP@linebreaking\@nil}%
+    \fi
+  \fi
+  \bbl at xin@{/e}{/\bbl at cl{lnbrk}}%
+  \ifin@\else\bbl at xin@{/k}{/\bbl at cl{lnbrk}}\fi
+  \ifin@\bbl at arabicjust\fi
+  % == Line breaking: hyphenate.other.(locale|script) ==
+  \ifx\bbl at lbkflag\@empty
+    \bbl at ifunset{bbl at hyotl@\languagename}{}%
+      {\bbl at csarg\bbl at replace{hyotl@\languagename}{ }{,}%
+       \bbl at startcommands*{\languagename}{}%
+         \bbl at csarg\bbl at foreach{hyotl@\languagename}{%
+           \ifcase\bbl at engine
+             \ifnum##1<257
+               \SetHyphenMap{\BabelLower{##1}{##1}}%
+             \fi
+           \else
+             \SetHyphenMap{\BabelLower{##1}{##1}}%
+           \fi}%
+       \bbl at endcommands}%
+    \bbl at ifunset{bbl at hyots@\languagename}{}%
+      {\bbl at csarg\bbl at replace{hyots@\languagename}{ }{,}%
+       \bbl at csarg\bbl at foreach{hyots@\languagename}{%
+         \ifcase\bbl at engine
+           \ifnum##1<257
+             \global\lccode##1=##1\relax
+           \fi
+         \else
+           \global\lccode##1=##1\relax
+         \fi}}%
+  \fi
+  % == Counters: maparabic ==
+  % Native digits, if provided in ini (TeX level, xe and lua)
+  \ifcase\bbl at engine\else
+    \bbl at ifunset{bbl at dgnat@\languagename}{}%
+      {\expandafter\ifx\csname bbl at dgnat@\languagename\endcsname\@empty\else
+        \expandafter\expandafter\expandafter
+        \bbl at setdigits\csname bbl at dgnat@\languagename\endcsname
+        \ifx\bbl at KVP@maparabic\@nil\else
+          \ifx\bbl at latinarabic\@undefined
+            \expandafter\let\expandafter\@arabic
+              \csname bbl at counter@\languagename\endcsname
+          \else    % ie, if layout=counters, which redefines \@arabic
+            \expandafter\let\expandafter\bbl at latinarabic
+              \csname bbl at counter@\languagename\endcsname
+          \fi
+        \fi
+      \fi}%
+  \fi
+  % == Counters: mapdigits ==
+  % Native digits (lua level).
+  \ifodd\bbl at engine
+    \ifx\bbl at KVP@mapdigits\@nil\else
+      \bbl at ifunset{bbl at dgnat@\languagename}{}%
+        {\RequirePackage{luatexbase}%
+         \bbl at activate@preotf
+         \directlua{
+           Babel = Babel or {}  %%% -> presets in luababel
+           Babel.digits_mapped = true
+           Babel.digits = Babel.digits or {}
+           Babel.digits[\the\localeid] =
+             table.pack(string.utfvalue('\bbl at cl{dgnat}'))
+           if not Babel.numbers then
+             function Babel.numbers(head)
+               local LOCALE = Babel.attr_locale
+               local GLYPH = node.id'glyph'
+               local inmath = false
+               for item in node.traverse(head) do
+                 if not inmath and item.id == GLYPH then
+                   local temp = node.get_attribute(item, LOCALE)
+                   if Babel.digits[temp] then
+                     local chr = item.char
+                     if chr > 47 and chr < 58 then
+                       item.char = Babel.digits[temp][chr-47]
+                     end
+                   end
+                 elseif item.id == node.id'math' then
+                   inmath = (item.subtype == 0)
+                 end
+               end
+               return head
+             end
+           end
+        }}%
+    \fi
+  \fi
+  % == Counters: alph, Alph ==
+  % What if extras<lang> contains a \babel at save\@alph? It won't be
+  % restored correctly when exiting the language, so we ignore
+  % this change with the \bbl at alph@saved trick.
+  \ifx\bbl at KVP@alph\@nil\else
+    \bbl at extras@wrap{\\\bbl at alph@saved}%
+      {\let\bbl at alph@saved\@alph}%
+      {\let\@alph\bbl at alph@saved
+       \babel at save\@alph}%
+    \bbl at exp{%
+      \\\bbl at add\<extras\languagename>{%
+        \let\\\@alph\<bbl at cntr@\bbl at KVP@alph @\languagename>}}%
+  \fi
+  \ifx\bbl at KVP@Alph\@nil\else
+    \bbl at extras@wrap{\\\bbl at Alph@saved}%
+      {\let\bbl at Alph@saved\@Alph}%
+      {\let\@Alph\bbl at Alph@saved
+       \babel at save\@Alph}%
+    \bbl at exp{%
+      \\\bbl at add\<extras\languagename>{%
+        \let\\\@Alph\<bbl at cntr@\bbl at KVP@Alph @\languagename>}}%
+  \fi
+  % == require.babel in ini ==
+  % To load or reaload the babel-*.tex, if require.babel in ini
+  \ifx\bbl at beforestart\relax\else  % But not in doc aux or body
+    \bbl at ifunset{bbl at rqtex@\languagename}{}%
+      {\expandafter\ifx\csname bbl at rqtex@\languagename\endcsname\@empty\else
+         \let\BabelBeforeIni\@gobbletwo
+         \chardef\atcatcode=\catcode`\@
+         \catcode`\@=11\relax
+         \bbl at input@texini{\bbl at cs{rqtex@\languagename}}%
+         \catcode`\@=\atcatcode
+         \let\atcatcode\relax
+         \global\bbl at csarg\let{rqtex@\languagename}\relax
+       \fi}%
+  \fi
+  % == frenchspacing ==
+  \ifcase\bbl at howloaded\in at true\else\in at false\fi
+  \ifin@\else\bbl at xin@{typography/frenchspacing}{\bbl at key@list}\fi
+  \ifin@
+    \bbl at extras@wrap{\\\bbl at pre@fs}%
+      {\bbl at pre@fs}%
+      {\bbl at post@fs}%
+  \fi
+  % == Release saved transforms ==
+  \bbl at release@transforms\relax % \relax closes the last item.
+  % == main ==
+  \ifx\bbl at KVP@main\@nil  % Restore only if not 'main'
+    \let\languagename\bbl at savelangname
+    \chardef\localeid\bbl at savelocaleid\relax
+  \fi}
+\def\bbl at provide@new#1{%
+  \@namedef{date#1}{}% marks lang exists - required by \StartBabelCommands
+  \@namedef{extras#1}{}%
+  \@namedef{noextras#1}{}%
+  \bbl at startcommands*{#1}{captions}%
+    \ifx\bbl at KVP@captions\@nil %      and also if import, implicit
+      \def\bbl at tempb##1{%             elt for \bbl at captionslist
+        \ifx##1\@empty\else
+          \bbl at exp{%
+            \\\SetString\\##1{%
+              \\\bbl at nocaption{\bbl at stripslash##1}{#1\bbl at stripslash##1}}}%
+          \expandafter\bbl at tempb
+        \fi}%
+      \expandafter\bbl at tempb\bbl at captionslist\@empty
+    \else
+      \ifx\bbl at initoload\relax
+        \bbl at read@ini{\bbl at KVP@captions}2%  % Here letters cat = 11
+      \else
+        \bbl at read@ini{\bbl at initoload}2%     % Same
+      \fi
+    \fi
+  \StartBabelCommands*{#1}{date}%
+    \ifx\bbl at KVP@import\@nil
+      \bbl at exp{%
+        \\\SetString\\\today{\\\bbl at nocaption{today}{#1today}}}%
+    \else
+      \bbl at savetoday
+      \bbl at savedate
+    \fi
+  \bbl at endcommands
+  \bbl at load@basic{#1}%
+  % == hyphenmins == (only if new)
+  \bbl at exp{%
+    \gdef\<#1hyphenmins>{%
+      {\bbl at ifunset{bbl at lfthm@#1}{2}{\bbl at cs{lfthm@#1}}}%
+      {\bbl at ifunset{bbl at rgthm@#1}{3}{\bbl at cs{rgthm@#1}}}}}%
+  % == hyphenrules (also in renew) ==
+  \bbl at provide@hyphens{#1}%
+  \ifx\bbl at KVP@main\@nil\else
+     \expandafter\main at language\expandafter{#1}%
+  \fi}
+\def\bbl at provide@renew#1{%
+  \ifx\bbl at KVP@captions\@nil\else
+    \StartBabelCommands*{#1}{captions}%
+      \bbl at read@ini{\bbl at KVP@captions}2%   % Here all letters cat = 11
+    \EndBabelCommands
+  \fi
+  \ifx\bbl at KVP@import\@nil\else
+    \StartBabelCommands*{#1}{date}%
+      \bbl at savetoday
+      \bbl at savedate
+    \EndBabelCommands
+  \fi
+  % == hyphenrules (also in new) ==
+  \ifx\bbl at lbkflag\@empty
+    \bbl at provide@hyphens{#1}%
+  \fi}
+\def\bbl at load@basic#1{%
+  \ifcase\bbl at howloaded\or\or
+    \ifcase\csname bbl at llevel@\languagename\endcsname
+      \bbl at csarg\let{lname@\languagename}\relax
+    \fi
+  \fi
+  \bbl at ifunset{bbl at lname@#1}%
+    {\def\BabelBeforeIni##1##2{%
+       \begingroup
+         \let\bbl at ini@captions at aux\@gobbletwo
+         \def\bbl at inidate ####1.####2.####3.####4\relax ####5####6{}%
+         \bbl at read@ini{##1}1%
+         \ifx\bbl at initoload\relax\endinput\fi
+       \endgroup}%
+     \begingroup       % boxed, to avoid extra spaces:
+       \ifx\bbl at initoload\relax
+         \bbl at input@texini{#1}%
+       \else
+         \setbox\z@\hbox{\BabelBeforeIni{\bbl at initoload}{}}%
+       \fi
+     \endgroup}%
+    {}}
+\def\bbl at provide@hyphens#1{%
+  \let\bbl at tempa\relax
+  \ifx\bbl at KVP@hyphenrules\@nil\else
+    \bbl at replace\bbl at KVP@hyphenrules{ }{,}%
+    \bbl at foreach\bbl at KVP@hyphenrules{%
+      \ifx\bbl at tempa\relax    %  if not yet found
+        \bbl at ifsamestring{##1}{+}%
+          {{\bbl at exp{\\\addlanguage\<l@##1>}}}%
+          {}%
+        \bbl at ifunset{l@##1}%
+          {}%
+          {\bbl at exp{\let\bbl at tempa\<l@##1>}}%
+      \fi}%
+  \fi
+  \ifx\bbl at tempa\relax %         if no opt or no language in opt found
+    \ifx\bbl at KVP@import\@nil
+      \ifx\bbl at initoload\relax\else
+        \bbl at exp{%               and hyphenrules is not empty
+          \\\bbl at ifblank{\bbl at cs{hyphr@#1}}%
+            {}%
+            {\let\\\bbl at tempa\<l@\bbl at cl{hyphr}>}}%
+      \fi
+    \else % if importing
+      \bbl at exp{%                    and hyphenrules is not empty
+        \\\bbl at ifblank{\bbl at cs{hyphr@#1}}%
+          {}%
+          {\let\\\bbl at tempa\<l@\bbl at cl{hyphr}>}}%
+    \fi
+  \fi
+  \bbl at ifunset{bbl at tempa}%       ie, relax or undefined
+    {\bbl at ifunset{l@#1}%         no hyphenrules found - fallback
+       {\bbl at exp{\\\adddialect\<l@#1>\language}}%
+       {}}%                      so, l@<lang> is ok - nothing to do
+    {\bbl at exp{\\\adddialect\<l@#1>\bbl at tempa}}}% found in opt list or ini
+\def\bbl at input@texini#1{%
+  \bbl at bsphack
+    \bbl at exp{%
+      \catcode`\\\%=14 \catcode`\\\\=0
+      \catcode`\\\{=1  \catcode`\\\}=2
+      \lowercase{\\\InputIfFileExists{babel-#1.tex}{}{}}%
+      \catcode`\\\%=\the\catcode`\%\relax
+      \catcode`\\\\=\the\catcode`\\\relax
+      \catcode`\\\{=\the\catcode`\{\relax
+      \catcode`\\\}=\the\catcode`\}\relax}%
+  \bbl at esphack}
+\def\bbl at iniline#1\bbl at iniline{%
+  \@ifnextchar[\bbl at inisect{\@ifnextchar;\bbl at iniskip\bbl at inistore}#1\@@}% ]
+\def\bbl at inisect[#1]#2\@@{\def\bbl at section{#1}}
+\def\bbl at iniskip#1\@@{}%      if starts with ;
+\def\bbl at inistore#1=#2\@@{%      full (default)
+  \bbl at trim@def\bbl at tempa{#1}%
+  \bbl at trim\toks@{#2}%
+  \bbl at xin@{;\bbl at section/\bbl at tempa;}{\bbl at key@list}%
+  \ifin@\else
+    \bbl at exp{%
+      \\\g at addto@macro\\\bbl at inidata{%
+        \\\bbl at elt{\bbl at section}{\bbl at tempa}{\the\toks@}}}%
+  \fi}
+\def\bbl at inistore@min#1=#2\@@{%  minimal (maybe set in \bbl at read@ini)
+  \bbl at trim@def\bbl at tempa{#1}%
+  \bbl at trim\toks@{#2}%
+  \bbl at xin@{.identification.}{.\bbl at section.}%
+  \ifin@
+    \bbl at exp{\\\g at addto@macro\\\bbl at inidata{%
+      \\\bbl at elt{identification}{\bbl at tempa}{\the\toks@}}}%
+  \fi}
+\ifx\bbl at readstream\@undefined
+  \csname newread\endcsname\bbl at readstream
+\fi
+\def\bbl at read@ini#1#2{%
+  \global\let\bbl at extend@ini\@gobble
+  \openin\bbl at readstream=babel-#1.ini
+  \ifeof\bbl at readstream
+    \bbl at error
+      {There is no ini file for the requested language\\%
+       (#1). Perhaps you misspelled it or your installation\\%
+       is not complete.}%
+      {Fix the name or reinstall babel.}%
+  \else
+    % == Store ini data in \bbl at inidata ==
+    \catcode`\[=12 \catcode`\]=12 \catcode`\==12 \catcode`\&=12
+    \catcode`\;=12 \catcode`\|=12 \catcode`\%=14 \catcode`\-=12
+    \bbl at info{Importing
+                \ifcase#2font and identification \or basic \fi
+                 data for \languagename\\%
+              from babel-#1.ini. Reported}%
+    \ifnum#2=\z@
+      \global\let\bbl at inidata\@empty
+      \let\bbl at inistore\bbl at inistore@min    % Remember it's local
+    \fi
+    \def\bbl at section{identification}%
+    \bbl at exp{\\\bbl at inistore tag.ini=#1\\\@@}%
+    \bbl at inistore load.level=#2\@@
+    \loop
+    \if T\ifeof\bbl at readstream F\fi T\relax % Trick, because inside \loop
+      \endlinechar\m at ne
+      \read\bbl at readstream to \bbl at line
+      \endlinechar`\^^M
+      \ifx\bbl at line\@empty\else
+        \expandafter\bbl at iniline\bbl at line\bbl at iniline
+      \fi
+    \repeat
+    % == Process stored data ==
+    \bbl at csarg\xdef{lini@\languagename}{#1}%
+    \bbl at read@ini at aux
+    % == 'Export' data ==
+    \bbl at ini@exports{#2}%
+    \global\bbl at csarg\let{inidata@\languagename}\bbl at inidata
+    \global\let\bbl at inidata\@empty
+    \bbl at exp{\\\bbl at add@list\\\bbl at ini@loaded{\languagename}}%
+    \bbl at toglobal\bbl at ini@loaded
+  \fi}
+\def\bbl at read@ini at aux{%
+  \let\bbl at savestrings\@empty
+  \let\bbl at savetoday\@empty
+  \let\bbl at savedate\@empty
+  \def\bbl at elt##1##2##3{%
+    \def\bbl at section{##1}%
+    \in@{=date.}{=##1}% Find a better place
+    \ifin@
+      \bbl at ini@calendar{##1}%
+    \fi
+    \bbl at ifunset{bbl at inikv@##1}{}%
+      {\csname bbl at inikv@##1\endcsname{##2}{##3}}}%
+  \bbl at inidata}
+\def\bbl at extend@ini at aux#1{%
+  \bbl at startcommands*{#1}{captions}%
+    % Activate captions/... and modify exports
+    \bbl at csarg\def{inikv at captions.licr}##1##2{%
+      \setlocalecaption{#1}{##1}{##2}}%
+    \def\bbl at inikv@captions##1##2{%
+      \bbl at ini@captions at aux{##1}{##2}}%
+    \def\bbl at stringdef##1##2{\gdef##1{##2}}%
+    \def\bbl at exportkey##1##2##3{%
+      \bbl at ifunset{bbl@@kv@##2}{}%
+        {\expandafter\ifx\csname bbl@@kv@##2\endcsname\@empty\else
+           \bbl at exp{\global\let\<bbl@##1@\languagename>\<bbl@@kv@##2>}%
+         \fi}}%
+    % As with \bbl at read@ini, but with some changes
+    \bbl at read@ini at aux
+    \bbl at ini@exports\tw@
+    % Update inidata at lang by pretending the ini is read.
+    \def\bbl at elt##1##2##3{%
+      \def\bbl at section{##1}%
+      \bbl at iniline##2=##3\bbl at iniline}%
+    \csname bbl at inidata@#1\endcsname
+    \global\bbl at csarg\let{inidata@#1}\bbl at inidata
+  \StartBabelCommands*{#1}{date}% And from the import stuff
+    \def\bbl at stringdef##1##2{\gdef##1{##2}}%
+    \bbl at savetoday
+    \bbl at savedate
+  \bbl at endcommands}
+\def\bbl at ini@calendar#1{%
+ \lowercase{\def\bbl at tempa{=#1=}}%
+ \bbl at replace\bbl at tempa{=date.gregorian}{}%
+ \bbl at replace\bbl at tempa{=date.}{}%
+ \in@{.licr=}{#1=}%
+ \ifin@
+   \ifcase\bbl at engine
+     \bbl at replace\bbl at tempa{.licr=}{}%
+   \else
+     \let\bbl at tempa\relax
+   \fi
+ \fi
+ \ifx\bbl at tempa\relax\else
+   \bbl at replace\bbl at tempa{=}{}%
+   \bbl at exp{%
+     \def\<bbl at inikv@#1>####1####2{%
+       \\\bbl at inidate####1...\relax{####2}{\bbl at tempa}}}%
+ \fi}
+\def\bbl at renewinikey#1/#2\@@#3{%
+  \edef\bbl at tempa{\zap at space #1 \@empty}%   section
+  \edef\bbl at tempb{\zap at space #2 \@empty}%   key
+  \bbl at trim\toks@{#3}%                      value
+  \bbl at exp{%
+    \edef\\\bbl at key@list{\bbl at key@list \bbl at tempa/\bbl at tempb;}%
+    \\\g at addto@macro\\\bbl at inidata{%
+       \\\bbl at elt{\bbl at tempa}{\bbl at tempb}{\the\toks@}}}}%
+\def\bbl at exportkey#1#2#3{%
+  \bbl at ifunset{bbl@@kv@#2}%
+    {\bbl at csarg\gdef{#1@\languagename}{#3}}%
+    {\expandafter\ifx\csname bbl@@kv@#2\endcsname\@empty
+       \bbl at csarg\gdef{#1@\languagename}{#3}%
+     \else
+       \bbl at exp{\global\let\<bbl@#1@\languagename>\<bbl@@kv@#2>}%
+     \fi}}
+\def\bbl at iniwarning#1{%
+  \bbl at ifunset{bbl@@kv at identification.warning#1}{}%
+    {\bbl at warning{%
+       From babel-\bbl at cs{lini@\languagename}.ini:\\%
+       \bbl at cs{@kv at identification.warning#1}\\%
+       Reported }}}
+\let\bbl at release@transforms\@empty
+\def\bbl at ini@exports#1{%
+  % Identification always exported
+  \bbl at iniwarning{}%
+  \ifcase\bbl at engine
+    \bbl at iniwarning{.pdflatex}%
+  \or
+    \bbl at iniwarning{.lualatex}%
+  \or
+    \bbl at iniwarning{.xelatex}%
+  \fi%
+  \bbl at exportkey{llevel}{identification.load.level}{}%
+  \bbl at exportkey{elname}{identification.name.english}{}%
+  \bbl at exp{\\\bbl at exportkey{lname}{identification.name.opentype}%
+    {\csname bbl at elname@\languagename\endcsname}}%
+  \bbl at exportkey{tbcp}{identification.tag.bcp47}{}%
+  \bbl at exportkey{lbcp}{identification.language.tag.bcp47}{}%
+  \bbl at exportkey{lotf}{identification.tag.opentype}{dflt}%
+  \bbl at exportkey{esname}{identification.script.name}{}%
+  \bbl at exp{\\\bbl at exportkey{sname}{identification.script.name.opentype}%
+    {\csname bbl at esname@\languagename\endcsname}}%
+  \bbl at exportkey{sbcp}{identification.script.tag.bcp47}{}%
+  \bbl at exportkey{sotf}{identification.script.tag.opentype}{DFLT}%
+  % Also maps bcp47 -> languagename
+  \ifbbl at bcptoname
+    \bbl at csarg\xdef{bcp at map@\bbl at cl{tbcp}}{\languagename}%
+  \fi
+  % Conditional
+  \ifnum#1>\z@         % 0 = only info, 1, 2 = basic, (re)new
+    \bbl at exportkey{lnbrk}{typography.linebreaking}{h}%
+    \bbl at exportkey{hyphr}{typography.hyphenrules}{}%
+    \bbl at exportkey{lfthm}{typography.lefthyphenmin}{2}%
+    \bbl at exportkey{rgthm}{typography.righthyphenmin}{3}%
+    \bbl at exportkey{prehc}{typography.prehyphenchar}{}%
+    \bbl at exportkey{hyotl}{typography.hyphenate.other.locale}{}%
+    \bbl at exportkey{hyots}{typography.hyphenate.other.script}{}%
+    \bbl at exportkey{intsp}{typography.intraspace}{}%
+    \bbl at exportkey{frspc}{typography.frenchspacing}{u}%
+    \bbl at exportkey{chrng}{characters.ranges}{}%
+    \bbl at exportkey{quote}{characters.delimiters.quotes}{}%
+    \bbl at exportkey{dgnat}{numbers.digits.native}{}%
+    \ifnum#1=\tw@           % only (re)new
+      \bbl at exportkey{rqtex}{identification.require.babel}{}%
+      \bbl at toglobal\bbl at savetoday
+      \bbl at toglobal\bbl at savedate
+      \bbl at savestrings
+    \fi
+  \fi}
+\def\bbl at inikv#1#2{%     key=value
+  \toks@{#2}%            This hides #'s from ini values
+  \bbl at csarg\edef{@kv@\bbl at section.#1}{\the\toks@}}
+\let\bbl at inikv@identification\bbl at inikv
+\let\bbl at inikv@typography\bbl at inikv
+\let\bbl at inikv@characters\bbl at inikv
+\let\bbl at inikv@numbers\bbl at inikv
+\def\bbl at inikv@counters#1#2{%
+  \bbl at ifsamestring{#1}{digits}%
+    {\bbl at error{The counter name 'digits' is reserved for mapping\\%
+                decimal digits}%
+               {Use another name.}}%
+    {}%
+  \def\bbl at tempc{#1}%
+  \bbl at trim@def{\bbl at tempb*}{#2}%
+  \in@{.1$}{#1$}%
+  \ifin@
+    \bbl at replace\bbl at tempc{.1}{}%
+    \bbl at csarg\protected at xdef{cntr@\bbl at tempc @\languagename}{%
+      \noexpand\bbl at alphnumeral{\bbl at tempc}}%
+  \fi
+  \in@{.F.}{#1}%
+  \ifin@\else\in@{.S.}{#1}\fi
+  \ifin@
+    \bbl at csarg\protected at xdef{cntr@#1@\languagename}{\bbl at tempb*}%
+  \else
+    \toks@{}% Required by \bbl at buildifcase, which returns \bbl at tempa
+    \expandafter\bbl at buildifcase\bbl at tempb* \\ % Space after \\
+    \bbl at csarg{\global\expandafter\let}{cntr@#1@\languagename}\bbl at tempa
+  \fi}
+\ifcase\bbl at engine
+  \bbl at csarg\def{inikv at captions.licr}#1#2{%
+    \bbl at ini@captions at aux{#1}{#2}}
+\else
+  \def\bbl at inikv@captions#1#2{%
+    \bbl at ini@captions at aux{#1}{#2}}
+\fi
+\def\bbl at ini@captions at template#1#2{% string language tempa=capt-name
+  \bbl at replace\bbl at tempa{.template}{}%
+  \def\bbl at toreplace{#1{}}%
+  \bbl at replace\bbl at toreplace{[ ]}{\nobreakspace{}}%
+  \bbl at replace\bbl at toreplace{[[}{\csname}%
+  \bbl at replace\bbl at toreplace{[}{\csname the}%
+  \bbl at replace\bbl at toreplace{]]}{name\endcsname{}}%
+  \bbl at replace\bbl at toreplace{]}{\endcsname{}}%
+  \bbl at xin@{,\bbl at tempa,}{,chapter,appendix,part,}%
+  \ifin@
+    \@nameuse{bbl at patch\bbl at tempa}%
+    \global\bbl at csarg\let{\bbl at tempa fmt@#2}\bbl at toreplace
+  \fi
+  \bbl at xin@{,\bbl at tempa,}{,figure,table,}%
+  \ifin@
+    \toks@\expandafter{\bbl at toreplace}%
+    \bbl at exp{\gdef\<fnum@\bbl at tempa>{\the\toks@}}%
+  \fi}
+\def\bbl at ini@captions at aux#1#2{%
+  \bbl at trim@def\bbl at tempa{#1}%
+  \bbl at xin@{.template}{\bbl at tempa}%
+  \ifin@
+    \bbl at ini@captions at template{#2}\languagename
+  \else
+    \bbl at ifblank{#2}%
+      {\bbl at exp{%
+         \toks@{\\\bbl at nocaption{\bbl at tempa}{\languagename\bbl at tempa name}}}}%
+      {\bbl at trim\toks@{#2}}%
+    \bbl at exp{%
+      \\\bbl at add\\\bbl at savestrings{%
+        \\\SetString\<\bbl at tempa name>{\the\toks@}}}%
+    \toks@\expandafter{\bbl at captionslist}%
+    \bbl at exp{\\\in@{\<\bbl at tempa name>}{\the\toks@}}%
+    \ifin@\else
+      \bbl at exp{%
+        \\\bbl at add\<bbl at extracaps@\languagename>{\<\bbl at tempa name>}%
+        \\\bbl at toglobal\<bbl at extracaps@\languagename>}%
+    \fi
+  \fi}
+\def\bbl at list@the{%
+  part,chapter,section,subsection,subsubsection,paragraph,%
+  subparagraph,enumi,enumii,enumiii,enumiv,equation,figure,%
+  table,page,footnote,mpfootnote,mpfn}
+\def\bbl at map@cnt#1{%  #1:roman,etc, // #2:enumi,etc
+  \bbl at ifunset{bbl at map@#1@\languagename}%
+    {\@nameuse{#1}}%
+    {\@nameuse{bbl at map@#1@\languagename}}}
+\def\bbl at inikv@labels#1#2{%
+  \in@{.map}{#1}%
+  \ifin@
+    \ifx\bbl at KVP@labels\@nil\else
+      \bbl at xin@{ map }{ \bbl at KVP@labels\space}%
+      \ifin@
+        \def\bbl at tempc{#1}%
+        \bbl at replace\bbl at tempc{.map}{}%
+        \in@{,#2,}{,arabic,roman,Roman,alph,Alph,fnsymbol,}%
+        \bbl at exp{%
+          \gdef\<bbl at map@\bbl at tempc @\languagename>%
+            {\ifin@\<#2>\else\\\localecounter{#2}\fi}}%
+        \bbl at foreach\bbl at list@the{%
+          \bbl at ifunset{the##1}{}%
+            {\bbl at exp{\let\\\bbl at tempd\<the##1>}%
+             \bbl at exp{%
+               \\\bbl at sreplace\<the##1>%
+                 {\<\bbl at tempc>{##1}}{\\\bbl at map@cnt{\bbl at tempc}{##1}}%
+               \\\bbl at sreplace\<the##1>%
+                 {\<\@empty @\bbl at tempc>\<c@##1>}{\\\bbl at map@cnt{\bbl at tempc}{##1}}}%
+             \expandafter\ifx\csname the##1\endcsname\bbl at tempd\else
+               \toks@\expandafter\expandafter\expandafter{%
+                 \csname the##1\endcsname}%
+               \expandafter\xdef\csname the##1\endcsname{{\the\toks@}}%
+             \fi}}%
+      \fi
+    \fi
+  %
+  \else
+    %
+    % The following code is still under study. You can test it and make
+    % suggestions. Eg, enumerate.2 = ([enumi]).([enumii]). It's
+    % language dependent.
+    \in@{enumerate.}{#1}%
+    \ifin@
+      \def\bbl at tempa{#1}%
+      \bbl at replace\bbl at tempa{enumerate.}{}%
+      \def\bbl at toreplace{#2}%
+      \bbl at replace\bbl at toreplace{[ ]}{\nobreakspace{}}%
+      \bbl at replace\bbl at toreplace{[}{\csname the}%
+      \bbl at replace\bbl at toreplace{]}{\endcsname{}}%
+      \toks@\expandafter{\bbl at toreplace}%
+      % TODO. Execute only once:
+      \bbl at exp{%
+        \\\bbl at add\<extras\languagename>{%
+          \\\babel at save\<labelenum\romannumeral\bbl at tempa>%
+          \def\<labelenum\romannumeral\bbl at tempa>{\the\toks@}}%
+        \\\bbl at toglobal\<extras\languagename>}%
+    \fi
+  \fi}
+\def\bbl at chaptype{chapter}
+\ifx\@makechapterhead\@undefined
+  \let\bbl at patchchapter\relax
+\else\ifx\thechapter\@undefined
+  \let\bbl at patchchapter\relax
+\else\ifx\ps at headings\@undefined
+  \let\bbl at patchchapter\relax
+\else
+  \def\bbl at patchchapter{%
+    \global\let\bbl at patchchapter\relax
+    \gdef\bbl at chfmt{%
+      \bbl at ifunset{bbl@\bbl at chaptype fmt@\languagename}%
+        {\@chapapp\space\thechapter}
+        {\@nameuse{bbl@\bbl at chaptype fmt@\languagename}}}
+    \bbl at add\appendix{\def\bbl at chaptype{appendix}}% Not harmful, I hope
+    \bbl at sreplace\ps at headings{\@chapapp\ \thechapter}{\bbl at chfmt}%
+    \bbl at sreplace\chaptermark{\@chapapp\ \thechapter}{\bbl at chfmt}%
+    \bbl at sreplace\@makechapterhead{\@chapapp\space\thechapter}{\bbl at chfmt}%
+    \bbl at toglobal\appendix
+    \bbl at toglobal\ps at headings
+    \bbl at toglobal\chaptermark
+    \bbl at toglobal\@makechapterhead}
+  \let\bbl at patchappendix\bbl at patchchapter
+\fi\fi\fi
+\ifx\@part\@undefined
+  \let\bbl at patchpart\relax
+\else
+  \def\bbl at patchpart{%
+    \global\let\bbl at patchpart\relax
+    \gdef\bbl at partformat{%
+      \bbl at ifunset{bbl at partfmt@\languagename}%
+        {\partname\nobreakspace\thepart}
+        {\@nameuse{bbl at partfmt@\languagename}}}
+    \bbl at sreplace\@part{\partname\nobreakspace\thepart}{\bbl at partformat}%
+    \bbl at toglobal\@part}
+\fi
+\let\bbl at calendar\@empty
+\DeclareRobustCommand\localedate[1][]{\bbl at localedate{#1}}
+\def\bbl at localedate#1#2#3#4{%
+  \begingroup
+    \ifx\@empty#1\@empty\else
+      \let\bbl at ld@calendar\@empty
+      \let\bbl at ld@variant\@empty
+      \edef\bbl at tempa{\zap at space#1 \@empty}%
+      \def\bbl at tempb##1=##2\@@{\@namedef{bbl at ld@##1}{##2}}%
+      \bbl at foreach\bbl at tempa{\bbl at tempb##1\@@}%
+      \edef\bbl at calendar{%
+        \bbl at ld@calendar
+        \ifx\bbl at ld@variant\@empty\else
+          .\bbl at ld@variant
+        \fi}%
+      \bbl at replace\bbl at calendar{gregorian}{}%
+    \fi
+    \bbl at cased
+      {\@nameuse{bbl at date@\languagename @\bbl at calendar}{#2}{#3}{#4}}%
+  \endgroup}
+\def\bbl at inidate#1.#2.#3.#4\relax#5#6{% TODO - ignore with 'captions'
+  \bbl at trim@def\bbl at tempa{#1.#2}%
+  \bbl at ifsamestring{\bbl at tempa}{months.wide}%      to savedate
+    {\bbl at trim@def\bbl at tempa{#3}%
+     \bbl at trim\toks@{#5}%
+     \@temptokena\expandafter{\bbl at savedate}%
+     \bbl at exp{%   Reverse order - in ini last wins
+       \def\\\bbl at savedate{%
+         \\\SetString\<month\romannumeral\bbl at tempa#6name>{\the\toks@}%
+         \the\@temptokena}}}%
+    {\bbl at ifsamestring{\bbl at tempa}{date.long}%     defined now
+      {\lowercase{\def\bbl at tempb{#6}}%
+       \bbl at trim@def\bbl at toreplace{#5}%
+       \bbl at TG@@date
+       \bbl at ifunset{bbl at date@\languagename @}%
+         {\bbl at exp{% TODO. Move to a better place.
+            \gdef\<\languagename date>{\\\protect\<\languagename date >}%
+            \gdef\<\languagename date >####1####2####3{%
+              \\\bbl at usedategrouptrue
+              \<bbl at ensure@\languagename>{%
+                \\\localedate{####1}{####2}{####3}}}%
+            \\\bbl at add\\\bbl at savetoday{%
+              \\\SetString\\\today{%
+                \<\languagename date>%
+                   {\\\the\year}{\\\the\month}{\\\the\day}}}}}%
+         {}%
+       \global\bbl at csarg\let{date@\languagename @}\bbl at toreplace
+       \ifx\bbl at tempb\@empty\else
+         \global\bbl at csarg\let{date@\languagename @\bbl at tempb}\bbl at toreplace
+       \fi}%
+      {}}}
+\let\bbl at calendar\@empty
+\newcommand\BabelDateSpace{\nobreakspace}
+\newcommand\BabelDateDot{.\@}  % TODO. \let instead of repeating
+\newcommand\BabelDated[1]{{\number#1}}
+\newcommand\BabelDatedd[1]{{\ifnum#1<10 0\fi\number#1}}
+\newcommand\BabelDateM[1]{{\number#1}}
+\newcommand\BabelDateMM[1]{{\ifnum#1<10 0\fi\number#1}}
+\newcommand\BabelDateMMMM[1]{{%
+  \csname month\romannumeral#1\bbl at calendar name\endcsname}}%
+\newcommand\BabelDatey[1]{{\number#1}}%
+\newcommand\BabelDateyy[1]{{%
+  \ifnum#1<10 0\number#1 %
+  \else\ifnum#1<100 \number#1 %
+  \else\ifnum#1<1000 \expandafter\@gobble\number#1 %
+  \else\ifnum#1<10000 \expandafter\@gobbletwo\number#1 %
+  \else
+    \bbl at error
+      {Currently two-digit years are restricted to the\\
+       range 0-9999.}%
+      {There is little you can do. Sorry.}%
+  \fi\fi\fi\fi}}
+\newcommand\BabelDateyyyy[1]{{\number#1}} % TODO - add leading 0
+\def\bbl at replace@finish at iii#1{%
+  \bbl at exp{\def\\#1####1####2####3{\the\toks@}}}
+\def\bbl at TG@@date{%
+  \bbl at replace\bbl at toreplace{[ ]}{\BabelDateSpace{}}%
+  \bbl at replace\bbl at toreplace{[.]}{\BabelDateDot{}}%
+  \bbl at replace\bbl at toreplace{[d]}{\BabelDated{####3}}%
+  \bbl at replace\bbl at toreplace{[dd]}{\BabelDatedd{####3}}%
+  \bbl at replace\bbl at toreplace{[M]}{\BabelDateM{####2}}%
+  \bbl at replace\bbl at toreplace{[MM]}{\BabelDateMM{####2}}%
+  \bbl at replace\bbl at toreplace{[MMMM]}{\BabelDateMMMM{####2}}%
+  \bbl at replace\bbl at toreplace{[y]}{\BabelDatey{####1}}%
+  \bbl at replace\bbl at toreplace{[yy]}{\BabelDateyy{####1}}%
+  \bbl at replace\bbl at toreplace{[yyyy]}{\BabelDateyyyy{####1}}%
+  \bbl at replace\bbl at toreplace{[y|}{\bbl at datecntr[####1|}%
+  \bbl at replace\bbl at toreplace{[m|}{\bbl at datecntr[####2|}%
+  \bbl at replace\bbl at toreplace{[d|}{\bbl at datecntr[####3|}%
+  \bbl at replace@finish at iii\bbl at toreplace}
+\def\bbl at datecntr{\expandafter\bbl at xdatecntr\expandafter}
+\def\bbl at xdatecntr[#1|#2]{\localenumeral{#2}{#1}}
+\let\bbl at release@transforms\@empty
+\@namedef{bbl at inikv@transforms.prehyphenation}{%
+  \bbl at transforms\babelprehyphenation}
+\@namedef{bbl at inikv@transforms.posthyphenation}{%
+  \bbl at transforms\babelposthyphenation}
+\def\bbl at transforms@aux#1#2#3,#4\relax{#1{#2}{#3}{#4}}
+\begingroup %  A hack. TODO. Don't require an specific order
+  \catcode`\%=12
+  \catcode`\&=14
+  \gdef\bbl at transforms#1#2#3{&%
+    \ifx\bbl at KVP@transforms\@nil\else
+      \directlua{
+         str = [==[#2]==]
+         str = str:gsub('%.%d+%.%d+$', '')
+         tex.print([[\def\string\babeltempa{]] .. str .. [[}]])
+      }&%
+      \bbl at xin@{,\babeltempa,}{,\bbl at KVP@transforms,}&%
+      \ifin@
+        \in@{.0$}{#2$}&%
+        \ifin@
+           \g at addto@macro\bbl at release@transforms{&%
+              \relax\bbl at transforms@aux#1{\languagename}{#3}}&%
+        \else
+           \g at addto@macro\bbl at release@transforms{, {#3}}&%
+        \fi
+      \fi
+    \fi}
+\endgroup
+\def\bbl at provide@lsys#1{%
+  \bbl at ifunset{bbl at lname@#1}%
+    {\bbl at load@info{#1}}%
+    {}%
+  \bbl at csarg\let{lsys@#1}\@empty
+  \bbl at ifunset{bbl at sname@#1}{\bbl at csarg\gdef{sname@#1}{Default}}{}%
+  \bbl at ifunset{bbl at sotf@#1}{\bbl at csarg\gdef{sotf@#1}{DFLT}}{}%
+  \bbl at csarg\bbl at add@list{lsys@#1}{Script=\bbl at cs{sname@#1}}%
+  \bbl at ifunset{bbl at lname@#1}{}%
+    {\bbl at csarg\bbl at add@list{lsys@#1}{Language=\bbl at cs{lname@#1}}}%
+  \ifcase\bbl at engine\or\or
+    \bbl at ifunset{bbl at prehc@#1}{}%
+      {\bbl at exp{\\\bbl at ifblank{\bbl at cs{prehc@#1}}}%
+        {}%
+        {\ifx\bbl at xenohyph\@undefined
+           \let\bbl at xenohyph\bbl at xenohyph@d
+           \ifx\AtBeginDocument\@notprerr
+             \expandafter\@secondoftwo  % to execute right now
+           \fi
+           \AtBeginDocument{%
+             \bbl at patchfont{\bbl at xenohyph}%
+             \expandafter\selectlanguage\expandafter{\languagename}}%
+        \fi}}%
+  \fi
+  \bbl at csarg\bbl at toglobal{lsys@#1}}
+\def\bbl at xenohyph@d{%
+  \bbl at ifset{bbl at prehc@\languagename}%
+    {\ifnum\hyphenchar\font=\defaulthyphenchar
+       \iffontchar\font\bbl at cl{prehc}\relax
+         \hyphenchar\font\bbl at cl{prehc}\relax
+       \else\iffontchar\font"200B
+         \hyphenchar\font"200B
+       \else
+         \bbl at warning
+           {Neither 0 nor ZERO WIDTH SPACE are available\\%
+            in the current font, and therefore the hyphen\\%
+            will be printed. Try changing the fontspec's\\%
+            'HyphenChar' to another value, but be aware\\%
+            this setting is not safe (see the manual)}%
+         \hyphenchar\font\defaulthyphenchar
+       \fi\fi
+     \fi}%
+    {\hyphenchar\font\defaulthyphenchar}}
+  % \fi}
+\def\bbl at load@info#1{%
+  \def\BabelBeforeIni##1##2{%
+    \begingroup
+      \bbl at read@ini{##1}0%
+      \endinput          % babel- .tex may contain onlypreamble's
+    \endgroup}%            boxed, to avoid extra spaces:
+  {\bbl at input@texini{#1}}}
+\def\bbl at setdigits#1#2#3#4#5{%
+  \bbl at exp{%
+    \def\<\languagename digits>####1{%       ie, \langdigits
+      \<bbl at digits@\languagename>####1\\\@nil}%
+    \let\<bbl at cntr@digits@\languagename>\<\languagename digits>%
+    \def\<\languagename counter>####1{%      ie, \langcounter
+      \\\expandafter\<bbl at counter@\languagename>%
+      \\\csname c@####1\endcsname}%
+    \def\<bbl at counter@\languagename>####1{% ie, \bbl at counter@lang
+      \\\expandafter\<bbl at digits@\languagename>%
+      \\\number####1\\\@nil}}%
+  \def\bbl at tempa##1##2##3##4##5{%
+    \bbl at exp{%    Wow, quite a lot of hashes! :-(
+      \def\<bbl at digits@\languagename>########1{%
+       \\\ifx########1\\\@nil              % ie, \bbl at digits@lang
+       \\\else
+         \\\ifx0########1#1%
+         \\\else\\\ifx1########1#2%
+         \\\else\\\ifx2########1#3%
+         \\\else\\\ifx3########1#4%
+         \\\else\\\ifx4########1#5%
+         \\\else\\\ifx5########1##1%
+         \\\else\\\ifx6########1##2%
+         \\\else\\\ifx7########1##3%
+         \\\else\\\ifx8########1##4%
+         \\\else\\\ifx9########1##5%
+         \\\else########1%
+         \\\fi\\\fi\\\fi\\\fi\\\fi\\\fi\\\fi\\\fi\\\fi\\\fi
+         \\\expandafter\<bbl at digits@\languagename>%
+       \\\fi}}}%
+  \bbl at tempa}
+\def\bbl at buildifcase#1 {% Returns \bbl at tempa, requires \toks@={}
+  \ifx\\#1%             % \\ before, in case #1 is multiletter
+    \bbl at exp{%
+      \def\\\bbl at tempa####1{%
+        \<ifcase>####1\space\the\toks@\<else>\\\@ctrerr\<fi>}}%
+  \else
+    \toks@\expandafter{\the\toks@\or #1}%
+    \expandafter\bbl at buildifcase
+  \fi}
+\newcommand\localenumeral[2]{\bbl at cs{cntr@#1@\languagename}{#2}}
+\def\bbl at localecntr#1#2{\localenumeral{#2}{#1}}
+\newcommand\localecounter[2]{%
+  \expandafter\bbl at localecntr
+  \expandafter{\number\csname c@#2\endcsname}{#1}}
+\def\bbl at alphnumeral#1#2{%
+  \expandafter\bbl at alphnumeral@i\number#2 76543210\@@{#1}}
+\def\bbl at alphnumeral@i#1#2#3#4#5#6#7#8\@@#9{%
+  \ifcase\@car#8\@nil\or   % Currenty <10000, but prepared for bigger
+    \bbl at alphnumeral@ii{#9}000000#1\or
+    \bbl at alphnumeral@ii{#9}00000#1#2\or
+    \bbl at alphnumeral@ii{#9}0000#1#2#3\or
+    \bbl at alphnumeral@ii{#9}000#1#2#3#4\else
+    \bbl at alphnum@invalid{>9999}%
+  \fi}
+\def\bbl at alphnumeral@ii#1#2#3#4#5#6#7#8{%
+  \bbl at ifunset{bbl at cntr@#1.F.\number#5#6#7#8@\languagename}%
+    {\bbl at cs{cntr@#1.4@\languagename}#5%
+     \bbl at cs{cntr@#1.3@\languagename}#6%
+     \bbl at cs{cntr@#1.2@\languagename}#7%
+     \bbl at cs{cntr@#1.1@\languagename}#8%
+     \ifnum#6#7#8>\z@ % TODO. An ad hoc rule for Greek. Ugly.
+       \bbl at ifunset{bbl at cntr@#1.S.321@\languagename}{}%
+         {\bbl at cs{cntr@#1.S.321@\languagename}}%
+     \fi}%
+    {\bbl at cs{cntr@#1.F.\number#5#6#7#8@\languagename}}}
+\def\bbl at alphnum@invalid#1{%
+  \bbl at error{Alphabetic numeral too large (#1)}%
+    {Currently this is the limit.}}
+\newcommand\localeinfo[1]{%
+  \bbl at ifunset{bbl@\csname bbl at info@#1\endcsname @\languagename}%
+    {\bbl at error{I've found no info for the current locale.\\%
+                The corresponding ini file has not been loaded\\%
+                Perhaps it doesn't exist}%
+               {See the manual for details.}}%
+    {\bbl at cs{\csname bbl at info@#1\endcsname @\languagename}}}
+\@namedef{bbl at info@tag.ini}{lini}
+\@namedef{bbl at info@name.english}{elname}
+\@namedef{bbl at info@name.opentype}{lname}
+\@namedef{bbl at info@tag.bcp47}{tbcp}
+\@namedef{bbl at info@language.tag.bcp47}{lbcp}
+\@namedef{bbl at info@tag.opentype}{lotf}
+\@namedef{bbl at info@script.name}{esname}
+\@namedef{bbl at info@script.name.opentype}{sname}
+\@namedef{bbl at info@script.tag.bcp47}{sbcp}
+\@namedef{bbl at info@script.tag.opentype}{sotf}
+\let\bbl at ensureinfo\@gobble
+\newcommand\BabelEnsureInfo{%
+  \ifx\InputIfFileExists\@undefined\else
+    \def\bbl at ensureinfo##1{%
+      \bbl at ifunset{bbl at lname@##1}{\bbl at load@info{##1}}{}}%
+  \fi
+  \bbl at foreach\bbl at loaded{{%
+    \def\languagename{##1}%
+    \bbl at ensureinfo{##1}}}}
+\newcommand\getlocaleproperty{%
+  \@ifstar\bbl at getproperty@s\bbl at getproperty@x}
+\def\bbl at getproperty@s#1#2#3{%
+  \let#1\relax
+  \def\bbl at elt##1##2##3{%
+    \bbl at ifsamestring{##1/##2}{#3}%
+      {\providecommand#1{##3}%
+       \def\bbl at elt####1####2####3{}}%
+      {}}%
+  \bbl at cs{inidata@#2}}%
+\def\bbl at getproperty@x#1#2#3{%
+  \bbl at getproperty@s{#1}{#2}{#3}%
+  \ifx#1\relax
+    \bbl at error
+      {Unknown key for locale '#2':\\%
+       #3\\%
+       \string#1 will be set to \relax}%
+      {Perhaps you misspelled it.}%
+  \fi}
+\let\bbl at ini@loaded\@empty
+\newcommand\LocaleForEach{\bbl at foreach\bbl at ini@loaded}
+\newcommand\babeladjust[1]{%  TODO. Error handling.
+  \bbl at forkv{#1}{%
+    \bbl at ifunset{bbl at ADJ@##1@##2}%
+      {\bbl at cs{ADJ@##1}{##2}}%
+      {\bbl at cs{ADJ@##1@##2}}}}
+\def\bbl at adjust@lua#1#2{%
+  \ifvmode
+    \ifnum\currentgrouplevel=\z@
+      \directlua{ Babel.#2 }%
+      \expandafter\expandafter\expandafter\@gobble
+    \fi
+  \fi
+  {\bbl at error   % The error is gobbled if everything went ok.
+     {Currently, #1 related features can be adjusted only\\%
+      in the main vertical list.}%
+     {Maybe things change in the future, but this is what it is.}}}
+\@namedef{bbl at ADJ@bidi.mirroring at on}{%
+  \bbl at adjust@lua{bidi}{mirroring_enabled=true}}
+\@namedef{bbl at ADJ@bidi.mirroring at off}{%
+  \bbl at adjust@lua{bidi}{mirroring_enabled=false}}
+\@namedef{bbl at ADJ@bidi.text at on}{%
+  \bbl at adjust@lua{bidi}{bidi_enabled=true}}
+\@namedef{bbl at ADJ@bidi.text at off}{%
+  \bbl at adjust@lua{bidi}{bidi_enabled=false}}
+\@namedef{bbl at ADJ@bidi.mapdigits at on}{%
+  \bbl at adjust@lua{bidi}{digits_mapped=true}}
+\@namedef{bbl at ADJ@bidi.mapdigits at off}{%
+  \bbl at adjust@lua{bidi}{digits_mapped=false}}
+\@namedef{bbl at ADJ@linebreak.sea at on}{%
+  \bbl at adjust@lua{linebreak}{sea_enabled=true}}
+\@namedef{bbl at ADJ@linebreak.sea at off}{%
+  \bbl at adjust@lua{linebreak}{sea_enabled=false}}
+\@namedef{bbl at ADJ@linebreak.cjk at on}{%
+  \bbl at adjust@lua{linebreak}{cjk_enabled=true}}
+\@namedef{bbl at ADJ@linebreak.cjk at off}{%
+  \bbl at adjust@lua{linebreak}{cjk_enabled=false}}
+\@namedef{bbl at ADJ@justify.arabic at on}{%
+  \bbl at adjust@lua{linebreak}{arabic.justify_enabled=true}}
+\@namedef{bbl at ADJ@justify.arabic at off}{%
+  \bbl at adjust@lua{linebreak}{arabic.justify_enabled=false}}
+\def\bbl at adjust@layout#1{%
+  \ifvmode
+    #1%
+    \expandafter\@gobble
+  \fi
+  {\bbl at error   % The error is gobbled if everything went ok.
+     {Currently, layout related features can be adjusted only\\%
+      in vertical mode.}%
+     {Maybe things change in the future, but this is what it is.}}}
+\@namedef{bbl at ADJ@layout.tabular at on}{%
+  \bbl at adjust@layout{\let\@tabular\bbl at NL@@tabular}}
+\@namedef{bbl at ADJ@layout.tabular at off}{%
+  \bbl at adjust@layout{\let\@tabular\bbl at OL@@tabular}}
+\@namedef{bbl at ADJ@layout.lists at on}{%
+  \bbl at adjust@layout{\let\list\bbl at NL@list}}
+\@namedef{bbl at ADJ@layout.lists at off}{%
+  \bbl at adjust@layout{\let\list\bbl at OL@list}}
+\@namedef{bbl at ADJ@hyphenation.extra at on}{%
+  \bbl at activateposthyphen}
+\@namedef{bbl at ADJ@autoload.bcp47 at on}{%
+  \bbl at bcpallowedtrue}
+\@namedef{bbl at ADJ@autoload.bcp47 at off}{%
+  \bbl at bcpallowedfalse}
+\@namedef{bbl at ADJ@autoload.bcp47.prefix}#1{%
+  \def\bbl at bcp@prefix{#1}}
+\def\bbl at bcp@prefix{bcp47-}
+\@namedef{bbl at ADJ@autoload.options}#1{%
+  \def\bbl at autoload@options{#1}}
+\let\bbl at autoload@bcpoptions\@empty
+\@namedef{bbl at ADJ@autoload.bcp47.options}#1{%
+  \def\bbl at autoload@bcpoptions{#1}}
+\newif\ifbbl at bcptoname
+\@namedef{bbl at ADJ@bcp47.toname at on}{%
+  \bbl at bcptonametrue
+  \BabelEnsureInfo}
+\@namedef{bbl at ADJ@bcp47.toname at off}{%
+  \bbl at bcptonamefalse}
+\@namedef{bbl at ADJ@prehyphenation.disable at nohyphenation}{%
+  \directlua{ Babel.ignore_pre_char = function(node)
+      return (node.lang == \the\csname l at nohyphenation\endcsname)
+    end }}
+\@namedef{bbl at ADJ@prehyphenation.disable at off}{%
+  \directlua{ Babel.ignore_pre_char = function(node)
+      return false
+    end }}
+\@namedef{bbl at ADJ@select.write at shift}{%
+  \let\bbl at restorelastskip\relax
+  \def\bbl at savelastskip{%
+    \let\bbl at restorelastskip\relax
+    \ifvmode
+      \ifdim\lastskip=\z@
+        \let\bbl at restorelastskip\nobreak
+      \else
+        \bbl at exp{%
+          \def\\\bbl at restorelastskip{%
+            \skip@=\the\lastskip
+            \\\nobreak \vskip-\skip@ \vskip\skip@}}%
+      \fi
+    \fi}}
+\@namedef{bbl at ADJ@select.write at keep}{%
+  \let\bbl at restorelastskip\relax
+  \let\bbl at savelastskip\relax}
+\@namedef{bbl at ADJ@select.write at omit}{%
+  \let\bbl at restorelastskip\relax
+  \def\bbl at savelastskip##1\bbl at restorelastskip{}}
+\ifx\directlua\@undefined\else
+  \ifx\bbl at luapatterns\@undefined
+    \input luababel.def
+  \fi
+\fi
 \bbl at trace{Cross referencing macros}
 \ifx\bbl at opt@safe\@empty\else
   \def\@newl at bel#1#2#3{%
@@ -646,8 +3862,6 @@
          \def\@currname{hhline}\input{hhline.sty}\makeatother
        \fi}%
       {}}}
-\DeclareRobustCommand{\FOREIGNLANGUAGE}[1]{%
-  \lowercase{\foreignlanguage{#1}}}
 \def\substitutefontfamily#1#2#3{%
   \lowercase{\immediate\openout15=#1#2.fd\relax}%
   \immediate\write15{%
@@ -960,78 +4174,55 @@
        Local config file '\bbl at opt@config.cfg' not found}{%
        Perhaps you misspelled it.}}%
 \fi
-\let\bbl at tempc\relax
-\bbl at foreach\bbl at language@opts{%
-  \ifcase\bbl at iniflag  % Default
-    \bbl at ifunset{ds@#1}%
-      {\DeclareOption{#1}{\bbl at load@language{#1}}}%
-      {}%
-  \or    % provide=*
-    \@gobble % case 2 same as 1
-  \or    % provide+=*
-    \bbl at ifunset{ds@#1}%
-      {\IfFileExists{#1.ldf}{}%
-        {\IfFileExists{babel-#1.tex}{}{\@namedef{ds@#1}{}}}}%
-      {}%
-    \bbl at ifunset{ds@#1}%
-      {\def\bbl at tempc{#1}%
-       \DeclareOption{#1}{%
-         \ifnum\bbl at iniflag>\@ne
-           \bbl at ldfinit
-           \babelprovide[import]{#1}%
-           \bbl at afterldf{}%
-         \else
-           \bbl at load@language{#1}%
-         \fi}}%
-      {}%
-  \or    % provide*=*
-    \def\bbl at tempc{#1}%
-    \bbl at ifunset{ds@#1}%
-      {\DeclareOption{#1}{%
-         \bbl at ldfinit
-         \babelprovide[import]{#1}%
-         \bbl at afterldf{}}}%
-      {}%
-  \fi}
-\let\bbl at tempb\@nnil
+\let\bbl at elt\relax
+\let\bbl at tempe\@empty
 \bbl at foreach\@classoptionslist{%
-  \bbl at ifunset{ds@#1}%
-    {\IfFileExists{#1.ldf}%
-      {\def\bbl at tempb{#1}%
-       \DeclareOption{#1}{%
-         \ifnum\bbl at iniflag>\@ne
-           \bbl at ldfinit
-           \babelprovide[import]{#1}%
-           \bbl at afterldf{}%
-         \else
-           \bbl at load@language{#1}%
-         \fi}}%
-      {\IfFileExists{babel-#1.tex}% TODO. Copypaste pattern
-        {\def\bbl at tempb{#1}%
-         \DeclareOption{#1}{%
-           \ifnum\bbl at iniflag>\@ne
-             \bbl at ldfinit
-             \babelprovide[import]{#1}%
-             \bbl at afterldf{}%
-           \else
-             \bbl at load@language{#1}%
-           \fi}}%
-         {}}}%
-    {}}
-\ifnum\bbl at iniflag=\z@\else
-  \ifx\bbl at opt@main\@nnil
-    \ifx\bbl at tempc\relax
-      \let\bbl at opt@main\bbl at tempb
+  \bbl at xin@{,#1,$}{\bbl at language@opts$}% Match last
+  \ifin@\else
+    \bbl at xin@{,#1,}{\bbl at language@opts}% Match non-last
+    \ifin@
+      \bbl at replace\bbl at language@opts{,#1,}{,,}%
+      \edef\bbl at tempe{\bbl at tempe\bbl at elt{3}{#1}}%
     \else
-      \let\bbl at opt@main\bbl at tempc
+      \babel at savecnt\z@ % Use as temp
+      \ifnum\bbl at iniflag<\thr@@ % Optimization: 3 = always ini
+        \IfFileExists{#1.ldf}{\advance\babel at savecnt\@ne}{}%
+      \fi
+      \ifnum\bbl at iniflag>\z@ % Optimization: 0 = always ldf
+        \IfFileExists{babel-#1.tex}{\advance\babel at savecnt\tw@}{}%
+      \fi
+      \ifnum\babel at savecnt>\z@
+        \edef\bbl at tempe{\bbl at tempe\bbl at elt{\the\babel at savecnt}{#1}}%
+      \fi
     \fi
+  \fi}
+\let\bbl at savemain\@empty
+\bbl at foreach\bbl at language@opts{%
+  \edef\bbl at tempe{\bbl at tempe\bbl at elt{3}{#1}}}
+\def\bbl at elt#1#2#3{%
+  \ifx#3\relax % if last
+    \bbl at ifunset{ds@#2}{}%
+      {\bbl at exp{\def\\\bbl at savemain{\\\DeclareOption{#2}{\[ds@#2]}}}}%
+    \bbl at add\bbl at savemain{\bbl at elt{#1}{#2}}% Save main
+    \DeclareOption{#2}{}%
+  \else
+    \ifnum\bbl at iniflag<\tw@ % other as ldf
+      \ifodd#1\relax % Class: if ldf exists 1,3. Package: always 3
+        \bbl at ifunset{ds@#2}%
+         {\DeclareOption{#2}{\bbl at load@language{#2}}}%
+         {}%
+      \fi
+    \else % other as ini
+      \ifnum#1>\@ne %  % Class: if ini exists 2,3. Package: always 3
+        \DeclareOption{#2}{%
+          \bbl at ldfinit
+          \babelprovide[import]{#2}%
+          \bbl at afterldf{}}%
+       \fi
+    \fi
   \fi
-\fi
-\ifx\bbl at opt@main\@nnil\else
-  \expandafter
-  \let\expandafter\bbl at loadmain\csname ds@\bbl at opt@main\endcsname
-  \expandafter\let\csname ds@\bbl at opt@main\endcsname\@empty
-\fi
+  #3}
+\bbl at tempe\relax % \relax catches last
 \def\AfterBabelLanguage#1{%
   \bbl at ifsamestring\CurrentOption{#1}{\global\bbl at add\bbl at afterlang}{}}
 \DeclareOption*{}
@@ -1053,31 +4244,27 @@
       and a package option. Use 'main=\bbl at tempc' as\\%
       option. Reported}%
   \fi
-\else
-  \ifodd\bbl at iniflag  % case 1,3
-    \bbl at ldfinit
-    \let\CurrentOption\bbl at opt@main
-    \ifx\bbl at opt@provide\@nnil
-      \bbl at exp{\\\babelprovide[import,main]{\bbl at opt@main}}%
-    \else
-      \bbl at exp{\\\bbl at forkv{\@nameuse{@raw at opt@babel.sty}}}{%
-        \bbl at xin@{,provide,}{,#1,}%
-        \ifin@
-          \def\bbl at opt@provide{#2}%
-          \bbl at replace\bbl at opt@provide{;}{,}%
-        \fi}%
-      \bbl at exp{%
-        \\\babelprovide[\bbl at opt@provide,import,main]{\bbl at opt@main}}%
+\fi
+\def\bbl at elt#1#2{% main
+  \ifodd\bbl at iniflag % as ini = 1(=), 3(*=)
+    \ifnum#1>\@ne %  % Class: if ini exists 2,3. Package: always 3
+      \def\CurrentOption{#2}% Directly, because luatexbase
+      \bbl at ldfinit
+      \babelprovide[\bbl at opt@provide,main,import]{#2}%
+      \bbl at afterldf{}%
+      \DeclareOption{#2}{}%
     \fi
-    \bbl at afterldf{}%
-  \else % case 0,2
-    \chardef\bbl at iniflag\z@  % Force ldf
-    \expandafter\let\csname ds@\bbl at opt@main\endcsname\bbl at loadmain
-    \ExecuteOptions{\bbl at opt@main}
-    \DeclareOption*{}%
-    \ProcessOptions*
-  \fi
-\fi
+  \else % as ldf = 0(no), 2(+=)
+    \ifodd#1\relax % Class: if ldf exists 1,3. Package: always 3
+      \bbl at ifunset{ds@#2}%
+        {\DeclareOption{#2}{\bbl at load@language{#2}}}%
+        {}%
+      \ExecuteOptions{#2}%
+    \fi
+  \fi}
+\bbl at savemain
+\DeclareOption*{}%
+\ProcessOptions*
 \def\AfterBabelLanguage{%
   \bbl at error
     {Too late for \string\AfterBabelLanguage}%

Modified: trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2021-10-13 20:33:19 UTC (rev 60757)
@@ -38,10 +38,10 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{hyphen.cfg}[2021/07/22 3.63 Babel hyphens]
+\ProvidesFile{hyphen.cfg}[2021/10/13 3.64 Babel hyphens]
 \xdef\bbl at format{\jobname}
-\def\bbl at version{3.63}
-\def\bbl at date{2021/07/22}
+\def\bbl at version{3.64}
+\def\bbl at date{2021/10/13}
 \ifx\AtBeginDocument\@undefined
   \def\@empty{}
 \fi

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.12
-date = 2021-06-25
+version = 1.13
+date = 2021-09-29
 name.local = العربية
 name.english = Arabic
 name.babel = arabic
@@ -180,11 +180,11 @@
 ; Yannis Haralambous' system in his 'dad'. Only two rules are missing.
 ; 3-letter
 transliteration.dad.1.0 = { {+}a{*} }
-transliteration.dad.1.2 =   { string = ٰ }
+transliteration.dad.1.1 =   { string = ٰ }
 transliteration.dad.1.2 =   { string = ّ }
 transliteration.dad.1.3 =   { remove }
 transliteration.dad.2.0 = { {+}([aui])N }
-transliteration.dad.2.2 =   { string = {1|aui|ًٌٍ} }
+transliteration.dad.2.1 =   { string = {1|aui|ًٌٍ} }
 transliteration.dad.2.2 =   { string = ّ }
 transliteration.dad.2.3 =   { remove }
 ; 2-letter

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-de-CH-1901.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-de-CH-1901.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-de-CH-1901.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,13 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.3
-date = 2020-06-30
+version = 1.4
+date = 2021-09-29
 name.local = Deutsch
 name.english = German
-name.babel = german-switzerland
-name.babel.A = german-ch
-name.babel.B = nswissgerman
+name.babel = german-switzerland german-ch nswissgerman
 name.polyglossia = german
 ; The following conflicts with gsw:
 name.babel.C = swissgerman

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-de-CH-1996.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-de-CH-1996.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-de-CH-1996.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,13 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.3
-date = 2020-06-30
+version = 1.4
+date = 2021-09-29
 name.local = Deutsch
 name.english = German
-name.babel = german-switzerland
-name.babel.A = german-ch
-name.babel.B = nswissgerman
+name.babel = german-switzerland german-ch nswissgerman
 name.polyglossia = german
 ; The following conflicts with gsw:
 name.babel.C = swissgerman

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-de-CH.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-de-CH.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-de-CH.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,14 +11,12 @@
 
 [identification]
 charset = utf8
-version = 1.3
-date = 2020-06-30
+version = 1.4
+date = 2021-09-29
 name.local = Deutsch
 name.english = German
-name.babel = german-switzerland
+name.babel = german-switzerland german-ch nswissgerman
 name.polyglossia = german
-name.babel.A = german-ch
-name.babel.B = nswissgerman
 ; The following conflicts with gsw:
 name.babel.C = swissgerman
 tag.bcp47 = de-CH

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-AU.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-AU.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-AU.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,13 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.2
-date = 2020-06-30
+version = 1.3
+date = 2021-09-29
 name.local = English
 name.english = English
-name.babel = english-australia
-name.babel.A = english-au
-name.babel.B = australian
+name.babel = english-australia english-au australian
 tag.bcp47 = en-AU
 language.tag.bcp47 = en
 tag.opentype = ENG

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-CA.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-CA.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-CA.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,13 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.2
-date = 2020-06-30
+version = 1.3
+date = 2021-09-29
 name.local = English
 name.english = English
-name.babel = english-canada
-name.babel.A = english-ca
-name.babel.B = canadian
+name.babel = english-canada english-ca canadian
 tag.bcp47 = en-CA
 language.tag.bcp47 = en
 tag.opentype = ENG

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-GB.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-GB.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-GB.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,14 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.2
-date = 2020-06-30
+version = 1.3
+date = 2021-09-29
 name.local = English
 name.english = English
-name.babel = english-unitedkingdom
-name.babel.A = english-gb
-name.babel.B = british
-name.babel.C = ukenglish
+name.babel = english-unitedkingdom english-gb british ukenglish
 tag.bcp47 = en-GB
 language.tag.bcp47 = en
 tag.opentype = ENG

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-NZ.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-NZ.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-NZ.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,13 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.2
-date = 2020-06-30
+version = 1.3
+date = 2021-09-29
 name.local = English
 name.english = English
-name.babel = english-newzealand
-name.babel.A = english-nz
-name.babel.B = newzealand
+name.babel = english-newzealand english-nz newzealand
 tag.bcp47 = en-NZ
 language.tag.bcp47 = en
 tag.opentype = ENG

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-US.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-US.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-en-US.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,14 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.2
-date = 2020-06-30
+version = 1.3
+date = 2021-09-29
 name.local = English
 name.english = English
-name.babel = english-unitedstates
-name.babel.A = english-us
-name.babel.B = american
-name.babel.C = usenglish
+name.babel = english-unitedstates english-us american usenglish
 tag.bcp47 = en-US
 language.tag.bcp47 = en
 tag.opentype = ENG

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-fr-CA.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-fr-CA.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-fr-CA.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,12 +11,11 @@
 
 [identification]
 charset = utf8
-version = 0.98
-date = 2020-06-30
+version = 0.981
+date = 2021-09-29
 name.local = français
 name.english = French
-name.babel = french-canada
-name.babel.A = french-ca
+name.babel = french-canada french-ca
 tag.bcp47 = fr-CA
 language.tag.bcp47 = fr
 tag.opentype = FRA

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-fr-CH.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-fr-CH.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-fr-CH.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,12 +11,11 @@
 
 [identification]
 charset = utf8
-version = 0.98
-date = 2020-06-30
+version = 0.981
+date = 2021-09-29
 name.local = français
 name.english = French
-name.babel = french-switzerland
-name.babel.A = french-ch
+name.babel = french-switzerland french-ch
 tag.bcp47 = fr-CH
 language.tag.bcp47 = fr
 tag.opentype = FRA

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-fr-LU.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-fr-LU.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-fr-LU.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,12 +11,11 @@
 
 [identification]
 charset = utf8
-version = 0.98
-date = 2020-06-30
+version = 0.981
+date = 2021-09-29
 name.local = français
 name.english = French
-name.babel = french-luxembourg
-name.babel.A = french-lu
+name.babel = french-luxembourg french-lu
 tag.bcp47 = fr-LU
 language.tag.bcp47 = fr
 tag.opentype = FRA

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ja/babel-ja.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ja/babel-ja.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ja/babel-ja.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.8
-date = 2020-10-11
+version = 1.9
+date = 2021-09-29
 name.local = 日本語
 name.english = Japanese
 name.babel = japanese
@@ -191,6 +191,10 @@
 formal.2     = 壱拾 弐拾 参拾 四拾 伍拾 六拾 七拾 八拾 九拾
 formal.3     = 壱百 弐百 参百 四百 伍百 六百 七百 八百 九百
 formal.4     = 壱阡 弐阡 参阡 四阡 伍阡 六阡 七阡 八阡 九阡
+cjk-earthly-branch = 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
+cjk-heavenly-stem  = 甲 乙 丙 丁 戊 己 庚 辛 壬 癸
+circled.ideograph = ㊀ ㊁ ㊂ ㊃ ㊄ ㊅ ㊆ ㊇ ㊈ ㊉
+parenthesized.ideograph = ㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
 fullwidth.lower.alpha = a b c d e f g h i j k l m n o p q r s t u v w x y z
 fullwidth.upper.alpha = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ko/babel-ko-Hani.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ko/babel-ko-Hani.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ko/babel-ko-Hani.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.2
-date = 2020-10-11
+version = 1.3
+date = 2021-09-29
 name.local = 한국어
 name.english = Korean
 name.babel = korean-han korean-hani
@@ -201,5 +201,7 @@
 hangul.formal.4    = 일천 이천 삼천 사천 오천 육천 칠천 팔천 구천
 cjk-earthly-branch = 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
 cjk-heavenly-stem  = 甲 乙 丙 丁 戊 己 庚 辛 壬 癸
+circled.ideograph = ㊀ ㊁ ㊂ ㊃ ㊄ ㊅ ㊆ ㊇ ㊈ ㊉
+parenthesized.ideograph = ㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
 fullwidth.lower.alpha = a b c d e f g h i j k l m n o p q r s t u v w x y z
 fullwidth.upper.alpha = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ko/babel-ko.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ko/babel-ko.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ko/babel-ko.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.9
-date = 2020-10-11
+version = 1.10
+date = 2021-09-29
 name.local = 한국어
 name.english = Korean
 name.babel = korean
@@ -202,6 +202,8 @@
 hangul.formal.4    = 일천 이천 삼천 사천 오천 육천 칠천 팔천 구천
 cjk-earthly-branch = 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
 cjk-heavenly-stem  = 甲 乙 丙 丁 戊 己 庚 辛 壬 癸
+circled.ideograph = ㊀ ㊁ ㊂ ㊃ ㊄ ㊅ ㊆ ㊇ ㊈ ㊉
+parenthesized.ideograph = ㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
 fullwidth.lower.alpha = a b c d e f g h i j k l m n o p q r s t u v w x y z
 fullwidth.upper.alpha = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/nb/babel-nb.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/nb/babel-nb.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/nb/babel-nb.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,11 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.5
-date = 2021-05-16
+version = 1.6
+date = 2021-08-29
 name.local = norsk bokmål
 name.english = Norwegian Bokmål
-name.babel = norsk norwegianbokmal
+name.babel = norwegianbokmal
 name.polyglossia = norwegian
 tag.bcp47 = nb
 language.tag.bcp47 = nb

Deleted: trunk/Master/texmf-dist/tex/generic/babel/locale/nb/babel-norsk.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/nb/babel-norsk.tex	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/nb/babel-norsk.tex	2021-10-13 20:33:19 UTC (rev 60757)
@@ -1,4 +0,0 @@
-% This file is part of babel. For further details see:
-% https://www.ctan.org/pkg/babel
-\input{babel-norwegianbokmal}
-\endinput
\ No newline at end of file

Added: trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-no.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-no.ini	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-no.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -0,0 +1,183 @@
+; This file is part of babel. For further details see:
+;   https://www.ctan.org/pkg/babel
+; Data has been collected mainly from the following sources:
+; * Common Locale Data Repository (license Unicode):
+;   http://cldr.unicode.org/
+;   http://unicode.org/copyright.html
+
+[identification]
+charset = utf8
+version = 1.0
+date = 2021-08-29
+name.local = norsk
+name.english = Norwegian
+name.babel = norsk norwegian
+name.polyglossia = norwegian
+tag.bcp47 = no
+language.tag.bcp47 = no
+tag.bcp47.likely = no-Latn-NO
+tag.opentype = NOR
+script.name = Latin
+script.tag.bcp47 = Latn
+script.tag.opentype = latn
+polyglossia.variant = bokmal
+level = 1
+encodings = T1 OT1 LY1
+derivate = no
+
+[captions]
+preface = Forord
+ref = Referanser
+abstract = Sammendrag
+bib = Bibliografi
+chapter = Kapittel
+appendix = Tillegg
+contents = Innhold
+listfigure = Figurer
+listtable = Tabeller
+index = Register
+figure = Figur
+table = Tabell
+part = Del
+encl = Vedlegg
+cc = Kopi sendt
+headto = Til
+page = Side
+see = Se
+also = Se også
+proof = Bevis
+glossary = Ordliste
+
+[captions.licr]
+preface = Forord
+ref = Referanser
+abstract = Sammendrag
+bib = Bibliografi
+chapter = Kapittel
+appendix = Tillegg
+contents = Innhold
+listfigure = Figurer
+listtable = Tabeller
+index = Register
+figure = Figur
+table = Tabell
+part = Del
+encl = Vedlegg
+cc = Kopi sendt
+headto = Til
+page = Side
+see = Se
+also = Se ogs\r a
+proof = Bevis
+glossary = Ordliste
+
+[date.gregorian]
+date.long = [d]. [MMMM] [y]
+date.short = [dd].[MM].[y]
+months.wide.1 = januar
+months.wide.2 = februar
+months.wide.3 = mars
+months.wide.4 = april
+months.wide.5 = mai
+months.wide.6 = juni
+months.wide.7 = juli
+months.wide.8 = august
+months.wide.9 = september
+months.wide.10 = oktober
+months.wide.11 = november
+months.wide.12 = desember
+months.narrow.1 = J
+months.narrow.2 = F
+months.narrow.3 = M
+months.narrow.4 = A
+months.narrow.5 = M
+months.narrow.6 = J
+months.narrow.7 = J
+months.narrow.8 = A
+months.narrow.9 = S
+months.narrow.10 = O
+months.narrow.11 = N
+months.narrow.12 = D
+days.wide.mon = mandag
+days.wide.tue = tirsdag
+days.wide.wed = onsdag
+days.wide.thu = torsdag
+days.wide.fri = fredag
+days.wide.sat = lørdag
+days.wide.sun = søndag
+days.abbreviated.mon = man.
+days.abbreviated.tue = tir.
+days.abbreviated.wed = ons.
+days.abbreviated.thu = tor.
+days.abbreviated.fri = fre.
+days.abbreviated.sat = lør.
+days.abbreviated.sun = søn.
+days.narrow.mon = M
+days.narrow.tue = T
+days.narrow.wed = O
+days.narrow.thu = T
+days.narrow.fri = F
+days.narrow.sat = L
+days.narrow.sun = S
+dayPeriods.abbreviated.am = a.m.
+dayPeriods.abbreviated.pm = p.m.
+dayPeriods.narrow.am = a
+dayPeriods.narrow.pm = p
+dayPeriods.wide.am = a.m.
+dayPeriods.wide.pm = p.m.
+
+[date.gregorian.licr]
+months.wide.1 = januar
+months.wide.2 = februar
+months.wide.3 = mars
+months.wide.4 = april
+months.wide.5 = mai
+months.wide.6 = juni
+months.wide.7 = juli
+months.wide.8 = august
+months.wide.9 = september
+months.wide.10 = oktober
+months.wide.11 = november
+months.wide.12 = desember
+
+[time.gregorian]
+time.medium = [HH]:[mm]:[ss]
+time.short = [HH]:[mm]
+
+[typography]
+frenchspacing = yes
+hyphenrules = bokmal
+lefthyphenmin = 
+righthyphenmin = 
+hyphenchar = 
+prehyphenchar = 
+posthyphenchar = 
+exhyphenchar = 
+preexhyphenchar = 
+postexhyphenchar = 
+hyphenationmin = 
+
+[characters]
+delimiters.quotes = «»‘’
+auxiliary = [á ǎ ã č ç đ è ê í ń ñ ŋ š ŧ ú ü ž ä ö]
+exemplarCharacters = [a à b c d e é f g h i j k l m n o ó ò ô p q r s t u v w x y z æ ø å]
+index = [A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Æ Ø Å]
+punctuation = [\\- – , ; \\: ! ? . ' \" « » ( ) \\[ \\] \\{ \\} § @ * / \\\\]
+
+[numbers]
+defaultNumberingSystem = latn
+minimumGroupingDigits = 1
+decimal = ,
+exponential = E
+group =  
+infinity = ∞
+list = ;
+minusSign = −
+nan = NaN
+perMille = ‰
+percentSign = %
+plusSign = +
+superscriptingExponent = ×
+
+[counters]
+


Property changes on: trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-no.ini
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-norsk.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-norsk.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-norsk.tex	2021-10-13 20:33:19 UTC (rev 60757)
@@ -0,0 +1,12 @@
+% This file is part of babel. For further details see:
+% https://www.ctan.org/pkg/babel
+\ifx\BabelBeforeIni\undefined
+  \PackageError{babel}%
+    {This file is a component of babel and cannot\MessageBreak
+     be loaded directly. I'll stop immediately}%
+    {Just use babel as documented.}%
+  \stop
+\fi
+\BabelBeforeIni{no}{%
+}
+\endinput
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-norsk.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-norwegian.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-norwegian.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-norwegian.tex	2021-10-13 20:33:19 UTC (rev 60757)
@@ -0,0 +1,12 @@
+% This file is part of babel. For further details see:
+% https://www.ctan.org/pkg/babel
+\ifx\BabelBeforeIni\undefined
+  \PackageError{babel}%
+    {This file is a component of babel and cannot\MessageBreak
+     be loaded directly. I'll stop immediately}%
+    {Just use babel as documented.}%
+  \stop
+\fi
+\BabelBeforeIni{no}{%
+}
+\endinput
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/generic/babel/locale/no/babel-norwegian.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl-BA.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl-BA.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl-BA.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,12 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.4
-date = 2021-04-24
+version = 1.5
+date = 2021-09-29
 name.local = српски
 name.english = Serbian
-name.babel = serbian-cyrillic-bosniaherzegovina
-name.babel.A = serbian-cyrl-ba
+name.babel = serbian-cyrillic-bosniaherzegovina serbian-cyrl-ba
 tag.bcp47 = sr-Cyrl-BA
 language.tag.bcp47 = sr
 tag.opentype = SRB

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl-ME.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl-ME.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl-ME.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,12 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.4
-date = 2021-04-24
+version = 1.5
+date = 2021-09-29
 name.local = српски
 name.english = Serbian
-name.babel = serbian-cyrillic-montenegro
-name.babel.A = serbian-cyrl-me
+name.babel = serbian-cyrillic-montenegro serbian-cyrl-me
 tag.bcp47 = sr-Cyrl-ME
 language.tag.bcp47 = sr
 tag.opentype = SRB

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl-XK.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl-XK.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl-XK.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,12 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.4
-date = 2021-04-24
+version = 1.5
+date = 2021-09-29
 name.local = српски
 name.english = Serbian
-name.babel = serbian-cyrillic-kosovo
-name.babel.A = serbian-cyrl-xk
+name.babel = serbian-cyrillic-kosovo serbian-cyrl-xk
 tag.bcp47 = sr-Cyrl-XK
 language.tag.bcp47 = sr
 tag.opentype = SRB

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Cyrl.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,12 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.4
-date = 2021-04-24
+version = 1.5
+date = 2021-09-29
 name.local = српски
 name.english = Serbian
-name.babel = serbian-cyrillic
-name.babel.A = serbian-cyrl
+name.babel = serbian-cyrillic serbian-cyrl
 tag.bcp47 = sr-Cyrl
 language.tag.bcp47 = sr
 tag.opentype = SRB

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Latn-ME.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Latn-ME.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Latn-ME.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,12 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.2
-date = 2020-06-30
+version = 1.3
+date = 2021-09-29
 name.local = srpski
 name.english = Serbian
-name.babel = serbian-latin-montenegro
-name.babel.A = serbian-latn-me
+name.babel = serbian-latin-montenegro serbian-latn-me
 tag.bcp47 = sr-Latn-ME
 language.tag.bcp47 = sr
 tag.opentype = SRB

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Latn-XK.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Latn-XK.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Latn-XK.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,12 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.2
-date = 2020-06-30
+version = 1.3
+date = 2021-09-29
 name.local = srpski
 name.english = Serbian
-name.babel = serbian-latin-kosovo
-name.babel.A = serbian-latn-xk
+name.babel = serbian-latin-kosovo serbian-latn-xk
 tag.bcp47 = sr-Latn-XK
 language.tag.bcp47 = sr
 tag.opentype = SRB

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Latn.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Latn.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-sr-Latn.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,12 +11,11 @@
 
 [identification]
 charset = utf8
-version = 1.2
-date = 2020-06-30
+version = 1.3
+date = 2021-09-29
 name.local = srpski
 name.english = Serbian
-name.babel = serbian-latin
-name.babel.A = serbian-latn
+name.babel = serbian-latin serbian-latn
 tag.bcp47 = sr-Latn
 language.tag.bcp47 = sr
 tag.opentype = SRB

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans-HK.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans-HK.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans-HK.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.8
-date = 2020-10-11
+version = 1.9
+date = 2021-09-29
 name.local = 中文
 name.english = Chinese
 name.opentype = Chinese Simplified
@@ -178,6 +178,8 @@
 [counters]
 cjk-earthly-branch = 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
 cjk-heavenly-stem  = 甲 乙 丙 丁 戊 己 庚 辛 壬 癸
+circled.ideograph = ㊀ ㊁ ㊂ ㊃ ㊄ ㊅ ㊆ ㊇ ㊈ ㊉
+parenthesized.ideograph = ㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
 fullwidth.lower.alpha = a b c d e f g h i j k l m n o p q r s t u v w x y z
 fullwidth.upper.alpha = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans-MO.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans-MO.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans-MO.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.8
-date = 2020-10-11
+version = 1.9
+date = 2021-09-29
 name.local = 中文
 name.english = Chinese
 name.opentype = Chinese Simplified
@@ -178,6 +178,8 @@
 [counters]
 cjk-earthly-branch = 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
 cjk-heavenly-stem  = 甲 乙 丙 丁 戊 己 庚 辛 壬 癸
+circled.ideograph = ㊀ ㊁ ㊂ ㊃ ㊄ ㊅ ㊆ ㊇ ㊈ ㊉
+parenthesized.ideograph = ㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
 fullwidth.lower.alpha = a b c d e f g h i j k l m n o p q r s t u v w x y z
 fullwidth.upper.alpha = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans-SG.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans-SG.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans-SG.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.8
-date = 2020-10-11
+version = 1.9
+date = 2021-09-29
 name.local = 中文
 name.english = Chinese
 name.opentype = Chinese Simplified
@@ -178,6 +178,8 @@
 [counters]
 cjk-earthly-branch = 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
 cjk-heavenly-stem  = 甲 乙 丙 丁 戊 己 庚 辛 壬 癸
+circled.ideograph = ㊀ ㊁ ㊂ ㊃ ㊄ ㊅ ㊆ ㊇ ㊈ ㊉
+parenthesized.ideograph = ㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
 fullwidth.lower.alpha = a b c d e f g h i j k l m n o p q r s t u v w x y z
 fullwidth.upper.alpha = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hans.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -13,8 +13,8 @@
 
 [identification]
 charset = utf8
-version = 1.9
-date = 2020-10-11
+version = 1.10
+date = 2021-09-29
 name.local = 中文
 name.english = Chinese
 name.opentype = Chinese Simplified
@@ -181,6 +181,8 @@
 [counters]
 cjk-earthly-branch = 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
 cjk-heavenly-stem  = 甲 乙 丙 丁 戊 己 庚 辛 壬 癸
+circled.ideograph = ㊀ ㊁ ㊂ ㊃ ㊄ ㊅ ㊆ ㊇ ㊈ ㊉
+parenthesized.ideograph = ㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
 fullwidth.lower.alpha = a b c d e f g h i j k l m n o p q r s t u v w x y z
 fullwidth.upper.alpha = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hant-HK.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hant-HK.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hant-HK.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.8
-date = 2020-10-11
+version = 1.9
+date = 2021-09-29
 name.local = 中文
 name.english = Chinese
 name.opentype = Chinese Traditional
@@ -178,6 +178,8 @@
 [counters]
 cjk-earthly-branch = 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
 cjk-heavenly-stem  = 甲 乙 丙 丁 戊 己 庚 辛 壬 癸
+circled.ideograph = ㊀ ㊁ ㊂ ㊃ ㊄ ㊅ ㊆ ㊇ ㊈ ㊉
+parenthesized.ideograph = ㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
 fullwidth.lower.alpha = a b c d e f g h i j k l m n o p q r s t u v w x y z
 fullwidth.upper.alpha = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hant-MO.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hant-MO.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hant-MO.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.8
-date = 2020-10-11
+version = 1.9
+date = 2021-09-29
 name.local = 中文
 name.english = Chinese
 name.opentype = Chinese Traditional
@@ -178,6 +178,8 @@
 [counters]
 cjk-earthly-branch = 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
 cjk-heavenly-stem  = 甲 乙 丙 丁 戊 己 庚 辛 壬 癸
+circled.ideograph = ㊀ ㊁ ㊂ ㊃ ㊄ ㊅ ㊆ ㊇ ㊈ ㊉
+parenthesized.ideograph = ㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
 fullwidth.lower.alpha = a b c d e f g h i j k l m n o p q r s t u v w x y z
 fullwidth.upper.alpha = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hant.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hant.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh-Hant.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -13,8 +13,8 @@
 
 [identification]
 charset = utf8
-version = 1.9
-date = 2020-10-11
+version = 1.10
+date = 2021-09-29
 name.local = 中文
 name.english = Chinese
 name.opentype = Chinese Traditional
@@ -183,6 +183,8 @@
 [counters]
 cjk-earthly-branch = 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
 cjk-heavenly-stem  = 甲 乙 丙 丁 戊 己 庚 辛 壬 癸
+circled.ideograph = ㊀ ㊁ ㊂ ㊃ ㊄ ㊅ ㊆ ㊇ ㊈ ㊉
+parenthesized.ideograph = ㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
 fullwidth.lower.alpha = a b c d e f g h i j k l m n o p q r s t u v w x y z
 fullwidth.upper.alpha = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh.ini	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh.ini	2021-10-13 20:33:19 UTC (rev 60757)
@@ -13,8 +13,8 @@
 
 [identification]
 charset = utf8
-version = 1.9
-date = 2020-10-11
+version = 1.10
+date = 2021-09-29
 name.local = 中文
 name.english = Chinese
 name.opentype = Chinese Simplified
@@ -182,6 +182,8 @@
 ; TODO. Add 壹 貳 叁...
 cjk-earthly-branch = 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
 cjk-heavenly-stem  = 甲 乙 丙 丁 戊 己 庚 辛 壬 癸
+circled.ideograph = ㊀ ㊁ ㊂ ㊃ ㊄ ㊅ ㊆ ㊇ ㊈ ㊉
+parenthesized.ideograph = ㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
 fullwidth.lower.alpha = a b c d e f g h i j k l m n o p q r s t u v w x y z
 fullwidth.upper.alpha = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 

Modified: trunk/Master/texmf-dist/tex/generic/babel/luababel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2021-10-13 20:33:19 UTC (rev 60757)
@@ -927,7 +927,7 @@
     \<keys_if_exist:nnF>{fontspec-opentype}{Language/\bbl at cl{lname}}%
       {\\\newfontlanguage{\bbl at cl{lname}}{\bbl at cl{lotf}}}%
     \\\renewfontfamily\\#4%
-      [\bbl at cs{lsys@\languagename},#2]}{#3}% ie \bbl at exp{..}{#3}
+      [\bbl at cl{lsys},#2]}{#3}% ie \bbl at exp{..}{#3}
   \begingroup
      #4%
      \xdef#1{\f at family}%     eg, \bbl at rmdflt@lang{FreeSerif(0)}
@@ -1471,6 +1471,7 @@
      {\ifx\tikz at atbegin@node\@undefined\else
         \ifx\AddToHook\@undefined\else % TODO. Still tentative.
           \AddToHook{env/pgfpicture/begin}{\bbl at pictsetdir\@ne}%
+          % \AddToHook{env/tikzpicture/begin}{\bbl at pictsetdir\z@}%
           \bbl at add\pgfinterruptpicture{\bbl at pictresetdir}%
         \fi
         \let\bbl at OL@pgfpicture\pgfpicture

Modified: trunk/Master/texmf-dist/tex/generic/babel/nil.ldf
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2021-10-13 20:33:19 UTC (rev 60757)
@@ -33,7 +33,7 @@
 %% extension |.ins|) which are part of the distribution.
 %%
 
-\ProvidesLanguage{nil}[2021/07/22 3.63 Nil language]
+\ProvidesLanguage{nil}[2021/10/13 3.64 Nil language]
 \LdfInit{nil}{datenil}
 \ifx\l at nil\@undefined
   \newlanguage\l at nil

Modified: trunk/Master/texmf-dist/tex/generic/babel/xebabel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/xebabel.def	2021-10-13 20:31:26 UTC (rev 60756)
+++ trunk/Master/texmf-dist/tex/generic/babel/xebabel.def	2021-10-13 20:33:19 UTC (rev 60757)
@@ -251,7 +251,7 @@
     \<keys_if_exist:nnF>{fontspec-opentype}{Language/\bbl at cl{lname}}%
       {\\\newfontlanguage{\bbl at cl{lname}}{\bbl at cl{lotf}}}%
     \\\renewfontfamily\\#4%
-      [\bbl at cs{lsys@\languagename},#2]}{#3}% ie \bbl at exp{..}{#3}
+      [\bbl at cl{lsys},#2]}{#3}% ie \bbl at exp{..}{#3}
   \begingroup
      #4%
      \xdef#1{\f at family}%     eg, \bbl at rmdflt@lang{FreeSerif(0)}



More information about the tex-live-commits mailing list.