I want to create a command for adding a superscript * to a variable, indicating its "optimal" value. However, when I do this, the superscript is added after the subscript instead of right above:

$V_N^*$ vs. $\optimal{V_N}$

enter image description here

My question is: how can I write a newcommand which would add the superscript above the subscript?

  • 3
    – user121799
    Commented Nov 6, 2018 at 17:39
  • 1
    @marmot Please add an answer, I think an explanation will be useful to future users (and to the OP, of course)!
    – CarLaTeX
    Commented Nov 6, 2018 at 18:00
  • @CarLaTeX OK, I tried. If you find a better way, I will be very happy to remove my answer. ;-)
    – user121799
    Commented Nov 6, 2018 at 18:11
  • @marmot No, I leave it to egreg :)
    – CarLaTeX
    Commented Nov 6, 2018 at 18:40

1 Answer 1


For what it's worth: I suggest to define the command as \newcommand{\optimal}[1]{#1^*} because

enter image description here

 \item The original command, which I renamed \verb|\oldoptimal|, has additional
 \item In order to get the star where you want it to be, you thus need to remove
 the braces. This is what \verb|\newoptimal| does:
 \verb|\newoptimal{V_N}|=\verb|V_N^*| \;.\]
  • How would you handle \newoptimal{V_N^1}?
    – Werner
    Commented Nov 6, 2018 at 18:20
  • @Werner {\newoptimal{V_N}}^1 or define it with an optional argument. I guess that this was not the question, right?
    – user121799
    Commented Nov 6, 2018 at 18:22

You must log in to answer this question.

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