I made a presentation in RStudio with RMarkdown/Knitr - it compiles without problems to a pdf (via LaTeX Beamer).
But I cannot get the LaTeX file. Is there any way to export also the LaTeX file which should be produced in the conversion?
(This was not the original accepted answer, but has since been accepted and then edited to reflect this change.)
As of late 2018, the following works:
---
title: "Untitled"
author: "Author Person"
date: "November 26, 2018"
output:
pdf_document:
keep_tex: yes
---
Note that this answer is the YAML automatically inserted by the RStudio program (circa 2018) when you follow the instructions above to use the GUI to make this setting. So I assume the formatting is in the preferred style.
beamer_presentation:
is used instead of pdf_document
. As of 2022, the keep_tex:
part must be indented!
to answer the 1st comment, here is some sample LaTeX
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{DF <-}\KeywordTok{read.table}\NormalTok{(}
\DataTypeTok{text=}
\StringTok{"Year State Histadrut Private}
\StringTok{1985 27 26 47}
\StringTok{1993 10 14 76}
\StringTok{"}\NormalTok{, }\DataTypeTok{header=}\OtherTok{TRUE}\NormalTok{)}
\KeywordTok{library}\NormalTok{(ggplot2)}
\KeywordTok{library}\NormalTok{(reshape2)}
produced by compiling
some simple RMD
```{r}
DF <-read.table(
text=
"Year State Histadrut Private
1985 27 26 47
1993 10 14 76
", header=TRUE)
library(ggplot2)
library(reshape2)
```
output: pdf_document: keep_tex: yes