From 19b70c06ff49e5cc3470679ab2acd8da5c669961 Mon Sep 17 00:00:00 2001 From: Josef Heinen Date: Fri, 29 Oct 2021 15:22:37 +0200 Subject: [PATCH] Update gr.jl Use new text functionality. GR v0.62+ can handle multiline strings and inline math expressions. --- src/backends/gr.jl | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 9cbd5e79..d7a0b7e6 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -228,9 +228,7 @@ end gr_inqtext(x, y, s) = gr_inqtext(x, y, string(s)) function gr_inqtext(x, y, s::AbstractString) - if length(s) >= 2 && s[1] == '$' && s[end] == '$' - GR.inqmathtex(x, y, s[2:(end - 1)]) - elseif occursin('\\', s) || occursin("10^{", s) + if (occursin('\\', s) || occursin("10^{", s)) && match(r".*\$[^\$]+?\$.*", s) == nothing GR.inqtextext(x, y, s) else GR.inqtext(x, y, s) @@ -240,9 +238,7 @@ end gr_text(x, y, s) = gr_text(x, y, string(s)) function gr_text(x, y, s::AbstractString) - if length(s) >= 2 && s[1] == '$' && s[end] == '$' - GR.mathtex(x, y, s[2:(end - 1)]) - elseif occursin('\\', s) || occursin("10^{", s) + if (occursin('\\', s) || occursin("10^{", s)) && match(r".*\$[^\$]+?\$.*", s) == nothing GR.textext(x, y, s) else GR.text(x, y, s)