latex-lsp / tree-sitter-latex

LaTeX grammar for tree-sitter
MIT License
98 stars 24 forks source link

\big, \Big, \bigg, \Bigg, etc. break syntax highlighting. #84

Closed RobinTruax closed 1 year ago

RobinTruax commented 1 year ago

In Issue #58, a change was made to treat \big, \Big, \bigg, \Bigg, etc. as \left and \right do. This is not a good idea with regards to LaTeX syntax as it is very common (and syntactically valid) to use one of these alone (instead of in a pair), unlike extendible delimiters. For example, a common way to resize the "evaluated-at" bar for definite integration is to use \big|, \Big|, \bigg|, or \Bigg| -- and this bar only appears once.

Can this be changed? The entire document turns red otherwise, making the coloring unusable.

joaodefelipe commented 1 year ago

I'd also like to add that #58 is fundamentally at odds with how (La)TeX treats these commands: \big and friends insert Ord atoms, not Open/Close ones -- see the TeXbook, page 171. This means \big-style commands do not actually enclose anything. It's wrong to treat Ord atoms as enclosing ones.

While I understand the request, the correct solution for that usecase would be using \bigl and \bigr. That's why TeX has these two sets of commands in the first place.

pfoerster commented 1 year ago

Closing this issue (see #85). Thanks @joaodefelipe!