Latex r markdown longtable+;横向字幕宽度缩小(不再是页面宽度)

Latex r markdown longtable+;横向字幕宽度缩小(不再是页面宽度),latex,r-markdown,landscape,kable,longtable,Latex,R Markdown,Landscape,Kable,Longtable,我正在尝试将longtable和lanscape一起用于跨多个页面的宽表。当我这样做时,表格标题会从页面的整个宽度转到页面中间部分。 我尝试过使用以下建议,但没有效果。 我是r markdown的新手,我对latek一点也不熟悉,所以按照上面的说明来做对我来说很困惑,尽管我已经尝试了所有我认为正确的选项。有人能给我非常明确的一步一步的指示,在YAML中放在哪里以及放什么来解决这个问题吗?或者有人有其他工作吗?谢谢你的帮助 test <- data.frame(col1=rep("

我正在尝试将longtable和lanscape一起用于跨多个页面的宽表。当我这样做时,表格标题会从页面的整个宽度转到页面中间部分。

我尝试过使用以下建议,但没有效果。

我是r markdown的新手,我对latek一点也不熟悉,所以按照上面的说明来做对我来说很困惑,尽管我已经尝试了所有我认为正确的选项。有人能给我非常明确的一步一步的指示,在YAML中放在哪里以及放什么来解决这个问题吗?或者有人有其他工作吗?谢谢你的帮助

test <- data.frame(col1=rep("MyLongWordsareLong",5),
               col2=rep("MyLongWordsareLong",5),
               col3=rep("MyLongWordsareLong",5),
               col4=rep("MyLongWordsareLong",5),
               col5=rep("MyLongWordsareLong",5),
               col6=rep("MyLongWordsareLong",5))

kable(test,format='latex',booktabs=TRUE,
caption="This is my example caption. See how, when I don't use 
longtable, it extends the full width of the table, but when I use the 
longtable option, it compresses down to only a portion of the table's width. 
Is this weird or is it just me?") %>% 
 landscape()

kable(test,longtable=TRUE,format='latex',booktabs=TRUE,caption="This is my 
example caption. See how, when I don't use longtable, it extends the full 
width of the table, but when I use the longtable option, it compresses down 
to only a portion of the table's width. Is this weird or is it just me?") 
%>% 
landscape()
test%
景观()
kable(test,longtable=TRUE,format='latex',booktab=TRUE,caption=“这是我的
示例标题。看看当我不使用longtable时,它是如何扩展整个
表的宽度,但当我使用longtable选项时,它会向下压缩
只是桌子宽度的一部分。这是奇怪还是只有我?)
%>% 
景观()
**编辑:我正在编织PDF

---
---
title: "Untitled"
author: "anonymous"
date: "14/12/2020"
header-includes:
  - \usepackage{caption}
output:
  pdf_document:
    keep_tex: yes
  html_document: default
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(kableExtra)
```

```{r}
test <- data.frame(col1=rep("MyLongWordsareLong", 5),
               col2=rep("MyLongWordsareLong",5),
               col3=rep("MyLongWordsareLong",5),
               col4=rep("MyLongWordsareLong",5),
               col5=rep("MyLongWordsareLong",5),
               col6=rep("MyLongWordsareLong",5))

kable(test, booktabs=TRUE, caption="This is my example caption. See how, when I don't use  longtable, it extends the full width of the table, but when I use the longtable option, it compresses down to only a portion of the table's width.  Is this weird or is it just me?") %>% 
 landscape()

kable(test, longtable=TRUE, booktabs=TRUE, caption="This is my example caption. See how, when I don't use longtable, it extends the full  width of the table, but when I use the longtable option, it compresses down to only a portion of the table's width. Is this weird or is it just me?") %>% 
landscape()
```
标题:“无标题” 作者:“匿名” 日期:“14/12/2020” 标题包括: -\usepackage{caption} 输出: pdf\U文件: 泰克斯:是的 html_文档:默认值 --- ```{r设置,include=FALSE} knitr::opts_chunk$set(echo=TRUE) 图书馆(tidyverse) 图书馆(kableExtra) ``` ```{r} 测试% 景观() kable(test,longtable=TRUE,booktables=TRUE,caption=“这是我的示例说明。看看当我不使用longtable时,它如何扩展表的整个宽度,但当我使用longtable选项时,它只压缩到表宽度的一部分。这是奇怪的还是只有我一个人?”)%>% 景观() ```

根据

的解决方案我不太清楚您对我所拥有的有何改变?请注意,我正在编织PDF。当我将其添加到YAML时,我得到以下错误:YAML::YAML.load(…,eval.expr=TRUE)中的错误:解析器错误:在分析第1行的块映射时,第1列在第7行没有找到预期的键,第3列调用:。。。解析yaml\u front\u matter->yaml\u load->Execution halted我认为这是yaml中的缩进问题。我已经试着在答案中解决了这个问题。这是我产生错误的全部YAML。希望这会有所帮助:-标题:“报告”作者:Michelle L.Stantial date:“
r格式(Sys.time(),“%d%B%Y”)
”输出:标题包括:-\usepackage{caption}pdf\u文档:keep\u tex:yes toc:yes fig\u标题:yes includes:in\u header:my\u header.tex word\u文档:toc:yes html\u文档:toc:yes toc\u float:collapsed:no fig\u宽度:6 fig\u高度:4---对不起。草率的测试。我再次编辑,复制粘贴和编织成功,所以现在应该是正确的。