3

I am currently trying to use quarto beamer to making lecture slides. I would like to use the theorem environment in beamer, the qmd file however cannot render properly. Rendering stopped with latex error showing that Command \theorem already defined. I am wondering what have I done wrong?

The sample codes are as follows

---
title: "Untitled"
format: beamer
editor: visual
---

## Quarto

Quarto enables you to weave together content and executable code into a finished presentation. To learn more about Quarto presentations see <https://quarto.org/docs/presentations/>.

::: {#thm-test}
## Just a quick test
:::

If possible, I hope that I can include theorem, definition, example environment in quarto beamer presentation.

Thanks for the help in advance.

  • @whoever voted to migrate this to tex.se: this wouldn't be a good fit for tex.se as it is mostly a problem with the Quarto conversion. In real latex one (hopefully) wouldn't include completely unnecessary packages which will break the compilation. And even if one would, the answer to a tex question would simply be "Don't load this package", which is sadly not possible with Quarto. – samcarter_is_at_topanswers.xyz Dec 24 '22 at 00:07

1 Answers1

3

Quarto very unhelpfully loads tons of unnecessary packages like amsthm, which beamer automatically loads, and then blindly tries to define a new theorem environment, even though beamer already has defined it. At the very minimum it should check if an environment is already defined before doing this.

You can work around the problem with the notheorems class options.

---
title: "Untitled"
format: beamer
editor: source
classoption: "notheorems"
---

## Quarto

Quarto enables you to weave together content and executable code into a finished presentation. To learn more about Quarto presentations see <https://quarto.org/docs/presentations/>.

::: {#thm-test}
## Just a quick test
:::