×
点此以英语 使用 ShareLaTeX

[edit] ShareLaTeX guides

[edit] LaTeX Basics

[edit] Mathematics

[edit] Figures and tables

[edit] References and Citations

[edit] Languages

[edit] Document structure

[edit] Formatting

[edit] Fonts

[edit] Presentations

[edit] Commands

[edit] Field specific

[edit] Class files

LaTeX supports many worldwide languages by means of some special packages. In this article is explained how to import and use those packages to create documents in Russian.

Contents

[edit] Introduction

Russian language uses the Cyrillic alphabet, therefore a special font encoding is used for this type of documents. Below is an example:

\documentclass{article}
 
%Russian-specific packages
%--------------------------------------
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
%--------------------------------------
 
%Hyphenation rules
%--------------------------------------
\usepackage{hyphenat}
\hyphenation{ма-те-ма-ти-ка вос-ста-нав-ли-вать}
%--------------------------------------
 
\begin{document}
 
\tableofcontents
 
\begin{abstract}
  Это вводный абзац в начале документа.
\end{abstract}
 
\section{Предисловие}
 Этот текст будет на русском языке. Это демонстрация того, что символы кириллицы
 в сгенерированном документе (Compile to PDF) отображаются правильно.
 Для этого Вы должны установить нужный  язык (russian) 
и необходимую кодировку шрифта (T2A).
 
\section{Математические формулы}
Кириллические символы также могут быть использованы в математическом режиме.
 
\begin{equation}
  S_\textup{ис} = S_{123}
\end{equation}
 
\end{document}

RussianEx1New.PNG

There are several packages in this document related to the encoding and the special characters. These packages will be explained in the next sections.

  Open an example in ShareLaTeX

[edit] Input encoding

Modern computer systems allow you to input letters of national alphabets directly from the keyboard. In order to handle a variety of input encodings used for different groups of languages and/or on different computer platforms LaTeX employs the inputenc package to set up input encoding. In this case the package properly displays characters in the Cyrillic alphabet. To use this package add the next line to the preamble of your document:

\usepackage[utf8]{inputenc}


The recommended input encoding is utf-8, see the reference guide for a list of Cyrillic-compatible document encodings.

  Open an example in ShareLaTeX

[edit] Font encoding

To proper LaTeX document generation you must also choose a font encoding which has to support specific characters for the Russian language, this is accomplished by the fontenc package:

\usepackage[T2]{fontenc}


Other font encodings will also work, it all depends on the compiler and the operating system you are using. The default LaTeX encoding is OT1.

  Open an example in ShareLaTeX

[edit] Language-specific packages and commands

To extended the default LaTeX capabilities, for proper hyphenation and translating the names of the document elements, import the babel package for the Russian language.

\usepackage[russian]{babel}


As you may see in the example at the introduction, instead of "abstract" and "Contents" the Russian words "Аннотация" and "Содержание" are used. Cyrillic characters can also be used in mathematical mode.

If you need to include more than one language, for instance Russian and English, see the International language support article to learn how to achieve this.

Note: In modern LaTeX distributions you can also define commands in Russian, but that won't work on older compilers since they treat Cyrillic characters as reserved symbols;

  Open an example in ShareLaTeX

[edit] Hyphenation

Sometimes for formatting reasons some words have to be broken up in syllables separated by a - (hyphen) to continue the word in a new line. For example, математика could become мате-мати-ка. The package babel, whose usage was described in the previous section, usually does a good job breaking up the words correctly, but if this is not the case you can use a couple of commands in your preamble.

 \usepackage{hyphenat}
  \hyphenation{мате-мати-ка восста-навливать}

The first command will import the package hyphenat and the second line is a list of space-separated words with defined hyphenation rules. On the other side, if you want a word not to be broken automatically, use the {\nobreak word} command within your document.

  Open an example in ShareLaTeX

[edit] Reference guide

Cyrillic code-pages

  • cp855. Standard MS-DOS Cyrillic code-page.
  • cp866. Standard MS-DOS Russian code-page.
  • cp1251. Standard Ms Windows Cyrillic code-page.
  • koi8-r. Standard Unix-Like systems Cyrillic code-page.

[edit] Further reading

For more information see