stefano-meschiari / latex2exp

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

Square brakets apparently need to be escaped #48

Closed alusiani closed 1 year ago

alusiani commented 2 years ago

Hi,

thanks for this very useful package!

I notice that apparently square brakets need to be escaped to prevent being ignored, together with whatever is enclosed.

plot(TeX(r"($a [b]$)"))

just shows "a", while

plot(TeX(r"($a \[b\]$)"))

shows "a[b]"

It would be nicer that square brakets be treated as in LaTeX without a dedicated escaping.

Greetings!

Alberto

alarsyo commented 2 years ago

Additionally, using square brackets seems to break subscript and superscript syntax:

plot(TeX(r"(a $\[b\]_{c}$)"))

shows "a[b]"

plot(TeX(r"(a $\[b\]^{c}$)"))

shows "a[b]" as well