Mathematica Stack Exchange is a question and answer site for users of Mathematica. 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 one boring problem with changing parameters in printing output. If I have equation

    eq = Plus[Times[a1,Derivative[2,0][q2][x,y]],Times[a2,Derivative[3,1][q1][x,y]]];

I want to replace all derivatives with new variables, for example this

      Derivative[2, 0][q2][x, y]

I want to replace it with $C_{\mathrm{q2}}^{2,0}$ and for all of them on the same way to get eq output automatically in this form


share|improve this question
Check SubsuperscriptBox. – Silvia Jun 18 '13 at 21:18
there is not explanation hoe to change them automatically – George Mills Jun 18 '13 at 21:26
I'm not sure about what you mean by changing parameters. But you might also be interested in RuleDelayed (:>). – Silvia Jun 18 '13 at 21:26
up vote 3 down vote accepted

If I understand you correctly, this might be what you're looking for:

eq /. Derivative[n__][q_][__] :>
                                   RowBox[Riffle[{n}, ","]]

formatted box

Please note the using of SubsuperscriptBox and RawBoxes, which will prevent superscript being evaluated as Power.

share|improve this answer

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.