latex3 / latex2e

The LaTeX2e kernel
https://www.latex-project.org/
LaTeX Project Public License v1.3c
1.82k stars 251 forks source link

Issue with align* environment in TRT pagedir (lualatex) #705

Open seloumi opened 2 years ago

seloumi commented 2 years ago

Brief outline of the bug

I have this example with align* environment in TRT pagedir (lualatex engine), The result is aligned to the right even though the environment is placed in left to right context (with \bodydir TLT \pardir TLT \textdir TLT)

https://tex.stackexchange.com/q/621820/54817

Minimal example showing the bug

\RequirePackage{latexbug}       
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{amsmath}

\pagedir TRT\bodydir TRT \pardir TRT \textdir TRT
\begin{document}

\begin{align*}
f(x)&=1+\dfrac{1}{x+2}\\
    &=1+k(x+2) 
\end{align*}

{%
\bodydir TLT \pardir TLT \textdir TLT
\begin{align*}
f(x)&=1+\dfrac{1}{x+2}\\
    &=1+k(x+2) 
\end{align*}
 }

 \newpage

\pagedir TLT \bodydir TLT \pardir TLT \textdir TLT

\begin{align*}
f(x)&=1+\dfrac{1}{x+2}\\
    &=1+k(x+2) 
\end{align*}

\end{document}

Log file (required) and possibly PDF file

image1.log image1.pdf

muzimuzhi commented 2 years ago

Some casual tests show

FrankMittelbach commented 2 years ago

In his talk at TUG online conference 2021 Vafa Khaligi mentions this problem with basic $$ ... $$ math (which is what equation is using underneath as a bug in the luatex engine (that he reported long time ago), see near the end of the talk:

Screenshot 2021-11-12 at 18 51 56

I guess that accounts for your third bullet point, but obviously not for the initially reported issue.

seloumi commented 2 years ago

@FrankMittelbach Thanks for the guidance, the confusing thing is why the issue appears only with align* environment and It does not appear in similar environments as mentioned by @muzimuzhi !