1. 直接插入css

直接在.rmd文件中插入css进行样式修饰,插入位置紧随文件头部‘—’之后,如下将标题部分设置为居中

---
title: 'test'
author: 'yuhe'
date: '2018-12-26'
output: html_document
---
<style type="text/css">
	#header {
	    text-align: center;
	}
</style>

Rmarkdown生成html的样式

2. 引用css

在头部加入对css的引用:

---
title: "test"
author: "yuhe"
date: "2018-12-26"
output: html_document
css: thecss.css
---

Rmarkdown生成html的样式

3. 引用主题

可以通过设置theme引用固定的主题样式:

---
title: "test"
author: "yuhe"
date: "2018-12-26"
output: 
  html_document: 
    theme: flatly
---

Rmarkdown生成html的样式
如果使用RStudio,可以通过页面进行设置:

Rmarkdown生成html的样式

Rmarkdown生成html的样式

相关文章:

  • 2022-12-23
  • 2021-09-19
  • 2022-12-23
  • 2021-10-05
  • 2021-09-29
  • 2022-12-23
  • 2022-02-10
  • 2022-02-25
猜你喜欢
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2022-03-05
  • 2022-01-15
相关资源
相似解决方案