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

Switch to Mathjax 3 #1706

Open
ktarplee opened this issue Jan 20, 2022 · 3 comments
Open

Switch to Mathjax 3 #1706

ktarplee opened this issue Jan 20, 2022 · 3 comments

Comments

@ktarplee
Copy link

MathJax 3 is superior to MathJax 2 in every way so why not upgrade. MathJax 3 renders the math much faster. It is also smaller. MathJax 2.7.7 is ~177 MB while MathJax 3.2.0 is only 17 MB. When dockerizing

Simply change the MathJax config (in the HTML template) to support MathJax 3 and switch the default URl to MathJax 3.

It is not possible to simply change the mathjax_url to point to MathJax 3 since the config for MathJax 2 is incompatible with MathJax 3.

@ktarplee
Copy link
Author

The new mathjax.html.j2 template looks like this

{%- macro mathjax(url="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js") -%}
    <!-- Load mathjax -->
    <script src="{{url}}"> </script>
    <script type="text/javascript" id="MathJax-script" async
        src="{{url}}">
    </script>
    <!-- MathJax configuration -->
    <script id=MathJax-configuration>
    window.MathJax = {
        tex: {
            tags: "ams",
            useLabelIds: true,
            inlineMath: [ ['$','$'], ["\\(","\\)"] ],
            displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
            processEscapes: true,
            processEnvironments: true
        }
    };
    </script>
    <!-- End of mathjax configuration -->
{%- endmacro %}

I tested it with nbconvert 6.4 and it works.

@bollwyvl
Copy link
Contributor

Some context here jupyterlab/jupyterlab#7218

We'd want to do a roll out of an updated default mathjax major version across JupyterLab, Jupyter Notebook and nbconvert at the same time.

There's nothing stopping folks today from using newer versions, e.g. mathjax3-extension so a standalone nbconvert-mathjax3 might be a good place to evaluate this.

@lorentzenchr
Copy link

Any update here? Now that jupyterlab/jupyterlab#13877 is merged, i.e. Jupyterlab v4 uses Mathjax v3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants