computorg / computo-quarto-extension

Quarto extension for Computo template
https://computorg.github.io/computo-quarto-extension/
MIT License
16 stars 4 forks source link

Feature request: put ams usage in the templates or the quarto extension #28

Open durandg12 opened 4 months ago

durandg12 commented 4 months ago

To write mathematics in LaTeX, I find myself relying a lot on the amsmaths package. I found a (perhaps clunky) way to use it in a .qmd file for both pdf and html rendering with the computo extension.

I replaced

format:
  computo-html: default
  computo-pdf: default

by

format:
  computo-html: 
    html-math-method: mathjax
    include-in-header:
      - text: |
          <script>
          window.MathJax = {
            tex: {
              tags: 'ams'
            }
          };
          </script>
  computo-pdf: 
    include-in-header:
      - text: |
          \usepackage{amsmath}

Then, like many, I use some custom TeX macros, I defined them like that

::: {.hidden}
 \newcommand{\Pro}[1]{\mathbb{P}\left(#1\right)} 
:::

Notice the difference with this screenshot taken from the the Quarto doc: image I had to remove the $$ or else the LaTeX would compilation fail.

I think that the ams usage could be added to the template to help authors, or directly in the computo quarto extension maybe. And the syntax for custom TeX macros could be added to the template too.