Can't get required css when I use tex2chtml and chtmlStylesheet in Node.js
Open
@dpvc is already working on this.
Since Aug 15, 2025.
Accepted
Investigate
v3
- Dominant language
- JavaScript
- Stars
- 10.9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Replace the text below with the details of the issue you are facing.
DO NOT simply erase the form and type a free-form response.
Issue Summary
Can't get required css when I use tex2chtml and chtmlStylesheet in Node.js
Steps to Reproduce:
- try to render Latex string \frac {25}{8} 800 2800
const MathJax = await mathjax.init({
chtml: {
fontURL: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/output/chtml/fonts/woff-v2/',
adaptiveCSS: true
}
loader: {load: ['input/tex', 'output/chtml']},
})
const chtml = await MathJax.tex2chtml('\\frac {25}{8} 800 2800');
const adaptor = MathJax.startup.adaptor;
const outerCSS = adaptor.textContent(MathJax.chtmlStylesheet());
const outerhtml = await adaptor.outerHTML(chtml);
- compared with css which output by web client,I found some css lines are missing:
mjx-c.mjx-c32::before {
padding: 0.666em 0.5em 0 0;
content: "2";
}
mjx-c.mjx-c35::before {
padding: 0.666em 0.5em 0.022em 0;
content: "5";
}
mjx-c.mjx-c38::before {
padding: 0.666em 0.5em 0.022em 0;
content: "8";
}
mjx-c.mjx-c30::before {
padding: 0.666em 0.5em 0.022em 0;
content: "0";
}
Any other information you want to share that is relevant to the issue
being reported. Especially, why do you consider this to be a bug? What
do you expect to happen instead?
Technical details:
- MathJax Version: 3.2.2
- Client OS: Mac OS X 13.4.1
- Nodejs: v16.18.0
Supporting information:
- Please supply a link to a (live) minimal example page, when possible.
- If your issue is with the display of the mathematics produced by MathJax, include a screen snapshot that illustrates the problem, when possible.
- Check your browser console window for any error messages, and include them here.
- Include the MathJax configuration you are using, and the script tag that loads MathJax itself.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.