Math Plugin

For the Math users out there I have enabled the Discourse Math Plugin which allows for the use of MathJax and asciimath. The plug-in documentation notes that it will also do LaTeX but to what extent I don’t know.

This feature may be turned off so don’t rely on it for the the time being.

Enjoy :slightly_smiling_face:


I am the Math plugin

I can display math inline by wrapping text with the $ symbol like so $E=MC^2$ which renders.

E=MC^2

I can display larger blocks of math by wrapping text in a double $$ sign. Like so:

$$
E=MC^2
$$

which renders

E=MC^2

All fonts and assets required to generate Math are embedded in the plugin.


This is a test of the asciimath ability.

This

%
sum_(i=1)^n i^3=((n(n+1))/2)^2
%

renders as

sum_(i=1)^n i^3=((n(n+1))/2)^2

3 Likes

Sorry for my very late reaction, I did not see this post.
Does this mean that this plugin could be used with a SWI-Prolog prover inside a script for an HTML page to render directly the result? It would be a very nice thing.
If the reply is “yes”, I would be happy to test it.

No.

It is a plugin for this Discourse forum that allows math to be rendered using MathJax and asciimath.

Thanks for your reply to my late intervention.
I have understood that it is a plugin for this Discourse forum. But suppose a Mathjax script inside an html webpage, why this plugin could not be used?

I have written something for R. It actually uses Prolog, and we currently try to make it accessible as a swipl pack.

Thanks ! It is intesting indeed. The only problem for me is that I need Mathjax to use the very useful proof.sty implemented in MathJax 3. Unfortunately, the setup to get a dynamic Mathjax is not so easy…

Would you mind to try it together? I would isolate the stuff we have as a swipl pack until next week, then we can check if there are missing pieces (and if you like our approach at all).

(unsure if it’s obvious: The R package can also convert expressions to MathJax, not just MathML. The MathJax ist just less elegant, because it uses “format” instead of HTML pieces.

I did not know that The R package can also convert expressions to MathJax, not just MathML. I would be glad to test your work, of course. But I must be prevent you that I am very slow, I am not at all a computer scientist, my education was in philosophy and that means that I have a slow and weak brain. If you can be patient, of course, it would be nice for me to try it. :smiley:

Haha, no problem. My main concern was that you would have to wait for me because we’re too slow/busy etc.

Les packages source téléchargés sont dans
	‘/tmp/RtmphVPkBb/downloaded_packages’
Messages d'avis :
1: Dans install.packages("mathml") :
  l'installation du package ‘rswipl’ a eu un statut de sortie non nul
2: Dans install.packages("mathml") :
  l'installation du package ‘rolog’ a eu un statut de sortie non nul
3: Dans install.packages("mathml") :
  l'installation du package ‘mathml’ a eu un statut de sortie non nul
> 

Not so slow finally . I believe that all that I need to test your work is now installed. 

Have you seen the SWISH example that uses MathJax?

This notebook explains using Mathjax in SWISH for rendering formulas in markdown text as well as rendering query answers as formulas.

Render mathematical formulas

1 Like

Yes, I saw this page and I am going to work on this point today and during the next week. Thanks !

When its about bussproofs, was using at the start of the document:

<script>
    window.MathJax = {
        loader: {load: ['[tex]/bussproofs']},
        tex: {packages: {'[+]': ['bussproofs']}}
    };
</script>

And at the end of the document:

<script type="text/javascript" id="MathJax-script" async
        src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
</script>

And when a button was pressed and the document had changed I then called:

    MathJax.typeset();