Change Latex font in Makie

Since I had the same problem a few days ago, I thought I’d share the theme snippet I ended up with, to make all non-latex text elements look similar to the latex ones:

using MathTeXEngine # required for texfont

textheme = Theme(fonts=(; regular=texfont(:text),
                        bold=texfont(:bold),
                        italic=texfont(:italic),
                        bold_italic=texfont(:bolditalic)))

with_theme(textheme) do
    fig = Figure(resolution=(400,300))
    ax = Axis(fig[1,1],
              title="foo",
              xlabel="whatever",
              ylabel=L"$\mathcal{H_\infty}$ Norm",
              xticks=(1:10, vcat(L"\sum i", repr.(2:10))))
    scatter!(ax, rand(10))
    fig
end

grafik