rhe*_*dak 5 css markdown r ioslides kable
我想在一张幻灯片上放一张大桌子。我正在使用 kable。我试过了,{.smaller}但还不够,所以我想我会使用 .css 但它也不起作用。
我创建了一个示例演示文稿来说明问题。我尝试编织它,它的显示方式与我的其他演示文稿中的显示方式相同(这很长,这就是我在这里排除它的原因)
我的代码:
---
title: "test"
author: "Test Author"
date: "5 Februar 2018"
output:
ioslides_presentation:
test: presentation.css
---
{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(knitr)
## Test slide
{r}
table <- data.frame(
index=1:10,
long_text=c("long text here: asdfghhjoqweqwrqwrqwrasfasdfghhjoqweqwrqwrqwrasfasdfghhjoqweqwrqwrqwrasfasdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf")
)
kable(table)
## Test slide css {.test}
{r}
table <- data.frame(
index=1:10,
long_text=c("long text here: asdfghhjoqweqwrqwrqwrasfasdfghhjoqweqwrqwrqwrasfasdfghhjoqweqwrqwrqwrasfasdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf")
)
kable(table)
Run Code Online (Sandbox Code Playgroud)
还有我的 .css:
.test{
font-size: 50%;
}
Run Code Online (Sandbox Code Playgroud)
您可以通过修改 csstable和td属性来做到这一点。
示例 CSS 和代码:
table.rmdtable td, table th {
font-size: 40%;
padding: 1em 0.5em;
line-height: 18px;
}
Run Code Online (Sandbox Code Playgroud)
---
title: "test"
author: "Test Author"
date: "5 Februar 2018"
output:
ioslides_presentation:
css: presentation.css
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(knitr)
```
## Test slide
```{r}
table <- data.frame(
index=1:10,
long_text=c("long text here: asdfghhjoqweqwrqwrqwrasfasdfghhjoqweqwrqwrqwrasfasdfghhjoqweqwrqwrqwrasfasdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf")
)
kable(table)
```
## Test slide css {.test}
```{r}
table <- data.frame(
index=1:10,
long_text=c("long text here: asdfghhjoqweqwrqwrqwrasfasdfghhjoqweqwrqwrqwrasfasdfghhjoqweqwrqwrqwrasfasdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf",
"long text here: asdfghhjoqweqwrqwrqwrasf")
)
kable(table)
```
Run Code Online (Sandbox Code Playgroud)
我的建议是您在浏览器中打开演示文稿,例如 chrome。启动开发工具并使用css属性。然后,您可以将其构建到您的演示文稿 .css 文件中。
而不是修改整体幻灯片格式。我建议您阅读有关将css格式应用于特定幻灯片的内容。例如,只有您的两个测试幻灯片。
https://bookdown.org/yihui/rmarkdown/custom-css-1.html#slide-ids-and-classes
我希望这为您指明了正确的方向。
| 归档时间: |
|
| 查看次数: |
1290 次 |
| 最近记录: |