\texttt
does not work as expected when using it with the polyglossia package, in a segment in the Hebrew language, even when the actual text to be set is Latin. I tried reading fontspec
documentation, but was overwhelmed by the quantity of the material, and the fix I tried did not work:
\documentclass{article} % Compile with xelatex
\usepackage{polyglossia}
\setmainlanguage{hebrew}
\setotherlanguage{english}
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}% or whatever
\begin{document}
\setLTR
The following should be mono-spaced, but isn't: \texttt{This should be mono-spaced.}
\end{document}
Based on the suggestions below, I tried also the following, but this does not help:
\documentclass{article} % Compile with xelatex
\usepackage{polyglossia}
\setmainfont[Script=Hebrew]{Ezra SIL}%
\setmonofont[Script=Hebrew]{FreeMono}%
\setmainlanguage{hebrew} % Document main language is Hebrew
\setotherlanguage{english} % But it uses English every so often
\begin{document}
\setLTR\textenglish{The following should be mono-spaced, but isn't:
\texttt{This should be mono-spaced.}
}
\end{document}
fontenc
won't help you. The relevant packages arefontspec
andpolyglossia
.