1

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) @DavidCarlisle

\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}

enter image description here

1 Answer 1

1

Too complex for just a comment, but:

I just discovered that this problem has been addressed already here. I refined this solution by using the etoolbox package to patch the command instead of copying the whole definition of the relevant macro. Why exactly this patch works, however, is not fully clear to me, to be honest.

Since I only refined their answer and do not understand the mechanism behind it, credit should really be given to user22486.

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

\usepackage{etoolbox}
\makeatletter
\patchcmd{\math@cr@@@align}{\fi\ifst@rred}{\else\place@tag\fi\ifst@rred}{}{}
\makeatother

\pagedir TRT \bodydir TRT \pardir TRT \textdir TRT

\begin{document}

Hello

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

Hello

{
\bodydir TLT \pardir TLT \textdir TLT 

Hello

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

Hello

}

Hello

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.