In R Markdown, one can out generate a word document with the YAML header output: word_document. This produces a very basic Word document. The basic appearance of this document can be customized by providing a reference template as described here.
However, I frequently produce Word documents of an exact template. Many of the journals I commonly submit to have a particular template they require submission in.
Is there anyway that I can more specifically customize how R Markdown converts to a Word document? Perhaps with additional custom YAML arguments? And also with the ability to calculate counts or other items from the .Rmd file, such as a word count or reference count? For example, ideally I would be able to provide a YAML like so:
---
title: How to make a custom Word template
authors:
- name: "John Doe, M.D."
affiliation: University of Texas
- name: "Jane Doe, M.D."
affiliation: University of California
- name: "Foo Bar, M.D."
affiliation: University of Texas
output: word_document
bibliography: bibliography.bib
keywords: word, pandoc, r
abstract: |
blah blah blah blah blah
---
And it produce an output like:
How to make a custom Word template
John Doe, M.D.1, Jane Doe, M.D.1, Foo Bar, M.D.1,2
- University of Texas
- University of California
ABSTRACT WORD COUNT: 4
MANUSCRIPT WORD COUNT: 500
NUMBER OF TABLES: 3
NUMBER OF FIGURES: 5
KEYWORDS: word, pandoc, R
NUMBER OF REFERENCES: 10
Abstract
Blah blah blah blah.
What is the - or is there a - better way to wield control over the Word document output in Rmarkdown in order to produce very specific output templates?