0

My usage scenario is to have asciimath as the primary formula engine. However, for some cases I might need more powerful features which I can find only using TeX.

Is there a way to have different open/close clauses one for the regular ascii math (say ` ) and one for TeX using, say $( and )$ ?

So I want to have mix of ascii math and TeX formulae on the same page.

Dr Phil
  • 833
  • 6
  • 18

1 Answers1

1

Sure, you can use both!

First simply configure both (assuming MathJax 3):

<script>
  MathJax = {
    loader: { load: ["input/asciimath", "[tex]/html"] },
    tex: {
      packages: { "[+]": ["html"] },
      inlineMath: [
        ["$", "$"],
        ["\\(", "\\)"]
      ],
      displayMath: [
        ["$$", "$$"],
        ["\\[", "\\]"]
      ]
    },
    asciimath: {
      delimiters: [["`", "`"]]
    }
  };
</script>

Then use the delimiters to signal to MathJax if you want AsciiMath or Latex:

<div>
  $$\sum_{n = 100}^{1000}\left(\frac{10\sqrt{n}}{n}\right)$$
</div>
<div>
  `sum_(n = 100)^(1000)(frac(10sqrt(n))(n))`
</div>

Remember that AsciiMath requires you to determine whether you want display style or not for the entire document with setting displaystyle: false / true, you can't have both, side by side, as you can for Latex:

asciimath: {
  displaystyle: true
}

Code sandbox: https://codesandbox.io/s/mathjax-3-0ve5d

fast-reflexes
  • 4,891
  • 4
  • 31
  • 44