I'm trying to write a report using the rmarkdown
package and as it is, unfortunately, customary in my field reports are often submitted as MS Word documents. So I can't always rely on the power of LaTeX
and have to be able convert my .Rmd to MS Word. Now, because I want to be able to create PDF and MS Word files from the same source file, I'm trying to find a general way to do this. I've got PDF working using the apa6
LaTeX-document class. The .Rmd will look something like this when creating a Word file:
---
title: My title
abstract: This is the abstract.
author: John Doe
affiliation: Unknown
note: Nothing to say.
output:
word_document:
reference_docx: myreference.docx
---
Lorem ipsum.
I can create a Word document from this but for obvious reasons my custom yaml
-variables (e.g. abstract) will not be rendered in the document.
So basically, my problem is the following:
When creating a word document, how can I add a title page (including author names, affiliations, author notes, etc.) and another page with just the abstract before the document body ("Lorem ipsum")? The focus here is not to create pagebreaks (there are other open questions on this), but rather **is there a way to make pandoc
use the custom yaml
variables place them at the beginning of the document and assign styles to them?
The rmarkdown
package provides an include()
function but it only works with HTML and PDF documents.