computorg / template-computo-R

Computo template and documentation for R users
https://computorg.github.io/template-computo-R/
6 stars 6 forks source link

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

Open durandg12 opened 2 weeks ago

durandg12 commented 2 weeks 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.