This doesn’t exist yet and should probably be handled by MathTeXEngine.jl. I encourage you to open an issue in that repository if one doesn’t exist already.
Maybe I can help you with some hacky workaround code, though. You can offset each text in a vector of texts separately, and you can find out how much to offset by going into the GlyphCollections in the lower layer of the plot object and finding out where the first = is placed:
fig, ax, t = text([1, 1, 1], [1, 1, 1],
text = [
L"x = y",
L"x/y = 1",
L"\sum{x} = x \times y",
],
offset = [
Vec2f(0, 0),
Vec2f(0, -50),
Vec2f(0, -100),
],
fontsize = 25
)
gc_obs = t.plots[1][1]
gcs = gc_obs[]
eq_offsets = map(gcs) do gc
idx = findfirst(1:length(gc.glyphs)) do i
Makie.FreeTypeAbstraction.glyph_index(gc.fonts[i], '=') === gc.glyphs[i]
end
idx === nothing && error("Didn't find a '=' in a glyphcollection.")
return gc.origins[idx][1]
end
max_offset = maximum(eq_offsets)
new_offsets = max_offset .- eq_offsets
t.offset[] = [Vec2f(n, y) for (n, (x, y)) in zip(new_offsets, t.offset[])]
fig
This is just a proof of concept, the alignment would need to be adjusted as well and made automatic, but that’s how one could do it. The data structures used could also change at any time, they are not stable API.
