latex - r markdown longtable + Landscape kable标题宽度缩小(不再是页面宽度)
问题描述
我正在尝试将 longtable 和 lanscape 一起用于跨多个页面的宽表。当我这样做时,表格标题从页面的整个宽度变为页面中间的挤压。
我尝试使用以下建议无济于事。 R Markdown表格标题宽度与kable和longtable
我是 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()
**编辑:我正在编织 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()
```
推荐阅读
- html - 列不会与 Rails 中的行中间对齐
- c# - EF6:无法识别对 db 上下文所做的更改
- java - ArrayList ArrayList in Java with SQLite 请教
- c++ - C++ 包括文件
- java - 如何在初始化期间从导入中为 LinkedHashMap removeEldestEntry 提供自定义函数
- javascript - 如何在对象上正确运行函数以及如何正确使用 .apply() 在对象上运行方法?
- javascript - PHP mysql varchar到两个日期过滤器不起作用
- ios - 在 iOS 上获取系统范围的 CPU 使用率
- dpdk - 为什么大页面没有更新
- c - 无锁链表实现