My computer is Mac OX m1. I use the package
LatexSting to render the latex. This is the code and output figure. I was wondering if I can change the font of latex. However, I don’t want to change the font of text because I think it is OK.
x = -2*π:0.01:2*π
y = @. sin(x)
There are a few open issues on the LatexStrings and related packages. Currently the only font that’s supported is CM Serif, unfortunately.
So I use either of these solutions:
use the PGFPlotsX backend for Plots.jl. Creates LaTeX figures, which, if you use LaTeX, will use the fonts you use in the LaTeX document. You can also choose fonts and export to pdf/svg or png.
change the main figure font to CM Serif, but you state that you like to use the sans serif font, so that may not be an option for you.
don’t use LatexStrings, but use the unicode symbols - this works fine if all you need are, e.g., \alpha, or such.
as 3.) but also use HTML super- and subscript features. This requires the use of an HTML backend, like PlotlyJS, but you can export to png or svg:
plot(x,y, xlabel="test α<sup>2</sup>")