[latex3-commits] [git/LaTeX3-latex3-babel] main: (Partial) fix for issue #214. (f023195)

Javier email at dante.de
Sat Jan 21 09:25:51 CET 2023


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

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

commit f023195f32ee8ca75f7fb3634c28f8f3a9b1627c
Author: Javier <email at localhost>
Date:   Sat Jan 21 09:25:51 2023 +0100

    (Partial) fix for issue #214.


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

f023195f32ee8ca75f7fb3634c28f8f3a9b1627c
 README.md    |   6 ++--
 babel.dtx    |  99 +++++++++++++++++++++++++++++++++++++----------------------
 babel.ins    |   2 +-
 babel.pdf    | Bin 906641 -> 914738 bytes
 bbcompat.dtx |   2 +-
 5 files changed, 69 insertions(+), 40 deletions(-)

diff --git a/README.md b/README.md
index d7c7e52..3e72473 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.84.2979
+## Babel 3.84.2989
 
 (dev)
 
@@ -54,7 +54,9 @@ respective authors.
       * Font-dependent transforms (lua).
       * Fixes:
         - \babelprehyphenation was not applied with 'onchar'.
-        - In some rare cases the hyphenrules were not correctly set.
+        - In some rare cases the hyphenrules weren’t correctly set.
+        - Partial fix for bidi in tabular (broken after an attempt to
+          fix amsmath).
       
 3.84  2022-12-26
       * Automatic selection of encodings with \babelprovide and pdftex.
diff --git a/babel.dtx b/babel.dtx
index 3a758d6..efcffc9 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2023/01/11 v3.84.2979 The Babel package]
+\ProvidesFile{babel.dtx}[2023/01/21 v3.84.2989 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -5246,8 +5246,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.84.2979>>
-%<<date=2023/01/11>>
+%<<version=3.84.2989>>
+%<<date=2023/01/21>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -7844,11 +7844,15 @@ help from Bernd Raichle, for which I am grateful.
 %  \end{macro}
 %
 %  \begin{macro}{\if at safe@actives}
-%    In some circumstances it is necessary to be able to change the
-%    expansion of an active character 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}.
+%  In some circumstances it is necessary to be able to set the catcode
+%  of a shorthand to ‘other’ on the fly (for example, if things like
+%  |\char"AA| are expected). 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, something like
+%  |"|$\sb{13}$|"|$\sb{13}$ becomes |"|$\sb{12}$|"|$\sb{12}$ (in other
+%  words, they are |\string|’ed). This contrasts with
+%  |\protected at edef|, where catcodes are left unchanged.
 %
 %    \begin{macrocode}
 \newif\if at safe@actives
@@ -7858,10 +7862,10 @@ help from Bernd Raichle, for which I am grateful.
 %  \end{macro}
 %
 %  \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 make them ``unsafe'' again.
+% 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
+% make them ``unsafe'' again.
 %
 %    \begin{macrocode}
 \def\bbl at restore@actives{\if at safe@actives\@safe at activesfalse\fi}
@@ -7872,10 +7876,10 @@ help from Bernd Raichle, for which I am grateful.
 %  \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|.
+% 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|.
 %
 %    \begin{macrocode}
 \chardef\bbl at activated\z@
@@ -7905,16 +7909,16 @@ help from Bernd Raichle, for which I am grateful.
 %  \end{macro}
 %  \end{macro}
 %
-%  \begin{macro}{\declare at shorthand}
-%    The command |\declare at shorthand| is used to declare a shorthand
-%    on a certain level. It takes three arguments:
-%    \begin{enumerate}
-%    \item a name for the collection of shorthands, i.e. `system', or
-%      `dutch';
-%    \item the character (sequence) that makes up the shorthand,
-%      i.e. |~| or |"a|;
-%    \item the code to be executed when the shorthand is encountered.
-%    \end{enumerate}
+% \begin{macro}{\declare at shorthand}
+% The command |\declare at shorthand| is used to declare a shorthand
+% on a certain level. It takes three arguments:
+% \begin{enumerate}
+% \item a name for the collection of shorthands, i.e. `system', or
+%   `dutch';
+% \item the character (sequence) that makes up the shorthand,
+%   i.e. |~| or |"a|;
+% \item the code to be executed when the shorthand is encountered.
+% \end{enumerate}
 %
 % The auxiliary macro |\babel at texpdf| improves the interoperativity with
 % \textsf{hyperref} and takes 4 arguments: (1) The \TeX{} code in text
@@ -8196,6 +8200,7 @@ help from Bernd Raichle, for which I am grateful.
 \def\bbl at putsh@i#1#2\@nnil{%
   \csname\language at group @sh@\string#1@%
     \ifx\@empty#2\else\string#2@\fi\endcsname}
+%
 \ifx\bbl at opt@shorthands\@nnil\else
   \let\bbl at s@initiate at active@char\initiate at active@char
   \def\initiate at active@char#1{%
@@ -14869,23 +14874,39 @@ end
 %
 \ifnum\bbl at bidimode>\z@
   \def\bbl at insidemath{0}%
-  \def\bbl at everymath{\def\bbl at insidemath{1}}
-  \def\bbl at everydisplay{\def\bbl at insidemath{2}}
+  \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 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 everymath\the\frozen at everymath}
   \frozen at everydisplay\expandafter{%
     \expandafter\bbl at everydisplay\the\frozen at everydisplay}
   \AtBeginDocument{
     \directlua{
+      Babel.use_math_box_dir = true
       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, 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'))
+        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
             end
           end
         end
@@ -14961,6 +14982,7 @@ end
     \ifx\maketag@@@\@undefined % Normal equation, eqnarray
       \AddToHook{env/equation/begin}{%
         \ifnum\bbl at thetextdir>\z@
+          \let\bbl at mathboxdir\relax
           \let\@eqnnum\bbl at eqnum
           \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
           \chardef\bbl at thetextdir\z@
@@ -14976,6 +14998,7 @@ end
       \fi
       \AddToHook{env/eqnarray/begin}{%
         \ifnum\bbl at thetextdir>\z@
+          \let\bbl at mathboxdir\relax
           \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
           \chardef\bbl at thetextdir\z@
           \bbl at add\normalfont{\bbl at eqnodir}%
@@ -15013,6 +15036,7 @@ end
             \hbox to 0.01pt{\hbox to\displaywidth{\hss{#1}}\hss}}%
         \fi
         \def\bbl at ams@preset#1{%
+          \let\bbl at mathboxdir\relax
           \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}%
@@ -15020,6 +15044,7 @@ end
           \fi}%
         \ifnum\bbl at eqnpos=\tw@\else
           \def\bbl at ams@equation{%
+            \let\bbl at mathboxdir\relax
             \ifnum\bbl at thetextdir>\z@
               \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
               \chardef\bbl at thetextdir\z@
@@ -15045,6 +15070,7 @@ end
           \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
         \AddToHook{env/flalign/begin}{\bbl at ams@preset\hbox}%
         \AddToHook{env/split/before}{%
+          \let\bbl at mathboxdir\relax
           \ifnum\bbl at thetextdir>\z@
             \bbl at ifsamestring\@currenvir{equation}%
               {\ifx\bbl at ams@lap\hbox % leqno
@@ -22404,6 +22430,7 @@ function Babel.bidi(head, ispar, hdir)
 
     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
diff --git a/babel.ins b/babel.ins
index d8382a3..816940d 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{2023/01/11}
+\def\filedate{2023/01/21}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index 262fb36..8a3186e 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index 8752dea..376766b 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2023/01/11 v3.84.2979]
+\ProvidesFile{bbcompat.dtx}[2023/01/21 v3.84.2989]
 %</dtx>
 %
 %% File 'bbcompat.dtx'





More information about the latex3-commits mailing list.