Apply pandoc_args to only part of an rmarkdown doc - eg two columns

Viewed 423

Is there a way to create an output with rmarkdown that only has two columns for part of the page? That is I want a header and some text that stretches across a whole page but the figures remain in column formats. Consider the example below where columns are set to 2 but the header remains in there.

Update

I got a bit closer here with the \twocolumn solution but then a new blank page is created.

---
title: "twocol_test"
author: "test"
output: pdf_document
---
  
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## This header should stretch across the whole page
Then this text should also not be in a column. But then the figures below should be organized into two columns:

\twocolumn

```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
```

```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
```

\onecolumn


```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
```

```{r}
plot(iris$Sepal.Length, iris$Sepal.Width)
```

More generally the question is how to apply a pandoc arg to only part of the .Rmd file?

1 Answers
Related