Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to insert new line #59

Closed
ForceBru opened this issue Apr 17, 2022 · 1 comment
Closed

Unable to insert new line #59

ForceBru opened this issue Apr 17, 2022 · 1 comment

Comments

@ForceBru
Copy link

This code latexstring("Hello\$\\\\\$World") is supposed to print text on two lines, which is correctly rendered in Jupyter Lab:

imgTeX

However, MathTeXEngine can't parse it:

using CairoMakie, LaTeXStrings
lines(1:10, axis=(title=latexstring("Hello\$\\\\\$World"), ))

Error:

TeXParseError: unexpected error while parsing
at position 2 (string index 2)
\\
 ^
Stack before
[1] TeXExpr :expr



Stacktrace:
  [1] texparse(data::String; showdebug::Bool)
    @ MathTeXEngine ~/.julia/packages/MathTeXEngine/ZP0gS/src/parser/parser.jl:277
  [2] texparse
    @ ~/.julia/packages/MathTeXEngine/ZP0gS/src/parser/parser.jl:267 [inlined]
  [3] _broadcast_getindex_evalf
    @ ./broadcast.jl:670 [inlined]
  [4] _broadcast_getindex
    @ ./broadcast.jl:643 [inlined]
  [5] _getindex
    @ ./broadcast.jl:666 [inlined]
  [6] _broadcast_getindex
    @ ./broadcast.jl:642 [inlined]
  [7] getindex
    @ ./broadcast.jl:597 [inlined]
  [8] copy
    @ ./broadcast.jl:899 [inlined]
  [9] materialize
    @ ./broadcast.jl:860 [inlined]
 [10] generate_tex_elements(str::LaTeXString, font_family::MathTeXEngine.FontFamily)
    @ MathTeXEngine ~/.julia/packages/MathTeXEngine/ZP0gS/src/engine/layout.jl:277
 [11] generate_tex_elements
    @ ~/.julia/packages/MathTeXEngine/ZP0gS/src/engine/layout.jl:271 [inlined]
 [12] texelems_and_glyph_collection(str::LaTeXString, fontscale_px::Float32, halign::Symbol, valign::Symbol, rotation::Quaternionf, color::Symbol, strokecolor::Tuple{Symbol, Float64}, strokewidth::Int64)
    @ Makie ~/.julia/packages/Makie/lgPZh/src/basic_recipes/text.jl:188
 [13] (::Makie.var"#995#1001")(latexstring::LaTeXString, ts::Float32, al::Tuple{Symbol, Symbol}, rot::Float64, mo::StaticArrays.SMatrix{4, 4, Float32, 16}, color::Symbol, scolor::Tuple{Symbol, Float64}, swidth::Int64, #unused#::Point2{Float64})
    @ Makie ~/.julia/packages/Makie/lgPZh/src/basic_recipes/text.jl:114
 [14] lift(::Function, ::Observable{LaTeXString}, ::Observable{Any}, ::Vararg{Observable{Any}}; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Makie ~/.julia/packages/Makie/lgPZh/src/interaction/observables.jl:30
 [15] lift(::Function, ::Observable{LaTeXString}, ::Observable{Any}, ::Observable{Any}, ::Vararg{Observable{Any}})
    @ Makie ~/.julia/packages/Makie/lgPZh/src/interaction/observables.jl:27
 [16] plot!(plot::MakieCore.Text{Tuple{LaTeXString}})
    @ Makie ~/.julia/packages/Makie/lgPZh/src/basic_recipes/text.jl:92
 [17] plot!(scene::Scene, P::Type{MakieCore.Text{Tuple{LaTeXString}}}, attributes::Attributes, input::Tuple{Observable{Any}}, args::Observable{Tuple{LaTeXString}})
    @ Makie ~/.julia/packages/Makie/lgPZh/src/interfaces.jl:401
 [18] plot!(scene::Scene, P::Type{MakieCore.Text}, attributes::Attributes, args::Observable{Any}; kw_attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Makie ~/.julia/packages/Makie/lgPZh/src/interfaces.jl:319
 [19] plot!
    @ ~/.julia/packages/Makie/lgPZh/src/interfaces.jl:287 [inlined]
 [20] #plot!#148
    @ ~/.julia/packages/Makie/lgPZh/src/interfaces.jl:270 [inlined]
 [21] text!(::Scene, ::Vararg{Any}; attributes::Base.Pairs{Symbol, Any, NTuple{8, Symbol}, NamedTuple{(:position, :visible, :textsize, :align, :font, :color, :space, :inspectable), Tuple{Observable{Point2{Float64}}, Observable{Any}, Observable{Any}, Observable{Tuple{Symbol, Symbol}}, Observable{Any}, Observable{Any}, Symbol, Bool}}})
    @ MakieCore ~/.julia/packages/MakieCore/A0hGm/src/recipes.jl:37
 [22] layoutable(::Type{Axis}, fig_or_scene::Figure; bbox::Nothing, kwargs::Base.Pairs{Symbol, LaTeXString, Tuple{Symbol}, NamedTuple{(:title,), Tuple{LaTeXString}}})
    @ Makie.MakieLayout ~/.julia/packages/Makie/lgPZh/src/makielayout/layoutables/axis.jl:328
 [23] #_layoutable#11
    @ ~/.julia/packages/Makie/lgPZh/src/makielayout/layoutables.jl:69 [inlined]
 [24] #_#9
    @ ~/.julia/packages/Makie/lgPZh/src/makielayout/layoutables.jl:49 [inlined]
 [25] plot(P::Type{Lines}, args::UnitRange{Int64}; axis::NamedTuple{(:title,), Tuple{LaTeXString}}, figure::NamedTuple{(), Tuple{}}, kw_attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Makie ~/.julia/packages/Makie/lgPZh/src/figureplotting.jl:32
 [26] #lines#31
    @ ~/.julia/packages/MakieCore/A0hGm/src/recipes.jl:33 [inlined]
 [27] top-level scope
    @ In[186]:1
 [28] eval
    @ ./boot.jl:368 [inlined]
 [29] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1277

Is this not how I should be inserting new lines?

@ForceBru
Copy link
Author

Oops, dupe of this (#18), sorry

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

No branches or pull requests

1 participant