0

I have a situation where i am knitting a bunch of figures in \enumerate and figures are big such that I would prefer one page for every figure.

\documentclass{article}

\begin{document}
\begin{enumerate}

\item Lets' try figure 1. 
<<fig1, include=TRUE, fig.pos='htbp', fig.align='center', fig.cap='fig1', fig.height=5, fig.width=5>>=
set.seed(1213)  # for reproducibility
x = cumsum(rnorm(100))
mean(x)  # mean of x
plot(x, type = 'l')  # Brownian motion
@

\item Lets' try figure 2. 
<<fig2, include=TRUE, fig.pos='htbp', fig.align='center', fig.cap='fig2'>>=
set.seed(1213)  # for reproducibility
x = cumsum(rnorm(100))
mean(x)  # mean of x
plot(x, type = 'l')  # Brownian motion
@

\item Lets' try figure 3. 
<<fig3, include=TRUE, fig.pos='htb!', fig.align='center', fig.cap='fig3'>>=
set.seed(1213)  # for reproducibility
x = cumsum(rnorm(100))
mean(x)  # mean of x
plot(x, type = 'l')  # Brownian motion
@
\end{enumerate}

\end{document}

I can use fig.width and fig.height to control the size of each figure, but I thought if there was an elegant way to have one figure per page? maybe making changes in enumerate or in chunks? Thanks.

1 Answer 1

1

One way would be the manual use of \newpage commands. If it is a

\documentclass{article}

\begin{document}
\begin{enumerate}

\item Lets' try figure 1. 
<<fig1, include=TRUE, fig.pos='htbp', fig.align='center', fig.cap='fig1', fig.height=5, fig.width=5>>=
set.seed(1213)  # for reproducibility
x = cumsum(rnorm(100))
mean(x)  # mean of x
plot(x, type = 'l')  # Brownian motion
@
\newpage
\item Lets' try figure 2. 
<<fig2, include=TRUE, fig.pos='htbp', fig.align='center', fig.cap='fig2'>>=
set.seed(1213)  # for reproducibility
x = cumsum(rnorm(100))
mean(x)  # mean of x
plot(x, type = 'l')  # Brownian motion
@
\newpage
\item Lets' try figure 3. 
<<fig3, include=TRUE, fig.pos='htb!', fig.align='center', fig.cap='fig3'>>=
set.seed(1213)  # for reproducibility
x = cumsum(rnorm(100))
mean(x)  # mean of x
plot(x, type = 'l')  # Brownian motion
@
\end{enumerate}

\end{document}
1
  • This works. Thanks. I would wait for an elegant answer to this :).
    – tallharish
    Commented Apr 25, 2015 at 19:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .