I have an issue with xelatex
+bidi
where parentheses sometimes are reversed on multilingual lines. A minimal example is included:
\documentclass{article}
\usepackage{polyglossia}
\usepackage{bidi}
\setdefaultlanguage[calendar=hebrew]{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew,Scale=1]{Times New Roman}
\renewcommand{\labelenumi}{\arabic{enumi})}
\begin{document}
רשימה:
\begin{enumerate}
\item
סעיף שנגמר עם עברית.
\item
$1\neq 2$.
\item
בסעיף העוקב רואים בעיה.
\end{enumerate}
משפט בעברית (עם הערה שנגמרת ב- English).
\end{document}
Note how the 2nd item ending with a math environment 'switched' the context to English, so that the next item has its label parenthesis reversed. The same occurs when a closing parenthesis is preceded by English text.
Questions here and here claim that adding Script=Hebrew
in my \hebrewfont
should've fixed the issue, but it doesn't. Also, I've seen an indication that this issue might be related to polyglossia
and the \if@Latin
boolean, but I'm not sure how to fix that systemically.
English
part in\textenglish{}
to get the parentheses right in the last sentence.XeTeX 3.14159265-2.6-0.99998 (TeX Live 2017)
) on Ubuntu Xenial I still get the reversed parenthesis on the following list item after an item concluding in English text (or inline math mode). However, as AlanMunn said, changing font toDavid CLM
does take care of that. Also, his remark regarding adding\setotherlanguage{english}
to the preamble and enclosing English text in\textenglish{}
solves the problem demonstrated after the list.