Sublime Forum

Suggested Patch To LaTeX.sublime-syntax

#1

I don’t know how to offer a suggested patch to the developers regarding an builtin package (I mean I can override this in the packages directory but it really should be fixed for everyone) and this seemed like the best place to make the suggestion. Let me know if I should post this elsewhere.

In particular, the default LaTeX.sublime-syntax file recognizes old-school math delimiters $ $ but not the new style ( ). It should recognize both. This is a minimal change that should take someone about 5 minutes to review.

diff --git a/LaTeX.sublime-syntax b/LaTeX.sublime-syntax
index 060a847..3660705 100644
--- a/LaTeX.sublime-syntax
+++ b/LaTeX.sublime-syntax
@@ -455,9 +455,7 @@ contexts:
         - include: math-content

     - match: (\\\()
-      scope: string.other.math.latex
-      captures:
-        1: punctuation.definition.string.begin.latex
+      scope: string.other.math.latex punctuation.definition.string.begin.latex
       push:
         - meta_scope: meta.environment.math.inline.paren.latex
         - match: (\\\))
0 Likes

#2

There is a dedicated repo on github for built-in syntaxes.

0 Likes

#3

Thanks somehow I couldn’t find that…deleting thread. Though apparently I just deleted my post.

0 Likes

#4

For me \( and \) as inline math delimiters work fine with the default syntax.
screenshot
From the diff code block in your opening post, I also see nothing that would be changed, because it applies the exact same scope to \( than before. Are you sure to really use \( and \) as math delimiters and not only parenthesis ( and ) in your LaTeX document?

0 Likes

#5

Does that still work for you if your cursor is inside the \( \). It’s been awhile but I believe that was the issue I had (tho probably fixed in new version anyway now).

0 Likes

#6

latex

Still looks fine to me. Do you have a minumum examle or screenshot that shows any unexpected behavior?

0 Likes