I want to insert a document before the table of contents of my Word exported markdown document.
My idea is to change pandoc template as indicated here.
Before changing the pandoc template however, I need to pass the document to insert to pandoc.
So I tried:
---
title: "Test"
author: "ben"
date: "2/2/2017"
output:
word_document:
toc: true
pandoc_args: [
"-B", "BeforeBody.Rmd"
]
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = 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>.
# Click
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this
But nothing happens, I just have my Word document, without the inserted text before the body.
I also tried to insert a Word document:
output:
word_document:
toc: true
pandoc_args: [
"-B", "/Users/ben/test.docx"
]
But nothing happens.
I also tried:
output:
word_document:
toc: true
pandoc_args: [
"--include-before-body", "/Users/ben/test.docx"
]
and
output:
word_document:
toc: true
pandoc_args: [
"--include-before", "/Users/ben/test.docx"
]
... still nothing. What can I do?