tags:

views:

119

answers:

1

Here's my code that's supposed to display to graphics next to each other, but fails to do so. In fact the sweave part is not interpreted.

\begin{figure}[h]
\begin{center} 
\begin{minipage}[t]{.485\linewidth} % 
 <<fig=true,echo=false>>=
 print(graph2)
 @
 \newline{\color{red}{\caption{\label{idx}Graph one}}}    
 \end{minipage}
 \hspace{.02\linewidth}
  \begin{minipage}[t]{.485\linewidth}% 
  <<fig=true,echo=false>>=
 print(graph2)
 @
 \newline{\color{red}{ \caption{\label{pb}Graph two}}}
 \end{minipage}

 \end{center}
 \end{figure}

graph1,graph2 is just any given graph created by qplot. Both graphs work just fine outside a minipage. I know this topic has been around, but somehow I could not get solutions to got that worked for others like this one.

Plus I have a little side question: What's the argument to prevent Sweave from generating both .eps and .pdf ? The manual just states that it is the default. However I am sure that I just use pdflatex and hence do not need .eps.

A: 

Eh, this is actually cheating, but a found a nice workaround on John's blog. It's not using minipage but it's getting it done by using subfigure. Subfigure did not have any problems with Sweave. Nice!

If you are interested in this solution check this site. Still i´d like to know how to do it with minipage :)

ran2