Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert appendix after references in Rmd using Rstudio?

I am using Rstudio, to create a pdf / html document from an Rmd file. The header looks sth like this:

title: "Title"
author: "Me"
date: "`r format(Sys.time(), '%B %d, %Y')`"
bibliography: bibliography.bib
output:
  html_document:
    toc: true
    number_sections: true

Now, I have some sections, and then include the references. After that, an appendix should follow, but I encounter the exact same problem as described here: Pandoc insert appendix after bibliography

There is a fixed solution in this thread, but I have no idea how I can do that within RStudio directly. To get the document, I just press the "Knit html" button, and do not run any pandoc commands myself. So where should I put the

--include-after-body

part, and how should the appendix rmd file look like?

like image 377
user3825755 Avatar asked Oct 15 '15 12:10

user3825755


2 Answers

As noted in the rmarkdown manual, you could use this syntax:

---
output:
  html_document:
    includes:
      after_body: appendix.md
---

This is equivalent to the general way to add arbitrary pandoc arguments to a Rmd file:

---
output:
  html_document:
    pandoc_args: ["--include-after-body=appendix.md"]
---
like image 176
scoa Avatar answered Oct 26 '22 03:10

scoa


The following might be easier; works if you knit to PDF, Word or HTML:

Everything I wanted to say in the main document.

# References

<div id="refs"></div>

\newpage
# Appendix

Some details that will bore the readers of the main document.

In the original post, this was also posted as an answer (few years after current question was asked): see https://stackoverflow.com/a/44294306/8234333 and https://stackoverflow.com/a/16428699/8234333

like image 27
Marjolein Fokkema Avatar answered Oct 26 '22 02:10

Marjolein Fokkema