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 7fa86ac275..ffa0b6299c 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 @@ -135,7 +135,7 @@ export const LaTeXLanguage = LRLanguage.define({ ['UsePackage'], ['FigureEnvironment', 'BeginEnv'], ], - ShortTextArgument: [['Date']], + ShortTextArgument: [['Date'], ['SetLengthCommand']], TextArgument: [['TabularEnvironment', 'BeginEnv']], }), // TODO: does this override groups defined in the grammar? 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 f3f21326a8..c9c155deca 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 @@ -107,7 +107,8 @@ TextSubscriptCtrlSeq, TextStrikeOutCtrlSeq, EmphasisCtrlSeq, - UnderlineCtrlSeq + UnderlineCtrlSeq, + SetLengthCtrlSeq } @external specialize {EnvName} specializeEnvName from "./tokens.mjs" { @@ -406,6 +407,9 @@ KnownCommand { } | UnderlineCommand { UnderlineCtrlSeq ArgumentType + } | + SetLengthCommand { + SetLengthCtrlSeq optionalWhitespace? ShortTextArgument optionalWhitespace? ShortTextArgument } } diff --git a/services/web/frontend/js/features/source-editor/lezer-latex/tokens.mjs b/services/web/frontend/js/features/source-editor/lezer-latex/tokens.mjs index 2167923a8d..933f2fc9a9 100644 --- a/services/web/frontend/js/features/source-editor/lezer-latex/tokens.mjs +++ b/services/web/frontend/js/features/source-editor/lezer-latex/tokens.mjs @@ -98,6 +98,7 @@ import { TextStrikeOutCtrlSeq, EmphasisCtrlSeq, UnderlineCtrlSeq, + SetLengthCtrlSeq, } from './latex.terms.mjs' const MAX_ARGUMENT_LOOKAHEAD = 100 @@ -603,6 +604,7 @@ const otherKnowncommands = { '\\sout': TextStrikeOutCtrlSeq, '\\emph': EmphasisCtrlSeq, '\\underline': UnderlineCtrlSeq, + '\\setlength': SetLengthCtrlSeq, } // specializer for control sequences // return new tokens for specific control sequences