> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/languages/14-russian.md).

# Russian

## Introduction

This article explores typesetting Russian text: enabling correct use of [Cyrillic](https://en.wikipedia.org/wiki/Cyrillic_script) characters, such аs ц, ч, ш, щ, ъ etc., and providing support for language-specific features such as hyphenation. If you are looking for instructions on how to use more than one language in a single document, for instance English and Russian, see the [International language support](/latex/languages/03-international-language-support.md) article.

## Russian example using pdfLaTeX

We’ll start with the following **pdfLaTeX** example which you can open in Overleaf using the link below the code. Because Russian uses the [Cyrillic script](https://en.wikipedia.org/wiki/Cyrillic_script) pdfLaTeX needs to ensure it not only handles the input (encoding) of Cyrillic text but also ensure the correct (output) encoding is applied to any fonts used to typeset the document. These encoding issues are discussed below.

```latex
\documentclass{article}
\usepackage[T2A]{fontenc}

%Hyphenation rules
%--------------------------------------
\usepackage{hyphenat}
\hyphenation{ма-те-ма-ти-ка вос-ста-нав-ли-вать}
%--------------------------------------
\usepackage[english, russian]{babel}
\begin{document}

\tableofcontents

\begin{abstract}
  Это вводный абзац в начале документа.
\end{abstract}

\section{Предисловие}
 Этот текст будет на русском языке. Это демонстрация того, что символы кириллицы
 в сгенерированном документе (Compile to PDF) отображаются правильно. Для этого Вы должны установить нужный  язык (russian) и необходимую кодировку шрифта (T2A).

\vskip12pt

\textbf{Этот текст будет на русском языке. Это демонстрация того, что символы кириллицы в сгенерированном документе (Compile to PDF) отображаются правильно.}

\vskip12pt

\textit{Этот текст будет на русском языке. Это демонстрация того, что символы кириллицы в сгенерированном документе (Compile to PDF) отображаются правильно.}

\section{Математические формулы}
Кириллические символы также могут быть использованы в математическом режиме.

\begin{equation}
  S_\textup{ис} = S_{123}
\end{equation}
\end{document}
```

[Open this pdfLaTeX example in Overleaf](<https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+to+typeset+Russian\&snip=\documentclass{article}&#xA;\usepackage\[T2A]{fontenc}&#xA;&#xA;%Hyphenation+rules&#xA;%--------------------------------------&#xA;\usepackage{hyphenat}&#xA;\hyphenation{ма-те-ма-ти-ка+вос-ста-нав-ли-вать}&#xA;%--------------------------------------&#xA;\usepackage\[english,+russian]{babel}&#xA;\begin{document}&#xA;+&#xA;\tableofcontents&#xA;&#xA;\begin{abstract}&#xA;++Это+вводный+абзац+в+начале+документа.&#xA;\end{abstract}&#xA;+&#xA;\section{Предисловие}&#xA;+Этот+текст+будет+на+русском+языке.+Это+демонстрация+того,+что+символы+кириллицы&#xA;+в+сгенерированном+документе+(Compile+to+PDF)+отображаются+правильно.+Для+этого+Вы+должны+установить+нужный++язык+(russian)+и+необходимую+кодировку+шрифта+(T2A).&#xA;&#xA;\vskip12pt&#xA;&#xA;\textbf{Этот+текст+будет+на+русском+языке.+Это+демонстрация+того,+что+символы+кириллицы+в+сгенерированном+документе+(Compile+to+PDF)+отображаются+правильно.}&#xA;&#xA;\vskip12pt&#xA;&#xA;\textit{Этот+текст+будет+на+русском+языке.+Это+демонстрация+того,+что+символы+кириллицы+в+сгенерированном+документе+(Compile+to+PDF)+отображаются+правильно.}+&#xA;&#xA;\section{Математические+формулы}&#xA;Кириллические+символы+также+могут+быть+использованы+в+математическом+режиме.&#xA;&#xA;\begin{equation}&#xA;++S_\textup{ис}+=+S_{123}&#xA;\end{equation}&#xA;\end{document}>)

This example produces the following output:

![Image showing Russian text typeset in LaTeX](/files/VUb34dJIEZNsulQeMDER)

## Background topics: characters and encodings

The following sections provide background material on topics related to typesetting different languages using LaTeX (mostly related to pdfLaTeX).

### Text files: integers and characters

Any text file, such as a LaTeX input `.tex` file, is nothing more than a stream of numeric (integer) values which are being used as a mechanism to *represent* characters of text; consequently, processing a text file involves scanning (reading/processing) a series of integer values. However, an important question arises: *which set of characters* is actually represented by the integer values contained in a particular text file? In other words, how have those integer values been *encoded*: what is the correct (intended) "mapping" (encoding) from integers in the text file to the corresponding characters they are supposed to *represent*?

Text files can be generated within innumerable computing environments: across different countries/continents, using a multitude of different devices, operating systems and editing tools. Originators of text files could, potentially, use or apply different text encodings according to local requirements, such as language, when generating and storing the sequence of integer values chosen to represent the individual characters contained in a text file. This may work well if the generated text files stayed within compatible technical ecosystems, which use the same encoding, but what would happen when those files are transferred to completely different environments—because many text files do not contain any information which indicates the encoding used to generate them.

Clearly, the producer (originator) and consumer (user) of textual data must, somehow, agree on the encoding (mapping) being used, otherwise *encoding errors* are likely to arise due to mismatches between the integer data in the file and the set of characters it is assumed to represent. In addition to correctly mapping text file integer values to characters, any subsequent visual display of those characters requires some form of font that is capable of providing the data (shapes, or even bitmaps) to output a visual representation of the desired characters.

### Input encoding: inputenc, UTF-8 and a change to LaTeX in 2018

Historically, a variety of 8-bit encodings were used to generate/process text files, including LaTeX inputs. To cut short a very long story, the developers of LaTeX created the `inputenc` package to address encoding issues—allowing text files, created using various encodings, to be transferred between disparate LaTeX installations.

However, over time, users/software developers moved away from multiple 8-bit encodings to using Unicode and its UTF-8 encoding scheme, which became the de facto option for encoding text files. Prior to 2018, to process UTF-8 encoded files LaTeX document preambles included the line

```latex
\usepackage[utf8]{inputenc}
```

Readers might observe that the example above does not include the line `\usepackage[utf8]{inputenc}` in the document preamble: why is that? This is due to an important change to LaTeX introduced in 2018: a switch to UTF-8 as the default *input* encoding. Documents typeset with pdfLaTeX, and using UTF-8 encoded text, including those created and typeset on Overleaf, no longer *need* to include `\usepackage[utf8]{inputenc}` but is [does no harm to do so](https://www.latex-project.org/news/2018/04/10/issue28-of-latex2e-news-released/). For further information see the [April 2018 issue of LaTeX News](https://www.latex-project.org/news/2018/04/10/issue28-of-latex2e-news-released/) and the Overleaf blog post [*TeX Live upgrade—September 2019*](https://www.overleaf.com/blog/tex-live-upgrade-september-2019). All text files created on Overleaf are encoded using UTF-8.

### Output encoding: the fontenc package (for use with pdfLaTeX)

To correctly typeset characters contained within input files, those characters need to be mapped to the appropriate *output shapes* (glyphs) contained in fonts used to typeset the document. This “output encoding” is handled by another package called `fontenc`.

To use `fontenc` include the following line in your document preamble, using an encoding, such as the [T2A encoding](http://mirrors.ctan.org/macros/latex/base/encguide.pdf), which supports the Cyrillic script:

```latex
\usepackage[T2A]{fontenc}
```

The following chart lists the `T2A` font encoding for Cyrillic text. It is reproduced from page 23 of the document *LaTeX font encodings* which is [available on CTAN](http://mirrors.ctan.org/macros/latex/base/encguide.pdf).

![](/files/yA9QY1RdVjeyLSt7aQNs)

## 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](https://ctan.org/pkg/babel?lang=en) and use the `russian` language option:

```latex
\usepackage[russian]{babel}
```

As you may see in the example in the [introduction](#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](/latex/languages/03-international-language-support.md) article to learn how to achieve this. A great deal of useful background information can be found in the document [Russian language module for Babel](http://mirrors.ctan.org/macros/latex/contrib/babel-contrib/russian/russianb.pdf).

## Hyphenation

To achieve linebreaks, some words have to be hyphenated: broken up into syllables separated by a `-` (hyphen), allowing the word to continue on the next line. For example, математика could become мате-мати-ка. The `babel` package usually does a good job of hyphenation but, occasionally, you may need to define hyphenation points manually, which you can do using these commands in the preamble:

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

`\usepackage{hyphenat}` imports the [`hyphenat` package](https://ctan.org/pkg/hyphenat?lang=en) and the second line is a list of space-separated words with defined hyphenation points. If you want to prevent automatic hyphenation of a particular `*word*`, use the command `{\nobreak *word*}` within your document.

## A final example

This final example configures LaTeX so that the Russian text can be typeset using pdfLaTeX, XeLaTeX and LuaLuaTeX—to switch compilers on Overleaf, see the article [Changing compiler](/latex/knowledge-base/026-changing-compiler.md).

This example uses the `\iftutex` command from the [`iftex` package](https://ctan.org/pkg/iftex?lang=en) to detect whether a Unicode-aware engine (LuaTeX or XeTeX) is being used to compile the LaTeX code (document). If so, Google's [OpenType Noto fonts](https://fonts.google.com/noto/fonts) are configured via the [`fontspec` package](https://ctan.org/pkg/fontspec?lang=en) and used to typeset the document. If a non-Unicode-aware engine, such as pdfTeX, is detected then the LaTeX code (document) is typeset using old 8-bit font technologies (based on [Adobe Type 1](https://en.wikipedia.org/wiki/PostScript_fonts#Type_1)).

The following code opens on Overleaf and defaults to compiling with XeLaTeX. To use a different compiler, see the article [Changing compiler](/latex/knowledge-base/026-changing-compiler.md).

```latex
\documentclass{article}
\usepackage{iftex}
\iftutex
% For LuaTeX or XeTeX Use Google's
% OpenType Noto fonts for typesetting
% Russian text
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\setmainfont{Noto Serif}
\setsansfont{Noto Sans}
\setmonofont{Noto Sans Mono}
\else
% For pdfTeX we must use old
% 8-bit font technologies
\usepackage[T2A]{fontenc}
\fi
%Hyphenation rules
\usepackage{hyphenat}
\hyphenation{ма-те-ма-ти-ка вос-ста-нав-ли-вать}
\usepackage[english, russian]{babel}
\begin{document}

Этот текст будет на русском языке. Это демонстрация того, что символы кириллицы в сгенерированном документе отображаются правильно.

\vskip12pt

\textbf{Этот текст будет на русском языке. Это демонстрация того, что символы кириллицы в сгенерированном документе отображаются правильно.}

\vskip12pt

\textit{Этот текст будет на русском языке. Это демонстрация того, что символы кириллицы в сгенерированном документе отображаются правильно.}

\vskip12pt

\texttt{Этот текст будет на русском языке.}
\end{document}
```

[Open this example on Overleaf](<https://www.overleaf.com/docs?engine=xelatex\&snip_name=Typesetting+Russian+using+different+compilers\&snip=\documentclass{article}&#xA;\usepackage{iftex}&#xA;\iftutex&#xA;%+For+LuaTeX+or+XeTeX+Use+Google's+&#xA;%+OpenType+Noto+fonts+for+typesetting&#xA;%+Russian+text&#xA;\usepackage{fontspec}&#xA;\defaultfontfeatures{Ligatures={TeX}}&#xA;\setmainfont{Noto+Serif}&#xA;\setsansfont{Noto+Sans}&#xA;\setmonofont{Noto+Sans+Mono}&#xA;\else&#xA;%+For+pdfTeX+we+must+use+old&#xA;%+8-bit+font+technologies&#xA;\usepackage\[T2A]{fontenc}&#xA;\fi&#xA;%Hyphenation+rules&#xA;\usepackage{hyphenat}&#xA;\hyphenation{ма-те-ма-ти-ка+вос-ста-нав-ли-вать}&#xA;\usepackage\[english,+russian]{babel}&#xA;\begin{document}&#xA;&#xA;Этот+текст+будет+на+русском+языке.+Это+демонстрация+того,+что+символы+кириллицы+в+сгенерированном+документе+отображаются+правильно.&#xA;&#xA;\vskip12pt&#xA;&#xA;\textbf{Этот+текст+будет+на+русском+языке.+Это+демонстрация+того,+что+символы+кириллицы+в+сгенерированном+документе+отображаются+правильно.}&#xA;&#xA;\vskip12pt&#xA;&#xA;\textit{Этот+текст+будет+на+русском+языке.+Это+демонстрация+того,+что+символы+кириллицы+в+сгенерированном+документе+отображаются+правильно.}+&#xA;&#xA;\vskip12pt&#xA;&#xA;\texttt{Этот+текст+будет+на+русском+языке.}&#xA;\end{document}>)

Using XeLaTeX, this example produces the following output:

![Image showing Russian text typeset in LaTeX](/files/qsiFhYcptTeWfPeFf4km)

## Further reading

For more information see

* [Supporting modern fonts with XƎLaTeX](/latex/fonts/03-xelatex.md)
* [Typesetting quotations and quotation marks](/latex/languages/04-typesetting-quotations.md)
* [International language support](/latex/languages/03-international-language-support.md)
* [Chinese](/latex/languages/06-chinese.md)
* [French](/latex/languages/07-french.md)
* [German](/latex/languages/08-german.md)
* [Greek](/latex/languages/09-greek.md)
* [Italian](/latex/languages/10-italian.md)
* [Japanese](/latex/languages/11-japanese.md)
* [Korean](/latex/languages/12-korean.md)
* [Portuguese](/latex/languages/13-portuguese.md)
* [Arabic](/latex/languages/05-arabic.md)
* [Spanish](/latex/languages/15-spanish.md)
* [Russian language module for Babel](http://mirrors.ctan.org/macros/latex/contrib/babel-contrib/russian/russianb.pdf)
* [History of the T2A, T2B and T2C Cyrillic encodings](https://tug.org/TUGboat/tb19-4/tb61berd.pdf)
* [The not so short introduction to LaTeX2ε](http://www.ctan.org/tex-archive/info/lshort/)
* [LaTeX/Internationalization on WikiBooks](http://en.wikibooks.org/wiki/LaTeX/Internationalization)
* [LaTeX/Special\_Characters on WikiBooks](http://en.wikibooks.org/wiki/LaTeX/Special_Characters)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/languages/14-russian.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
