One of the requirements set for the graphing project I am working on is that plot and axis unit labels sometimes need to include superscripts. Here is an approximately minimal example (I have some plotting options set differently from the default, but these shouldn't matter here):
fakedata101 =
FoldList[0.92 #1 + #2 &, 0.,
RandomVariate[NormalDistribution[0, 0.5], 100]];
ListLinePlot[fakedata101, Filling -> Axis, PlotStyle ->Red,
FillingStyle -> Red,
PlotLabel -> "Test Label in k(\!\(\*SuperscriptBox[\(m\), \(2\)]\))"]
The SingleLetterItalics
option appears to be turned off in the Options Inspector, but that doesn't seem to work for String
-format text labels. It does work if set explicitly, e.g. when adding Text
in an Epilog
with an explicit Style
wrapping:
Epilog ->
Text[Style["\!\(\*SuperscriptBox[\(Text with Footnote marker\), \((a)\)]\)",
SingleLetterItalics -> False], {10, -1.5}]
Is there a way I can robustly turn off SingleLetterItalics
in styled text such as this? I would prefer not to have to catch every String
passed to a PlotLabel
or AxisLabel
and send it through a Style
command if I could help it.
Ctrl-9
. Then I type $m^2$. Then I selectm
and pressCtrl-I
to make the italic into upright type. The input for of what I get is"k (\!\(\*Cell[TextData[Cell[BoxData[\nFormBox[\n\n \ SuperscriptBox[\nStyleBox[\"m\",\nFontSlant->\"Plain\"], \"2\"], \n \ TraditionalForm]],\nFormatType->\"TraditionalForm\"]]]\))"
I know it looks awful here, just paste it back into a notebook and 'evaluate' it to see what it looks like. Move the cursor onm
to see the subcell. $\endgroup$