Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Trying to use minted with Hebrew as the default language with polyglossia:

\documentclass{article}
\usepackage{minted}
\usepackage{polyglossia}
\setdefaultlanguage[calendar=hebrew, numerals=arabic]{hebrew}
\setotherlanguage{english}
\newfontfamily\hebrewfont{David CLM}

\begin{document}
בדיקה

\begin{english}
\begin{minted}{bash}
    $ for i in {1..2}; do echo 'Hello World'; done
    Hello World
    Hello World
\end{minted}
\end{english}
\end{document}

Results in:

$ xelatex -shell-escape test
! Package polyglossia Error: 
The current roman font does not contain the Hebrew script!
Please define \hebrewfont with \newfontfamily.

See the polyglossia package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.1 \begin{Verbatim}[commandchars=\\\{\}, ]

I think I understand what the error is saying, but not sure why.

I'm in the english environment which should use the default English font... So why am I getting errors about Hebrew stuff?

(I did manage to workaround it by setting the default language to English, but that made other things break unfortunately)

share|improve this question

1 Answer 1

up vote 5 down vote accepted

It's a clear bug in how Polyglossia manages the situation, as it seems not taking into account the current language. A temporary workaround is to say

\let\hebrewfonttt\ttfamily

just after \newfontfamily\hebrewfont{David CLM} (it suffices to say it in the preamble, anyway). This assuming that you don't need Hebrew in the minted environment.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.