Reputation: 5459
How to render bold text in plot in R using TeX
?
TeX("$\\alpha$")
TeX("The ratio of 1 and 2 is $\\frac{1}{2}$")
a <- 1:100
plot(a, a^2, xlab=TeX("$\\alpha$ bold text"), ylab=TeX("$\\alpha^2$ bold text"))
I tried TeX("$\\alpha$ \textbf{bold text}")
and TeX("$\\alpha$ $\textbf{bold text}$")
without success
Upvotes: 0
Views: 998
Reputation: 24228
library(latex2exp)
TeX("$\\alpha$")
TeX("The ratio of 1 and 2 is $\\frac{1}{2}$")
a <- 1:100
plot(a, a^2, xlab=TeX("$\\alpha$ \\textbf{bold text}"), ylab=TeX("$\\alpha^2$ \\textbf{bold text}"))
You need to use double slash in front of the command, then you will get the result:
Upvotes: 2