\vphantom と上付き文字

\vphantom と上付き文字

次の 2 つのステートメントでは、上付き文字の位置はまったく同じです。

\vphantom{\int}^Sそして{}^S

上付き文字を上にするにはどうすればいいでしょうか?

編集

\int単なる例です。もう 1 つ例を挙げます。\vphantom{)}^Sおよび)^S

答え1

この構造は\vphantom数学演算子ではないため、上付き文字には通常の数学アトムのルールが適用されます。\mathop役立ちます:

\documentclass{article}

\begin{document}
\[
  \int^S = \mathop{\vphantom{\int}}\nolimits^S
\]
\[
  \int\limits^S = \mathop{\vphantom{\int}}^S
\]
\end{document}

結果

パッケージを使用すると、amsmath「空の」数学演算子を次のように宣言できます\DeclareMathOperator

\documentclass{article}

\usepackage{amsmath}
\DeclareMathOperator*{\vint}{\vphantom{\int}}

\begin{document}
\[
  \int^S = \vint\nolimits^S
\]
\[
  \int\limits^S = \vint^S
\]
\end{document}

終了区切り文字が大きい場合は、\mathclose次のようにすると役立ちます。

\documentclass{article}

\begin{document}
\[
  \Biggr)^S = \mathclose{\vphantom{\Biggr)}}^S
\]
\end{document}

非表示の終了区切り文字に上付き文字

質問の理由はわかりません。上付き文字だけが必要な場合は、目に見えない\ruleor\raiseboxが役立ちます。

\documentclass{article}

\begin{document}
\[
  {}^S < \rule{0pt}{2.5ex}^S < \raisebox{3ex}{$\scriptstyle S$}
\]
\end{document}

上付き文字

答え2

理由は、マクロがプリミティブ\vphantomに展開されるからです\mathchoice。このプリミティブは、数学リストに「選択項目」を配置します。^次の場合、原子核は直前に作成されず、TeXbook の 291 ページを読むことができます。

<superscript>: 現在のリストがアトムで終わらない場合は、すべてのフィールドが空の新しい Ord アトムが追加されます。

これを試して:

$ \int^S, {\int}^S  % <- both creates the same result, Ord or Op is irrelevant
  \mathchoice{\int}{\int}{\int}{\int}^S % <- this emulates \vphnatom{\int}^S
  % and the empty atom is inserted (see TeXbook) like: 
  \mathchoice{\int}{\int}{\int}{\int}{}^S
  % so the result is the same as:
  {}^S
$

次の方法で問題を解決できます:

$ {\vphantom{\int}}^S $ 

Ord アトムは「選択項目」を核として作成されるためです。

注: 通常の原子は問題ではありません、問題は です\mathchoice

関連情報