how to include an abstract in a rmakdown Rmd file

2019-05-01 12:34发布

问题:

In a .Rmd file with the header below, I want to include an abstract, so I tried the standard LateX article form,

\abstract{This paper explores a variety of topics related to the question of testing the equality of
covariance matrices in multivariate linear models, particularly in the MANOVA setting. 
The main focus is on graphical methods that can be used to understand features of data related
to this question.}

But, surprisingly (I know this seems weird), the references in my References section become badly formatted -- no spacing between references, odd indentations. So, how can I include something that looks like an abstract?

My YAML header is:

---
title: "Notes on Testing Equality of Covariance Matrices"
author: "Michael Friendly"
date: '`r format(Sys.time(), "%B %d, %Y")`'
output:
  pdf_document:
    fig_caption: yes
    keep_tex: yes
    number_sections: yes
    includes:
        in_header: mystyles.tex
 csl: apa.csl
bibliography: 
  - "C:/Users/friendly/Dropbox/localtexmf/bibtex/bib/statistics.bib"
  - "C:/Users/friendly/Dropbox/localtexmf/bibtex/bib/graphics.bib"
---

Edit: Thinking this over, the problem may be that pandoc-citeproc is somehow confused by something done by using \abstract{} in the document.

回答1:

The rmarkdown package now allows for including an abstract in your YAML. Like so:

abstract: "This is my abstract."

See this blog post for an example.