> 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/ja/shu-xue/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`：二重の下付き文字や上付き文字に使われるスタイルを適用する

典型的な例は TeXBook の142ページから取ったものですが、ここでは `$$` 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 team}
\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/ja/shu-xue/01-mathematical-expressions.md)
* [下付き文字と上付き文字](/latex/ja/shu-xue/02-subscripts-and-superscripts.md)
* [amsmath を使った式の整列](/latex/ja/shu-xue/06-aligning-equations-with-amsmath.md)
* [数式モードでの空き](/latex/ja/shu-xue/08-spacing-in-math-mode.md)
* [積分、総和、極限](/latex/ja/shu-xue/09-integrals-sums-and-limits.md)
* [数式フォント](/latex/ja/shu-xue/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/ja/shu-xue/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.
