> 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/05-double-superscript.md).

# 二重上付き

## はじめに

慣例的に、LaTeXではキャレット記号（`^`）を使って上付き文字を組みます。たとえば `$a^b$` は $$a^b$$を生成します。もし `$a^bcde$`、最初の文字だけが `b`、上付き文字になります。たとえば $$a^bcde$$というのも LaTeX は *仮定しません* 文字の集合全体を上付き文字にしたい場合は `bcde`。複数の項目（トークン）を上付き文字として組むには、グループで囲んでLaTeXに知らせる必要があります `{...}`。たとえば次のように： `$a^{bcde}$`、これにより $$a^{bcde}$$.

## 二重上付き文字エラー

二重上付き文字エラーは、LaTeXに対して、すでに *下付きが付いている* 上付き文字が付いた数式要素にさらに上付き文字を付けるよう指示したときに発生します。このエラーは通常、波括弧を使うことで解決できます `{...}`。これは数式モード内で、いわゆる *部分数式*—組版しようとしている数式表現の断片を指す用語です。

たとえば、次のように書くと `$a^b^c$` は、次の二重上付き文字エラーを引き起こします：

![Overleaf に表示される二重上付き文字エラー](/files/7920d4e17cd3213d87eced17d2f4c1e9d0a1bb8d)

この特定のエラーは、中括弧を使うことでいくつかの方法で修正できます `{...}`—結果は中括弧の位置によって異なります：

* `$a^{b^c}$` は組版されます $$a^{b^c}$$
* `${a^b}^c$` は組版されます $${a^b}^c$$
* `$a^{bc}$` は組版されます $$a^{bc}$$

### 二重上付き文字エラー：特殊なケース

#### 上付き文字とアクセント

tex.stackexchange の `質問で` には [二重の意外な例が *下付き文字* エラー](https://tex.stackexchange.com/questions/253080/why-am-i-getting-a-double-subscript-error) その根本原因と解決策は二重上付き文字にも当てはまります。次の例は、波括弧を使っていてもコンパイルに失敗します：

```latex
\documentclass{article}
\begin{document}
\({\vec a^b}^c\)
\end{document}
```

[この ***エラーを発生させる*** Overleaf 上の例を開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=accents+package+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%28%7B%5Cvec+a%5Eb%7D%5Ec%5C%29%0A%5Cend%7Bdocument%7D)

と同様に [二重下付き文字エラー](/latex/ja/latexer/04-double-subscript.md)、この問題を解決する方法の一つは [`accents` パッケージ](https://ctan.org/pkg/accents?lang=en) を文書のプリアンブルに追加することです（ [こちら](https://tex.stackexchange.com/a/253094)):

```latex
\documentclass{article}
\usepackage{accents}
\begin{document}
\({\vec a^b}^c\)
\end{document}
```

[この ***修正版*** Overleaf 上の例を開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=accents+package+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Baccents%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%28%7B%5Cvec+a%5Eb%7D%5Ec%5C%29%0A%5Cend%7Bdocument%7D)

#### 上付き文字とプライム記号の使い方

このエラーのもう一つの一般的な原因は、上付き文字とプライム記号を併用することです。特にテンソル表記では厄介で、以下に示すようになります：

```latex
\documentclass{article}
\begin{document}
\[T'_{\nu_{1}\nu_{2}\ldots\nu_{p}}^{\mu_{1}\mu_{2}\ldots\mu_{q}}\]
\end{document}
```

[この ***エラーを発生させる*** Overleaf 上の例を開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=accents+package+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5BT%27_%7B%5Cnu_%7B1%7D%5Cnu_%7B2%7D%5Cldots%5Cnu_%7Bp%7D%7D%5E%7B%5Cmu_%7B1%7D%5Cmu_%7B2%7D%5Cldots%5Cmu_%7Bq%7D%7D%5C%5D%0A%5Cend%7Bdocument%7D)

この例では次のエラーが発生します：

![数式モードでプライム記号が原因の二重上付き文字エラー](/files/17fd381e3d24925db12cfa9ea1b8fed6027fd570)

数式モードでは、LaTeX はプライム付き記号を `T'` as `T^{\prime}`—つまり、 `T`。続いてLaTeXがキャレット記号を入力すると、 `^`を読み込んでいるため、 `^{\mu_{1}\mu_{2}\ldots\mu_{q}}`、 *2つ目の上付き文字* を `T`を追加しようとしていると検出し、それがエラーを引き起こします。

上記の式を正しく書く方法は、次の例で示します：

```latex
\documentclass{article}
\begin{document}
\[T_{\nu_{1}\nu_{2}\ldots\nu_{p}}^{\prime\mu_{1}\mu_{2}\ldots\mu_{q}}\]
\end{document}
```

[この ***修正版*** Overleaf 上の例を開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=accents+package+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5C%5BT_%7B%5Cnu_%7B1%7D%5Cnu_%7B2%7D%5Cldots%5Cnu_%7Bp%7D%7D%5E%7B%5Cprime%5Cmu_%7B1%7D%5Cmu_%7B2%7D%5Cldots%5Cmu_%7Bq%7D%7D%5C%5D%0A%5Cend%7Bdocument%7D)

この例では次の出力が得られます（見やすくするため拡大しています）：

![Overleaf での上付き文字とプライム記号の組版例](/files/7896ad590c9ea253d88da49ab0306d9827d6ae4f)

## 上付き文字についてさらに詳しく

さらに深いレベルの上付き文字は、次のようなLaTeXで組むことができます `a^{b^{c^{d^e}}}` 、これにより $$a^{b^{c^{d^e}}}$$。第2レベル以上の上付き文字はすべて同じフォントサイズ（ポイント）で組まれますが、第1レベルの上付き文字はやや大きいフォントサイズで組まれます。上付き文字についてさらに詳しくは、Overleaf の [そのトピック専用のヘルプページをご覧ください](/latex/ja/shu-xue/02-subscripts-and-superscripts.md).


---

# 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/05-double-superscript.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.
