stefano-meschiari / latex2exp

Use LaTeX in R graphics.
Other
185 stars 10 forks source link

Error when rendering math outside of math mode #45

Closed stefano-meschiari closed 2 years ago

stefano-meschiari commented 2 years ago

This throws an error:

> TeX(r"(\alpha+\beta)")
Error in TeX("\\alpha+\\beta") : 
  Error while converting LaTeX into valid plotmath.
Original string: \alpha+\beta
Parsed expression: alpha+*beta
Error in str2expression(rendered) : <text>:1:7: unexpected '*'
1: alpha+*

while this doesn't:

> TeX(r"($\alpha+\beta$)")
   LaTeX: $\alpha+\beta$ 
plotmath: alpha + beta 

They should be equivalent.