is there a simple way (e.g., via a chunk option) to get a chunk's source code and the plot it produces side by side, as on page 8 (among others) of this document?

I tried using out.width="0.5\\textwidth", fig.align='right', which makes the plot correctly occupy only half the page and be aligned to the right, but the source code is displayed on top of it, which is the normal behaviour. I would like to have it on the left side of the plot.

Thanks

Sample code:

<<someplot, out.width="0.5\\textwidth", fig.align='right'>>=
plot(1:10)
@
Edit
Report