Maybe you could use \RequirePackage{Bioconductor}
and then set the TEXINPUTS environment variable via Sys.setenv(). Internally tools::texi2dvi() is used that that "listens to" TEXINPUTS. Just FYI: I use this trick in https://github.com/HenrikBengtsson/R.rsp/blob/master/R/compileLaTeX.R to set/fix/update TEXINPUTS temporarily, but for somewhat different reasons. There you also see take extra precautions to drop duplicates etc. /Henrik On Mon, Oct 6, 2014 at 3:21 PM, Martin Morgan <mtmor...@fhcrc.org> wrote: > On 10/6/2014 2:44 PM, James W. MacDonald wrote: >> >> Hi Steffen, >> >> It looks like you are running R as an administrator, rather than as a >> regular user (or you are on something really old like XP). By default R >> should try to create a user-level library directory in your Documents >> folder. It is probably not such a good idea to run R as administrator if >> you are on a more modern version of Windows. >> >> Note that system.file (which BiocStyle::latex() calls to find the package >> path) will in the case of base packages use .Library to construct the >> path: >> >>> system.file() >> >> [1] "C:/PROGRA~1/R/R-31~1.0/library/base" >> >> Which being an 8.1 path, will work for MikTex. But if I run as an > > > It would be great for BiocStyle to return a functional path under all > circumstances. > > I'm not sure that MikTex handles ~ in paths? or at least not the way > BiocStyle currently uses this, as > > \RequirePackage{C:/PROGRA~1/R/R-31~1.0/library/BiocStyle/sty/Bioconductor} > > When I try to mock this up it looks like the ~ are being processed as latex > -- there is a latex file not found error with the ~ replaced by > \unhbox\voidb@x \penalty \@m \{}. > > I thought there might be some hints with the Sweave sty file use by all > vignettes. This is found with > > styfile <- file.path(R.home("share"), "texmf", "tex", "latex", > "Sweave") > if (.Platform$OS.type == "windows") > styfile <- chartr("\\", "/", styfile) > if (length(grep(" ", styfile))) > warning(gettextf("path to %s contains spaces,\n", > sQuote(styfile)), > gettext("this may cause problems when running LaTeX"), > domain = NA) > > but R.home() (eventually find.package()) uses .Library for the special case > when the path to a single package from the base distribution is being sought > >> find.package("stats") > [1] "C:/PROGRA~1/R/R-31~1.1/library/stats" >> find.package(c("stats", "stats"))[1] > [1] "C:/Program Files/R/R-3.1.1/library/stats" > > So I'm not sure how to get at a working path to Bioconductor.sty in the face > of spaces in the installed path name (the warning hints that R has similar > problems). > > >> administrator and put BiocStyle in my Program Files library, I get >> >>> latex() >> >> \RequirePackage{C:/Program >> Files/R/R-3.1.0/library/BiocStyle/sty/Bioconductor} >> >> \AtBeginDocument{\bibliographystyle{C:/Program >> Files/R/R-3.1.0/library/BiocStyle/sty/unsrturl}} >> >> Which of course will fail. So the best option is to stop running R as an >> administrator, and install packages in your Documents folder in a path >> with >> no spaces. >> >> Best, >> >> Jim >> >> >> >> On Mon, Oct 6, 2014 at 4:34 PM, Neumann, Steffen <sneum...@ipb-halle.de> >> wrote: >> >>> Hi, >>> >>> sometimes I am forced to R CMD check packages on windows, >>> and my problem is that both the system-wide library and >>> the personal library with BiocStyle contain spaces, so that >>> BiocStyle::latex() results in: >>> \RequirePackage{C:/Program >>> Files/R/R-3.1.0/library/BiocStyle/sty/Bioconductor} >>> >>> which causes MiKTeX to fail with >>> ! LaTeX Error: File >>> `C:/ProgramFiles/R/R-3.1.0/library/BiocStyle/sty/Bioconductor.sty' not >>> found. >>> (This is with BiocStyles-1.3.15) >>> >>> What is the recommended solution here ? Installing R to a non-standard >>> location ? >>> Use texlive instead of miktex (does that make a difference ?) Or >>> something >>> else ? >>> >>> Yours, >>> Steffen >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Bioc-devel@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/bioc-devel >>> >> >> >> > > > -- > Dr. Martin Morgan, PhD > Fred Hutchinson Cancer Research Center > 1100 Fairview Ave. N. > PO Box 19024 Seattle, WA 98109 > > > _______________________________________________ > Bioc-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/bioc-devel _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel