# [tex4ht] is it possible to use KaTex with tex4ht?

Nasser M. Abbasi nma at 12000.org
Tue May 7 23:55:49 CEST 2019

On 5/7/2019 9:30 AM, Michal Hoftich wrote:
> Hi Nasser,
>
>
>> Since tex4ht now supports mathjax mode, I was just wondering,
>> if it is even possible to make tex4ht also support katex mode
>> as well? i.e. compile the latex file so that the HTML
>> generated uses Katex for math rendering instead of mathjax.
>
> yes, it is possible to support KaTeX. Try the following configuration file:
>
> ------------
> \Preamble{xhtml,mathjax}
> \Configure{MathjaxSource}{}
> href="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/katex.min.css"
> integrity="sha384-dbVIfZGuN1Yq7/1Ocstc1lUEm+AT+/rCkibIcC/OmWo5f0EA48Vf8CytHzGrSwbQ"
> crossorigin="anonymous">\Hnewline
> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/katex.min.js"
> integrity="sha384-2BKqo+exmr9su6dir+qCw08N2ZKRucY4PrGQPPWU1A7FtlCGjmEGFqXCv5nyM5Ij"
> crossorigin="anonymous"></script>\Hnewline
> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/contrib/auto-render.min.js"
> integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI"
> crossorigin="anonymous"
> }}
> \begin{document}
> \EndPreamble
> ------------
>
> There is one downside: KaTeX supports even less LaTeX commands than
> MathJax, not mentioning all custom commands you use in your documents.
> So I can predict that you will have lot of troubles in trying to write
> a support for your documents.
> I am not sure it is worth the trouble, but you will see.
>
> Best regards,
> Michal
>

Thanks Michal. I will try the above soon
(studying for final exams now). But I believe you.

I was reading the same thing later that KaTeX is much faster than
mathjax but does not support as many Latex commands.

https://katex.org/docs/issues.html

"KaTeX does not support the align environment"

This is a killer for me. I use align everywhere. Here is
list of supported latex functions in Katex:

https://katex.org/docs/supported.html

But I need to try katex using your code above later this week
on some large latex documents I have and see for myself the difference.

Thanks
--Nasser