Rendering math formulas using Asciidoc and Hugo

Hey folks, I really new to Hugo, and I have been working to get Asciidoc support working. Most everything works except for rendering math formulas on a webpage. I was looking at some of the different resources about how to do this, including the very helpful post:

I was looking at a simple latex block like this, for the Asciidoc format:

\frac{\partial V}{\partial t}
+ \frac{1}{2} \sigma^2 S^2 \frac{\partial^2 V}{\partial S^2}
+ r S \frac{\partial V}{\partial S}
- r V = 0

I tried to add the :stem: latexmath directive to the adoc template. I also added the following lines to my config.toml.

    extensions = ["asciidoctor-html5s",
    workingFolderCurrent = true
        my-base-url = ""
        my-attribute-name = "my value"

But the math stuff is still not rendering properly. I imagine there must be a setting somewhere else in the Hugo config to help make this work.

If anyone know how to get this working, please pass along some wisdom. Thanks.

can you give us a repository for help?
What is in the generated pages?

Do you have loaded mathjax???

@ju52 Thanks for responding. I was able to get it working now.

I had to load this script in the partials folder under mathjax_support.html:

<script type="text/x-mathjax-config">
  messageStyle: "none",
  tex2jax: {
    inlineMath: [["\\(", "\\)"]],
    displayMath: [["\\[", "\\]"]],
    ignoreClass: "nostem|nolatexmath"
  asciimath2jax: {
    delimiters: [["\\$", "\\$"]],
    ignoreClass: "nostem|noasciimath"
  TeX: { equationNumbers: { autoNumber: "none" } }
<script src=""></script>


Then I added this link to the header.html file in my theme’s partials folder as well. After that it started to work. I have to reference stem: blocks in my posts just like usual in asciidoc.

One note is that the script above references Mathjax 2.7 and there is version 3.0 out now. But that is as easy as looking up the mathjax website and copying the new link.