I'm created a PDF document using RMarkdown in RStudio using default options.
I want to use figure options like fig.env and fig.ncol, as specified in https://rstudio.com/wp-content/uploads/2015/03/rmarkdown-reference.pdf.
Some options like "fig.cap" work, but in the rendered tex, none of my custom environments created work. What is going wrong here?
My ultimate purpose is to use a latex template that specifies multicols. Using the figure* environment is a recommended way to get an image to render full-page within a multicols environment.
My full document looks like:
---
title: "testing graphics output"
author: "my test author"
date: "20 January 2020"
output:
pdf_document:
keep_tex: yes
---
'```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
'```
## Including Plots
You can also embed plots, for example:
'```{r pressure, echo=FALSE,fig.cap="Here's a figure caption",fig.env="figure*"}
plot(pressure)
'```
'```{r pressure2, echo=FALSE,fig.cap="Here's a figure caption",fig.env="custom_env"}
plot(pressure)
'```
'```{r pressure3, echo=FALSE,fig.cap="Here's a figure caption for a GGplot",fig.env="figure*", fig.ncol=2}
library(ggplot2)
ggplot(pressure,aes(x = temperature,y=pressure))+geom_point()
'```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
The rendered output just for the plots are:
\begin{figure}
\centering
\includegraphics{rmarkdown-graphics-test_files/figure-latex/pressure-1.pdf}
\caption{Here's a figure caption}
\end{figure}
\begin{figure}
\centering
\includegraphics{rmarkdown-graphics-test_files/figure-latex/pressure2-1.pdf}
\caption{Here's a figure caption}
\end{figure}
\begin{figure}
\centering
\includegraphics{rmarkdown-graphics-test_files/figure-latex/pressure3-1.pdf}
\caption{Here's a figure caption for a GGplot}
\end{figure}