rマークダウンロングテーブル+ランドスケープケーブルキャプション幅の縮小(ページの幅ではなくなりました)

Dec 14 2020

複数のページにまたがる広いテーブルにlongtableとlanscapeを一緒に使用しようとしています。これを行うと、テーブルのキャプションがページの全幅からページの中央で押しつぶされるようになります。

私は役に立たないために以下の提案を使用しようとしました。Rマークダウンテーブルのキャプション幅(ケーブルとロングテーブル付き)

私はrマークダウンに不慣れで、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()

**編集:私はPDFに編み物をしています!!

回答

1 Paul Dec 15 2020 at 06:11
---
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()
```

ソリューションごとのようにRマークダウンテーブルキャプション幅KABLEとlongtable