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

Quarto PDF输出中APA规范图表编号与格式配置求助

解决Quarto PDF输出的APA图表格式问题

核心问题梳理

  • 图表主标题/子标题需置于图表上方,注释紧邻下方
  • 特定图表需关闭自动编号且格式合规
  • 现有配置存在重复设置、caption格式定义错误、手动排版冲突的问题

修正后的全局配置(YAML)

---
fig-cap-location: top
fig-numbers: true  # 全局开启编号,特定图表单独关闭更灵活
format:
  pdf:
    fontsize: 12pt
    linestretch: 1.5
    geometry: "left=25mm, right=20mm, top=20mm, bottom=20mm"
    classoption: oneside
    papersize: a4
    header-includes:
      - \usepackage{float}
      - \floatplacement{table}{H}
      - \usepackage{tikz}
      - \usetikzlibrary{arrows.meta, positioning, calc}
      - \usepackage{caption}
      - \usepackage{subcaption}
      # APA图表主标题格式:粗体,无冗余占位符(关闭编号时避免空行)
      - \DeclareCaptionFormat{APAfigure}{\textbf{#3}\\[0.5\baselineskip]}
      # APA子图标题格式:斜体左对齐
      - \DeclareCaptionFormat{APAsubfigure}{\textit{#3}}
      - \captionsetup[figure]{format=APAfigure, justification=raggedright, singlelinecheck=false, font=small}
      - \captionsetup[subfigure]{format=APAsubfigure, justification=raggedright, singlelinecheck=false, font=small}
engine: knitr
bibliography: ../bibliography.bib
csl: ../apa.csl
---

配置说明

  • 移除重复的geometry设置,避免LaTeX编译冲突
  • 全局保留编号开关,通过单图表属性控制是否关闭编号,适配不同场景
  • 重新定义APAfigure格式:直接渲染粗体标题内容,去掉编号占位符,解决关闭编号时的空行问题
  • 新增subcaption包并配置子图格式,匹配APA子标题斜体要求

单个图表的正确写法(关闭编号+APA格式)

示例1:带多副标题的无编号图表

```{r fig-study1-models, fig-numbering=false, fig-cap="This is the caption for the figure", fig-note="Note. Here the note that appears underneath the figure"}
#| fig-subcap:
#|   - "Model 1.1"
#|   - "Model 1.2"
#|   - "Model 1.3"
#|   - "Model 1.4"
#| layout: "[[1,1], [1.2,0.9]]"
#| out.width: "90%"

knitr::include_graphics(c("figures/model1_1.tex", 
                          "figures/model1_2.tex", 
                          "figures/model1_3.tex", 
                          "figures/model1_4.tex"))
### 示例2:带双副标题的无编号图表
```r
```{r fig-study2-models, fig-numbering=false, fig-cap="Figure Caption", fig-note="Note. Figure Note."}
#| fig-subcap:
#|   - "Model 2.1"
#|   - "Model 2.2"
#| layout: "[[1,1]]"
#| out.width: "100%"

knitr::include_graphics(c("figures/model2_1.tex", 
                          "figures/model2_2.tex"))
## 关键修正点
1. **放弃手动排版**:直接使用Quarto原生的`fig-cap`(主标题)、`fig-note`(注释)、`fig-subcap`(子标题)属性,避免与Quarto自动排版逻辑冲突
2. **关闭编号的正确方式**:在目标代码块中设置`fig-numbering: false`,无需手动修改LaTeX caption格式
3. **注释自动合规**:`fig-note`会继承全局的左对齐设置,无需手动添加`\raggedright`
4. **子标题格式统一**:通过`subcaption`包配置子图标题为斜体,完全匹配APA规范

## 验证效果
- 主标题以粗体显示在图表最上方
- 子标题以斜体显示在对应子图上方
- 注释以斜体`Note.`开头,紧邻图表下方
- 关闭编号的图表无数字前缀,整体格式与其他图表保持一致

内容的提问来源于stack exchange,提问作者valentinkm
相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.17 23:32:02