Code box size and font size in RPres

本小妞迷上赌 提交于 2019-12-19 02:54:05

问题


I've worked in the past a good deal with knitr and beamer for slides. One thing I'm noticing now with R Presentations that dynamic sizing of both the code box and the size of the code font seems to be missing. With knitr/beamer I could easily change font size with the size argument (e.g., size="footnote" worked for denser slides) as well as changing the code box width for my slides with options(width=...).

I'm struggling with how to do this in the current implementation of R Presentations - any suggestions?


回答1:


@Florian's answer didn't work for me. I found a solution here that seems cleaner - credit to Andy Lyons for this fix.

Define a new style for smaller code at the beginning of the document, then apply it whenever you want the slide to use smaller code.

Here's an example of how to do it:

Presentation Title
========================================================
author: Jane Doe
transition: none

<style>
.small-code pre code {
  font-size: 1em;
}
</style>

Slide 1 - large code
========================================================
Regular slide text here

```{r}
head(cars)
```
Slide 2 - small code
========================================================
class: small-code

More regular slide text...
```{r}
head(cars)
```




回答2:


For the font size, wrapping the chunk in

<font size="X"> CHUNK </font> 

worked for me.



来源:https://stackoverflow.com/questions/25612385/code-box-size-and-font-size-in-rpres

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!