0

This question is closely related to this one.

I am trying to enter Latin characters with accents into a Hebrew paragraph, using XeLaTeX + polyglossia. It turns out that if I don't use the english environment, the accented characters disappear (perhaps since they do not exist in the related Hebrew font), but if I am using the english environment, then extra spaces are being added to my non-Hebrew text, and in any of the cases, the order of the words is reversed.

Here's the code:

\documentclass{article}

\usepackage{polyglossia} 
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\usepackage{fontspec}
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Simple CLM}
\usepackage{bidi}

\begin{document}
שמו היה Paul Erdős.

שמו היה \begin{english}Paul Erdős\end{english}.

\begin{english}
His name was Paul Erdős.
\end{english}

\end{document}

And here's what is produced:

enter image description here

  • You could switch only the font locally: שמו היה {\rmfamilylatin Paul Erdős}. – Ulrike Fischer Dec 18 '15 at 11:45
  • @UlrikeFischer, thanks for you reply. This indeed solves the extra spacing issue - but it still reverses the words... so perhaps it's a solution to the title, but not to the entire issue. Should I close this and open a new specialized question? – Bach Dec 18 '15 at 11:47
  • I get as output .Erdős Paul שמו היה. It this what you want? (But I don't have your fonts, so I use Arial Unicode MS, perhaps it matters). – Ulrike Fischer Dec 18 '15 at 11:52
  • No, this is a reversed order. The order of the two non-Hebrew words should be just as in the English output (that is, Paul is to the left of Erdős). – Bach Dec 18 '15 at 11:56
  • Another issue with your proposed solution is that if I am using setmainfont instead of newfontfamily in the preamble (and it seems like I need it, since otherwise -- is compiled as -- instead of as en-dash in Hebrew; that's a separate issue), then the rmfamilylatin does not fix the missing character. – Bach Dec 18 '15 at 12:18
3

The spacing after \end{english} is due to a bug (a spurious space) in gloss-hebrew. You should report it to the polyglossia maintainer. Regarding the order: Imho the english-environment is for paragraphs. If you want to change the order for some words only you can use e.g. \LRE:

\documentclass{article}

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\usepackage{fontspec}
\newfontfamily\hebrewfont[Script=Hebrew]{Arial Unicode MS}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Arial Unicode MS}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Arial Unicode MS}
\usepackage{bidi}

\def\captionshebrew{%
  \def\prefacename{מבוא}%
  \def\refname{מקורות}%
  \def\abstractname{תקציר}%
  \def\bibname{ביבליוגרפיה}%
  \def\chaptername{פרק}%
  \def\appendixname{נספח}%
  \def\contentsname{תוכן העניינים}%
  \def\listfigurename{רשימת האיורים}%
  \def\listtablename{רשימת הטבלאות}%
  \def\indexname{מפתח}%
  \def\figurename{איור}%
  \def\tablename{טבלה}%
  \def\partname{חלק}%
  \def\enclname{רצ"ב}%
  \def\ccname{העתקים}%
  \def\headtoname{אל}%
  \def\pagename{עמוד}%
  \def\psname{נ.ב.}%
  \def\seename{ראה}%
  \def\alsoname{ראה גם}% check
  \def\proofname{הוכחה}% <--- missing in gloss-hebrew
  \def\glossaryname{מילון מונחים}% check
}
\begin{document}


שמו היה \foreignlanguage{english}{\LRE{Paul Erdős}}.

שמו היה \begin{english}Paul Erdős\end{english}.

\begin{english}
His name was Paul Erdős.
\end{english}

\end{document}
  • Thank you very much! This is indeed a solution to my question. As I've mentioned in the comments, this only works if I am not using \setmainfont (and I have asked tex.stackexchange.com/questions/283755/… for that). This is also a bit cumbersome, but it absolutely gives the desired output. – Bach Dec 18 '15 at 12:47
  • It seems like \textenglish does the trick without using foreignlanguage + LRE: שמו היה \textenglish{Paul Erdős}.. – Bach Dec 18 '15 at 14:54

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.