# Double Superscript error with primes

Simple question,

Why does the following cause a double superscript error?

$$H^{' '}$$


Removing the spaces $$H^{''}$$ produces the expected output.

• The markup should be H'' ' is a macro that turns into ^{\prime} which is why you get a double superscript in the first case, the second is equivalent to H^{{}^{\prime\prime}} – David Carlisle Jul 3 '14 at 22:46
• Welcome to TeX.SX! Please read the following Q&A: tex.stackexchange.com/q/503 – LaRiFaRi Jul 3 '14 at 22:46

' is made active in math mode both in plain TeX and LaTeX. It puts \prime at the superscript position: ^{\prime}. However, consecutive ' are quite common and would raise a double superscript error. Therefore the macro behind ' checks the next token, whether it is again a '. If yes, the following ' is added to the superscript. The number of consecutive ' is not limited, but any other token as your space token stops it.

Since ' is putting \prime at the superscript position already. Putting ' into a superscript would move the \prime too high:

\documentclass{article}
\begin{document}
$H^{\prime\prime} = H'' \neq H^{''}$
\end{document}


Example for plain TeX:

$$H^{\prime\prime} = H'' \neq H^{''}$$
\bye


Because ' acts as superscripted prime, i.e. you can write, e.g., $f'$ instead of $f^\prime$.