【问题标题】:Change the position of a table caption (tufte_handout)更改表格标题的位置 (tufte_handout)
【发布时间】:2017-08-24 14:03:37
【问题描述】:

这是一个 R -> 乳胶问题。 我用 tufte_handout

我需要将全角表格的标题放在表格下方,在边距中,因为表格太宽了。

这里是 Rmarkdown 文件

---
title: "Untitled"
author: "A. Nonymous"
date: "19/8/2017"
header-includes:
   - \usepackage{array}
output:
  tufte::tufte_handout:
    citation_package: natbib
    keep_tex: yes
    latex_engine: xelatex
---

```{r setup, include=FALSE}
library(tidyverse)
library(tibble)
library(knitr)
library(kableExtra)
library(tufte)

knitr::opts_chunk$set(echo = TRUE)

options(knitr.table.format = "latex") 
```


# table


```{r table-1, fig.fullwidth=T, echo=FALSE}

tmp <- tibble(`long titre de texte de colonne` = 1:3, 
              `encore un long titre de colonne` = 101:103,
       `c'est très long là aussi (trop)`=31:33, 
       `mais pourquoi est-ce si long ? (oui, pourquoi?)`=c("a","b","b"))
tmp <- as.data.frame(tmp)

knitr::kable(tmp,booktabs=TRUE,caption="test de test de table, mais c'est trop long et oh là là ça fait une collision") %>% 
  column_spec(1, width = "10em") %>%
  column_spec(2, width = "10em") %>%
  column_spec(3, width = "10em") %>%
  column_spec(4, width = "10em") 

```

【问题讨论】:

标签: r knitr r-markdown bookdown tufte


【解决方案1】:

我知道这不是您正在寻找的内容,但我遇到了同样的问题,并且将表格代码块包装在 ::: {.fullwidth} ::: 中防止了重叠的标题(至少)。注意,这里我只是在块“```”前加了一个“”,用于可视化。

::: {.fullwidth}
\```{r table-1, fig.fullwidth=T, echo=FALSE}

tmp <- tibble("long titre de texte de colonne" = 1:3, 
              "encore un long titre de colonne" = 101:103,
       "c'est très long là aussi (trop)" = 31:33, 
       "mais pourquoi est-ce si long ? (oui, pourquoi?)" = c("a","b","b"))
tmp <- as.data.frame(tmp)

knitr::kable(tmp,booktabs=TRUE,caption="test de test de table, mais c'est trop long et oh là là ça fait une collision") %>% 
  column_spec(1, width = "10em") %>%
  column_spec(2, width = "10em") %>%
  column_spec(3, width = "10em") %>%
  column_spec(4, width = "10em") 

\```
:::

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多