\vphantom 和上標

\vphantom 和上標

這兩個語句的上標位置完全相同:

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

如何讓上標更高?

編輯

\int只是一個例子。這是另一個:\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

相關內容