Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose that I use Frame -> True in Plot. Then I can use FrameLabel -> {"x (nm)", "y (nm)"} to label the frame (i.e., "pseudo-axes"). For example, I have done the following:

Plot[Sin[x], {x, 0, 2 Pi}, PlotRange -> All, 
 Frame -> True, FrameLabel -> {"x (nm)", "y (nm)"}, 
 BaseStyle -> {FontFamily -> "Arial", 20}]


Now, however, I would like the characters "x" and "y" to be italicized in FrameLabel. Is this possible?

I would like my labels to look like this:

x (nm)

y (nm)

where x and y are italicized, but (nm) is not.

Do I need to use Style, or is there a simpler solution?

Also, in the future, I may need to create FrameLabel directives that are more complicated, such as:

Phi(z) (V)

where, for example, z is italicized, but Phi( and ) (V) are not.

share|improve this question
Closely related because it requires the same manipulations: Annotating plots with plain (not italicized) mathematical text – Jens Jul 21 '12 at 22:10
up vote 6 down vote accepted

One possibility is to enter your labels in box representation and use the option setting SingleLetterItalics -> True (which is actually the default for Plot, but here we give it explicitly just to be clear):

 Sin[x], {x, 0, 2 Pi}, PlotRange -> All,
 Frame -> True, FrameLabel -> {"\!\(x (nm)\)", "\!\(y (nm)\)"}, 
 BaseStyle -> {FontFamily -> "Arial", 20, SingleLetterItalics -> True}

This gives exactly the same output as shown in @R.M's answer, so I won't duplicate it again.

If you want to have an upright single letter, you could embed a StyleBox to override the base style. For example (here we just use Style to introduce the option value; these strings can be used directly as labels without the enclosing Style):

 "\!\( Phi(z) ( \*StyleBox[V, SingleLetterItalics -> False] ) \)", 
 SingleLetterItalics -> True

Or, you can enter upright symbols as string literals embedded within the boxes (as these aren't subject to styling):

Style["\!\( Phi(z) ( \"V\" ) \)", SingleLetterItalics -> True]

Probably the simplest way, though, is to use a FormBox to display certain parts of the string in TraditionalForm as needed (which is also useful in this case for imparting correct spacing to the RowBox):

"\!\( \(TraditionalForm\`Phi(z)\) (V) \)"

I admit string representations of boxes are an acquired taste, so this approach might not be for everyone--but it's wholly equivalent to building things up using functions like Row and Style, while being a bit more compact in most cases.

share|improve this answer

The simplest way would be to select x and y and press CmdI on a mac to make those letters italic before evaluating it (CtrlI on Windows/Linux). It will also appear italicized in your input cell.

enter image description here

If you want to do it programmatically, you can use Row and Style the letters you want appropriately.

Plot[Sin[x], {x, 0, 2 Pi}, PlotRange -> All, Frame -> True, 
    BaseStyle -> {FontFamily -> "Arial", 20}, FrameLabel -> {
        Row[{Style["x", FontSlant -> Italic], " (nm)"}], 
        Row[{Style["y", FontSlant -> Italic], " (nm)"}]

Both of these apply to your Phi(z)(V) example too.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.