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.

I've installed full TexLive 2011 using "install-tl" script in Ubuntu 12.04. When I was using TexLive 2009 from repositories the following file was compiled without any errors.

\documentclass{article}
% XeLaTeX
\usepackage{xltxtra}
\usepackage{xunicode}

% Fonts
\setmainfont{Arial}
\newfontfamily\cyrillicfont{Arial}
\setmonofont{Courier New}

% Lang
\usepackage{polyglossia}
\setmainlanguage{russian}
\setotherlanguage{english}

\begin{document}
English normal.  \texttt{English monospace}.

Русский обычный.  \texttt{Русский моноширинный}.  % Text in Russian
\end{document}

But XeLaTeX from TexLive 2011 gives this error:

ERROR: Package polyglossia Error:

--- TeX said --- The current roman font does not contain the Cyrillic script! Please define \cyrillicfont with \newfontfamily.

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

l.17 ...nglish normal. \texttt{English monospace} .

In spite of this error the output PDF is correct.

The error remains if comment out \setmonofont{Courier New}. Using Courier New as main font gives no error on normal text (without \texttt, \textbf and so on). Using DejaVu Sans Mono as monospaced font gives no error too.

I've been searching for solution few hours but there aren't any. Maybe this is a bug in Polyglossia or Fontspec?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

Some fonts don't advertise their features correctly, as far as Polyglossia can understand them. In your case you have to announce that Courier New can be used also for cyrillic monospaced bits:

\newfontfamily{\cyrillicfonttt}{Courier New}

Notice also that if you should enclose English passages in suitable environment, or hyphenation won't be even attempted.

To give an example for languages that I know, assume that I'm writing a document in English with parts in Italian. The hyphenation rules for Italian are very different from the English rules: the Italian word "formidabile" is hyphenated for-mi-da-bi-le, while the English "formidable" is hyphenated for-mid-able.

XeTeX uses one set of hyphenation rules at a time, but it can switch between sets of rules. A passage in English when the current language is Russian will not be hyphenated at all, because the rules for Russian involve only the cyrillic characters. It's in principle possible to write hyphenation rules that treat properly English and Russian, because they use different parts of Unicode. But this would be impossible for Russian and Ukrainian; and if the document is in Russian, Italian and English, what set of rules would be used?

share|improve this answer
    
Thank you, this removes the error. Why does it work? I've looked at fontspec documentation but there is no information about \cyrillicfonttt. For short text in English I use \textenglish but have no idea why I have to do it :) Could you explain it too, please? –  Kirill May 28 '12 at 12:59
2  
@Kirill The \<family>fonttt feature is explained on page 6 of the documentation of Polyglossia. I've added some words about "segregating languages". –  egreg May 28 '12 at 13:56
    
Thanks a lot for further explanation! –  Kirill May 28 '12 at 14:05
add comment

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.