diff --git a/packages/doenetml-worker/src/test/tagSpecific/label.test.ts b/packages/doenetml-worker/src/test/tagSpecific/label.test.ts
index a73017cff..df84196c0 100644
--- a/packages/doenetml-worker/src/test/tagSpecific/label.test.ts
+++ b/packages/doenetml-worker/src/test/tagSpecific/label.test.ts
@@ -18,8 +18,8 @@ describe("Label tag tests", async () => {
doenetML: `
-
-
+
+
@@ -31,12 +31,12 @@ describe("Label tag tests", async () => {
const stateVariables = await returnAllStateVariables(core);
let l1 = "Hello";
let l2 = "Hello";
- let l3Latex = "\\left(x^2,\\frac{y^2}{z^2}\\right)";
+ let l3Latex = "\\left(x_2 y_{2.1},\\frac{y^2}{z^{2.1}}\\right)";
let l3Value = `\\(${l3Latex}\\)`;
- let l3Text = "( x², (y²)/(z²) )";
- let l4Latex = "\\left( a^{2}, \\frac{b^{2}}{c^{2}} \\right)";
+ let l3Text = "( x₂ y_2.1, (y²)/(z^2.1) )";
+ let l4Latex = "\\left( a_{2} b_{2.1}, \\frac{b^{2}}{c^{2.1}} \\right)";
let l4Value = `\\(${l4Latex}\\)`;
- let l4Text = "( a², (b²)/(c²) )";
+ let l4Text = "( a₂ b_2.1, (b²)/(c^2.1) )";
let l5 = "1";
let l6Latex = "2";
let l6Value = `\\(${l6Latex}\\)`;
diff --git a/packages/doenetml-worker/src/utils/math.ts b/packages/doenetml-worker/src/utils/math.ts
index e99925380..5e1effaf4 100644
--- a/packages/doenetml-worker/src/utils/math.ts
+++ b/packages/doenetml-worker/src/utils/math.ts
@@ -850,9 +850,9 @@ export function superSubscriptsToUnicode(text: string) {
return newVal;
}
- text = text.replace(/_(\d+)/g, replaceSubscripts);
+ text = text.replace(/_(\d+)(?!\.)/g, replaceSubscripts);
text = text.replace(/_\(([\d +-]+)\)/g, replaceSubscripts);
- text = text.replace(/\^(\d+)/g, replaceSuperscripts);
+ text = text.replace(/\^(\d+)(?!\.)/g, replaceSuperscripts);
text = text.replace(/\^\(([\d +-]+)\)/g, replaceSuperscripts);
return text;