I would like to write $R^{(2)}$ and use this as a FrameLabel. This means that I specifically want () around the 2 in the exponent. I've tried using

ToExpression["$R^{(2)}$", TeXForm]

but this produces only the 2 in the exponent with no parantheses. Thank you for any help and merry christmas!

  • 4
    $\begingroup$ Plot[x, {x, 0, 1}, Frame -> True, FrameLabel -> {x, R^"(2)"}] $\endgroup$
    – Bob Hanlon
    Dec 23 '19 at 16:46
  • $\begingroup$ Interesting, the answer here: mathematica.stackexchange.com/questions/140336/… does not seem to solve the problem (note: instead of converting to string, convert to traditional form to preserve superscript). Mathematica still removes the brackets. There needs to be a direct way of converting from TeXForm to String, but if you're only doing it for the label, then the solution above is better. $\endgroup$
    – user55405
    Dec 23 '19 at 18:44

The solution offered by Bob Hanlon in his comment certainly works:

Plot[x, {x, 0, 1}, Frame -> True, FrameLabel -> {x, R^"(2)"}]


but, on MacOS at least, I think Mathematica renders the exponent of $R$ in too large a font. To fix this perceived fault, I suggest the following variation:

Plot[x, {x, 0, 1}, Frame -> True, FrameLabel -> {x, Superscript[R, Style["(2)", 6.5]]}]



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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