问题描述
我正在尝试更改代码块的字体大小(更确切地说,我想使用较小的字体).以下面的基本示例为例:
I am trying to change the font size of a code chunk (more precisely I want to use a smaller font).Take the following basic example:
---
title: "Example"
output:
ioslides_presentation:
toc: yes
widescreen: yes
---
## Code
```{r, eval=FALSE}
print(mtcars)
```
有人知道吗?是否有像代码字体大小之类的YAML选项?
Anyone an idea? Is there a YAML option like code-font-size or something like that?
推荐答案
您可以使用以下方法更改默认字体大小的文档
You can change the default font size document wide using
<style>
pre {
font-size: 20px;
}
</style>
,您可以将其放在YAML标头下方或单独的样式表(CSS文件)中,您可以包括在您的YAML中.
which you can put right underneath your YAML header or in a seperate stylesheet (CSS file) that you can include in your YAML.
您可能还想更改padding
和margin
的设置,以美化数据块的布局.
You may want to change the settings for padding
and margin
as well in order to prettify chunk layout.
修改单个块
可以将一个类添加到要修改的代码块中(如果不是全部).在此处查看答案:stackoverflow.com/questions/37944197/
It is possible to add a class to the code chunks you want to modify (if not all of them). Check out the answer here: stackoverflow.com/questions/37944197/
这篇关于Markdown:更改ioslides中代码块的默认字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!