11

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)?

1
  • Polyglossia loads fontspec; the default font is Latin Modern, which has no support for Cyrillic.
    – egreg
    Nov 26, 2013 at 12:20

1 Answer 1

9

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.

3
  • That works nicely! Nevertheless, I think, cm-unicode has a slanted font: cmunsl.otf. But if I use this font via ` SlantedFont=cmunsl`, the small caps font becomes slanted, too. Any ideas?
    – porst17
    Nov 26, 2013 at 18:11
  • @porst17 You have to add SmallCapsFont=cmunrm, and SmallCapsFeatures={Letters=SmallCaps}, to the options; but I wouldn't miss slanted type.
    – egreg
    Nov 26, 2013 at 18:17
  • It works. I wouldn't miss slanted, too, but it's just for the sake of completeness.
    – porst17
    Nov 26, 2013 at 18:47

You must log in to answer this question.

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