[Makie] \widehat and \widetilde in xlabel

Here’s my code.

using CairoMakie
using LaTeXStrings

fig = Figure()

ax = Axis(fig[1,1], xlabel=L"\widehat{EE}")

fig

I got the following error message.

{
	"name": "MathTeXEngine.TeXParseError",
	"message": "TeXParseError: unexpected error
at position 2 (string index 2)
$\\widehat{EE}$
 ^
Stack
[4] TeXExpr :command
└─ \"\\\\widehat\"
[3] TeXExpr :inline_math
[2] TeXExpr :line
[1] TeXExpr :lines

",
	"stack": "TeXParseError: unexpected error
at position 2 (string index 2)
$\\widehat{EE}$
 ^
Stack
[4] TeXExpr :command
└─ \"\\\\widehat\"
[3] TeXExpr :inline_math
[2] TeXExpr :line
[1] TeXExpr :lines



Stacktrace:
  [1] texparse(tex::LaTeXString; root::MathTeXEngine.TeXExpr, showdebug::Bool)
    @ MathTeXEngine C:\\Users\\lcano\\.julia\\packages\\MathTeXEngine\\4yI25\\src\\parser\\parser.jl:195
  [2] texparse
    @ C:\\Users\\lcano\\.julia\\packages\\MathTeXEngine\\4yI25\\src\\parser\\parser.jl:113 [inlined]
  [3] generate_tex_elements(str::LaTeXString, font_family::MathTeXEngine.FontFamily)
    @ MathTeXEngine C:\\Users\\lcano\\.julia\\packages\\MathTeXEngine\\4yI25\\src\\engine\\layout.jl:320
  [4] generate_tex_elements
    @ C:\\Users\\lcano\\.julia\\packages\\MathTeXEngine\\4yI25\\src\\engine\\layout.jl:320 [inlined]
  [5] texelems_and_glyph_collection(str::LaTeXString, fontscale_px::Float32, halign::Symbol, valign::Symbol, rotation::Quaternionf, color::ColorTypes.RGBA{Float32}, strokecolor::ColorTypes.RGBA{Float32}, strokewidth::Int64, word_wrap_width::Int64)
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\basic_recipes\\text.jl:201
  [6] _get_glyphcollection_and_linesegments(latexstring::LaTeXString, index::Int64, ts::Float32, f::FreeTypeAbstraction.FTFont, fs::Attributes, al::Tuple{Symbol, Symbol}, rot::Quaternionf, jus::MakieCore.Automatic, lh::Float64, col::ColorTypes.RGBA{Float32}, scol::ColorTypes.RGBA{Float32}, swi::Int64, www::Int64, offs::Vec{2, Float32})
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\basic_recipes\\text.jl:111
  [7] (::Makie.var\"#push_args#2303\"{Vector{Int64}, Vector{ColorTypes.RGBA{Float32}}, Vector{Float32}, Vector{Point{2, Float32}}, Vector{Makie.GlyphCollection}})(::LaTeXString, ::Vararg{Any})
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\basic_recipes\\text.jl:46
  [8] (::Makie.var\"#2299#2302\"{Base.RefValue{Vector{Int64}}, Observable{Vector{ColorTypes.RGBA{Float32}}}, Observable{Vector{Float32}}, Observable{Vector{Point{2, Float32}}}, Observable{Vector{Makie.GlyphCollection}}})(str::LaTeXString, ts::Float64, f::Symbol, fs::Attributes, al::Tuple{Symbol, Symbol}, rot::Float32, jus::MakieCore.Automatic, lh::Float64, col::ColorTypes.RGBA{Float32}, scol::Tuple{Symbol, Float64}, swi::Int64, www::Int64, offs::Tuple{Float64, Float64})
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\basic_recipes\\text.jl:62
  [9] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@Kwargs{})
    @ Base .\\essentials.jl:892
 [10] invokelatest(::Any, ::Any, ::Vararg{Any})
    @ Base .\\essentials.jl:889
 [11] (::Observables.OnAny)(value::Any)
    @ Observables C:\\Users\\lcano\\.julia\\packages\\Observables\\YdEbO\\src\\Observables.jl:420
 [12] #invokelatest#2
    @ .\\essentials.jl:892 [inlined]
 [13] invokelatest
    @ .\\essentials.jl:889 [inlined]
 [14] notify(observable::Observables.AbstractObservable)
    @ Observables C:\\Users\\lcano\\.julia\\packages\\Observables\\YdEbO\\src\\Observables.jl:206
 [15] plot!(plot::MakieCore.Text{Tuple{Vector{Point{2, Float32}}}})
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\basic_recipes\\text.jl:83
 [16] connect_plot!(parent::Scene, plot::MakieCore.Text{Tuple{Vector{Point{2, Float32}}}})
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\interfaces.jl:380
 [17] plot!(scene::Scene, plot::MakieCore.Text{Tuple{Vector{Point{2, Float32}}}})
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\interfaces.jl:389
 [18] _create_plot!(F::Function, attributes::Dict{Symbol, Any}, scene::Scene, args::Observable{Point{2, Float32}})
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\figureplotting.jl:391
 [19] text!(::Scene, ::Vararg{Any}; kw::@Kwargs{text::Observable{Any}, fontsize::Observable{Any}, color::Observable{Any}, visible::Observable{Any}, align::Observable{Tuple{Symbol, Symbol}}, rotation::Observable{Float32}, font::Observable{Any}, markerspace::Symbol, inspectable::Bool})
    @ MakieCore C:\\Users\\lcano\\.julia\\packages\\MakieCore\\f3yyf\\src\\recipes.jl:440
 [20] Makie.LineAxis(parent::Scene, attrs::Attributes)
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\makielayout\\lineaxis.jl:391
 [21] #LineAxis#1572
    @ C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\makielayout\\lineaxis.jl:8 [inlined]
 [22] LineAxis
    @ C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\makielayout\\lineaxis.jl:6 [inlined]
 [23] initialize_block!(ax::Axis; palette::Nothing)
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\makielayout\\blocks\\axis.jl:319
 [24] initialize_block!(ax::Axis)
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\makielayout\\blocks\\axis.jl:150
 [25] _block(T::Type{Axis}, fig_or_scene::Figure, args::Vector{Any}, kwdict::Dict{Symbol, Any}, bbox::Nothing; kwdict_complete::Bool)
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\makielayout\\blocks.jl:371
 [26] _block
    @ C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\makielayout\\blocks.jl:291 [inlined]
 [27] #_block#1422
    @ C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\makielayout\\blocks.jl:259 [inlined]
 [28] _block(::Type{Axis}, ::GridPosition; kwargs::@Kwargs{xlabel::LaTeXString})
    @ Makie C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\makielayout\\blocks.jl:253
 [29] _block
    @ C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\makielayout\\blocks.jl:246 [inlined]
 [30] #_#1420
    @ C:\\Users\\lcano\\.julia\\packages\\Makie\\rEu75\\src\\makielayout\\blocks.jl:237 [inlined]
 [31] top-level scope
    @ c:\\Users\\lcano\\Documents\\test.ipynb:6"
}

The error is reproduced for \widetilde.

It seems like Makie is missing these features.

You could open an issue over at MathTeXEngine.jl, probably this could be added relatively simply if it’s just about a missing symbol mapping

Thank you for your reply. I have opened an issue.

TeXParseError: \widehat and \widetilde · Issue #122 · Kolaru/MathTeXEngine.jl (github.com)