Public
Edited
Jun 22, 2024
2 stars
Also listed in…
Math
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
MathJax = {
let MathJaxCHTML = await require("https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js").catch(
() => window["MathJax"]
);
delete window.MathJax;
let MathJaxSVG = await require("https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg-full.js").catch(
() => window["MathJax"]
);
return { MathJaxCHTML, MathJaxSVG };
}
Insert cell
{
// Multiple replace
const chars = {
a: "x",
b: "y",
c: "z"
};

let s = "234abc567bbbbac";
s = s.replace(/[abc]/g, (m) => chars[m]);
return s;
}
Insert cell
{
const subs = {
x: "{{}_{a}^{b}o^c_d}",
a: "{{}_{a}^{b}o_d}",
b: "{{}_{a}^{b}o^c}",
c: "{{}^{b}o^c_d}",
d: "{{}_{a}o^c_d}"
};
let s = "x";
for (let i = 0; i < 6; i++) {
s = s.replace(/[abcdx]/g, (r) => subs[r]);
}
let div = d3.create("div");
// .style("transform", "scale(0.4)");
div.append(() => tex`${s}`);
return div.node();
return tex`${s}`;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more