If would like to print $\left(\frac{b}{a}\right)^2$= (b/a)^2 inside a plot or a graphics where a and b have been seted to certain values so the first part is analytic and the second part (after the =) is computed

  • $\begingroup$ something like Graphics[Text[Row[{HoldForm[(a/b)^2], "=", (a/b)^2}]]]? $\endgroup$
    – kglr
    Commented Jun 7, 2019 at 16:26

1 Answer 1


You can use HoldForm to prevent the "formal part" of the label from being evaluated:

a = 2; b = 3;
  Text[Style[ToString[HoldForm[(a/b)^2], TraditionalForm] <> " = " <> 
     ToString[(a/b)^2, TraditionalForm], 24], {1/3, 0}]}, 
 PlotLabel -> Style[ToString[HoldForm[(a/b)^2], TraditionalForm] <> " = " <> 
    ToString[(a/b)^2, TraditionalForm], 24]]

enter image description here

You can replace HoldForm with Defer to get the same result.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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