2

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!

camileri
  • 167
  • 1
  • 5
  • 4
    Plot[x, {x, 0, 1}, Frame -> True, FrameLabel -> {x, R^"(2)"}] – Bob Hanlon Dec 23 '19 at 16:46
  • Interesting, the answer here:

    https://mathematica.stackexchange.com/questions/140336/how-to-convert-texform-to-string-via-toexpression-without-it-being-evaluated-in

    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.

    –  Dec 23 '19 at 18:44

1 Answers1

4

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

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

plot1

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]]}]

plot2

m_goldberg
  • 107,779
  • 16
  • 103
  • 257