3

I am using XeLaTeX + polyglossia for Hebrew typesetting. Recently I have encountered an issue with producing dashes (Kav Mafrid, in Hebrew) in Hebrew texts. The issue arises when I am using newfontfamily instead of setmainfont.

To be more precise, here is an example. When I am using setmainfont, the following code

\documentclass{article}
\usepackage{fontspec}
\setmainfont{David CLM}
\setsansfont{Simple CLM}
\setmonofont{Miriam Mono CLM}
\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\begin{document}
קו -- מפריד.
\end{document}

produces the right output:

kav mafrid - ok

However, the compilation in that case is very slow (I have no idea why, but it runs xelatex 6 times), and I have issues including Latin characters with accents inside Hebrew paragraphs (see this question).

The better practice is, perhaps, to use newfontfamily. In that case, this is the code:

\documentclass{article}
\usepackage{fontspec}
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Simple CLM}
\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\begin{document}
קו -- מפריד.
\end{document}

In that case, the compilation is very quick (only a single call to xelatex), and some issues with Latin characters are solved, but the output is the following:

kav mafrid - wrong

Any idea what I can do to fix this behaviour?

4

Just add Ligatures=TeX to your fontfamily options.

  • Ligatures=TeX is enabled by default with recent versions of fontspec. – egreg Dec 18 '15 at 12:49
  • I have added \defaultfontfeatures{Ligatures=TeX} just after loading fontspec, and it did the job. Thanks! – Bach Dec 18 '15 at 12:50
  • @egreg I'm using the most recent version, and it doesn't do that with Bach's MWE. – Alan Munn Dec 18 '15 at 12:55

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.