四开 PDF 输出中的 APA 图形格式和编号

问题描述 投票:0回答:1

我正在四开本中开展一个项目,但我无法根据 APA 标准使我的图形编号和标题正确运行。我需要一个设置,其中的数字遵循以下要求:

图标题和子标题必须符合 APA 风格(标题位于图顶部)。 注释应直接放在图的下方。 我需要禁用特定图形的自动编号,同时仍保留符合 APA 的标题和注释。 生成 PDF 输出需要此设置,所有格式均符合 APA 标准。 这是我正在使用的代码示例:

---
fig-cap-location: top
fig-numbers: false
format:
    pdf:
        fig-numbering: false
        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{geometry}
           - \geometry{margin=1in}
           - \usepackage{caption}
           - \DeclareCaptionFormat{APAfigure}{\textbf{#1#2}\\[1.5\baselineskip]\textit{#3}}
           - \captionsetup[figure]{format=APAfigure, labelsep=none, justification=raggedright, singlelinecheck=false, font=small}
          
fontsize: 12pt
engine: knitr
bibliography: ../bibliography.bib
csl: ../apa.csl
---


```{r, include=FALSE}
knitr::opts_chunk$set(message = FALSE, warning = FALSE, echo = FALSE)
```



:::{#fig-study1-models}

```{r fig-study1-models}
#| fig-numbering: false
#| 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"))
```

\raggedright \textit{Note.} Here the note that appears underneath the figure"

This is the caption underneath the figure number
:::



::: {#fig-study2-models}
\captionsetup[figure]{labelformat=empty}

```{r fig-study2-models}
#| number: false
#| 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"))
```


\raggedright \textit{Note.} Figure Note.

Figure Caption
:::

我尝试使用Fig-numbering: false并添加自定义LaTeX命令,但似乎注释的编号或位置都没有正确显示。 预先感谢您的帮助!

当仅依靠格式化 r 块中的标题和注释时,我无法使注释完全显示或不显示在图形下方。

如果您能在遵守 APA 格式的同时使其正常工作,我们将不胜感激!

r-markdown knitr quarto pdflatex
1个回答
0
投票

解决了这个问题:

:::{fig-study1-models}
```{r fig-study1-models}
#| fig-cap: "Caption Above 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"))
```

::: {fig-note}
\raggedright \textit{Note.} Figure Note underneath the figure"
:::
:::

::: {fig-study2-models}
```{r fig-study2-models}
#| fig-cap: "Figure Caption above"
#| 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"))
```

::: {fig-note} 
\raggedright \textit{Note.} Figure note...
:::
:::
© www.soinside.com 2019 - 2024. All rights reserved.