R Markdown-在html输出中更改字体大小和字体类型 [英] R Markdown - changing font size and font type in html output
问题描述
我正在RStudio中使用R Markdown和knit HTML选项来创建HTML输出.但是,用于纯文本块的输出中使用的字体很小,我想将其更改为其他字体并增加字体大小.有人可以显示一个示例来设置输出字体的方法吗-在没有大量html知识的情况下仍然可行?
I am using R Markdown in RStudio and the knit HTML option to create HTML output. However, the font used in the ouput for plain text blocks is rather small and I would like to change it to a differnt font and increase the font size. Can someone show an example how to set the output font - workable without a lot of knowledge in html?
到目前为止,我已尝试在降价文档的顶部进行操作,但这不起作用.
So far I tried at the top of my markdown document, but this doesn't work.
---
fontsize: 24pt
---
推荐答案
我认为YAML中的fontsize:
命令仅适用于LaTeX/pdf. 分开,仅在标准乳胶课程(文章,书籍和报告)中接受三种字体大小(10pt,11pt和12pt).
I think fontsize:
command in YAML only works for LaTeX / pdf. Apart, in standard latex classes (article, book, and report) only three font sizes are accepted (10pt, 11pt, and 12pt).
关于外观(不同的字体类型和颜色),您可以指定theme:
.请参见外观和样式.
Regarding appearance (different font types and colors), you can specify a theme:
. See Appearance and Style.
我想,您正在寻找的是您自己的css.
制作一个名为style.css
的文件,将其保存在与.Rmd
相同的文件夹中,并将其包含在YAML标头中:
I guess, what you are looking for is your own css.
Make a file called style.css
, save it in the same folder as your .Rmd
and include it in the YAML header:
---
output:
html_document:
css: style.css
---
在css文件中,定义字体类型和大小:
In the css-file you define your font-type and size:
/* Whole document: */
body{
font-family: Helvetica;
font-size: 16pt;
}
/* Headers */
h1,h2,h3,h4,h5,h6{
font-size: 24pt;
}
这篇关于R Markdown-在html输出中更改字体大小和字体类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!