latex3 / babel

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

bidi=basic cause strange result with incorrect alignement in tabular cells with Arabic content #214

Closed seloumi closed 1 year ago

seloumi commented 1 year ago

The following example shows the issue Arabic text is aligned to the right though the column is of type c, also the right vrule appear on the left of the text. Inserting Arabic text inside \hbox give correct result

\documentclass{article}
\usepackage[bidi=basic,arabic,provide=*]{babel}

\babelfont{rm}{Amiri}

\begin{document}

\begin{tabular}{c}
\hline
واحد
 \\
\hline
\end{tabular}
-
\begin{tabular}{|c|}
\hline
واحد
 \\
\hline 
\end{tabular}
-
\begin{tabular}{|c|}
\hline
واحد
 \\
\hline 
one\\ 
\hline
\end{tabular}
-
\begin{tabular}{|c|}
\hline
\hbox{واحد}
 \\
\hline
\end{tabular}
- 
\begin{tabular}{|c|}
\hline
one
 \\
\hline
\end{tabular}

\end{document}
u-fischer commented 1 year ago

with \mathdir TRT it looks okay, what probably means that some hidden math is interfering (again).

seloumi commented 1 year ago

@u-fischer The example compiled with texlive 2021 (overleaf) give correct result, the problem may have appeared after solving this https://github.com/latex3/babel/issues/158# image

jbezos commented 1 year ago

In my tests, it fails even if I undo the fix for #158. Either I’m undoing it in the wrong way, either something else has changed.

jbezos commented 1 year ago

The true part is “something else has changed”. The fix for #158 is unrelated.

jbezos commented 1 year ago

This particular issue will be fixed in the next release (I’ll submit it to CTAN in a few days), but I’ll keep the issue open because very likely the whole tabular thing must be revised, maybe with a radically different approach. The fact tabular enters in math mode makes things harder (in fact, I broke it when I was trying to fix amsmath, which might in turn require a different approach, too).

seloumi commented 1 year ago

Thanks again @jbezos for your efforts to solve the issue.

jbezos commented 1 year ago

I’m closing this issue because I’ve grouped it with other issues related to tabular in a new one (221).