3
$\begingroup$

I'm trying to use consistently the fonts in a plot, but even after checking this post, the "a" on the axes is different from that near the point. This is my code:

a = {60, 25}; ListPlot[{a}, PlotStyle -> Black, BaseStyle -> {FontFamily -> "Times New Roman", 12}, AxesStyle -> Directive[Black, Thick], AxesLabel -> {L, K}, LabelStyle -> {FontFamily -> "Times New Roman", 12}, Ticks -> {{{a[[1]], "\!\(\*SubscriptBox[\(L\), \(a\)]\)"}}, {{a[[2]], "\!\(\*SubscriptBox[\(K\), \(a\)]\)"}}}, Epilog -> {Text["a", a + {0.5, 2}]}] 

In particular, I'd like the font in the subindices to match the one in the label at the point.

$\endgroup$
3
  • $\begingroup$ try replacing "\!\(\*SubscriptBox[\(L\), \(a\)]\)" with Style["\!\(\*SubscriptBox[\(L\), \(a\)]\)", SingleLetterItalics ->False]? (Similarly for the tick label on vertical axis). $\endgroup$ Commented Jul 9, 2020 at 11:34
  • $\begingroup$ @kglr, But this changes not only the subindex but the $L$ too $\endgroup$ Commented Jul 9, 2020 at 12:04
  • $\begingroup$ how about, Ticks -> {{{a[[1]], Subscript[L, "a"]}}, {{a[[2]], Subscript[K, "a"]}}}? $\endgroup$ Commented Jul 9, 2020 at 12:11

1 Answer 1

1
$\begingroup$

My understanding is that you want to use italics for all these labels, as this is customary when writing mathematical notation.

One way is to use symbols instead of strings, and let the system convert them to TraditionalForm automatically. Use HoldForm to prevent evaluation.

a = {60, 25}; ListPlot[{a}, PlotStyle -> Black, BaseStyle -> {FontFamily -> "Times New Roman", 12}, AxesStyle -> Directive[Black, Thick], AxesLabel -> {L, K}, LabelStyle -> {FontFamily -> "Times New Roman", 12}, Ticks -> {{{a[[1]], HoldForm[Subscript[L, a]]}}, {{a[[2]], HoldForm[Subscript[K, a]]}}}, Epilog -> {Text[HoldForm[a], a + {0.5, 2}]}] 

Another way is to use strings, but convert the contents into TraditionalForm by selecting it (within the string) and hitting Command-Shift-T or Ctrl-Shift-T (depending on your OS).

I prefer to use one of these two methods because they rely on indicating the intention (i.e. "write math") and not on simply changing the raw formatting (italics vs non-italics).

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.