mathjaxquarto

In Quarto to HTML, how to set MathJax default to SVG?


I'm trying to set the MathJax default as SVG in my Quarto project

I have the _quarto.yml file as follows

project:
  type: book

book:
  chapters:
    - index.qmd

format:
  html:
    html-math-method: mathjax
    include-in-header: header-includes.html

Where the header-includes.html file have these definitions

<script type="text/x-mathjax-config">
  MathJax = {
    tex: {inlineMath: [['$', '$'], ['\\(', '\\)']]},
    svg: {fontCache: 'global'}
  };
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>

And the index.qmd have:

# Test

$$
a = \sqrt{b^2 + c^2}
$$


$$
E = mc^2
$${#eq-eistein}

But, instead of having the default render as SVG, the equations are still in HTML, my guess is that the configuration is not beeing applied.

Any ideas are welcome.

enter image description here


Solution

  • This setting has to be passed to Quarto via the _quarto.yml. You can use

    format:
      html:
        html-math-method:
          method: mathjax
          url: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js