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

• This topic has 3 replies, 3 voices, and was last updated 7 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
• Author
Posts
• #2229 noapmtl

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.

#2231 noapmtl

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 Tomasz Dziuda

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

--
Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

#5459 yamkopp

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>
Viewing 4 posts - 1 through 4 (of 4 total)
• You must be logged in to reply to this topic.