Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big operator in subscript #3321

Open
Tragicus opened this issue Jan 2, 2025 · 4 comments
Open

Big operator in subscript #3321

Tragicus opened this issue Jan 2, 2025 · 4 comments
Labels
Accepted Issue has been reproduced by MathJax team Code Example Contains an illustrative code example, solution, or work-around v3

Comments

@Tragicus
Copy link

Tragicus commented Jan 2, 2025


Issue Summary

Typesetting \[a_{\sum_b c}\] produces an error Uncaught (in promise) TypeError: o is null.

Steps to Reproduce:

Compiling the following LaTeX file

\documentclass{article}
\begin{document}
\[a_{\sum_b c}\]
\end{document}

with make4ht test.tex "mathjax,mathml" produces the following html file

<!DOCTYPE html> 
<html lang='en-US' xml:lang='en-US'> 
<head><title></title> 
<meta charset='utf-8' /> 
<meta content='TeX4ht (https://tug.org/tex4ht/)' name='generator' /> 
<meta content='width=device-width,initial-scale=1' name='viewport' /> 
<link href='test.css' rel='stylesheet' type='text/css' /> 
<meta content='test.tex' name='src' /> 
 <script async='async' id='MathJax-script' src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/mml-chtml.js' type='text/javascript'></script>  
</head><body>
   <div class='par-math-display'><!-- l. 5 --><math display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mrow>
                                                <msub><mrow><mi>a</mi></mrow><mrow><munder class='msub'><mrow><mtext>∑</mtext></mrow><mrow>
<mi>b</mi></mrow></munder><mi>c</mi></mrow></msub>
</mrow></math></div>
<!-- l. 5 --><p class='nopar'>
</p>
    
</body> 
</html>

Note that removing any of the symbols produces a correct output.

Technical details:

  • MathJax Version: 3.2
  • Client OS: Kubuntu 24.04
  • Browser: Firefox 133.0.3

I am using the following MathJax configuration: ?

MathJax = { ?
...
};

and loading MathJax via

<script async='async' id='MathJax-script' src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/mml-chtml.js' type='text/javascript'></script> 

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
Copy link
Member

dpvc commented Jan 2, 2025

I can't reproduce the error message, as the file you provide renders properly for me on MacOS with Firefox 133.0.3, and Safari 18.2, and Chrome 131.0.6778.205.

Is the error you are getting in the console window? If so, can you provide the complete traceback as well?

@Tragicus
Copy link
Author

Tragicus commented Jan 2, 2025

Ah, if that comes from a configuration issue on my side, it might be easy to solve, although I do not know what to look for.
I indeed got the error in the console window, here is the traceback:

findChildText                        complexity.js:1
collapse                             complexity.js:1
check                                complexity.js:1
setComplexity                        complexity.js:1
visitDefault                         complexity.js:1
visitNode                            mml-chtml.js:formatted:12663
visitNode                            complexity.js:1
visitDefault                         mml-chtml.js:formatted:12671
visitMsubsupNode                     complexity.js:1
visitMsubNode                        complexity.js:1
visitNode                            mml-chtml.js:formatted:12663
visitNode                            complexity.js:1
visitDefault                         mml-chtml.js:formatted:12671
childrenComplexity                   complexity.js:1
visitDefault                         complexity.js:1
visitNode                            mml-chtml.js:formatted:12663
visitNode                            complexity.js:1
visitDefault                         mml-chtml.js:formatted:12671
childrenComplexity                   complexity.js:1
visitDefault                         complexity.js:1
visitNode                            mml-chtml.js:formatted:12663
visitNode                            complexity.js:1
visitDefault                         mml-chtml.js:formatted:12671
childrenComplexity                   complexity.js:1
visitDefault                         complexity.js:1
visitNode                            mml-chtml.js:formatted:12663
visitNode                            complexity.js:1
visitTree                            mml-chtml.js:formatted:12657
visitTree                            complexity.js:1
a                                    complexity.js:1
complexity                           complexity.js:1
complexity                           complexity.js:1
m                                    mml-chtml.js:formatted:2661
renderDoc                            mml-chtml.js:formatted:2679
render                               mml-chtml.js:formatted:2893
typesetPromise                       mml-chtml.js:formatted:1771
e                                    mml-chtml.js:formatted:52258
e                                    mml-chtml.js:formatted:52262
promise callback*e                   mml-chtml.js:formatted:52261
handleRetriesFor                     mml-chtml.js:formatted:52254
typesetPromise                       mml-chtml.js:formatted:1770
defaultPageReady                     mml-chtml.js:formatted:1996
defaultReady                         mml-chtml.js:formatted:1987
promise callback*2388/t.defaultReady mml-chtml.js:formatted:1986
defaultReady                         mml-chtml.js:formatted:1131
<anonymous>                          mml-chtml.js:formatted:77458
promise callback*                    mml-chtml.js:formatted:77457
<anonymous>                          mml-chtml.js:formatted:77462
<anonymous>                          mml-chtml.js:formatted:77463

@dpvc
Copy link
Member

dpvc commented Jan 3, 2025

Ah, that is helpful. It indicates that the problem is occurring during the complexity computation used for collapsible math as part of the assistive tools. I am able to reproduce if I turn that on. For now, can you turn that off in the MathJax contextual menu? If you are not able to access that menu, you can use localStorage.clear() in the developer console to reset the menu settings to their defaults.

I don't know if tex4ht allows you to give a custom MathJax configuration or not, but if it does, you could use

MathJax = {
  loader: {load: ['a11y/complexity']},
  startup: {
    ready() {
      const {Collapse} = MathJax._.a11y.complexity.collapse;
      class MyCollapse extends Collapse {
        findChildText(node, id) {
          if (id === '') return '';
          return super.findChildText(node, id);
        }
      }
      MathJax.config.options.Collapse = MyCollapse;
      MathJax.startup.defaultReady();
    }
  }
};

which works around the cause of the issue (the id being empty, which shouldn't happen, but does in this case).

@dpvc dpvc added Accepted Issue has been reproduced by MathJax team Code Example Contains an illustrative code example, solution, or work-around and removed Cannot Reproduce labels Jan 3, 2025
@Tragicus
Copy link
Author

Tragicus commented Jan 3, 2025

Great ! I could not test the first workaround (due to a lack of knowledge on my part), but the other two do work. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Code Example Contains an illustrative code example, solution, or work-around v3
Projects
None yet
Development

No branches or pull requests

2 participants