Quarto/rmarkDown到PDF:如何增加表的亚capt仪之间的边距?

发布于 2025-02-07 20:26:07 字数 797 浏览 3 评论 0原文

使用Quarto/rmarkDown I导出一个PDF,其中包含一个代码块,该代码块包含两个表。子尺寸。

如何将下部子帽的边缘增加到上表?

我的代码:

#| label: tbl-1985
#| tbl-cap: "*Was Wann Wo* im Jahr 1985"
#| tbl-subcap: 
#|   - "Auswertung nach Kategorien"
#|   - "Besonderheiten"
#| layout-nrow: 2
#| fig-pos: 'H'

# table 1
df_table_1 %>% 
    knitr::kable(., caption = paste0("\\textit{Was Wann Wo} im Jahr ", year)) %>%
    kableExtra::kable_styling(latex_options = "scale_down")

# table 2
df_table_2 %>% 
    knitr::kable(., caption = paste0("Besonderheiten im Jahr ", year)) %>% 
    kableExtra::column_spec(2, width = "12cm")

“在此处输入图像描述”

Using Quarto/RMarkdown I export a PDF that includes a code chunk that produces two tables incl. subcaps.

How can I increase the margin of the lower subcap to the upper table?

My code:

#| label: tbl-1985
#| tbl-cap: "*Was Wann Wo* im Jahr 1985"
#| tbl-subcap: 
#|   - "Auswertung nach Kategorien"
#|   - "Besonderheiten"
#| layout-nrow: 2
#| fig-pos: 'H'

# table 1
df_table_1 %>% 
    knitr::kable(., caption = paste0("\\textit{Was Wann Wo} im Jahr ", year)) %>%
    kableExtra::kable_styling(latex_options = "scale_down")

# table 2
df_table_2 %>% 
    knitr::kable(., caption = paste0("Besonderheiten im Jahr ", year)) %>% 
    kableExtra::column_spec(2, width = "12cm")

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三生殊途 2025-02-14 20:26:08

一个选项可以使用布局选项来在两个表之间创建一些垂直空间。
根据复杂布局上的四分之一文档

布局属性是一个二维数组,其中第一个维度定义行和第二列。在这种情况下列。

您也可以使用负值在元素之间创建空间。

---
format: pdf
execute: 
  echo: false
---


```{r}
#| label: data

df_table_1 <- head(mtcars, 15)
```


```{r}
#| label: tbl-1985
#| tbl-cap: "*Was Wann Wo* im Jahr 1985"
#| tbl-subcap: 
#|   - "Auswertung nach Kategorien"
#|   - "Besonderheiten"
#| layout: "[[1], [-1], [1]]"
#| fig-pos: 'H'

# table 1
knitr::kable(df_table_1)

# table 2
knitr::kable(df_table_1)
```


One option could be using layout option to create some vertical space between the two table.
As per the Quarto documentation on complex layout,

The layout attribute is a 2-dimensional array where the first dimension defines rows and the second columns. In this case layout="[[1,1], [1]]" translates to: create two rows, the first of which has two columns of equal size and the second of which has a single column.

You can also use negative values to create space between elements.

---
format: pdf
execute: 
  echo: false
---


```{r}
#| label: data

df_table_1 <- head(mtcars, 15)
```


```{r}
#| label: tbl-1985
#| tbl-cap: "*Was Wann Wo* im Jahr 1985"
#| tbl-subcap: 
#|   - "Auswertung nach Kategorien"
#|   - "Besonderheiten"
#| layout: "[[1], [-1], [1]]"
#| fig-pos: 'H'

# table 1
knitr::kable(df_table_1)

# table 2
knitr::kable(df_table_1)
```

vertical space between tables.


~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文