KaTeX Extension Inconsistent Behavior

My version of HedgeDoc is: 1.8.2

What I expected to happen:
Within a math expression, I can use \ce to write chemistry expressions like:
$\ce{H2O + H+ -> H3O+}$

What actually happened:

Sometimes it works, and sometimes it does not, and I have not discovered a pattern. Today, it was working correctly, but when I reloaded the page after switching wifi networks, it stopped working.

here is the display when it is not working:

I am using hedgedoc hosted by my employer at https://pad.gwdg.de/

I am not enough of a developer to investigate this problem on my own. From the KaTex website it seems that \ce requires an ‘extension’ to be installed, but I don’t know why an extension might get loaded sometimes and not others.

Hello @catmarx,

HedgeDoc 1.8.2 is still using MathJax, the switch to KaTeX will only occur with 2.0. It seems to me at least on a quick look, that MathJax also needs an extensions for this to work.

I’ll try to have a closer look at that in the next few days.

Greetings
DerMolly

I just tried to reproduce the mentioned behaviour on our demo instance and was not able to do so. Could you provide us with a working example note on https://pad.gwdg.de/ ?

I looked at your demo instance, and \ce does not appear to be working. Is it working for you? Would it depend on whether the mathjax extension was installed alongside the hedgedoc instance?

I am sorry to say that I cannot provide an example on https://pad.gwdg.de/, since this service is only available to signed-in members of my organization. I understand that, without a working (public) example, there’s probably not much that can be done. Thank you for your time and help anyhow.

No, it isn’t.

This could be the case, but I’m not too sure. Maybe you could ask the admins of https://pad.gwdg.de/?

I ran a GWDG Pad instance locally from the source code. Using \ce in math mode does not work for me, and there is no indication that the mhchem extension is loaded automatically.

What does work though (in every HedgeDoc instance) is adding $\require{mhchem}$ at the start of the document or adding the require in the first TeX-expression. That loads the extension globally and \ce can be used everywhere.

1 Like