# [latex3-commits] [git/LaTeX3-latex3-latex2e] master: First attempt to fix mirroring in math (#134) (6a0e4cd)

Wed Mar 20 18:39:13 CET 2019

Repository : https://github.com/latex3/latex2e
On branch  : master

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

commit 6a0e4cd0e874c00125a3a119228cd7be77634544
Author: Javier Bezos <jbezos at users.noreply.github.com>
Date:   Wed Mar 20 18:39:13 2019 +0100

First attempt to fix mirroring in math (#134)

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

6a0e4cd0e874c00125a3a119228cd7be77634544
required/babel/babel.dtx |    6 ++++++
1 file changed, 6 insertions(+)

diff --git a/required/babel/babel.dtx b/required/babel/babel.dtx
index 4623bd3..1497432 100644
--- a/required/babel/babel.dtx
+++ b/required/babel/babel.dtx
@@ -18144,6 +18144,7 @@ function Babel.bidi(head, ispar)
end
end
dir = dir or 'l'
+      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
@@ -18406,6 +18407,7 @@ function Babel.bidi(head, ispar, hdir)

local nodes = {}
local outer_first = nil
+  local inmath = false

local glue_d = nil
local glue_i = nil
@@ -18465,6 +18467,7 @@ function Babel.bidi(head, ispar, hdir)
end
end
d = d or 'l'
+      if inmath then d = ('TRT' == tex.mathdir) and 'r' or 'l' end
d_font = d_font or d

d_font = (d_font == 'l' and 0) or
@@ -18513,6 +18516,9 @@ function Babel.bidi(head, ispar, hdir)
glue_i = item
d = nil

+    elseif item.id == node.id'math' then
+      inmath = (item.subtype == 0)
+
else
d = nil
end