[R-pkg-devel] Disable a particular knitr vignette
Iñaki Úcar
i@uc@r86 @ending from gm@il@com
Fri Aug 3 09:31:17 CEST 2018
For anyone interested, I finally managed to solve this, following a
suggestion by Baptiste Auguie. TLDR; my yaml header reads as follows:
output: if (packageVersion("rticles") < 0.5 || rmarkdown::pandoc_version() >= 2)
rticles::jss_article else rmarkdown::html_vignette
This fallback simply ignores the fancy latex commands and produces a
HTML output, which prevents R CMD check from complaining.
Regards,
Iñaki
El jue., 2 ago. 2018 a las 10:04, Iñaki Úcar (<i.ucar86 using gmail.com>) escribió:
>
> Hi everyone,
>
> I have a JSS vignette based on the rticles package. It was compiling
> just fine until rticles v0.5 for some reason started requiring pandoc
> v2.x for such a document class, and failing otherwise. Due to this
> requirement, Windows machines on CRAN show a nasty WARN, because they
> still have pandoc v1.x.
>
> It is painful for Uwe to install pandoc v2.x there, so I was wondering
> whether there's any easy mechanism to just disable a particular
> vignette based on some condition (in this case, it would be "we are on
> CRAN, this is Windows and the pandoc version is < 2"; this is easy to
> test).
>
> I tried putting a condition for the output format in the YAML header
> and it works, i.e.:
>
> output: if (cond) rticles::jss_article else rmarkdown::pdf_document
>
> But rmarkdown::pdf_document fails to compile, because the JSS class
> has many custom macros. I tried also putting a NULL or a NA there, and
> it doesn't work.
>
> Does any knitr ninja here know if there's some easy trick to do this
> and make Uwe's life easier? Some "NULL" document format?
>
> Regards,
> Iñaki
--
Iñaki Úcar
http://www.enchufa2.es
@Enchufa2
More information about the R-package-devel
mailing list