# \vphantom and superscripts

The superscripts position is exactly the same for these two statements:

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

How can I get the superscript higher up?

Edit

The \intis just an example. Here is another one: \vphantom{)}^S and )^S.

• in which mode? text based math or display based? It might also be an idea to explain a bit more about what you are trying to do. Perhaps there is a better solution than trying to hack something together manually. – daleif Mar 14 '14 at 12:08

The construct \vphantom is not a math operator, thus the rules for an ordinary math atom applies for the superscript. \mathop helps:

\documentclass{article}

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


With package amsmath an "empty" math operator can be declared with \DeclareMathOperator:

\documentclass{article}

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

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


In case of a larger closing delimiter, \mathclose can help, e.g.:

\documentclass{article}

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


I do not know, the reason for the question. If only a lonely higher superscript is needed, then an invisible \rule or \raisebox will help:

\documentclass{article}

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


• Is this equivalent to a simple {\vphantom{\int}}^S? What about the )^S? It seems your solutions will produce a higher superscript than )^S. – user4514 Mar 16 '14 at 9:24
• @user4514: I have added some other cases in the updated answer. – Heiko Oberdiek Mar 16 '14 at 12:33
• @user4514 Yes, this is equivalent to {\vphantom{\int}}^S. See my answer where the reason of your problem is explained in detail. – wipet Nov 2 '17 at 6:31

The reason is: the macro \vphantom expands to the \mathchoice primitive. This primitive puts the "choice item" to the math list. When the ^ follows, then nucleus of the atom is not created immediately before and you can read the TeXbook, page 291:

<superscript>: If the current list does not end with an atom, a new Ord atom with all fields empty is appended.

Try this:

$\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$


You can solve your problem by:

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


because the Ord atom is created with "choice item" as nucleus.

Note: Ordinary atom is not problem, problem is \mathchoice.

• I've always wondered why \vphantom did not always behave exactly like its typeset counterpart. Thanks. – Steven B. Segletes Nov 2 '17 at 10:13