## Bracket Matching broken in Latex math mode

### Bracket Matching broken in Latex math mode

Hi everybody,

I noticed that bracket matching is not working in LaTeX math mode (for example between $...$).
I guess this is connected to the fact that math mode is a sub-scope of string (string.other.math.tex)...
however math mode has very different "use-cases" than strings.
I could just go in the language definition and change the scope assignment but I do not know if this could break other things.
Any ideas on the best way of solving the problem? What would a better substitute for string as a scope?

Thanks!
judecrot

Posts: 8
Joined: Sat Jun 30, 2012 10:28 pm

### Re: Bracket Matching broken in Latex math mode

I have run into the same problem like you and I'm wondering if there is a fix
for this coming anytime soon?

Greets Janick
ph03

Posts: 3
Joined: Tue Jul 24, 2012 9:07 pm

### Re: Bracket Matching broken in Latex math mode

Any luck on solving this problem? Not only does highlighting not work between "", it doesn't work in equation/align either.
AGS

Posts: 32
Joined: Mon Aug 20, 2012 5:58 pm

### Re: Bracket Matching broken in Latex math mode

Sorry to exhume such an old thread but this problem really annoyed me and I did not see any update on it.

judecrot's suggestion to change the scope type in the tmLanguage files does work but breaks compatibility with other packages such as LaTeXTools.

A safer solution is to use the BracketHighlighter package. Since version 2 basic bracket highlighting in math mode is built-in. However it will by default (in the current latest version) only work in math environments such as "equation" "align" ,etc. It will not work in simple math mode delimited by $...$. The easy fix is to modify the settings file for the package and replace every occurrence of "string.other.math.block.environment.latex" by "string.other.math".

It is also fairly easy to adapt the bracket matching to LaTeX cases where sequences such as "\{" should be ignored, or to add highlighting for \begin{..} \end{..} constructs.
kragol

Posts: 2
Joined: Tue Sep 04, 2012 5:27 pm

### Re: Bracket Matching broken in Latex math mode

Hey

Just got bitten by this in Sublime 3
Not good for someone that got convinced just yesterday to buy it

Any known fix?

Thanks
Alberto
ambs

Posts: 5
Joined: Thu Nov 28, 2013 7:52 pm