liffiton / dokuwiki-plugin-mathjax

MathJax plugin for DokuWiki
https://www.dokuwiki.org/plugin:mathjax
12 stars 11 forks source link

Conflict with the mathjax plugin #32

Closed zyzhu2000 closed 2 years ago

zyzhu2000 commented 4 years ago

When I edit an equation block as follows, it will change the double backslash to a single backslash. It would be perfect if it can recognize equation blocks and disable the escaping. (There might be other characters that are similarly escaped and transformed without my noticing.)

$$ \begin{aligned} abc &= def \\ abc &= def \end{aligned} $$

liffiton commented 4 years ago

I think the only issue there is that the environment is named align, not aligned. Also, the align environment does not need to be enclosed in an additional math environment (your $$), so the following should work fine:

\begin{align}
abc &= def \\
abc &= def
\end{align}

There is code in the plugin to turn off the escaping and other transformations within detected math environments (in protecttex.php), and it works for me in my testing. Let me know if you still run into issues.

zyzhu2000 commented 4 years ago

No, I miswrote above. Below was the actual code I used. I tried double backslashes and it did not work. I had to use quad-backslashes.

$$
\begin{aligned}
P(d|\pi^1) &={u+v \choose u} C^u (1-C)^v \\\\
P(d|\pi^2) &= {u+v \choose v} C^v (1-C)^u 
\end{aligned}
$$
liffiton commented 4 years ago

Again, the $$ are unneeded, and the correct environment name is align, as far as I know. The following works for me in my dokuwiki installation:

\begin{align}
P(d|\pi^1) &={u+v \choose u} C^u (1-C)^v \\
P(d|\pi^2) &= {u+v \choose v} C^v (1-C)^u 
\end{align}
zyzhu2000 commented 4 years ago

I think we can either use $$..$$ pairs with \begin{aligned}...\end{aligned} or just \begin{align}...\end{align} without the double $$ enclosings. I just tested and in either case, I had to use quad-backslashes. Could that be some versioning issues? I installed it from the extension manager yesterday.

liffiton commented 4 years ago

Yes, my apologies! You're right about the environments.

It could be an issue with your version of Dokuwiki (are you on the latest?), or perhaps a conflict with some other plugin (do you have other non-standard plugins installed?). Are you using the math formula inside some other formatting block? If you put the formula on a new wiki page completely by itself, does that work?

liffiton commented 2 years ago

Closing because I can't reproduce the issue in my own install and no further follow-up.