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 inline cases and array environment (with bidi=basic option) #167

Closed jalilsadati closed 2 years ago

jalilsadati commented 2 years ago
\documentclass{article}
\usepackage{amsmath}
\usepackage[bidi=basic]{babel}
\babelprovide[import,main]{arabic}

\begin{document}

\[|x|=
\begin{cases}
    1-x\frac{1}{\kappa} &  x>0 \\
    -x^2 & x<0
\end{cases}\]

$ |x|=
\begin{cases}
    1-x\frac{1}{\kappa} &  x>0 \\
    -x^2 & x<0
\end{cases} $

\[|x|=\left\{
\begin{array}{ll}
    1-x\frac{1}{\kappa} &  x>0 \\
    -x^2 & x<0
\end{array}
\right.\]

$|x|=\left\{
\begin{array}{ll}
    1-x\frac{1}{\kappa} &  x>0 \\
    -x^2 & x<0
\end{array}
\right. $

\end{document}
jbezos commented 2 years ago

As a quick workaround, try with the following before \begin{document].

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

It might break other things, but just try.

jalilsadati commented 2 years ago

It seems every things is Ok. Tabular environment also has correct behavior now by these commands.

    \begin{tabular}{ll}
        $ax+b+c+d$ &  $f(x)=x^2-3-\cos (x^2)$ \\
        $ax+b$  &  $f(x)=x^2-3$
    \end{tabular}

Thank you very much.

jbezos commented 2 years ago

👍 Thank you for your report. Please, feel free to report any other problems you find. The number of possible combinations tends to infinity and testing everything is impossible.