Gregory
Gregory

Reputation: 4279

How to control caption placement for figures in KnitR?

Is there a way to specify the placement of captions for figures generated by R using KnitR? I'm hoping that there's something functionally equivalent to xtable()'s caption.placement option.

A minimal working example is provided below.

\documentclass[12pt, english, oneside]{amsart}
\begin{document}

The caption for Figure \ref{fig:plot} is placed below the figure. Could we place it above, instead?
<<plot, echo=FALSE, fig.cap="Default caption placement is below the figure.">>=
plot(x=0, y=0)
@

\end{document}

Upvotes: 5

Views: 1035

Answers (1)

jamie.f.olson
jamie.f.olson

Reputation: 992

This would likely be best to deal with in the latex style for all figures, but you can customize figures with hooks. The fig.env chunk option controls the environment the block is inserted into. You could always make your own version of figure with your own formatting.

Upvotes: 3

Related Questions