Replies: 5 comments 16 replies
-
Just a thought, maybe a pre-processor that would run something like |
Beta Was this translation helpful? Give feedback.
-
Another possible route might be to configure Mathjax such that it knows about the macros, but that doesn't seem trivial (one would need to convert the |
Beta Was this translation helpful? Give feedback.
-
Same thoughts. I guess a new parameter in # _quarto.yaml
...
macros: _macros.tex # import a list of TeX/LaTeX definitions
... % macros.tex
\def\bb{\mathbb}
\def\bf{\mathbf}
\def\cl{\mathcal} Or more general mechanism with an initialization file # _init.qmd
::: {.content-hidden}
$ {{< include _macros.tex >}} $
::: |
Beta Was this translation helpful? Give feedback.
-
LaTeX macros are only LaTeX code/text, thus MathJax is an independent Javascript library. Quarto is not tied to it, MathJax is only a default value. KaTeX and several other libraries can also be used with their own particular syntax and configuration. I don't think Quarto should even try to make assumptions on configuring those libraries. Finally your issue, your post lack a minimal reproducible example to really help. |
Beta Was this translation helpful? Give feedback.
-
@baptiste following discussion at did you try directly {{< include _macros.tex >}} Without the Pandoc's seems to do Macros expansion for HTML based on raw LaTeX block contents, so this would probably work to have your Macros expanded. |
Beta Was this translation helpful? Give feedback.
-
Maybe I've missed something in the docs, but I can't find a clear way to include an entire file of LaTeX macros. Say I have a file
_macros.tex
full of\newcommand
macros as I'm writing a book involving lots of equations, what's the best way to make those macros known to pandoc+mathjax when it's rendering the content (either to html or pdf)?What I currently have is this in my
_quarto.yml
:where
_dollar.tex
is a dummy file containing$$
. This seems to work, but the dummy$$
s isn't very elegant. Have I missed some way to include both files and raw text in the header?EDIT: No, actually, this works for the chapters where I do use maths, but for the others I get the raw content dumped above the page.
The alternative seems to be inserting the macros into each
qmd
file as follows:which suits Mathjax. For LaTeX, the macros are still fed (once) via
include-in-header
, and the{.content-hidden}
includes are not written in the tex file, so this seems to work.Beta Was this translation helpful? Give feedback.
All reactions