LaTeX Equations


I am not yet a Kirby user, but I am seriously considering Kirby as a replacement for my current CMS. Leading reason: File based => Can use Git keep track of everything.

However, I just have one question that is of utmost importance for me and I could not find an answer on the website: Does Kirby support rendering LaTeX equations? Or if not; can I easily add a custom symbol (like [math]…[/math]) to allow JS-based rendering using MathJax?

P.S.: I can code PHP/CSS/JS/etc.


I haven’t done that yet but I don’t see any problem doing so

it should be pretty easy to strip down the Columns Plugin so you could use

//latex goes here

also the docs on kirbytext could be helpfull

But then you would have to render it on the server before Kirbytext is executed.

if you use MathJax you would only wrap the math in a div with a matching class and include the JS script

could also be achieved with extended Markdown

1 Like

Well, the problem is not so much with the div and the class, but with Markdown rendering:

From the MathJax docs:

Another source of difficulty is when MathJax is used in content management systems that have their own document processing commands that are interpreted before the HTML page is created. For example, many blogs and wikis use formats like Markdown to allow you to create the content of you pages. In Markdown, the underscore is used to indicate italics, and this usage will conflict with MathJax’s use of the underscore to indicate a subscript. Since Markdown is applied to the page first, it will convert your subscripts markers into italics (inserting tags into your mathematics, which will cause MathJax to ignore the math).

You would have to escape those underscores.

Not if using a Kirbytext pre-filter like proposed by @mxst. By wrapping the formulas in MathJax divs, the Markdown parser won’t touch anything inside that.

So yes: Using MathJax with Kirby should most likely work just fine.

1 Like

Oops, yes, right, I completely forgot about that, sorry :blush:

1 Like

Thanks, that sounds feasible. I will give Kirby a shot then!