latexproofbeamerquartotheorem

Theorem and Proof Environment in Beamer


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.


Solution

  • Quarto very unhelpfully loads tons of unnecessary packages like amsthm, which beamer has already automatically, and quarto then blindly tries to define a new theorem environment, even though beamer already has defined it. At the very minimum quarto 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
    :::