2
$\begingroup$

Within the Plot[] environment I'd like to label one of the axes as

$r\,\,[a_0]$

with square brackets to denote that $a_0$ is the unit. How can I achieve this? So far I've tried

Text[Style[ToExpression["r [a_0]", TeXForm, HoldForm]]

but this outputs

$r\,\,(a_0)$.

So, the subscript comes out correctly but not the brackets.

$\endgroup$
3
$\begingroup$

Use a StringForm:

Plot[x, {x, 0, 1},
AxesLabel -> {Text[StringForm["r[``]", Subscript[a, 0]]], Automatic}]

It is alternatively possible to enter the subscripts directly inside the quoted string (without using StringForm).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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