Reputation: 727
Based on some other threads, I found out how to make some pages portrait and some landscape in R (see code below).
What I cannot seem to find is how to rotate the landscape pages by 90 degrees so they are legible.
Explanation below:
Create a "header.tex" file in your working directory, and save it with this text:
\usepackage{lscape}
\newcommand{\blandscape}{\begin{landscape}}
\newcommand{\elandscape}{\end{landscape}}
Then, run the below code:
---
title: "PortraitLandscape"
author: "John"
date: "September 1, 2015"
output:
pdf_document:
includes:
in_header: header.tex
---
Portrait
```{r}
summary(cars)
```
\newpage
\blandscape
Landscape
```{r, echo=FALSE}
plot(cars)
```
\elandscape
The second page will look like this:
While still leaving it in landscape, how can I make it rotated, like this?
Upvotes: 2
Views: 913
Reputation: 19857
You can use \pdfpageattr
. Adapting from this question (on tex.SE):
header.tex
\usepackage{lscape}
\newcommand{\blandscape}{
\begin{landscape}
\pagebreak[4]\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 90}}
\newcommand{\elandscape}{
\end{landscape}
\pagebreak[4]\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 0}}
Upvotes: 1