From db2fe61a204d4accf4717035d1727fadd2d4e881 Mon Sep 17 00:00:00 2001 From: Tim Down <158919+timdown@users.noreply.github.com> Date: Fri, 12 Jun 2026 09:45:48 +0100 Subject: [PATCH] Merge pull request #34373 from overleaf/td-latex-parser-relax-text-restriction Allow ^ and _ in text nodes by default in LaTeX grammar GitOrigin-RevId: 9e94d86f7a0540431eb28d29c0fa79a0ea889855 --- .../js/features/source-editor/lezer-latex/latex.grammar | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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 6d32df371a..45c0271825 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 @@ -143,7 +143,7 @@ Whitespace { $[ \t]+ } NewLine { "\n" } BlankLine { "\n" "\n"+ } - Normal { ![\\{}\[\]$&~#^_% \t\n] ![\\{}\[\]$&~#^_%\t\n]* } // everything is normal text, except these characters + Normal { ![\\{}\[\]$&~#% \t\n] ![\\{}\[\]$&~#%\t\n]* } // everything is normal text, except these characters @precedence { CtrlSeq, CtrlSym, BlankLine, NewLine, Whitespace, Normal } OpenBrace[closedBy=CloseBrace] { "{" } @@ -528,7 +528,6 @@ LongArg { | Environment | BlankLine | "#" // macro character - | "_" | "^" // other math chars )* } @@ -540,7 +539,6 @@ ShortArg { ( textWithBrackets | NonEmptyGroup | "#" // macro character - | "_" | "^" // other math chars )* } @@ -548,7 +546,6 @@ ShortOptionalArg { ( textBase | NonEmptyGroup | "#" // macro character - | "_" // underscore is used in some parameter names )* } @@ -556,7 +553,6 @@ TikzPictureContent { /// same as Text but with added allowed characters ( textWithEnvironmentsAndBlankLines | NonEmptyGroup | "#" // macro character - | "_" | "^" // other math chars )+ } @@ -581,7 +577,6 @@ DefinitionFragment { | "#" // macro character | Ampersand // for tables | Tilde // unbreakable space - | "_" | "^" // other math chars | SectioningCommand< BookCtrlSeq | PartCtrlSeq |