From murdoch at stats.uwo.ca  Fri Feb 24 15:11:44 2006
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Fri, 24 Feb 2006 09:11:44 -0500
Subject: [Rd] Links to non-vignette documentation
In-Reply-To: <43FEFB9E.5020700@free.fr>
References: <f8e6ff050602230853l7eb9cfe6n7458e718ce7934b3@mail.gmail.com>	<43FE042B.4080601@stats.uwo.ca>	<Pine.LNX.4.64.0602232010470.17594@gannet.stats.ox.ac.uk>	<f8e6ff050602231237j12689b32i511425b6948766a1@mail.gmail.com>	<Pine.LNX.4.64.0602232044190.25797@gannet.stats.ox.ac.uk>	<f8e6ff050602231323m7a0779bdrb694f85758df6f3d@mail.gmail.com>	<Pine.LNX.4.64.0602232127250.26309@gannet.stats.ox.ac.uk>	<17406.21200.539725.925232@bossiaea.maths.uwa.edu.au>
	<43FEFB9E.5020700@free.fr>
Message-ID: <43FF1420.2030604@stats.uwo.ca>

On 2/24/2006 7:27 AM, Romain Francois wrote:
> 
> What about using the latex package pdfpages to copy the pages from your 
> PDF file `interface96.pdf` to your Sweave file. (I don't know if it is 
> compatible with Sweave).
> 
> Not tested :
> 
> \documentclass[a4paper]{article}
> %\VignetteIndexEntry{Interface '96 paper by Marron et al. (1997)}
> %\VignettePackage{clps}
> 
> \usepackage{hyperref}
> \usepackage{natbib}
> \usepackage{pdfpages}
> 
> \title{Interface '96 paper by \cite{mar:tur:wan:96}}
> \author{Berwin A Turlach}
> \date{September 25, 2004}
> 
> \begin{document}
> \maketitle
> 
> \newpage
> 
> \includepdf{interface96.pdf}
> 
> 
> \bibliographystyle{dcunsp}
> \bibliography{clps}
> 
> \end{document}

That's a nice hack.  You probably want the "fitpaper" option on the 
\includepdf command, so that you don't get an extra border around the 
page.  For example, this file test.Rnw

\documentclass{article}
%\VignetteIndexEntry{test include of pdf}
%\VignettePackage{ellipse}

\usepackage{pdfpages}

\begin{document}

\includepdf[fitpaper=true]{response.pdf}

\end{document}

produces an output that looks pretty much exactly like the 
"response.pdf" file I used as test input in a viewer.

The only disadvantages I see are that both the test.pdf and response.pdf 
files got built into the package (but only test.pdf shows up in the 
index), and that test.pdf is a lot larger than response.pdf.  (This may 
be because response.pdf was small; I haven't checked if the increase is 
additive or multiplicative).

For a non-hack solution:

A change to the R package build process would be to add support for a 
command like

%\VignetteExists

to the test.Rnw file, telling R not to bother trying to build the pdf, 
because it had already been built by other means.  Then I'd just have 
test.Rnw containing

%\VignetteIndexEntry{test include of pdf}
%\VignettePackage{ellipse}
%\VignetteExists

and solve both of the problems with Romain's workaround.

Duncan Murdoch



[Rd] Links to non-vignette documentation
Duncan Murdoch