# [Rd] Links to non-vignette documentation

Duncan Murdoch murdoch at stats.uwo.ca
Fri Feb 24 15:11:44 CET 2006

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

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