2

I am using RMarkdown to pull various .pdf's into one central file. These .pdfs are multiple pages in length. The code that I am using is:

--- title: <center> <h1>Analysis Data</h1> </center> mainfont: Arial output: pdf_document: latex_engine: xelatex sansfont: Arial fig_crop: false toc: true classoption: landscape fontsize: {10} geometry: margin=0.30in header-includes: - \usepackage{booktabs} - \usepackage{sectsty} \sectionfont{\centering} - \renewcommand{\contentsname}{}\vspace{-2cm} --- # File One \begin{center} \includegraphics[width=9.5in]{~/Desktop/DatasetOne.pdf} \end{center} \newpage # File Two \begin{center} \includegraphics[width=9.5in]{~/Desktop/DatasetTwo.pdf} \end{center} 

However, when I knit the final .pdf together, only the first page of each .pdf document ("DatasetOne.pdf" and "DatasetTwo.pdf") are included and not the entire document.

Is it possible to pull through the entire .pdf's rather than just the first page?

Thank you.

3
  • See stackoverflow.com/questions/2739159/… Commented Sep 8, 2017 at 1:15
  • Unfortunately, when I try to use the pdfpages package, I get the following error: ! Missing $ inserted. <inserted text> $ l.137 ...esktop/DatasetOne.pdf} pandoc: Error producing PDF Error: pandoc document conversion failed with error 43 Execution halted Commented Sep 8, 2017 at 1:46
  • I was able to get your example working on my end, see my answer. Commented Sep 8, 2017 at 2:02

1 Answer 1

5

I'm able to successfully include two different multi-page PDFs in your example document using pdfpages:

--- title: <center> <h1>Analysis Data</h1> </center> mainfont: Arial output: pdf_document: latex_engine: xelatex sansfont: Arial fig_crop: false toc: true classoption: landscape fontsize: {10} geometry: margin=0.30in header-includes: - \usepackage{booktabs} - \usepackage{sectsty} \sectionfont{\centering} - \renewcommand{\contentsname}{}\vspace{-2cm} - \usepackage{pdfpages} --- # File One \includepdf[pages={-}]{pdf1.pdf} \newpage # File Two \includepdf[pages={-}]{pdf2.pdf} 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.