0

I'm using MkDocs 1.2.2 with MathJax 3.2 via Arithmatex from the pymdown-extensions. I'm trying to get Arithmatex to recognize math inside \\[ and \\] (instead of the default \[\]) as display math. Starting with a basic config,

markdown_extensions:
  - footnotes
  - pymdownx.arithmatex
  - pymdownx.highlight
  - pymdownx.superfences
extra_javascript:
  - javascripts/mathjax-config.js
  - https://polyfill.io/v3/polyfill.min.js?features=es6
  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg-full.js

where mathjax-config.js contains exactly the code under the tab "Default – MathJax 3" in the section on Loading MathJax, writing the following in a Markdown input file,

\\[
\Sigma_n
\\]

produces

enter image description here

Changing the MkDocs config file to add tex_block_wrap like this,

markdown_extensions:
  - footnotes
  - pymdownx.arithmatex:
      tex_block_wrap: ['\\\\[', '\\\\]']
  - pymdownx.highlight
  - pymdownx.superfences

does not change the output. I've tried variations on the number of \ characters to no effect. I've tried similar configuration changes on the MathJax side by adding the following to my mathjax-config.js file:

window.MathJax = {
    tex: {
        displayMath: [ ["\\\\[", "\\\\]"] ],
    },
....

and variations on the number of \ characters there too, but without success.

How can I get Arithmatex+MathJax in MkDocs to allow the use of \\[ and \\] as display math delimeters?

mhucka
  • 2,143
  • 26
  • 41

1 Answers1

1

You do not need to use \( or \[ in your Markdown file. Arithmatex converts $ to inline math and $$ to block math. See the examples in Arithmatex's documents. Following the instruction there, I got it to work in both generic and non-generic modes.

The .js file for generic mode is

window.MathJax = {
  tex: {
    inlineMath: [ ["\\(","\\)"] ],
    displayMath: [ ["\\[","\\]"] ],
    processEscapes: true,
    processEnvironments: true
  },
  options: {
    ignoreHtmlClass: ".*",
    processHtmlClass: "arithmatex"
  }
}; 

In markdown files, you can use either \( or $ for inline math. Arithmatex converts $ pairs to \( and \). If you use \[, do not escape the backslash, i.e., NOT \\(.

JerryZ
  • 11
  • 2