r markdown longtable + landscape kable başlık genişliği küçülüyor (artık sayfa genişliği değil)

Dec 14 2020

Birden çok sayfaya yayılan geniş bir tablo için longtable ve lanscape'i birlikte kullanmaya çalışıyorum. Bunu yaptığımda, tablo başlığı sayfanın tam genişliğinden sayfanın ortasına doğru uzanıyor.

Aşağıdaki önerileri boşuna kullanmayı denedim. Kable ve longtable ile R Markdown table caption width

Markdown konusunda yeniyim ve latek'e hiç aşina değilim, bu yüzden yukarıdaki talimatlara uymak benim için kafa karıştırıcı oldu, ancak doğru olduğunu düşündüğüm tüm seçenekleri denedim. Birisi bana bu sorunu gidermek için YAML'de nereye ve neyi yazacağıma dair çok açık adım adım talimatlar verebilir mi? Ya da etrafta başka bir işi olan var mı? Yardımın için teşekkürler

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()

** düzenleme: PDF'ye örüyorum !!

Yanıtlar

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()
```

Çözelti uygun olarak R, Markdown tablo başlık genişliği kable ve longtable