Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: substitute \mbox with \text (#8555)

Akshay Agrawal243a4b1434cb
diff --git a/frontend/src/plugins/layout/TexPlugin.tsx b/frontend/src/plugins/layout/TexPlugin.tsx
index 1099374874..cdd9483cb0 100644
--- a/frontend/src/plugins/layout/TexPlugin.tsx
+++ b/frontend/src/plugins/layout/TexPlugin.tsx
@@ -39,7 +39,10 @@ const importMhChem = once(async () => {
});
// Required, even if empty. (see https://github.com/KaTeX/KaTeX/issues/2513)
-const macros = {};
+const macros = {
+ // KaTeX doesn't support \mbox; map it to the equivalent \text
+ "\\mbox": "\\text{#1}",
+};
async function renderLatex(mount: HTMLElement, tex: string): Promise<void> {
const [katex] = await Promise.all([importKatex(), importMhChem()]);