4
$\begingroup$

I need to label the y-axis of a plot with the form a/GeV^-1, where ^ denotes superscript. But Mathematica always write GeV a instead, interpreting 1/GeV^-1 as GeV. How to avoid this interpretation?

$\endgroup$
  • 1
    $\begingroup$ put it inside " ". AxesLabel->{"x axis", "a/GeV^-1"} $\endgroup$ – Sumit May 2 '17 at 13:58
  • 1
    $\begingroup$ see: 20566 $\endgroup$ – Kuba May 2 '17 at 13:59
8
$\begingroup$

There is a $\LaTeX$ typesetting package, MaTeX, written for such situations by Szabolcs.

<< MaTeX`

Plot[x^2, {x, -10, 10}, AxesLabel -> MaTeX /@ {"\\text{$x$ axis}", "a/\\mathrm{GeV}^{-1}"}]

Mathematica graphics

$\endgroup$
  • 1
    $\begingroup$ Hope you don't mind the edit :-) (feel free to revert) $\endgroup$ – Szabolcs May 24 '17 at 10:33
  • $\begingroup$ @Szabolcs Of course not. Thanks for your corrections. $\endgroup$ – zhk May 24 '17 at 10:36
2
$\begingroup$

In:

label = Row[ {"a/Ge", Superscript["V", -1] }];
Plot[Sin[x], {x, 0, 2 Pi}, AxesLabel -> label]

Out:

Mathematica graphics

$\endgroup$
  • $\begingroup$ The answer is updated according to your suggestion. :) $\endgroup$ – UnchartedWorks May 24 '17 at 12:16

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.