Hi Yihui

For figures in latex my bible is
Keith Reckdahl Using Imported Graphics in LATEX and pdfLATEX Version 3.0.1 January 12, 2006
I think there is a 2009 version but I cannot find it

Below is an example of a 3 X 1 figure

\begin{figure}[h]
\centering
% Figure A
\subfloat[A]{
\label{subfig:continued:S13a} %% label ref sub A
\includegraphics[height=4in,%
                 clip=true,%
                 trim=0in 0in 0in 0in,% LBRT
                 keepaspectratio=true]%
                 {OV02a.pdf}
% caption
\caption[Regression diagnostic test plot: individual farms]%
{Regression diagnostic test plot: individual farms}%
\label{fig:continued:OV2a} %% label for first figure
\end{figure}
%
% Figure B
\begin{figure}[!h]
\ContinuedFloat
\centering
\subfloat[B]{
\label{subfig:continued:S13b} %% label ref subfig B
\includegraphics[height=4in,%
                 clip=true,%
                 trim=0in 0in 0in 0in,% LBRT
                 keepaspectratio=true]%
                 {OV02b.pdf}
% caption
\caption[Regression diagnostic test plot: individual farms]%
{Regression diagnostic test plot: individual farms }%
\label{fig:continued:OV2b} %% label for second figure
\end{figure}
%
% Figure C
\begin{figure}[!h]
\ContinuedFloat
\centering
\subfloat[C]{
\label{subfig:continued:S13c} %% label subfig C
\includegraphics[height=4in,%
                 clip=true,%
                 trim=0in 0in 0in 0in,% LBRT
                 keepaspectratio=true]%
                 {OV02c.pdf}
% caption
\caption[Regression diagnostic test plot: individual farms]%
{Regression diagnostic test plot for individual farms}%
\label{fig:continued:OV2c} %% label for 3 figure
\end{figure}
\clearpage

the code also works with sidewaysfigure
At first I had problems with getting the subcaptions right - I think this is right In the subfig label I added the figure 'number' S13 to avoid duplicating if more than one in a tex file There may be other variants but see Reckdahl - you may have to change things slightly for spacing
I have amended it to omit \Sexpr values within

HTH

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mac...@northnet.com.au


At 08:50 30/08/2012, you wrote:
Do you know what environments are allowed inside \subfloat{}? The
graphics example works because it is nothing but a simple
\includegraphics{} command. The table example you gave is much more
complicated than that.

Regards,
Yihui
--
Yihui Xie <xieyi...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Wed, Aug 29, 2012 at 3:30 PM, Liviu Andronic <landronim...@gmail.com> wrote:
> Hey Yihui
>
>
> On Wed, Aug 29, 2012 at 6:17 PM, Yihui Xie <x...@yihui.name> wrote:
>> Yes that is one possible solution, but the filename is hard-coded
>> somehow. The key to this problem is a missing new line before <<>>=,
>> which was addressed in
>> https://github.com/downloads/yihui/knitr/knitr-subfloats.pdf
>>
> Thanks a lot for the example.
>
>
>> The LyX and Rnw source files can be checked out with GIT under
>> https://github.com/yihui/knitr/tree/master/inst/examples If you open
>> knitr-subfloats.lyx, you will see an intentional new line in the ERT,
>> and that is to break \subfloat[asdfa]{<<>>= into
>>
>> \subfloat[asdfa]{
>> <<>>=
>>
> This trick doesn't seem to work for table subfloats. I added a nearly
> identical example to your document, this time using table floats
> (instead of figure floats). [1] The document doesn't compile. Any
> ideas?
>
> Regards
> Liviu
>
> [1] http://s000.tinyupload.com/index.php?file_id=64085332583398153478

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to