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

如何在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 render
    
    或指定根目录的主文件:
    quarto render index.qmd
    
  • 子文件夹中的.qmd文件会自动向上读取根目录的_quarto.yml配置,无需额外设置。

3. 测试验证

在任意.qmd文件中添加测试提示框:

> [!NOTE]
> 测试笔记提示框

> [!WARNING]
> 测试警告提示框

重新渲染PDF,所有提示框将显示为黑白样式。

内容的提问来源于stack exchange,提问作者Terese Eriksson

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.12 17:36:05