4
$\begingroup$

I am trying to have the symbol $\epsilon_{9/2,4}^-$ as the axis label in a graph in Mathematica. First problem is that: when I use Subscript[$\epsilon$,9/2,4], 9/2 changes to $\frac{9}{2}$ (which I don't want, because it doesn't look good). Second problem is that Subscript[$\epsilon$,9/2,4]^- does not work. Can anyone please let me know how to do this? Thanks!

$\endgroup$
3
  • 1
    $\begingroup$ OK, I found the answer. This works Subscript[ϵ,"9/2",4]^"-". So, please ignore this question. $\endgroup$
    – Farokh
    Commented May 15, 2013 at 19:04
  • 1
    $\begingroup$ maybe you want to look at Subsuperscript[\[Epsilon], "9/2,4", "-"] $\endgroup$ Commented May 15, 2013 at 19:47
  • $\begingroup$ "OK, I found the answer." - please write an answer to your own question. $\endgroup$ Commented May 16, 2013 at 1:58

2 Answers 2

2
$\begingroup$

One very robust way to do such things is using the BoxLanguage of Mma. Your task for example is solved by the construct:

SubsuperscriptBox["\[Epsilon]", "2.4", "-"] // DisplayForm

placed just where you enter the desired AxesLabel. It can be, however, styled in addition, for example, as follows:

    StyleBox[SubsuperscriptBox["\[Epsilon]", "2.4", "-"], 
  FontColor -> Red, FontSize -> 18, FontWeight -> Bold] // DisplayForm

I will give below the example of its use for formatting the axes labels, by fromatting them differently (e.g. different colors, fonts and fixing FontWeight):

    Plot[Sin[eps], {eps, 0, 3}, 
 AxesLabel -> {StyleBox[SubsuperscriptBox["\[Epsilon]", "2.4", "-"], 
     FontColor -> Red, FontSize -> 18, FontWeight -> Bold] // 
    DisplayForm, 
   StyleBox[SuperscriptBox["x", "y/z"], FontFamily -> "Mathematica6", 
     FontSize -> 18, FontColor -> Blue, FontWeight -> Bold] // 
    DisplayForm}]

This returns the following plot: enter image description here

I organized these constructs in such a way that one may use them without knowing anything else about the BoxLanguage. Have fun!

$\endgroup$
3
  • $\begingroup$ Comment just to clarify: The fonts actually looks great unlike in the included image. I guess it looks low resolution here either because of the way it was exported or because it was created using a much older version. $\endgroup$
    – Kvothe
    Commented Dec 7, 2022 at 15:13
  • $\begingroup$ @Kvothe First, this has been posted in 2014. That is, a rather old version. Second, one has to understand what this image is for. If it rests in a notebook, it will look much better without further effort. If I need to publish a plot, say, in a journal, I use the following trick: Rasterize[plot, RasterSize->800] and play with the value of the RasterSize until the quality becomes good enough. $\endgroup$ Commented Dec 8, 2022 at 13:00
  • $\begingroup$ thanks, and it was not meant as a criticism. I almost dismissed the answer without paying much attention to it because I thought the result was bad anyway. Then I realized that might just be an issue with the included image and tested it. I wanted to warn people that the image looks good so that they don't instantly dismiss the answer. $\endgroup$
    – Kvothe
    Commented Dec 8, 2022 at 14:29
0
$\begingroup$

I just wanted to provide this with a complete answer, since I had this very same question. There are two ways to enter both a sub and a superscript, one using the Subsuperscript command (as noted by @Pinguin Dirk), and one using shortcut keys, which is described in the help:

To enter a subsuperscript in a notebook, use either Ctrl+_ to begin a regular subscript or Ctrl+^ to begin a regular superscript. After typing the first script, use Ctrl+% to move to the opposite script position. Ctrl+Space moves out of the subscript or superscript position.

Using the shortcut keys enables one to actually have the subsuperscript style while typing, rather than just as an output.

$\endgroup$

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.