Math Typesetting

Hugo Authors
A min to read

Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries.

KL(y^||y)=c=1My^clogy^cyc JS(y^||y)=12(KL(y||y+y^2)+KL(y^||y+y^2))

Check out Hugo Math Typesetting for more details.

  • To enable Math Typesetting globally set the parameter math to true in a project’s configuration
  • To enable Math Typesetting on a per page basis include the parameter math: true in content files

Configure the hugo.yaml file to setup goldmark to support Math Typesetting:

markup:
  defaultMarkdownHandler: goldmark
  goldmark:
    extensions:
      passthrough:
        enable: true
        delimiters:
          block:
            - ["$$", "$$"]
            - ["\\[", "\\]"]
          inline:
            - ["\\(", "\\)"]

Note: You can also set the parameter math.engine to katex to use KaTeX instead of MathJax.

Math

This is an inline a=xb equation.

These are block equations:

a=xba=xba=xb

These are also block equations:

a=xba=xba=xbx=b±b24ac2a.

Chemistry

Cp[HA2O(l)]=75.3 JmolK