JuliaPlots / MakieTeX.jl

TeX integration in Makie
MIT License
86 stars 12 forks source link

add `tex_annotation!()` #43

Open Moelf opened 1 year ago

Moelf commented 1 year ago
julia> using CairoMakie, MakieTex

julia> MakieTeX.CURRENT_TEX_ENGINE[] = `tectonic`

julia> function main()
           f,a,_ = plot(1:3, 1:3)
           MakieTeX.tex_annotation!(a, L"\sqrt{s} = 13~\text{TeV}", 1.5, 1.5;
           scale_factor=2)

           MakieTeX.tex_annotation!(a, L"\sqrt{s} = 13~\text{TeV}", 2.5, 2.5;
           mainfont="DejaVu Sans",
           scale_factor=2.5)

           MakieTeX.tex_annotation!(a, L"\sqrt{s} = 13~\text{TeV}", 1.5, 1.4;
                  mathfont="Nimbus Sans",
                  scale_factor=2)
           CairoMakie.save("/tmp/jl_onm7cZSLiJ.png", f)
       end

image

for #36

Moelf commented 1 year ago

user needs to have font installed, on linux, check fc-list

Moelf commented 1 year ago

you can use https://tug.org/FontCatalogue/ to find fonts with math support. https://ctan.org/pkg/tex-gyre-heros?lang=en by the look of it, it's basically Nimbus, but yeah we can default to it. And in that case a good math font is probably https://tug.org/FontCatalogue/urwnimbusroman/

Moelf commented 8 months ago

Bump?