# string and subscript in label

s = Import[
"Desktop/crack.xlsx", {"Data", 2, Range[1, 546], {1, 2, 4}}];
ListContourPlot[s, AspectRatio -> Automatic,
ColorFunction -> "Pastel",
Contours -> Range[0.054, 0.27, (0.27 - 0.054)/10],
FrameLabel -> {Subscript[X, 1], Subscript[X, 2]},
PlotLegends -> Placed[Automatic, Right], ColorFunction -> "Pastel",
PlotLabel -> Style["MLS" Subscript[u, 2]
OverTilde[\[Eta]] "=0.048%", FontSize -> 18]]


The label of this ouput has subscript and string. But I want the label show like the below. How to modify the Plotlabel command??

You can try using Row to layout the text, and use Spacer command to adjust the spacing as needed

Plot[Sin[x], {x, -Pi, Pi},
PlotLabel ->
Text@Style[
Row[{"MLS", Spacer[5], Subscript[u, 2], Spacer[20],
OverTilde[\[Eta]] , Spacer[5], "= 0.048%"}]], FontSize -> 18],


Or, the way I would actually do it, is use Szhorvat nice MaTex package, like this

<< MaTeX
label = MaTeX["\\text{MLS}\\, u_2 \\qquad \\tilde\\eta = 0.048\%",
Magnification -> 2];
Plot[Sin[x], {x, -Pi, Pi}, PlotLabel -> label, ImagePadding -> 20]


• I personally prefer to just maintain labels as Strings like so: TraditionalForm["MLS \!$$\*SubscriptBox[\(u$$, $$2$$]\) \ \!$$\*OverscriptBox[\(\[Eta]$$, $$~$$]\)=0.048%"]. The InputForm is quite ugly, but within the notebook one can use typesetting and it becomes a one-liner along the lines of TraditionalForm["MLS u_2 ~\Eta=0.048%"] – LLlAMnYP Apr 13 '15 at 7:23

Your output is formatted wrongly, because what you gave to Style is not a series of things to style, but a multiplication of its elements. Just evaluate the arguments on their own in your notebook to see the effect:

"MLS" Subscript[u, 2] OverTilde[\[Eta]] "=0.048%"
(* "=0.048%" "MLS" \!$$\*OverscriptBox[\(\[Eta]$$, $$~$$]\) Subscript[u, 2] *)


To get what you wanted, you could modify PlotLabel to

PlotLabel->TraditionalForm@
Style[Row[{"MLS ", Subscript[u, 2], "\t", OverTilde[\[Eta]],
"=0.048%"}], FontSize -> 18]


• fyi, I am not sure that using tab "\t" is recommend for spacing, as it might generate different space amount depending on the platform or some other system configuration. I think Spacer[n] is supposed to generate the exact space on all systems. (mac, linux, windows) – Nasser Apr 13 '15 at 8:02
• @Nasser: Well, \t` works for me. ;) But you are right, of course. – Jinxed Apr 13 '15 at 8:05