What is the simplest method to tell XeTeX (not XeLaTeX) to use a font with Cyrillic letters and to apply Russian hyphenation rules?

Ideally i would like to not have to specify anything in the source files, but to get new commands rxetex and ramsxetex to compile sources in Russian.


Replace the preloaded cm text fonts with Unicode aware ones, and use them in your documents. Asumming that you have a working XeTeX installation, try the following:

  1. Install the OTF version of the cm-unicode set of fonts into your system. You can download them from CTAN.

  2. Run fc-cache on a terminal to update the font database cache.

  3. Copy the following code into cmunfonts.tex, and input this file at the beginning of your document.

\message{cm unicode fonts!}

\font\tenrm="[cmunrm]" at 10 pt% roman text
\font\sevenrm="[cmunrm]" at 7pt
\font\fiverm="[cmunrm]" at 5pt

\font\tenbf="[cmunbx]" at 10pt % boldface extended
\font\sevenbf="[cmunbx]" at 7pt
\font\fivebf="[cmunbx]" at 5pt

\font\tentt="[cmunbtl]" at 10pt % typewriter

\font\tensl="[cmunsl]" at 10pt % slanted roman

\font\tenit="[cmunti]" at 10pt % text italic


Now try to xetex yourfile and see if that works.

In general, you will need to substitute the default 7bit cm text fonts with unicode text fonts in all your font definitions in your input files.

Now, to use russian hyphenation you need to use a format different than plain.fmt: that's untouchable. I recommend to you to install hyplain, the russian loader, and the hyphenation patterns (from hyph-utf8 package) from CTAN; check the documentation for hyplain (it's two pages), and at the appropriate place in the hylang.tex file, add russian as follows:

\input unicode-letters

Make the format running xetex -ini *hyplain, and call xetex ^&hyplain yourfile and it will compile with cyrillic and russian hyphenation.

Then you can make a batch file or bash script rxetex to include the line xetex ^&hyplain %1 %2 %3 %4 %5 %6 to run your russian enabled xetex in a prompt.

I'm sorry, but I can see no way you may bypass the process of learning how to make a format.

  • Nice to see that there are people using hyplain. ;-) – egreg Jun 9 '15 at 19:42
  • @egreg Do you think is it possible to dispense with the \preloaded fonts in the code above? —And yes, hyplain is a nice hack! – jarnosz Jun 9 '15 at 19:47
  • 1
    There's no need to define those \preloaded fonts: you can't store OpenType fonts in the format anyway, so you don't save time by defining those fonts: indeed, you lose some because you load fonts that probably you won't use. – egreg Jun 9 '15 at 19:54
  • Make sure you convert your input files to utf8 before trying to compile them. Files encoded in cp1251 will likely choke xetex. – jarnosz Jun 9 '15 at 22:15
  • xetex myfile does not work, i get ! Internal error: bad native font flag in 'map_char_to_glyph'. The error has to do with \bar command in math mode and with amsppt AMSTeX package -- if i remove one or the other, there is no error. – Alexey Jun 20 '15 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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