Kolaru / MathTeXEngine.jl

A latex math mode engine in pure Julia.
MIT License
96 stars 20 forks source link

varepsilon? #35

Closed briochemc closed 3 years ago

briochemc commented 3 years ago

I'm not sure if this is a duplicate of some deeper issue, but here is a minimal example that throws (MathTeXEngine v0.2.1):

julia> texparse(L"\varepsilon")
ERROR: TeXParseError: unexpected error while parsing
at position 13 (string index 13)
$\varepsilon$
            ^
Stack before
[1] TeXExpr :expr
└─ TeXExpr :char
   └─ '$'

Stacktrace:
 [1] texparse(data::LaTeXString; showdebug::Bool)
   @ MathTeXEngine ~/.julia/packages/MathTeXEngine/ZP0gS/src/parser/parser.jl:277
 [2] texparse(data::LaTeXString)
   @ MathTeXEngine ~/.julia/packages/MathTeXEngine/ZP0gS/src/parser/parser.jl:267
 [3] top-level scope
   @ REPL[6]:1

caused by: TeXParseError: unsupported command \varepsilon
at position 13 (string index 13)
$\varepsilon$
            ^
Stack before
[1] TeXExpr :expr
└─ TeXExpr :char
   └─ '$'

Stacktrace:
 [1] _end_command_builder!(stack::DataStructures.Stack{Any}, p::Int64, data::LaTeXString)
   @ MathTeXEngine ~/.julia/packages/MathTeXEngine/ZP0gS/src/parser/parser.jl:230
 [2] macro expansion
   @ ~/.julia/packages/MathTeXEngine/ZP0gS/src/parser/parser.jl:253 [inlined]
 [3] macro expansion
   @ ~/.julia/packages/Automa/1KOLQ/src/codegen.jl:153 [inlined]
 [4] texparse(data::LaTeXString; showdebug::Bool)
   @ MathTeXEngine ~/.julia/packages/MathTeXEngine/ZP0gS/src/parser/parser.jl:275
 [5] texparse(data::LaTeXString)
   @ MathTeXEngine ~/.julia/packages/MathTeXEngine/ZP0gS/src/parser/parser.jl:267
 [6] top-level scope
   @ REPL[6]:1

Is there an easy fix?

greimel commented 3 years ago

I would like that to work as well :-)

Kolaru commented 3 years ago

There was multiple issues there. But it comes down mostly to the fun fact you can write this symbol as \upepsilon too.

Also MathTeXEngine should handle unicode input gracefully, so if Julia unicode completion support it you can input the symbol you want directly.