Change line spacing for RMD abstract?

ぐ巨炮叔叔 提交于 2020-05-13 10:48:23

问题


Is it possible to change the line spacing for the abstract specified in my YAML header to single space, while leaving the rest of the document in double space? My YAML is below:

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
---

I've tried wrapping the abstract like so, but it did not work:

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

回答1:


The abstract is automatically wrapped, so it is enough to use \singlespacing before it:

---
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>.

Result:



来源:https://stackoverflow.com/questions/52118202/change-line-spacing-for-rmd-abstract

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!