[Bioc-devel] BiocStyle for styling Sweave (and other?) vignettes

Martin Morgan mtmorgan at fhcrc.org
Tue Jul 16 16:59:11 CEST 2013


On 07/16/2013 06:43 AM, Robert Castelo wrote:
> hi Martin,
>
> i have tried it out by simply adding the code snippet you specify below to the
> preamble of one of the vignettes of 'qpgraph', concretely the one entitled
> 'qpTxRegNet.Rnw' and once the .tex is generated, the processing with LaTeX gives
> the following error:

Thanks Robert -- Bioconductor.sty is not playing well with some of your other 
packages; the changes below work, and some of them make sense anyway in terms of 
what Bioconductor.sty provides -- the times, mathptmx, hyperref, and fullpage 
packages are redundant.

Also as currently written the Bioconductor.sty file needs to come before \title 
(and it assumes that there _is_ a \title)

We'll work on an update to make this better.

More below...

Index: qpTxRegNet.Rnw
===================================================================
--- qpTxRegNet.Rnw	(revision 78459)
+++ qpTxRegNet.Rnw	(working copy)
@@ -1,14 +1,13 @@
  %\VignetteIndexEntry{Reverse-engineer transcriptional regulatory networks 
using qpgraph}
  %\VignetteKeywords{qp-graph, microarray, network}
  %\VignettePackage{qpTxRegNet}
-\documentclass[11pt]{article}
+\documentclass{article}

-\usepackage{times}
-\usepackage{mathptmx}
-\usepackage{graphicx}
-\usepackage{hyperref}
+
+<<style, eval=TRUE, echo=FALSE, results=tex>>=
+BiocStyle::latex()
+@
  \usepackage{natbib}
-\usepackage{fullpage}

  \title{Reverse engineering transcriptional regulatory networks \\ from
         gene expression microarray data using {\tt qpgraph}}

>
> =================
>
> (/opt/R/R-3.0.0/lib64/R/develLibrary/BiocStyle/sty/Bioconductor.sty
>
> LaTeX Warning: You have requested package `/opt/R/R-3.0.0/lib64/R/develLibrary/
> BiocStyle/sty/Bioconductor',
>                 but the package provides `Bioconductor'.
>
> (/soft/texlive/2011/texmf-dist/tex/latex/graphics/color.sty
> (/soft/texlive/2011/texmf-dist/tex/latex/latexconfig/color.cfg)
> (/soft/texlive/2011/texmf-dist/tex/latex/graphics/dvipsnam.def))
>
> ! LaTeX Error: Missing \begin{document}.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type  H <return>  for immediate help.
>   ...
>
> l.30 \pdfpageattr
>                   {/Group << /S /Transparency /I true /CS /DeviceRGB>>} %fixe...
>
> ? X
> No pages of output.
> Transcript written on qpTxRegNet.log.
>
> ================
>
> the offending line in the .tex file seems to be this one:
>
> \usepackage{/opt/R/R-3.0.0/lib64/R/develLibrary/BiocStyle/sty/Bioconductor}
>
> because if i comment it then it works, but of course this is *the line* that
> would give the BioC look and feel to the vignette.
>
> i can reproduce this error in my linux box with R 3.0.0 and pdflatex version:
>
> $ pdflatex --version
> pdfTeX 3.1415926-2.3-1.40.12 (TeX Live 2011)
> kpathsea version 6.0.1
> Copyright 2011 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
> There is NO warranty.  Redistribution of this software is
> covered by the terms of both the pdfTeX copyright and
> the Lesser GNU General Public License.
> For more information about these matters, see the file
> named COPYING and the pdfTeX source.
> Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
> Compiled with libpng 1.5.2; using libpng 1.5.2
> Compiled with zlib 1.2.5; using zlib 1.2.5
> Compiled with xpdf version 3.02pl5
>
> and in my mac osx laptop with R 3.0.1 and pdflatex version:
>
> pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012)
> kpathsea version 6.1.0
> Copyright 2012 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
> There is NO warranty.  Redistribution of this software is
> covered by the terms of both the pdfTeX copyright and
> the Lesser GNU General Public License.
> For more information about these matters, see the file
> named COPYING and the pdfTeX source.
> Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
> Compiled with libpng 1.5.10; using libpng 1.5.10
> Compiled with zlib 1.2.7; using zlib 1.2.7
> Compiled with xpdf version 3.03
>
>
> one of the things i was curious about is how the style handles R code and its
> output, since i cannot see it at the moment, and neither in the BiocStyle
> vignette, i just give my $0.02 about two aspects that i think should be discussed:
>
> 1. should the plus signs "+" from wrapped code line be removed? they make copy &
> pasting a wrapped line of R code more difficult.
>
> 2. should we consider highlighting R code from output. i'm not referring to
> highlighting individual keywords, but simply putting in different color or shade
> input R code from its output. see for instance, the qpgraphSimulate.pdf
> vignette, i think it's helpful to avoid copying & pasting output lines by mistake.

It seems reasonable to me to move in this direction, improving copy / paste and 
highlighting results. One thing is that the R script underlying the vignette is 
available at

   sub(".Rnw", ".R", vignette("qpTxRegNet")$file)

which I admit is not as convenient as cut-and-paste.

Thanks for the feedback.

Martin

>
>
> cheers,
>
> robert.
>
> On 07/14/2013 05:23 PM, Martin Morgan wrote:
>> Developers --
>>
>> Sweave-style vignettes often include copy-pasted versions of basic LaTeX
>> macros and other commands. We've created the BiocStyle package to make
>> it easy to add these macros, and a consistent style, to Bioconductor
>> vignettes -- just add Suggests: BiocStyle to your package DESCRIPTION,
>> and the following lines inside the preamble (between
>> \documentclass{article} and \begin{document}) of your vignette
>>
>> <<style, eval=TRUE, echo=FALSE, results=tex>>=
>> BiocStyle::latex()
>> @
>>
>> Details, including illustration of macros and styles, are in the package
>> vignette
>>
>>
>> http://bioconductor.org/packages/devel/bioc/vignettes/BiocStyle/inst/doc/LatexStyle.pdf
>>
>>
>>
>> and on the ?latex help page. Suggestions welcome. Perhaps this can be
>> extended for non-Sweave vignettes.
>>
>> Martin
>


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioc-devel mailing list