diff --git a/Project.toml b/Project.toml index 55fefa4c..fc460751 100644 --- a/Project.toml +++ b/Project.toml @@ -13,6 +13,7 @@ GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71" GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" GeometryTypes = "4d00f742-c7ba-57c2-abde-4428a4b178cb" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Measures = "442fdcdd-2543-5da2-b0f3-8c86c306513e" NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index bf469525..01b488f3 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -1,5 +1,6 @@ using Contour: Contour using UUIDs +using Latexify Base.@kwdef mutable struct PGFPlotsXPlot is_created::Bool = false was_shown::Bool = false @@ -1040,6 +1041,9 @@ function pgfx_sanitize_string(s::AbstractString) s = replace(s, r"\\?\&" => "\\&") s = replace(s, r"\\?\{" => "\\{") s = replace(s, r"\\?\}" => "\\}") + s = map(split(s, "")) do s + isascii(s) ? s : latexify(s) + end |> join end @require LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" begin using .LaTeXStrings