After having some hyphenation problems with my text (in greek and english) I changed some of my packages. In the beggining I was using:


After doing some search I modified those to get correct hyphenation. After doing so in a small sample text, I am trying to change the packages of my original text to the ones used in my sample, in order to get finally the correct hyphenation. However at some point I get:

Package polyglossia error: The current Roman Font does not contain the Greek Script.

Line 242: \begin{verbatim}

The packages I use are the following:

\newfontfamily\greekfont[Script=Greek]{Linux Libertine O}
\newfontfamily\greekfontsf[Script=Greek]{Linux Libertine O}
\setmainfont{Linux Libertine O}

How can this be fixed?

  • You have to define also \greekfonttt. I would never use ucharclasses for interspersing English in Greek; you risk many unexpected results.
    – egreg
    Oct 16, 2012 at 17:21
  • So what would you recommend instead? Apart the strategy when you define a command for change language and then you put the language X block in it, like \en{I am Jonathan} \gr{Είμαι ο Γιάννης}
    – Paramar
    Oct 16, 2012 at 17:38
  • The default language is Greek; just define \en for English snippets: \newcommand{\en}[1]{\foreignlanguage{english}{#1}} and use the provided environments to switch languages for longer passages in English (and maybe \gr for inserting Greek snippets in English text). Marking the code is always better. One problem you can run into is exactly that \verb text may not be typeset in the mono font.
    – egreg
    Oct 16, 2012 at 17:45
  • @egreg Make that an answer, please.
    – lockstep
    Nov 4, 2012 at 15:01

1 Answer 1


Verbatim text uses the font defined with \setmonofont (or the default Latin Modern Typewriter font).

However, when the Greek language is active, Polyglossia makes XeLaTeX look whether the font has the GRK feature and, if that's not available, it looks whether a font family under the name \greekfonttt has been defined. Thus


(use your preferred monospaced font) should do.

I wouldn't use ucharclasses for switching automatically from English to Greek and conversely: this will fill your auxiliary files with \select@language declarations and won't ensure that a monospaced font is used in verbatim. Rather prefer the standard method of confining language switches with explicit \selectlanguage commands (not recommended), otherlanguage, otherlanguage* or \foreignlanguage.

  • Thanks for this answer. Have a question about your remark: Why not use ucharclasses for switching automatically from English to <other language> and back? It seems easier than explicitly writing \textsanskrit (or whatever) at each place the other language is used. Nov 7, 2016 at 4:01
  • @ShreevatsaR I think that the last paragraph explains it
    – egreg
    Nov 7, 2016 at 7:45
  • Thanks, I understand the issue with verbatim: what is not clear to me is whether, in case there is no verbatim used in the document (and thus no need for a monospaced font), it is still the case that "this will fill your auxiliary files with \select@language declarations" has any negative consequences that would discourage using ucharclasses to switch language automatically. Nov 7, 2016 at 8:03

You must log in to answer this question.

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