> 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/latexer/07-extra-alignment-tab-has-been-changed-to-cr.md).

# 余分な配置タブは\crに変更されました

このエラーは、LaTeX が表を組版しているときに、整列文字（`&`）が、そこにあるとは想定していない位置に見つかったときに発生します。LaTeX は表の列を区切るために整列文字を使用し、 [エラーを出します](#a-short-note-on-the-cr-command) 。表が予想より多くの列を使おうとすると。

## tabular 環境によって引き起こされるエラー

tabular 環境はこのエラーのよくある原因であり、次の例で示されます。ここでは、 `{c|c|c}` と書いて、3つの（中央揃えの）列を持つ表を指定しています。つまり、表の各行には3つのセルが含まれる必要があります。

```latex
\begin{tabular}{c|c|c} % 中央揃えの3列を指定
   1 & 2 & 3 & 4\\ % エラー: 4列を使用しており、3列ではない
   5 & 6 & 7\\
\end{tabular}
```

[これを開く **エラーを発生させる** Overleafでの例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+of+a+tabular+with+too+many+alignment+characters\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Btabular%7D%7Bc%7Cc%7Cc%7D+%25+Specify+3+centered+columns%0A+++1+%26+2+%26+3+%26+4%5C%5C+%25+ERROR%3A+Uses+4+columns%2C+not+3%0A+++5+%26+6+%26+7%5C%5C%0A%5Cend%7Btabular%7D%0A%5Cend%7Bdocument%7D)

この例では、次のエラーメッセージが生成されます:

![LaTeX の表エラー「Extra alignment tab has been changed to \cr」を示すデモ](/files/bbba62b7c9e97400a716eee994ac983bf9430e53)

そして、この表が組版されます:

![](/files/7904c69245f7b3373c4d585a627a86d122a4f4d9)

### エラーの説明

最初の `&` 表の1行内にある & は、 *2回目の* 列の開始を示します。したがって、3列の表では LaTeX は次のものが現れることを期待します *2つ* 各改行（`\\`）の前にある整列文字を。しかし、私たちの表の最初の行では *3つ* の整列文字が使われており、LaTeX を混乱させ、予期しない整列文字を [`\cr` コマンド](#a-short-note-on-the-cr-command)へ変更させます。これは列数を3に減らそうとする試みです。なお、 *3つ* 整列文字を使うには *4* 列が必要です。

### エラーの修正方法

このエラーを解決して表を修正するには、次のいずれかを行えます:

* 項目
* を削除して余分な列を取り除く、あるいは tabular 環境のオプションに列を追加する（たとえば、 `{c|c|c|c}`)
* と書く）、または

新しい行（新しい表の行）を作成する。以下は、これらそれぞれの解決策を示す例です:

```latex
\section*{余分な列の項目を削除する}

\begin{center}
\begin{tabular}{c|c|c}
   1 & 2 & 3\\
   5 & 6 & 7\\
\end{tabular}
\end{center}

\section*{tabular に列を追加する}

\begin{center}
\begin{tabular}{c|c|c|c}
   1 & 2 & 3 & 4\\
   5 & 6 & 7\\
\end{tabular}
\end{center}

\section*{新しい行（新しい表の行）を作成する}

\begin{center}
\begin{tabular}{c|c|c}
   1 & 2 & 3 \\
   4 &   &   \\
   5 & 6 & 7 \\
\end{tabular}
\end{center}
```

[この例をOverleafで開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Options+for+correcting+a+tablular+error\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csection%2A%7BRemoving+the+extra+column+entry%7D%0A%0A%5Cbegin%7Bcenter%7D%0A%5Cbegin%7Btabular%7D%7Bc%7Cc%7Cc%7D%0A+++1+%26+2+%26+3%5C%5C%0A+++5+%26+6+%26+7%5C%5C%0A%5Cend%7Btabular%7D%0A%5Cend%7Bcenter%7D%0A%0A%5Csection%2A%7BAdding+an+extra+column+to+the+tabular%7D%0A%0A%5Cbegin%7Bcenter%7D%0A%5Cbegin%7Btabular%7D%7Bc%7Cc%7Cc%7Cc%7D%0A+++1+%26+2+%26+3+%26+4%5C%5C%0A+++5+%26+6+%26+7%5C%5C%0A%5Cend%7Btabular%7D%0A%5Cend%7Bcenter%7D%0A%0A%5Csection%2A%7BCreating+a+new+line+%28new+table+row%29%7D%0A%0A%5Cbegin%7Bcenter%7D%0A%5Cbegin%7Btabular%7D%7Bc%7Cc%7Cc%7D%0A+++1+%26+2+%26+3+%5C%5C%0A+++4+%26+++%26+++%5C%5C%0A+++5+%26+6+%26+7+%5C%5C%0A%5Cend%7Btabular%7D%0A%5Cend%7Bcenter%7D%0A%5Cend%7Bdocument%7D)

この例では、次の出力が生成されます:

![tabular のエラーを修正する](/files/af3ed9ae6efe5ffab2827cd74b9dae09c0b03a82)

## 数式環境によって引き起こされるエラー

数式の組版では、数式要素の整列が必要になることが多く、それは次のような環境を使って実現されます `array`, `行列`、および他にもいくつかあります。一部の数式環境は、整列のために表を使うため、次の例で示すように、余分な整列タブのエラーを引き起こすことがあります。

### array 環境

array の行で使う整列タブの数が array の列数を超えると、LaTeX はエラーを生成します。以下は3列の array を使っているのに、最初の行が4列を使おうとしている例です:

```latex
\[
\begin{array}{lcl}
g(x) & = & (x+2)^2 & = (x+2)(x+2)\\ % この行がエラーを引き起こす
& = & x^2+4x+4\\
\end{array}
\]
```

[これを開く **エラーを発生させる** Overleafでの例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=An+array+with+too+many+alignment+characters\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5B%0A%5Cbegin%7Barray%7D%7Blcl%7D%0Ag%28x%29+%26+%3D+%26+%28x%2B2%29%5E2+%26+%3D+%28x%2B2%29%28x%2B2%29%5C%5C+%25+This+row+triggers+the+error%0A%26+%3D+%26+x%5E2%2B4x%2B4%5C%5C%0A%5Cend%7Barray%7D%0A%5C%5D%0A%5Cend%7Bdocument%7D)

この例では、次のエラーメッセージが生成されます:

![タブ文字が多すぎるために LaTeX の array でエラーが発生している画像](/files/f24af55ccda23989dc1ecb8a674464d647702f16)

そして、この array が組版されます:

$$\begin{array}{lcl} g(x) & = & (x+2)^2 \ =(x+2)(x+2) \ & = & x^2+4x+4\ \end{array}$$

このエラーを修正するには、array を次のように書き換えます:

```latex
\[
\begin{array}{lcl}
g(x) & = & (x+2)^2 \\
& = & (x+2)(x+2) \\
& = & x^2+4x+4\\
\end{array}
\]
```

[これを開く **修正済み** Overleafでの例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Corrected+version+of+the+array+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5B%0A%5Cbegin%7Barray%7D%7Blcl%7D%0Ag%28x%29+%26+%3D+%26+%28x%2B2%29%5E2+%5C%5C%0A%26+%3D+%26+%28x%2B2%29%28x%2B2%29+%5C%5C%0A%26+%3D+%26+x%5E2%2B4x%2B4%5C%5C%0A%5Cend%7Barray%7D%0A%5C%5D%0A%5Cend%7Bdocument%7D)

修正後の array では次のようになります:

$$\begin{array}{lcl} g(x) & = & (x+2)^2 \ & = & (x+2)(x+2) \ & = & x^2+4x+4\ \end{array}$$

### amsmath の行列環境

その `amsmath` パッケージは、行列を組版するための多数の環境を提供しており、次を含みます `行列`, `pmatrix`, `bmatrix`, `Bmatrix`, `vmatrix`、および `Vmatrix`.

次の `pmatrix` 例では12列を使おうとしていますが、エラーになります。なぜなら `amsmath` は、組版された行列の既定の最大列数を10に設定しているからです。

```latex
\documentclass{article}
\usepackage{amsmath} % 行列環境を使うため
\begin{document}
\[
\begin{pmatrix}
a_{1,1} & a_{1,2} & a_{1,3} & a_{1,4} & a_{1,5} & a_{1,6} & a_{1,7} & a_{1,8} & a_{1,9} & a_{1,10} & a_{1,11} & a_{1,12} \\
\end{pmatrix}
\]
\end{document}
```

[これを開く **エラーを発生させる** Overleafでの例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=A+pmatrix+with+too+many+columns\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D+%25+To+access+the+matrix+environment%0A%5Cbegin%7Bdocument%7D%0A%5C%5B%0A%5Cbegin%7Bpmatrix%7D%0Aa_%7B1%2C1%7D+%26+a_%7B1%2C2%7D+%26+a_%7B1%2C3%7D+%26+a_%7B1%2C4%7D+%26+a_%7B1%2C5%7D+%26+a_%7B1%2C6%7D+%26+a_%7B1%2C7%7D+%26+a_%7B1%2C8%7D+%26+a_%7B1%2C9%7D+%26+a_%7B1%2C10%7D+%26+a_%7B1%2C11%7D+%26+a_%7B1%2C12%7D+%5C%5C%0A%5Cend%7Bpmatrix%7D%0A%5C%5D%0A%5Cend%7Bdocument%7D)

このエラーを修正するには、次のように書いて列数の最大値を12に変更します `\setcounter{MaxMatrixCols}{12}`。または、お好みの任意の値にします。

```latex
\documentclass{article}
\usepackage{amsmath} % pmatrix 環境を使うため
\setcounter{MaxMatrixCols}{12}
\begin{document}
\[
\begin{pmatrix}
a_{1,1} & a_{1,2} & a_{1,3} & a_{1,4} & a_{1,5} & a_{1,6} & a_{1,7} & a_{1,8} & a_{1,9} & a_{1,10} & a_{1,11} & a_{1,12} \\
\end{pmatrix}
\]
\end{document}
```

[これを開く **修正済み** Overleafでの例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=A+pmatrix+with+12+columns\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D+%25+To+access+the+pmatrix+environment%0A%5Csetcounter%7BMaxMatrixCols%7D%7B12%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5B%0A%5Cbegin%7Bpmatrix%7D%0Aa_%7B1%2C1%7D+%26+a_%7B1%2C2%7D+%26+a_%7B1%2C3%7D+%26+a_%7B1%2C4%7D+%26+a_%7B1%2C5%7D+%26+a_%7B1%2C6%7D+%26+a_%7B1%2C7%7D+%26+a_%7B1%2C8%7D+%26+a_%7B1%2C9%7D+%26+a_%7B1%2C10%7D+%26+a_%7B1%2C11%7D+%26+a_%7B1%2C12%7D+%5C%5C%0A%5Cend%7Bpmatrix%7D%0A%5C%5D%0A%5Cend%7Bdocument%7D)

修正後の例では次の行列が生成されます:

$$\begin{pmatrix} a\_{1,1} & a\_{1,2} & a\_{1,3} & a\_{1,4} & a\_{1,5} & a\_{1,6} & a\_{1,7} & a\_{1,8} & a\_{1,9} & a\_{1,10} & a\_{1,11} & a\_{1,12} \ \end{pmatrix}$$

## \cr コマンドについての短い補足

LaTeX は、予期しない整列文字の問題を、次の基本コマンドで置き換えることで対処します `\cr`。これは、表の行を終了するための LaTeX の内部メカニズムに不可欠です。ユーザーは LaTeX の `\\` マクロを使って表の行の終わりを示しますが、実際には `\cr` コマンドが、 `\\` マクロが処理されたときに行を終了するために、裏で実行されます。


---

# 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/latexer/07-extra-alignment-tab-has-been-changed-to-cr.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.
