8

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!

1 Answers1

11

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.

Hendrik Vogt
  • 37,935
  • Wow! No wonder google couldn't help me! This is the perfect solution. Thanks! – Richard Herron Nov 24 '10 at 17:07
  • 1
    @ricardh A good rule of thumb when you are having issues with latex not parsing your intended grouping correctly is to stuff it in brackets. Its the latex equivalent of putting parenthesis around mathematical expressions to explicitly state the order of operations. – crasic Nov 26 '10 at 08:29
  • Thanks, I wasn't planning on altering the orig function with this, just applying it as needed. – Richard Herron Nov 27 '10 at 04:35