Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

what is the best way to post math formula with publii ?

  • #2229
    Avatar photo[anonymous]

    I’ve got some markdown text containing latex formula. Mardown seems to work well with the last pre release of Publii, but I’m still having issues with latex formula. Does anyone found a way to display math formula correctly when you make a post ? I’m thinking to convert them to jpeg, but it’s not the ideal.

    Thanks for your help !

    #2231
    Avatar photo[anonymous]

    I actually found a working solution for anyone having the same need with using MathJax :

    In publii app, you click on “Tools” -> “Custom HTML”, in “head”, you add the following :

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

    It will then render your latex formula. If you have a factorisation, you need to put spaces before and after a *, if not, it won’t render the formula.
    Ex :

    $$V_{min}=V_{init}*k= V_{init}*\frac{1}{1-n}$$

    will not work while

    $$V_{min}=V_{init} * k= V_{init} * \frac{1}{1-n}$$

    will render correctly.

    Hope it’ll work for you !

    #2370
    Avatar photo[anonymous]

    I have moved this topic to useful resources for these who wants to use latex too 🙂

    #5459
    Avatar photo[anonymous]

    Hello,

    in order to render the inline math,

    This is a formula $V_{min}=V_{init} * k= V_{init} * \frac{1}{1-n}$

    The code shoud be:

    <span class="p"><</span><span class="nt">script</span><span class="p">></span>
    <span class="nx">MathJax</span> <span class="o">=</span> <span class="p">{</span>
      <span class="nx">tex</span><span class="o">:</span> <span class="p">{</span>
        <span class="nx">inlineMath</span><span class="o">:</span> <span class="p">[[</span><span class="s1">'$'</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">],</span> <span class="p">[</span><span class="s1">'\\('</span><span class="p">,</span> <span class="s1">'\\)'</span><span class="p">]]</span>
      <span class="p">}</span>
    <span class="p">};</span>
    <span class="p"></</span><span class="nt">script</span><span class="p">></span>
    <span class="p"><</span><span class="nt">script</span> <span class="na">id</span><span class="o">=</span><span class="s">"MathJax-script"</span> <span class="na">async</span>
      <span class="na">src</span><span class="o">=</span><span class="s">"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"</span><span class="p">></span>
    <span class="p"></</span><span class="nt">script</span><span class="p">></span>