Re: Current recommendation for inserting LaTeX markup?
Christopher Pinon <[email protected]> Sat, 12 Jul 2025 20:05:40 +0000
| Newsgroups | gmane.comp.web.wiki.pmwiki.user |
|---|---|
| Message-ID | <87zfd9w4x7.fsf@localhost> |
Petko Yotov <[email protected]> writes: > I would recommend Cookbook/MathJax: the maintainer Said is an active > administrator and can assist if needed. > > Petko > > On 08/07/2025 12:55, Christopher Pinon wrote: >> Hi, >> >> If I look at >> >> https://www.pmwiki.org/wiki?n=PmWiki.PmWiki&action=search&q=latex >> >> there are a number of suggestions, many of them rather old. >> >> My sense is that >> >> https://www.pmwiki.org/wiki/Cookbook/MathJax >> >> or >> >> https://www.pmwiki.org/wiki/Cookbook/TrueLatex >> >> would be the current recommendation. Of these two, MathJax is simpler >> because it (naturally) uses MathJax, whereas TrueLatex requires a local >> LaTeX installation. >> >> Do any of you have a preferred way of inserting LaTeX markup? I just wanted to post a short update on this. The context: I'm using v2.4.6 of PmWiki, which is the latest stable version. The current version of MathJax is v3.2.2, and the legacy version is v2.7.9 -- see https://www.mathjax.org/ . I tried Cookbook/MathJax with v2 of MathJax (which is the version that the recipe was designed for), but unfortunately, it doesn't work at all (unless I missed something obvious). :-( Since there are no error messages that I could see, it also isn't so clear to me what the problem is. I also tried Cookbook/LaTeXMathJax (a possibility that I didn't mention above), which is older than Cookbook/MathJax, and it was a pleasant surprise to see that it does work, but it's also designed for v2 of MathJax and in addition, it requires MathJax to be installed locally. After a little reflection, I decided to pursue a different strategy. In local/config.php , I simply put $HTMLHeaderFmt['mathjax3'] = '<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"> </script>'; which adds the URL of MathJax v3 to the <head> section of the page. With this modification, MathJax v3 becomes available and can be tested in PmWiki with the following text/markup: This is a test of MathJax v3. This is an example of an in-line equation: \( \frac{n!}{k!(n-k)!} = \binom{n}{k} \) Each of the following two examples is a displayed equation (which means that the equation is placed on a new line and centered): \[ \lim\limits_{x \to \infty} \exp(-x) = 0 \] \[ \sum_{i=1}^{n}i = \frac{n(n+1)}{2} \] For convenience, I also put this text/markup in an HTML file in order to illustrate how it should appear: https://versioning.org/tmp/mathjax3.html I think that this is currently the simplest way to use MathJax in PmWiki, but naturally, if one wanted to have more flexibility (e.g. the possibility of using a local MathJax installation), various parameters would need to be introduced. C.