[latex3-commits] [git/LaTeX3-latex3-babel] main: New 'adjust' bidi.math (on|off). Fixes in tabular. (39bc046)

Javier email at dante.de
Wed Feb 8 18:59:07 CET 2023


Repository : https://github.com/latex3/babel
On branch  : main
Link       : https://github.com/latex3/babel/commit/39bc046212a832aeab08ea14b715af4f8122081a

>---------------------------------------------------------------

commit 39bc046212a832aeab08ea14b715af4f8122081a
Author: Javier <email at localhost>
Date:   Wed Feb 8 18:59:07 2023 +0100

    New 'adjust' bidi.math (on|off). Fixes in tabular.


>---------------------------------------------------------------

39bc046212a832aeab08ea14b715af4f8122081a
 README.md    |   2 +-
 babel.dtx    | 179 ++++++++++++++++++++++++++++++-----------------------------
 babel.pdf    | Bin 919789 -> 920032 bytes
 bbcompat.dtx |   2 +-
 4 files changed, 92 insertions(+), 91 deletions(-)

diff --git a/README.md b/README.md
index 3f67941..fd40775 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.85.03970
+## Babel 3.85.03975
 
 (Draft)
 
diff --git a/babel.dtx b/babel.dtx
index 59727c4..8132352 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2023/02/08 v3.85.03970 The Babel package]
+\ProvidesFile{babel.dtx}[2023/02/08 v3.85.03975 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -4207,6 +4207,7 @@ with values |on| or |off|:
 \ttfamily
 bidi.mirroring\\
 bidi.text\\
+bidi.math\\
 % bidi.mapdigits\\
 linebreak.sea\\
 linebreak.cjk\\
@@ -5286,7 +5287,7 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.85.03970>>
+%<<version=3.85.03975>>
 %<<date=2023/02/08>>
 %    \end{macrocode}
 %
@@ -6100,6 +6101,7 @@ help from Bernd Raichle, for which I am grateful.
 \endinput\fi % Same line!
 <@Make sure ProvidesFile is defined@>
 \ProvidesFile{babel.def}[<@date@> <@version@> Babel common definitions]
+\let\bbl at isplain\relax
 \ifx\AtBeginDocument\@undefined  % TODO. change test.
   <@Emulate LaTeX@>
 \fi
@@ -11322,6 +11324,10 @@ help from Bernd Raichle, for which I am grateful.
   \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}{%
@@ -14931,18 +14937,12 @@ end
       function Babel.math_box_dir(head)
         if not (token.get_macro('bbl at insidemath') == '0') then
           if Babel.hlist_has_bidi(head) then
-            if (node.get_attribute(head, Babel.attr_dir)&0x3) == 0 then 
-              local d = node.new(node.id'dir')
-              d.dir = '+TLT'
-              node.insert_before(head, node.has_glyph(head), d)
-            else
-              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
+            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
@@ -14986,10 +14986,9 @@ end
 \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 lua tex primitive
   \fi
   \let\bbl at eqnodir\relax
   \def\bbl at eqdel{()}
@@ -15015,6 +15014,7 @@ end
       \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@
@@ -15049,77 +15049,75 @@ end
       % 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}%
-          \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}%
-             {}%
+            \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
-    \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 ==
@@ -15181,6 +15179,7 @@ end
   \else
     \ifnum\pardirection=\@ne\else\pardir TRT\bodydir TRT\fi
   \fi}
+\ifx\bbl at isplain\relax\endinput\fi % if plain
 \IfBabelLayout{tabular}%
   {\chardef\bbl at tabular@mode\tw@}% All RTL
   {\IfBabelLayout{notabular}%
@@ -15191,24 +15190,26 @@ end
   \ifx\AddToHook\@undefined\else
     \AddToHook{para/before}{\bbl at parabefore}%
   \fi
-  \global\let\bbl at thenextmath\relax
   \ifx\@tabular\@undefined\else
     \bbl at replace\@tabular{$}{$%
       \def\bbl at insidemath{0}%
       \def\bbl at parabefore{\babelrestoredirs}}%
     \bbl at ifunset{@tabclassz}{}{%
-      \bbl at sreplace\@tabclassz
-        {\ifcase\@chnum}{\babelrestoredirs\ifcase\@chnum}}%
+      \bbl at exp{% Hide conditionals
+        \\\bbl at sreplace\\\@tabclassz
+          {\<ifcase>\\\@chnum}{\\\babelrestoredirs\<ifcase>\\\@chnum}}}%
   \fi
   \AtBeginDocument{%
     \@ifpackageloaded{colortbl}%
       {\bbl at sreplace\@classz
         {\hbox\bgroup\bgroup}{\hbox\bgroup\bgroup\babelrestoredirs}}%
       {\@ifpackageloaded{array}%
-         {\bbl at sreplace\@classz
-           {\ifcase\@chnum}{\bgroup\babelrestoredirs\ifcase\@chnum}%
-          \bbl at sreplace\@classz
-           {\do at row@strut\fi}{\do at row@strut\fi\egroup}}%
+         {\bbl at exp{% Hide conditionals
+            \\\bbl at sreplace\\\@classz
+              {\<ifcase>\\\@chnum}%
+              {\bgroup\\\babelrestoredirs\<ifcase>\\\@chnum}%
+            \\\bbl at sreplace\\\@classz
+              {\\\do at row@strut\<fi>}{\\\do at row@strut\<fi>\egroup}}}%
          {}}}
 \fi
 \ifx\bbl at opt@layout\@nnil\endinput\fi  % if no layout
diff --git a/babel.pdf b/babel.pdf
index 53581fd..ed2e157 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index 9cf66db..34d7fa5 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2023/02/08 v3.85.03970]
+\ProvidesFile{bbcompat.dtx}[2023/02/08 v3.85.03975]
 %</dtx>
 %
 %% File 'bbcompat.dtx'





More information about the latex3-commits mailing list.