> 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/ru/matematika/10-display-style-in-math-mode.md).

# Стиль отображения в математическом режиме

## Введение

В этой статье объясняется, как вручную настраивать стиль набранных математических формул, но начнём мы с краткого напоминания о видимых различиях между строчными и выносными формулами.

Набранная в строке (внутри) текста абзаца математика должна занимать меньше места, чем та же математика, набранная вне текста абзаца как отдельный материал в выносном стиле. Чтобы увидеть это на практике, рассмотрим, что уравнение $$f(x) = \sum\_{i=0}^{n} \frac{a\_i}{1+x}$$ может расходиться или сходиться в зависимости от значения $$x$$. Мы также можем набрать $$f(x)$$ вне абзаца в выносном стиле:

$$f(x) = \sum\_{i=0}^{n} \frac{a\_i}{1+x}$$

Даже беглый взгляд на предыдущий пример показывает изменения в размере и форматировании математических символов, таких как $$\sum$$ и расположении его пределов, а также изменения в размере и положении верхних и нижних индексов и дробей.

Эти вопросы математической типографики возникают из взаимодействия алгоритмов набора, встроенных в движки TeX, и некоторых параметров интервалов, содержащихся в математических шрифтах. Эти параметры шрифта помогают точно настраивать набор математики в соответствии с особенностями дизайна используемых математических шрифтов.

## Переопределение стилей математики по умолчанию

Иногда может понадобиться изменить стиль по умолчанию, используемый для набора математического выражения. Например, вы можете захотеть изменить строчную формулу, такую как $$f(x) = \frac{1}{1+x}$$, и включить её в абзац, но набрать в выносном стиле: $$\displaystyle f(x) = \frac{1}{1+x}$$, хотя это сильно влияет на межстрочный интервал.

Движки TeX предоставляют несколько команд, которые можно использовать для переопределения стиля по умолчанию, в котором набирается математическое выражение:

* `\textstyle`: применяет стиль, используемый для математики, набранной в абзацах
* `\displaystyle`: применяет стиль, используемый для математики, набранной на отдельных строках
* `\scriptstyle`: применяет стиль, используемый для нижних или верхних индексов
* `\scriptscriptstyle`: применяет стиль, используемый для нижних или верхних индексов второго порядка

Показательный пример взят со страницы 142 TeXBook, хотя мы заменили `$$` на предпочитаемый LaTeX `\[` и `\]`:

```latex
\[
a_0+{1\over a_1+
      {1\over a_2+
        {1 \over a_3 +
           {1 \over a_4}}}}
\]
```

По умолчанию это набирается так:

$$a\_0+{1\over a\_1+{1\over a\_2 +{1 \over a\_3 + {1 \over a\_4}}}}$$

Стиль набора по умолчанию можно изменить, используя `\displaystyle` команду:

```latex
\[
a_0+{1\over\displaystyle a_1+
      {1\over\displaystyle a_2+
        {1 \over\displaystyle a_3 +
           {1 \over\displaystyle a_4}}}}
\]
```

в результате чего получается

$$a\_0+{1\over\displaystyle a\_1+{1\over\displaystyle a\_2+{1 \over\displaystyle a\_3 +{1 \over\displaystyle a\_4}}}}$$

Вот ещё один пример, демонстрирующий эффект `\textstyle`, `\scriptstyle` и `\scriptscriptstyle`:

```latex
\[
\begin{align*}
f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\textstyle f(x) = \textstyle \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptstyle f(x) = \scriptstyle \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptscriptstyle f(x) = \scriptscriptstyle \sum_{i=0}^{n} \frac{a_i}{1+x}
\end{align*}
\]
```

который отображается как $$\begin{align\*} f(x) = \sum\_{i=0}^{n} \frac{a\_i}{1+x} \ \textstyle f(x) = \textstyle \sum\_{i=0}^{n} \frac{a\_i}{1+x} \ \scriptstyle f(x) = \scriptstyle \sum\_{i=0}^{n} \frac{a\_i}{1+x} \ \scriptscriptstyle f(x) = \scriptscriptstyle \sum\_{i=0}^{n} \frac{a\_i}{1+x} \end{align\*}$$

Вот пример, который можно открыть в Overleaf:

```latex
\documentclass{article}
\usepackage{amsmath}
\title{Изучаем стили отображения математики}
\author{команда Overleaf}
\begin{document}
\maketitle
В зависимости от значения \(x\) уравнение \( f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \) может расходиться или сходиться.

\[ f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \]

\vspace{1cm}

Строчные математические элементы можно набрать в другом стиле: \(f(x) = \displaystyle \frac{1}{1+x}\). То же справедливо и для выносных формул:

\begin{align*}
f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\textstyle f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptstyle f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptscriptstyle f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x}
\end{align*}
\end{document}
```

[Откройте этот пример в Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Exploring+math+display+styles\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Ctitle%7BExploring+math+display+styles%7D%0A%5Cauthor%7BOverleaf+team%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0ADepending+on+the+value+of+%5C%28x%5C%29+the+equation+%5C%28+f%28x%29+%3D+%5Csum_%7Bi%3D0%7D%5E%7Bn%7D+%5Cfrac%7Ba_i%7D%7B1%2Bx%7D+%5C%29+may+diverge+or+converge.%0A%0A%5C%5B+f%28x%29+%3D+%5Csum_%7Bi%3D0%7D%5E%7Bn%7D+%5Cfrac%7Ba_i%7D%7B1%2Bx%7D+%5C%5D%0A%0A%5Cvspace%7B1cm%7D%0A%0AInline+maths+elements+can+be+set+with+a+different+style%3A+%5C%28f%28x%29+%3D+%5Cdisplaystyle+%5Cfrac%7B1%7D%7B1%2Bx%7D%5C%29.+The+same+is+true+for+display+math+material%3A%0A%0A%5Cbegin%7Balign%2A%7D%0Af%28x%29+%3D+%5Csum_%7Bi%3D0%7D%5E%7Bn%7D+%5Cfrac%7Ba_i%7D%7B1%2Bx%7D+%5C%5C%0A%5Ctextstyle+f%28x%29+%3D+%5Csum_%7Bi%3D0%7D%5E%7Bn%7D+%5Cfrac%7Ba_i%7D%7B1%2Bx%7D+%5C%5C%0A%5Cscriptstyle+f%28x%29+%3D+%5Csum_%7Bi%3D0%7D%5E%7Bn%7D+%5Cfrac%7Ba_i%7D%7B1%2Bx%7D+%5C%5C%0A%5Cscriptscriptstyle+f%28x%29+%3D+%5Csum_%7Bi%3D0%7D%5E%7Bn%7D+%5Cfrac%7Ba_i%7D%7B1%2Bx%7D%0A%5Cend%7Balign%2A%7D%0A%5Cend%7Bdocument%7D)

## Дополнительное чтение

Для получения дополнительной информации см.

* [Математические выражения](/latex/ru/matematika/01-mathematical-expressions.md)
* [Нижние и верхние индексы](/latex/ru/matematika/02-subscripts-and-superscripts.md)
* [Выравнивание уравнений с помощью amsmath](/latex/ru/matematika/06-aligning-equations-with-amsmath.md)
* [Интервалы в математическом режиме](/latex/ru/matematika/08-spacing-in-math-mode.md)
* [Интегралы, суммы и пределы](/latex/ru/matematika/09-integrals-sums-and-limits.md)
* [Математические шрифты](/latex/ru/matematika/12-mathematical-fonts.md)
* [Не слишком краткое введение в LaTeX2ε](http://www.ctan.org/tex-archive/info/lshort/)


---

# 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/ru/matematika/10-display-style-in-math-mode.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.
