598 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 before this work there was no support for siunitx
v3. This work can be said to take over where burnpanck/MathJax-siunitx left off.
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 the following in the project/document YAML:
project:
resources:
- "path/to/siunitx.js"
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 your Quarto manuscript :-)
Note that if you also want your notebooks to benefit from siunitx-pcc, you will need to symlink (or copy) the siunitx.js
file into their top-level directory (which is ./notebooks
) or otherwise siunitx macros will not render as paths: { custom: './path/to/' }
is relative to their top-level directory and not (as you might think) the Quarto project root.
I have found that re-creating the directory structure mkdir -p notebooks/path/to; cd notebooks/path/to
and then symlinking ln -s ../../../path/to/siunitx.js .
works (don't forget to add another resources line: - "notebooks/path/to/siunitx.js"
).
In short, siunitx-pcc lets you use almost all siunitx
macros.
- 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