latex3 / babel

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

\leqno is broken in r2l paragraphs. #259

Open Udi-Fogiel opened 10 months ago

Udi-Fogiel commented 10 months ago

This is more a bug in the LuaTeX engine, but babel need to be aware of that (and maybe to find a workaround if it won't be fixed). Here is a small example

\pardirection=1
$$1+2=3 \leqno(1)$$
\bye

This break files that use r2l script as a second language. Here is an example using babel

\documentclass{article}

\usepackage[hebrew,english,provide*=*,bidi=basic]{babel}

\begin{document}
\selectlanguage{hebrew}
\begin{equation}
1+2=3
\end{equation}
\end{document}

I've sent an email to luatex-dev, I'll update if and when I'll get an answer.

jbezos commented 10 months ago

This wouldn’t be the first workaround to fix some issue in luatex math. Currently there is a dirty hack related to \[ ... \] (search the dtx for the string ‘YA luatex bug?’), which seems to do the job and I haven't had time to investigate further.

Udi-Fogiel commented 5 months ago

The only idea I have for a fix is to use \eqno, fix the horizontal placing by translating the box, and then fix the vertical spacing with the aid of the pre_append_to_vlist_filter callback (which is not a part of the kernel yet I believe, the lua-ul package defines it in a lua module).

Do you think it is too involved for such a small thing?