如何在Quarto的PDF输出中创建黑白样式的提示框?
解决Quarto PDF提示框黑白样式不生效的问题
1. 修正callout-style.sty文件
你的原代码错误地重定义了通用callout环境,但Quarto的PDF提示框是基于quartocallout系列专属样式,替换为以下代码:
\usepackage[most]{tcolorbox} % 统一设置所有Quarto提示框的黑白基础样式 \tcbset{ quartocalloutdefault/.style={ enhanced, breakable, sharp corners, colback=white, colframe=black, coltitle=black, colbacktitle=white, boxrule=0.5pt, fonttitle=\bfseries, }, % 让所有类型的提示框继承黑白默认样式 quartocalloutnote/.style={quartocalloutdefault}, quartocalloutwarning/.style={quartocalloutdefault}, quartocallouttip/.style={quartocalloutdefault}, quartocalloutimportant/.style={quartocalloutdefault}, quartocalloutcaution/.style={quartocalloutdefault}, quartocalloutseealso/.style={quartocalloutdefault} }
2. 确认_quarto.yml配置有效性
你当前的include-in-header配置是正确的,无需修改。注意:
- 确保渲染命令从
_quarto.yml所在的根目录执行,比如:
或指定根目录的主文件:quarto renderquarto render index.qmd - 子文件夹中的
.qmd文件会自动向上读取根目录的_quarto.yml配置,无需额外设置。
3. 测试验证
在任意.qmd文件中添加测试提示框:
> [!NOTE] > 测试笔记提示框 > [!WARNING] > 测试警告提示框
重新渲染PDF,所有提示框将显示为黑白样式。
内容的提问来源于stack exchange,提问作者Terese Eriksson
相关产品推荐
相关产品推荐

