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

# amsmathを使った数式の整列 es

パッケージ **amsmath** このパッケージには、方程式を表示するための多くのオプションが用意されている。方程式が非常に大きい場合や、1 行に複数の方程式を入れる必要がある場合でも、文書に最も適した方程式の配置を選べる。

## はじめに

LaTeX の標準的な方程式処理ツールは柔軟性に欠け、その結果、要素が重なったり、方程式が大きすぎると一部が切り捨てられたりすることがある。これらの問題はすべて、パッケージ **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-eqn1.png](/files/ba10f56c9e0ef30d974b2bd736d3692abad973e9)

方程式は環境内に含める必要がある *equation* 番号付きで表示したい場合は、 *equation\** （アスタリスク付き）を使う。番号を付けたくない場合は、 *equation* 環境では *split* 方程式をより小さな部分に分割するために使う。二重バックスラッシュ（double backslash）は改行として機能する。et 記号（英語名の ampersand としても知られる）は *&* 方程式を垂直方向に整列させる基準点を設定するために使う。

[Overleaf で amsmath パッケージの例を開く](https://www.sharelatex.com/project/new/template?zipUrl=/project/52e1889fd3e596077700148c/download/zip\&templateName=Amsmath_Example_Project\&compiler=pdflatex)

## amsmath パッケージを読み込む

この手順はとても簡単で、LaTeX を頻繁に使うならおそらくすでに知っているだろう。パッケージ '*amsmath*' を読み込むには、文書のプリアンブルに次のコード行を追加する。

`\usepackage{amsmath}`

[Overleaf で amsmath パッケージの例を開く](https://www.sharelatex.com/project/new/template?zipUrl=/project/52e1889fd3e596077700148c/download/zip\&templateName=Amsmath_Example_Project\&compiler=pdflatex)

## 1 つの方程式を書く

1 つの方程式を表示するには、はじめに述べたように、環境 *equation\** を使って番号なし方程式を、あるいは環境 *equation* を使って番号付き方程式を表示する。さらに、コマンド `\label`でラベルを追加することもでき、そのラベルは後で文書内から参照できる。

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

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

![Amsmath-eqn2.png](/files/4f62c309dd8dcf061e240b3854334c313d2c5b24)

[Overleaf で amsmath パッケージの例を開く](https://www.sharelatex.com/project/new/template?zipUrl=/project/52e1889fd3e596077700148c/download/zip\&templateName=Amsmath_Example_Project\&compiler=pdflatex)

## 複数行の方程式を含める

2 行以上にわたる方程式を作成するには、環境 *multline*を使う。方程式を分割する位置を決めるには、二重バックスラッシュを挿入する。最初の部分は左揃えになり、残りの部分は次の行に表示され右揃えになる。

他のコマンドと同様に、環境名にアスタリスクを付けて、方程式に番号を付けるかどうかを指定できる。

```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-eqn3.png](/files/ce62d0adc2b2758428243287ef41f0d3abf5a25f)

[Overleaf で amsmath パッケージの例を開く](https://www.sharelatex.com/project/new/template?zipUrl=/project/52e1889fd3e596077700148c/download/zip\&templateName=Amsmath_Example_Project\&compiler=pdflatex)

## 方程式を分割して整列する

*split* は、〜に非常によく似た環境である *multline*。 *split* 方程式をいくつかの部分に分割し、それらを表の中にあるかのように列ごとに整列させるために使う。この環境は、環境 *equation*内で使う必要がある。例はこの記事の冒頭にある導入部分を参照してほしい。

## 複数の方程式を整列する

垂直方向に整列させる必要がある複数の方程式がある場合は、環境 *align* がそれを担う：

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

![Amsmath-eqn4.png](/files/5ce5b52d47540e7a71060649bec1675457f3c96a)

通常は、二項演算子（>, <, =）を垂直整列の基準点として用いることで、見た目のよい文書になる。

前述のとおり、アンパサンド記号 *&* が方程式の整列位置を決める。もう少し複雑な例を見てみよう：

```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-eqn6.png](/files/e4d0f85306dbf50c8be2ddabd87e2d45c336c8f5)

ここでは、方程式は 3 列に配置されている。LaTeX は、各方程式が文字 *&*&#x3067;区切られた 2 つの部分から成り、さらに各方程式は前の方程式から *&*.

ここでもアスタリスク \* を使って、方程式の番号付けを有効・無効にできる。番号付けが有効な場合は、各行に個別のラベルを付けられる。

[Overleaf で amsmath パッケージの例を開く](https://www.sharelatex.com/project/new/template?zipUrl=/project/52e1889fd3e596077700148c/download/zip\&templateName=Amsmath_Example_Project\&compiler=pdflatex)

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

連続する方程式を、中央揃えで、整列なしに表示したいだけなら、環境 *gather*を使う。方程式の番号付けを有効・無効にするアスタリスクの技巧はここでも使える。

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

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

[Overleaf で amsmath パッケージの例を開く](https://www.sharelatex.com/project/new/template?zipUrl=/project/52e1889fd3e596077700148c/download/zip\&templateName=Amsmath_Example_Project\&compiler=pdflatex)

## さらに読む

詳細は以下を参照：

* [数式](/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/sononotopikku/03-aligning-equations-with-amsmath-es.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.
