[latex3-commits] [git/LaTeX3-latex3-babel] main: Fix #167: Wrong equation direction in 'cases' and 'array' (0bf72d4)

Javier email at dante.de
Sat Feb 5 09:39:59 CET 2022


Repository : https://github.com/latex3/babel
On branch  : main
Link       : https://github.com/latex3/babel/commit/0bf72d4a12f8d40d6b2215b9d35cfa0ca641ea4f

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

commit 0bf72d4a12f8d40d6b2215b9d35cfa0ca641ea4f
Author: Javier <email at localhost>
Date:   Sat Feb 5 09:39:59 2022 +0100

    Fix #167: Wrong equation direction in 'cases' and 'array'


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

0bf72d4a12f8d40d6b2215b9d35cfa0ca641ea4f
 README.md              |   8 ++-
 babel.dtx              | 132 ++++++++++++++++++++++++++++++-------------------
 babel.ins              |   2 +-
 babel.pdf              | Bin 853557 -> 854630 bytes
 bbcompat.dtx           |   2 +-
 samples/lua-arabic.pdf | Bin 116299 -> 115532 bytes
 samples/lua-arabic.tex |  10 ++--
 7 files changed, 91 insertions(+), 63 deletions(-)

diff --git a/README.md b/README.md
index 59e33f0..eb4da9f 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.70.2637
+## Babel 3.70.2639
 
 (Development.)
 
@@ -49,8 +49,12 @@ respective authors.
 ### Summary of Latest changes
 ```
 3.71   2022-02-?? (dev)
-       * Fix
+       * Fixes:
          - Bad interraction between bidi option and mathtools (#166).
+         - 'provide+=' didn’t work with 'hebrew' as a secondary
+           language.
+         - Wrong equation direction in 'cases' and 'array' (#167).
+         
 
 3.70   2022-01-26
        * Finnish: transform 'prehyphen.nobreak'.
diff --git a/babel.dtx b/babel.dtx
index 111b02e..cda0061 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2022/02/03 v3.70.2637 The Babel package]
+\ProvidesFile{babel.dtx}[2022/02/05 v3.70.2639 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -5122,8 +5122,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.70.2637>>
-%<<date=2022/02/03>>
+%<<version=3.70.2639>>
+%<<date=2022/02/05>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -12172,39 +12172,38 @@ help from Bernd Raichle, for which I am grateful.
 % the language exists. With class options, check if the option is a
 % language by checking if the correspondin file exists.
 % 
-%
 %    \begin{macrocode}
 \bbl at foreach\bbl at language@opts{%
   \def\bbl at tempa{#1}%
   \ifx\bbl at tempa\bbl at opt@main\else
-    \bbl at ifunset{ds@#1}%
-      {\ifnum\bbl at iniflag<\tw@    % 0 ø (other = ldf)
-         \DeclareOption{#1}{\bbl at load@language{#1}}%
-       \else                      % + * (other = ini)
-         \DeclareOption{#1}{%
-           \bbl at ldfinit
-           \babelprovide[import]{#1}%
-           \bbl at afterldf{}}%
-       \fi}%
-      {}%
+    \ifnum\bbl at iniflag<\tw@    % 0 ø (other = ldf)
+      \bbl at ifunset{ds@#1}%
+        {\DeclareOption{#1}{\bbl at load@language{#1}}}%
+        {}%
+    \else                      % + * (other = ini)
+      \DeclareOption{#1}{%
+        \bbl at ldfinit
+        \babelprovide[import]{#1}%
+        \bbl at afterldf{}}%
+    \fi
   \fi}
 \bbl at foreach\@classoptionslist{%
   \def\bbl at tempa{#1}%
   \ifx\bbl at tempa\bbl at opt@main\else
-    \bbl at ifunset{ds@#1}%
-      {\ifnum\bbl at iniflag<\tw@    % 0 ø (other = ldf)
-         \IfFileExists{#1.ldf}%
-           {\DeclareOption{#1}{\bbl at load@language{#1}}}%
-           {}%
-       \else                      % + * (other = ini)
-         \IfFileExists{babel-#1.tex}% 
-           {\DeclareOption{#1}{%  
-              \bbl at ldfinit
-              \babelprovide[import]{#1}%
-              \bbl at afterldf{}}}%
-           {}%
-       \fi}%
-    {}%
+    \ifnum\bbl at iniflag<\tw@    % 0 ø (other = ldf)
+      \bbl at ifunset{ds@#1}%
+        {\IfFileExists{#1.ldf}%
+          {\DeclareOption{#1}{\bbl at load@language{#1}}}%
+          {}}%
+        {}%
+     \else                      % + * (other = ini)
+       \IfFileExists{babel-#1.tex}% 
+         {\DeclareOption{#1}{%  
+            \bbl at ldfinit
+            \babelprovide[import]{#1}%
+            \bbl at afterldf{}}}%
+         {}%
+     \fi
   \fi}
 %    \end{macrocode}
 %
@@ -13484,6 +13483,30 @@ help from Bernd Raichle, for which I am grateful.
     end
     lang.patterns(lg, pats)
   end
+  function Babel.hlist_has_bidi(head)
+    local has_bidi = false
+    for item in node.traverse(head) do
+      if item.id == node.id'glyph' then
+        local itemchar = item.char
+        local chardata = Babel.characters[itemchar]
+        local dir = chardata and chardata.d or nil
+        if not dir then
+          for nn, et in ipairs(Babel.ranges) do
+            if itemchar < et[1] then
+              break
+            elseif itemchar <= et[2] then
+              dir = et[3]
+              break
+            end
+          end
+        end
+        if dir and (dir == 'al' or dir == 'r') then
+          has_bidi = true
+        end
+      end
+    end
+    return has_bidi
+  end
 }
 \endgroup
 \ifx\newattribute\@undefined\else
@@ -14474,6 +14497,7 @@ end
 \def\bbl at dirparastext{\pardir\the\textdir\relax}%   %%%%
 %
 \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}%
@@ -14482,10 +14506,30 @@ end
      \fi}
   \def\bbl at mathboxdir@aux#1{%
     \@ifnextchar\egroup{}{\textdir T#1T\relax}}
+  \def\bbl at everymath{\def\bbl at insidemath{1}}
+  \def\bbl at everydisplay{%
+    \bbl at mathboxdir
+    \def\bbl at everymath{\bbl at mathboxdir}%
+    \def\bbl at insidemath{2}}
   \frozen at everymath\expandafter{%
-    \expandafter\bbl at mathboxdir\the\frozen at everymath}
+    \expandafter\bbl at everymath\the\frozen at everymath}
   \frozen at everydisplay\expandafter{%
-    \expandafter\bbl at mathboxdir\the\frozen at everydisplay}
+    \expandafter\bbl at everydisplay\the\frozen at everydisplay}
+  \AtBeginDocument{
+    \directlua{
+      function Babel.math_box_dir(head)
+        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, head, d)
+          end
+        end
+        return head
+      end
+      luatexbase.add_to_callback("hpack_filter", Babel.math_box_dir,
+        "Babel.math_box_dir", 0)
+  }}%
 \fi
 %    \end{macrocode}
 %
@@ -14534,8 +14578,8 @@ end
       \bbl at xin@{,leqno,}{,\@classoptionslist,}%
       \ifin@
         \def\@eqnnum{%
-           \setbox\z@\hbox{\normalfont\normalcolor(\theequation)}%
-           \hbox to0.01pt{\hss\hbox to\displaywidth{\box\z@\hss}}}%
+          \setbox\z@\hbox{\normalfont\normalcolor(\theequation)}%
+          \hbox to0.01pt{\hss\hbox to\displaywidth{\box\z@\hss}}}%
       \fi
     \else % amstex
       \edef\bbl at tempa{%
@@ -14605,6 +14649,7 @@ end
 \ifnum\bbl at bidimode>\z@
   \def\bbl at nextfake#1{%  non-local changes, use always inside a group!
     \bbl at exp{%
+      \def\\\bbl at insidemath{0}%
       \mathdir\the\bodydir  
       #1%              Once entered in math, set boxes to restore values
       \<ifmmode>%
@@ -14667,28 +14712,11 @@ end
      \directlua{
        Babel.get_picture_dir = true
        Babel.picture_has_bidi = 0
+       %
        function Babel.picture_dir (head)
          if not Babel.get_picture_dir then return head end
-         for item in node.traverse(head) do
-           if item.id == node.id'glyph' then
-             local itemchar = item.char
-             % TODO. Copypaste pattern from Babel.bidi (-r)
-             local chardata = Babel.characters[itemchar]
-             local dir = chardata and chardata.d or nil
-             if not dir then
-               for nn, et in ipairs(Babel.ranges) do
-                 if itemchar < et[1] then
-                   break
-                 elseif itemchar <= et[2] then
-                   dir = et[3]
-                   break
-                 end
-               end
-             end
-             if dir and (dir == 'al' or dir == 'r') then
-               Babel.picture_has_bidi = 1
-             end
-           end
+         if Babel.hlist_has_bidi(head) then 
+           Babel.picture_has_bidi = 1
          end
          return head
        end
diff --git a/babel.ins b/babel.ins
index 3196e88..91abd82 100644
--- a/babel.ins
+++ b/babel.ins
@@ -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/02/03}
+\def\filedate{2022/02/05}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index 2673049..07334e7 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index b06b5f3..068dcb5 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2022/02/03 v3.70.2637]
+\ProvidesFile{bbcompat.dtx}[2022/02/05 v3.70.2639]
 %</dtx>
 %
 %% File 'bbcompat.dtx'
diff --git a/samples/lua-arabic.pdf b/samples/lua-arabic.pdf
index 2426874..7d404bd 100644
Binary files a/samples/lua-arabic.pdf and b/samples/lua-arabic.pdf differ
diff --git a/samples/lua-arabic.tex b/samples/lua-arabic.tex
index 840d19f..ab79ebe 100644
--- a/samples/lua-arabic.tex
+++ b/samples/lua-arabic.tex
@@ -19,7 +19,6 @@
 %             headfoot=arabic,  % an alternative is layout=sectioning
 %             layout=counters.tabular]{babel}
 
-
 % =====================
 
 \babelfont{rm}
@@ -30,7 +29,7 @@
 \usepackage{microtype}
 \usepackage{graphicx}
 \usepackage{color}
-\usepackage[unicode]{hyperref}
+\usepackage[linkcolor=blue,urlcolor=blue,colorlinks=true]{hyperref}
 \usepackage{multicol}
 \usepackage{booktabs}
 
@@ -204,11 +203,8 @@ Pseudodoxia Epidemica) الذي صدر عام 1646.
 
 \subsection{جدول التوزيع الإلكتروني}
 
-\foreignlanguage*{english}{Also from Wikipedia. These examples show
-the column order and some directions must be still sorted out. A
-minimal experimental \texttt{tabular} (3.17.1171) is
-used. Furthermore, the way “New Caledonia” is split looks wrong (but
-actually “correct”).}
+\foreignlanguage*{english}{Also from Wikipedia. The way “New Caledonia”
+is split looks wrong (but actually “correct”).}
 
 \begin{table}
 \centering





More information about the latex3-commits mailing list.