LaTeX and cyrillic text snippets

I recently tried to include a few Russian names in Cyrillic script into one of my LaTeX documents and while doing so, I couldn't find any nice and clean documentation on this on the web. As I eventually managed to sort things out, here's my attempt at it.
  1. It is not quite so difficult to get basic Cyrillic support into your document -- there are basically only two things that you need.
    • A font encoding that supports Cyrillic characters. LaTeX's default is (the pretty old) OT1 which includes Latin characters in many shapes and forms. Typical Cyrillic encodings are T2A, T2B, and T2C; loading those is as easy as using the fontenc package with the corresponding option (see below).
    • To actually being able to type in Cyrillic letters into you LaTeX source code, and to have LaTeX recognize them as such, you'll need to use an appropriate input encoding. Now, this really depends on your file settings, but using UTF-8 should be all right in most cases.
    A first LaTeX file would look like

    \documentclass{article}

    \usepackage[T2A]{fontenc}
    \usepackage[utf8]{inputenc}

    \parindent 0in

    \begin{document}

    Tchaikovsky\\\\
    Чайк\\'oвский

    \end{document}


    Watch out, though, for those nasty accented characters such as ë or ó -- you'll really need to encode those as \"e and \'o, respectively, to avoid error messages such as

    ! Package inputenc Error: Unicode char \u8: not set up for use with LaTeX.

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

    l.23 Чайко
    вский
    ?


    Now anyway, many of you will notice that all the rest of your Postscript or PDF document will look somewhat distorted if you just pull in T2A encoding. Also, when you zoom in, you'll notice that the result of the above LaTeX code will contain bitmapped fonts all over.

  2. The reason for all fonts to be bitmapped is that the standard LaTeX CM (computer modern) font does not contain mappings for the T2A encoding. In fact, if it goes beyond OT1, computer modern will cowardly retreat to bitmapped fonts all the way.

    To retain at least the look of the non-Cyrillic text, one can go ahead and make the old OT1 standard encoding by putting it last in the list of encodings. Of course, it can't deal with the Cyrillic letters, so each time we come across one in the text, the encoding should be locally changed to T2A. This is accomplished by using the \fontencoding{} directive, which can be used like any other font selection command (such as \fontfamily{}, for example).

    \documentclass{article}

    \usepackage[T2A,OT1]{fontenc}
    \usepackage[utf8]{inputenc}

    \parindent 0in

    \begin{document}

    Tchaikovsky\\\\
    {\fontencoding{T2A}\selectfont Чайк\\'oвский}

    \end{document}

    Alternatively, one could make the latter construction a customised command, such as in

    \documentclass{article}

    \usepackage[T2A,OT1]{fontenc}
    \usepackage[utf8]{inputenc}

    \newcommand\cyrtext[1]{{\fontencoding{T2A}\selectfont #1}}

    \parindent 0in

    \begin{document}

    Tchaikovsky\\\\
    \cyrtext{Чайк\\'oвский}

    \end{document}

    This will produce
    Bitmapped cyrillic, proper Latin.

  3. The only thing that remains is to have the bitmapped Cyrillic text replaced by an appropriate non-bitmapped version as well.

    One way of attacking the problem is installing the comprehensive CM-super font set. It should be included in every LaTeX package manager, and it contains gazillions of glyphs for all kinds of encodings and shapes. Installing the thing takes a while too..

    If done properly, your LaTeX system will contain the file cm-super-t2a.map which you should add to your font mapping index by

    $ updmap --enable Map=/path/to/cm-super-t2a.map


    Without further additions to the LaTeX file, this should produce a nice-looking font-mixture!

    Proper cyrillic, proper Latin.

Done!

Remark

CM-super contains such an incredible number of fonts that it is impossible for a single individual to design and code it all. As a matter of fact, most (all?) of the fonts are produced by an automated tracing algorithm that comverted bitmapped fonts into proper ones. Hence, the quality is sometimes not as good as with genuinely designed fonts. See, for example, the first character of "Чайковский" in the last image.

Thanks

... Yuriy Bidasyuk for giving some hints here!