[Tex/LaTex] Computer Modern fonts and Cyrillic letters

computer-moderncyrillicfontslanguagesxetex

I am trying to typeset a multi-language unicode document (English, German, Spanish, Russian and there are more languages to come) in XeLaTeX and I am struggling with Cyrillic letters. Consider the following example:

\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{russian}

\begin{document}
\noindent
\textrm{Hello! Привет!}\\
\textit{Hello! Привет!}\\
\textsl{Hello! Привет!}\\
\textsc{Hello! Привет!}
\end{document}

The document is typeset with XeLaTeX without error messages on my TeXLive 2012 system but the Cyrillic letters don't show up. I made some experiments with the fontspec and cm-unicode packages but I could not get anything besides the Roman serif font to work (and it was a mess anyway – that is why I did not include it in the above example).

What it the correct way to use all available Computer Modern characters for as many languages as possible at the same time in XeLaTeX (or LuaLaTeX)?

Best Answer

Polyglossia loads fontspec, but the default font is Latin Modern, which has no support for Cyrillic.

You can load the Computer Modern Unicode fonts instead:

\documentclass{article}
\usepackage{fontspec}

\setmainfont[Ligatures=TeX]{CMU Serif}

\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{russian}

\newcommand{\RU}[1]{\foreignlanguage{russian}{#1}}

\begin{document}
\noindent
\textrm{Hello! \RU{Привет!}}\\
\textit{Hello! \RU{Привет!}}\\
\textbf{Hello! \RU{Привет!}}\\
\textbf{\textit{Hello! \RU{Привет!}}}\\
\textsl{Hello! \RU{Привет!}}\\
\textsc{Hello! \RU{Привет!}}
\end{document}

I'd still use language changing commands, even if the font directly supports Cyrillic, because hyphenation would be incorrect (or missing) otherwise.

In case you don't have installed the CMU fonts as system fonts, you need a different way to call them, assuming your TeX Live has them.

\documentclass{article}
\usepackage{fontspec}

\setmainfont[
  Ligatures=TeX,
  Extension=.otf,
  BoldFont=cmunbx,
  ItalicFont=cmunti,
  BoldItalicFont=cmunbi,
]{cmunrm}

\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{russian}

\newcommand{\RU}[1]{\foreignlanguage{russian}{#1}}

\begin{document}
\noindent
\textrm{Hello! \RU{Привет!}}\\
\textit{Hello! \RU{Привет!}}\\
\textbf{Hello! \RU{Привет!}}\\
\textbf{\textit{Hello! \RU{Привет!}}}\\
\textsl{Hello! \RU{Привет!}}\\
\textsc{Hello! \RU{Привет!}}
\end{document}

enter image description here

There's no slanted CMU font, so the call to \textsl becomes the same as \textit. One could artificially slant the upright font.