diff --git a/services/web/frontend/js/features/source-editor/languages/latex/latex-language.ts b/services/web/frontend/js/features/source-editor/languages/latex/latex-language.ts index 968c31487f..aa19af3497 100644 --- a/services/web/frontend/js/features/source-editor/languages/latex/latex-language.ts +++ b/services/web/frontend/js/features/source-editor/languages/latex/latex-language.ts @@ -163,17 +163,8 @@ export const LaTeXLanguage = LRLanguage.define({ ) { types.push('$TextArgument') } - } else if ( - type.name.endsWith('Environment') && - !['NewEnvironment', 'RenewEnvironment'].includes(type.name) - ) { - types.push('$Environment') } else if (type.name.endsWith('Brace')) { types.push('$Brace') - } else if ( - ['BracketMath', 'ParenMath', 'DollarMath'].includes(type.name) - ) { - types.push('$MathContainer') } if (type.name in typeMap) { diff --git a/services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar b/services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar index c9c155deca..578ef52bdb 100644 --- a/services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar +++ b/services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar @@ -692,7 +692,7 @@ NonEmptyGroup { /// MATH MODE -DollarMath { +DollarMath[@isGroup="$MathContainer"] { Dollar (InlineMath | DisplayMath) Dollar } @@ -714,7 +714,7 @@ CloseParenMath[openedBy=OpenParenMath] { } // alternative syntax \( math \) for inline math, it is the same as $ math $ -ParenMath { +ParenMath[@isGroup="$MathContainer"] { OpenParenMath Math? CloseParenMath @@ -729,7 +729,7 @@ CloseBracketMath[openedBy=OpenBracketMath] { } // alternative syntax \[ math \] for display math, it is the same as $$ math $$ -BracketMath { +BracketMath[@isGroup="$MathContainer"] { OpenBracketMath Math? CloseBracketMath