1. 直接插入css
直接在.rmd文件中插入css进行样式修饰,插入位置紧随文件头部‘—’之后,如下将标题部分设置为居中
---
title: 'test'
author: 'yuhe'
date: '2018-12-26'
output: html_document
---
<style type="text/css">
#header {
text-align: center;
}
</style>
2. 引用css
在头部加入对css的引用:
---
title: "test"
author: "yuhe"
date: "2018-12-26"
output: html_document
css: thecss.css
---
3. 引用主题
可以通过设置theme引用固定的主题样式:
---
title: "test"
author: "yuhe"
date: "2018-12-26"
output:
html_document:
theme: flatly
---
如果使用RStudio,可以通过页面进行设置: