admin管理员组文章数量:1406167
I am trying to define a new operator in Quarto presentation (revealjs), but I either fail or it adds a white empty slide. Here are two examples:
Fails
This code fails in the sense that \N
is not understood and litteraly written.
---
title: "Test title"
date: today
author: Test author
date-format: iso
keep-tex: true
format:
revealjs: default
---
::: {.content-hidden}
\newcommand{\test}{f_{\text{test}}}
\renewcommand{\phi}{\varphi}
$$
\DeclareMathOperator{\N}{\mathcal{N}}
$$
:::
## First slide
$$
\test = \N(\phi)
$$
Works but add a white slide
This time \N
is written because the math operator is declared in the html (see after qmd block code for the html output)
---
title: "Test title"
date: today
author: Test author
date-format: iso
keep-tex: true
format:
revealjs: default
---
::: {.hidden}
\newcommand{\test}{f_{\text{test}}}
\renewcommand{\phi}{\varphi}
$$
\DeclareMathOperator{\N}{\mathcal{N}}
$$
:::
## First slide
$$
\test = \N(\phi)
$$
Opening the html output file, I found:
<section class="slide level2">
<div class="hidden">
<p><span class="math display">\[
\DeclareMathOperator{\N}{\mathcal{N}}
\]</span></p>
</div>
</section>
So, how to add latex macros in quarto revealjs? I also tried to hide the slide itself rather than the content, as shown in this post, but it did not work out.
I am trying to define a new operator in Quarto presentation (revealjs), but I either fail or it adds a white empty slide. Here are two examples:
Fails
This code fails in the sense that \N
is not understood and litteraly written.
---
title: "Test title"
date: today
author: Test author
date-format: iso
keep-tex: true
format:
revealjs: default
---
::: {.content-hidden}
\newcommand{\test}{f_{\text{test}}}
\renewcommand{\phi}{\varphi}
$$
\DeclareMathOperator{\N}{\mathcal{N}}
$$
:::
## First slide
$$
\test = \N(\phi)
$$
Works but add a white slide
This time \N
is written because the math operator is declared in the html (see after qmd block code for the html output)
---
title: "Test title"
date: today
author: Test author
date-format: iso
keep-tex: true
format:
revealjs: default
---
::: {.hidden}
\newcommand{\test}{f_{\text{test}}}
\renewcommand{\phi}{\varphi}
$$
\DeclareMathOperator{\N}{\mathcal{N}}
$$
:::
## First slide
$$
\test = \N(\phi)
$$
Opening the html output file, I found:
<section class="slide level2">
<div class="hidden">
<p><span class="math display">\[
\DeclareMathOperator{\N}{\mathcal{N}}
\]</span></p>
</div>
</section>
So, how to add latex macros in quarto revealjs? I also tried to hide the slide itself rather than the content, as shown in this post, but it did not work out.
Share Improve this question edited Mar 24 at 19:00 Jan 9,9156 gold badges20 silver badges33 bronze badges asked Mar 21 at 13:56 mistralmistral 1389 bronze badges1 Answer
Reset to default 1This is because if you put anything before the first header, it will be regarded as content which has to be put on a slide. The solution is that you define things afterwards:
---
title: "Test title"
date: today
author: Test author
date-format: iso
keep-tex: true
format:
revealjs: default
---
## First slide
::: {.hidden}
\newcommand{\test}{f_{\text{test}}}
\renewcommand{\phi}{\varphi}
$$
\DeclareMathOperator{\N}{\mathcal{N}}
$$
:::
$$
\test = \N(\phi)
$$
本文标签: How to add MathJax macros in a Quarto Revealjs presentationStack Overflow
版权声明:本文标题:How to add MathJax macros in a Quarto Revealjs presentation? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744348508a2601909.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论