TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
up vote 11 down vote accepted

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.

share|improve this answer
Wow! No wonder google couldn't help me! This is the perfect solution. Thanks! – Richard Herron Nov 24 '10 at 17:07
@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 8:29
Thanks, I wasn't planning on altering the orig function with this, just applying it as needed. – Richard Herron Nov 27 '10 at 4:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.