0

I am trying to add one or more appendix pages after my references when using Latex in Rmarkdown. After trying the solutions in "Pandoc insert appendix after bib" and "Insert Appendix after references" I get an error that doesn't make any sense to me because the solution it provides it has to do with numeric types (which I am not dealing with?).

My header:

---
title: "A smart title here"
author: "Ashameed Person"
geometry: margin=1in
header-includes:
  \usepackage{array}
  \usepackage{tabularx}
  \AtBeginDocument{\let\maketitle\relax} #to hide title
output:
  bookdown::pdf_book:
    fig_caption: yes
    keep_tex: no
    number_sections: yes
    toc: yes
    toc_bib: yes
    toc_depth: 2
    citation_package: natbib
    pandoc_args: ["--include-after-body=appendix.md"]
fontsize: 12pt
bibliography: WorkCited.bib
biblio-style: humannat
link-citations: true
---

My Rmd file:

knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE, eval = TRUE)
\section{new section}
A lot of gibirish \citep{scottdamblon2010, hirth2010}.
See appendix for more info.

When compiling my document I get the following error:

! Missing $ inserted.
                $
l.142   bookdown::pdf_
                      book: 

Try to find the following text in Draft1.Rmd:
  bookdown::pdf_ 

You may need to add $ $ around a certain inline R expression `r ` in Draft1.Rmd (see the above hint). See https://github.com/rstudio/rmarkdown/issues/385 for more info.
Error: LaTeX failed to compile Draft1.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Draft1.log for more info.
Execution halted

My appendix.md is similar to that of the above and it looks like this:

---
output:
  bookdown::pdf_book:
    keep_tex: yes
    number_sections: no
    citation_package: natbib
fontsize: 12pt
link-citations: true
---

\section{Appendix B - Raw Data}
\newpage
Raw data can be found at some repository

I have also tried to use the file extension .Rmd and .tex instead of the .md found at after the argument pandoc_args:. In addition, I have tried to change pandoc_args: with includes: after_body: appendix.md but this compiles my pdfbook but does not add the appendix section.

You can find my references, my orginal rmd, humannat file, and appendix file, in these github's link.

kilojoules
  • 9,768
  • 18
  • 77
  • 149
  • 1
    Can you rework this into a minimal reproducible example? https://stackoverflow.com/help/minimal-reproducible-example – kilojoules Jun 10 '20 at 18:12
  • I am new to posting and coding, I hope this addresses the issue – Jonathan Roldan Jun 10 '20 at 21:08
  • 1
    For some reason, latex is attempting to compile `pdf_book`. Try to reproduce this problem using the fewest lines of code possible. One approach to doing this is simply deleting all the lines that do not cause this error. – kilojoules Jun 11 '20 at 21:27

0 Answers0