[Bioc-devel] BiocStyle markdown, pdf and html

Henrik Bengtsson henrik.bengtsson at gmail.com
Sat Feb 27 01:42:49 CET 2016


On Feb 26, 2016 09:23, "Andrzej Oleś" <andrzej.oles at gmail.com> wrote:
>
> Hi Kasper,
>
> 1. It actually does, see BiocStyle::pdf_document.
> 2. I think you might be right that R doesn't support that yet, but maybe
> this could be circumvented through a Makefile.
>
> Cheers,
> Andrzej
>
> On Fri, Feb 26, 2016 at 5:33 PM, Kasper Daniel Hansen <
> kasperdanielhansen at gmail.com> wrote:
>
> > 1. It would be great if BiocStyle supported PDF generation from R markdown.
> > 2. Would it be worth considering (if possible) generation of both PDF and
> > HTML from a vignette.  We could probably do that through a Makefile, but
> > I'm unsure if R supports two output files for a single input (probably not,
> > come to think of it).

Just adding a few comments about multiple vignette product files per vignette:

I'd like to separate package vignettes from non-package vignettes.
When we do the latter, there's really nothing preventing a vignette
being compiled into multiple output files / file formats.  There's
also no restriction in what the output format should be.

When it comes to package vignettes it's a bit different.  I assume
this is what you're think of.  The files generated from package
vignette sources are termed "vignette products" in R / the tools
package.  The only recognized/accepted output formats are PDF and
HTML.  See tools:::find_vignette_product().  This function is used by
tools::buildVignettes(), which is main function that build package
vignettes.  (BTW, there's also tools::buildVignette() which one use to
test build single package vignette.)    There is also a direct test in
tools:::find_vignette_product() that only accepts one vignette product
per package vignette, cf.

  https://github.com/wch/r-source/blob/trunk/src/library/tools/R/Vignettes.R#L80-L84

It should be too hard to change this part to allow for multiple output
files/formats.  What complicates things is the package vignette index.
In addition to the HTML vignette index page having to be updated also
the internal data table (a plain matrix) has to be adjusted such that
it is can represent multiple output files, e.g.

> head(tools::getVignetteInfo("R.rsp"), 2L)
     Package Dir
[1,] "R.rsp" "C:/Users/hb/R/win-library/3.3/R.rsp"
[2,] "R.rsp" "C:/Users/hb/R/win-library/3.3/R.rsp"
     Topic
[1,] "Dynamic_document_creation_using_RSP"
[2,] "RSP_intro"
     File
[1,] "Dynamic_document_creation_using_RSP.tex.rsp"
[2,] "RSP_intro.md.rsp"
     Title                                 R
[1,] "Dynamic document creation using RSP" ""
[2,] "Introductory slides on RSP"          ""
     PDF
[1,] "Dynamic_document_creation_using_RSP.pdf"
[2,] "RSP_intro.html"

The vignette product is in the 'PDF' column, which is a legacy name
from the Sweave-only time.

Ignoring the HTML vignette index issue (which you can override using
your own Makefile), I think if you would try trick R CMD build using a
customized vignette engine (specifically it's "weave" function) that
outputs multiple products, you would get complains from R CMD check
(--as-cran?) that there are stray vignette files.

But to summarize, if multiple products per vignette is really needed,
it wouldn't be that hard to implement.  The challenge would probably
be convince R core that it's needed(*).

/Henrik

(*) One use case I can imagine is for visually impaired users; I
pretty sure I've read somewhere (R Journal article?) that when it
comes to reading equations, the *.tex file is often much more helpful
than the PDF.  In this case it could be neat if Sweave/knitr source
vignettes would keep both the (intermediate) *.tex file and the final
PDF file.

> >
> > Best,
> > Kasper
> >
> >         [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > Bioc-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/bioc-devel
> >
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel



More information about the Bioc-devel mailing list