31

I'm learning math mode and having an issue here with the prime symbol.

$y\in[0,1]^{d\prime}$

In this inline math formula, the prime symbol is supposed to be superscript, but it shows up at the regular text level and size.

2

2 Answers 2

55

It is not clear what you want the output to be

$y\in[0,1]^{d\prime}$

the \prime is in the superscript along with d. If you want the prime to be on d then just use

$y\in[0,1]^{d'}$

which is equivalent to

$y\in[0,1]^{d^{\prime}}$
4
  • Thank you. I needed the extra explanation as well as the answer. I'm not up to speed on this language.
    – Nathan
    Commented Feb 3, 2013 at 0:54
  • 7
    +1 for noting apostrophe (') is, in math mode, the same as ^{\prime} Commented Feb 3, 2013 at 16:11
  • 2
    @AlexNelson, I think that that's only approximately true. Namely, \(d'\) is the same (I guess) as \(d^\prime\), but \(d''\) is not the same as \(d^\prime^\prime\). (I think ' does some \ifnextchar monkeying precisely to handle this.)
    – LSpice
    Commented Jun 17, 2015 at 20:01
  • 3
    @LSpice \futurelet rather than \@ifnextchar but yes. Commented Jun 17, 2015 at 20:05
22

\prime is by default on the same level as normal text. (Just as \circ - used as symbol for degrees for example.) Instead you need to specify that \prime is a superscript:

$y\in[0,1]^{d^\prime}$

EDIT: This might be marginal to the question, but I think it's a useful addition. The ' is a shorthand for ^\prime. Thus, if you type in LaTeX:

$y\in[0,1]^{d^{\circ'}}$

the output will be:

double superscript

As you can see, LaTeX interprets it as a double superscript. Now suppose you don't want that, but instead something like:

no double superscript

If you try to do it by typing: $y\in[0,1]^{d^{\circ}'}$, you'll summon up an error:

! Double superscript.
<recently read> ^
l.4 $y\in[0,1]^{d^{\circ}'

To avoid this, \prime comes handy. Just do: $y\in[0,1]^{d^{\circ\prime}}$ and everything will be fine. :)

1
  • Duplicated from tex.stackexchange.com/questions/96558/…: I think that "The ' is a shorthand for ^\prime." is only approximately true. Namely, \(d'\) is the same (I guess) as \(d^\prime\), but \(d''\) is not the same as \(d^\prime^\prime\). (I think ' does some \ifnextchar monkeying precisely to handle this.)
    – LSpice
    Commented Jun 17, 2015 at 20:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .