I am new to moodle . But I google out that Katex for math rendering is faster than mathjax .

Katex .Comparison with mathjax with help of

So I want to know can I use Katex with moodle. And if it is yes then how?

I am new to moodle . But I google out that Katex for math rendering is faster than mathjax .

Katex .Comparison with mathjax with help of

So I want to know can I use Katex with moodle. And if it is yes then how?

Speed is not everything. MathJax has some features that KaTeX does not. In particular it is more accessible. The speed test page above exaggerates the speed difference. On more practical pages the difference is not as noticeable.

However, If you are interested in trying KaTeX in Moodle 2.8+, you can use the following procedure. Go to Site administration -> Appearance -> Additional HTML. In the box *Within HEAD* put

`<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.8.3/katex.min.css" integrity="sha384-B41nY7vEWuDrE9Mr+J2nBL0Liu+nl/rBXTdpQal730oTHdlrlXHzYMOhDU60cwde" crossorigin="anonymous">`

In *Before BODY is closed* include

`<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.8.3/katex.min.js" integrity="sha384-L9gv4ooDLrYwW0QCM6zY3EKSSPrsuUncpx26+erN0pJX4wv1B1FzVW1SvpcJPx/8" crossorigin="anonymous"></script>`

<script>

var texpreviews = document

.getElementsByClassName('MathJax_Preview');

for (var i = 0; i < texpreviews.length; i++) {

katex.render(

texpreviews.item(i).nextSibling.textContent,

texpreviews.item(i)

);

}

</script>

Then enable the TeX notation filter and disable MathJax filter. TeX expressions will be filtered and displayed as images first by the TeX notation filter. KaTeX will then replace the images with its display.

Hi Daniel,

I have tried to insert your code within the head and before the BODY is closed in the Additional HTML section. It gives 'This page is not working' and 'Chrome detected unusual code on this page and blocked it to protect your personal information (for example, passwords, phone numbers, and credit cards).'

I am using Moodle 3.4 on a current version of Chrome.

Is there something new in Moodle that scrubs out scripts in the Additional HTML?

Thanks, Dave

I just ran it with the development master, and it seems to be working for me. Make sure that MathJax filter is off. Normally the additional HTML is not scrubbed. Are you using one of the standard themes or a custom one? That might interfere.

Hi Daniel,

Thanks for your quick response. I think it may be a browser issue; no problem in FF and runs fine in Chrome after being updated in FF. Standard Boost theme.

Thanks again, Dave

Hi there mathematics guys,

I've just written a Moodle KaTeX filter that can be downloaded from

http://wwwmain.h.kobe-u.ac.jp/~nagasaka/research/xml_quiz/

The speed is not everything I agree. However, for example, our project has a set of massive Mathematical questions for Quiz activities hence the speed is required for every short assessment by the Quiz activity module.

have a fun and speedy Mathematics!

yours, Kosaku

I've just written a Moodle KaTeX filter that can be downloaded from

http://wwwmain.h.kobe-u.ac.jp/~nagasaka/research/xml_quiz/

The speed is not everything I agree. However, for example, our project has a set of massive Mathematical questions for Quiz activities hence the speed is required for every short assessment by the Quiz activity module.

have a fun and speedy Mathematics!

yours, Kosaku