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:

https://foo-dogsquared.github.io/blog/posts/blogging-with-asciidoctor-and-hugo/

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

[latexmath]
++++
\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.

[markup.asciidocext]
    extensions = ["asciidoctor-html5s",
                  "asciidoctor-diagram",
                  "asciidoctor-mathematical",
                  "asciidoctor-bibtex"]
    workingFolderCurrent = true
    [markup.asciidocext.attributes]
        my-base-url = "https://blog.org"
        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">
MathJax.Hub.Config({
  messageStyle: "none",
  tex2jax: {
    inlineMath: [["\\(", "\\)"]],
    displayMath: [["\\[", "\\]"]],
    ignoreClass: "nostem|nolatexmath"
  },
  asciimath2jax: {
    delimiters: [["\\$", "\\$"]],
    ignoreClass: "nostem|noasciimath"
  },
  TeX: { equationNumbers: { autoNumber: "none" } }
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_HTMLorMML"></script>

Source: https://github.com/asciidoctor/jekyll-asciidoc#adding-the-stem-assets-to-the-page

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.