diff --git a/Project.toml b/Project.toml index 0b4ebefb..45d54ec7 100644 --- a/Project.toml +++ b/Project.toml @@ -12,6 +12,7 @@ FixedPointNumbers = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71" GeometryTypes = "4d00f742-c7ba-57c2-abde-4428a4b178cb" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Measures = "442fdcdd-2543-5da2-b0f3-8c86c306513e" NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" @@ -37,6 +38,7 @@ FixedPointNumbers = "0.6, 0.7, 0.8" GR = "0.46, 0.47, 0.48" GeometryTypes = "0.7, 0.8" JSON = "0.21" +LaTeXStrings = "1" Measures = "0.3" NaNMath = "0.3" PGFPlotsX = "1.2.0" diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index 672636c6..3cb2673b 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -1,4 +1,5 @@ using Contour: Contour +using LaTeXStrings using UUIDs Base.@kwdef mutable struct PGFPlotsXPlot is_created::Bool = false @@ -900,6 +901,12 @@ function pgfx_sanitize_string(s::AbstractString) s = replace(s, r"\\?\%" => "\\%") s = replace(s, r"\\?\_" => "\\_") s = replace(s, r"\\?\&" => "\\&") + s = replace(s, r"\\?\{" => "\\{") + s = replace(s, r"\\?\}" => "\\}") +end +function pgfx_sanitize_string(s::LaTeXString) + s = replace(s, r"\\?\#" => "\\#") + s = replace(s, r"\\?\%" => "\\%") end function pgfx_sanitize_plot!(plt) for (key, value) in plt.attr