Skip to content

Commit c04db48

Browse files
nickkolokmarijnh
authored andcommitted
[stex mode] LaTeX-style inline math delimiters \( \) are parsed correctly
1 parent 97b03ae commit c04db48

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

mode/stex/stex.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@
117117
setState(state, function(source, state){ return inMathMode(source, state, "\\]"); });
118118
return "keyword";
119119
}
120+
if (source.match("\\(")) {
121+
setState(state, function(source, state){ return inMathMode(source, state, "\\)"); });
122+
return "keyword";
123+
}
120124
if (source.match("$$")) {
121125
setState(state, function(source, state){ return inMathMode(source, state, "$$"); });
122126
return "keyword";

mode/stex/test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@
111111
MT("inlineMath",
112112
"[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text");
113113

114+
MT("inlineMathLatexStyle",
115+
"[keyword \\(][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword \\)] other text");
116+
114117
MT("displayMath",
115118
"More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text");
116119

0 commit comments

Comments
 (0)