-
DescriptionThis question is a follow-up to an earlier post, which didn't seem to resolve. I wish to include latex macros into html and revealjs formats via the yaml header. But I'm not able to get this to work because the macros are printed at the top of the output. (See below.) Here's a working example with illustrates the behavior.
---
title: Test
format:
revealjs:
include-before-body: _macros.qmd
---
## First slide
The nonnegative orthant: $\Rn_+$
::: {.content-hidden}
$$
\def\Rn{\mathbb{R}^n}
$$
::: And here's the output: ![]() |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
That's the way to go in general in Quarto. (This is also part of the thread you linked.) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
@mpf as documented in https://quarto.org/docs/output-formats/html-basics.html#includes, these includes are inserted verbatim in the document. This means they are not processed, so you can't use a .qmd and expect it to be rendered before being included. This is why Using So this has nothing to do with Mathjax syntax, its support, or any expectation to be in body. Here, you are just using Hope it helps understand. |
Beta Was this translation helpful? Give feedback.
-
Using I now use this approach: in the yaml header that specifies the format, I have format:
revealjs:
include-in-header:
- file: "macros.jax" where
This seems to work reliably, though the downside is having to maintain macros in an unusual format. |
Beta Was this translation helpful? Give feedback.
Using
{{< include _macros.qmd >}}
works but has the unfortunate side effect that, if placed before the first header in a revealjs format document, it can cause a blank slide. That means having to place it inside of the first slide. That's awkward.I now use this approach: in the yaml header that specifies the format, I have
where
macros.jax
contains the macro definitions, as specified here:This seems to work reliably, though the downside is having to maintain macros in an unusual format.