How can I add add chemical equations to a Quarto document? #5226
-
I have been through the whole quarto web site and cannot find something useful to add chemical equations in a quarto document. That would be nice. A few examples like in page 4 of this great manual https://mirror2.sandyriver.net/pub/ctan/macros/latex/contrib/mhchem/mhchem.pdf I am not sure if this is totally new or just not documented well enough. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Quarto website cannot document and showcase everything that is possible using HTML or LaTeX. You can add extra LaTeX packages by modifying partials (https://quarto.org/docs/journals/templates.html#latex-partials) or by using Same principles for HTML:
For example, you can use MathJax JavaScript library (default equation environment for HTML-based format in Quarto) and the extension |
Beta Was this translation helpful? Give feedback.
-
I agree that some hints in the documentation would be nice since formatting chemical equations is quite a common need in scholarly writing. |
Beta Was this translation helpful? Give feedback.
I agree that some hints in the documentation would be nice since formatting chemical equations is quite a common need in scholarly writing.
As far as I see, using the mhchem package inside math delimiters (e.g.,
$\ce{H2O}$
) currently is the best option. It works both for HTML (via MathJax) and pdf (via the Latex package). If you need docx output, you might try using this mhchem lua filter for pandoc. I just recently came across it (here), and did not try it myself yet, but it looks promising. Looking at the Quarto documentation on custom filters, it should not be too complicated to use.