From murdoch.duncan at gmail.com  Wed Mar  5 20:31:00 2014
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Wed, 05 Mar 2014 14:31:00 -0500
Subject: [Rd] Sweave provides a misleading error when vignette engine
 not fully specified
In-Reply-To: <53175320.8060304@fhcrc.org>
References: <53175320.8060304@fhcrc.org>
Message-ID: <53177B74.4090207@gmail.com>

On 05/03/2014 11:38 AM, Martin Morgan wrote:
> Trying to Stangle / Sweave a file
>
> $ cat vignette.Rnw
> %\VignetteEngine{knitr}
> \documentclass{article}
> \begin{document}
> \end{document}
>
> results in a misleading error message:
>
> ~/tmp$ R CMD Stangle vignette.Rnw
> Error: Vignette engine package not specified
> Execution halted

I don't see that as misleading.  The code can't figure out where the 
knitr engine comes from, and it's telling you that.
>
> when what is missing is the full specification knitr::knitr; 'vignette engine
> package and function not specified' ? Also it's somehow unfortunate that the
> vignette builds when in a package/vignettes directory, but not as a stand-alone
> document.
A package can declare the vignette building package in its DESCRIPTION 
file.  If it's a standalone Sweave document, it needs to be declared in 
the document itself.  (It's also possible to declare it on the Stangle 
command line, but you'll still need the fully qualified name, e.g.

R CMD Stangle --engine=knitr::knitr vignette.Rnw

It might be possible to set up R to automatically load knitr first (e.g. 
by putting it in your list of R_DEFAULT_PACKAGES); I haven't tried 
that.  But somehow you need to tell R where the knitr engine lives.


> Also for what its worth Sweave'ing still fails to produce graphics output

Now that sounds unrelated.

Duncan Murdoch
>
> https://stat.ethz.ch/pipermail/r-devel/2014-February/068414.html
>
> $ R --version|head -n 3
> R Under development (unstable) (2014-03-05 r65124) -- "Unsuffered Consequences"
> Copyright (C) 2014 The R Foundation for Statistical Computing
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> Martin



[Rd] Sweave provides a misleading error when vignette engine not fully specified
Duncan Murdoch