I'm trying to use the statmath CTAN package (https://ctan.org/pkg/statmath?lang=en) in Quarto (following https://github.com/quarto-dev/quarto-cli/discussions/1620#discussioncomment-3296389); here's a reprex:
---
title: "Quarto Math"
format:
pdf:
pdf-engine: xelatex
include-in-header:
text: |
\usepackage{statmath}
html:
html-math-method: mathjax
include-in-header:
- text: |
<script>
window.MathJax = {
loader: {
load: ['[tex]/statmath']
},
tex: {
packages: {'[+]': ['statmath']}
}
};
</script>
---
$$X_n \indist X$$
The pdf output works:
but I can't get the html version to load the \indist macro from statmath. Instead I get:
Is there a way to make this work?
MathJax is a javascript library that can process a subset of LaTeX commands, but it is not TeX itself, and can't load arbitrary LaTeX packages, only ones that have been reimplemented in javascript. The statmath package is not one of them.
On the other hand, the definition for \indist in statmath is
\newcommand{\indist}{\overset{d}{\to}}
so you can define that yourself before using it. If you want to include that automatically in your MathJax configuration, you can incorporate
window.MathJax = {
tex: {
macros: {
indist: '\\overset{d}{\\to}',
}
}
}
into your MathJax configuration.