5

Simple question,

Why does the following cause a double superscript error?

$$ H^{' '} $$

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

  • 3
    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 03 '14 at 22:46
  • Welcome to TeX.SX! Please read the following Q&A: http://tex.stackexchange.com/q/503 – LaRiFaRi Jul 03 '14 at 22:46

2 Answers2

7

' 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}

Result

Example for plain TeX:

$$ H^{\prime\prime} = H'' \neq H^{''} $$
\bye
Heiko Oberdiek
  • 271,626
0

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