Hi,
I am editing a document for submission to the R-news newsletter, and
in my article my Sweave code inserts a dynamically generated PDF
report that my R program generates.
However, when I insert the PDF using the following Sweave code:
\newpage
\includegraphics[scale=1.0]{\Sexpr{print(location)}}
\newpage
(in tex this looks like):
\newpage
\includegraphics[scale=1.0]{/home/arjun/sample.pdf}
\newpage
However, the r-news style package over-rides everything that I can set
(including using the minipage option) to make my included PDF small
sized. Part of the problem is that the R-news style specifies a
two-column formatting, and so the PDF is shrunk to fit in one column.
How can I, for just one page, over-ride the styles to include the PDF?
Even if I hard-hack the graphics to be scaled up in size, that does
not get rid of the vertical line that in between the two columns, and
thus breaking my image.
I realise that this is not an R problem, but more a latex problem, but
I am hoping that somebody has faced similar problems with the Rnews
styles and has an idea on how to do this.
Thank you,
Yours sincerely,
--
Arjun Ravi Narayan
contact at arjunnarayan.com
Hi Arjun Ravi Narayan wrote:> Hi, > > I am editing a document for submission to the R-news newsletter, and > in my article my Sweave code inserts a dynamically generated PDF > report that my R program generates. > > However, when I insert the PDF using the following Sweave code: > > \newpage > \includegraphics[scale=1.0]{\Sexpr{print(location)}} > \newpage > > (in tex this looks like): > \newpage > \includegraphics[scale=1.0]{/home/arjun/sample.pdf} > \newpageTry putting your image in a figure* environment (should go full width of the page). Paul> > However, the r-news style package over-rides everything that I can set > (including using the minipage option) to make my included PDF small > sized. Part of the problem is that the R-news style specifies a > two-column formatting, and so the PDF is shrunk to fit in one column. > How can I, for just one page, over-ride the styles to include the PDF? > Even if I hard-hack the graphics to be scaled up in size, that does > not get rid of the vertical line that in between the two columns, and > thus breaking my image. > > I realise that this is not an R problem, but more a latex problem, but > I am hoping that somebody has faced similar problems with the Rnews > styles and has an idea on how to do this. > > > Thank you, > > Yours sincerely,-- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/
Arjun Ravi Narayan <contact <at> arjunnarayan.com> writes:> I am editing a document for submission to the R-news newsletter, and > in my article my Sweave code inserts a dynamically generated PDF > report that my R program generates. >Slightly off Arjuns topic is a problem with Schunk, Sinput and Soutput environments. They just use to much inline space. I have tweade this problem with sed (see bellow for Makefile content), but wonder if there is a better solution. Thanks, Gregor default: Sweave fixTex texi2pdf --clean wrapper.tex && evince wrapper.pdf Sweave: # Sweave myPaper.Rnw R CMD Sweave myPaper.Rnw fixTex: Sweave # Change all S* environments to smallverbatim @cat myPaper.tex | sed -e '/\\begin{Sinput}/d' \ -e '/\\end{Sinput}/d' \ -e '/\\begin{Soutput}/d' \ -e '/\\end{Soutput}/d' \ -e 's/\\begin{Schunk}/\\begin{smallverbatim}/g' \ -e 's/\\end{Schunk}/\\end{smallverbatim}/g' \ > myPaper2.tex @mv -f myPaper2.tex myPaper.tex
> > Thank you Paul for your response. Unfortunately that did not work. A > figure environment frames it neatly, but still contained in only one column. > I have tried various methods, but they all seem to not work, or if the > solutions involve manually setting the size, the grey column separator still > runs through the middle of the page. > > I know a solution exists, because on page 21, Vol 1/1 of R-News, there is > an image that spans both columns. Do you know where I could get the Rnw > source files for R-news articles? That would at least allow me to trawl for > a solution. > > Best regards, > Arjun > > On 8/22/07, Paul Murrell <paul@stat.auckland.ac.nz> wrote: > > > > Hi > > > > > > Arjun Ravi Narayan wrote: > > > Hi, > > > > > > I am editing a document for submission to the R-news newsletter, and > > > in my article my Sweave code inserts a dynamically generated PDF > > > report that my R program generates. > > > > > > However, when I insert the PDF using the following Sweave code: > > > > > > \newpage > > > \includegraphics[scale=1.0]{\Sexpr{print(location)}} > > > \newpage > > > > > > (in tex this looks like): > > > \newpage > > > \includegraphics[scale=1.0]{/home/arjun/sample.pdf} > > > \newpage > > > > > > Try putting your image in a figure* environment (should go full width of > > the page). > > > > Paul > > > > > > > > > > However, the r-news style package over-rides everything that I can set > > > (including using the minipage option) to make my included PDF small > > > sized. Part of the problem is that the R-news style specifies a > > > two-column formatting, and so the PDF is shrunk to fit in one column. > > > How can I, for just one page, over-ride the styles to include the PDF? > > > Even if I hard-hack the graphics to be scaled up in size, that does > > > not get rid of the vertical line that in between the two columns, and > > > thus breaking my image. > > > > > > I realise that this is not an R problem, but more a latex problem, but > > > I am hoping that somebody has faced similar problems with the Rnews > > > styles and has an idea on how to do this. > > > > > > > > > Thank you, > > > > > > Yours sincerely, > > > > > > -- > > Dr Paul Murrell > > Department of Statistics > > The University of Auckland > > Private Bag 92019 > > Auckland > > New Zealand > > 64 9 3737599 x85392 > > paul@stat.auckland.ac.nz > > http://www.stat.auckland.ac.nz/~paul/ > > > >[[alternative HTML version deleted]]
Dear Paul,
I stand corrected. Your solution was the right way. The following code now
works:
(Apparently I still need to specify the width command as my pdf is
incorrectly sized by default)
\begin{figure*}[b]
\begin{center}
\includegraphics[width=8in]{generatedPDF.pdf}
\end{center}
\end{figure*}
There is a full explanation in the template.tex file which can be found in
the RNews tutorial here: http://cran.r-project.org/doc/Rnews/template.tex
Thank you for your time.
Best regards,
Arjun
>
>
> Try putting your image in a figure* environment (should go full width of
> the page).
>
> Paul
>
> Dr Paul Murrell
> Department of Statistics
> The University of Auckland
> Private Bag 92019
> Auckland
> New Zealand
> 64 9 3737599 x85392
> paul@stat.auckland.ac.nz
> http://www.stat.auckland.ac.nz/~paul/
>
[[alternative HTML version deleted]]