Mu is rendered as just an "m" in pdf

Hi there,

I am wanting to use the greek letter mu in text and titles. Example:

"Particle Diameter [", mu, "m]"

But it keeps rendering as just "mm" when I print to pdf

We need a reproducible example (reprex)

A handy way to supply sample data is to use the dput() function. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with.

Apologies,

library(extrafont)
font_install("fontcm")
loadfonts() 

pdf(file = "C:/Users/PSD1.pdf", family = "CM Roman", height = 5, width = 7)
par(family = "CM Roman")

plot(my_pow$PD_1, my_pow$Fre_1, xlab = expression(paste("Particle Diameter [", mu, "m]")), ylab = "Volume Frequency [%]", type = "l", col = "red", xaxp = c(0, 130, 13), yaxp = c(0, 6.5, 13), xlim=c(0, 130), ylim=c(0, 6.5))

dev.off()
embed_fonts(file = "C:/Users/PSD1.pdf")

The data in the my_pow file is irrelevant as I'm having problems just with the Mu greek letter in the title of plots.

Thanks

R needs some persuading to show Greek letters. Try the latex2exp package and something like

library(latex2exp)
plot(x,y,xlab=TeX(paste("a","$\\mu$","b")))

Thanks for the help.

This suggestion works if I comment out the embed in pdf lines, but doesn't show up in the pdf if I run the code to print to pdf?

Any suggestions to get the greek letters printing correctly to pdf in CMU Serif font?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.