You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Quarto Beamer定理环境渲染报错:Command \theorem already defined

解决Quarto Beamer定理环境渲染报错问题

问题原因

你使用的::: {#thm-test}自定义定理环境的方式,和Beamer内置的定理机制冲突了——Beamer默认已经加载amsthm包并定义了\theorem命令,重复定义就会触发Command \theorem already defined错误。

正确使用方法

在Quarto Beamer中,直接调用内置的定理类环境即可,无需手动定义:

1. 基础用法

直接使用预定义的环境标签,包括theorem、definition、example,示例代码:

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

## Quarto

Quarto enables you to weave together content and executable code into a finished presentation.

::: theorem
这是一个标准定理
:::

::: definition
这是一个定义
:::

::: example
这是一个示例
:::

2. 自定义环境标题

如果需要为环境添加自定义标题,使用name属性:

::: theorem name="勾股定理"
直角三角形两直角边的平方和等于斜边的平方
:::

3. 控制编号

若要关闭环境编号,添加unnumbered属性:

::: theorem unnumbered name="无编号定理"
这是一个不显示编号的定理
:::

关键注意事项

  • 禁止使用#thm-test这类手动定义定理环境的方式,避免与Beamer内置命令冲突
  • 所有定理类环境均通过::: 环境名的格式调用,Quarto会自动处理LaTeX层面的兼容性

内容的提问来源于stack exchange,提问作者Ginger Shu-Ying Yeh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 20:40:44