更改RMD摘要的行距?

时间:2018-08-31 15:02:34

标签: yaml r-markdown knitr

是否可以将YAML标头中指定的摘要的行距更改为单个空格,而将文档的其余部分保留为双倍空格?我的YAML如下:

output:  pdf_document
number_sections: true
title: | 
  | My Title
author: 
- Me
header-includes:
    - \usepackage{setspace}\doublespacing
    - \usepackage{float}
abstract: "My abstract"
keywords: "My keywords"
date: "`r format(Sys.time(), '%B %d, %Y')`"
geometry: margin=1in
fontsize: 12pt
spacing: double
fig_caption: yes
indent: true
---

我已经尝试过像这样包装摘要,但是没有用:

abstract: 
    - \usepackage{setspace}\singlespacing
"My abstract"
    - \end{singlespacing}

1 个答案:

答案 0 :(得分:3)

摘要是自动包装的,因此可以在其之前使用\singlespacing

---
output:  pdf_document
number_sections: true
title: | 
  | My Title
author: 
- Me
header-includes:
    - \usepackage{setspace}\doublespacing
    - \usepackage{float}
abstract: \singlespacing My abstract which has to be long enough to take multiple
  lines otherwise one does not see the effect of single-spacing.
keywords: "My keywords"
date: "`r format(Sys.time(), '%B %d, %Y')`"
geometry: margin=1in
fontsize: 12pt
fig_caption: yes
indent: true
---


## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for
authoring HTML, PDF, and MS Word documents. For more details on using R Markdown
see <http://rmarkdown.rstudio.com>.

结果:

enter image description here