# Replace KaTeX with MathJax

**URL:** <https://discourse.joplinapp.org/t/replace-katex-with-mathjax/2561>\
**Category:** Development\
**Created:** [3 June 2019 19:50 UTC](https://discourse.joplinapp.org/t/replace-katex-with-mathjax/2561 "2019-06-03T19:50:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![desk7](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@desk7](https://discourse.joplinapp.org/u/desk7)\
**Post date:** [3 June 2019 19:50 UTC](https://discourse.joplinapp.org/t/replace-katex-with-mathjax/2561/1 "2019-06-03T19:50:24Z")

</div>

I know that KaTeX is much faster than MathJax in rendering but it supports less commands than MathJax. Is there a way I can replace KaTeX with MathJax, just for me?

---

<div class="post-metadata">

**Author:** ![tessus](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/tessus/32/13_2.png) [@tessus](https://discourse.joplinapp.org/u/tessus)\
**Post date:** [3 June 2019 21:07 UTC](https://discourse.joplinapp.org/t/replace-katex-with-mathjax/2561/2 "2019-06-03T21:07:23Z")

</div>

Katex is added as a plugin. You could also add MathJax as a plugin, in which case people could choose between the two.  
You only have to make sure that they are mutually exclusive. (I don’t want to know what would happen, if you were to enable both at the same time.)

check out the following 2 files:

```nohighlight
ReactNativeClient/lib/MdToHtml.js
ReactNativeClient/lib/MdToHtml/rules/katex.js

```

---

<div class="post-metadata">

**Author:** ![desk7](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@desk7](https://discourse.joplinapp.org/u/desk7)\
**Post date:** [4 June 2019 08:04 UTC](https://discourse.joplinapp.org/t/replace-katex-with-mathjax/2561/3 "2019-06-04T08:04:00Z")

</div>

Thanks for replying. From your answer I understand that I have to recompile all the application, right? Is there a step-by-step guide how to do it? Otherwise I won’t be able to.  
Thanks for help

---

<div class="post-metadata">

**Author:** ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)\
**Post date:** [4 June 2019 09:17 UTC](https://discourse.joplinapp.org/t/replace-katex-with-mathjax/2561/4 "2019-06-04T09:17:38Z")

</div>

There are build instructions there: [https://github.com/laurent22/joplin/blob/master/BUILD.md](https://github.com/laurent22/joplin/blob/master/BUILD.md)

---

<div class="post-metadata">

**Author:** ![desk7](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@desk7](https://discourse.joplinapp.org/u/desk7)\
**Post date:** [11 July 2019 20:32 UTC](https://discourse.joplinapp.org/t/replace-katex-with-mathjax/2561/5 "2019-07-11T20:32:34Z")

</div>

Have you ever evaluated the possibility of using Mathjax instead of Katex. I offers more features, like equation labels and ref.

---

<div class="post-metadata">

**Author:** ![tessus](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/tessus/32/13_2.png) [@tessus](https://discourse.joplinapp.org/u/tessus)\
**Post date:** [11 July 2019 22:16 UTC](https://discourse.joplinapp.org/t/replace-katex-with-mathjax/2561/6 "2019-07-11T22:16:24Z")

</div>

I’m against using MathJax instead of Katex. However, if MathJax is requested by a lot of people, maybe there’s a way to allow people to choose either or. (not a checkbox, but a select box)

---

<div class="post-metadata">

**Author:** ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)\
**Post date:** [11 July 2019 22:17 UTC](https://discourse.joplinapp.org/t/replace-katex-with-mathjax/2561/7 "2019-07-11T22:17:40Z")

</div>

Last time I checked, katex is faster than Mathjax, which is important for us since we render everything real time. This is important especially on mobile.

---

<div class="post-metadata">

**Author:** ![desk7](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@desk7](https://discourse.joplinapp.org/u/desk7)\
**Post date:** [12 July 2019 06:47 UTC](https://discourse.joplinapp.org/t/replace-katex-with-mathjax/2561/8 "2019-07-12T06:47:00Z")

</div>

@tessus: It could be a good solution.  
@laurent: I thought that the preference depends on the rendering speed.

---

<div class="post-metadata">

**Author:** ![charlesdaniels](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/charlesdaniels/32/1190_2.png) [@charlesdaniels](https://discourse.joplinapp.org/u/charlesdaniels)\
**Post date:** [15 July 2019 01:53 UTC](https://discourse.joplinapp.org/t/replace-katex-with-mathjax/2561/9 "2019-07-15T01:53:12Z")

</div>

I would also point out that there is some risk when supporting several different approaches to solving the same problem, as this may create a greater maintenance burden in the future.

> [@laurent](#):
>
> Last time I checked, katex is faster than Mathjax, which is important for us since we render everything real time. This is important especially on mobile.

Maybe it would be possible to grab the SVGs from Mathjax and cache them, only re-generating if the note changes (or ideally if the equation changes, but associating the equation with the output SVG is probably hard). [Mathjax-node](https://github.com/mathjax/MathJax-node) can ostensibly generate SVGs which could be saved and cached appropriately.

Of course that is also probably be a _lot_ of work to implement.

---

<div class="post-metadata">

**Author:** ![Narip2](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/narip2/32/16462_2.png) [@Narip2](https://discourse.joplinapp.org/u/Narip2)\
**Post date:** [18 May 2023 02:47 UTC](https://discourse.joplinapp.org/t/replace-katex-with-mathjax/2561/10 "2023-05-18T02:47:05Z")

</div>

Hello. Did you figure out how to use Mathjax in Joplin? I also want some of the features in Mahtjax especially number and ref my equations in it. So I also really need Mathjax. Hope to your reply. Thanks in advance!
