[Bioc-devel] BiocStyle on windows with spaces in path names
On Wed, Oct 8, 2014 at 12:20 PM, Martin Morgan <mtmorgan at fhcrc.org> wrote:
On 10/08/2014 11:41 AM, Henrik Bengtsson wrote:
You may want to make those function local to latex(). I haven't verified it works (won't have time), but I bet a beer that it will work.
I'll take you up on the bet, at least for some definition of 'work'. For instance when debugging a vignette or writing a complicated Makefile for courses I commonly do the equivalent of R CMD Sweave foo.Rnw R CMD texi2dvi --pdf foo.tex Any environment variables set running Sweave are not available running texi2dvi.
Easy,
Rscript -e R.rsp::rfile foo.Rnw
would Sweave + texi2dvi --pdf in one go. Putting that aside, I'm
happy to buy you a beer :)
Another solution along along lines of using TEXINPUTS would be to do:
R CMD Sweave foo.Rnw
export TEXINPUTS=`Rscript -e BiocStyle::texinputs()`
R CMD texi2dvi --pdf foo.tex
A third different (and "obvious") solution, is to copy the files to
the current directory, i.e.
$ svn diff -x --ignore-all-space R/latex.R
Index: R/latex.R
===================================================================
--- R/latex.R (revision 95224)
+++ R/latex.R (working copy)
@@ -3,12 +3,14 @@
error=FALSE, use.unsrturl=TRUE)
{
options(..., width=width)
- cat(sprintf("\\RequirePackage{%s}\n\n",
- sub(".sty$", "", .bioconductor.sty)))
+ sty <- .bioconductor.sty
+ file.copy(sty, basename(sty), overwrite=TRUE)
+ cat("\\RequirePackage{Bioconductor}\n\n")
if (use.unsrturl) {
bst <- file.path(system.file(package="BiocStyle", "resources",
"latex"), "unsrturl")
+ file.copy(bst, basename(bst), overwrite=TRUE)
cat(sprintf("\\AtBeginDocument{\\bibliographystyle{%s}}\n", bst))
}
This works also in your use case and those local copies are
automagically cleaned out by R CMD build. This passes R CMD check
--as-cran on BiocStyle etc. Now one can argue that it will clutter up
your local directory. For the original problem of \usepackage{} et
al. does not support spaces in paths one can also copy to a temporary
directory and use that path instead. (Personally I favor not
specifying paths at all to make even the intermediate *.tex file
portable.)
/Henrik
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