texlive[65823] Master/texmf-dist: babel (13feb23)

commits+karl at tug.org commits+karl at tug.org
Mon Feb 13 21:55:02 CET 2023


Revision: 65823
          http://tug.org/svn/texlive?view=revision&revision=65823
Author:   karl
Date:     2023-02-13 21:55:01 +0100 (Mon, 13 Feb 2023)
Log Message:
-----------
babel (13feb23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/babel/README.md
    trunk/Master/texmf-dist/doc/latex/babel/babel.pdf
    trunk/Master/texmf-dist/source/latex/babel/babel.dtx
    trunk/Master/texmf-dist/source/latex/babel/babel.ins
    trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
    trunk/Master/texmf-dist/source/latex/babel/locale.zip
    trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic-r.lua
    trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.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/hyphen.cfg
    trunk/Master/texmf-dist/tex/generic/babel/locale/fa/babel-fa.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/lt/babel-lt.ini
    trunk/Master/texmf-dist/tex/generic/babel/luababel.def
    trunk/Master/texmf-dist/tex/generic/babel/nil.ldf

Modified: trunk/Master/texmf-dist/doc/latex/babel/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/babel/README.md	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/doc/latex/babel/README.md	2023-02-13 20:55:01 UTC (rev 65823)
@@ -1,6 +1,6 @@
-## Babel 3.85
+## Babel 3.86
 
-2023-01-23
+2023-02-13
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages. Many
@@ -10,9 +10,9 @@
 
 The latest stable version is available on <https://ctan.org/pkg/babel>.
 
-Changes in version 3.85 are described in:
+Changes in version 3.86 are described in:
 
-https://latex3.github.io/babel/news/whats-new-in-babel-3.85.html
+https://latex3.github.io/babel/news/whats-new-in-babel-3.86.html
 
 Apart from the manual, you can find information on some aspects of babel at:
 
@@ -48,15 +48,14 @@
 
 ### Summary of latest changes
 ```
-3.85  2023-01-23
-      * A high-level interface to enable and disable transforms (lua).
-      * Font-dependent transforms (lua).
-      * Spaces allowed as separators in layout=.
-      * Fixes:
-        - \babelprehyphenation was not applied with 'onchar'.
-        - In some rare cases the hyphenrules weren’t correctly set.
-        - Partial fix for bidi in tabular (broken after an attempt to
-          fix amsmath).
+3.86  2023-02-13
+      * New macro \localerestoredirs (lua).
+      * Improved tabular in bidi texts (lua). See #221.
+      * Fixed \glossaryname in the 'ini' file for 'lithuanian'
+        (thanks to Andrius Pukšta, @yjhn).
+      * Added diacritics to the rules for 'kashida.plain' in 'persian'.
+      * \babeladjust{ bidi.math = off } disables changes in math with
+        bidi (lua).
 ```
 
 ### Previous changes

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	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2023-02-13 20:55:01 UTC (rev 65823)
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2022/01/23 v3.85 The Babel package]
+\ProvidesFile{babel.dtx}[2023/02/13 v3.86 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -2579,7 +2579,7 @@
   Polytonic Greek with but with some sections in Italian. Then, the
   first attempt should be:
 \begin{verbatim}
-\usepackage[italian, greek.polutonic]{babel}
+\usepackage[italian, greek.polutonico]{babel}
 \end{verbatim}
   But if, say, accents in Greek are not shown correctly, you can try
 \begin{verbatim}
@@ -3884,6 +3884,14 @@
 RTL A \foreignlanguage{english}{ltr text \thechapter{} and still ltr} RTL B
 \end{verbatim}
 
+\Describe{localerestoredirs}{}
+
+\New{3.86} \textit{LuaTeX}. This command resets the internal text,
+paragraph and body directions to those of the current locale (if
+different). Sometimes changing directly these values can be useful for
+some hacks, and this command helps in restoring the directions to the
+correct ones. It can be used in |>| arguments of \textsf{array}, too.
+
 \Describe{\BabelPatchSection}{\marg{section-name}}
 
 Mainly for bidi text, but it can be useful in other cases.
@@ -4207,12 +4215,13 @@
 \ttfamily
 bidi.mirroring\\
 bidi.text\\
+bidi.math\\%*
 % bidi.mapdigits\\
-linebreak.sea\\
-linebreak.cjk\\
-justify.arabic\\
-layout.tabular\\
-layout.lists\\
+linebreak.sea\\%*
+linebreak.cjk\\%*
+justify.arabic\\%*
+layout.tabular\\%*
+layout.lists\\%*
 autoload.bcp47\\
 bcp47.toname
 \end{multicols}
@@ -4220,12 +4229,12 @@
 Other keys [to be documented] are:
 \begin{multicols}{3}
 \ttfamily
-autoload.options\\
+autoload.options\\%*
 autoload.bcp47.prefix\\
 autoload.bcp47.options\\
-prehyphenation.disable\\
+prehyphenation.disable\\%*
 select.write\\
-select.encoding\\
+select.encoding\\%*
 \end{multicols}
 
 For example, you can set |\babeladjust{bidi.text=off}| if you are using
@@ -5286,8 +5295,8 @@
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.85>>
-%<<date=2022/01/23>>
+%<<version=3.86>>
+%<<date=2023/02/13>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -11322,6 +11331,10 @@
   \bbl at adjust@lua{bidi}{bidi_enabled=true}}
 \@namedef{bbl at ADJ@bidi.text at off}{%
   \bbl at adjust@lua{bidi}{bidi_enabled=false}}
+\@namedef{bbl at ADJ@bidi.math at on}{%
+  \let\bbl at noamsmath\@empty}
+\@namedef{bbl at ADJ@bidi.math at off}{%
+  \let\bbl at noamsmath\relax}
 \@namedef{bbl at ADJ@bidi.mapdigits at on}{%
   \bbl at adjust@lua{bidi}{digits_mapped=true}}
 \@namedef{bbl at ADJ@bidi.mapdigits at off}{%
@@ -11350,9 +11363,17 @@
       in vertical mode.}%
      {Maybe things change in the future, but this is what it is.}}}
 \@namedef{bbl at ADJ@layout.tabular at on}{%
-  \bbl at adjust@layout{\let\@tabular\bbl at NL@@tabular}}
+  \ifnum\bbl at tabular@mode=\tw@
+    \bbl at adjust@layout{\let\@tabular\bbl at NL@@tabular}%
+  \else
+    \chardef\bbl at tabular@mode\@ne
+  \fi}
 \@namedef{bbl at ADJ@layout.tabular at off}{%
-  \bbl at adjust@layout{\let\@tabular\bbl at OL@@tabular}}
+  \ifnum\bbl at tabular@mode=\tw@
+    \bbl at adjust@layout{\let\@tabular\bbl at OL@@tabular}%
+  \else
+    \chardef\bbl at tabular@mode\z@
+  \fi}
 \@namedef{bbl at ADJ@layout.lists at on}{%
   \bbl at adjust@layout{\let\list\bbl at NL@list}}
 \@namedef{bbl at ADJ@layout.lists at off}{%
@@ -12203,7 +12224,7 @@
 \def\bbl at setdirs#1{% TODO - math
   \ifcase\bbl at select@type % TODO - strictly, not the right test
     \bbl at bodydir{#1}%
-    \bbl at pardir{#1}%
+    \bbl at pardir{#1}% <- Must precede \bbl at textdir
   \fi
   \bbl at textdir{#1}}
 % TODO. Only if \bbl at bidimode > 0?:
@@ -14863,7 +14884,7 @@
 % math with the package option bidi=.
 %
 %    \begin{macrocode}
-\ifnum\bbl at bidimode>100 \ifnum\bbl at bidimode<200
+\ifnum\bbl at bidimode>\@ne % Excludes default=1
   \let\bbl at beforeforeign\leavevmode
   \AtEndOfPackage{\EnableBabelHook{babel-bidi}}
   \RequirePackage{luatexbase}
@@ -14875,13 +14896,10 @@
     \or
       require('babel-bidi-basic-r.lua')
     \fi}
-  % TODO - to locale_props, not as separate attribute
   \newattribute\bbl at attr@dir
   \directlua{ Babel.attr_dir = luatexbase.registernumber'bbl at attr@dir' }
-  % TODO. I don't like it, hackish:
   \bbl at exp{\output{\bodydir\pagedir\the\output}}
-  \AtEndOfPackage{\EnableBabelHook{babel-bidi}}
-\fi\fi
+\fi
 \chardef\bbl at thetextdir\z@
 \chardef\bbl at thepardir\z@
 \def\bbl at getluadir#1{%
@@ -14901,34 +14919,30 @@
       #2 TRT\relax
     \fi
   \fi}
+% ..00PPTT, with masks 0xC (par dir) and 0x3 (text dir)
 \def\bbl at thedir{0}
 \def\bbl at textdir#1{%
   \bbl at setluadir{text}\textdir{#1}%
   \chardef\bbl at thetextdir#1\relax
-  % par/text 0..8 = l/l l/r l/al r/l r/r r/al al/l al/r al/al
-  \edef\bbl at thedir{\the\numexpr\bbl at thepardir*3+#1}%
-  \setattribute\bbl at attr@dir{\numexpr\bbl at thepardir*3+#1}}
-\def\bbl at pardir#1{%
+  \edef\bbl at thedir{\the\numexpr\bbl at thepardir*4+#1}%
+  \setattribute\bbl at attr@dir{\numexpr\bbl at thepardir*4+#1}}
+\def\bbl at pardir#1{%  Used twice
   \bbl at setluadir{par}\pardir{#1}%
   \chardef\bbl at thepardir#1\relax}
-\def\bbl at bodydir{\bbl at setluadir{body}\bodydir}
-\def\bbl at pagedir{\bbl at setluadir{page}\pagedir}
-\def\bbl at dirparastext{\pardir\the\textdir\relax}%   %%%%
+\def\bbl at bodydir{\bbl at setluadir{body}\bodydir}%   Used once
+\def\bbl at pagedir{\bbl at setluadir{page}\pagedir}%   Unused
+\def\bbl at dirparastext{\pardir\the\textdir\relax}% Used once
+%    \end{macrocode}
 %
+% RTL text inside math needs special attention. It affects not only to
+% actual math stuff, but also to `tabular`, which is based on a fake
+% math.
+%
+%    \begin{macrocode}
 \ifnum\bbl at bidimode>\z@
   \def\bbl at insidemath{0}%
-  \def\bbl at mathboxdir{%
-    \ifcase\bbl at thetextdir\relax
-      \everyhbox{\bbl at mathboxdir@aux L}%
-    \else
-      \everyhbox{\bbl at mathboxdir@aux R}%
-     \fi}
-  \def\bbl at mathboxdir@aux#1{%
-    \@ifnextchar\egroup{}{\textdir T#1T\relax}}
-  \def\bbl at everymath{\bbl at mathboxdir}
-  \def\bbl at everydisplay{%
-    \bbl at mathboxdir
-    \def\bbl at everymath{\bbl at mathboxdir}}
+  \def\bbl at everymath{\def\bbl at insidemath{1}}
+  \def\bbl at everydisplay{\def\bbl at insidemath{2}}
   \frozen at everymath\expandafter{%
     \expandafter\bbl at everymath\the\frozen at everymath}
   \frozen at everydisplay\expandafter{%
@@ -14935,18 +14949,15 @@
     \expandafter\bbl at everydisplay\the\frozen at everydisplay}
   \AtBeginDocument{
     \directlua{
-      Babel.use_math_box_dir = true
       function Babel.math_box_dir(head)
-        if Babel.use_math_box_dir then
-          if not (token.get_macro('bbl at insidemath') == '0') then
-            if Babel.hlist_has_bidi(head) then
-              local d = node.new(node.id'dir')
-              d.dir = '+TRT'
-              node.insert_before(head, node.has_glyph(head), d)
-              for item in node.traverse(head) do
-                node.set_attribute(item,
-                  Babel.attr_dir, token.get_macro('bbl at thedir'))
-              end
+        if not (token.get_macro('bbl at insidemath') == '0') then
+          if Babel.hlist_has_bidi(head) then
+            local d = node.new(node.id'dir')
+            d.dir = '+TRT'
+            node.insert_before(head, node.has_glyph(head), d)
+            for item in node.traverse(head) do
+              node.set_attribute(item,
+                Babel.attr_dir, token.get_macro('bbl at thedir'))
             end
           end
         end
@@ -14990,10 +15001,9 @@
 \DeclareOption{fleqn}{\chardef\bbl at eqnpos\tw@}
 %<</More package options>>
 %
-\def\BabelNoAMSMath{\let\bbl at noamsmath\relax}
 \ifnum\bbl at bidimode>\z@
   \ifx\matheqdirmode\@undefined\else
-    \matheqdirmode\@ne
+    \matheqdirmode\@ne % A luatex primitive
   \fi
   \let\bbl at eqnodir\relax
   \def\bbl at eqdel{()}
@@ -15019,6 +15029,7 @@
       \eqno\hbox{#1}%
     \fi}
   \AtBeginDocument{%
+    \ifx\bbl at noamsmath\relax\else
     \ifx\maketag@@@\@undefined % Normal equation, eqnarray
       \AddToHook{env/equation/begin}{%
         \ifnum\bbl at thetextdir>\z@
@@ -15038,7 +15049,6 @@
       \fi
       \AddToHook{env/eqnarray/begin}{%
         \ifnum\bbl at thetextdir>\z@
-          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}
           \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
           \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
           \chardef\bbl at thetextdir\z@
@@ -15054,77 +15064,75 @@
       % Hack. YA luatex bug?:
       \expandafter\bbl at sreplace\csname] \endcsname{$$}{\eqno\kern.001pt$$}%
     \else % amstex
-      \ifx\bbl at noamsmath\@undefined
-        \bbl at exp{% Hack to hide maybe undefined conditionals:
-          \chardef\bbl at eqnpos=0%
-            \<iftagsleft@>1\<else>\<if at fleqn>2\<fi>\<fi>\relax}%
-        \ifnum\bbl at eqnpos=\@ne
-          \let\bbl at ams@lap\hbox
-        \else
-          \let\bbl at ams@lap\llap
-        \fi
-        \ExplSyntaxOn
-        \bbl at sreplace\intertext@{\normalbaselines}%
-          {\normalbaselines
-           \ifx\bbl at eqnodir\relax\else\bbl at pardir\@ne\bbl at eqnodir\fi}%
-        \ExplSyntaxOff
-        \def\bbl at ams@tagbox#1#2{#1{\bbl at eqnodir#2}}% #1=hbox|@lap|flip
-        \ifx\bbl at ams@lap\hbox % leqno
-          \def\bbl at ams@flip#1{%
-            \hbox to 0.01pt{\hss\hbox to\displaywidth{{#1}\hss}}}%
-        \else % eqno
-          \def\bbl at ams@flip#1{%
-            \hbox to 0.01pt{\hbox to\displaywidth{\hss{#1}}\hss}}%
-        \fi
-        \def\bbl at ams@preset#1{%
+      \bbl at exp{% Hack to hide maybe undefined conditionals:
+        \chardef\bbl at eqnpos=0%
+          \<iftagsleft@>1\<else>\<if at fleqn>2\<fi>\<fi>\relax}%
+      \ifnum\bbl at eqnpos=\@ne
+        \let\bbl at ams@lap\hbox
+      \else
+        \let\bbl at ams@lap\llap
+      \fi
+      \ExplSyntaxOn
+      \bbl at sreplace\intertext@{\normalbaselines}%
+        {\normalbaselines
+         \ifx\bbl at eqnodir\relax\else\bbl at pardir\@ne\bbl at eqnodir\fi}%
+      \ExplSyntaxOff
+      \def\bbl at ams@tagbox#1#2{#1{\bbl at eqnodir#2}}% #1=hbox|@lap|flip
+      \ifx\bbl at ams@lap\hbox % leqno
+        \def\bbl at ams@flip#1{%
+          \hbox to 0.01pt{\hss\hbox to\displaywidth{{#1}\hss}}}%
+      \else % eqno
+        \def\bbl at ams@flip#1{%
+          \hbox to 0.01pt{\hbox to\displaywidth{\hss{#1}}\hss}}%
+      \fi
+      \def\bbl at ams@preset#1{%
+        \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
+        \ifnum\bbl at thetextdir>\z@
+          \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
+          \bbl at sreplace\textdef@{\hbox}{\bbl at ams@tagbox\hbox}%
+          \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@tagbox#1}%
+        \fi}%
+      \ifnum\bbl at eqnpos=\tw@\else
+        \def\bbl at ams@equation{%
           \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
           \ifnum\bbl at thetextdir>\z@
             \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
-            \bbl at sreplace\textdef@{\hbox}{\bbl at ams@tagbox\hbox}%
-            \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@tagbox#1}%
+            \chardef\bbl at thetextdir\z@
+            \bbl at add\normalfont{\bbl at eqnodir}%
+            \ifcase\bbl at eqnpos
+              \def\veqno##1##2{\bbl at eqno@flip{##1##2}}%
+            \or
+              \def\veqno##1##2{\bbl at leqno@flip{##1##2}}%
+            \fi
           \fi}%
-        \ifnum\bbl at eqnpos=\tw@\else
-          \def\bbl at ams@equation{%
-            \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
-            \ifnum\bbl at thetextdir>\z@
-              \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
-              \chardef\bbl at thetextdir\z@
-              \bbl at add\normalfont{\bbl at eqnodir}%
-              \ifcase\bbl at eqnpos
-                \def\veqno##1##2{\bbl at eqno@flip{##1##2}}%
-              \or
-                \def\veqno##1##2{\bbl at leqno@flip{##1##2}}%
-              \fi
-            \fi}%
-          \AddToHook{env/equation/begin}{\bbl at ams@equation}%
-          \AddToHook{env/equation*/begin}{\bbl at ams@equation}%
-        \fi
-        \AddToHook{env/cases/begin}{\bbl at ams@preset\bbl at ams@lap}%
-        \AddToHook{env/multline/begin}{\bbl at ams@preset\hbox}%
-        \AddToHook{env/gather/begin}{\bbl at ams@preset\bbl at ams@lap}%
-        \AddToHook{env/gather*/begin}{\bbl at ams@preset\bbl at ams@lap}%
-        \AddToHook{env/align/begin}{\bbl at ams@preset\bbl at ams@lap}%
-        \AddToHook{env/align*/begin}{\bbl at ams@preset\bbl at ams@lap}%
-        \AddToHook{env/eqnalign/begin}{\bbl at ams@preset\hbox}%
-        % Hackish, for proper alignment. Don’t ask me why it works!:
-        \bbl at exp{% Avoid a 'visible' conditional
-          \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
-        \AddToHook{env/flalign/begin}{\bbl at ams@preset\hbox}%
-        \AddToHook{env/split/before}{%
-          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
-          \ifnum\bbl at thetextdir>\z@
-            \bbl at ifsamestring\@currenvir{equation}%
-              {\ifx\bbl at ams@lap\hbox % leqno
-                 \def\bbl at ams@flip#1{%
-                   \hbox to 0.01pt{\hbox to\displaywidth{{#1}\hss}\hss}}%
-               \else
-                 \def\bbl at ams@flip#1{%
-                   \hbox to 0.01pt{\hss\hbox to\displaywidth{\hss{#1}}}}%
-               \fi}%
-             {}%
-          \fi}%
+        \AddToHook{env/equation/begin}{\bbl at ams@equation}%
+        \AddToHook{env/equation*/begin}{\bbl at ams@equation}%
       \fi
-    \fi}
+      \AddToHook{env/cases/begin}{\bbl at ams@preset\bbl at ams@lap}%
+      \AddToHook{env/multline/begin}{\bbl at ams@preset\hbox}%
+      \AddToHook{env/gather/begin}{\bbl at ams@preset\bbl at ams@lap}%
+      \AddToHook{env/gather*/begin}{\bbl at ams@preset\bbl at ams@lap}%
+      \AddToHook{env/align/begin}{\bbl at ams@preset\bbl at ams@lap}%
+      \AddToHook{env/align*/begin}{\bbl at ams@preset\bbl at ams@lap}%
+      \AddToHook{env/eqnalign/begin}{\bbl at ams@preset\hbox}%
+      % Hackish, for proper alignment. Don’t ask me why it works!:
+      \bbl at exp{% Avoid a 'visible' conditional
+        \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
+      \AddToHook{env/flalign/begin}{\bbl at ams@preset\hbox}%
+      \AddToHook{env/split/before}{%
+        \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
+        \ifnum\bbl at thetextdir>\z@
+          \bbl at ifsamestring\@currenvir{equation}%
+            {\ifx\bbl at ams@lap\hbox % leqno
+               \def\bbl at ams@flip#1{%
+                 \hbox to 0.01pt{\hbox to\displaywidth{{#1}\hss}\hss}}%
+             \else
+               \def\bbl at ams@flip#1{%
+                 \hbox to 0.01pt{\hss\hbox to\displaywidth{\hss{#1}}}}%
+             \fi}%
+           {}%
+        \fi}%
+    \fi\fi}
 \fi
 \def\bbl at provide@extra#1{%
   % == Counters: mapdigits ==
@@ -15174,8 +15182,63 @@
     \csname bbl at inidata@\languagename\endcsname
     \bbl at release@transforms\relax % \relax closes the last item.
   \fi}
+% Start tabular here:
+\def\localerestoredirs{%
+  \ifcase\bbl at thetextdir
+    \ifnum\textdirection=\z@\else\textdir TLT\fi
+  \else
+    \ifnum\textdirection=\@ne\else\textdir TRT\fi
+  \fi
+  \ifcase\bbl at thepardir
+    \ifnum\pardirection=\z@\else\pardir TLT\bodydir TLT\fi
+  \else
+    \ifnum\pardirection=\@ne\else\pardir TRT\bodydir TRT\fi
+  \fi}
+\IfBabelLayout{tabular}%
+  {\chardef\bbl at tabular@mode\tw@}% All RTL
+  {\IfBabelLayout{notabular}%
+    {\chardef\bbl at tabular@mode\z@}%
+    {\chardef\bbl at tabular@mode\@ne}}% Mixed, with LTR cols
+\ifnum\bbl at bidimode>\@ne
+  \ifnum\bbl at tabular@mode=\@ne
+    \let\bbl at parabefore\relax
+    \AddToHook{para/before}{\bbl at parabefore}
+    \AtBeginDocument{%
+      \bbl at replace\@tabular{$}{$%
+        \def\bbl at insidemath{0}%
+        \def\bbl at parabefore{\localerestoredirs}}%
+      \ifnum\bbl at tabular@mode=\@ne
+        \bbl at ifunset{@tabclassz}{}{%
+          \bbl at exp{% Hide conditionals
+            \\\bbl at sreplace\\\@tabclassz
+              {\<ifcase>\\\@chnum}%
+              {\\\localerestoredirs\<ifcase>\\\@chnum}}}%
+        \@ifpackageloaded{colortbl}%
+          {\bbl at sreplace\@classz
+            {\hbox\bgroup\bgroup}{\hbox\bgroup\bgroup\localerestoredirs}}%
+          {\@ifpackageloaded{array}%
+             {\bbl at exp{% Hide conditionals
+                \\\bbl at sreplace\\\@classz
+                  {\<ifcase>\\\@chnum}%
+                  {\bgroup\\\localerestoredirs\<ifcase>\\\@chnum}%
+                \\\bbl at sreplace\\\@classz
+                  {\\\do at row@strut\<fi>}{\\\do at row@strut\<fi>\egroup}}}%
+             {}}%
+    \fi}
+  \fi
+\fi
 \ifx\bbl at opt@layout\@nnil\endinput\fi  % if no layout
+%    \end{macrocode}
 %
+% \textsc{Omega} provided a companion to |\mathdir| (|\nextfakemath|)
+% for those cases where we did not want it to be applied, so that the
+% writing direction of the main text was left unchanged.
+% |\bbl at nextfake| is an attempt to emulate it, because \luatex{} has
+% 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@
   \def\bbl at nextfake#1{%  non-local changes, use always inside a group!
     \bbl at exp{%
@@ -22113,7 +22176,7 @@
         attr_dir = 0
         for at in node.traverse(item.attr) do
           if at.number == Babel.attr_dir then
-            attr_dir = at.value % 3
+            attr_dir = at.value & 0x3
           end
         end
         if attr_dir == 1 then
@@ -22373,7 +22436,7 @@
   local save_outer
   local temp = node.get_attribute(head, ATDIR)
   if temp then
-    temp = temp % 3
+    temp = temp & 0x3
     save_outer = (temp == 0 and 'l') or
                  (temp == 1 and 'r') or
                  (temp == 2 and 'al')
@@ -22443,7 +22506,7 @@
           attr_d = 0
         else
           attr_d = node.get_attribute(item, ATDIR)
-          attr_d = attr_d % 3
+          attr_d = attr_d & 0x3
         end
         if attr_d == 1 then
           outer_first = 'r'
@@ -22471,7 +22534,7 @@
 
     elseif item.id == DIR then
       d = nil
-      -- new_d = true
+
       if head ~= item then new_d = true end
 
     elseif item.id == node.id'glue' and item.subtype == 13 then

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.ins	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.ins	2023-02-13 20:55:01 UTC (rev 65823)
@@ -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{2022/01/23}
+\def\filedate{2023/02/13}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 

Modified: trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2023-02-13 20:55:01 UTC (rev 65823)
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2022/01/23 v3.85]
+\ProvidesFile{bbcompat.dtx}[2023/02/13 v3.86]
 %</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	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic-r.lua	2023-02-13 20:55:01 UTC (rev 65823)
@@ -101,7 +101,7 @@
         attr_dir = 0
         for at in node.traverse(item.attr) do
           if at.number == Babel.attr_dir then
-            attr_dir = at.value % 3
+            attr_dir = at.value & 0x3
           end
         end
         if attr_dir == 1 then

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua	2023-02-13 20:55:01 UTC (rev 65823)
@@ -113,7 +113,7 @@
   local save_outer
   local temp = node.get_attribute(head, ATDIR)
   if temp then
-    temp = temp % 3
+    temp = temp & 0x3
     save_outer = (temp == 0 and 'l') or
                  (temp == 1 and 'r') or
                  (temp == 2 and 'al')
@@ -183,7 +183,7 @@
           attr_d = 0
         else
           attr_d = node.get_attribute(item, ATDIR)
-          attr_d = attr_d % 3
+          attr_d = attr_d & 0x3
         end
         if attr_d == 1 then
           outer_first = 'r'
@@ -211,7 +211,7 @@
 
     elseif item.id == DIR then
       d = nil
-      -- new_d = true
+
       if head ~= item then new_d = true end
 
     elseif item.id == node.id'glue' and item.subtype == 13 then

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.def	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.def	2023-02-13 20:55:01 UTC (rev 65823)
@@ -40,7 +40,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{babel.def}[2022/01/23 3.85 Babel common definitions]
+\ProvidesFile{babel.def}[2023/02/13 3.86 Babel common definitions]
 \ifx\AtBeginDocument\@undefined  % TODO. change test.
   \def\@empty{}
 \def\loadlocalcfg#1{%
@@ -406,8 +406,8 @@
 \expandafter\newif\csname ifbbl at single\endcsname
 \chardef\bbl at bidimode\z@
 \fi
-\def\bbl at version{3.85}
-\def\bbl at date{2022/01/23}
+\def\bbl at version{3.86}
+\def\bbl at date{2023/02/13}
 \ifx\language\@undefined
   \csname newcount\endcsname\language
 \fi
@@ -3668,6 +3668,10 @@
   \bbl at adjust@lua{bidi}{bidi_enabled=true}}
 \@namedef{bbl at ADJ@bidi.text at off}{%
   \bbl at adjust@lua{bidi}{bidi_enabled=false}}
+\@namedef{bbl at ADJ@bidi.math at on}{%
+  \let\bbl at noamsmath\@empty}
+\@namedef{bbl at ADJ@bidi.math at off}{%
+  \let\bbl at noamsmath\relax}
 \@namedef{bbl at ADJ@bidi.mapdigits at on}{%
   \bbl at adjust@lua{bidi}{digits_mapped=true}}
 \@namedef{bbl at ADJ@bidi.mapdigits at off}{%
@@ -3694,9 +3698,17 @@
       in vertical mode.}%
      {Maybe things change in the future, but this is what it is.}}}
 \@namedef{bbl at ADJ@layout.tabular at on}{%
-  \bbl at adjust@layout{\let\@tabular\bbl at NL@@tabular}}
+  \ifnum\bbl at tabular@mode=\tw@
+    \bbl at adjust@layout{\let\@tabular\bbl at NL@@tabular}%
+  \else
+    \chardef\bbl at tabular@mode\@ne
+  \fi}
 \@namedef{bbl at ADJ@layout.tabular at off}{%
-  \bbl at adjust@layout{\let\@tabular\bbl at OL@@tabular}}
+  \ifnum\bbl at tabular@mode=\tw@
+    \bbl at adjust@layout{\let\@tabular\bbl at OL@@tabular}%
+  \else
+    \chardef\bbl at tabular@mode\z@
+  \fi}
 \@namedef{bbl at ADJ@layout.lists at on}{%
   \bbl at adjust@layout{\let\list\bbl at NL@list}}
 \@namedef{bbl at ADJ@layout.lists at off}{%

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2023-02-13 20:55:01 UTC (rev 65823)
@@ -34,7 +34,7 @@
 %%
 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
-\ProvidesPackage{babel}[2022/01/23 3.85 The Babel package]
+\ProvidesPackage{babel}[2023/02/13 3.86 The Babel package]
 \@ifpackagewith{babel}{debug}
   {\providecommand\bbl at trace[1]{\message{^^J[ #1 ]}}%
    \let\bbl at debug\@firstofone
@@ -463,8 +463,8 @@
       \expandafter\@secondoftwo
     \fi}
 \fi
-\def\bbl at version{3.85}
-\def\bbl at date{2022/01/23}
+\def\bbl at version{3.86}
+\def\bbl at date{2023/02/13}
 \ifx\language\@undefined
   \csname newcount\endcsname\language
 \fi
@@ -3725,6 +3725,10 @@
   \bbl at adjust@lua{bidi}{bidi_enabled=true}}
 \@namedef{bbl at ADJ@bidi.text at off}{%
   \bbl at adjust@lua{bidi}{bidi_enabled=false}}
+\@namedef{bbl at ADJ@bidi.math at on}{%
+  \let\bbl at noamsmath\@empty}
+\@namedef{bbl at ADJ@bidi.math at off}{%
+  \let\bbl at noamsmath\relax}
 \@namedef{bbl at ADJ@bidi.mapdigits at on}{%
   \bbl at adjust@lua{bidi}{digits_mapped=true}}
 \@namedef{bbl at ADJ@bidi.mapdigits at off}{%
@@ -3751,9 +3755,17 @@
       in vertical mode.}%
      {Maybe things change in the future, but this is what it is.}}}
 \@namedef{bbl at ADJ@layout.tabular at on}{%
-  \bbl at adjust@layout{\let\@tabular\bbl at NL@@tabular}}
+  \ifnum\bbl at tabular@mode=\tw@
+    \bbl at adjust@layout{\let\@tabular\bbl at NL@@tabular}%
+  \else
+    \chardef\bbl at tabular@mode\@ne
+  \fi}
 \@namedef{bbl at ADJ@layout.tabular at off}{%
-  \bbl at adjust@layout{\let\@tabular\bbl at OL@@tabular}}
+  \ifnum\bbl at tabular@mode=\tw@
+    \bbl at adjust@layout{\let\@tabular\bbl at OL@@tabular}%
+  \else
+    \chardef\bbl at tabular@mode\z@
+  \fi}
 \@namedef{bbl at ADJ@layout.lists at on}{%
   \bbl at adjust@layout{\let\list\bbl at NL@list}}
 \@namedef{bbl at ADJ@layout.lists at off}{%
@@ -4157,7 +4169,7 @@
 \def\bbl at setdirs#1{% TODO - math
   \ifcase\bbl at select@type % TODO - strictly, not the right test
     \bbl at bodydir{#1}%
-    \bbl at pardir{#1}%
+    \bbl at pardir{#1}% <- Must precede \bbl at textdir
   \fi
   \bbl at textdir{#1}}
 \AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}

Modified: trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2023-02-13 20:55:01 UTC (rev 65823)
@@ -38,10 +38,10 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{hyphen.cfg}[2022/01/23 3.85 Babel hyphens]
+\ProvidesFile{hyphen.cfg}[2023/02/13 3.86 Babel hyphens]
 \xdef\bbl at format{\jobname}
-\def\bbl at version{3.85}
-\def\bbl at date{2022/01/23}
+\def\bbl at version{3.86}
+\def\bbl at date{2023/02/13}
 \ifx\AtBeginDocument\@undefined
   \def\@empty{}
 \fi

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/fa/babel-fa.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/fa/babel-fa.ini	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/fa/babel-fa.ini	2023-02-13 20:55:01 UTC (rev 65823)
@@ -9,8 +9,8 @@
 
 [identification]
 charset = utf8
-version = 1.11
-date = 2022-12-08
+version = 1.12
+date = 2023-01-27
 name.local = فارسی
 name.english = Persian
 name.babel = persian
@@ -194,8 +194,9 @@
 alphabetic = ا ب پ ت ث ج چ ح خ د ذ ر ز ژ س ش ص ض ط ظ ع غ ف ق ک گ ل م ن و ه‍ ی
 
 [transforms.prehyphenation]
-kashida.plain.1.0 = { ()[يئهشسقفغعضصنمكلظطخحچجثتپب]()[يئهشسقفغعضصنمكلظطخحچجثتپباأإآوؤذدژزرة] }
+kashida.plain.1.0 = { ()[يئهشسقفغعضصنمكلظطخحچجثتپب]()[ًٍَُِّ]*[يئهشسقفغعضصنمكلظطخحچجثتپباأإآوؤذدژزرة] }
 kashida.plain.1.1 =   { kashida = 500 }
-kashida.plain.2.0 = { ()ل()[اأإآ] }
+kashida.plain.2.0 = { ()ل()[ًٍَُِّ]*[اأإآ] }
 kashida.plain.2.1 =   { kashida = 0 }
 
+

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/lt/babel-lt.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/lt/babel-lt.ini	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/lt/babel-lt.ini	2023-02-13 20:55:01 UTC (rev 65823)
@@ -6,11 +6,12 @@
 ; * Common Locale Data Repository (license Unicode):
 ;   http://cldr.unicode.org/
 ;   http://unicode.org/copyright.html
+; Contributions by Andrius Pukšta @yjhn.
 
 [identification]
 charset = utf8
-version = 1.6
-date = 2022-12-08
+version = 1.7
+date = 2023-01-29
 name.local = lietuvių
 name.english = Lithuanian
 name.babel = lithuanian
@@ -52,7 +53,7 @@
 see = žiūrėk
 also = taip pat
 proof = Įrodymas
-glossary = Glosarijus
+glossary = Terminų žodynas
 
 [captions.licr]
 preface = Pratarm\.e
@@ -80,7 +81,7 @@
 see = \v zi\=ur\.ek
 also = taip pat
 proof = \k Irodymas
-glossary = Glosarijus
+glossary = Termin\k u \v zodynas
 
 [date.gregorian]
 date.long = [y] m[.] [MMMM] [d] d[.]

Modified: trunk/Master/texmf-dist/tex/generic/babel/luababel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2023-02-13 20:55:01 UTC (rev 65823)
@@ -1367,7 +1367,7 @@
       luatexbase.priority_in_callback('hpack_filter',
         'luaotfload.node_processor') or nil)
   }}
-\ifnum\bbl at bidimode>100 \ifnum\bbl at bidimode<200
+\ifnum\bbl at bidimode>\@ne % Excludes default=1
   \let\bbl at beforeforeign\leavevmode
   \AtEndOfPackage{\EnableBabelHook{babel-bidi}}
   \RequirePackage{luatexbase}
@@ -1379,13 +1379,10 @@
     \or
       require('babel-bidi-basic-r.lua')
     \fi}
-  % TODO - to locale_props, not as separate attribute
   \newattribute\bbl at attr@dir
   \directlua{ Babel.attr_dir = luatexbase.registernumber'bbl at attr@dir' }
-  % TODO. I don't like it, hackish:
   \bbl at exp{\output{\bodydir\pagedir\the\output}}
-  \AtEndOfPackage{\EnableBabelHook{babel-bidi}}
-\fi\fi
+\fi
 \chardef\bbl at thetextdir\z@
 \chardef\bbl at thepardir\z@
 \def\bbl at getluadir#1{%
@@ -1409,29 +1406,18 @@
 \def\bbl at textdir#1{%
   \bbl at setluadir{text}\textdir{#1}%
   \chardef\bbl at thetextdir#1\relax
-  % par/text 0..8 = l/l l/r l/al r/l r/r r/al al/l al/r al/al
-  \edef\bbl at thedir{\the\numexpr\bbl at thepardir*3+#1}%
-  \setattribute\bbl at attr@dir{\numexpr\bbl at thepardir*3+#1}}
-\def\bbl at pardir#1{%
+  \edef\bbl at thedir{\the\numexpr\bbl at thepardir*4+#1}%
+  \setattribute\bbl at attr@dir{\numexpr\bbl at thepardir*4+#1}}
+\def\bbl at pardir#1{%  Used twice
   \bbl at setluadir{par}\pardir{#1}%
   \chardef\bbl at thepardir#1\relax}
-\def\bbl at bodydir{\bbl at setluadir{body}\bodydir}
-\def\bbl at pagedir{\bbl at setluadir{page}\pagedir}
-\def\bbl at dirparastext{\pardir\the\textdir\relax}%   %%%%
+\def\bbl at bodydir{\bbl at setluadir{body}\bodydir}%   Used once
+\def\bbl at pagedir{\bbl at setluadir{page}\pagedir}%   Unused
+\def\bbl at dirparastext{\pardir\the\textdir\relax}% Used once
 \ifnum\bbl at bidimode>\z@
   \def\bbl at insidemath{0}%
-  \def\bbl at mathboxdir{%
-    \ifcase\bbl at thetextdir\relax
-      \everyhbox{\bbl at mathboxdir@aux L}%
-    \else
-      \everyhbox{\bbl at mathboxdir@aux R}%
-     \fi}
-  \def\bbl at mathboxdir@aux#1{%
-    \@ifnextchar\egroup{}{\textdir T#1T\relax}}
-  \def\bbl at everymath{\bbl at mathboxdir}
-  \def\bbl at everydisplay{%
-    \bbl at mathboxdir
-    \def\bbl at everymath{\bbl at mathboxdir}}
+  \def\bbl at everymath{\def\bbl at insidemath{1}}
+  \def\bbl at everydisplay{\def\bbl at insidemath{2}}
   \frozen at everymath\expandafter{%
     \expandafter\bbl at everymath\the\frozen at everymath}
   \frozen at everydisplay\expandafter{%
@@ -1438,18 +1424,15 @@
     \expandafter\bbl at everydisplay\the\frozen at everydisplay}
   \AtBeginDocument{
     \directlua{
-      Babel.use_math_box_dir = true
       function Babel.math_box_dir(head)
-        if Babel.use_math_box_dir then
-          if not (token.get_macro('bbl at insidemath') == '0') then
-            if Babel.hlist_has_bidi(head) then
-              local d = node.new(node.id'dir')
-              d.dir = '+TRT'
-              node.insert_before(head, node.has_glyph(head), d)
-              for item in node.traverse(head) do
-                node.set_attribute(item,
-                  Babel.attr_dir, token.get_macro('bbl at thedir'))
-              end
+        if not (token.get_macro('bbl at insidemath') == '0') then
+          if Babel.hlist_has_bidi(head) then
+            local d = node.new(node.id'dir')
+            d.dir = '+TRT'
+            node.insert_before(head, node.has_glyph(head), d)
+            for item in node.traverse(head) do
+              node.set_attribute(item,
+                Babel.attr_dir, token.get_macro('bbl at thedir'))
             end
           end
         end
@@ -1460,10 +1443,9 @@
   }}%
 \fi
 \bbl at trace{Redefinitions for bidi layout}
-\def\BabelNoAMSMath{\let\bbl at noamsmath\relax}
 \ifnum\bbl at bidimode>\z@
   \ifx\matheqdirmode\@undefined\else
-    \matheqdirmode\@ne
+    \matheqdirmode\@ne % A luatex primitive
   \fi
   \let\bbl at eqnodir\relax
   \def\bbl at eqdel{()}
@@ -1489,6 +1471,7 @@
       \eqno\hbox{#1}%
     \fi}
   \AtBeginDocument{%
+    \ifx\bbl at noamsmath\relax\else
     \ifx\maketag@@@\@undefined % Normal equation, eqnarray
       \AddToHook{env/equation/begin}{%
         \ifnum\bbl at thetextdir>\z@
@@ -1508,7 +1491,6 @@
       \fi
       \AddToHook{env/eqnarray/begin}{%
         \ifnum\bbl at thetextdir>\z@
-          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}
           \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
           \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
           \chardef\bbl at thetextdir\z@
@@ -1524,77 +1506,75 @@
       % Hack. YA luatex bug?:
       \expandafter\bbl at sreplace\csname] \endcsname{$$}{\eqno\kern.001pt$$}%
     \else % amstex
-      \ifx\bbl at noamsmath\@undefined
-        \bbl at exp{% Hack to hide maybe undefined conditionals:
-          \chardef\bbl at eqnpos=0%
-            \<iftagsleft@>1\<else>\<if at fleqn>2\<fi>\<fi>\relax}%
-        \ifnum\bbl at eqnpos=\@ne
-          \let\bbl at ams@lap\hbox
-        \else
-          \let\bbl at ams@lap\llap
-        \fi
-        \ExplSyntaxOn
-        \bbl at sreplace\intertext@{\normalbaselines}%
-          {\normalbaselines
-           \ifx\bbl at eqnodir\relax\else\bbl at pardir\@ne\bbl at eqnodir\fi}%
-        \ExplSyntaxOff
-        \def\bbl at ams@tagbox#1#2{#1{\bbl at eqnodir#2}}% #1=hbox|@lap|flip
-        \ifx\bbl at ams@lap\hbox % leqno
-          \def\bbl at ams@flip#1{%
-            \hbox to 0.01pt{\hss\hbox to\displaywidth{{#1}\hss}}}%
-        \else % eqno
-          \def\bbl at ams@flip#1{%
-            \hbox to 0.01pt{\hbox to\displaywidth{\hss{#1}}\hss}}%
-        \fi
-        \def\bbl at ams@preset#1{%
+      \bbl at exp{% Hack to hide maybe undefined conditionals:
+        \chardef\bbl at eqnpos=0%
+          \<iftagsleft@>1\<else>\<if at fleqn>2\<fi>\<fi>\relax}%
+      \ifnum\bbl at eqnpos=\@ne
+        \let\bbl at ams@lap\hbox
+      \else
+        \let\bbl at ams@lap\llap
+      \fi
+      \ExplSyntaxOn
+      \bbl at sreplace\intertext@{\normalbaselines}%
+        {\normalbaselines
+         \ifx\bbl at eqnodir\relax\else\bbl at pardir\@ne\bbl at eqnodir\fi}%
+      \ExplSyntaxOff
+      \def\bbl at ams@tagbox#1#2{#1{\bbl at eqnodir#2}}% #1=hbox|@lap|flip
+      \ifx\bbl at ams@lap\hbox % leqno
+        \def\bbl at ams@flip#1{%
+          \hbox to 0.01pt{\hss\hbox to\displaywidth{{#1}\hss}}}%
+      \else % eqno
+        \def\bbl at ams@flip#1{%
+          \hbox to 0.01pt{\hbox to\displaywidth{\hss{#1}}\hss}}%
+      \fi
+      \def\bbl at ams@preset#1{%
+        \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
+        \ifnum\bbl at thetextdir>\z@
+          \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
+          \bbl at sreplace\textdef@{\hbox}{\bbl at ams@tagbox\hbox}%
+          \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@tagbox#1}%
+        \fi}%
+      \ifnum\bbl at eqnpos=\tw@\else
+        \def\bbl at ams@equation{%
           \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
           \ifnum\bbl at thetextdir>\z@
             \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
-            \bbl at sreplace\textdef@{\hbox}{\bbl at ams@tagbox\hbox}%
-            \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@tagbox#1}%
+            \chardef\bbl at thetextdir\z@
+            \bbl at add\normalfont{\bbl at eqnodir}%
+            \ifcase\bbl at eqnpos
+              \def\veqno##1##2{\bbl at eqno@flip{##1##2}}%
+            \or
+              \def\veqno##1##2{\bbl at leqno@flip{##1##2}}%
+            \fi
           \fi}%
-        \ifnum\bbl at eqnpos=\tw@\else
-          \def\bbl at ams@equation{%
-            \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
-            \ifnum\bbl at thetextdir>\z@
-              \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
-              \chardef\bbl at thetextdir\z@
-              \bbl at add\normalfont{\bbl at eqnodir}%
-              \ifcase\bbl at eqnpos
-                \def\veqno##1##2{\bbl at eqno@flip{##1##2}}%
-              \or
-                \def\veqno##1##2{\bbl at leqno@flip{##1##2}}%
-              \fi
-            \fi}%
-          \AddToHook{env/equation/begin}{\bbl at ams@equation}%
-          \AddToHook{env/equation*/begin}{\bbl at ams@equation}%
-        \fi
-        \AddToHook{env/cases/begin}{\bbl at ams@preset\bbl at ams@lap}%
-        \AddToHook{env/multline/begin}{\bbl at ams@preset\hbox}%
-        \AddToHook{env/gather/begin}{\bbl at ams@preset\bbl at ams@lap}%
-        \AddToHook{env/gather*/begin}{\bbl at ams@preset\bbl at ams@lap}%
-        \AddToHook{env/align/begin}{\bbl at ams@preset\bbl at ams@lap}%
-        \AddToHook{env/align*/begin}{\bbl at ams@preset\bbl at ams@lap}%
-        \AddToHook{env/eqnalign/begin}{\bbl at ams@preset\hbox}%
-        % Hackish, for proper alignment. Don’t ask me why it works!:
-        \bbl at exp{% Avoid a 'visible' conditional
-          \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
-        \AddToHook{env/flalign/begin}{\bbl at ams@preset\hbox}%
-        \AddToHook{env/split/before}{%
-          \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
-          \ifnum\bbl at thetextdir>\z@
-            \bbl at ifsamestring\@currenvir{equation}%
-              {\ifx\bbl at ams@lap\hbox % leqno
-                 \def\bbl at ams@flip#1{%
-                   \hbox to 0.01pt{\hbox to\displaywidth{{#1}\hss}\hss}}%
-               \else
-                 \def\bbl at ams@flip#1{%
-                   \hbox to 0.01pt{\hss\hbox to\displaywidth{\hss{#1}}}}%
-               \fi}%
-             {}%
-          \fi}%
+        \AddToHook{env/equation/begin}{\bbl at ams@equation}%
+        \AddToHook{env/equation*/begin}{\bbl at ams@equation}%
       \fi
-    \fi}
+      \AddToHook{env/cases/begin}{\bbl at ams@preset\bbl at ams@lap}%
+      \AddToHook{env/multline/begin}{\bbl at ams@preset\hbox}%
+      \AddToHook{env/gather/begin}{\bbl at ams@preset\bbl at ams@lap}%
+      \AddToHook{env/gather*/begin}{\bbl at ams@preset\bbl at ams@lap}%
+      \AddToHook{env/align/begin}{\bbl at ams@preset\bbl at ams@lap}%
+      \AddToHook{env/align*/begin}{\bbl at ams@preset\bbl at ams@lap}%
+      \AddToHook{env/eqnalign/begin}{\bbl at ams@preset\hbox}%
+      % Hackish, for proper alignment. Don’t ask me why it works!:
+      \bbl at exp{% Avoid a 'visible' conditional
+        \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
+      \AddToHook{env/flalign/begin}{\bbl at ams@preset\hbox}%
+      \AddToHook{env/split/before}{%
+        \def\bbl at mathboxdir{\def\bbl at insidemath{1}}%
+        \ifnum\bbl at thetextdir>\z@
+          \bbl at ifsamestring\@currenvir{equation}%
+            {\ifx\bbl at ams@lap\hbox % leqno
+               \def\bbl at ams@flip#1{%
+                 \hbox to 0.01pt{\hbox to\displaywidth{{#1}\hss}\hss}}%
+             \else
+               \def\bbl at ams@flip#1{%
+                 \hbox to 0.01pt{\hss\hbox to\displaywidth{\hss{#1}}}}%
+             \fi}%
+           {}%
+        \fi}%
+    \fi\fi}
 \fi
 \def\bbl at provide@extra#1{%
   % == Counters: mapdigits ==
@@ -1644,6 +1624,50 @@
     \csname bbl at inidata@\languagename\endcsname
     \bbl at release@transforms\relax % \relax closes the last item.
   \fi}
+\def\localerestoredirs{%
+  \ifcase\bbl at thetextdir
+    \ifnum\textdirection=\z@\else\textdir TLT\fi
+  \else
+    \ifnum\textdirection=\@ne\else\textdir TRT\fi
+  \fi
+  \ifcase\bbl at thepardir
+    \ifnum\pardirection=\z@\else\pardir TLT\bodydir TLT\fi
+  \else
+    \ifnum\pardirection=\@ne\else\pardir TRT\bodydir TRT\fi
+  \fi}
+\IfBabelLayout{tabular}%
+  {\chardef\bbl at tabular@mode\tw@}% All RTL
+  {\IfBabelLayout{notabular}%
+    {\chardef\bbl at tabular@mode\z@}%
+    {\chardef\bbl at tabular@mode\@ne}}% Mixed, with LTR cols
+\ifnum\bbl at bidimode>\@ne
+  \ifnum\bbl at tabular@mode=\@ne
+    \let\bbl at parabefore\relax
+    \AddToHook{para/before}{\bbl at parabefore}
+    \AtBeginDocument{%
+      \bbl at replace\@tabular{$}{$%
+        \def\bbl at insidemath{0}%
+        \def\bbl at parabefore{\localerestoredirs}}%
+      \ifnum\bbl at tabular@mode=\@ne
+        \bbl at ifunset{@tabclassz}{}{%
+          \bbl at exp{% Hide conditionals
+            \\\bbl at sreplace\\\@tabclassz
+              {\<ifcase>\\\@chnum}%
+              {\\\localerestoredirs\<ifcase>\\\@chnum}}}%
+        \@ifpackageloaded{colortbl}%
+          {\bbl at sreplace\@classz
+            {\hbox\bgroup\bgroup}{\hbox\bgroup\bgroup\localerestoredirs}}%
+          {\@ifpackageloaded{array}%
+             {\bbl at exp{% Hide conditionals
+                \\\bbl at sreplace\\\@classz
+                  {\<ifcase>\\\@chnum}%
+                  {\bgroup\\\localerestoredirs\<ifcase>\\\@chnum}%
+                \\\bbl at sreplace\\\@classz
+                  {\\\do at row@strut\<fi>}{\\\do at row@strut\<fi>\egroup}}}%
+             {}}%
+    \fi}
+  \fi
+\fi
 \ifx\bbl at opt@layout\@nnil\endinput\fi  % if no layout
 \ifnum\bbl at bidimode>\z@
   \def\bbl at nextfake#1{%  non-local changes, use always inside a group!

Modified: trunk/Master/texmf-dist/tex/generic/babel/nil.ldf
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2023-02-13 20:53:51 UTC (rev 65822)
+++ trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2023-02-13 20:55:01 UTC (rev 65823)
@@ -33,7 +33,7 @@
 %% extension |.ins|) which are part of the distribution.
 %%
 
-\ProvidesLanguage{nil}[2022/01/23 3.85 Nil language]
+\ProvidesLanguage{nil}[2023/02/13 3.86 Nil language]
 \LdfInit{nil}{datenil}
 \ifx\l at nil\@undefined
   \newlanguage\l at nil



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