latex3 / babel

The babel system for LaTeX, LuaLaTeX and XeLaTeX
LaTeX Project Public License v1.3c
125 stars 34 forks source link

Wrong equation direction in display math Cases and Array environment (with bidi=basic option) #169

Closed jalilsadati closed 2 years ago

jalilsadati commented 2 years ago

In the previous version of Babel with

\makeatletter
\everymath{\let\bbl@mathboxdir@aux\@gobble}
\makeatother

Inline and display math for Cases, Array, and Tabular was correct, but in V3.71, Display math for Cases and Array has wrong direction again!

\documentclass{article}
\usepackage{amsmath}
\usepackage[bidi=basic]{babel}
\babelprovide[import,main]{arabic}

%\makeatletter
%\everymath{\let\bbl@mathboxdir@aux\@gobble}
%\makeatother

\begin{document}

    \[ f=
    \begin{cases}
        A_{1}^2 & \text{if}\quad x>0 \\
        B_{1}^2 & \text{if}\quad x<0
    \end{cases}\]

    $ f=
    \begin{cases}
        A_{1}^2 & \text{if}\quad x>0 \\
        B_{1}^2 & \text{if}\quad x<0
    \end{cases} $

    \[f=\left\{
    \begin{array}{ll}
        A_{1}^2 & \text{if}\quad x>0 \\
        B_{1}^2 & \text{if}\quad x<0
    \end{array}
    \right.\]

    $ f=\left\{
    \begin{array}{ll}
        A_{1}^2 & \text{if}\quad x>0 \\
        B_{1}^2 & \text{if}\quad x<0
    \end{array}
    \right. $

    \begin{tabular}{ll}
        $ a+b+c $ &  $ a+b+c $ \\
        $ a $ & $ d $
    \end{tabular}

\end{document}
jbezos commented 2 years ago

😣😣 Every time a direction gets fixed, another direction gets broken.

I promise nothing, but try with:

\makeatletter
\def\bbl@everydisplay{\def\bbl@insidemath{2}}
\makeatother

I think that with the mechanism I’ve started to implement (partly based on direct node processing with lua), I’ll manage to provide the definitive solution, but I’m still working on it.

jbezos commented 2 years ago

Fixed in 3.73.