LaTeX

Makie can render LaTeX strings from the LaTeXStrings.jl package using MathTeXEngine.jl.

While this engine is responsive enough for use in GLMakie, it only supports a subset of LaTeX's most used commands.

Using L-strings

You can pass LaTeXString objects to almost any object with text labels. They are constructed using the L string macro prefix. The whole string is interpreted as an equation if it doesn't contain an unescaped $.

using CairoMakie

f = Figure(fontsize = 18)

Axis(f[1, 1],
    title = L"\forall \mathcal{X} \in \mathbb{R} \quad \frac{x + y}{\sin(k^2)}",
    xlabel = L"\sum_a^b{xy} + \mathscr{L}",
    ylabel = L"\sqrt{\frac{a}{b}} - \mathfrak{W}"
)

f

You can also mix math-mode and text-mode. For string interpolation use %$instead of $:

using CairoMakie

f = Figure(fontsize = 18)
t = "text"
Axis(f[1,1], title=L"Some %$(t) and some math: $\frac{2\alpha+1}{y}$")

f