mathjax / MathJax

Beautiful and accessible math in all browsers
http://www.mathjax.org/
Apache License 2.0
10.23k stars 1.16k forks source link

Can't get required css when I use tex2chtml and chtmlStylesheet in Node.js #3093

Open asd123freedom opened 1 year ago

asd123freedom commented 1 year ago

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:

  1. try to render Latex string \frac {25}{8} 800 2800
  2.     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);
  3. 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.
dpvc commented 1 year ago

OK, I can reproduce the issue you are seeing. If you add

  startup: {
    typeset: false
  }

to the configuration that you pass to the init() function, that should give you the full CSS. I'm still trying to locate exactly why that is needed, but for now that should let you get the CSS that you need.