PaperMode theme is easy to use, but the math formatting render is not out of the box. Lucky, it is relatively easy to set up this feature.

Set up

First, you need to create the HTML file layouts/partials/extend_head.html relative to your website source code root. Then you can fill in the following codes in this file.

{{ if or .Params.math .Site.Params.math }}
<link rel="stylesheet" href="" integrity="sha384-KiWOvVjnN8qwAZbuQyWDIbfCLFhLXNETzBQjA/92pIowpC0d2O3nppDGQVgwd2nB" crossorigin="anonymous">
<script defer src="" integrity="sha384-0fdwu/T/EQMsQlrHCCHoH10pkPLlKA1jL5dFyUOvB3lfeT2540/2g6YgSi2BL14p" crossorigin="anonymous"></script>
<script defer src="" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"></script>
    document.addEventListener("DOMContentLoaded", function() {
        renderMathInElement(document.body, {
          // customised options
          // • auto-render specific keys, e.g.:
          delimiters: [
              {left: '$$', right: '$$', display: true},
              {left: '$', right: '$', display: false},
              {left: '\\(', right: '\\)', display: false},
              {left: '\\[', right: '\\]', display: true}
          // • rendering keys, e.g.:
          throwOnError : false
{{ end }}

To turn on/off the math support for the whole site, you can use the following setting in the site configure file.

math: true
# math: false

To turn on/off the math support for a specific page, you can set the same parameter in the page’s head matter.

math: true
# math: false

Use the latex math

This is a inline math example $E = mc^{2}$ (source code: $E = mc^{2}$).

This is a display math example $$ E = mc^{2}~. $$ The related source code is

E = mc^{2}~.