0

This is a follow-up question to my previous question where I encountered an issue with tikz arrows (specifically with the witharrows package which uses tikz) combined with polyglossia and xelatex where the text next to the arrows was generated in LTR fashion despite the document being configured for the Hebrew language (an RTL language) resulting in reversed text.

One user suggested in a comment that the issue is related to the compiler xelatex since he got no issues when compiling with lualatex. I tried to switch compilers and it indeed solved the problem and the text was rendered correctly. However, a new problem arose which I'd like help solving.

Whenever I used a regular align* environment from amsmath with lualatex it printed on the right side of the page instead of the center like most math equations. Here are pictures of the output of the same code compiled once with xelatex:

and once with lualatex: As you can see, with xelatex I get the problem described in my previous question where Hebrew text is reversed next to the arrow in the DispWithArrows* environment, while with lualatex the contents of a regular align* environment are right-aligned instead of centered.

Why does align* behave differently with lualatex and how can I center it like normal? Are there other noticeable differences between xelatex and lualatex regarding the output of the code, especially with an RTL document, that I should be aware of? I've been using xelatex until now and I'm considering switching to lualatex after this experience. I also heard (correct me if I'm wrong) that lualatex is built on top of pdflatex so it should behave similarly to it, which is what most people who don't deal with non-English documents use if I am not mistaken.

The code producing the above pictures:

% !TeX spellcheck = he_HE
\documentclass{article}

\usepackage{amsmath} \usepackage{witharrows}

% Font and language settings \usepackage[no-math]{fontspec} \usepackage{polyglossia}

\newfontfamily\hebrewfont[ Script=Hebrew, ItalicFont=*-Regular, ItalicFeatures={FakeSlant=0.3}, ]{Assistant}

\setmainlanguage{hebrew} \setotherlanguage{english} \setsansfont{Assistant} \setmonofont{Assistant}

\WithArrowsOptions{displaystyle} \tikzset{ WithArrows/arrow/.append style = { font = \selectlanguage{hebrew}, } }

\begin{document} דוגמה לחישוב: \begin{DispWithArrows} A &= (a + b)^2 \Arrow{נפתח את הסוגריים בביטוי} \ &= a^2 + 2ab + b^2 \end{DispWithArrows} דוגמה נוספת: \begin{align} A &= (a + b)^2\ &= a^2 + 2ab + b^2 \end{align} \end{document}

I am using the font Assistant.

Shai Avr
  • 715

0 Answers0