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

5
  • You could switch only the font locally: שמו היה {\rmfamilylatin Paul Erdős}. Dec 18, 2015 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, 2015 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). Dec 18, 2015 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, 2015 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, 2015 at 12:18

1 Answer 1

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}
3
  • 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, 2015 at 12:47
  • It seems like \textenglish does the trick without using foreignlanguage + LRE: שמו היה \textenglish{Paul Erdős}..
    – Bach
    Dec 18, 2015 at 14:54
  • It is now 2022, we went through pandemics and we are going through war, but the error is still present in gloss-hebrew.ldf…
    – yannis
    Mar 10, 2022 at 20:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .