Problem with Mathjax extensions in eXeLearning

29 views
Skip to first unread message

Iván Sánchez Pereira

unread,
Jan 20, 2023, 6:44:03 PM1/20/23
to MathJax Users
Hello!

I've written this script to use Mathjax in eXelearning:

<script>

window.MathJax = {

    loader: {

        load: ['[tex]/ams','[tex]/bbox','[tex]/cancel','[tex]/color','[tex]/colortbl','[tex]/configmacros','[tex]/gensymb','[tex]/newcommand','[tex]/mathtools','[tex]/textmacros']

    },

    tex: {

        tags: "ams",

        inlineMath: [ ['$','$'], ["\\(","\\)"] ],

        displayMath: [ ['$$','$$'], ["\\[","\\]"] ],

        processEscapes: true,

        packages: {

            '[+]':['ams','bbox','cancel','color','colortbl','configmacros','gensymb','newcommand','mathtools','textmacros'] 

        },

    },

    options: {

        ignoreHtmlClass: 'tex2jax_ignore',

        processHtmlClass: 'tex2jax_process'

    }

};

</script>

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

However, some packages doesn't work like mathtools or gensymb. I'm be able to solve this problem. Thank you for your time.

Mastermaticus

unread,
Jan 21, 2023, 2:45:17 AM1/21/23
to MathJax Users
Can anyone help me? Thank you 

Mastermaticus

unread,
Jan 21, 2023, 6:57:31 AM1/21/23
to MathJax Users
Sorry, I’m using Mathjax 3. 😊😊

Davide Cervone

unread,
Jan 21, 2023, 7:31:30 AM1/21/23
to mathja...@googlegroups.com
I don't use eXelearning, but your configuration works for me in a stand-alone test file:

<!DOCTYPE html>
<html>
<head>
<title>Test config</title>
<script>
window.MathJax = {
    loader: {
        load: ['[tex]/ams','[tex]/bbox','[tex]/cancel','[tex]/color','[tex]/colortbl','[tex]/configmacros','[tex]/gensymb','[tex]/newcommand','[tex]/mathtools','[tex]/textmacros']
    },
    tex: {
        tags: "ams",
        inlineMath: [ ['$','$'], ["\\(","\\)"] ],
        displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
        processEscapes: true,
        packages: {
            '[+]':['ams','bbox','cancel','color','colortbl','configmacros','gensymb','newcommand','mathtools','textmacros'] 
        },
    },
    options: {
        ignoreHtmlClass: 'tex2jax_ignore',
        processHtmlClass: 'tex2jax_process'
    }
};
</script>
<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script></head>
<body>

$$32\degree$$

$$x\coloneqq y$$

</body>
</html>

so your problem most likely is an interaction with eXelearning itself.  It appears that eXelearning already includes MathJax itself, so if you are adding this into the page yourself, that might be the problem.  It looks like you shovel be able to modify the configuration through standard eXelearning means.  See


though I'm afraid I can't tell you what those are.

Note that you don't need to load [tex]/ams, [tex]/bbox, [tex]/cancel, [tex]/color, [tex]/configmacros,  or [tex]/newcommand, as these are either already included in the tex-mml-chtml.js file, or are loaded automatically when needed.  The others are all that need to be loaded explicitly.  E.g.,

<!DOCTYPE html>
<html>
<head>
<title>Test config</title>
<script>
window.MathJax = {
    loader: {
        load: ['[tex]/colortbl','[tex]/gensymb','[tex]/mathtools','[tex]/textmacros']
    },
    tex: {
        tags: "ams",
        inlineMath: [ ['$','$'], ["\\(","\\)"] ],
        displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
        processEscapes: true,
        packages: {
            '[+]':['colortbl','gensymb','mathtools','textmacros'] 
        },
    },
    options: {
        ignoreHtmlClass: 'tex2jax_ignore',
        processHtmlClass: 'tex2jax_process'
    }
};
</script>
<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script></head>
<body>

$$32\degree$$

$$\bbox[lightgreen]{x\coloneqq {\color{red}y}}$$

\begin{align}
E&=mc^2
\end{align}

</body>
</html>

I've added some usage of the packages that I left tout to prove that they are not needed.

Hope that helps.

Davide


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/6c218b3e-07b7-4996-86db-5f658a7810fdn%40googlegroups.com.

Mastermaticus

unread,
Jan 21, 2023, 6:43:44 PM1/21/23
to MathJax Users
Hi, Davide

I didn't say it, but I'm a math teacher.

Your answer will be very helpful for my eXeLearning files.

Thank you very much for your time.

Mastermaticus

unread,
Jan 24, 2023, 1:05:10 PM1/24/23
to MathJax Users
How can I set Sans Serif font in MathJax 3.0 in eXelearning?

Thank you for your time.

Davide Cervone

unread,
Jan 24, 2023, 3:41:51 PM1/24/23
to mathja...@googlegroups.com
See my response to your other post.  You would be able to include the "startup" block of that configuration into the configuration you already have listed in the email thread below.

Davide


Mastermaticus

unread,
Jan 27, 2023, 12:06:42 PM1/27/23
to MathJax Users
Thank you.
Reply all
Reply to author
Forward
0 new messages