594 private links
This solves a major shortcoming when authoring documents in Quarto or R Markdown that generate both PDF and HTML output. MathJax lets the author use LaTeX commands in the source that translate into proper output in the HTML, but without this work there was really no support for siunitx v3.
This work could be said to take over where burnpanck/MathJax-siunitx stopped.
To use it, I copied siunitx.js from its repo to my Quarto project and then made Quarto add it to the published site by setting resources: [ "path/to/siunitx.js" ]
in the project
dict. I also added the following to the top-level YAML:
format:
html:
html-math-method:
method: mathjax
url: "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"
include-in-header:
text: |
<script>
window.MathJax = {
loader: {
load: ['[custom]/siunitx.js', '[tex]/html'],
paths: { custom: './path/to/' }
},
tex: {
packages: { '[+]': ['siunitx', 'html'] },
siunitx: {
'per-mode': 'power'
}
}
};
</script>
And that should give you siunitx v3 commands in Quarto :-)
Of course unless you put the siunitx macros inside dollar signs they will simply be ignored by pandoc in the HTML output, but that's a small price to pay for maintaining a single source that produces both PDF and HTML while still letting me use siunitx.
- https://github.com/limefrogyank/siunitx-pcc
- https://github.com/quarto-dev/quarto-cli/discussions/6168#discussioncomment-11545200
- https://github.com/mathjax/MathJax-third-party-extensions/issues/47
- https://github.com/burnpanck/MathJax-siunitx/issues/14
- https://github.com/burnpanck/MathJax-siunitx/issues/13
- https://old.reddit.com/r/LaTeX/comments/1bj8p7c/whats_your_experience_transitioning_to_quarto/m1p0m4p