bracket highlighting not working in math environnement
Closed this issue · 8 comments
In environnement like align, it seems that the bracket matcher does not work anymore. I tried to find a option to modify but I could not find any. Is this a bug from this package ?
@PierreMarchand20 Here is my (closed) GitHub issue about this in Atom's bracket-matcher
repo: atom/bracket-matcher#293
Thank you for the reference. From what I understood it is due to the fact that bracket matching is not working in strings, but then why what is written inside a align environnement is considered as a string ?
I am not sure people will be willing to allow bracket matching in strings anyway (see atom/bracket-matcher#253), so may be there is something to do to avoid align and equation environnements as strings ?
This package scopes a math environment (like the $$ one) as "string.other.math.block.tex". This means a package like the bracket matcher will look from left to right and see that it is a string, so brackets don't get matched.
On a separate note, what about constructions like (a,b] in maths (intervals)? You don't want these brackets being used for matches, as they actually match each other. So I agree with the current setup: brackets in maths should not be matched.
Do you still have an issue with this behaviour? I can't think of any reasonable solution, given the possibility of non matching brackets, other than writing your own rules to treat the align environment differently. Otherwise, please close.
Rethinking about this, I think it would be better to have the bracket matcher working in math environnement. I think it is way more common to use latex commands such as \mathbb{}
or \dfrac{}{}
etc. and it can be really useful to have the bracket matcher working when using a lot to these commands. Example:
\begin{align*}
\chi_p(\mathbf{x}_j):= \dfrac{\operatorname{dist}(\mathbf{x}_j, \partial \widetilde{\Omega}_p)}{\sum_{k\in \mathcal{N}(\mathbf{x}_j) } \operatorname{dist}(\mathbf{x}_j,\partial \widetilde{\Omega}_k)} \quad \text{at all nodes } \mathbf{x}_j,
\end{align*}
It is pretty nice to have the bracket matcher when you miss one in complex expressions like the one before, which is more common than using ")a,b[", I think.
That being said, another issue it would raise is when using \left\{
with \right.
...
Thanks @yudai-nkt this PR fixes my issues with bracket-matcher.
I agree it is a better design to scope math mode into something else than a string.
Thank you for your answer @yudai-nkt . I will close this issue when version 2 will be available then.