diff --git a/src/preview/math/mathpreviewlib/newcommandfinder.ts b/src/preview/math/mathpreviewlib/newcommandfinder.ts index f8f9efffe..46faf1af9 100644 --- a/src/preview/math/mathpreviewlib/newcommandfinder.ts +++ b/src/preview/math/mathpreviewlib/newcommandfinder.ts @@ -64,7 +64,7 @@ function parseAst(content: string, node: Ast.Node): string[] { lastContent = lastArg.content[lastArg.content.length - 1] } const end = (lastArg.content[lastArg.content.length - 1].position?.end.offset ?? -1 - closeBraceOffset) + closeBraceOffset - macros.push(content.slice(start, end + 1)) + macros.push(content.slice(start, end + 1).replaceAll(/\\providecommand([^a-zA-Z])/g, '\\newcommand$1')) } if ('content' in node && typeof node.content !== 'string') {