Skip to content

Conversation

@manuelbb-upb
Copy link
Contributor

Tackle one of the problems in #61, i.e., spacing around symbols that by default represent binary operators but can have unary meaning too.
Old tests succeed even with this heuristic enabled; there are some new tests.

using GLMakie
using LaTeXStrings
import MathTeXEngine as MTE
Z = rand(2, 10)

function test_fig(unspace=true)
    global Z
    MTE.UNSPACE_BINARY_OPERATORS_HEURISTIC[] = unspace
    fig = Figure(; size=(480,480))
    Label(fig[0,1], "unspace=$(unspace)"; fontsize=10)
    s=L"$-1, 2-1, (-1), (2-1)+1$\\\\$\frac{1}{2}\pm\sqrt{3}\mp 1$\\\\$\frac{1}{2}{}\pm\sqrt{3}{}\mp 1$\\\\$ℯ^{-1},ℯ^{2-1}ℯ^\pm$"
    Label(fig[1,1], s; fontsize=40)
    
    return fig    
end

fig1 = test_fig(true)
save(joinpath(@__DIR__, "fig_unspaced.png"), fig1)
fig2 = test_fig(false)
save(joinpath(@__DIR__, "fig_spaced.png"), fig2)
fig_unspaced fig_spaced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant