texlive[72134] Master/texmf-dist: babel (29aug24)

commits+karl at tug.org commits+karl at tug.org
Thu Aug 29 22:32:06 CEST 2024


Revision: 72134
          https://tug.org/svn/texlive?view=revision&revision=72134
Author:   karl
Date:     2024-08-29 22:32:06 +0200 (Thu, 29 Aug 2024)
Log Message:
-----------
babel (29aug24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/babel/README.md
    trunk/Master/texmf-dist/doc/latex/babel/babel-code.pdf
    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-bidi-basic-r.lua
    trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-buddhist.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-chinese.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-coptic.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-ethiopic.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-hebrew.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-islamic.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-ca-persian.tex
    trunk/Master/texmf-dist/tex/generic/babel/babel-data-bidi.lua
    trunk/Master/texmf-dist/tex/generic/babel/babel-data-cjk.lua
    trunk/Master/texmf-dist/tex/generic/babel/babel-transforms.lua
    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/blplain.tex
    trunk/Master/texmf-dist/tex/generic/babel/bplain.tex
    trunk/Master/texmf-dist/tex/generic/babel/errbabel.def
    trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
    trunk/Master/texmf-dist/tex/generic/babel/locale/ja/babel-ja.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/plain.def
    trunk/Master/texmf-dist/tex/generic/babel/switch.def
    trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def
    trunk/Master/texmf-dist/tex/generic/babel/xebabel.def

Modified: trunk/Master/texmf-dist/doc/latex/babel/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/babel/README.md	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/doc/latex/babel/README.md	2024-08-29 20:32:06 UTC (rev 72134)
@@ -1,6 +1,6 @@
-## Babel 24.8
+## Babel 24.9
 
-2024-08-18
+2024-08-29
 
 `babel` is the multilingual framework for localizing documents in
 LaTeX, LuaLaTeX, XeLaTeX. It manages culturally-determined
@@ -10,9 +10,9 @@
 
 The latest stable version is available on <https://ctan.org/pkg/babel>.
 
-Changes in version 24.8 are described in:
+Changes in version 24.9 are described in:
 
-https://latex3.github.io/babel/news/whats-new-in-babel-24.8.html
+https://latex3.github.io/babel/news/whats-new-in-babel-24.9.html
 
 Apart from the manual, you can find information on some aspects of babel at:
 
@@ -48,10 +48,9 @@
 
 ### Summary of latest changes
 ```
-24.8  2024-08-18
-      * Internal changes in bidi=basic (more reliable).
-      * Hook 'foreign' and \BabelWrapText.
-      * Improved some locales thanks to Stephen Huan (@stephen-huan).
+24.9  2024-08-29
+      * New transform 'digits.native' (alternative to `mapdigits').
+      * Tentative transforms for CJK spacing and line breaking.
 ```
 
 ### Previous changes

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

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	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2024/08/18 v24.8 The Babel package]
+\ProvidesFile{babel.dtx}[2024/08/29 v24.9 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -50,6 +50,8 @@
   {NotoSans-Regular.ttf}
 \setmonofont[Scale=.86, FakeStretch=.97]{DejaVu Sans Mono}
 \raggedright
+\frenchspacing
+\addtolength{\oddsidemargin}{1em}
 \addtolength{\textwidth}{25pt}
 \addtolength{\textheight}{3.5cm}
 \addtolength{\topmargin}{-2cm}
@@ -65,7 +67,7 @@
 \newcommand*\m[1]{\mbox{$\langle$\normalfont\itshape#1\/$\rangle$}}
 \newcommand*\langlist{%
   \meta{language}\texttt{,}\meta{language}\texttt{,}...}
-\newcommand*\langvar{\m{lang}}
+\newcommand*\langvar{\m{language}}
 \newcommand*\Lopt[1]{\textsf{#1}}
 \newcommand*\Lenv[1]{\texttt{#1}}
 \newcommand*\menv[1]{\char`\{#1\char`\}}
@@ -75,7 +77,6 @@
 \newcommand*\file[1]{\texttt{#1}}
 \newcommand*\cls[1]{\texttt{#1}}
 \newcommand*\pkg[1]{\texttt{#1}}
-\addtolength{\oddsidemargin}{1em}
 \setlength{\leftmargini}{1.5em}
 \usepackage{framed}
 \usepackage{multicol}
@@ -128,6 +129,13 @@
 \let\bblexv\endverbatim
 \newcommand\setengine{\def\engine}
 \let\engine\relax
+\begingroup
+  \catcode`\<=13
+  \catcode`\>=13
+  \catcode`\|=13
+  \AtBeginDocument{%
+    \gdef|{\verb|\def<##1>{$\langle${\rmfamily\itshape##1}$\rangle$}}}
+\endgroup
 \def\verbatim{%
   \begin{shaded*}%
     \ifx\engine\relax\else
@@ -160,7 +168,7 @@
 \def\args#1{%
   \def\bbl at tempa{#1}%
   \ifx\bbl at tempa\@empty\else#1\vskip1ex\fi\ignorespaces}
-\begingroup % Changes to ltxdoc
+\begingroup % Changes to ltxdoc (add <<...>> syntax)
   \catcode`\<\active
   \catcode`\>\active
   \gdef\check at plus@etc{%
@@ -199,9 +207,7 @@
 \makeatother
 \begin{document}
 \title{Babel, a multilingual package for use with \LaTeX's standard
-   document classes\thanks{During the development ideas from Nico
-   Poppelier, Piet van Oostrum and many others have been used.
-   Bernd Raichle has provided many helpful suggestions.}}
+   document classes.}
 \author{Johannes Braams\\
         Javier Bezos}
 
@@ -682,7 +688,7 @@
 
 \begin{itemize}
 \item Loading directly |sty| files in \LaTeX{} (ie,
-  |\usepackage|\marg{language}) is deprecated and you will get the
+  |\usepackage{<language>}|) is deprecated and you will get the
   error:\footnote{In old versions the error read ``You have used an
   old interface to call babel'', not very helpful.}
 \trouble{You are loading directly a language style}
@@ -790,7 +796,7 @@
     which may break the vertical spacing in some cases (for example,
     between lists or at the beginning of a table cell). \New{3.64} The
     behavior can be adjusted with
-    |\babeladjust{select.write=|\m{mode}|}|, where \m{mode} is |shift|
+    |\babeladjust{select.write=<mode>}|, where \m{mode} is |shift|
     (which shifts the skips down and adds a |\penalty|); |keep| (the
     default -- with it the |\write| and the skips are kept in the order
     they are written), and |omit| (which may seem a too drastic
@@ -891,10 +897,10 @@
 commands above can be cumbersome. With this tool shorter names can be
 defined. It adds nothing really new -- it is just syntactical sugar.
 
-It defines |\text|\m{tag1}\marg{text} to be
-|\foreignlanguage|\marg{language1}\marg{text}, and |\begin|\marg{tag1}
-to be |\begin{otherlanguage*}|\marg{language1}, and so on. Note
-|\|\m{tag1} is also allowed, but remember to set it locally inside a
+It defines |\text<tag1>{<text>}| to be
+|\foreignlanguage{<language1>}{<text>}|, and |\begin{<tag1>}|
+to be |\begin{otherlanguage*}{<language1>}|, and so on. Note
+|\<tag1>| is also allowed, but remember to set it locally inside a
 group.
 
 \begin{warning}
@@ -1074,9 +1080,8 @@
 |\useshorthands*|\marg{char} is provided, which makes sure shorthands
 are always activated.
 
-Currently, if the package option |shorthands| is used, you must include any
-character to be activated with |\useshorthands|. This restriction will
-be lifted in a future release.  % <- TODO
+If the package option |shorthands| is used, you must include any
+character to be activated with |\useshorthands|.
 
 \Describe\defineshorthand{\texttt{[}\langlist\texttt{]}%
      \marg{shorthand}\marg{code}}
@@ -1087,8 +1092,8 @@
 
 \New{3.9a} An optional argument allows to (re)define language and
 system shorthands (some languages do not activate shorthands, so you
-may want to add |\languageshorthands|\marg{lang} to the corresponding
-|\extras|\m{lang}, as explained below). By default, user shorthands
+may want to add |\languageshorthands|\marg{language} to the corresponding
+|\extras<language>|, as explained below). By default, user shorthands
 are (re)defined.
 
 User shorthands override language ones, which in turn override
@@ -1207,7 +1212,7 @@
 
 \begin{note}
   \catcode`\|=12\relax Both \textsf{ltxdoc} and \textsf{babel} use
-  \verb|\AtBeginDocument| to change some catcodes, and babel reloads
+  \verb|\AtBeginDocument| to change some catcodes, and \babel{} reloads
   \textsf{hhline} to make sure \verb|:| has the right one, so if you
   want to change the catcode of \verb/|/ it has to be done using the
   same method at the proper place, with
@@ -1214,10 +1219,10 @@
 \begin{verbatim}
 \AtBeginDocument{\DeleteShortVerb{\|}}
 \end{verbatim}
-  \textit{before} loading babel. This way, when the document begins
+  \textit{before} loading \babel. This way, when the document begins
   the sequence is (1) make \verb/|/ active (\textsf{ltxdoc}); (2) make
-  it inactive (your settings); (3) make babel shorthands active
-  (\textsf{babel)}; (4) reload \textsf{hhline} (\textsf{babel}, now
+  it inactive (your settings); (3) make \babel{} shorthands active
+  (\textsf{babel}); (4) reload \textsf{hhline} (\textsf{babel}, now
   with the correct catcodes for \verb/|/ and
   \verb|:|).\catcode`\|=\active
 \end{note}
@@ -1230,7 +1235,7 @@
 three options have been available in previous versions.
 
 \Describe{KeepShorthandsActive}{}
-Tells babel not to deactivate shorthands after loading a language
+Tells \babel{} not to deactivate shorthands after loading a language
 file, so that they are also available in the preamble.
 
 \Describe{activeacute}{} For some languages \babel\ supports this
@@ -1463,7 +1468,7 @@
   \babel).
 \end{more}
 
-\New{3.49} Alternatively, you can tell babel to load all or some
+\New{3.49} Alternatively, you can tell \babel{} to load all or some
 languages passed as options with |\babelprovide| and not from the |ldf|
 file in a few few typical cases. Thus, |provide=*| means ‘load the main
 language with the |\babelprovide| mechanism instead of the |ldf| file’
@@ -1503,7 +1508,7 @@
   only if the former does not work for you. Fortunately, fonts can be
   loaded twice with different renderers; for example:
 \begin{verbatim}
-\babelfont[spanish]{rm}{FreeSerif}  
+\babelfont[spanish]{rm}{FreeSerif}
 \babelfont[hindi]{rm}[Renderer=Harfbuzz]{FreeSerif}
 \end{verbatim}
 \begin{description}
@@ -1520,7 +1525,7 @@
 need to set explicitly the script to either |deva| or |dev2|, eg:
 \begin{verbatim}
 \newfontscript{Devanagari}{deva}
-\end{verbatim}  
+\end{verbatim}
   Other Indic scripts are still under development in the default
   \luatex{} renderer, but should work with |Renderer=Harfbuzz|. They
   also work with \xetex{}, although unlike with \luatex{} fine tuning
@@ -1587,7 +1592,7 @@
 % \begin{example}
 %   Let's assume you need only the basic features of `spanish`, so that
 %   the |ini| file is enough, and also a variant with your own
-%   hyphenation with  
+%   hyphenation with
 % \end{example}
 
 \subsection{List of locales available in \cs{babelprovide}}
@@ -2320,6 +2325,28 @@
 \end{warning}
 
 \begin{troubleshooting}
+  \trouble{Package fontspec Info: Language '<lang>' not explicitly
+  supported within font '<font>' with script '<script>'.}
+  \textit{Package fontspec Info: Language '<lang>' not explicitly
+  supported within font '<font>' with script '<script>'.}.
+
+  \textbf{This is \textit{not} and error.} This info is shown by
+  \textsf{fontspec}, not by \babel. If everything is okay in your
+  document (and almost always it is), the best thing you can do is just
+  to ignore it altogether.
+
+  In some forums you can find the advice to set, more or less
+  mechanically, |Language=Default|. \textit{Do not follow it}, because
+  font features for the language will not be applied, which can be
+  relevant for many languages, like Urdu and Turkish. Set the
+  |Language| explicitly only if there is a reason to do it. If you
+  really want to conceal this message, use instead:
+\begin{verbatim}
+\PassOptionsToPackage{silent}{fontspec}
+\end{verbatim}
+\end{troubleshooting}
+
+\begin{troubleshooting}
   \trouble{Package babel Info: The following fonts are not babel
   standard families} \textit{Package babel Info: The following fonts
   are not babel standard families}.
@@ -2414,15 +2441,15 @@
 \end{note}
 
 Macros to be run when a language is selected can be add to
-  |\extras|\m{lang}:
+  |\extras<language>|:
 \begin{verbatim}
 \addto\extrasrussian{\mymacro}
 \end{verbatim}
 There is a counterpart for code to be run when a language is
-unselected: |\noextras|\m{lang}.
+unselected: |\noextras<language>|.
 
 \begin{note}
-  These macros (|\captions|\m{lang}, |\extras|\m{lang}) may be
+  These macros (|\captions<language>|, |\extras<language>|) may be
   redefined, but \textit{must not} be used as such -- they just pass
   information to \babel{}, which executes them in the proper context.
 \end{note}
@@ -2809,50 +2836,50 @@
 Languages providing native digits in all or some variants are:
 \begin{multicols}{5}
 Arabic\\ 
-Assamese\\    
+Assamese\\
 Bangla\\ 
-Bhojpuri\\    
-Bodo\\   
+Bhojpuri\\
+Bodo\\
 Burmese\\
-Cantonese\\   
-Central Kurdish\\   
+Cantonese\\
+Central Kurdish\\
 Chinese\\
-Dogri\\  
-Dzongkha\\    
-Gujarati\\    
-Haryanvi\\    
-Hindi\\  
-Hmong Njua\\  
+Dogri\\
+Dzongkha\\
+Gujarati\\
+Haryanvi\\
+Hindi\\
+Hmong Njua\\
 Kannada\\
-Kashmiri\\    
-Khmer\\  
+Kashmiri\\
+Khmer\\
 Konkani\\
-Korean\\  
-Lao\\    
-Maithili\\    
-Malayalam\\   
-Manipuri\\    
+Korean\\
+Lao\\
+Maithili\\
+Malayalam\\
+Manipuri\\
 Marathi\\
 Mazanderani\\ 
 Nepali\\ 
 Northern Kurdish\\ 
-Northern Luri\\    
-Odia\\   
+Northern Luri\\
+Odia\\
 Pashto\\ 
 Persian\\
 Punjabi\\
-Rajasthani\\  
-Sanskrit\\    
-Santali\\  
+Rajasthani\\
+Sanskrit\\
+Santali\\
 Sindhi\\ 
-Tamil\\  
+Tamil\\
 Telugu\\ 
-Thai\\   
+Thai\\
 Tibetan\\ 
-Urdu\\   
+Urdu\\
 Uyghur\\ 
-Uzbek\\  
-Vai    
+Uzbek\\
+Vai
 \end{multicols}
 
 \New{3.30} With \luatex{} there is an alternative approach for mapping
@@ -3256,7 +3283,7 @@
 
 It can be used only in the preamble, and exceptions are set when the
 language is first selected, thus taking into account changes of
-|\lccodes|'s done in |\extras|\m{lang} as well as the language-specific
+|\lccodes|'s done in |\extras<language>| as well as the language-specific
 encoding (not set in the preamble by default). Multiple
 |\babelhyphenation|'s are allowed. For example:
 \begin{verbatim}
@@ -3309,7 +3336,7 @@
 
 It can be used only in the preamble, and patterns are added when the
 language is first selected, thus taking into account changes of
-|\lccodes|'s done in |\extras|\m{lang} as well as the language-specific
+|\lccodes|'s done in |\extras<language>| as well as the language-specific
 encoding (not set in the preamble by default). Multiple
 |\babelpatterns|'s are allowed.
 
@@ -3392,9 +3419,15 @@
   \hspace{2mm}%
   \parbox[t]{6.6cm}{\strut#3}\par}
 \bigskip\hrule\nobreak\vspace{.5mm}
-% \strut\hfil Transforms 
-% \medskip\hrule\nobreak
 
+\trans{}{digits.native}{\New{24.9} An alternative to |mapdigits|,
+available in the same locales. This transform is applied before the
+first prehyphenation, while |mapdigits| is applied after the last
+posthyphenation. Another difference is |mapdigits| cannot be disabled
+in the middle of a paragraph. (This transform is \textit{not} declared
+explicitly in |ini| files. Instead, it’s defined by |babel| if the key
+\texttt{numbers/digits.native} exists.)}
+
 \trans{Arabic}{transliteration.dad}{Applies the transliteration system
 devised by Yannis Haralambous for \textsf{dad} (simple and
 \TeX-friendly). Not yet complete, but sufficient for most texts.}
@@ -3638,11 +3671,10 @@
 hyphen (eg,~|.,;a-zA-Z|). If you need the hyphen to be assigned a
 class, write it at the very beginning of the list.
 
-There are several predefined ‘global’ classes, namely 
-|default|, |cjkideogram|, |cjkleftpunctuation|, |cjkrightpunctuation|,
-|boundary|, and |ignore|, which  are described in the \xetex{} manual
-(currently CJK classes are ‘empty’, but they will be assigned in a
-future release). 
+There are several predefined ‘global’ classes, namely |default|,
+|cjkideogram|, |cjkleftpunctuation|, |cjkrightpunctuation|, |boundary|,
+and |ignore|, which are described in the \xetex{} manual. These classes
+are used by the |linebreak.basic|, described below.
 
 \Describe{\babelinterchar}{\oarg{options}\marg{locale}
   \marg{class-first}\marg{class-second}\marg{code}}
@@ -4019,7 +4051,7 @@
                    \texttt{contents}  $\string|$
                    \texttt{footnotes}  $\string|$
                    \texttt{captions}  $\string|$
-                   \texttt{columns} $\string|$                
+                   \texttt{columns} $\string|$
                    \texttt{graphics} $\string|$
                    \texttt{extras}}
 
@@ -4229,7 +4261,7 @@
 
 \New{3.64} This is not the only way to inject code at those points. The
 events listed below can be used as a hook name in |\AddToHook| in the
-form |babel/|\m{language-name}|/|\m{event-name} (with |*| it’s applied to
+form |babel/<language-name>/<event-name>| (with |*| it’s applied to
 all languages), but there is a limitation, because the parameters
 passed with the \babel{} mechanism are not allowed. The |\AddToHook|
 mechanism does \textit{not} replace the current one in `babel`. Its
@@ -4236,7 +4268,7 @@
 main advantage is you can reconfigure `babel` even before loading it.
 See the example below.
 
-\Describe{\AddBabelHook}{\oarg{lang}\marg{name}\marg{event}\marg{code}}
+\Describe{\AddBabelHook}{\oarg{language}\marg{name}\marg{event}\marg{code}}
 
 The same name can be applied to several events. Hooks with a certain
 \marg{name} may be enabled and disabled for all defined events with
@@ -4269,10 +4301,10 @@
 \item[stopcommands] Used to reset the above, if necessary.
 \item[write] This event comes just after the switching commands are
   written to the |aux| file.
-\item[beforeextras] Just before executing |\extras|\m{language}. This
+\item[beforeextras] Just before executing |\extras<language>|. This
   event and the next one should not contain language-dependent code
-  (for that, add it to |\extras|\m{language}).
-\item[afterextras] Just after executing |\extras|\m{language}. For
+  (for that, add it to |\extras<language>|).
+\item[afterextras] Just after executing |\extras<language>|. For
   example, the following deactivates shorthands in all languages:
 \begin{verbatim}
 \AddBabelHook{noshort}{afterextras}{\languageshorthands{none}}
@@ -4291,7 +4323,7 @@
   other (|\string|'ed) and the original one.
 \item[afterreset] \New{3.9i} Executed when selecting a language just after
   |\originalTeX| is run and reset to its base value, before executing
-  |\captions|\m{language} and |\date|\m{language}.
+  |\captions<language>| and |\date<language>|.
 \item[begindocument] \New{3.88} Executed before the code written by
   |ldf| files with |\AtBeginDocument|. The optional argument with the
   language in this particular case is the language that wrote the code.
@@ -4305,16 +4337,8 @@
 \AddBabelHook{one}{foreign}{\BabelWrapText{\textit{##1}}
 \AddBabelHook{two}{foreign}{\BabelWrapText{\parse{##1}}
 \end{verbatim}
-the text becomes |\textit{\parse{|\m{text}|}}|. 
+the text becomes |\textit{\parse{<text>}}|. 
 
-  
-% STILL UNDER STUDY:
-% \item[beforestart] \New{3.34} Executed either at the beginning of the
-%   |aux| file (when read at the start of the document), or else at begin
-%   document. In other words, it makes sure the code is executed always
-%   and executed once. But be aware it is a somewhat dangerous, because
-%   the scope in the first case is local, while in the second case is
-%   global, so be careful with assignments.
 \end{description}
 
 Four events are used in \file{hyphen.cfg}, which are handled in a
@@ -4345,7 +4369,7 @@
 |\AddBabelHook|).
 
 In addition, locale-specific hooks in the form
-|babel/|\m{language-name}|/|\m{event-name} are \textit{recognized}
+|babel/<language-name>/<event-name>| are \textit{recognized}
 (executed just before the localized \babel{} hooks), but they are
 \textit{not predefined}. You have to do it yourself. For example, to
 set |\frenchspacing| only in |bengali|:
@@ -4475,7 +4499,7 @@
 
 For example:
 \begin{verbatim}
-\babelcharproperty{`¿}{mirror}{`?}   
+\babelcharproperty{`¿}{mirror}{`?}
 \babelcharproperty{`-}{direction}{l}  % or al, r, en, an, on, et, cs
 \babelcharproperty{`)}{linebreak}{cl} % or id, op, cl, ns, ex, in, hy
 \end{verbatim}
@@ -4711,7 +4735,7 @@
 With the previous settings, if the encoding when the language is
 selected is |T1| then the patterns in \file{hyphenT1.ger} are
 used, but otherwise use those in \file{hyphen.ger} (note the encoding
-can be set in |\extras|\m{lang}).
+can be set in |\extras<language>|).
 
 A typical error when using \babel{} is the following:
 \begin{verbatim}
@@ -4761,11 +4785,13 @@
 \item Language names must be all lowercase. If an unknown language is
   selected, \babel{} will attempt setting it after lowercasing its
   name.
-\item The semantics of modifiers is not defined (on purpose). In
-  most cases, they will just be simple separated options (eg,
+\item The semantics of modifiers is not defined (on purpose). In most
+  cases, they will just be simple separated options (eg,
   \texttt{spanish}), but a language might require, say, a set of
   options organized as a tree with suboptions (in such a case, the
-  recommended separator is \verb|/|).
+  recommended separator is \verb|/|). How modifiers (saved in
+  |\BabelModifiers|) are handled are left to language styles; they can
+  use |\in@|, loop them with |\@for| or load |keyval|, for example.
 \end{itemize}
 
 Some recommendations:
@@ -4773,7 +4799,7 @@
 \item The preferred shorthand is |"|, which is not used in \LaTeX{}
   (quotes are entered as |``| and |''|). Other good choices are
   characters which are not used in a certain context (eg, |=| in an
-  ancient language). Note however |=|, |<|, |>|, |:| and the like
+  ancient language). Note however |=|, \texttt{<}, |>|, |:| and the like
   can be dangerous, because they may be used as part of the syntax
   of some elements (numeric expressions, key/value pairs, etc.).
 \item Captions should not contain shorthands or encoding-dependent
@@ -4780,12 +4806,12 @@
   commands (the latter is not always possible, but should be clearly
   documented). They should be defined using the LICR. You may
   also use the new tools for encoded strings, described below.
-\item Avoid adding things to |\noextras|\m{lang} except for umlauthigh
+\item Avoid adding things to |\noextras<language>| except for umlauthigh
   and friends, |\bbl at deactivate|, |\bbl@(non)frenchspacing|, and
-  language-specific macros. Use always, if possible, |\babel at save| and
+  language-specific macros. Use always, wherever possible, |\babel at save| and
   |\babel at savevariable| (except if you still want to have access to the
   previous value). Do not reset a macro or a setting to a hardcoded
-  value. Never. Instead save its value in |\extras|\m{lang}.
+  value. Never. Instead save its value in |\extras<language>|.
 \item Do not switch scripts. If you want to make sure a set of glyphs
   is used, switch either the font encoding (low-level) or the language
   (high-level, which in turn may switch the font encoding). Usage of things
@@ -4795,11 +4821,10 @@
   prefix. It is used by \babel{} and it can lead to incompatibilities.
 \end{itemize}
 
-There are no special requirements for documenting your language
-files. Now they are not included in the base \babel{} manual, so
-provide a standalone document suited for your needs, as well as other
-files you think can be useful. A PDF and a ``readme'' are strongly
-recommended.
+There are no special requirements for documenting your language files.
+Just provide a standalone document suited to your needs, as well as
+other files you think can be useful. A PDF and a ``readme'' are
+strongly recommended.
 
 \subsection{Guidelines for contributed languages}
 \label{contribute}
@@ -4806,8 +4831,8 @@
 
 Currently, the easiest way to contribute a new language is by taking
 one of the 500 or so |ini| templates available on GitHub as a basis.
-Just make a pull request or download it and then, after filling the
-fields, sent it to me. Fell free to ask for help or to make feature
+Just make a pull request or download it, and then, after filling out the
+fields, sent it to me. Feel free to ask for help or to make features
 requests.
 
 As to \texttt{ldf} files, now language files are “outsourced” and are
@@ -4821,8 +4846,8 @@
 
 \begin{itemize}
 \item Do not hesitate stating on the file heads you are the author and the
-  maintainer, if you actually are. There is no need to state the babel
-  maintainer(s) as authors if they have not contributed significantly
+  maintainer, if you actually are. There is no need to state the \babel{}
+  maintainer(s) as author(s) if they have not contributed significantly
   to your language files.
 \item Fonts are not strictly part of a language, so they are best placed
   in the corresponding TeX tree. This includes not only \texttt{tfm},
@@ -4830,10 +4855,11 @@
   like, but also \texttt{fd} ones.
 \item Font and input encodings are usually best placed in the
   corresponding tree, too, but sometimes they belong more naturally to
-  the babel style.  Note you may also need to define a LICR.
-\item \Babel{} ldf files may just interface a framework, as it happens often
-  with Oriental languages/scripts. This framework is best placed in its
-  own directory.
+  the \babel{} style.  Note you may also need to define a LICR
+  (\textit{TLC3}, I, 757f.).
+\item \Babel{} \texttt{ldf} files may just interface a framework, as it
+  happens often with Oriental languages/scripts. This framework is best
+  placed in its own directory.
 \end{itemize}
 
 The following page provides a starting point for \texttt{ldf} files:
@@ -4840,9 +4866,9 @@
 \texttt{http://www.texnia.com/incubator.html}. See also
 \texttt{https://latex3.github.io/babel/guides/list-of-locale-templates.html}.
 
-If you need further assistance and technical advice in the
-development of language styles, I am willing to help you.  And of
-course, you can make any suggestion you like.
+If you need further assistance and technical advice in the development
+of language styles, I will be happy to help you. And of course, you can
+make any suggestion you like.
 
 \subsection{Basic macros}
 
@@ -4875,7 +4901,7 @@
 \renewcommand\spanishhyphenmins{34}
 \end{verbatim}
 (Assigning |\lefthyphenmin| and |\righthyphenmin| directly in
-|\extras<lang>| has no effect.)
+|\extras<language>| has no effect.)
 
 \DescribeMacro{\providehyphenmins}
 The macro |\providehyphenmins| should be used in the language
@@ -5254,12 +5280,12 @@
 \EndBabelCommands
 \end{verbatim}
 
-When used in |ldf| files, previous values of |\|\m{category}\m{language}
+When used in |ldf| files, previous values of |\<category><language>|
 are overridden, which means the old way to define strings still works
 and used by default (to be precise, is first set to undefined and then
 strings are added). However, when used in the preamble or in a
 package, new settings are added to the previous ones, if the language
-exists (in the \babel{} sense, ie, if |\date|\m{language} exists).
+exists (in the \babel{} sense, ie, if |\date<language>| exists).
 
 \begin{note}
   The package option |strings| introduced in version 3.9 (around 2013)
@@ -5355,7 +5381,7 @@
 \end{verbatim}
 is true with any of these two environment selectors.
 
-Its natural place of use is in hooks or in |\extras|\m{language}.
+Its natural place of use is in hooks or in |\extras<language>|.
 
 \else
 
@@ -5365,14 +5391,15 @@
 
 \section{Acknowledgements}
 
-I would like to thank all who volunteered as $\beta$-testers for their
-time. Michel Goossens supplied contributions for most of the other
-languages. Nico Poppelier helped polish the text of the documentation
-and supplied parts of the macros for the Dutch language. Paul Wackers
-and Werenfried Spit helped find and repair bugs. During the further
-development of the babel system I received much help from Bernd
-Raichle, for which I am grateful.
+In the initial stages of the development of \babel, Bernd Raichle
+provided many helpful suggestions and Michel Goossens supplied
+contributions for many languages. Ideas from Nico Poppelier, Piet van
+Oostrum and many others have been used. Paul Wackers and Werenfried
+Spit helped find and repair bugs.
 
+More recently, there are significant contributions by Salim Bou, Ulrike
+Fischer and Udi Fogiel.
+
 There are also many contributors for specific languages, which are
 mentioned in the respective files. Without them, \babel{} just
 wouldn’t exist.
@@ -5416,25 +5443,11 @@
 \end{thebibliography}
 \end{document}
 %</filedriver>
-%
 % \fi
 %
 % \addtolength{\oddsidemargin}{-15pt}
 % \addtolength{\textwidth}{50pt}
 %
-%\begingroup
-%  \catcode`<=\active%
-%  \catcode`>=\active
-%  \makeatletter
-%  \gdef\MakePrivateLetters{%
-%    \catcode`@=11\relax
-%    \gdef<##1{\ifx##1@$\langle\langle$\bgroup\itshape\rmfamily
-%      \expandafter\bblref
-%      \else\string<##1\fi}%
-%    \gdef\bblref##1@>{##1\/\egroup$\rangle\rangle$}}%
-%  \global\let\check at percent\saved at check@percent
-%\endgroup
-%
 % \small
 %
 % The \babel{} package is being developed incrementally, which means
@@ -5446,7 +5459,7 @@
 % \section{Identification and loading of required files}
 %
 % \textit{Code documentation is still under revision.}
-
+%
 % The \babel{} package after unpacking consists of the following files:
 % \begin{description}
 % \itemsep=-\parskip
@@ -5460,11 +5473,11 @@
 % \item[hyphen.cfg] is the file to be used when generating the
 %   formats to load hyphenation patterns.
 % \end{description}
-% There some additional |tex|, |def| and |lua| files
+% There some additional |tex|, |def| and |lua| files.
 %
 % The \babel{} installer extends \textsf{docstrip} with a few
 % ``pseudo-guards'' to set ``variables'' used at installation time.
-% They are used with |<||@name@>| at the appropriate places in the
+% They are used with \texttt{<@name@>} at the appropriate places in the
 % source code and defined with either
 % $\langle\langle$\textit{name}=\textit{value}$\rangle\rangle$, or with
 % a series of lines between
@@ -5471,15 +5484,15 @@
 % $\langle\langle$|*|\textit{name}$\rangle\rangle$ and
 % $\langle\langle$|/|\textit{name}$\rangle\rangle$. The latter is
 % cumulative (eg, with \textit{More package options}). That brings a
-% little bit of literate programming. The guards |<-name>| and
-% |<+name>| have been redefined, too. See |babel.ins| for further
+% little bit of literate programming. The guards \texttt{<-name>} and
+% \texttt{<+name>} have been redefined, too. See |babel.ins| for further
 % details.
 %
 % \section{\texttt{locale} directory}
 %
 % A required component of \babel{} is a set of |ini| files with basic
-% definitions for about 250 languages. They are distributed as a
-% separate |zip| file, not packed as |dtx|. Most of them are
+% definitions for about 300 languages. They are distributed as a
+% separate |zip| file, not packed as |dtx|. Many of them are
 % essentially finished (except bugs and mistakes, of course). Some of
 % them are still incomplete (but they will be usable), and there are
 % some omissions (eg, there are no geographic areas in Spanish). Not
@@ -5494,15 +5507,14 @@
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=24.8>>
-%<<date=2024/08/18>>
+%<<version=24.9>>
+%<<date=2024/08/29>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
-% may change in the future}. This applies mainly to those recently
+% may change in the future.} This applies mainly to those recently
 % added for replacing, trimming and looping. The older ones, like
 % |\bbl at afterfi|, will not change.
-%
 % We define some basic macros which just make the code cleaner.
 % |\bbl at add| is now used internally instead of |\addto| because of
 % the unpredictable behavior of the latter. Used in
@@ -5536,11 +5548,11 @@
 \def\bbl at for#1#2#3{\bbl at loopx#1{#2}{\ifx#1\@empty\else#3\fi}}
 %    \end{macrocode}
 %
-%  \begin{macro}{\bbl at add@list}
-%    This internal macro adds its second argument to a comma
-%    separated list in its first argument. When the list is not
-%    defined yet (or empty), it will be initiated. It presumes
-%    expandable character strings.
+% \begin{macro}{\bbl at add@list}
+% This internal macro adds its second argument to a comma separated
+% list in its first argument. When the list is not defined yet (or
+% empty), it will be initiated. It presumes expandable character
+% strings.
 %
 %    \begin{macrocode}
 \def\bbl at add@list#1#2{%
@@ -5551,18 +5563,17 @@
     #2}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at afterelse}
-%  \begin{macro}{\bbl at afterfi}
-%    Because the code that is used in the handling of active
-%    characters may need to look ahead, we take extra care to `throw'
-%    it over the |\else| and |\fi| parts of an
-%    |\if|-statement\footnote{This code is based on code presented in
-%    TUGboat vol. 12, no2, June 1991 in ``An expansion Power Lemma''
-%    by Sonja Maus.}. These macros will break if another |\if...\fi|
-%    statement appears in one of the arguments and it is not enclosed
-%    in braces.
+% \begin{macro}{\bbl at afterelse}
+% \begin{macro}{\bbl at afterfi}
+% Because the code that is used in the handling of active characters
+% may need to look ahead, we take extra care to `throw' it over the
+% |\else| and |\fi| parts of an |\if|-statement\footnote{This code is
+% based on code presented in TUGboat vol. 12, no2, June 1991 in ``An
+% expansion Power Lemma'' by Sonja Maus.}. These macros will break if
+% another |\if...\fi| statement appears in one of the arguments and it
+% is not enclosed in braces.
 %
 %    \begin{macrocode}
 \long\def\bbl at afterelse#1\else#2\fi{\fi#1}
@@ -5569,18 +5580,18 @@
 \long\def\bbl at afterfi#1\fi{\fi#1}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\bbl at exp}
 %
-%   Now, just syntactical sugar, but it makes partial expansion of
-%   some code a lot more simple and readable. Here |\\| stands for
-%   |\noexpand|, |\<..>| for |\noexpand| applied to a built macro
-%   name (which does not define the macro if undefined to
-%   |\relax|, because it is created locally), and |\[..]| for one-level
-%   expansion (where |..| is the macro name without the backslash). The
-%   result may be followed by extra arguments, if necessary.
+% Now, just syntactical sugar, but it makes partial expansion of some
+% code a lot more simple and readable. Here |\\| stands for
+% |\noexpand|, |\<..>| for |\noexpand| applied to a built macro name
+% (which does not define the macro if undefined to |\relax|, because it
+% is created locally), and |\[..]| for one-level expansion (where |..|
+% is the macro name without the backslash). The result may be followed
+% by extra arguments, if necessary.
 %
 %    \begin{macrocode}
 \def\bbl at exp#1{%
@@ -5597,13 +5608,13 @@
 % \end{macro}
 %
 % \begin{macro}{\bbl at trim}
-%   The following piece of code is stolen (with some changes) from
-%   \textsf{keyval}, by David Carlisle. It defines two macros:
-%   |\bbl at trim| and |\bbl at trim@def|. The first one strips the leading
-%   and trailing spaces from the second argument and then applies the
-%   first argument (a macro, |\toks@| and the like). The second one,
-%   as its name suggests, defines the first argument as the stripped
-%   second argument.
+% The following piece of code is stolen (with some changes) from
+% \textsf{keyval}, by David Carlisle. It defines two macros:
+% |\bbl at trim| and |\bbl at trim@def|. The first one strips the leading and
+% trailing spaces from the second argument and then applies the first
+% argument (a macro, |\toks@| and the like). The second one, as its
+% name suggests, defines the first argument as the stripped second
+% argument.
 %
 %    \begin{macrocode}
 \def\bbl at tempa#1{%
@@ -5623,11 +5634,11 @@
 % \end{macro}
 %
 % \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 does not
-%   waste memory. Defined inside a group, to avoid \cs{ifcsname} being
-%   implicitly set to |\relax| by the |\csname| test.
+% 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 does not waste
+% memory. Defined inside a group, to avoid \cs{ifcsname} being
+% implicitly set to |\relax| by the |\csname| test.
 %
 %    \begin{macrocode}
 \begingroup
@@ -5654,9 +5665,9 @@
 % \end{macro}
 %
 % \begin{macro}{\bbl at ifblank}
-%   A tool from \textsf{url}, by Donald Arseneau, which tests if a
-%   string is empty or space. The companion macros tests if a macro is
-%   defined with some `real' value, ie, not |\relax| and not empty,
+% A tool from \textsf{url}, by Donald Arseneau, which tests if a string
+% is empty or space. The companion macros tests if a macro is defined
+% with some `real' value, ie, not |\relax| and not empty,
 %
 %    \begin{macrocode}
 \def\bbl at ifblank#1{%
@@ -5731,7 +5742,7 @@
 % because they are retokenized). It may change! (or even merged with
 % |\bbl at replace|; I'm not sure checking the replacement is really
 % necessary or just paranoia).
-% 
+%
 %    \begin{macrocode}
 \ifx\detokenize\@undefined\else % Unused macros if old Plain TeX
   \bbl at exp{\def\\\bbl at parsedef##1\detokenize{macro:}}#2->#3\relax{%
@@ -5818,9 +5829,9 @@
       {\expandafter\OE\expandafter}\expandafter{\oe}%
     \ifin@
       \bbl at afterelse\expandafter\MakeUppercase
-    \else  
+    \else
       \bbl at afterfi\expandafter\MakeLowercase
-    \fi  
+    \fi
   \else
     \expandafter\@firstofone
   \fi}
@@ -5831,7 +5842,7 @@
 % |#|'s. Used to deal with alph, Alph and frenchspacing when there are
 % already changes (with |\babel at save|). 
 %
-%    \begin{macrocode}  
+%    \begin{macrocode}
 \def\bbl at extras@wrap#1#2#3{% 1:in-test, 2:before, 3:after
   \toks@\expandafter\expandafter\expandafter{%
     \csname extras\languagename\endcsname}%
@@ -5897,24 +5908,22 @@
 %<</Define core switching macros>>
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
-%    Now we make sure all required files are loaded.  When the command
-%    |\AtBeginDocument| doesn't exist we assume that we are dealing
-%    with a plain-based format. In that case the file
-%    \file{plain.def} is needed (which also defines
-%    |\AtBeginDocument|, and therefore it is not loaded twice). We
-%    need the first part when the format is created, and |\orig at dump|
-%    is used as a flag. Otherwise, we need to use the second part, so
-%    |\orig at dump| is not defined (\file{plain.def} undefines it).
+% Now we make sure all required files are loaded. When the command
+% |\AtBeginDocument| doesn't exist we assume that we are dealing with a
+% plain-based format. In that case the file \file{plain.def} is needed
+% (which also defines |\AtBeginDocument|, and therefore it is not
+% loaded twice). We need the first part when the format is created, and
+% |\orig at dump| is used as a flag. Otherwise, we need to use the second
+% part, so |\orig at dump| is not defined (\file{plain.def} undefines it).
 %
-%    Check if the current version of \file{switch.def} has been
-%    previously loaded (mainly, \file{hyphen.cfg}). If not, load it
-%    now. We cannot load |babel.def| here because we first need to
-%    declare and process the package options.
+% Check if the current version of \file{switch.def} has been previously
+% loaded (mainly, \file{hyphen.cfg}). If not, load it now. We cannot
+% load |babel.def| here because we first need to declare and process
+% the package options.
 %
-%
 % \subsection{The Package File (\LaTeX, \texttt{babel.sty})}
 %
 %    \begin{macrocode}
@@ -5922,7 +5931,7 @@
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
 \ProvidesPackage{babel}[<@date@> v<@version@> The Babel package]
 %    \end{macrocode}
-% 
+%
 % Start with some “private” debugging tool, and then define macros for
 % errors.
 %
@@ -5970,7 +5979,7 @@
 % 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
+% 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.
@@ -6022,7 +6031,7 @@
 %
 % Now the \texttt{base} option. With it we can define (and load, with
 % \luatex) hyphenation patterns, even if we are not interested in the
-% rest of babel.
+% rest of \babel{}.
 %
 %    \begin{macrocode}
 \bbl at trace{Defining option 'base'}
@@ -6049,12 +6058,10 @@
 %
 % \subsection{\texttt{key=value} options and other general option}
 %
-%    The following macros extract language modifiers, and only real
-%    package options are kept in the option list. Modifiers are saved
-%    and assigned to |\BabelModifiers| at |\bbl at load@language|; when
-%    no modifiers have been given, the former is |\relax|. How
-%    modifiers are handled are left to language styles; they can use
-%    |\in@|, loop them with |\@for| or load |keyval|, for example.
+% The following macros extract language modifiers, and only real
+% package options are kept in the option list. Modifiers are saved and
+% assigned to |\BabelModifiers| at |\bbl at load@language|; when no
+% modifiers have been given, the former is |\relax|.
 %
 %    \begin{macrocode}
 \bbl at trace{key=value and another general options}
@@ -6075,7 +6082,7 @@
       \in@{$modifiers$}{$#1$}% TODO. Allow spaces.
       \ifin@
         \bbl at tempe#2\@@
-      \else   
+      \else
         \in@{=}{#1}%
         \ifin@
           \edef\bbl at tempc{\ifx\bbl at tempc\@empty\else\bbl at tempc,\fi#1.#2}%
@@ -6105,12 +6112,11 @@
 \DeclareOption{noconfigs}{}
 \DeclareOption{showlanguages}{}
 \DeclareOption{silent}{}
-% \DeclareOption{mono}{}
 \DeclareOption{shorthands=off}{\bbl at tempa shorthands=\bbl at tempa}
 \chardef\bbl at iniflag\z@
 \DeclareOption{provide=*}{\chardef\bbl at iniflag\@ne}    % main -> +1
-\DeclareOption{provide+=*}{\chardef\bbl at iniflag\tw@}   % add = 2
-\DeclareOption{provide*=*}{\chardef\bbl at iniflag\thr@@} % add + main
+\DeclareOption{provide+=*}{\chardef\bbl at iniflag\tw@}   % second = 2
+\DeclareOption{provide*=*}{\chardef\bbl at iniflag\thr@@} % second + main
 % A separate option
 \let\bbl at autoload@options\@empty
 \DeclareOption{provide@=*}{\def\bbl at autoload@options{import}}
@@ -6160,7 +6166,7 @@
   \bbl at xin@{\string=}{\CurrentOption}%
   \ifin@
     \expandafter\bbl at tempa\CurrentOption\bbl at tempa
-  \else  
+  \else
     \bbl at add@list\bbl at language@opts{\CurrentOption}%
   \fi}
 %    \end{macrocode}
@@ -6183,7 +6189,7 @@
       \bbl at replace\bbl at opt@provide{;}{,}%
     \fi}
 \fi
-% 
+%
 %    \end{macrocode}
 %
 % \subsection{Conditional loading of shorthands}
@@ -6214,8 +6220,7 @@
 \else
 %    \end{macrocode}
 %
-%    The following macro tests if a shorthand is one of the allowed
-%    ones.
+% The following macro tests if a shorthand is one of the allowed ones.
 %
 %    \begin{macrocode}
   \def\bbl at ifshorthand#1{%
@@ -6363,19 +6368,18 @@
   \endgroup}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%    |\bbl at iflanguage| executes code only if the language |l@|
-%    exists. Otherwise raises an error.
+% |\bbl at iflanguage| executes code only if the language |l@| 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
-%    long-standing bug when |\foreignlanguage| and the like appear in
-%    a |\MakeXXXcase|. However, a lowercase form is not imposed to
-%    improve backward compatibility (perhaps you defined a language
-%    named |MYLANG|, but unfortunately mixed case names cannot be
-%    trapped). Note |l@| is encapsulated, so that its case does not
-%    change.
+% 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
+% long-standing bug when |\foreignlanguage| and the like appear in a
+% |\MakeXXXcase|. However, a lowercase form is not imposed to improve
+% backward compatibility (perhaps you defined a language named
+% |MYLANG|, but unfortunately mixed case names cannot be trapped). Note
+% |l@| is encapsulated, so that its case does not change.
 %
 %    \begin{macrocode}
 \def\bbl at fixname#1{%
@@ -6407,7 +6411,7 @@
 % sr-latn-ba becomes fr-Latn-BA. Note |#4| may contain some
 % |\@empty|'s, but they are eventually removed. |\bbl at bcplookup| either
 % returns the found |ini| or it is |\relax|.
-% 
+%
 %    \begin{macrocode}
 \def\bbl at bcpcase#1#2#3#4\@@#5{%
   \ifx\@empty#3%
@@ -6426,7 +6430,7 @@
     \IfFileExists{babel-\bbl at tempa-\bbl at tempb.ini}%
       {\edef\bbl at bcp{\bbl at tempa-\bbl at tempb}}%
       {}%
-    \ifx\bbl at bcp\relax   
+    \ifx\bbl at bcp\relax
       \IfFileExists{babel-\bbl at tempa.ini}{\let\bbl at bcp\bbl at tempa}{}%
     \fi
   \else
@@ -6435,17 +6439,17 @@
     \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   
+    \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   
+    \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   
+    \ifx\bbl at bcp\relax
       \IfFileExists{babel-\bbl at tempa.ini}{\let\bbl at bcp\bbl at tempa}{}%
     \fi
   \fi\fi}
@@ -6457,7 +6461,7 @@
   \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}}}% 
+    {\edef\languagename{\@nameuse{bbl at bcp@map@\languagename}}}%
   \ifbbl at bcpallowed
     \expandafter\ifx\csname date\languagename\endcsname\relax
       \expandafter
@@ -6482,7 +6486,7 @@
 %<+core>
 %    \end{macrocode}
 %
-%  \begin{macro}{\iflanguage}
+% \begin{macro}{\iflanguage}
 % Users might want to test (in a private package for instance)
 % which language is currently active. For this we provide a test
 % macro, |\iflanguage|, that has three arguments.  It checks
@@ -6501,11 +6505,11 @@
     \fi}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \subsection{Selecting the language}
 %
-%  \begin{macro}{\selectlanguage}
+% \begin{macro}{\selectlanguage}
 %
 % The macro |\selectlanguage| checks whether the language is
 % already defined before it performs its actual task, which is to
@@ -6537,9 +6541,9 @@
 %
 % \end{macro}
 %
-%    Since version 3.5 \babel\ writes entries to the auxiliary files in
-%    order to typeset table of contents etc. in the correct language
-%    environment.
+% Since version 3.5 \babel\ writes entries to the auxiliary files in
+% order to typeset table of contents etc. in the correct language
+% environment.
 %
 % \begin{macro}{\bbl at pop@language}
 %
@@ -6581,7 +6585,7 @@
         \xdef\bbl at language@stack{\languagename+}%
       \else
         \xdef\bbl at language@stack{\languagename+\bbl at language@stack}%
-      \fi    
+      \fi
     \fi
   \fi}
 %    \end{macrocode}
@@ -6590,10 +6594,10 @@
 % we need to remove the element from the stack while storing it in the
 % macro |\languagename|. For this we first define a helper function.
 %
-%  \begin{macro}{\bbl at pop@lang}
-%    This macro stores its first element (which is delimited by the
-%    `+'-sign) in |\languagename| and stores the rest of the string
-%    in |\bbl at language@stack|.
+% \begin{macro}{\bbl at pop@lang}
+% This macro stores its first element (which is delimited by the
+% `+'-sign) in |\languagename| and stores the rest of the string in
+% |\bbl at language@stack|.
 %
 %    \begin{macrocode}
 \def\bbl at pop@lang#1+#2\@@{%
@@ -6601,7 +6605,7 @@
   \xdef\bbl at language@stack{#2}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 % The reason for the somewhat weird arrangement of arguments to the
 % helper function is the fact it is called in the following way.
 % This means that before |\bbl at pop@lang| is executed \TeX\ first
@@ -6623,9 +6627,9 @@
 % Once the name of the previous language is retrieved from the stack,
 % it is fed to |\bbl at set@language| to do the actual work of
 % switching everything that needs switching.
-%  \end{macro}
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % An alternative way to identify languages (in the \babel{} sense)
 % with a numerical value is introduced in 3.30. This is one of the
@@ -6667,9 +6671,9 @@
 \let\endselectlanguage\relax
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at set@language}
+% \begin{macro}{\bbl at set@language}
 %
 % The macro |\bbl at set@language| takes care of switching the language
 % environment \emph{and} of writing entries on the auxiliary files.
@@ -6760,7 +6764,7 @@
   \select at language{#1}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % First, check if the user asks for a known language. If so,
 % update the value of |\language| and call |\originalTeX|
@@ -6787,7 +6791,7 @@
 % current values, then we check if |\|\langvar|hyphenmins| is
 % defined. If it is not, we set default values (2 and 3), otherwise
 % the values in |\|\langvar|hyphenmins| will be used.
-% 
+%
 % No text is supposed to be added with switching captions and date, so
 % we remove any spurious spaces with |\bbl at bsphack| and |\bbl at esphack|.
 %
@@ -6818,7 +6822,7 @@
         \csname captions#1\endcsname\relax
       \fi
       \bbl at xin@{,date,}{,\bbl at select@opts,}%
-      \ifin@  % if \foreign... within \<lang>date
+      \ifin@  % if \foreign... within \<language>date
         \csname date#1\endcsname\relax
       \fi
     \fi
@@ -7004,9 +7008,9 @@
    \expandafter\bbl at tempa\expandafter{\BabelText{#1}}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\foreign at language}
+% \begin{macro}{\foreign at language}
 %
 % This macro does the work for |\foreignlanguage| and the
 % \Lenv{otherlanguage*} environment. First we need to store the name
@@ -7091,7 +7095,7 @@
     \endgroup}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \begin{environment}{hyphenrules}
 %
@@ -7136,11 +7140,11 @@
   \fi}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\set at hyphenmins}
-%    This macro sets the values of |\lefthyphenmin| and
-%    |\righthyphenmin|. It expects two values as its argument.
+% \begin{macro}{\set at hyphenmins}
+% This macro sets the values of |\lefthyphenmin| and |\righthyphenmin|.
+% It expects two values as its argument.
 %
 %    \begin{macrocode}
 \def\set at hyphenmins#1#2{%
@@ -7179,26 +7183,26 @@
 \fi
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\originalTeX}
-%    The macro|\originalTeX| should be known to \TeX\ at this moment.
-%    As it has to be expandable we |\let| it to |\@empty| instead of
-%    |\relax|.
+% \begin{macro}{\originalTeX}
+% The macro|\originalTeX| should be known to \TeX\ at this moment. As
+% it has to be expandable we |\let| it to |\@empty| instead of
+% |\relax|.
 %
 %    \begin{macrocode}
 \ifx\originalTeX\@undefined\let\originalTeX\@empty\fi
 %    \end{macrocode}
 %
-%    Because this part of the code can be included in a format, we
-%    make sure that the macro which initializes the save mechanism,
-%    |\babel at beginsave|, is not considered to be undefined.
+% Because this part of the code can be included in a format, we make
+% sure that the macro which initializes the save mechanism,
+% |\babel at beginsave|, is not considered to be undefined.
 %
 %    \begin{macrocode}
 \ifx\babel at beginsave\@undefined\let\babel at beginsave\relax\fi
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % A few macro names are reserved for future releases of \babel, which
 % will use the concept of `locale':
@@ -7249,7 +7253,7 @@
   \bbl at warning{%
     \@backslashchar#1 not set for '\languagename'. Please,\\%
     define it after the language has been loaded\\%
-    (typically in the preamble) with:\\% 
+    (typically in the preamble) with:\\%
     \string\setlocalecaption{\languagename}{\bbl at tempa}{..}\\%
     Feel free to contribute on github.com/latex3/babel.\\%
     Reported}}
@@ -7306,7 +7310,7 @@
 \fi
 %    \end{macrocode}
 %
-%  \begin{macro}{\addto}
+% \begin{macro}{\addto}
 % It takes two arguments, a \meta{control sequence} and \TeX-code to
 % be added to the \meta{control sequence}.
 %
@@ -7330,7 +7334,7 @@
   \fi}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % The macro |\initiate at active@char| below takes all the necessary
 % actions to make its argument a shorthand character. The real work
@@ -7344,7 +7348,7 @@
     \lowercase{\endgroup#1~}}
 %    \end{macrocode}
 %
-%  \begin{macro}{\bbl at redefine}
+% \begin{macro}{\bbl at redefine}
 %
 % To redefine a command, we save the old meaning of the macro. Then
 % we redefine it to call the original macro with the `sanitized'
@@ -7361,11 +7365,11 @@
 \@onlypreamble\bbl at redefine
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at redefine@long}
-%    This version of |\babel at redefine| can be used to redefine |\long|
-%    commands such as |\ifthenelse|.
+% \begin{macro}{\bbl at redefine@long}
+% This version of |\babel at redefine| can be used to redefine |\long|
+% commands such as |\ifthenelse|.
 %
 %    \begin{macrocode}
 \def\bbl at redefine@long#1{%
@@ -7375,7 +7379,7 @@
 \@onlypreamble\bbl at redefine@long
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\bbl at redefinerobust}
 % For commands that are redefined, but which \textit{might} be
@@ -7396,7 +7400,7 @@
 \@onlypreamble\bbl at redefinerobust
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \subsection{Hooks}
 %
@@ -7453,13 +7457,13 @@
 % \begin{macro}{\babelensure}
 %
 % The user command just parses the optional argument and creates a
-% new macro named |\bbl at e@|\m{language}. We register a hook at the
+% new macro named |\bbl at e@<language>|. We register a hook at the
 % |afterextras| event which just executes this macro in a
 % ``complete'' selection (which, if undefined, is |\relax| and does
 % nothing). This part is somewhat involved because we have to make
 % sure things are expanded the correct number of times.
 %
-% The macro |\bbl at e@|\m{language} contains
+% The macro |\bbl at e@<language>| contains
 % |\bbl at ensure|\marg{include}\marg{exclude}\marg{fontenc}, which in in
 % turn loops over the macros names in |\bbl at captionslist|, excluding
 % (with the help of |\in@|) those in the |exclude| list. If the
@@ -7536,7 +7540,7 @@
   \alsoname\proofname\glossaryname}
 %    \end{macrocode}
 %
-%    \end{macro}
+% \end{macro}
 %
 % \subsection{Setting up language files}
 %
@@ -7605,10 +7609,10 @@
   \bbl at ldfinit}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\ldf at quit}
-%    This macro interrupts the processing of a language definition file.
+% \begin{macro}{\ldf at quit}
+% This macro interrupts the processing of a language definition file.
 %
 %    \begin{macrocode}
 \def\ldf at quit#1{%
@@ -7618,16 +7622,16 @@
   \endinput}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\ldf at finish}
-%    This macro takes one argument. It is the name of the language
-%    that was defined in the language definition file.
+% \begin{macro}{\ldf at finish}
+% This macro takes one argument. It is the name of the language that
+% was defined in the language definition file.
 %
-%    We load the local configuration file if one is present, we set
-%    the main language (taking into account that the argument might be
-%    a control sequence that needs to be expanded) and reset the
-%    category code of the @-sign.
+% We load the local configuration file if one is present, we set the
+% main language (taking into account that the argument might be a
+% control sequence that needs to be expanded) and reset the category
+% code of the @-sign.
 %
 %    \begin{macrocode}
 \def\bbl at afterldf#1{% TODO. Merge into the next macro? Unused elsewhere
@@ -7643,11 +7647,11 @@
   \catcode`\==\eqcatcode \let\eqcatcode\relax}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%    After the preamble of the document the commands |\LdfInit|,
-%    |\ldf at quit| and |\ldf at finish| are no longer needed. Therefore
-%    they are turned into warning messages in \LaTeX.
+% After the preamble of the document the commands |\LdfInit|,
+% |\ldf at quit| and |\ldf at finish| are no longer needed. Therefore they
+% are turned into warning messages in \LaTeX.
 %
 %    \begin{macrocode}
 \@onlypreamble\LdfInit
@@ -7655,12 +7659,11 @@
 \@onlypreamble\ldf at finish
 %    \end{macrocode}
 %
-%  \begin{macro}{\main at language}
-%  \begin{macro}{\bbl at main@language}
-%    This command should be used in the various language definition
-%    files. It stores its argument in |\bbl at main@language|; to be used
-%    to switch to the correct language at the beginning of the
-%    document.
+% \begin{macro}{\main at language}
+% \begin{macro}{\bbl at main@language}
+% This command should be used in the various language definition files.
+% It stores its argument in |\bbl at main@language|; to be used to switch
+% to the correct language at the beginning of the document.
 %
 %    \begin{macrocode}
 \def\main at language#1{%
@@ -7671,14 +7674,19 @@
 %    \end{macrocode}
 %
 % We also have to make sure that some code gets executed at the
-% beginning of the document, either when the |aux| file is read or,
-% if it does not exist, when the |\AtBeginDocument| is executed.
-% Languages do not set |\pagedir|, so we set here for the whole
-% document to the main |\bodydir|.
+% beginning of the document, either when the |aux| file is read or, if
+% it does not exist, when the |\AtBeginDocument| is executed. Languages
+% do not set |\pagedir|, so we set here for the whole document to the
+% main |\bodydir|. TODO. Handle correctly the 'nil' language, to avoid
+% errors in toc files if there was a typo in a name.
 %
+% The code written to the |aux| file attempts to avoid errors if
+% \babel\ is removed from the document.
+%
 %    \begin{macrocode}
 \def\bbl at beforestart{%
   \def\@nolanerr##1{%
+    \bbl at carg\chardef{l@##1}\z@
     \bbl at warning{Undefined language '##1' in aux.\\Reported}}%
   \bbl at usehooks{beforestart}{}%
   \global\let\bbl at beforestart\relax}
@@ -7686,8 +7694,8 @@
   {\@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{\unexpanded{%
+      \providecommand\babel at aux[2]{\global\let\babel at toc\@gobbletwo}}}%
     \immediate\write\@mainaux{\string\@nameuse{bbl at beforestart}}%
   \fi
   \expandafter\selectlanguage\expandafter{\bbl at main@language}%
@@ -7717,8 +7725,8 @@
 \fi
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % A bit of optimization. Select in heads/foots the language only if
 % necessary.
@@ -7734,18 +7742,17 @@
 %
 % \subsection{Shorthands}
 %
-%  \begin{macro}{\bbl at add@special}
-%    The macro |\bbl at add@special| is used to add a new character (or
-%    single character control sequence) to the macro |\dospecials|
-%    (and |\@sanitize| if \LaTeX\ is used). It is used only at one
-%    place, namely when |\initiate at active@char| is called (which is
-%    ignored if the char has been made active before).  Because
-%    |\@sanitize| can be undefined, we put the definition inside a
-%    conditional.
+% \begin{macro}{\bbl at add@special}
+% The macro |\bbl at add@special| is used to add a new character (or
+% single character control sequence) to the macro |\dospecials| (and
+% |\@sanitize| if \LaTeX\ is used). It is used only at one place,
+% namely when |\initiate at active@char| is called (which is ignored if
+% the char has been made active before). Because |\@sanitize| can be
+% undefined, we put the definition inside a conditional.
 %
-%    Items are added to the lists without checking its existence or
-%    the original catcode. It does not hurt, but should be fixed. It's
-%    already done with |\nfss at catcodes|, added in 3.10.
+% Items are added to the lists without checking its existence or the
+% original catcode. It does not hurt, but should be fixed. It's already
+% done with |\nfss at catcodes|, added in 3.10.
 %
 %    \begin{macrocode}
 \bbl at trace{Shorhands}
@@ -7765,13 +7772,13 @@
   \fi}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at remove@special}
+% \begin{macro}{\bbl at remove@special}
 %
-%    The companion of the former macro is |\bbl at remove@special|.  It
-%    removes a character from the set macros |\dospecials| and
-%    |\@sanitize|, but it is not used at all in the \babel{} core.
+% The companion of the former macro is |\bbl at remove@special|. It
+% removes a character from the set macros |\dospecials| and
+% |\@sanitize|, but it is not used at all in the \babel{} core.
 %
 %    \begin{macrocode}
 \def\bbl at remove@special#1{%
@@ -7788,38 +7795,36 @@
   \x}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\initiate at active@char}
-%    A language definition file can call this macro to make a
-%    character active. This macro takes one argument, the character
-%    that is to be made active. When the character was already active
-%    this macro does nothing. Otherwise, this macro defines the
-%    control sequence |\normal at char|\m{char} to expand to the
-%    character in its `normal state' and it defines the active
-%    character to expand to |\normal at char|\m{char} by default
-%    (\m{char} being the character to be made active). Later its
-%    definition can be changed to expand to |\active at char|\m{char}
-%    by calling |\bbl at activate{|\m{char}|}|.
+% \begin{macro}{\initiate at active@char}
+% A language definition file can call this macro to make a character
+% active. This macro takes one argument, the character that is to be
+% made active. When the character was already active this macro does
+% nothing. Otherwise, this macro defines the control sequence
+% |\normal at char<char>| to expand to the character in its `normal
+% state' and it defines the active character to expand to
+% |\normal at char<char>| by default (\m{char} being the character to be
+% made active). Later its definition can be changed to expand to
+% |\active at char<char>| by calling |\bbl at activate{<char>}|.
 %
-%    For example, to make the double quote character active one could
-%    have |\initiate at active@char{"}| in a language definition file.
-%    This defines |"| as |\active at prefix "\active at char"| (where the
-%    first |"| is the character with its original catcode, when the
-%    shorthand is created, and |\active at char"| is a single token). In
-%    protected contexts, it expands to |\protect "| or |\noexpand "|
-%    (ie, with the original |"|); otherwise |\active at char"| is
-%    executed. This macro in turn expands to |\normal at char"| in
-%    ``safe'' contexts (eg, |\label|), but |\user at active"| in normal
-%    ``unsafe'' ones. The latter search a definition in the user,
-%    language and system levels, in this order, but if none is found,
-%    |\normal at char"| is used.  However, a deactivated shorthand (with
-%    |\bbl at deactivate| is defined as |\active at prefix "\normal at char"|.
+% For example, to make the double quote character active one could have
+% |\initiate at active@char{"}| in a language definition file. This
+% defines |"| as |\active at prefix "\active at char"| (where the first |"|
+% is the character with its original catcode, when the shorthand is
+% created, and |\active at char"| is a single token). In protected
+% contexts, it expands to |\protect "| or |\noexpand "| (ie, with the
+% original |"|); otherwise |\active at char"| is executed. This macro in
+% turn expands to |\normal at char"| in ``safe'' contexts (eg, |\label|),
+% but |\user at active"| in normal ``unsafe'' ones. The latter search a
+% definition in the user, language and system levels, in this order,
+% but if none is found, |\normal at char"| is used. However, a deactivated
+% shorthand (with |\bbl at deactivate| is defined as
+% |\active at prefix "\normal at char"|.
 %
-%    The following macro is used to define shorthands in the three
-%    levels. It takes 4 arguments: the (string'ed) character,
-%    |\<level>@group|, |<level>@active| and |<next-level>@active|
-%    (except in |system|).
+% The following macro is used to define shorthands in the three levels.
+% It takes 4 arguments: the (string'ed) character, |\<level>@group|,
+% |<level>@active| and |<next-level>@active| (except in |system|).
 %
 %    \begin{macrocode}
 \def\bbl at active@def#1#2#3#4{%
@@ -7831,9 +7836,9 @@
     \fi}%
 %    \end{macrocode}
 %
-%    When there is also no current-level shorthand with an argument we
-%    will check whether there is a next-level  defined shorthand for
-%    this active character.
+% When there is also no current-level shorthand with an argument we
+% will check whether there is a next-level defined shorthand for this
+% active character.
 %
 %    \begin{macrocode}
   \long\@namedef{#3 at arg#1}##1{%
@@ -7844,10 +7849,10 @@
     \fi}}%
 %    \end{macrocode}
 %
-%    |\initiate at active@char| calls |\@initiate at active@char| with 3
-%    arguments. All of them are the same character with different
-%    catcodes: active, other (|\string|'ed) and the original one.
-%    This trick simplifies the code a lot.
+% |\initiate at active@char| calls |\@initiate at active@char| with 3
+% arguments. All of them are the same character with different
+% catcodes: active, other (|\string|'ed) and the original one. This
+% trick simplifies the code a lot.
 %
 %    \begin{macrocode}
 \def\initiate at active@char#1{%
@@ -7857,10 +7862,10 @@
     {}}
 %    \end{macrocode}
 %
-%   The very first thing to do is saving the original catcode and the
-%   original definition, even if not active, which is possible
-%   (undefined characters require a special treatment to avoid
-%   making them |\relax| and preserving some degree of protection).
+% The very first thing to do is saving the original catcode and the
+% original definition, even if not active, which is possible (undefined
+% characters require a special treatment to avoid making them |\relax|
+% and preserving some degree of protection).
 %
 %    \begin{macrocode}
 \def\@initiate at active@char#1#2#3{%
@@ -7875,14 +7880,14 @@
   \fi
 %    \end{macrocode}
 %
-%    If the character is already active we provide the default
-%    expansion under this shorthand mechanism. Otherwise we write a
-%    message in the transcript file, and define |\normal at char|\m{char}
-%    to expand to the character in its default state. If the character
-%    is mathematically active when \babel{} is loaded (for example
-%    |'|) the normal expansion is somewhat different to avoid an
-%    infinite loop (but it does not prevent the loop if the mathcode
-%    is set to |"8000| \textit{a posteriori}).
+% If the character is already active we provide the default expansion
+% under this shorthand mechanism. Otherwise we write a message in the
+% transcript file, and define |\normal at char<char>| to expand to the
+% character in its default state. If the character is mathematically
+% active when \babel{} is loaded (for example |'|) the normal expansion
+% is somewhat different to avoid an infinite loop (but it does not
+% prevent the loop if the mathcode is set to |"8000| \textit{a
+% posteriori}).
 %
 %    \begin{macrocode}
   \ifx#1#3\relax
@@ -7897,16 +7902,16 @@
     \fi
 %    \end{macrocode}
 %
-%    To prevent problems with the loading of other packages after
-%    \babel\ we reset the catcode of the character to the original one
-%    at the end of the package and of each language file (except with
-%    \textsf{KeepShorthandsActive}). It is re-activate again at
-%    |\begin{document}|.  We also need to make sure that the
-%    shorthands are active during the processing of the \file{.aux}
-%    file. Otherwise some citations may give unexpected results in
-%    the printout when a shorthand was used in the optional argument
-%    of |\bibitem| for example. Then we make it active (not strictly
-%    necessary, but done for backward compatibility).
+% To prevent problems with the loading of other packages after \babel\
+% we reset the catcode of the character to the original one at the end
+% of the package and of each language file (except with
+% \textsf{KeepShorthandsActive}). It is re-activate again at
+% |\begin{document}|. We also need to make sure that the shorthands are
+% active during the processing of the \file{.aux} file. Otherwise some
+% citations may give unexpected results in the printout when a
+% shorthand was used in the optional argument of |\bibitem| for
+% example. Then we make it active (not strictly necessary, but done for
+% backward compatibility).
 %
 %    \begin{macrocode}
     \bbl at restoreactive{#2}%
@@ -7920,14 +7925,14 @@
   \fi
 %    \end{macrocode}
 %
-%    Now we have set |\normal at char|\m{char}, we must define
-%    |\active at char|\m{char}, to be executed when the character is
-%    activated.  We define the first level expansion of
-%    |\active at char|\m{char} to check the status of the |@safe at actives|
-%    flag. If it is set to true we expand to the `normal' version of
-%    this character, otherwise we call |\user at active|\m{char} to start
-%    the search of a definition in the user, language and system
-%    levels (or eventually |normal at char|\m{char}).
+% Now we have set |\normal at char<char>|, we must define
+% |\active at char<char>|, to be executed when the character is
+% activated. We define the first level expansion of
+% |\active at char<char>| to check the status of the |@safe at actives|
+% flag. If it is set to true we expand to the `normal' version of this
+% character, otherwise we call |\user at active<char>| to start the
+% search of a definition in the user, language and system levels (or
+% eventually |normal at char<char>|).
 %
 %    \begin{macrocode}
   \let\bbl at tempa\@firstoftwo
@@ -7952,13 +7957,13 @@
     \expandafter\noexpand\csname user at active#2\endcsname}%
 %    \end{macrocode}
 %
-%    We now define the default values which the shorthand is set to
-%    when activated or deactivated. It is set to the deactivated form
-%    (globally), so that the character expands to
-%    \begin{center}
-%    |\active at prefix| \m{char} |\normal at char|\m{char}
-%    \end{center}
-%    (where |\active at char|\m{char} is \emph{one} control sequence!).
+% We now define the default values which the shorthand is set to when
+% activated or deactivated. It is set to the deactivated form
+% (globally), so that the character expands to
+% \begin{center}
+% |\active at prefix| \m{char} |\normal at char<char>|
+% \end{center}
+% (where |\active at char<char>| is \emph{one} control sequence!).
 %
 %    \begin{macrocode}
   \bbl at csarg\edef{active@#2}{%
@@ -7970,10 +7975,10 @@
   \bbl at ncarg\let#1{bbl at normal@#2}%
 %    \end{macrocode}
 %
-%    The next level of the code checks whether a user has defined a
-%    shorthand for himself with this character. First we check for a
-%    single character shorthand. If that doesn't exist we check for a
-%    shorthand with an argument.
+% The next level of the code checks whether a user has defined a
+% shorthand for himself with this character. First we check for a
+% single character shorthand. If that doesn't exist we check for a
+% shorthand with an argument.
 %
 %    \begin{macrocode}
   \bbl at active@def#2\user at group{user at active}{language at active}%
@@ -7981,13 +7986,13 @@
   \bbl at active@def#2\system at group{system at active}{normal at char}%
 %    \end{macrocode}
 %
-%    In order to do the right thing when a shorthand with an argument
-%    is used by itself at the end of the line we provide a definition
-%    for the case of an empty argument. For that case we let the
-%    shorthand character expand to its non-active self. Also, When a
-%    shorthand combination such as |''| ends up in a heading \TeX\
-%    would see |\protect'\protect'|. To prevent this from happening a
-%    couple of shorthand needs to be defined at user level.
+% In order to do the right thing when a shorthand with an argument
+% is used by itself at the end of the line we provide a definition
+% for the case of an empty argument. For that case we let the
+% shorthand character expand to its non-active self. Also, When a
+% shorthand combination such as |''| ends up in a heading \TeX\
+% would see |\protect'\protect'|. To prevent this from happening a
+% couple of shorthand needs to be defined at user level.
 %
 %    \begin{macrocode}
   \expandafter\edef\csname\user at group @sh@#2@@\endcsname
@@ -7996,13 +8001,13 @@
     {\expandafter\noexpand\csname user at active#2\endcsname}%
 %    \end{macrocode}
 %
-%    Finally, a couple of special cases are taken care of.  (1) If we
-%    are making the right quote (|'|) active we need to change |\pr at m@s| as
-%    well.  Also, make sure that a single |'| in math mode `does the
-%    right thing'.  (2) If we are using the caret (|^|) as a shorthand
-%    character special care should be taken to make sure math still
-%    works. Therefore an extra level of expansion is introduced with a
-%    check for math mode on the upper level.
+% Finally, a couple of special cases are taken care of.  (1) If we
+% are making the right quote (|'|) active we need to change |\pr at m@s| as
+% well.  Also, make sure that a single |'| in math mode `does the
+% right thing'.  (2) If we are using the caret (|^|) as a shorthand
+% character special care should be taken to make sure math still
+% works. Therefore an extra level of expansion is introduced with a
+% check for math mode on the upper level.
 %
 %    \begin{macrocode}
   \if\string'#2%
@@ -8012,8 +8017,8 @@
   \bbl at usehooks{initiateactive}{{#1}{#2}{#3}}}
 %    \end{macrocode}
 %
-%    The following package options control the behavior of shorthands
-%    in math mode.
+% The following package options control the behavior of shorthands in
+% math mode.
 %
 %    \begin{macrocode}
 %<<*More package options>>
@@ -8022,10 +8027,10 @@
 %<</More package options>>
 %    \end{macrocode}
 %
-%    Initiating a shorthand makes active the char. That is not
-%    strictly necessary but it is still done for backward
-%    compatibility. So we need to restore the original catcode at the
-%    end of package \textit{and} and the end of the |ldf|.
+% Initiating a shorthand makes active the char. That is not strictly
+% necessary but it is still done for backward compatibility. So we need
+% to restore the original catcode at the end of package \textit{and}
+% and the end of the |ldf|.
 %
 %    \begin{macrocode}
 \@ifpackagewith{babel}{KeepShorthandsActive}%
@@ -8039,18 +8044,18 @@
    \AtEndOfPackage{\let\bbl at restoreactive\@gobble}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at sh@select}
-%    This command helps the shorthand supporting macros to select how
-%    to proceed. Note that this macro needs to be expandable as do all
-%    the shorthand macros in order for them to work in expansion-only
-%    environments such as the argument of |\hyphenation|.
+% \begin{macro}{\bbl at sh@select}
+% This command helps the shorthand supporting macros to select how to
+% proceed. Note that this macro needs to be expandable as do all the
+% shorthand macros in order for them to work in expansion-only
+% environments such as the argument of |\hyphenation|.
 %
-%    This macro expects the name of a group of shorthands in its first
-%    argument and a shorthand character in its second argument. It
-%    will expand to either |\bbl at firstcs| or |\bbl at scndcs|. Hence two
-%    more arguments need to follow it.
+% This macro expects the name of a group of shorthands in its first
+% argument and a shorthand character in its second argument. It will
+% expand to either |\bbl at firstcs| or |\bbl at scndcs|. Hence two more
+% arguments need to follow it.
 %
 %    \begin{macrocode}
 \def\bbl at sh@select#1#2{%
@@ -8061,17 +8066,16 @@
   \fi}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\active at prefix}
-%    The command |\active at prefix| which is used in the expansion of
-%    active characters has a function similar to |\OT1-cmd| in that it
-%    |\protect|s the active character whenever |\protect| is
-%    \emph{not} |\@typeset at protect|. The |\@gobble| is needed to remove
-%    a token such as |\activechar:| (when the double colon was the
-%    active character to be dealt with). There are two definitions,
-%    depending of |\ifincsname| is available. If there is, the
-%    expansion will be more robust.
+% \begin{macro}{\active at prefix}
+% The command |\active at prefix| which is used in the expansion of active
+% characters has a function similar to |\OT1-cmd| in that it
+% |\protect|s the active character whenever |\protect| is \emph{not}
+% |\@typeset at protect|. The |\@gobble| is needed to remove a token such
+% as |\activechar:| (when the double colon was the active character to
+% be dealt with). There are two definitions, depending of |\ifincsname|
+% is available. If there is, the expansion will be more robust.
 %
 %    \begin{macrocode}
 \begingroup
@@ -8104,20 +8108,20 @@
 \endgroup
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\if at safe@actives}
-%  In some circumstances it is necessary to be able to reset the
-%  shorthand to its ‘normal’ value (usually the character with catcode
-%  ‘other’) on the fly. For this purpose the switch |@safe at actives| is
-%  available. The setting of this switch should be checked in the first
-%  level expansion of |\active at char|\m{char}. When this expansion mode
-%  is active (with |\@safe at activestrue|), something like
-%  |"|$\sb{13}$|"|$\sb{13}$ becomes |"|$\sb{12}$|"|$\sb{12}$ in an
-%  |\edef| (in other words, shorthands are |\string|’ed). This
-%  contrasts with |\protected at edef|, where catcodes are always left
-%  unchanged. Once converted, they can be used safely even after this
-%  expansion mode is deactivated (with |\@safe at activefalse|).
+% \begin{macro}{\if at safe@actives}
+% In some circumstances it is necessary to be able to reset the
+% shorthand to its ‘normal’ value (usually the character with catcode
+% ‘other’) on the fly. For this purpose the switch |@safe at actives| is
+% available. The setting of this switch should be checked in the first
+% level expansion of |\active at char<char>|. When this expansion mode
+% is active (with |\@safe at activestrue|), something like
+% |"|$\sb{13}$|"|$\sb{13}$ becomes |"|$\sb{12}$|"|$\sb{12}$ in an
+% |\edef| (in other words, shorthands are |\string|’ed). This contrasts
+% with |\protected at edef|, where catcodes are always left unchanged.
+% Once converted, they can be used safely even after this expansion
+% mode is deactivated (with |\@safe at activefalse|).
 %
 %    \begin{macrocode}
 \newif\if at safe@actives
@@ -8124,9 +8128,9 @@
 \@safe at activesfalse
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at restore@actives}
+% \begin{macro}{\bbl at restore@actives}
 % When the output routine kicks in while the active characters were
 % made ``safe'' this must be undone in the headers to prevent
 % unexpected typeset results. For this situation we define a command to
@@ -8136,15 +8140,15 @@
 \def\bbl at restore@actives{\if at safe@actives\@safe at activesfalse\fi}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at activate}
-%  \begin{macro}{\bbl at deactivate}
+% \begin{macro}{\bbl at activate}
+% \begin{macro}{\bbl at deactivate}
 %
 % Both macros take one argument, like |\initiate at active@char|. The
 % macro is used to change the definition of an active character to
-% expand to |\active at char|\m{char} in the case of |\bbl at activate|,
-% or |\normal at char|\m{char} in the case of |\bbl at deactivate|.
+% expand to |\active at char<char>| in the case of |\bbl at activate|,
+% or |\normal at char<char>| in the case of |\bbl at deactivate|.
 %
 %    \begin{macrocode}
 \chardef\bbl at activated\z@
@@ -8158,11 +8162,11 @@
     \csname bbl at normal@\string#1\endcsname}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at firstcs}
-%  \begin{macro}{\bbl at scndcs}
+% \begin{macro}{\bbl at firstcs}
+% \begin{macro}{\bbl at scndcs}
 %
 % These macros are used only as a trick when declaring shorthands.
 %
@@ -8171,8 +8175,8 @@
 \def\bbl at scndcs#1#2{\csname#2\endcsname}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\declare at shorthand}
 % The command |\declare at shorthand| is used to declare a shorthand
@@ -8230,12 +8234,12 @@
   \fi}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\textormath}
-%    Some of the shorthands that will be declared by the language
-%    definition files have to be usable in both text and mathmode. To
-%    achieve this the helper macro |\textormath| is provided.
+% \begin{macro}{\textormath}
+% Some of the shorthands that will be declared by the language
+% definition files have to be usable in both text and mathmode. To
+% achieve this the helper macro |\textormath| is provided.
 %
 %    \begin{macrocode}
 \def\textormath{%
@@ -8246,16 +8250,15 @@
   \fi}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\user at group}
-%  \begin{macro}{\language at group}
-%  \begin{macro}{\system at group}
-%    The current concept of `shorthands' supports three levels or
-%    groups of shorthands. For each level the name of the level or
-%    group is stored in a macro. The default is to have a user group;
-%    use language group `english' and have a system group called
-%    `system'.
+% \begin{macro}{\user at group}
+% \begin{macro}{\language at group}
+% \begin{macro}{\system at group}
+% The current concept of `shorthands' supports three levels or groups
+% of shorthands. For each level the name of the level or group is
+% stored in a macro. The default is to have a user group; use language
+% group `english' and have a system group called `system'.
 %
 %    \begin{macrocode}
 \def\user at group{user}
@@ -8263,17 +8266,17 @@
 \def\system at group{system}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\useshorthands}
+% \begin{macro}{\useshorthands}
 %
-%    This is the user level macro. It initializes and activates the
-%    character for use as a shorthand character (ie, it's active in the
-%    preamble). Languages can deactivate shorthands, so a starred
-%    version is also provided which activates them always after the
-%    language has been switched.
+% This is the user level macro. It initializes and activates the
+% character for use as a shorthand character (ie, it's active in the
+% preamble). Languages can deactivate shorthands, so a starred version
+% is also provided which activates them always after the language has
+% been switched.
 %
 %    \begin{macrocode}
 \def\useshorthands{%
@@ -8291,12 +8294,12 @@
     {\bbl at error{shorthand-is-off}{}{#2}{}}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\defineshorthand}
+% \begin{macro}{\defineshorthand}
 %
 % Currently we only support two groups of user level shorthands,
-% named internally |user| and |user@<lang>| (language-dependent
+% named internally |user| and |user@<language>| (language-dependent
 % user shorthands). By default, only the first one is taken into
 % account, but if the former is also used (in the optional argument
 % of |\defineshorthand|) a new level is inserted for it
@@ -8326,23 +8329,23 @@
     \declare at shorthand{\bbl at tempb}{#2}{#3}}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\languageshorthands}
+% \begin{macro}{\languageshorthands}
 %
-%  A user level command to change the language from which shorthands
-%  are used. Unfortunately, \babel{} currently does not keep track
-%  of defined groups, and therefore there is no way to catch a
-%  possible change in casing to fix it in the same way languages names
-%  are fixed. [TODO].
-% %
+% A user level command to change the language from which shorthands are
+% used. Unfortunately, \babel{} currently does not keep track of
+% defined groups, and therefore there is no way to catch a possible
+% change in casing to fix it in the same way languages names are fixed.
+% [TODO].
+%
 %    \begin{macrocode}
 \def\languageshorthands#1{\def\language at group{#1}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\aliasshorthand}
+% \begin{macro}{\aliasshorthand}
 %
 % \textit{Deprecated}. First the new shorthand needs to be
 % initialized. Then, we define the new shorthand in terms of the
@@ -8349,7 +8352,7 @@
 % original one, but note with |\aliasshorthands{"}{/}| is
 % |\active at prefix /\active at char/|, so we still need to let the
 % latter to |\active at char"|.
-%    
+%
 %    \begin{macrocode}
 \def\aliasshorthand#1#2{%
   \bbl at ifshorthand{#2}%
@@ -8366,18 +8369,18 @@
     {\bbl at error{shorthand-is-off}{}{#2}{}}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\@notshorthand}
+% \begin{macro}{\@notshorthand}
 %
 %    \begin{macrocode}
 \def\@notshorthand#1{\bbl at error{not-a-shorthand}{#1}{}{}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\shorthandon}
-%  \begin{macro}{\shorthandoff}
+% \begin{macro}{\shorthandon}
+% \begin{macro}{\shorthandoff}
 %
 % The first level definition of these macros just passes the
 % argument on to |\bbl at switch@sh|, adding |\@nil| at the end to
@@ -8390,7 +8393,7 @@
 \def\bbl at shorthandoff#1#2{\bbl at switch@sh#1#2\@nnil}
 %    \end{macrocode}
 %
-%  \begin{macro}{\bbl at switch@sh}
+% \begin{macro}{\bbl at switch@sh}
 %
 % The macro |\bbl at switch@sh| takes the list of characters apart one
 % by one and subsequently switches the category code of the
@@ -8436,9 +8439,9 @@
   \fi}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % Note the value is that at the expansion time; eg, in the preamble
 % shorthands are usually deactivated.
@@ -8479,8 +8482,8 @@
 \newcommand\ifbabelshorthand[3]{\bbl at ifunset{bbl at active@\string#1}{#3}{#2}}
 %    \end{macrocode}
 %
-%  \begin{macro}{\bbl at prim@s}
-%  \begin{macro}{\bbl at pr@m at s}
+% \begin{macro}{\bbl at prim@s}
+% \begin{macro}{\bbl at pr@m at s}
 %
 % One of the internal macros that are involved in substituting |\prime|
 % for each right quote in mathmode is |\prim at s|. This checks if the
@@ -8510,8 +8513,8 @@
 \endgroup
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % Usually the |~| is active and expands to \verb*=\penalty\@M\ =.
 % When it is written to the \file{.aux} file it is written
@@ -8529,12 +8532,12 @@
 \bbl at activate{~}
 %    \end{macrocode}
 %
-%  \begin{macro}{\OT1dqpos}
-%  \begin{macro}{\T1dqpos}
-%    The position of the double quote character is different for the
-%    OT1 and T1 encodings. It will later be selected using the
-%    |\f at encoding| macro. Therefore we define two macros here to store
-%    the position of the character in these encodings.
+% \begin{macro}{\OT1dqpos}
+% \begin{macro}{\T1dqpos}
+% The position of the double quote character is different for the OT1
+% and T1 encodings. It will later be selected using the |\f at encoding|
+% macro. Therefore we define two macros here to store the position of
+% the character in these encodings.
 %
 %    \begin{macrocode}
 \expandafter\def\csname OT1dqpos\endcsname{127}
@@ -8541,8 +8544,8 @@
 \expandafter\def\csname T1dqpos\endcsname{4}
 %    \end{macrocode}
 %
-%    When the macro |\f at encoding| is undefined (as it is in plain
-%    \TeX) we define it here to expand to \texttt{OT1}
+% When the macro |\f at encoding| is undefined (as it is in plain \TeX) we
+% define it here to expand to \texttt{OT1}
 %
 %    \begin{macrocode}
 \ifx\f at encoding\@undefined
@@ -8550,21 +8553,20 @@
 \fi
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \subsection{Language attributes}
 %
-%    Language attributes provide a means to give the user control over
-%    which features of the language definition files he wants to
-%    enable.
+% Language attributes provide a means to give the user control over
+% which features of the language definition files he wants to enable.
 %
-%  \begin{macro}{\languageattribute}
+% \begin{macro}{\languageattribute}
 %
-%    The macro |\languageattribute| checks whether its arguments are
-%    valid and then activates the selected language attribute.
-%    First check whether the language is known, and then process each
-%    attribute in the list.
+% The macro |\languageattribute| checks whether its arguments are valid
+% and then activates the selected language attribute. First check
+% whether the language is known, and then process each attribute in the
+% list.
 %
 %    \begin{macrocode}
 \bbl at trace{Language attributes}
@@ -8608,8 +8610,7 @@
 \@onlypreamble\languageattribute
 %    \end{macrocode}
 %
-%    The error text to be issued when an unknown attribute is
-%    selected.
+% The error text to be issued when an unknown attribute is selected.
 %
 %    \begin{macrocode}
 \newcommand*{\@attrerr}[2]{%
@@ -8616,17 +8617,17 @@
   \bbl at error{unknown-attribute}{#1}{#2}{}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at declare@ttribute}
-%    This command adds the new language/attribute combination to the
-%    list of known attributes.
+% \begin{macro}{\bbl at declare@ttribute}
+% This command adds the new language/attribute combination to the list
+% of known attributes.
 %
-%    Then it defines a control sequence to be executed when the
-%    attribute is used in a document. The result of this should be
-%    that the macro |\extras...| for the current language is extended,
-%    otherwise the attribute will not work as its code is removed from
-%    memory at |\begin{document}|.
+% Then it defines a control sequence to be executed when the attribute
+% is used in a document. The result of this should be that the macro
+% |\extras...| for the current language is extended, otherwise the
+% attribute will not work as its code is removed from memory at
+% |\begin{document}|.
 %
 %    \begin{macrocode}
 \def\bbl at declare@ttribute#1#2#3{%
@@ -8638,18 +8639,18 @@
   \expandafter\def\csname#1 at attr@#2\endcsname{#3}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at ifattributeset}
-%    This internal macro has 4 arguments. It can be used to interpret
-%    \TeX\ code based on whether a certain attribute was set. This
-%    command should appear inside the argument to |\AtBeginDocument|
-%    because the attributes are set in the document preamble,
-%    \emph{after} \babel\ is loaded.
+% \begin{macro}{\bbl at ifattributeset}
+% This internal macro has 4 arguments. It can be used to interpret
+% \TeX\ code based on whether a certain attribute was set. This command
+% should appear inside the argument to |\AtBeginDocument| because the
+% attributes are set in the document preamble, \emph{after} \babel\ is
+% loaded.
 %
-%    The first argument is the language, the second argument the
-%    attribute being checked, and the third and fourth arguments are
-%    the true and false clauses.
+% The first argument is the language, the second argument the attribute
+% being checked, and the third and fourth arguments are the true and
+% false clauses.
 %
 %    \begin{macrocode}
 \def\bbl at ifattributeset#1#2#3#4{%
@@ -8665,16 +8666,16 @@
   \fi}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at ifknown@ttrib}
-%    An internal macro to check whether a given language/attribute is
-%    known. The macro takes 4 arguments, the language/attribute, the
-%    attribute list, the \TeX-code to be executed when the attribute
-%    is known and the \TeX-code to be executed otherwise.
+% \begin{macro}{\bbl at ifknown@ttrib}
+% An internal macro to check whether a given language/attribute is
+% known. The macro takes 4 arguments, the language/attribute, the
+% attribute list, the \TeX-code to be executed when the attribute is
+% known and the \TeX-code to be executed otherwise.
 %
-%    We first assume the attribute is unknown. Then we loop over the
-%    list of known attributes, trying to find a match. 
+% We first assume the attribute is unknown. Then we loop over the list
+% of known attributes, trying to find a match.
 %
 %    \begin{macrocode}
 \def\bbl at ifknown@ttrib#1#2{%
@@ -8688,11 +8689,11 @@
   \bbl at tempa}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at clear@ttribs}
-%    This macro removes all the attribute code from \LaTeX's memory at
-%    |\begin{document}| time (if any is present).
+% \begin{macro}{\bbl at clear@ttribs}
+% This macro removes all the attribute code from \LaTeX's memory at
+% |\begin{document}| time (if any is present).
 %
 %    \begin{macrocode}
 \def\bbl at clear@ttribs{%
@@ -8706,25 +8707,23 @@
 \AtBeginDocument{\bbl at clear@ttribs}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \subsection{Support for saving macro definitions}
 %
-%  To save the meaning of control sequences using |\babel at save|, we
-%  use temporary control sequences.  To save hash table entries for
-%  these control sequences, we don't use the name of the control
-%  sequence to be saved to construct the temporary name.  Instead we
-%  simply use the value of a counter, which is reset to zero each time
-%  we begin to save new values.  This works well because we release
-%  the saved meanings before we begin to save a new set of control
-%  sequence meanings (see |\selectlanguage| and |\originalTeX|). Note
-%  undefined macros are not undefined any more when saved -- they are
-%  |\relax|'ed.
+% To save the meaning of control sequences using |\babel at save|, we use
+% temporary control sequences. To save hash table entries for these
+% control sequences, we don't use the name of the control sequence to
+% be saved to construct the temporary name. Instead we simply use the
+% value of a counter, which is reset to zero each time we begin to save
+% new values. This works well because we release the saved meanings
+% before we begin to save a new set of control sequence meanings (see
+% |\selectlanguage| and |\originalTeX|). Note undefined macros are not
+% undefined any more when saved -- they are |\relax|'ed.
 %
-%  \begin{macro}{\babel at savecnt}
-%  \begin{macro}{\babel at beginsave}
-%    The initialization of a new save cycle: reset the counter to
-%    zero.
+% \begin{macro}{\babel at savecnt}
+% \begin{macro}{\babel at beginsave}
+% The initialization of a new save cycle: reset the counter to zero.
 %
 %    \begin{macrocode}
 \bbl at trace{Macros for saving definitions}
@@ -8731,7 +8730,7 @@
 \def\babel at beginsave{\babel at savecnt\z@}
 %    \end{macrocode}
 %
-%    Before it's forgotten, allocate the counter and initialize all.
+% Before it's forgotten, allocate the counter and initialize all.
 %
 %    \begin{macrocode}
 \newcount\babel at savecnt
@@ -8738,11 +8737,11 @@
 \babel at beginsave
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\babel at save}
-%  \begin{macro}{\babel at savevariable}
+% \begin{macro}{\babel at save}
+% \begin{macro}{\babel at savevariable}
 %
 % The macro |\babel at save|\meta{csname} saves the current meaning of the
 % control sequence \meta{csname} to
@@ -8774,11 +8773,11 @@
   \bbl at exp{\def\\\originalTeX{\the\toks@\the#1\relax}}}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at frenchspacing}
-%  \begin{macro}{\bbl at nonfrenchspacing}
+% \begin{macro}{\bbl at frenchspacing}
+% \begin{macro}{\bbl at nonfrenchspacing}
 % Some languages need to have |\frenchspacing| in effect. Others
 % don't want that. The command |\bbl at frenchspacing| switches it on
 % when it isn't already in effect and |\bbl at nonfrenchspacing|
@@ -8826,15 +8825,15 @@
   \fi\fi\fi}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \subsection{Short tags}
 %
 % \begin{macro}{\babeltags}
 % This macro is straightforward. After zapping spaces, we
-% loop over the list and define the macros |\text|\m{tag} and
-% |\|\m{tag}. Definitions are first expanded so that they don't
+% loop over the list and define the macros |\text<tag>| and
+% |\<tag>|. Definitions are first expanded so that they don't
 % contain |\csname| but the actual macro.
 %
 %   \begin{macrocode}
@@ -8863,7 +8862,7 @@
 %
 % This macro saves hyphenation exceptions. Two macros are used to
 % store them: |\bbl at hyphenation@| for the global ones and
-% |\bbl at hyphenation<lang>| for language ones. See |\bbl at patterns|
+% |\bbl at hyphenation<language>| for language ones. See |\bbl at patterns|
 % above for further details. We make sure there is a space between
 % words when multiple commands are used.
 %
@@ -8896,9 +8895,9 @@
     \fi}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at allowhyphens}
+% \begin{macro}{\bbl at allowhyphens}
 %
 % This macro makes hyphenation possible. Basically its definition
 % is nothing more than |\nobreak| |\hskip| \texttt{0pt plus
@@ -8911,7 +8910,7 @@
 \def\allowhyphens{\ifx\cf at encoding\bbl at t@one\else\bbl at allowhyphens\fi}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\babelhyphen}
 %
@@ -8953,7 +8952,7 @@
   \leavevmode\ifdim\lastskip>\z@\mbox{#1}\else#1\fi}
 %    \end{macrocode}
 %
-%    The following macro inserts the hyphen char.
+% The following macro inserts the hyphen char.
 %
 %    \begin{macrocode}
 \def\bbl at hyphenchar{%
@@ -8964,9 +8963,9 @@
   \fi}
 %    \end{macrocode}
 %
-%    Finally, we define the hyphen ``types''. Their names will not
-%    change, so you may use them in |ldf|'s. After a space, the
-%    |\mbox| in |\bbl at hy@nobreak| is redundant.
+% Finally, we define the hyphen ``types''. Their names will not change,
+% so you may use them in |ldf|'s. After a space, the |\mbox| in
+% |\bbl at hy@nobreak| is redundant.
 %
 %    \begin{macrocode}
 \def\bbl at hy@soft{\bbl at usehyphen{\discretionary{\bbl at hyphenchar}{}{}}}
@@ -8985,18 +8984,18 @@
 \def\bbl at hy@@empty{\discretionary{}{}{}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\bbl at disc}
-%    For some languages the macro |\bbl at disc| is used to ease the
-%    insertion of discretionaries for letters that behave `abnormally'
-%    at a breakpoint.
+% \begin{macro}{\bbl at disc}
+% For some languages the macro |\bbl at disc| is used to ease the
+% insertion of discretionaries for letters that behave `abnormally' at
+% a breakpoint.
 %
 %    \begin{macrocode}
 \def\bbl at disc#1#2{\nobreak\discretionary{#2-}{}{#1}\bbl at allowhyphens}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \subsection{Multiencoding strings}
 %
@@ -9161,7 +9160,7 @@
 %    \end{macrocode}
 %
 % There are two versions of |\bbl at scswitch|. The first version is used
-% when |ldf|s are read, and it makes sure |\|\m{group}\m{language} is
+% when |ldf|s are read, and it makes sure |\<group><language>| is
 % reset, but only once (|\bbl at screset| is used to keep track of this).
 % The second version is used in the preamble and packages loaded after
 % \babel{} and does nothing.
@@ -9168,7 +9167,7 @@
 %
 % The macro |\bbl at forlang| loops |\bbl at L| but its body is executed only
 % if the value is in |\BabelLanguages| (inside \babel) or
-% |\date|\m{language} is defined (after \babel{} has been loaded).
+% |\date<language>| is defined (after \babel{} has been loaded).
 % There are also two version of |\bbl at forlang|. The first one skips the
 % current iteration if the language is not in |\BabelLanguages| (used
 % in |ldf|s), and the second one skips undefined languages (after
@@ -9303,9 +9302,9 @@
 %<</Macros local to BabelCommands>>
 %    \end{macrocode}
 %
-%   There are 3 helper macros which do most of the work for you.
+% There are 3 helper macros which do most of the work for you.
 %
-%   \begin{macrocode}
+%    \begin{macrocode}
 \newcommand\BabelLower[2]{% one to one.
   \ifnum\lccode#1=#2\else
     \babel at savevariable{\lccode#1}%
@@ -9346,8 +9345,8 @@
 %<</More package options>>
 %    \end{macrocode}
 %
-%    Initial setup to provide a default behavior if |hyphenmap|
-%    is not set.
+% Initial setup to provide a default behavior if |hyphenmap| is not
+% set.
 %
 %    \begin{macrocode}
 \AtEndOfPackage{%
@@ -9378,7 +9377,7 @@
       {\expandafter\string\csname #2name\endcsname}%
       {\bbl at tempd}%
     \ifin@ % Renew caption
-      \bbl at xin@{\string\bbl at scset}{\bbl at tempd}% 
+      \bbl at xin@{\string\bbl at scset}{\bbl at tempd}%
       \ifin@
         \bbl at exp{%
           \\\bbl at ifsamestring{\bbl at tempa}{\languagename}%
@@ -9403,7 +9402,7 @@
             {}}%
       \else  % Old way, but defined in the new way
         \bbl at exp{%
-          \\\bbl at add\<captions#1>{\def\<#2name>{\<#1#2name>}}%      
+          \\\bbl at add\<captions#1>{\def\<#2name>{\<#1#2name>}}%
           \\\bbl at ifsamestring{\bbl at tempa}{\languagename}%
             {\def\<#2name>{\<#1#2name>}}%
             {}}%
@@ -9422,7 +9421,7 @@
 %
 % \subsection{Macros common to a number of languages}
 %
-%  \begin{macro}{\set at low@box}
+% \begin{macro}{\set at low@box}
 %
 % The following macro is used to lower quotes to the same level as
 % the comma.  It prepares its argument in box register~0.
@@ -9434,11 +9433,11 @@
     \setbox\z@\hbox{\lower\dimen\z@ \box\z@}\ht\z@\ht\tw@ \dp\z@\dp\tw@}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\save at sf@q}
-%    The macro |\save at sf@q| is used to save and reset the current
-%    space factor.
+% \begin{macro}{\save at sf@q}
+% The macro |\save at sf@q| is used to save and reset the current space
+% factor.
 %
 %    \begin{macrocode}
 \def\save at sf@q#1{\leavevmode
@@ -9447,7 +9446,7 @@
   \endgroup}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \subsection{Making glyphs available}
 %
@@ -9457,7 +9456,7 @@
 %
 % \subsubsection{Quotation marks}
 %
-%  \begin{macro}{\quotedblbase}
+% \begin{macro}{\quotedblbase}
 % In the \texttt{T1} encoding the opening double quote at the
 % baseline is available as a separate character, accessible via
 % |\quotedblbase|. In the \texttt{OT1} encoding it is not
@@ -9478,10 +9477,10 @@
   \UseTextSymbol{OT1}{\quotedblbase}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\quotesinglbase}
-%    We also need the single quote character at the baseline.
+% \begin{macro}{\quotesinglbase}
+% We also need the single quote character at the baseline.
 %
 %    \begin{macrocode}
 \ProvideTextCommand{\quotesinglbase}{OT1}{%
@@ -9489,8 +9488,8 @@
     \box\z@\kern-.04em\bbl at allowhyphens}}
 %    \end{macrocode}
 %
-%    Make sure that when an encoding other than \texttt{OT1} or
-%    \texttt{T1} is used this glyph can still be typeset.
+% Make sure that when an encoding other than \texttt{OT1} or
+% \texttt{T1} is used this glyph can still be typeset.
 %
 %    \begin{macrocode}
 \ProvideTextCommandDefault{\quotesinglbase}{%
@@ -9497,10 +9496,10 @@
   \UseTextSymbol{OT1}{\quotesinglbase}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\guillemetleft}
-%  \begin{macro}{\guillemetright}
+% \begin{macro}{\guillemetleft}
+% \begin{macro}{\guillemetright}
 % The guillemet characters are not available in \texttt{OT1}
 % encoding. They are faked. (Wrong names with o preserved for
 % compatibility.)
@@ -9550,13 +9549,13 @@
   \UseTextSymbol{OT1}{\guillemotright}}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\guilsinglleft}
-%  \begin{macro}{\guilsinglright}
-%    The single guillemets are not available in \texttt{OT1}
-%    encoding. They are faked.
+% \begin{macro}{\guilsinglleft}
+% \begin{macro}{\guilsinglright}
+% The single guillemets are not available in \texttt{OT1} encoding.
+% They are faked.
 %
 %    \begin{macrocode}
 \ProvideTextCommand{\guilsinglleft}{OT1}{%
@@ -9585,13 +9584,13 @@
   \UseTextSymbol{OT1}{\guilsinglright}}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \subsubsection{Letters}
 %
-%  \begin{macro}{\ij}
-%  \begin{macro}{\IJ}
+% \begin{macro}{\ij}
+% \begin{macro}{\IJ}
 % The dutch language uses the letter `ij'. It is available in
 % \texttt{T1} encoded fonts, but not in the \texttt{OT1} encoded
 % fonts. Therefore we fake it for the \texttt{OT1} encoding.
@@ -9605,8 +9604,8 @@
 \DeclareTextCommand{\IJ}{T1}{\char156}
 %    \end{macrocode}
 %
-%    Make sure that when an encoding other than \texttt{OT1} or
-%    \texttt{T1} is used these glyphs can still be typeset.
+% Make sure that when an encoding other than \texttt{OT1} or
+% \texttt{T1} is used these glyphs can still be typeset.
 %
 %    \begin{macrocode}
 \ProvideTextCommandDefault{\ij}{%
@@ -9615,8 +9614,8 @@
   \UseTextSymbol{OT1}{\IJ}}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\dj}
 % \begin{macro}{\DJ}
@@ -9650,8 +9649,8 @@
 \DeclareTextCommand{\DJ}{OT1}{\DDJ@ D}
 %    \end{macrocode}
 %
-%    Make sure that when an encoding other than \texttt{OT1} or
-%    \texttt{T1} is used these glyphs can still be typeset.
+% Make sure that when an encoding other than \texttt{OT1} or
+% \texttt{T1} is used these glyphs can still be typeset.
 %
 %    \begin{macrocode}
 \ProvideTextCommandDefault{\dj}{%
@@ -9660,13 +9659,13 @@
   \UseTextSymbol{OT1}{\DJ}}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\SS}
-%    For the \texttt{T1} encoding |\SS| is defined and selects a
-%    specific glyph from the font, but for other encodings it is not
-%    available. Therefore we make it available here.
+% \begin{macro}{\SS}
+% For the \texttt{T1} encoding |\SS| is defined and selects a specific
+% glyph from the font, but for other encodings it is not available.
+% Therefore we make it available here.
 %
 %    \begin{macrocode}
 \DeclareTextCommand{\SS}{OT1}{SS}
@@ -9673,20 +9672,20 @@
 \ProvideTextCommandDefault{\SS}{\UseTextSymbol{OT1}{\SS}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \subsubsection{Shorthands for quotation marks}
 %
-%    Shorthands are provided for a number of different quotation
-%    marks, which make them usable both outside and inside mathmode.
-%    They are defined with |\ProvideTextCommandDefault|, but this is
-%    very likely not required because their definitions are based on
-%    encoding-dependent macros.
+% Shorthands are provided for a number of different quotation marks,
+% which make them usable both outside and inside mathmode. They are
+% defined with |\ProvideTextCommandDefault|, but this is very likely
+% not required because their definitions are based on
+% encoding-dependent macros.
 %
-%  \begin{macro}{\glq}
-%  \begin{macro}{\grq}
+% \begin{macro}{\glq}
+% \begin{macro}{\grq}
 %
-%    The `german' single quotes.
+% The `german' single quotes.
 %
 %    \begin{macrocode}
 \ProvideTextCommandDefault{\glq}{%
@@ -9693,8 +9692,8 @@
   \textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
 %    \end{macrocode}
 %
-%    The definition of |\grq| depends on the fontencoding. With
-%    \texttt{T1} encoding no extra kerning is needed.
+% The definition of |\grq| depends on the fontencoding. With
+% \texttt{T1} encoding no extra kerning is needed.
 %
 %    \begin{macrocode}
 \ProvideTextCommand{\grq}{T1}{%
@@ -9708,13 +9707,13 @@
 \ProvideTextCommandDefault{\grq}{\UseTextSymbol{OT1}\grq}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\glqq}
-%  \begin{macro}{\grqq}
+% \begin{macro}{\glqq}
+% \begin{macro}{\grqq}
 %
-%    The `german' double quotes.
+% The `german' double quotes.
 %
 %    \begin{macrocode}
 \ProvideTextCommandDefault{\glqq}{%
@@ -9721,8 +9720,8 @@
   \textormath{\quotedblbase}{\mbox{\quotedblbase}}}
 %    \end{macrocode}
 %
-%    The definition of |\grqq| depends on the fontencoding. With
-%    \texttt{T1} encoding no extra kerning is needed.
+% The definition of |\grqq| depends on the fontencoding. With
+% \texttt{T1} encoding no extra kerning is needed.
 %
 %    \begin{macrocode}
 \ProvideTextCommand{\grqq}{T1}{%
@@ -9736,13 +9735,13 @@
 \ProvideTextCommandDefault{\grqq}{\UseTextSymbol{OT1}\grqq}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\flq}
-%  \begin{macro}{\frq}
+% \begin{macro}{\flq}
+% \begin{macro}{\frq}
 %
-%    The `french' single guillemets.
+% The `french' single guillemets.
 %
 %    \begin{macrocode}
 \ProvideTextCommandDefault{\flq}{%
@@ -9751,13 +9750,13 @@
   \textormath{\guilsinglright}{\mbox{\guilsinglright}}}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\flqq}
-%  \begin{macro}{\frqq}
+% \begin{macro}{\flqq}
+% \begin{macro}{\frqq}
 %
-%    The `french' double guillemets.
+% The `french' double guillemets.
 %
 %    \begin{macrocode}
 \ProvideTextCommandDefault{\flqq}{%
@@ -9766,24 +9765,24 @@
   \textormath{\guillemetright}{\mbox{\guillemetright}}}
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \subsubsection{Umlauts and tremas}
 %
-%    The command |\"| needs to have a different effect for different
-%    languages. For German for instance, the `umlaut' should be
-%    positioned lower than the default position for placing it over
-%    the letters a, o, u, A, O and U. When placed over an e, i, E or I
-%    it can retain its normal position. For Dutch the same glyph is
-%    always placed in the lower position.
+% The command |\"| needs to have a different effect for different
+% languages. For German for instance, the `umlaut' should be positioned
+% lower than the default position for placing it over the letters a, o,
+% u, A, O and U. When placed over an e, i, E or I it can retain its
+% normal position. For Dutch the same glyph is always placed in the
+% lower position.
 %
-%  \begin{macro}{\umlauthigh}
+% \begin{macro}{\umlauthigh}
 %
-%  \begin{macro}{\umlautlow}
-%    To be able to provide both positions of |\"| we provide two
-%    commands to switch the positioning, the default will be
-%    |\umlauthigh| (the normal positioning).
+% \begin{macro}{\umlautlow}
+% To be able to provide both positions of |\"| we provide two commands
+% to switch the positioning, the default will be |\umlauthigh| (the
+% normal positioning).
 %
 %    \begin{macrocode}
 \def\umlauthigh{%
@@ -9798,16 +9797,14 @@
 \umlauthigh
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\lower at umlaut}
-%    The command |\lower at umlaut| is used to position the |\"| closer
-%    to the letter.
+% \begin{macro}{\lower at umlaut}
+% The command |\lower at umlaut| is used to position the |\"| closer to
+% the letter. We want the umlaut character lowered, nearer to the
+% letter. To do this we need an extra \meta{dimen} register.
 %
-%    We want the umlaut character lowered, nearer to the letter. To do
-%    this we need an extra \meta{dimen} register.
-%
 %    \begin{macrocode}
 \expandafter\ifx\csname U at D\endcsname\relax
   \csname newdimen\endcsname\U at D
@@ -9814,20 +9811,19 @@
 \fi
 %    \end{macrocode}
 %
-%    The following code fools \TeX's \texttt{make\_accent} procedure
-%    about the current x-height of the font to force another placement
-%    of the umlaut character.
-%    First we have to save the current x-height of the font, because
-%    we'll change this font dimension and this is always done
-%    globally.
+% The following code fools \TeX's \texttt{make\_accent} procedure about
+% the current x-height of the font to force another placement of the
+% umlaut character. First we have to save the current x-height of the
+% font, because we'll change this font dimension and this is always
+% done globally.
 %
-%    Then we compute the new x-height in such a way that the umlaut
-%    character is lowered to the base character.  The value of
-%    \texttt{.45ex} depends on the \MF\ parameters with which the
-%    fonts were built.  (Just try out, which value will look best.)
-%    If the new x-height is too low, it is not changed.
-%    Finally we call the |\accent| primitive, reset the old x-height
-%    and insert the base character in the argument.
+% Then we compute the new x-height in such a way that the umlaut
+% character is lowered to the base character. The value of
+% \texttt{.45ex} depends on the \MF\ parameters with which the fonts
+% were built. (Just try out, which value will look best.) If the new
+% x-height is too low, it is not changed. Finally we call the |\accent|
+% primitive, reset the old x-height and insert the base character in
+% the argument.
 %
 %    \begin{macrocode}
 \def\lower at umlaut#1{%
@@ -9842,7 +9838,7 @@
   \egroup}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % For all vowels we declare |\"| to be a composite command which
 % uses |\bbl at umlauta| or |\bbl at umlaute| to position the umlaut
@@ -9851,9 +9847,9 @@
 % option \Lopt{OT1} is used. Therefore these declarations are
 % postponed until the beginning of the document. Note these
 % definitions only apply to some languages, but
-% babel sets them for \textit{all} languages -- you may want to
+% \babel{} sets them for \textit{all} languages -- you may want to
 % redefine |\bbl at umlauta| and/or |\bbl at umlaute| for a language
-% in the corresponding |ldf| (using the babel switching mechanism,
+% in the corresponding |ldf| (using the \babel{} switching mechanism,
 % of course).
 %
 %    \begin{macrocode}
@@ -9931,7 +9927,7 @@
 %    \end{macrocode}
 %
 % \subsection{Load engine specific macros}
-% 
+%
 % Some macros are not defined in all engines, so, after loading the
 % files define them if necessary to raise an error.
 %
@@ -9985,7 +9981,7 @@
   \global\let\bbl at inidata\@empty
   \global\let\bbl at extend@ini\@gobble
   \global\let\bbl at included@inis\@empty
-  \gdef\bbl at key@list{;}% 
+  \gdef\bbl at key@list{;}%
   \bbl at forkv{#1}{%
     \in@{/}{##1}% With /, (re)sets a value in the ini
     \ifin@ 
@@ -10443,7 +10439,7 @@
       \bbl at csarg\let{lname@\languagename}\relax
     \fi
   \fi
-  \bbl at ifunset{bbl at lname@#1}% 
+  \bbl at ifunset{bbl at lname@#1}%
     {\def\BabelBeforeIni##1##2{%
        \begingroup
          \let\bbl at ini@captions at aux\@gobbletwo
@@ -10472,7 +10468,7 @@
     \bbl at replace\bbl at KVP@hyphenrules{ }{,}%
     \bbl at foreach\bbl at KVP@hyphenrules{%
       \ifnum\@tempcnta=\m at ne   % if not yet found
-        \bbl at ifsamestring{##1}{+}%  
+        \bbl at ifsamestring{##1}{+}%
           {\bbl at carg\addlanguage{l@##1}}%
           {}%
         \bbl at ifunset{l@##1}% After a possible +
@@ -10539,7 +10535,7 @@
   \bbl at trim\toks@{#2}%
   \bbl at xin@{;\bbl at section/\bbl at tempa;}{\bbl at key@list}%
   \ifin@\else
-    \bbl at xin@{,identification/include.}% 
+    \bbl at xin@{,identification/include.}%
              {,\bbl at section/\bbl at tempa}%
     \ifin@\xdef\bbl at included@inis{\the\toks@}\fi
     \bbl at exp{%
@@ -10640,7 +10636,7 @@
       \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 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
@@ -10683,7 +10679,7 @@
      \xdef\bbl at calendars{\bbl at calendars,\bbl at tempa}%
    \fi
    \bbl at exp{%
-     \def\<bbl at inikv@#1>####1####2{% 
+     \def\<bbl at inikv@#1>####1####2{%
        \\\bbl at inidate####1...\relax{####2}{\bbl at tempa}}}%
  \fi}
 %    \end{macrocode}
@@ -10694,8 +10690,8 @@
 % file has not yet been read), and define a dummy macro. When the |ini|
 % file is read, just skip the corresponding key and reset the macro (in
 % |\bbl at inistore| above).
-% 
 %
+%
 %    \begin{macrocode}
 \def\bbl at renewinikey#1/#2\@@#3{%
   \edef\bbl at tempa{\zap at space #1 \@empty}%   section
@@ -10731,7 +10727,7 @@
 % many other sources do (as a \textit{private use extension}). For
 % consistency with other single-letter subtags or ‘singletons’, here
 % is considered an extension, too.
-% 
+%
 %    \begin{macrocode}
 \def\bbl at iniwarning#1{%
   \bbl at ifunset{bbl@@kv at identification.warning#1}{}%
@@ -10786,7 +10782,7 @@
     \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{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}{}%
@@ -10899,9 +10895,9 @@
   \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{[}{\csname the}%
   \bbl at replace\bbl at toreplace{]]}{name\endcsname{}}%
-  \bbl at replace\bbl at toreplace{]}{\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}%
@@ -10940,7 +10936,7 @@
 %
 % \textbf{Labels.} Captions must contain just strings, no
 % format at all, so there is new group in ini files. 
-% 
+%
 %    \begin{macrocode}
 \def\bbl at list@the{%
   part,chapter,section,subsection,subsubsection,paragraph,%
@@ -10989,8 +10985,8 @@
       \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{}}% 
+      \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{%
@@ -11180,7 +11176,7 @@
 \bbl at csarg\let{inikv at transforms.posthyphenation}\bbl at inikv
 \def\bbl at transforms@aux#1#2#3#4,#5\relax{%
   #1[#2]{#3}{#4}{#5}}
-\begingroup %  A hack. TODO. Don't require an specific order
+\begingroup %  A hack. TODO. Don't require a specific order
   \catcode`\%=12
   \catcode`\&=14
   \gdef\bbl at transforms#1#2#3{&%
@@ -11276,7 +11272,7 @@
             'HyphenChar' to another value, but be aware\\%
             this setting is not safe (see the manual).\\%
             Reported}%
-         \hyphenchar\font\defaulthyphenchar     
+         \hyphenchar\font\defaulthyphenchar
        \fi\fi
      \fi}%
     {\hyphenchar\font\defaulthyphenchar}}
@@ -11430,7 +11426,7 @@
 %
 % \LaTeX{} needs to know the BCP 47 codes for some features. For that,
 % it expects |\BCPdata| to be defined. While |language|, |region|,
-% |script|, and |variant| are recognized, |extension.|\m{s} for
+% |script|, and |variant| are recognized, |extension.<s>| for
 % singletons may change.
 %
 %    \begin{macrocode}
@@ -11447,7 +11443,7 @@
   \def\bbl at bcpdata@i#1#2#3#4#5#6\@empty{%
     \@nameuse{str_if_eq:nnTF}{#1#2#3#4#5}{main.}%
       {\bbl at bcpdata@ii{#6}\bbl at main@language}%
-      {\bbl at bcpdata@ii{#1#2#3#4#5#6}\languagename}}%   
+      {\bbl at bcpdata@ii{#1#2#3#4#5#6}\languagename}}%
   \def\bbl at bcpdata@ii#1#2{%
     \bbl at ifunset{bbl at info@#1.tag.bcp47}%
       {\bbl at error{unknown-ini-field}{#1}{}{}}%
@@ -11462,9 +11458,9 @@
 \newcommand\BabelLowercaseMapping[3]{%
   \DeclareLowercaseMapping[\@nameuse{bbl at casing@#1}]{#2}{#3}}
 %    \end{macrocode}
-% 
+%
 % The parser for |casing| and |casing.|\meta{variant}. 
-% 
+%
 %    \begin{macrocode}
 \def\bbl at casemapping#1#2#3{% 1:variant
   \def\bbl at tempa##1 ##2{% Loop
@@ -11504,7 +11500,7 @@
 %
 % With version 3.75 |\BabelEnsureInfo| is executed always, but there is
 % an option to disable it.
-% 
+%
 %    \begin{macrocode} 
 %<<*More package options>>
 \DeclareOption{ensureinfo=off}{}
@@ -11529,7 +11525,7 @@
 % |\bbl at ini@loaded| is a comma-separated list of locales, built by
 % |\bbl at read@ini|.
 %
-%    \begin{macrocode}   
+%    \begin{macrocode}
 \newcommand\getlocaleproperty{%
   \@ifstar\bbl at getproperty@s\bbl at getproperty@x}
 \def\bbl at getproperty@s#1#2#3{%
@@ -11563,7 +11559,7 @@
 %    \begin{macrocode}
 \newcommand\babeladjust[1]{%  TODO. Error handling.
   \bbl at forkv{#1}{%
-    \bbl at ifunset{bbl at ADJ@##1@##2}% 
+    \bbl at ifunset{bbl at ADJ@##1@##2}%
       {\bbl at cs{ADJ@##1}{##2}}%
       {\bbl at cs{ADJ@##1@##2}}}}
 %
@@ -11573,7 +11569,7 @@
       \directlua{ Babel.#2 }%
       \expandafter\expandafter\expandafter\@gobble
     \fi
-  \fi      
+  \fi
   {\bbl at error{adjust-only-vertical}{#1}{}{}}}% Gobbled if everything went ok. 
 \@namedef{bbl at ADJ@bidi.mirroring at on}{%
   \bbl at adjust@lua{bidi}{mirroring_enabled=true}}
@@ -11740,9 +11736,9 @@
     \global\@namedef{#1@#2}{#3}}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\@testdef}
+% \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
@@ -11783,7 +11779,7 @@
 \fi
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\ref}
 % \begin{macro}{\pageref}
@@ -11820,8 +11816,8 @@
 \fi
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\@citex}
 %
@@ -11878,7 +11874,7 @@
       }{}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\nocite}
 %
@@ -11890,7 +11886,7 @@
     \@safe at activestrue\org at nocite{#1}\@safe at activesfalse}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\bibcite}
 %
@@ -11913,7 +11909,7 @@
     \bibcite}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\bbl at bibcite}
 %
@@ -11925,7 +11921,7 @@
     \org at bibcite{#1}{\@safe at activesfalse#2}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\bbl at cite@choice}
 %
@@ -11949,7 +11945,7 @@
   \AtBeginDocument{\bbl at cite@choice}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\@bibitem}
 %
@@ -11967,7 +11963,7 @@
 \fi
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \subsection{Marks}
 %
@@ -12007,19 +12003,19 @@
               {\\\protect\\\bbl at restore@actives\the\toks@}}}}}%
 %    \end{macrocode}
 %
-%  \end{macro}
+% \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 need 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{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 need 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
@@ -12043,8 +12039,8 @@
      \fi}  % end ifbbl at single, end \IfBabelLayout
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \subsection{Preventing clashes with other packages}
 %
@@ -12056,9 +12052,9 @@
 % 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}
+% \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
@@ -12103,7 +12099,7 @@
 \fi
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \subsubsection{\pkg{varioref}}
 %
@@ -12111,7 +12107,7 @@
 % \begin{macro}{\vrefpagenum}
 % \begin{macro}{\Ref}
 %
-% When the package varioref is in use we need to modify its
+% When the package \pkg{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|.
@@ -12146,9 +12142,9 @@
 \fi
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \subsubsection{\pkg{hhline}}
 %
@@ -12174,11 +12170,12 @@
       {}}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\substitutefontfamily}
 %
-% \textit{Deprecated.} Use the tools provides by \LaTeX. The command
+% \textit{Deprecated.} Use the tools provided by \LaTeX\ 
+% (|\DeclareFontFamilySubstitution|). 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.
@@ -12205,20 +12202,20 @@
 \@onlypreamble\substitutefontfamily
 %    \end{macrocode}
 %
-%  \end{macro}
+% \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|.
+% 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{macro}{\ensureascii}
 %
 %    \begin{macrocode}
 \bbl at trace{Encoding and fonts}
@@ -12258,30 +12255,29 @@
   \fi}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \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.
+% 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{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.
+% 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{%
@@ -12306,12 +12302,11 @@
      \fi}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \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{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}{%
@@ -12319,12 +12314,12 @@
   \def\encodingdefault{\latinencoding}}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \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{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
@@ -12382,8 +12377,8 @@
 %    \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 % Any xe+lua bidi=
+\else % TODO. Move to txtbabel. Any xe+lua bidi
+  \ifnum\bbl at bidimode>100 \ifnum\bbl at bidimode<200
     \bbl at error{bidi-only-lua}{}{}{}%
     \let\bbl at beforeforeign\leavevmode
     \AtEndOfPackage{%
@@ -12394,7 +12389,9 @@
     \ifx\RTLfootnotetext\@undefined
       \AtEndOfPackage{%
         \EnableBabelHook{babel-bidi}%
-        \bbl at loadfontspec % bidi needs fontspec
+        \ifx\fontspec\@undefined
+          \usepackage{fontspec}% bidi needs fontspec
+        \fi
         \usepackage#1{bidi}%
         \let\bbl at digitsdotdash\DigitsDotDashInterCharToks
         \def\DigitsDotDashInterCharToks{% See the 'bidi' package
@@ -12434,24 +12431,19 @@
 %
 %    \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,Lydian,Mandaean,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}%
+  \bbl at xin@{\csname bbl at sbcp@#1\endcsname}{,Arab,Syrc,Thaa,}%
   \ifin@
-    \global\bbl at csarg\chardef{wdir@#1}\@ne
-    \bbl at xin@{\csname bbl at sname@#1\endcsname}{\bbl at alscripts}%
+    \global\bbl at csarg\chardef{wdir@#1}\tw@
+  \else
+    \bbl at xin@{\csname bbl at sbcp@#1\endcsname}{%
+      ,Armi,Avst,Cprt,Hatr,Hebr,Hung,Lydi,Mand,Mani,Merc,Mero,%
+       Narb,Nbat,Nkoo,Orkh,Palm,Phli,Phlp,Phnx,Prti,Samr,Sarb,}%
     \ifin@
-      \global\bbl at csarg\chardef{wdir@#1}\tw@
+      \global\bbl at csarg\chardef{wdir@#1}\@ne
+    \else
+      \global\bbl at csarg\chardef{wdir@#1}\z@
     \fi
-  \else
-    \global\bbl at csarg\chardef{wdir@#1}\z@
   \fi
   \ifodd\bbl at engine
     \bbl at csarg\ifcase{wdir@#1}%
@@ -12472,9 +12464,10 @@
     \bbl at pardir{#1}% <- Must precede \bbl at textdir
   \fi
   \bbl at textdir{#1}}
-% TODO. Only if \bbl at bidimode > 0?:
-\AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
-\DisableBabelHook{babel-bidi}
+\ifnum\bbl at bidimode>\z@
+  \AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
+  \DisableBabelHook{babel-bidi}
+\fi
 %    \end{macrocode}
 %
 % Now the engine-dependent macros. TODO. Must be moved to the engine
@@ -12544,10 +12537,7 @@
       \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}}
+    \AddToHook{para/begin}{\bbl at xeeverypar}}
   \ifnum\bbl at bidimode>200 % Any xe bidi=
     \let\bbl at textdir@i\@gobbletwo
     \let\bbl at xebidipar\@empty
@@ -12602,7 +12592,7 @@
         \@empty}}
 \fi
 %    \end{macrocode}%
-%    \end{macro}
+% \end{macro}
 %
 % \subsection{Language options}
 %
@@ -12694,7 +12684,7 @@
 % above, the names of the option and the file are the same. We first
 % pre-process the class and package options to determine the main
 % language, which is processed in the third ‘main’ pass,
-% \textit{except} if all files are ldf \textit{and} there is no |main|
+% \textit{except} if all files are \texttt{ldf} \textit{and} there is no |main|
 % key. In the latter case (|\bbl at opt@main| is still |\@nnil|), the
 % traditional way to set the main language is kept — the last loaded is
 % the main language.
@@ -12735,7 +12725,7 @@
 % Now define the corresponding loaders. With package options, assume
 % the language exists. With class options, check if the option is a
 % language by checking if the corresponding file exists.
-% 
+%
 %    \begin{macrocode}
 \bbl at foreach\bbl at language@opts{%
   \def\bbl at tempa{#1}%
@@ -12761,8 +12751,8 @@
           {}}%
         {}%
      \else                      % + * (other = ini)
-       \IfFileExists{babel-#1.tex}% 
-         {\DeclareOption{#1}{%  
+       \IfFileExists{babel-#1.tex}%
+         {\DeclareOption{#1}{%
             \bbl at ldfinit
             \babelprovide[import]{#1}%
             \bbl at afterldf{}}}%
@@ -12837,11 +12827,11 @@
   \DeclareOption*{}
   \ProcessOptions*
 \fi
-\bbl at exp{% 
+\bbl at exp{%
   \\\AtBeginDocument{\\\bbl at usehooks@lang{/}{begindocument}{{}}}}%
 \def\AfterBabelLanguage{\bbl at error{late-after-babel}{}{}{}}
 %    \end{macrocode}
-%      
+%
 % In order to catch the case where the user didn’t specify a
 % language we check whether |\bbl at main@language|, has become
 % defined. If not, the |nil| language is loaded.
@@ -12872,7 +12862,7 @@
 %
 % 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
+% 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.
 %
@@ -13084,9 +13074,9 @@
 %<*patterns>
 %    \end{macrocode}
 %
-%  \end{macro}
-%  \end{macro}
-%  \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \section{Loading hyphenation patterns}
 %
@@ -13108,13 +13098,12 @@
 <@Define core switching macros@>
 %    \end{macrocode}
 %
-%  \begin{macro}{\process at line}
-%    Each line in the file \file{language.dat} is processed by
-%    |\process at line| after it is read. The first thing this macro does
-%    is to check whether the line starts with \texttt{=}.
-%    When the first token of a line is an \texttt{=}, the macro
-%    |\process at synonym| is called; otherwise the macro
-%    |\process at language| will continue.
+% \begin{macro}{\process at line}
+% Each line in the file \file{language.dat} is processed by
+% |\process at line| after it is read. The first thing this macro does is
+% to check whether the line starts with \texttt{=}. When the first
+% token of a line is an \texttt{=}, the macro |\process at synonym| is
+% called; otherwise the macro |\process at language| will continue.
 %
 %    \begin{macrocode}
 \def\process at line#1#2 #3 #4 {%
@@ -13126,9 +13115,9 @@
   \ignorespaces}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
-%  \begin{macro}{\process at synonym}
+% \begin{macro}{\process at synonym}
 %
 % This macro takes care of the lines which start with an
 % \texttt{=}. It needs an empty token register to begin with.
@@ -13163,7 +13152,7 @@
   \fi}
 %    \end{macrocode}
 %
-%  \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\process at language}
 %
@@ -13342,15 +13331,15 @@
 \bbl at hook@loadkernel{switch.def}
 %    \end{macrocode}
 %
-%  \begin{macro}{\readconfigfile}
-%    The configuration file can now be opened for reading.
+% \begin{macro}{\readconfigfile}
+% The configuration file can now be opened for reading.
 %
 %    \begin{macrocode}
 \openin1 = language.dat
 %    \end{macrocode}
 %
-%    See if the file exists, if not, use the default hyphenation file
-%    \file{hyphen.tex}. The user will be informed about this.
+% See if the file exists, if not, use the default hyphenation file
+% \file{hyphen.tex}. The user will be informed about this.
 %
 %    \begin{macrocode}
 \def\languagename{english}%
@@ -13385,11 +13374,11 @@
     \endlinechar`\^^M
 %    \end{macrocode}
 %
-%    If the file has reached its end, exit from the loop here. If not,
-%    empty lines are skipped. Add 3 space characters to the end of
-%    |\bbl at line|. This is needed to be able to recognize the arguments
-%    of |\process at line| later on. The default language should be the
-%    very first one.
+% If the file has reached its end, exit from the loop here. If not,
+% empty lines are skipped. Add 3 space characters to the end of
+% |\bbl at line|. This is needed to be able to recognize the arguments of
+% |\process at line| later on. The default language should be the very
+% first one.
 %
 %    \begin{macrocode}
     \if T\ifeof1F\fi T\relax
@@ -13416,7 +13405,7 @@
 \closein1
 %    \end{macrocode}
 %
-% We add a message about the fact that babel is loaded in the
+% We add a message about the fact that \babel{} is loaded in the
 % format and with which language patterns to the \cs{everyjob}
 % register.
 %
@@ -13427,10 +13416,9 @@
 \fi
 %    \end{macrocode}
 %
-%    Also remove some macros from memory and raise an error
-%    if |\toks@| is not empty. Finally load \file{switch.def}, but the
-%    latter is not required and the line inputting it may be commented
-%    out.
+% Also remove some macros from memory and raise an error if |\toks@| is
+% not empty. Finally load \file{switch.def}, but the latter is not
+% required and the line inputting it may be commented out.
 %
 %    \begin{macrocode}
 \let\bbl at line\@undefined
@@ -13447,8 +13435,8 @@
 %</patterns>
 %    \end{macrocode}
 %
-%    Here the code for ini\TeX\ ends.
-%  \end{macro}
+% Here the code for ini\TeX\ ends.
+% \end{macro}
 %
 % \section{Font handling with fontspec}
 %
@@ -13473,28 +13461,12 @@
 % |bbl at font| replaces hardcoded font names inside |\..family| by the
 % corresponding macro |\..default|.
 %
-% At the time of this writing, \textsf{fontspec} shows a warning about
-% there are languages not available, which some people think refers to
-% \babel{}, even if there is nothing wrong. Here is hack to patch
-% \textsf{fontspec} to avoid the misleading (and mostly unuseful)
-% message.
-%
 %    \begin{macrocode}
 %<<*Font selection>>
 \bbl at trace{Font handling with fontspec}
-\ifx\ExplSyntaxOn\@undefined\else
-  \def\bbl at fs@warn at nx#1#2{% \bbl at tempfs is the original macro
-    \in@{,#1,}{,no-script,language-not-exist,}%
-    \ifin@\else\bbl at tempfs@nx{#1}{#2}\fi}
-  \def\bbl at fs@warn at nxx#1#2#3{%
-    \in@{,#1,}{,no-script,language-not-exist,}%
-    \ifin@\else\bbl at tempfs@nxx{#1}{#2}{#3}\fi}
-  \def\bbl at loadfontspec{%
-    \let\bbl at loadfontspec\relax 
-    \ifx\fontspec\@undefined
-      \usepackage{fontspec}%
-    \fi}%
-\fi
+\AddBabelHook{babel-fontspec}{afterextras}{\bbl at switchfont}
+\AddBabelHook{babel-fontspec}{beforestart}{\bbl at ckeckstdfonts}
+\DisableBabelHook{babel-fontspec}
 \@onlypreamble\babelfont
 \newcommand\babelfont[2][]{%  1=langs/scripts 2=fam
   \bbl at foreach{#1}{%
@@ -13505,8 +13477,10 @@
     \fi}%
   \edef\bbl at tempa{#1}%
   \def\bbl at tempb{#2}%  Used by \bbl at bblfont
-  \bbl at loadfontspec
-  \EnableBabelHook{babel-fontspec}% Just calls \bbl at switchfont
+  \ifx\fontspec\@undefined
+    \usepackage{fontspec}%
+  \fi
+  \EnableBabelHook{babel-fontspec}%
   \bbl at bblfont}
 \newcommand\bbl at bblfont[2][]{% 1=features 2=fontname, @font=rm|sf|tt
   \bbl at ifunset{\bbl at tempb family}%
@@ -13671,17 +13645,10 @@
       {\\\newfontscript{\bbl at cl{sname}}{\bbl at cl{sotf}}}%
     \<keys_if_exist:nnF>{fontspec-opentype}{Language/\bbl at cl{lname}}%
       {\\\newfontlanguage{\bbl at cl{lname}}{\bbl at cl{lotf}}}%
-    \let\\\bbl at tempfs@nx\<__fontspec_warning:nx>%
-    \let\<__fontspec_warning:nx>\\\bbl at fs@warn at nx
-    \let\\\bbl at tempfs@nxx\<__fontspec_warning:nxx>%
-    \let\<__fontspec_warning:nxx>\\\bbl at fs@warn at nxx
     \\\renewfontfamily\\#4%
       [\bbl at cl{lsys},% xetex removes unknown features :-(
        \ifcase\bbl at engine\or RawFeature={family=\bbl at tempb},\fi
        #2]}{#3}% ie \bbl at exp{..}{#3}
-  \bbl at exp{%
-    \let\<__fontspec_warning:nx>\\\bbl at tempfs@nx
-    \let\<__fontspec_warning:nxx>\\\bbl at tempfs@nxx}%
   \begingroup
      #4%
      \xdef#1{\f at family}%     eg, \bbl at rmdflt@lang{FreeSerif(0)}
@@ -13841,9 +13808,6 @@
       \fi}%
   \fi}
 \ifx\DisableBabelHook\@undefined\endinput\fi %%%% TODO: why
-\AddBabelHook{babel-fontspec}{afterextras}{\bbl at switchfont}
-\AddBabelHook{babel-fontspec}{beforestart}{\bbl at ckeckstdfonts}
-\DisableBabelHook{babel-fontspec}
 <@Font selection@>
 \def\bbl at provide@extra#1{}
 %    \end{macrocode}
@@ -13958,7 +13922,7 @@
 % And finally, the command with the code to be inserted. If the language
 % doesn’t define a class, then use the global one, as defined above.
 % For the definition there is a intermediate macro, which can be
-% ‘disabled’ with |\bbl at ic@<label>@<lang>|.
+% ‘disabled’ with |\bbl at ic@<label>@<language>|.
 %
 %    \begin{macrocode}
 \def\bbl at ignoreinterchar{%
@@ -13974,7 +13938,7 @@
     {\bbl at ignoreinterchar{#5}}%
   \bbl at csarg\let{ic@\bbl at kv@label @#2}\@firstofone
   \bbl at exp{\\\bbl at for\\\bbl at tempa{\zap at space#3 \@empty}}{%
-    \bbl at exp{\\\bbl at for\\\bbl at tempb{\zap at space#4 \@empty}}{%     
+    \bbl at exp{\\\bbl at for\\\bbl at tempb{\zap at space#4 \@empty}}{%
       \XeTeXinterchartoks
         \@nameuse{bbl at xeclass@\bbl at tempa @%
           \bbl at ifunset{bbl at xeclass@\bbl at tempa @#2}{}{#2}} %
@@ -13986,11 +13950,11 @@
               @#3@#4@#2 \@empty\endcsname}}}}
 \DeclareRobustCommand\enablelocaleinterchar[1]{%
   \bbl at ifunset{bbl at ic@#1@\languagename}%
-    {\bbl at error{unknown-interchar}{#1}{}{}}% 
+    {\bbl at error{unknown-interchar}{#1}{}{}}%
     {\bbl at csarg\let{ic@#1@\languagename}\@firstofone}}
 \DeclareRobustCommand\disablelocaleinterchar[1]{%
   \bbl at ifunset{bbl at ic@#1@\languagename}%
-    {\bbl at error{unknown-interchar-b}{#1}{}{}}% 
+    {\bbl at error{unknown-interchar-b}{#1}{}{}}%
     {\bbl at csarg\let{ic@#1@\languagename}\@gobble}}
 %</xetex>
 %    \end{macrocode}
@@ -14080,9 +14044,9 @@
   {}
 %    \end{macrocode}
 %
-%      Implicitly reverses sectioning labels in |bidi=basic|, because
-%      the full stop is not in contact with L numbers any more. I
-%      think there must be a better way.
+% Implicitly reverses sectioning labels in |bidi=basic|, because the
+% full stop is not in contact with L numbers any more. I think there
+% must be a better way.
 %
 %    \begin{macrocode}
 \IfBabelLayout{counters*}%
@@ -14208,7 +14172,7 @@
 % (3) in the middle of |plain.def| and |babel.sty|, by |babel.def|,
 % with the commands and other definitions for |luatex| (eg,
 % |\babelpatterns|).
-%  
+%
 %    \begin{macrocode}
 %<*luatex>
 \ifx\AddBabelHook\@undefined % When plain.def, babel.sty starts
@@ -14356,8 +14320,12 @@
        {\expandafter\expandafter\expandafter\bbl at luapatterns
           \csname bbl at hyphendata@\the\language\endcsname}}{}}
 \endinput\fi
-  % Here ends \ifx\AddBabelHook\@undefined
-  % A few lines are only read by hyphen.cfg
+%    \end{macrocode}
+%
+% Here ends |\ifx\AddBabelHook\@undefined|. A few lines are only read
+% by \textsc{hyphen.cfg}.
+%
+%    \begin{macrocode}
 \ifx\DisableBabelHook\@undefined
   \AddBabelHook{luatex}{everylanguage}{%
     \def\process at language##1##2##3{%
@@ -14373,9 +14341,12 @@
        {\expandafter\expandafter\expandafter\bbl at tempb
         \csname bbl at hyphendata@\the\language\endcsname}}
 \endinput\fi
-  % Here stops reading code for hyphen.cfg
-  % The following is read the 2nd time it's loaded
-  % First, global declarations for lua
+%    \end{macrocode}
+%
+% Here stops reading code for \textsc{hyphen.cfg}. The following is read the 2nd
+% time it's loaded. First, global declarations for lua.
+%
+%    \begin{macrocode}
 \begingroup  % TODO - to a lua file
 \catcode`\%=12
 \catcode`\'=12
@@ -14534,12 +14505,12 @@
         {\prehyphenchar=\bbl at cl{prehc}\relax}}}}
 %    \end{macrocode}
 %
-%  \begin{macro}{\babelpatterns}
+% \begin{macro}{\babelpatterns}
 %
-%    This macro adds patterns. Two macros are used to store them:
-%    |\bbl at patterns@| for the global ones and |\bbl at patterns@<lang>|
-%    for language ones. We make sure there is a space between words
-%    when multiple commands are used.
+% This macro adds patterns. Two macros are used to store them:
+% |\bbl at patterns@| for the global ones and |\bbl at patterns@<language>| for
+% language ones. We make sure there is a space between words when
+% multiple commands are used.
 %
 %    \begin{macrocode}
 \@onlypreamble\babelpatterns
@@ -14568,7 +14539,7 @@
             #2}}}%
     \fi}}
 %    \end{macrocode}
-%  \end{macro}
+% \end{macro}
 %
 % \subsection{Southeast Asian scripts}
 %
@@ -14581,7 +14552,7 @@
 % not touched. See Unicode UAX 14.
 %
 %    \begin{macrocode}
-% TODO - to a lua file
+% TODO - to a lua file -- or a logical place
 \directlua{
   Babel = Babel or {}
   Babel.linebreaking = Babel.linebreaking or {}
@@ -14619,7 +14590,7 @@
   }}
 \begingroup
 \catcode`\%=12
-\catcode`\&=14  
+\catcode`\&=14
 \catcode`\'=12
 \catcode`\~=12
 \gdef\bbl at seaintraspace{&
@@ -14656,7 +14627,7 @@
                 n = node.new(14, 0)     &% penalty
                 n.penalty = intrapenalty
                 node.insert_before(head, item, n)
-              end    
+              end
               n = node.new(12, 13)      &% (glue, spaceskip)
               node.setglue(n, intraspace.b * quad,
                               intraspace.p * quad,
@@ -14669,9 +14640,9 @@
       end
     end
   }&
-  \bbl at luahyphenate}  
+  \bbl at luahyphenate}
 %    \end{macrocode}
-%    
+%
 % \subsection{CJK line breaking}
 %
 % Minimal line breaking for CJK scripts, mainly intended for simple
@@ -14715,8 +14686,10 @@
             class = props.cjk_quotes[item.char]
           end
 
-          if class == 'cp' then class = 'cl' end % )] as CL
-          if class == 'id' then class = 'I' end
+          if class == 'cp' then class = 'cl' % )] as CL
+          elseif class == 'id' then class = 'I'
+          elseif class == 'cj' then class = 'I' % loose
+          end
 
           local br = 0
           if class and last_class and Babel.cjk_breaks[last_class][class] then 
@@ -14731,7 +14704,7 @@
               local n = node.new(14, 0)     % penalty
               n.penalty = intrapenalty
               node.insert_before(head, item, n)
-            end    
+            end
             local intraspace = props.intraspace
             local n = node.new(12, 13)      % (glue, spaceskip)
             node.setglue(n, intraspace.b * quad,
@@ -14763,10 +14736,10 @@
           func(head)
         end
       end
+      lang.hyphenate(head)
       if Babel.cjk_enabled then
         Babel.cjk_linebreak(head)
       end
-      lang.hyphenate(head)
       if Babel.linebreaking.after then
         for k, func in ipairs(Babel.linebreaking.after)  do
           func(head)
@@ -14847,7 +14820,7 @@
       Babel.arabic.justify, 'Babel.arabic.justify')
     luatexbase.add_to_callback('hpack_filter',
       Babel.arabic.justify_hbox, 'Babel.arabic.justify_hbox')
-  }}% 
+  }}%
 %    \end{macrocode}
 %
 % Save both node lists to make replacement. TODO. Save also widths to
@@ -14868,7 +14841,7 @@
         end
       end
       Babel.arabic.#3['##1#4'] = last.char
-    }}}    
+    }}}
 %    \end{macrocode}
 %
 % Elongated forms. Brute force. No rules at all, yet. The ideal: look
@@ -15034,7 +15007,7 @@
     while width < goal do
       subst_done = true
       k_item = k_list[k_curr].node
-      if k_list[k_curr].weight == Babel.kashida_wts[wt_pos] then        
+      if k_list[k_curr].weight == Babel.kashida_wts[wt_pos] then
         d = node.copy(k_item)
         d.char = 0x0640
         d.yoffset = 0 % TODO. From the prev char. But 0 seems safe.
@@ -15052,7 +15025,7 @@
       end
       if k_curr == 1 then
         k_curr = #k_list
-        wt_pos = (wt_pos >= table.getn(Babel.kashida_wts)) and 1 or wt_pos+1   
+        wt_pos = (wt_pos >= table.getn(Babel.kashida_wts)) and 1 or wt_pos+1
       else
         k_curr = k_curr - 1
       end
@@ -15095,9 +15068,6 @@
 % \subsection{Common stuff}
 %
 %    \begin{macrocode}
-\AddBabelHook{babel-fontspec}{afterextras}{\bbl at switchfont}
-\AddBabelHook{babel-fontspec}{beforestart}{\bbl at ckeckstdfonts}
-\DisableBabelHook{babel-fontspec}
 <@Font selection@>
 %    \end{macrocode}
 %
@@ -15125,7 +15095,7 @@
               {0xFE70, 0xFEFF}, {0xFB50, 0xFDFF}, {0x1EE00, 0x1EEFF}},
   ['Armn'] = {{0x0530, 0x058F}},
   ['Beng'] = {{0x0980, 0x09FF}}, 
-  ['Cher'] = {{0x13A0, 0x13FF}, {0xAB70, 0xABBF}},   
+  ['Cher'] = {{0x13A0, 0x13FF}, {0xAB70, 0xABBF}},
   ['Copt'] = {{0x03E2, 0x03EF}, {0x2C80, 0x2CFF}, {0x102E0, 0x102FF}},
   ['Cyrl'] = {{0x0400, 0x04FF}, {0x0500, 0x052F}, {0x1C80, 0x1C8F},
               {0x2DE0, 0x2DFF}, {0xA640, 0xA69F}},
@@ -15237,7 +15207,7 @@
     elseif not inmath and item.id == 7 then % Apply recursively
       item.replace = item.replace and Babel.locale_map(item.replace)
       item.pre     = item.pre and Babel.locale_map(item.pre)
-      item.post    = item.post and Babel.locale_map(item.post)  
+      item.post    = item.post and Babel.locale_map(item.post)
     elseif item.id == node.id'math' then
       inmath = (item.subtype == 0)
     end
@@ -15297,7 +15267,7 @@
 % Post-handling hyphenation patterns for non-standard rules, like |ff|
 % to |ff-f|. There are still some issues with speed (not very slow, but
 % still slow). The Lua code is below.
-%  
+%
 %    \begin{macrocode}
 \directlua{
   Babel.nohyphenation = \the\l at nohyphenation
@@ -15317,7 +15287,7 @@
 % this macro at the appropriate place. As |\directlua| does not take
 % into account the current catcode of |@|, we just avoid this character
 % in macro names (which explains the internal group, too).
-% 
+%
 %    \begin{macrocode}
 \begingroup
 \catcode`\~=12
@@ -15343,7 +15313,7 @@
       \bbl at ifsamestring{##1}{remove}&%
         {\bbl at add@list\babeltempb{nil}}&%
         {\directlua{
-           local rep = [=[##1]=]             
+           local rep = [=[##1]=]
            rep = rep:gsub('^%s*(remove)%s*$', 'remove = true')
            rep = rep:gsub('^%s*(insert)%s*,', 'insert = true, ')
            rep = rep:gsub('^%s*(after)%s*,', 'after = true, ')
@@ -15360,10 +15330,10 @@
                '(spacefactor)%s*=%s*([%-%d%.]+)%s+([%-%d%.]+)%s+([%-%d%.]+)',
                'spacefactor = {' .. '%2, %3, %4' .. '}')
              rep = rep:gsub('(kashida)%s*=%s*([^%s,]*)', Babel.capture_kashida)
-           else  
+           else
              rep = rep:gsub(    '(no)%s*=%s*([^%s,]*)', Babel.capture_func)
              rep = rep:gsub(   '(pre)%s*=%s*([^%s,]*)', Babel.capture_func)
-             rep = rep:gsub(  '(post)%s*=%s*([^%s,]*)', Babel.capture_func)      
+             rep = rep:gsub(  '(post)%s*=%s*([^%s,]*)', Babel.capture_func)
            end
            tex.print([[\string\babeltempa{{]] .. rep .. [[}}]])
          }}}&%
@@ -15373,7 +15343,7 @@
           post,penalty,kashida,space,spacefactor,kern,node,after,norule,}&%
         \ifin@\else
           \bbl at error{bad-transform-option}{####1}{}{}&%
-        \fi}}&% 
+        \fi}}&%
     \let\bbl at kv@attribute\relax
     \let\bbl at kv@label\relax
     \let\bbl at kv@fonts\@empty
@@ -15380,7 +15350,7 @@
     \bbl at forkv{#2}{\bbl at csarg\edef{kv@##1}{##2}}&%
     \ifx\bbl at kv@fonts\@empty\else\bbl at settransfont\fi
     \ifx\bbl at kv@attribute\relax
-      \ifx\bbl at kv@label\relax\else  
+      \ifx\bbl at kv@label\relax\else
         \bbl at exp{\\\bbl at trim@def\\\bbl at kv@fonts{\bbl at kv@fonts}}&%
         \bbl at replace\bbl at kv@fonts{ }{,}&%
         \edef\bbl at kv@attribute{bbl at ATR@\bbl at kv@label @#3@\bbl at kv@fonts}&%
@@ -15440,7 +15410,7 @@
       patt = u.gsub(patt, '{(%x%x%x%x+)}', 
              function (n)
                return u.gsub(u.char(tonumber(n, 16)), '(%p)', '%%%1')
-             end)            
+             end)
       lbkr[id] = lbkr[id] or {}
       table.insert(lbkr[id],
         { label=label, attr=attr, pattern=patt, replace={\babeltempb} })
@@ -15482,7 +15452,7 @@
     {\bbl at csarg\setattribute{ATR@#1@\languagename @}\@ne}}
 \DeclareRobustCommand\disablelocaletransform[1]{%
   \bbl at ifunset{bbl at ATR@#1@\languagename @}%
-    {\bbl at error{transform-not-available-b}{#1}{}{}}% 
+    {\bbl at error{transform-not-available-b}{#1}{}{}}%
     {\bbl at csarg\unsetattribute{ATR@#1@\languagename @}}}
 \def\bbl at activateposthyphen{%
   \let\bbl at activateposthyphen\relax
@@ -15562,11 +15532,11 @@
 % the |\bodydir| to the |\pagedir|. Sadly, we have to deal with boxes
 % in math with basic, so the |\bbl at mathboxdir| hack is activated every
 % math with the package option bidi=. The hack for the PUA is no longer
-% necessary with |basic|, but it’s kept in |basic-r|.
+% necessary with |basic| (24.8), but it’s kept in |basic-r|.
 %
 %    \begin{macrocode}
 \breakafterdirmode=1
-\ifnum\bbl at bidimode>\@ne % Any bidi= except default=1
+\ifnum\bbl at bidimode>\@ne % Any bidi= except default (=1)
   \let\bbl at beforeforeign\leavevmode
   \AtEndOfPackage{\EnableBabelHook{babel-bidi}}
   \RequirePackage{luatexbase}
@@ -15899,10 +15869,29 @@
         \bbl at replace\bbl at tempa{transforms.}{}%
         \bbl at carg\bbl at transforms{babel\bbl at tempa}{##2}{##3}%
       \fi}%
+    \bbl at exp{%
+      \\\bbl at ifblank{\bbl at cl{dgnat}}%
+       {\let\\\bbl at tempa\relax}%
+       {\def\\\bbl at tempa{%
+         \\\bbl at elt{transforms.prehyphenation}%
+          {digits.native.1.0}{([0-9])}%
+         \\\bbl at elt{transforms.prehyphenation}%
+          {digits.native.1.1}{string={1\string|0123456789\string|\bbl at cl{dgnat}}}}}}%
+    \ifx\bbl at tempa\relax\else
+      \toks@\expandafter\expandafter\expandafter{%
+        \csname bbl at inidata@\languagename\endcsname}%
+      \bbl at csarg\edef{inidata@\languagename}{%
+        \unexpanded\expandafter{\bbl at tempa}%
+        \the\toks@}%
+    \fi
     \csname bbl at inidata@\languagename\endcsname
     \bbl at release@transforms\relax % \relax closes the last item.
   \fi}
+%    \end{macrocode}
+%
 % Start tabular here:
+%
+%    \begin{macrocode}
 \def\localerestoredirs{%
   \ifcase\bbl at thetextdir
     \ifnum\textdirection=\z@\else\textdir TLT\fi
@@ -15920,7 +15909,7 @@
     {\chardef\bbl at tabular@mode\z@}%
     {\chardef\bbl at tabular@mode\@ne}}% Mixed, with LTR cols
 \ifnum\bbl at bidimode>\@ne % Any lua bidi= except default=1
-  % Redefine: vrules mess up dirs:
+  % Redefine: vrules mess up dirs. TODO: why?
   \def\@arstrut{\relax\copy\@arstrutbox}%
   \ifcase\bbl at tabular@mode\or % 1 = Mixed - default
     \let\bbl at parabefore\relax
@@ -15987,12 +15976,12 @@
 % removed it without an alternative. Also, |\hangindent| does not
 % honour direction changes by default, so we need to redefine
 % |\@hangfrom|.
-%    
+%
 %    \begin{macrocode}
 \ifnum\bbl at bidimode>\z@ % Any bidi=
   \def\bbl at nextfake#1{%  non-local changes, use always inside a group!
     \bbl at exp{%
-      \mathdir\the\bodydir  
+      \mathdir\the\bodydir
       #1%              Once entered in math, set boxes to restore values
       \def\\\bbl at insidemath{0}%
       \<ifmmode>%
@@ -16093,7 +16082,7 @@
        \raise\@tempdimc\hb at xt@\z@{%
          \@defaultunitsset\@tempdimc{#1}\unitlength
          \kern\@tempdimc
-         {\ifnum\bbl at tempc>\z@\bbl at pictresetdir\fi#3}\hss}% 
+         {\ifnum\bbl at tempc>\z@\bbl at pictresetdir\fi#3}\hss}%
        \ignorespaces}%
      \MakeRobust\put}%
    \AtBeginDocument
@@ -16124,10 +16113,10 @@
   {}
 %    \end{macrocode}
 %
-%      Implicitly reverses sectioning labels in bidi=basic-r, because
-%      the full stop is not in contact with L numbers any more. I
-%      think there must be a better way. Assumes |bidi=basic|, but
-%      there are some additional readjustments for |bidi=default|.
+% Implicitly reverses sectioning labels in bidi=basic-r, because the
+% full stop is not in contact with L numbers any more. I think there
+% must be a better way. Assumes |bidi=basic|, but there are some
+% additional readjustments for |bidi=default|.
 %
 %    \begin{macrocode}
 \IfBabelLayout{counters*}%
@@ -16208,9 +16197,17 @@
 Babel.linebreaking.replacements[0] = {}  -- pre 
 Babel.linebreaking.replacements[1] = {}  -- post
 
+function Babel.tovalue(v)
+  if type(v) == 'string' then
+    return loadstring('return ' .. v)()
+  else
+    return v
+  end
+end
+
 -- Discretionaries contain strings as nodes
 function Babel.str_to_nodes(fn, matches, base)
-  local n, head, last    
+  local n, head, last
   if fn == nil then return nil end
   for s in string.utfvalues(fn(matches)) do
     if base.id == 7 then 
@@ -16257,7 +16254,7 @@
 
       if lang == locale or lang == nil then
         lang = lang or locale
-        if Babel.ignore_pre_char(item) then  
+        if Babel.ignore_pre_char(item) then
           word_string = word_string .. Babel.us_char
         else
           word_string = word_string .. unicode.utf8.char(item.char)
@@ -16273,7 +16270,7 @@
 
     -- Ignore leading unrecognized nodes, too.
     elseif word_string ~= '' then
-      word_string = word_string .. Babel.us_char   
+      word_string = word_string .. Babel.us_char
       word_nodes[#word_nodes+1] = item  -- Will be ignored
     end
 
@@ -16321,7 +16318,7 @@
       word_nodes[#word_nodes+1] = item
 
     elseif item.id == 7 and item.subtype == 3 then
-      word_string = word_string .. '|'       
+      word_string = word_string .. '|'
       word_nodes[#word_nodes+1] = item
 
     -- (1) Go to next word if nothing was found, and (2) implicitly
@@ -16334,7 +16331,7 @@
       break
 
     else 
-      word_string = word_string .. Babel.us_char   
+      word_string = word_string .. Babel.us_char
       word_nodes[#word_nodes+1] = item  -- Will be ignored
     end
 
@@ -16621,7 +16618,7 @@
             head, new = node.insert_before(head, item, d)
 
           elseif crep and crep.node then
-            d = node.new(crep.node[1], crep.node[2])  
+            d = node.new(crep.node[1], crep.node[2])
             d.attr = item_base.attr
             head, new = node.insert_before(head, item, d)
 
@@ -16762,7 +16759,7 @@
     last.next = n
     last = n
   end
-  head = Babel.hyphenate_replace(head, 0)  
+  head = Babel.hyphenate_replace(head, 0)
   res = ''
   for n in node.traverse(head) do
     if n.id == 12 then
@@ -22997,13 +22994,13 @@
       if inmath then dir = ('TRT' == tex.mathdir) and 'r' or 'l' end
 %    \end{macrocode}
 %
-%      Next is based on the assumption babel sets the language AND
-%      switches the script with its dir. We treat a language block as
-%      a separate Unicode sequence. The following piece of code is
-%      executed at the first glyph after a `dir' node. We don't know
-%      the current language until then. This is not exactly true, as
-%      the math mode may insert explicit dirs in the node list, so, for
-%      the moment there is a hack by brute force (just above).
+% Next is based on the assumption \babel{} sets the language
+% \textit{and} switches the script with its dir. We treat a language
+% block as a separate Unicode sequence. The following piece of code is
+% executed at the first glyph after a `dir' node. We don't know the
+% current language until then. This is not exactly true, as the math
+% mode may insert explicit dirs in the node list, so, for the moment
+% there is a hack by brute force (just above).
 %
 %    \begin{macrocode}
       if new_dir then
@@ -23257,7 +23254,7 @@
 
 -- TODO - \hbox with an explicit dir can lead to wrong results
 -- <R \hbox dir TLT{<R>}> and <L \hbox dir TRT{<L>}>. A small attempt
--- was s made to improve the situation, but the problem is the 3-dir
+-- was made to improve the situation, but the problem is the 3-dir
 -- model in babel/Unicode and the 2-dir model in LuaTeX don't fit
 -- well.
 
@@ -23311,7 +23308,7 @@
     -- current one is not added until we start processing the neutrals.
 
     -- three cases: glyph, dir, otherwise
-    if glyph_not_symbol_font(item)   
+    if glyph_not_symbol_font(item)
        or (item.id == 7 and item.subtype == 2) then
 
       if node.get_attribute(item, ATDIR) == 128 then goto nextnode end
@@ -23394,7 +23391,7 @@
       d = nil
 
     elseif item.id == node.id'math' then
-      inmath = (item.subtype == 0)   
+      inmath = (item.subtype == 0)
 
     elseif item.id == 8 and item.subtype == 19 then
       has_hyperlink = true
@@ -23666,10 +23663,10 @@
 
 Babel.cjk_characters = {
   [0x0021]={c='ex'},
-  [0x0022]={c='qu'},          
+  [0x0022]={c='qu'},
   [0x0024]={c='pr'},
   [0x0025]={c='po'},
-  [0x0027]={c='qu'},          
+  [0x0027]={c='qu'},
   [0x0028]={c='op'},
   [0x0029]={c='cp'},
   [0x002B]={c='pr'},
@@ -23690,18 +23687,18 @@
   [0x00A3]={c='pr'},
   [0x00A4]={c='pr'},
   [0x00A5]={c='pr'},
-  [0x00AB]={c='qu'},          
+  [0x00AB]={c='qu'},
   [0x00B0]={c='po'},
   [0x00B1]={c='pr'},
-  [0x00BB]={c='qu'},          
-  [0x2018]={c='qu'},          
-  [0x2019]={c='qu'},          
+  [0x00BB]={c='qu'},
+  [0x2018]={c='qu'},
+  [0x2019]={c='qu'},
   [0x201A]={c='op'},
-  [0x201B]={c='qu'},    
-  [0x201C]={c='qu'},    
-  [0x201D]={c='qu'},          
+  [0x201B]={c='qu'},
+  [0x201C]={c='qu'},
+  [0x201D]={c='qu'},
   [0x201E]={c='op'},
-  [0x201F]={c='qu'},          
+  [0x201F]={c='qu'},
   [0x2024]={c='in'},
   [0x2025]={c='in'},
   [0x2026]={c='in'},
@@ -23713,8 +23710,8 @@
   [0x2035]={c='po'},
   [0x2036]={c='po'},
   [0x2037]={c='po'},
-  [0x2039]={c='qu'},          
-  [0x203A]={c='qu'},            
+  [0x2039]={c='qu'},
+  [0x203A]={c='qu'},
   [0x203C]={c='ns'},
   [0x203D]={c='ns'},
   [0x2044]={c='is'},
@@ -23773,22 +23770,22 @@
   [0x29FD]={c='cl'},
   [0x2CF9]={c='ex'},
   [0x2CFE]={c='ex'},
-  [0x2E02]={c='qu'},          
-  [0x2E03]={c='qu'},          
-  [0x2E04]={c='qu'},          
-  [0x2E05]={c='qu'},          
-  [0x2E06]={c='qu'},    
-  [0x2E07]={c='qu'},    
-  [0x2E08]={c='qu'},    
-  [0x2E09]={c='qu'},          
-  [0x2E0A]={c='qu'},          
-  [0x2E0B]={c='qu'},          
-  [0x2E0C]={c='qu'},          
-  [0x2E0D]={c='qu'},          
+  [0x2E02]={c='qu'},
+  [0x2E03]={c='qu'},
+  [0x2E04]={c='qu'},
+  [0x2E05]={c='qu'},
+  [0x2E06]={c='qu'},
+  [0x2E07]={c='qu'},
+  [0x2E08]={c='qu'},
+  [0x2E09]={c='qu'},
+  [0x2E0A]={c='qu'},
+  [0x2E0B]={c='qu'},
+  [0x2E0C]={c='qu'},
+  [0x2E0D]={c='qu'},
   [0x2E18]={c='op'},
-  [0x2E1C]={c='qu'},          
-  [0x2E1D]={c='qu'},          
-  [0x2E20]={c='qu'},          
+  [0x2E1C]={c='qu'},
+  [0x2E1D]={c='qu'},
+  [0x2E20]={c='qu'},
   [0x2E21]={c='qu'}, 
   [0x2E22]={c='op'},
   [0x2E23]={c='cl'},
@@ -23825,14 +23822,39 @@
   [0x301D]={c='op'},
   [0x301E]={c='cl'},
   [0x301F]={c='cl'},
+  [0x3043]={c='cj'},
+  [0x3045]={c='cj'},
+  [0x3047]={c='cj'},
+  [0x3049]={c='cj'},
+  [0x3063]={c='cj'},
+  [0x3083]={c='cj'},
+  [0x3085]={c='cj'},
+  [0x3087]={c='cj'},
+  [0x308E]={c='cj'},
+  [0x3095]={c='cj'},
+  [0x3096]={c='cj'},
   [0x303B]={c='ns'},
   [0x303C]={c='ns'},
+  [0x3041]={c='cj'},
   [0x309B]={c='ns'},
   [0x309C]={c='ns'},
   [0x309D]={c='ns'},
   [0x309E]={c='ns'},
   [0x30A0]={c='ns'},
+  [0x30A1]={c='cj'},
+  [0x30A3]={c='cj'},
+  [0x30A5]={c='cj'},
+  [0x30A7]={c='cj'},
+  [0x30A9]={c='cj'},
+  [0x30C3]={c='cj'},
+  [0x30E3]={c='cj'},
+  [0x30E5]={c='cj'},
+  [0x30E7]={c='cj'},
+  [0x30EE]={c='cj'},
+  [0x30F5]={c='cj'},
+  [0x30F6]={c='cj'},
   [0x30FB]={c='ns'},
+  [0x30FC]={c='cj'},
   [0x30FD]={c='ns'},
   [0x30FE]={c='ns'},
   [0xA015]={c='ns'},
@@ -23902,19 +23924,22 @@
   [0xFF61]={c='cl', w='h'},
   [0xFF62]={c='op', w='h'},
   [0xFF63]={c='cl', w='h'},
-  [0xFF64]={c='cl', w='h'} 
+  [0xFF64]={c='cl', w='h'},
+  [0xFF70]={c='cj'}
 }
 
 Babel.cjk_class = setmetatable ( Babel.cjk_characters, {
   __index = function(_, k)
     if (k >= 0xAC00  and k <= 0xD7A3)      -- H2/H3
-        or (k >= 0x2E80  and k <= 0x9FFF)
+        or (k >= 0x2E80  and k <= 0x31E9)  -- Skip small
+        or (k >= 0x3200  and k <= 0x9FFF)
         or (k >= 0xA000  and k <= 0xA48F)  -- Yi
         or (k >= 0xA490  and k <= 0xA4CF)  -- Yi
         or (k >= 0xF900  and k <= 0xFAFF)
         or (k >= 0xFE10  and k <= 0xFE1F) 
         or (k >= 0xFE30  and k <= 0xFE6F)
-        or (k >= 0xFF00  and k <= 0xFFEF)
+        or (k >= 0xFF00  and k <= 0xFF66)  -- Skip small
+        or (k >= 0xFF70  and k <= 0xFFEF)
         or (k >= 0x1F000 and k <= 0x1FFFD)
         or (k >= 0x20000 and k <= 0x2FFFD)
         or (k >= 0x30000 and k <= 0x3FFFD) then
@@ -23921,6 +23946,11 @@
       return {c='I'}
     elseif (k >= 0x20A0  and k <= 0x20CF) then
       return {c='pr'}
+    elseif (k >= 0x31F0  and k <= 0x31FF)
+        or (k >= 0xFF67  and k <= 0xFF6F)
+        or (k >= 0x1B150 and k <= 0x1B152)
+        or (k >= 0x1B164 and k <= 0x1B167) then
+      return {c='cj'}
     else
       return {c='O'}
     end
@@ -23953,16 +23983,14 @@
 %
 % \section{The `nil' language}
 %
-%    This `language' does nothing, except setting the hyphenation patterns to
-%    nohyphenation.
+% This `language' does nothing, except setting the hyphenation patterns
+% to nohyphenation. For this language currently no special definitions
+% are needed or available.
 %
-%    For this language currently no special definitions are needed or
-%    available.
+% The macro |\LdfInit| takes care of preventing that this file is
+% loaded more than once, checking the category code of the \texttt{@}
+% sign, etc.
 %
-%    The macro |\LdfInit| takes care of preventing that this file is
-%    loaded more than once, checking the category code of the
-%    \texttt{@} sign, etc.
-%
 %    \begin{macrocode}
 %<*nil>
 \ProvidesLanguage{nil}[<@date@> v<@version@> Nil language]
@@ -23969,9 +23997,9 @@
 \LdfInit{nil}{datenil}
 %    \end{macrocode}
 %
-%    When this file is read as an option, i.e. by the |\usepackage|
-%    command, \texttt{nil} could be an `unknown' language in which
-%    case we have to make it known.
+% When this file is read as an option, i.e. by the |\usepackage|
+% command, \texttt{nil} could be an `unknown' language in which case we
+% have to make it known.
 %
 %    \begin{macrocode}
 \ifx\l at nil\@undefined
@@ -23983,15 +24011,15 @@
 \fi
 %    \end{macrocode}
 %
-%    This macro is used to store the values of the hyphenation
-%    parameters |\lefthyphenmin| and |\righthyphenmin|.
+% This macro is used to store the values of the hyphenation parameters
+% |\lefthyphenmin| and |\righthyphenmin|.
 %
 %    \begin{macrocode}
 \providehyphenmins{\CurrentOption}{\m at ne\m at ne}
 %    \end{macrocode}
 %
-%    The next step consists of defining commands to switch to (and
-%    from) the `nil' language.
+% The next step consists of defining commands to switch to (and from)
+% the `nil' language.
 % \begin{macro}{\captionnil}
 % \begin{macro}{\datenil}
 %
@@ -24037,10 +24065,10 @@
 \@namedef{bbl at sotf@nil}{latn}
 %    \end{macrocode}
 %
-%    The macro |\ldf at finish| takes care of looking for a
-%    configuration file, setting the main language to be switched on
-%    at |\begin{document}| and resetting the category code of
-%    \texttt{@} to its original value.
+% The macro |\ldf at finish| takes care of looking for a configuration
+% file, setting the main language to be switched on at
+% |\begin{document}| and resetting the category code of \texttt{@} to
+% its original value.
 %
 %    \begin{macrocode}
 \ldf at finish{nil}
@@ -24530,7 +24558,7 @@
 %</ca-buddhist>
 %
 % \subsection{Chinese}
-% 
+%
 % Brute force, with the Julian day of first day of each month. The
 % table has been computed with the help of \textsf{python-lunardate} by
 % Ricky Yeung, GPLv2 (but the code itself has not been used). The range
@@ -24540,7 +24568,7 @@
 %<*ca-chinese>
 \ExplSyntaxOn
 <@Compute Julian day@>
-\def\bbl at ca@chinese#1-#2-#3\@@#4#5#6{% 
+\def\bbl at ca@chinese#1-#2-#3\@@#4#5#6{%
   \edef\bbl at tempd{\fp_eval:n{%
     \bbl at cs@jd{#1}{#2}{#3} - 2457072.5 }}%
   \count@\z@
@@ -24719,7 +24747,7 @@
 %
 % \subsection{General tools}
 %
-%    A number of \LaTeX\ macro's that are needed later on.
+% A number of \LaTeX\ macro's that are needed later on.
 %
 %    \begin{macrocode}
 \long\def\@firstofone#1{#1}
@@ -24794,8 +24822,8 @@
 \@onlypreamble\@onlypreamble
 %    \end{macrocode}
 %
-%    Mimic \LaTeX's |\AtBeginDocument|; for this to work the user
-%    needs to add |\begindocument| to his file.
+% Mimic \LaTeX's |\AtBeginDocument|; for this to work the user needs to
+% add |\begindocument| to his file.
 %
 %    \begin{macrocode}
 \def\begindocument{%
@@ -24814,9 +24842,8 @@
 \def\AtBeginDocument{\g at addto@macro\@begindocumenthook}
 %    \end{macrocode}
 %
-%    We also have to mimic \LaTeX's |\AtEndOfPackage|. Our
-%    replacement macro is much simpler; it stores its argument in
-%    |\@endofldf|.
+% We also have to mimic \LaTeX's |\AtEndOfPackage|. Our replacement
+% macro is much simpler; it stores its argument in |\@endofldf|.
 %
 %    \begin{macrocode}
 \def\AtEndOfPackage#1{\g at addto@macro\@endofldf{#1}}
@@ -24827,10 +24854,10 @@
 \chardef\bbl at opt@hyphenmap\z@
 %    \end{macrocode}
 %
-%    \LaTeX\ needs to be able to switch off writing to its auxiliary
-%    files; plain doesn't have them by default. There is a trick to
-%    hide some conditional commands from the outer |\ifx|. The same
-%    trick is applied below.
+% \LaTeX\ needs to be able to switch off writing to its auxiliary
+% files; plain doesn't have them by default. There is a trick to hide
+% some conditional commands from the outer |\ifx|. The same trick is
+% applied below.
 %
 %    \begin{macrocode}
 \catcode`\&=\z@
@@ -24841,7 +24868,7 @@
 \catcode`\&=4
 %    \end{macrocode}
 %
-%    Mimic \LaTeX's commands to define control sequences.
+% Mimic \LaTeX's commands to define control sequences.
 %
 %    \begin{macrocode}
 \def\newcommand{\@star at or@long\new at command}
@@ -24909,11 +24936,11 @@
   \def\@x at protect#1&fi#2#3{&fi\protect#1}
 %    \end{macrocode}
 %
-%    The following little macro |\in@| is taken from \file{latex.ltx};
-%    it checks whether its first argument is part of its second
-%    argument. It uses the boolean |\in@|; allocating a new boolean
-%    inside conditionally executed code is not possible, hence the
-%    construct with the temporary definition of |\bbl at tempa|.
+% The following little macro |\in@| is taken from \file{latex.ltx}; it
+% checks whether its first argument is part of its second argument. It
+% uses the boolean |\in@|; allocating a new boolean inside
+% conditionally executed code is not possible, hence the construct with
+% the temporary definition of |\bbl at tempa|.
 %
 %    \begin{macrocode}
   \def\bbl at tempa{\csname newif\endcsname&ifin@}
@@ -24929,32 +24956,31 @@
 \bbl at tempa
 %    \end{macrocode}
 %
-%    \LaTeX\ has a macro to check whether a certain package was loaded
-%    with specific options. The command has two extra arguments which
-%    are code to be executed in either the true or false case.
-%    This is used to detect whether the document needs one of the
-%    accents to be activated (\Lopt{activegrave} and
-%    \Lopt{activeacute}). For plain \TeX\ we assume that the user
-%    wants them to be active by default. Therefore the only thing we
-%    do is execute the third argument (the code for the true case).
+% \LaTeX\ has a macro to check whether a certain package was loaded
+% with specific options. The command has two extra arguments which are
+% code to be executed in either the true or false case. This is used to
+% detect whether the document needs one of the accents to be activated
+% (\Lopt{activegrave} and \Lopt{activeacute}). For plain \TeX\ we
+% assume that the user wants them to be active by default. Therefore
+% the only thing we do is execute the third argument (the code for the
+% true case).
 %
 %    \begin{macrocode}
 \def\@ifpackagewith#1#2#3#4{#3}
 %    \end{macrocode}
 %
-%    The \LaTeX\ macro |\@ifl at aded| checks whether a file was
-%    loaded. This functionality is not needed for plain \TeX\ but we
-%    need the macro to be defined as a no-op.
+% The \LaTeX\ macro |\@ifl at aded| checks whether a file was loaded. This
+% functionality is not needed for plain \TeX\ but we need the macro to
+% be defined as a no-op.
 %
 %    \begin{macrocode}
 \def\@ifl at aded#1#2#3#4{}
 %    \end{macrocode}
 %
-%    For the following code we need to make sure that the commands
-%    |\newcommand| and |\providecommand| exist with some sensible
-%    definition. They are not fully equivalent to their \LaTeXe\
-%    versions; just enough to make things work in plain~\TeX
-%    environments.
+% For the following code we need to make sure that the commands
+% |\newcommand| and |\providecommand| exist with some sensible
+% definition. They are not fully equivalent to their \LaTeXe\ versions;
+% just enough to make things work in plain~\TeX environments.
 %
 %    \begin{macrocode}
 \ifx\@tempcnta\@undefined
@@ -24965,9 +24991,9 @@
 \fi
 %    \end{macrocode}
 %
-%    To prevent wasting two counters in \LaTeX\ (because
-%    counters with the same name are allocated later by it) we reset
-%    the counter that holds the next free counter (|\count10|).
+% To prevent wasting two counters in \LaTeX\ (because counters with the
+% same name are allocated later by it) we reset the counter that holds
+% the next free counter (|\count10|).
 %
 %    \begin{macrocode}
 \ifx\bye\@undefined
@@ -25008,8 +25034,8 @@
 %
 % \subsection{Encoding related macros}
 %
-%    Code from \file{ltoutenc.dtx}, adapted for use in the plain \TeX\
-%    environment.
+% Code from \file{ltoutenc.dtx}, adapted for use in the plain \TeX\
+% environment.
 %
 %    \begin{macrocode}
 \def\DeclareTextCommand{%
@@ -25132,9 +25158,8 @@
 \def\cf at encoding{OT1}
 %    \end{macrocode}
 %
-% Currently we only use the \LaTeXe\ method for accents for those
-%    that are known to be made active in \emph{some} language
-%    definition file.
+% Currently we only use the \LaTeXe\ method for accents for those that
+% are known to be made active in \emph{some} language definition file.
 %
 %    \begin{macrocode}
 \DeclareTextAccent{\"}{OT1}{127}
@@ -25144,8 +25169,8 @@
 \DeclareTextAccent{\~}{OT1}{126}
 %    \end{macrocode}
 %
-%    The following control sequences are used in \file{babel.def}
-%    but are not defined for \textsc{plain} \TeX.
+% The following control sequences are used in \file{babel.def} but are
+% not defined for \textsc{plain} \TeX.
 %
 %    \begin{macrocode}
 \DeclareTextSymbol{\textquotedblleft}{OT1}{92}
@@ -25167,7 +25192,7 @@
 \fi
 %    \end{macrocode}
 %
-%    And a few more “dummy” definitions.
+% And a few more “dummy” definitions.
 %
 %    \begin{macrocode}
 \def\languagename{english}%
@@ -25204,7 +25229,6 @@
 \input babel.def
 %</plain>
 %    \end{macrocode}
-%
 % \Finale
 %
 \endinput

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.ins	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.ins	2024-08-29 20:32:06 UTC (rev 72134)
@@ -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{2024/08/18}
+\def\filedate{2024/08/29}
 \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	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2024-08-29 20:32:06 UTC (rev 72134)
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2024/08/18 v24.8]
+\ProvidesFile{bbcompat.dtx}[2024/08/29 v24.]
 %</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-bidi-basic-r.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic-r.lua	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic-r.lua	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 -- and covered by LPPL is defined by the unpacking scripts (with
 -- extension |.ins|) which are part of the distribution.
 --
-
 Babel = Babel or {}
 
 Babel.bidi_enabled = true

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 -- and covered by LPPL is defined by the unpacking scripts (with
 -- extension |.ins|) which are part of the distribution.
 --
-
 Babel = Babel or {}
 
 -- eg, Babel.fontmap[1][<prefontid>]=<dirfontid>
@@ -102,7 +101,7 @@
 
 -- TODO - \hbox with an explicit dir can lead to wrong results
 -- <R \hbox dir TLT{<R>}> and <L \hbox dir TRT{<L>}>. A small attempt
--- was s made to improve the situation, but the problem is the 3-dir
+-- was made to improve the situation, but the problem is the 3-dir
 -- model in babel/Unicode and the 2-dir model in LuaTeX don't fit
 -- well.
 

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-buddhist.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-buddhist.tex	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-buddhist.tex	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \def\bbl at ca@buddhist#1-#2-#3\@@#4#5#6{%
   \edef#4{\number\numexpr#1+543\relax}%
   \edef#5{#2}%

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-chinese.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-chinese.tex	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-chinese.tex	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \ExplSyntaxOn
 \def\bbl at fpmod#1#2{(#1-#2*floor(#1/#2))}
 \def\bbl at cs@gregleap#1{%

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-coptic.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-coptic.tex	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-coptic.tex	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \ExplSyntaxOn
 \def\bbl at fpmod#1#2{(#1-#2*floor(#1/#2))}
 \def\bbl at cs@gregleap#1{%

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-ethiopic.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-ethiopic.tex	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-ethiopic.tex	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \ExplSyntaxOn
 \def\bbl at fpmod#1#2{(#1-#2*floor(#1/#2))}
 \def\bbl at cs@gregleap#1{%

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-hebrew.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-hebrew.tex	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-hebrew.tex	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \newcount\bbl at cntcommon
 \def\bbl at remainder#1#2#3{%
   #3=#1\relax

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-islamic.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-islamic.tex	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-islamic.tex	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \ExplSyntaxOn
 \def\bbl at fpmod#1#2{(#1-#2*floor(#1/#2))}
 \def\bbl at cs@gregleap#1{%

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-ca-persian.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-ca-persian.tex	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-ca-persian.tex	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \ExplSyntaxOn
 \def\bbl at fpmod#1#2{(#1-#2*floor(#1/#2))}
 \def\bbl at cs@gregleap#1{%

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-data-bidi.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-data-bidi.lua	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-data-bidi.lua	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 -- and covered by LPPL is defined by the unpacking scripts (with
 -- extension |.ins|) which are part of the distribution.
 --
-
 -- Data from Unicode and ConTeXt
 
 Babel = Babel or {}

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-data-cjk.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-data-cjk.lua	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-data-cjk.lua	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 -- and covered by LPPL is defined by the unpacking scripts (with
 -- extension |.ins|) which are part of the distribution.
 --
-
 Babel = Babel or {}
 
 Babel.cjk_characters = {
@@ -196,14 +195,39 @@
   [0x301D]={c='op'},
   [0x301E]={c='cl'},
   [0x301F]={c='cl'},
+  [0x3043]={c='cj'},
+  [0x3045]={c='cj'},
+  [0x3047]={c='cj'},
+  [0x3049]={c='cj'},
+  [0x3063]={c='cj'},
+  [0x3083]={c='cj'},
+  [0x3085]={c='cj'},
+  [0x3087]={c='cj'},
+  [0x308E]={c='cj'},
+  [0x3095]={c='cj'},
+  [0x3096]={c='cj'},
   [0x303B]={c='ns'},
   [0x303C]={c='ns'},
+  [0x3041]={c='cj'},
   [0x309B]={c='ns'},
   [0x309C]={c='ns'},
   [0x309D]={c='ns'},
   [0x309E]={c='ns'},
   [0x30A0]={c='ns'},
+  [0x30A1]={c='cj'},
+  [0x30A3]={c='cj'},
+  [0x30A5]={c='cj'},
+  [0x30A7]={c='cj'},
+  [0x30A9]={c='cj'},
+  [0x30C3]={c='cj'},
+  [0x30E3]={c='cj'},
+  [0x30E5]={c='cj'},
+  [0x30E7]={c='cj'},
+  [0x30EE]={c='cj'},
+  [0x30F5]={c='cj'},
+  [0x30F6]={c='cj'},
   [0x30FB]={c='ns'},
+  [0x30FC]={c='cj'},
   [0x30FD]={c='ns'},
   [0x30FE]={c='ns'},
   [0xA015]={c='ns'},
@@ -273,19 +297,22 @@
   [0xFF61]={c='cl', w='h'},
   [0xFF62]={c='op', w='h'},
   [0xFF63]={c='cl', w='h'},
-  [0xFF64]={c='cl', w='h'}
+  [0xFF64]={c='cl', w='h'},
+  [0xFF70]={c='cj'}
 }
 
 Babel.cjk_class = setmetatable ( Babel.cjk_characters, {
   __index = function(_, k)
     if (k >= 0xAC00  and k <= 0xD7A3)      -- H2/H3
-        or (k >= 0x2E80  and k <= 0x9FFF)
+        or (k >= 0x2E80  and k <= 0x31E9)  -- Skip small
+        or (k >= 0x3200  and k <= 0x9FFF)
         or (k >= 0xA000  and k <= 0xA48F)  -- Yi
         or (k >= 0xA490  and k <= 0xA4CF)  -- Yi
         or (k >= 0xF900  and k <= 0xFAFF)
         or (k >= 0xFE10  and k <= 0xFE1F)
         or (k >= 0xFE30  and k <= 0xFE6F)
-        or (k >= 0xFF00  and k <= 0xFFEF)
+        or (k >= 0xFF00  and k <= 0xFF66)  -- Skip small
+        or (k >= 0xFF70  and k <= 0xFFEF)
         or (k >= 0x1F000 and k <= 0x1FFFD)
         or (k >= 0x20000 and k <= 0x2FFFD)
         or (k >= 0x30000 and k <= 0x3FFFD) then
@@ -292,6 +319,11 @@
       return {c='I'}
     elseif (k >= 0x20A0  and k <= 0x20CF) then
       return {c='pr'}
+    elseif (k >= 0x31F0  and k <= 0x31FF)
+        or (k >= 0xFF67  and k <= 0xFF6F)
+        or (k >= 0x1B150 and k <= 0x1B152)
+        or (k >= 0x1B164 and k <= 0x1B167) then
+      return {c='cj'}
     else
       return {c='O'}
     end

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-transforms.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-transforms.lua	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-transforms.lua	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,11 +32,18 @@
 -- and covered by LPPL is defined by the unpacking scripts (with
 -- extension |.ins|) which are part of the distribution.
 --
-
 Babel.linebreaking.replacements = {}
 Babel.linebreaking.replacements[0] = {}  -- pre
 Babel.linebreaking.replacements[1] = {}  -- post
 
+function Babel.tovalue(v)
+  if type(v) == 'string' then
+    return loadstring('return ' .. v)()
+  else
+    return v
+  end
+end
+
 -- Discretionaries contain strings as nodes
 function Babel.str_to_nodes(fn, matches, base)
   local n, head, last

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.def	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.def	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \ifx\ldf at quit\@undefined\else
 \endinput\fi % Same line!
 \ifx\ProvidesFile\@undefined
@@ -40,7 +39,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{babel.def}[2024/08/18 v24.8 Babel common definitions]
+\ProvidesFile{babel.def}[2024/08/29 v24.9 Babel common definitions]
 \ifx\AtBeginDocument\@undefined  % TODO. change test.
   \def\@empty{}
 \def\loadlocalcfg#1{%
@@ -596,8 +595,8 @@
     \toks@\expandafter{\bbl at tempc#3}%
     \expandafter\edef\csname extras\languagename\endcsname{\the\toks@}%
   \fi}
-\def\bbl at version{24.8}
-\def\bbl at date{2024/08/18}
+\def\bbl at version{24.9}
+\def\bbl at date{2024/08/29}
 \ifx\language\@undefined
   \csname newcount\endcsname\language
 \fi
@@ -824,7 +823,7 @@
         \csname captions#1\endcsname\relax
       \fi
       \bbl at xin@{,date,}{,\bbl at select@opts,}%
-      \ifin@  % if \foreign... within \<lang>date
+      \ifin@  % if \foreign... within \<language>date
         \csname date#1\endcsname\relax
       \fi
     \fi
@@ -1268,6 +1267,7 @@
   \bbl at patterns{\languagename}}
 \def\bbl at beforestart{%
   \def\@nolanerr##1{%
+    \bbl at carg\chardef{l@##1}\z@
     \bbl at warning{Undefined language '##1' in aux.\\Reported}}%
   \bbl at usehooks{beforestart}{}%
   \global\let\bbl at beforestart\relax}
@@ -1275,8 +1275,8 @@
   {\@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{\unexpanded{%
+      \providecommand\babel at aux[2]{\global\let\babel at toc\@gobbletwo}}}%
     \immediate\write\@mainaux{\string\@nameuse{bbl at beforestart}}%
   \fi
   \expandafter\selectlanguage\expandafter{\bbl at main@language}%

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,9 +32,8 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
-\ProvidesPackage{babel}[2024/08/18 v24.8 The Babel package]
+\ProvidesPackage{babel}[2024/08/29 v24.9 The Babel package]
 \@ifpackagewith{babel}{debug}
   {\providecommand\bbl at trace[1]{\message{^^J[ #1 ]}}%
    \let\bbl at debug\@firstofone
@@ -344,8 +343,8 @@
 \DeclareOption{shorthands=off}{\bbl at tempa shorthands=\bbl at tempa}
 \chardef\bbl at iniflag\z@
 \DeclareOption{provide=*}{\chardef\bbl at iniflag\@ne}    % main -> +1
-\DeclareOption{provide+=*}{\chardef\bbl at iniflag\tw@}   % add = 2
-\DeclareOption{provide*=*}{\chardef\bbl at iniflag\thr@@} % add + main
+\DeclareOption{provide+=*}{\chardef\bbl at iniflag\tw@}   % second = 2
+\DeclareOption{provide*=*}{\chardef\bbl at iniflag\thr@@} % second + main
 \let\bbl at autoload@options\@empty
 \DeclareOption{provide@=*}{\def\bbl at autoload@options{import}}
 \newif\ifbbl at single
@@ -466,8 +465,8 @@
       \expandafter\@secondoftwo
     \fi}
 \fi
-\def\bbl at version{24.8}
-\def\bbl at date{2024/08/18}
+\def\bbl at version{24.9}
+\def\bbl at date{2024/08/29}
 \ifx\language\@undefined
   \csname newcount\endcsname\language
 \fi
@@ -722,7 +721,7 @@
         \csname captions#1\endcsname\relax
       \fi
       \bbl at xin@{,date,}{,\bbl at select@opts,}%
-      \ifin@  % if \foreign... within \<lang>date
+      \ifin@  % if \foreign... within \<language>date
         \csname date#1\endcsname\relax
       \fi
     \fi
@@ -1166,6 +1165,7 @@
   \bbl at patterns{\languagename}}
 \def\bbl at beforestart{%
   \def\@nolanerr##1{%
+    \bbl at carg\chardef{l@##1}\z@
     \bbl at warning{Undefined language '##1' in aux.\\Reported}}%
   \bbl at usehooks{beforestart}{}%
   \global\let\bbl at beforestart\relax}
@@ -1173,8 +1173,8 @@
   {\@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{\unexpanded{%
+      \providecommand\babel at aux[2]{\global\let\babel at toc\@gobbletwo}}}%
     \immediate\write\@mainaux{\string\@nameuse{bbl at beforestart}}%
   \fi
   \expandafter\selectlanguage\expandafter{\bbl at main@language}%
@@ -3254,7 +3254,7 @@
 \bbl at csarg\let{inikv at transforms.posthyphenation}\bbl at inikv
 \def\bbl at transforms@aux#1#2#3#4,#5\relax{%
   #1[#2]{#3}{#4}{#5}}
-\begingroup %  A hack. TODO. Don't require an specific order
+\begingroup %  A hack. TODO. Don't require a specific order
   \catcode`\%=12
   \catcode`\&=14
   \gdef\bbl at transforms#1#2#3{&%
@@ -3935,8 +3935,8 @@
 \def\bbl at patchfont#1{\AddToHook{selectfont}{#1}}
 \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 % Any xe+lua bidi=
+\else % TODO. Move to txtbabel. Any xe+lua bidi
+  \ifnum\bbl at bidimode>100 \ifnum\bbl at bidimode<200
     \bbl at error{bidi-only-lua}{}{}{}%
     \let\bbl at beforeforeign\leavevmode
     \AtEndOfPackage{%
@@ -3947,7 +3947,9 @@
     \ifx\RTLfootnotetext\@undefined
       \AtEndOfPackage{%
         \EnableBabelHook{babel-bidi}%
-        \bbl at loadfontspec % bidi needs fontspec
+        \ifx\fontspec\@undefined
+          \usepackage{fontspec}% bidi needs fontspec
+        \fi
         \usepackage#1{bidi}%
         \let\bbl at digitsdotdash\DigitsDotDashInterCharToks
         \def\DigitsDotDashInterCharToks{% See the 'bidi' package
@@ -3980,24 +3982,19 @@
     \fi}
 \fi
 \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,Lydian,Mandaean,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}%
+  \bbl at xin@{\csname bbl at sbcp@#1\endcsname}{,Arab,Syrc,Thaa,}%
   \ifin@
-    \global\bbl at csarg\chardef{wdir@#1}\@ne
-    \bbl at xin@{\csname bbl at sname@#1\endcsname}{\bbl at alscripts}%
+    \global\bbl at csarg\chardef{wdir@#1}\tw@
+  \else
+    \bbl at xin@{\csname bbl at sbcp@#1\endcsname}{%
+      ,Armi,Avst,Cprt,Hatr,Hebr,Hung,Lydi,Mand,Mani,Merc,Mero,%
+       Narb,Nbat,Nkoo,Orkh,Palm,Phli,Phlp,Phnx,Prti,Samr,Sarb,}%
     \ifin@
-      \global\bbl at csarg\chardef{wdir@#1}\tw@
+      \global\bbl at csarg\chardef{wdir@#1}\@ne
+    \else
+      \global\bbl at csarg\chardef{wdir@#1}\z@
     \fi
-  \else
-    \global\bbl at csarg\chardef{wdir@#1}\z@
   \fi
   \ifodd\bbl at engine
     \bbl at csarg\ifcase{wdir@#1}%
@@ -4018,8 +4015,10 @@
     \bbl at pardir{#1}% <- Must precede \bbl at textdir
   \fi
   \bbl at textdir{#1}}
-\AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
-\DisableBabelHook{babel-bidi}
+\ifnum\bbl at bidimode>\z@
+  \AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
+  \DisableBabelHook{babel-bidi}
+\fi
 \ifodd\bbl at engine  % luatex=1
 \else % pdftex=0, xetex=2
   \newcount\bbl at dirlevel
@@ -4075,10 +4074,7 @@
       \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}}
+    \AddToHook{para/begin}{\bbl at xeeverypar}}
   \ifnum\bbl at bidimode>200 % Any xe bidi=
     \let\bbl at textdir@i\@gobbletwo
     \let\bbl at xebidipar\@empty

Modified: trunk/Master/texmf-dist/tex/generic/babel/blplain.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/blplain.tex	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/blplain.tex	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \catcode`\{=1 % left brace is begin-group character
 \catcode`\}=2 % right brace is end-group character
 \catcode`\#=6 % hash mark is macro parameter character

Modified: trunk/Master/texmf-dist/tex/generic/babel/bplain.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/bplain.tex	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/bplain.tex	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \catcode`\{=1 % left brace is begin-group character
 \catcode`\}=2 % right brace is end-group character
 \catcode`\#=6 % hash mark is macro parameter character

Modified: trunk/Master/texmf-dist/tex/generic/babel/errbabel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/errbabel.def	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/errbabel.def	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \catcode`\{=1  \catcode`\}=2  \catcode`\#=6
 \catcode`\:=12 \catcode`\,=12 \catcode`\.=12 \catcode`\-=12
 \catcode`\'=12 \catcode`\(=12 \catcode`\)=12

Modified: trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,16 +32,15 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \ifx\ProvidesFile\@undefined
   \def\ProvidesFile#1[#2 #3 #4]{%
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{hyphen.cfg}[2024/08/18 v24.8 Babel hyphens]
+\ProvidesFile{hyphen.cfg}[2024/08/29 v24.9 Babel hyphens]
 \xdef\bbl at format{\jobname}
-\def\bbl at version{24.8}
-\def\bbl at date{2024/08/18}
+\def\bbl at version{24.9}
+\def\bbl at date{2024/08/29}
 \ifx\AtBeginDocument\@undefined
   \def\@empty{}
 \fi

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	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ja/babel-ja.ini	2024-08-29 20:32:06 UTC (rev 72134)
@@ -1,3 +1,4 @@
+
 ; 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:
@@ -9,8 +10,8 @@
 
 [identification]
 charset = utf8
-version = 1.11
-date = 2024-04-18
+version = 1.12
+date = 2024-08-27
 name.local = 日本語
 name.english = Japanese
 name.babel = japanese
@@ -197,4 +198,35 @@
 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
 
+[transforms.prehyphenation]
+linebreak.strict.1.0 = { [々ぁぃぅぇぉっゃゅょゎ゛-ゞァィゥェォッャュョヮヵヶゕゖㇰ-ㇿ・-ヾ・-ゥェ-ー゙] }
+linebreak.strict.1.1 =   { insert, penalty = 10000, step = 1 }
+linebreak.strict.1.2 =   {}
+; 
+spacing.basic.1.0 = { [、。,.・:;!?)]}〉》」』】〕〗〙〛”〞] ()[([{〈《「『【〔〖〘〚“〝]()  }
+spacing.basic.1.1 =   { insert, kern = -.5 }
+spacing.basic.1.2 =   { insert, penalty = 0 }
+spacing.basic.1.3 =   { insert, kern = .5 }
+spacing.basic.1.4 =   { insert, norule = -.5 0 0 }
+spacing.basic.1.5 =   {}
+spacing.basic.2.0 = { [、。,.・:;!?)]}〉》」』】〕〗〙〛”〞] ()[、。,.・:!?)]}〉》」』】〕〗〙〛”〞]() }
+spacing.basic.2.1 =   { insert, kern= -.5, step = -1 }
+spacing.basic.2.2 =   {}
+spacing.basic.3.0 = { [([{〈《「『【〔〖〘〚“〝] ()[([{〈《「『【〔〖〘〚“〝]() }
+spacing.basic.3.1 =   { insert, kern = -.5, step =- 1 }
+spacing.basic.3.2 =   {}
+;
+spacing.basic.4.0 = { [、。,.・:;!?)]}〉》」』】〕〗〙〛”〞] ()[{a}]() }
+spacing.basic.4.1 =   { insert, kern = -.5, step = -1 }
+spacing.basic.4.2 =   { insert, penalty = 0 }
+spacing.basic.4.3 =   { insert, kern = .5 }
+spacing.basic.4.4 =   {}
+spacing.basic.5.0 = { [{a}] ()[([{〈《「『【〔〖〘〚“〝]() }
+spacing.basic.5.1 =   { insert, penalty = 0 }
+spacing.basic.5.2 =   { insert, kern = .5 }
+spacing.basic.5.3 =   { insert, norule = -.5 0 0 }
+spacing.basic.5.4 =   {}
+spacing.basic.6.0 = { ^()[([{〈《「『【〔〖〘〚“〝]() }
+spacing.basic.6.1 =   { insert, kern = -.5 }
+spacing.basic.6.2 =   {}
 

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	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-zh.ini	2024-08-29 20:32:06 UTC (rev 72134)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.14
-date = 2023-10-24
+version = 1.15
+date = 2024-10-27
 name.local = 中文
 name.english = Chinese
 name.opentype = Chinese Simplified
@@ -240,3 +240,31 @@
 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
 date.day = 初一 初二 初三 初四 初五 初六 初七 初八 初九 初十 十一 十二 十三 十四 十五 十六 十七 十八 十九 二十 廿一 廿二 廿三 廿四 廿五 廿六 廿七 廿八 廿九 三十
+
+[transforms.prehyphenation]
+spacing.basic.1.0 = { [、。,.・:;!?)]}〉》」』】〕〗〙〛”〞] ()[([{〈《「『【〔〖〘〚“〝]()  }
+spacing.basic.1.1 =   { insert, kern = -.5 }
+spacing.basic.1.2 =   { insert, penalty = 0 }
+spacing.basic.1.3 =   { insert, kern = .5 }
+spacing.basic.1.4 =   { insert, norule = -.5 0 0 }
+spacing.basic.1.5 =   {}
+spacing.basic.2.0 = { [、。,.・:;!?)]}〉》」』】〕〗〙〛”〞] ()[、。,.・:!?)]}〉》」』】〕〗〙〛”〞]() }
+spacing.basic.2.1 =   { insert, kern= -.5, step = -1 }
+spacing.basic.2.2 =   {}
+spacing.basic.3.0 = { [([{〈《「『【〔〖〘〚“〝] ()[([{〈《「『【〔〖〘〚“〝]() }
+spacing.basic.3.1 =   { insert, kern = -.5, step =- 1 }
+spacing.basic.3.2 =   {}
+;
+spacing.basic.4.0 = { [、。,.・:;!?)]}〉》」』】〕〗〙〛”〞] ()[{a}]() }
+spacing.basic.4.1 =   { insert, kern = -.5, step = -1 }
+spacing.basic.4.2 =   { insert, penalty = 0 }
+spacing.basic.4.3 =   { insert, kern = .5 }
+spacing.basic.4.4 =   {}
+spacing.basic.5.0 = { [{a}] ()[([{〈《「『【〔〖〘〚“〝]() }
+spacing.basic.5.1 =   { insert, penalty = 0 }
+spacing.basic.5.2 =   { insert, kern = .5 }
+spacing.basic.5.3 =   { insert, norule = -.5 0 0 }
+spacing.basic.5.4 =   {}
+spacing.basic.6.0 = { ^()[([{〈《「『【〔〖〘〚“〝]() }
+spacing.basic.6.1 =   { insert, kern = -.5 }
+spacing.basic.6.2 =   {}

Modified: trunk/Master/texmf-dist/tex/generic/babel/luababel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \ifx\AddBabelHook\@undefined % When plain.def, babel.sty starts
 \bbl at trace{Read language.dat}
 \ifx\bbl at readstream\@undefined
@@ -178,8 +177,6 @@
        {\expandafter\expandafter\expandafter\bbl at luapatterns
           \csname bbl at hyphendata@\the\language\endcsname}}{}}
 \endinput\fi
-  % Here ends \ifx\AddBabelHook\@undefined
-  % A few lines are only read by hyphen.cfg
 \ifx\DisableBabelHook\@undefined
   \AddBabelHook{luatex}{everylanguage}{%
     \def\process at language##1##2##3{%
@@ -195,9 +192,6 @@
        {\expandafter\expandafter\expandafter\bbl at tempb
         \csname bbl at hyphendata@\the\language\endcsname}}
 \endinput\fi
-  % Here stops reading code for hyphen.cfg
-  % The following is read the 2nd time it's loaded
-  % First, global declarations for lua
 \begingroup  % TODO - to a lua file
 \catcode`\%=12
 \catcode`\'=12
@@ -496,8 +490,10 @@
             class = props.cjk_quotes[item.char]
           end
 
-          if class == 'cp' then class = 'cl' end % )] as CL
-          if class == 'id' then class = 'I' end
+          if class == 'cp' then class = 'cl' % )] as CL
+          elseif class == 'id' then class = 'I'
+          elseif class == 'cj' then class = 'I' % loose
+          end
 
           local br = 0
           if class and last_class and Babel.cjk_breaks[last_class][class] then
@@ -544,10 +540,10 @@
           func(head)
         end
       end
+      lang.hyphenate(head)
       if Babel.cjk_enabled then
         Babel.cjk_linebreak(head)
       end
-      lang.hyphenate(head)
       if Babel.linebreaking.after then
         for k, func in ipairs(Babel.linebreaking.after)  do
           func(head)
@@ -844,23 +840,10 @@
 }
 \endgroup
 \fi\fi % ends Arabic just block: \ifnum\bbl at bidimode>100...
+\bbl at trace{Font handling with fontspec}
 \AddBabelHook{babel-fontspec}{afterextras}{\bbl at switchfont}
 \AddBabelHook{babel-fontspec}{beforestart}{\bbl at ckeckstdfonts}
 \DisableBabelHook{babel-fontspec}
-\bbl at trace{Font handling with fontspec}
-\ifx\ExplSyntaxOn\@undefined\else
-  \def\bbl at fs@warn at nx#1#2{% \bbl at tempfs is the original macro
-    \in@{,#1,}{,no-script,language-not-exist,}%
-    \ifin@\else\bbl at tempfs@nx{#1}{#2}\fi}
-  \def\bbl at fs@warn at nxx#1#2#3{%
-    \in@{,#1,}{,no-script,language-not-exist,}%
-    \ifin@\else\bbl at tempfs@nxx{#1}{#2}{#3}\fi}
-  \def\bbl at loadfontspec{%
-    \let\bbl at loadfontspec\relax
-    \ifx\fontspec\@undefined
-      \usepackage{fontspec}%
-    \fi}%
-\fi
 \@onlypreamble\babelfont
 \newcommand\babelfont[2][]{%  1=langs/scripts 2=fam
   \bbl at foreach{#1}{%
@@ -871,8 +854,10 @@
     \fi}%
   \edef\bbl at tempa{#1}%
   \def\bbl at tempb{#2}%  Used by \bbl at bblfont
-  \bbl at loadfontspec
-  \EnableBabelHook{babel-fontspec}% Just calls \bbl at switchfont
+  \ifx\fontspec\@undefined
+    \usepackage{fontspec}%
+  \fi
+  \EnableBabelHook{babel-fontspec}%
   \bbl at bblfont}
 \newcommand\bbl at bblfont[2][]{% 1=features 2=fontname, @font=rm|sf|tt
   \bbl at ifunset{\bbl at tempb family}%
@@ -996,17 +981,10 @@
       {\\\newfontscript{\bbl at cl{sname}}{\bbl at cl{sotf}}}%
     \<keys_if_exist:nnF>{fontspec-opentype}{Language/\bbl at cl{lname}}%
       {\\\newfontlanguage{\bbl at cl{lname}}{\bbl at cl{lotf}}}%
-    \let\\\bbl at tempfs@nx\<__fontspec_warning:nx>%
-    \let\<__fontspec_warning:nx>\\\bbl at fs@warn at nx
-    \let\\\bbl at tempfs@nxx\<__fontspec_warning:nxx>%
-    \let\<__fontspec_warning:nxx>\\\bbl at fs@warn at nxx
     \\\renewfontfamily\\#4%
       [\bbl at cl{lsys},% xetex removes unknown features :-(
        \ifcase\bbl at engine\or RawFeature={family=\bbl at tempb},\fi
        #2]}{#3}% ie \bbl at exp{..}{#3}
-  \bbl at exp{%
-    \let\<__fontspec_warning:nx>\\\bbl at tempfs@nx
-    \let\<__fontspec_warning:nxx>\\\bbl at tempfs@nxx}%
   \begingroup
      #4%
      \xdef#1{\f at family}%     eg, \bbl at rmdflt@lang{FreeSerif(0)}
@@ -1415,7 +1393,7 @@
         'luaotfload.node_processor') or nil)
   }}
 \breakafterdirmode=1
-\ifnum\bbl at bidimode>\@ne % Any bidi= except default=1
+\ifnum\bbl at bidimode>\@ne % Any bidi= except default (=1)
   \let\bbl at beforeforeign\leavevmode
   \AtEndOfPackage{\EnableBabelHook{babel-bidi}}
   \RequirePackage{luatexbase}
@@ -1691,6 +1669,21 @@
         \bbl at replace\bbl at tempa{transforms.}{}%
         \bbl at carg\bbl at transforms{babel\bbl at tempa}{##2}{##3}%
       \fi}%
+    \bbl at exp{%
+      \\\bbl at ifblank{\bbl at cl{dgnat}}%
+       {\let\\\bbl at tempa\relax}%
+       {\def\\\bbl at tempa{%
+         \\\bbl at elt{transforms.prehyphenation}%
+          {digits.native.1.0}{([0-9])}%
+         \\\bbl at elt{transforms.prehyphenation}%
+          {digits.native.1.1}{string={1\string|0123456789\string|\bbl at cl{dgnat}}}}}}%
+    \ifx\bbl at tempa\relax\else
+      \toks@\expandafter\expandafter\expandafter{%
+        \csname bbl at inidata@\languagename\endcsname}%
+      \bbl at csarg\edef{inidata@\languagename}{%
+        \unexpanded\expandafter{\bbl at tempa}%
+        \the\toks@}%
+    \fi
     \csname bbl at inidata@\languagename\endcsname
     \bbl at release@transforms\relax % \relax closes the last item.
   \fi}
@@ -1711,7 +1704,7 @@
     {\chardef\bbl at tabular@mode\z@}%
     {\chardef\bbl at tabular@mode\@ne}}% Mixed, with LTR cols
 \ifnum\bbl at bidimode>\@ne % Any lua bidi= except default=1
-  % Redefine: vrules mess up dirs:
+  % Redefine: vrules mess up dirs. TODO: why?
   \def\@arstrut{\relax\copy\@arstrutbox}%
   \ifcase\bbl at tabular@mode\or % 1 = Mixed - default
     \let\bbl at parabefore\relax

Modified: trunk/Master/texmf-dist/tex/generic/babel/nil.ldf
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,8 +32,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
-\ProvidesLanguage{nil}[2024/08/18 v24.8 Nil language]
+\ProvidesLanguage{nil}[2024/08/29 v24.9 Nil language]
 \LdfInit{nil}{datenil}
 \ifx\l at nil\@undefined
   \newlanguage\l at nil

Modified: trunk/Master/texmf-dist/tex/generic/babel/plain.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/plain.def	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/plain.def	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \input babel.def
 \endinput
 %%

Modified: trunk/Master/texmf-dist/tex/generic/babel/switch.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/switch.def	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/switch.def	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \let\bbl at onlyswitch\@empty
 \input babel.def
 \let\bbl at onlyswitch\@undefined

Modified: trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \providecommand\bbl at provide@intraspace{}
 \bbl at trace{Redefinitions for bidi layout}
 \def\bbl at sspre@caption{%  TODO: Unused!

Modified: trunk/Master/texmf-dist/tex/generic/babel/xebabel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/xebabel.def	2024-08-29 20:31:12 UTC (rev 72133)
+++ trunk/Master/texmf-dist/tex/generic/babel/xebabel.def	2024-08-29 20:32:06 UTC (rev 72134)
@@ -32,7 +32,6 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-
 \def\BabelStringsDefault{unicode}
 \let\xebbl at stop\relax
 \AddBabelHook{xetex}{encodedcommands}{%
@@ -94,23 +93,10 @@
       \fi}%
   \fi}
 \ifx\DisableBabelHook\@undefined\endinput\fi %%%% TODO: why
+\bbl at trace{Font handling with fontspec}
 \AddBabelHook{babel-fontspec}{afterextras}{\bbl at switchfont}
 \AddBabelHook{babel-fontspec}{beforestart}{\bbl at ckeckstdfonts}
 \DisableBabelHook{babel-fontspec}
-\bbl at trace{Font handling with fontspec}
-\ifx\ExplSyntaxOn\@undefined\else
-  \def\bbl at fs@warn at nx#1#2{% \bbl at tempfs is the original macro
-    \in@{,#1,}{,no-script,language-not-exist,}%
-    \ifin@\else\bbl at tempfs@nx{#1}{#2}\fi}
-  \def\bbl at fs@warn at nxx#1#2#3{%
-    \in@{,#1,}{,no-script,language-not-exist,}%
-    \ifin@\else\bbl at tempfs@nxx{#1}{#2}{#3}\fi}
-  \def\bbl at loadfontspec{%
-    \let\bbl at loadfontspec\relax
-    \ifx\fontspec\@undefined
-      \usepackage{fontspec}%
-    \fi}%
-\fi
 \@onlypreamble\babelfont
 \newcommand\babelfont[2][]{%  1=langs/scripts 2=fam
   \bbl at foreach{#1}{%
@@ -121,8 +107,10 @@
     \fi}%
   \edef\bbl at tempa{#1}%
   \def\bbl at tempb{#2}%  Used by \bbl at bblfont
-  \bbl at loadfontspec
-  \EnableBabelHook{babel-fontspec}% Just calls \bbl at switchfont
+  \ifx\fontspec\@undefined
+    \usepackage{fontspec}%
+  \fi
+  \EnableBabelHook{babel-fontspec}%
   \bbl at bblfont}
 \newcommand\bbl at bblfont[2][]{% 1=features 2=fontname, @font=rm|sf|tt
   \bbl at ifunset{\bbl at tempb family}%
@@ -246,17 +234,10 @@
       {\\\newfontscript{\bbl at cl{sname}}{\bbl at cl{sotf}}}%
     \<keys_if_exist:nnF>{fontspec-opentype}{Language/\bbl at cl{lname}}%
       {\\\newfontlanguage{\bbl at cl{lname}}{\bbl at cl{lotf}}}%
-    \let\\\bbl at tempfs@nx\<__fontspec_warning:nx>%
-    \let\<__fontspec_warning:nx>\\\bbl at fs@warn at nx
-    \let\\\bbl at tempfs@nxx\<__fontspec_warning:nxx>%
-    \let\<__fontspec_warning:nxx>\\\bbl at fs@warn at nxx
     \\\renewfontfamily\\#4%
       [\bbl at cl{lsys},% xetex removes unknown features :-(
        \ifcase\bbl at engine\or RawFeature={family=\bbl at tempb},\fi
        #2]}{#3}% ie \bbl at exp{..}{#3}
-  \bbl at exp{%
-    \let\<__fontspec_warning:nx>\\\bbl at tempfs@nx
-    \let\<__fontspec_warning:nxx>\\\bbl at tempfs@nxx}%
   \begingroup
      #4%
      \xdef#1{\f at family}%     eg, \bbl at rmdflt@lang{FreeSerif(0)}



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