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$
2
  • 1
    $\begingroup$ put it inside " ". AxesLabel->{"x axis", "a/GeV^-1"} $\endgroup$
    – Sumit
    May 2, 2017 at 13:58
  • 1
    $\begingroup$ see: 20566 $\endgroup$
    – Kuba
    May 2, 2017 at 13:59

2 Answers 2

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$
2
  • 1
    $\begingroup$ Hope you don't mind the edit :-) (feel free to revert) $\endgroup$
    – Szabolcs
    May 24, 2017 at 10:33
  • $\begingroup$ @Szabolcs Of course not. Thanks for your corrections. $\endgroup$
    – zhk
    May 24, 2017 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$
1
  • $\begingroup$ The answer is updated according to your suggestion. :) $\endgroup$
    – webcpu
    May 24, 2017 at 12:16

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.