How to display "Angstrom" symbol as an axis label in Makie?

Angstrom is commonly used as an unit in astronomy. In LaTeX, we can easily input it using “\AA”. I tried to display it in Makie as an axis label, but failed. L"\AA" doesn’t work.

For example:

using CairoMakie, LaTeXStrings
fig = Figure(font = “CMU Serif”)
x = range(1, stop = 10, length = 1000)
y = sin.(x)
ax = Axis(fig[1, 1], ylabel = L"y (\AA)“, xlabel = L"x”)
lines!(ax, x, y)
save(“temp.pdf”, fig)
fig

Is there any method to make it displayed properly? Thanks very much.

Just type \AA<TAB> to get a unicode Å and use that?

Just to clarify, most Julia tools support input for unicode characters. E.g. if you use julia in the terminal or in VS code, Jupyter, Pluto, you can input latex-like unicode characters by slash-followed-by-tab autocompletion. I would also suggest installing the wonderful Julia Mono typeface, a font that makes your unicode-rich code so much more beautiful https://juliamono.netlify.app/

Of course, going straight to LaTeXStrings is a reasonable approach too.

You can also open an issue to add the command to MathTeXEngine.jl if you think that it should be supported.

Your code works fine for me:

↑ PDF, although the PNG shows a bit of pixellation:

MathTeXEngine v0.5.0 is happy to display Å via LaTeXStrings:

I believe it uses the NewComputerModern font automatically.

Thank you very much. I update my MathTeXEngine to version 0.5.3, then it works fine! :grin: