> 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/06-aligning-equations-with-amsmath.md).

# 数式の整列

## はじめに

この `amsmath` このパッケージには、数式を表示するためのいくつかのオプションがあります。数式が非常に長い場合や、同じ行に複数の数式を入れる必要がある場合でも、文書により適したレイアウトを選べます。

LaTeX 標準の数式用ツールは柔軟性に欠けることがあり、数式が長すぎると重なってしまったり、数式の一部が切り取られたりすることがあります。こうした問題は、次のものを使うことで克服できます。 `amsmath` このパッケージは、次の方法で文書のプリアンブルに追加できます。 `\usepackage{amsmath}`.

まずは基本的な例から始めましょう:

```latex
\begin{equation} \label{eq1}
\begin{split}
A & = \frac{\pi r^2}{2} \\
 & = \frac{1}{2} \pi r^2
\end{split}
\end{equation}
```

[この `amsmath` Overleaf のフラグメント](https://www.overleaf.com/docs?engine=\&snip_name=amsmath+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Ctitle%7BAmsmath+example%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7BMay+2021%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0A%5Csection%7BIntroduction%7D%0A%5Cbegin%7Bequation%7D+%5Clabel%7Beq1%7D%0A%5Cbegin%7Bsplit%7D%0AA+%26+%3D+%5Cfrac%7B%5Cpi+r%5E2%7D%7B2%7D+%5C%5C%0A+%26+%3D+%5Cfrac%7B1%7D%7B2%7D+%5Cpi+r%5E2%0A%5Cend%7Bsplit%7D%0A%5Cend%7Bequation%7D%0A%5Cend%7Bdocument%7D)

次の図は、LaTeX のコードによって生成された出力を示しています。

![Amsmath-eqn1.png](/files/ba10f56c9e0ef30d974b2bd736d3692abad973e9)

数式は次の中に囲む必要があります。 `equation` 数式に番号を付けたい場合は、環境を使い、 `equation*` それ以外の場合は、アスタリスク付きのものを使います。 `equation` 環境の中では、次のものを使います。 `split` 数式をより小さな部分に分割するには、環境を使います。分割された各部分は、それに応じて整列されます。二重バックスラッシュは改行文字として機能します。アンパサンド記号 `&`を使って、数式を縦方向に揃える位置を指定します。

## 1つの数式を書く

序文で述べたように、1つの数式を表示するには、次のものを使う必要があります。 `equation*` または `equation` 数式に番号を付けるかどうかに応じて、環境を使います。さらに、文書内で後で参照するためにラベルを追加することもできます。

```latex
\begin{equation} \label{eu_eqn}
e^{\pi i} + 1 = 0
\end{equation}

美しい数式 \ref{eu_eqn} はオイラーの方程式として知られています。
```

[この `amsmath` Overleaf のフラグメント](https://www.overleaf.com/docs?engine=\&snip_name=amsmath+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Ctitle%7BAmsmath+example%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7BMay+2021%7D%0A%5Cbegin%7Bdocument%7D%0A%25%5Cmaketitle%0A%25%5Csection%7BIntroduction%7D%0A%5Cbegin%7Bequation%7D+%5Clabel%7Beu_eqn%7D%0Ae%5E%7B%5Cpi+i%7D+%2B+1+%3D+0%0A%5Cend%7Bequation%7D%0A%0AThe+beautiful+equation+%5Cref%7Beu_eqn%7D+is+known+as+the+Euler+equation.%0A%5Cend%7Bdocument%7D)

次の図は、LaTeX のコードによって生成された出力を示しています。

![Neweuler1.png](/files/05dea23b365d74f87420873e75681916d4811249)

また、 [次のより完全な例を開く `amsmath` Overleaf のパッケージ。](https://www.overleaf.com/project/new/template/19716?id=66719097\&templateName=Amsmath+example\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## 長い数式を表示する

1行より長い数式には、次のものを使います。 `multline` 環境を使います。数式を改行する位置を指定するには、二重バックスラッシュを挿入します。最初の部分は左揃えになり、2つ目の部分は次の行に表示され、右揃えになります。

繰り返しになりますが、環境名にアスタリスク \* を付けるかどうかで、数式に番号を付けるかどうかが決まります。

```latex
\begin{multline*}
p(x) = 3x^6 + 14x^5y + 590x^4y^2 + 19x^3y^3\\
- 12x^2y^4 - 12xy^5 + 2y^6 - a^3b^3
\end{multline*}
```

[この複数行の数式を開く `amsmath` Overleaf のフラグメント](https://www.overleaf.com/docs?engine=\&snip_name=amsmath+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Ctitle%7BAmsmath+example%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7BMay+2021%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0A%5Csection%7BIntroduction%7D%0A%5Cbegin%7Bmultline%2A%7D%0Ap%28x%29+%3D+3x%5E6+%2B+14x%5E5y+%2B+590x%5E4y%5E2+%2B+19x%5E3y%5E3%5C%5C+%0A-+12x%5E2y%5E4+-+12xy%5E5+%2B+2y%5E6+-+a%5E3b%5E3%0A%5Cend%7Bmultline%2A%7D%0A%5Cend%7Bdocument%7D)

次の図は、LaTeX のコードによって生成された出力を示しています。

![Amsmath-eqn3.png](/files/ce62d0adc2b2758428243287ef41f0d3abf5a25f)

また、 [次のより完全な例を開く `amsmath` Overleaf のパッケージ。](https://www.overleaf.com/project/new/template/19716?id=66719097\&templateName=Amsmath+example\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## 数式を分割して揃える

*Split* は〜と非常によく似ています *multline*。次のものを使います。 *split* 数式を分割し、あたかも数式の各部分が表の中にあるかのように列ごとに揃えるには、環境を使います。この環境は、次のものの内部で使用する必要があります。 *equation* 環境。例については、この文書の導入部を参照してください。

## 複数の数式を揃える

縦方向に揃える必要のある数式が複数ある場合は、次のものが役立ちます。 *align* 環境で実現できます。

```latex
\begin{align*}
2x - 5y &=  8 \\
3x + 9y &=  -12
\end{align*}
```

[この `amsmath` Overleaf のフラグメント](https://www.overleaf.com/docs?engine=\&snip_name=amsmath+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Ctitle%7BAmsmath+example%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7BMay+2021%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0A%5Csection%7BIntroduction%7D%0A%5Cbegin%7Balign%2A%7D+%0A2x+-+5y+%26%3D++8+%5C%5C+%0A3x+%2B+9y+%26%3D++-12%0A%5Cend%7Balign%2A%7D%0A%5Cend%7Bdocument%7D)

次の図は、LaTeX のコードによって生成された出力を示しています。

![Amsmatheqn4OLV2.png](/files/a1185362df57b15e66747bef3e5a5ee46656b545)

通常、二項演算子（`>`, `<` や `=`）が揃えられ、美しく見える文書になります。

前述のとおり、アンパサンド記号 `&` が、数式をどこで揃えるかを決めます。より複雑な例を見てみましょう。

```latex
\begin{align*}
x&=y           &  w &=z              &  a&=b+c\\
2x&=-y         &  3w&=\frac{1}{2}z   &  a&=b\\
-4 + 5x&=2+y   &  w+2&=-1+w          &  ab&=cb
\end{align*}
```

[この `amsmath` Overleaf のフラグメント](https://www.overleaf.com/docs?engine=\&snip_name=amsmath+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Ctitle%7BAmsmath+example%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7BMay+2021%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0A%5Csection%7BIntroduction%7D%0A%5Cbegin%7Balign%2A%7D%0Ax%26%3Dy+++++++++++%26++w+%26%3Dz++++++++++++++%26++a%26%3Db%2Bc%5C%5C%0A2x%26%3D-y+++++++++%26++3w%26%3D%5Cfrac%7B1%7D%7B2%7Dz+++%26++a%26%3Db%5C%5C%0A-4+%2B+5x%26%3D2%2By+++%26++w%2B2%26%3D-1%2Bw++++++++++%26++ab%26%3Dcb%0A%5Cend%7Balign%2A%7D%0A%5Cend%7Bdocument%7D)

次の図は、LaTeX のコードによって生成された出力を示しています。

![Amsmath-eqn6OLV2.png](/files/7a27470a2b19452dedc199fb2c5ac876bd982323)

ここでは数式を3列に配置します。LaTeX では、各数式はアンパサンドで区切られた2つの部分から成るものとみなされます。 `&` また、各数式はその前の数式からアンパサンドで区切られているものとみなされます。 `&`.

繰り返しになりますが、\* を使うと数式番号の表示を切り替えられます。番号付けが有効な場合は、各行に個別のラベルを付けられます。

## 数式をまとめて中央揃えにする

連続する数式を、中央揃えで、いっさい整列させずに表示したいだけなら、次のものを使います。 `gather` 環境。数式番号の表示/非表示を切り替えるアスタリスクのテクニックも、ここで使えます。

```latex
\begin{gather*}
2x - 5y =  8 \\
3x^2 + 9y =  3a + c
\end{gather*}
```

[この `amsmath` Overleaf のフラグメント](https://www.overleaf.com/docs?engine=\&snip_name=amsmath+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Ctitle%7BAmsmath+example%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7BMay+2021%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0A%5Csection%7BIntroduction%7D%0A%5Cbegin%7Bgather%2A%7D+%0A2x+-+5y+%3D++8+%5C%5C+%0A3x%5E2+%2B+9y+%3D++3a+%2B+c%0A%5Cend%7Bgather%2A%7D%0A%5Cend%7Bdocument%7D)

次の図は、LaTeX のコードによって生成された出力を示しています。

![Amsmath-eqn5.png](/files/56470852d96fe30afae97bb2f2272f979a28b172)

## さらに読む

詳細については

* [数式](/latex/ja/shu-xue/01-mathematical-expressions.md)
* [角括弧と丸括弧](/latex/ja/shu-xue/03-brackets-and-parentheses.md)
* [下付き文字と上付き文字](/latex/ja/shu-xue/02-subscripts-and-superscripts.md)
* [数式モードでのスペース](/latex/ja/shu-xue/08-spacing-in-math-mode.md)
* [数式モードでの表示スタイル](/latex/ja/shu-xue/10-display-style-in-math-mode.md)
* [数学フォント](/latex/ja/shu-xue/12-mathematical-fonts.md)
* [ギリシャ文字と数式記号の一覧](/latex/ja/shu-xue/11-list-of-greek-letters-and-math-symbols.md)
* [演算子](/latex/ja/shu-xue/07-operators.md)
* [分数と二項係数](/latex/ja/shu-xue/05-fractions-and-binomials.md)
* [amsmath パッケージのドキュメント](http://mirrors.ctan.org/macros/latex/required/amsmath/amsmath.pdf)


---

# 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/06-aligning-equations-with-amsmath.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.
