[Tex/LaTex] Trick LaTeX into doing double superscripts

amsmathsuperscripts

I have a function in my .sty sheet that does a second partial derivative:

\newcommand{\hpartdsq}[2]{\dfrac{\partial^2 #1}{\partial #2 ^2}} 

But I'd like to pass it something that already has a superscript (today it's \rho^*).

Is there a way to do this with this function? I feel like wrapping the \rho^* with parentheses would really kill the aesthetics and is not typical for second partial derivatives. Thanks!

Best Answer

One cheap solution is to call the macro like this: \hpartdsq{f}{{\rho^*}}.

EDIT: Maybe I should add that it's not a good idea to modify the macro definition so that it contains the braces {}: If you call this macro

\newcommand{\hpartdsq}[2]{\dfrac{\partial^2 #1}{\partial{#2}^2}} 

with \hpartdsq{f}{\rho^*}, then it looks as desired, but with \hpartdsq{f}{x_1} the ^2 will be too far to the right.

Related Question