[R-SIG-Mac] checking for pdflatex
Berend Hasselman
bhh at xs4all.nl
Mon Mar 16 19:33:40 CET 2015
John,
> On 16-03-2015, at 18:53, John Fox <jfox at mcmaster.ca> wrote:
>
> Dear Berend,
> ….
>>
>> For what it’s worth: I have the following code in the .First function in
>> ~/.Rprofile:
>> (R 3.1.3 on OS X Yosemite)
>>
>> if( .Platform$GUI == "AQUA" ) {
>> # this appends /usr/local/bin to what is already in PATH
>> # by default this is already in PATH (at least in 10.6.8)
>> # so remove any duplicated items
>> z <- Sys.getenv("PATH")
>> z <- unlist(strsplit(z,.Platform$path.sep,fixed=TRUE))
>> # add path to MacTeX executables for OS X Yosemite (which has a bug)
>> # in Terminal it is added automatically
>> z[length(z)+1] <- "/usr/texbin"
>> Sys.setenv(PATH=paste(z[!duplicated(z)],collapse=.Platform$path.sep))
>> }
>
> This should work fine if pdflatex is in /usr/texbin, which I now understand is by far the most common case (and is the case on my Mac).
>
> Do you mind if I adapt your code for the Rcmdr? I can fix the path in this manner at startup of the Rcmdr GUI and restore it to its initial value on exit from the GUI.
>
Go right ahead. Don’t forget it assumes MacTeX.
But do also have a look Simon’s suggestion of using path_helper, which seems more flexible than my solution:
I tried this in R-GUI
system2("/usr/libexec/path_helper","-s", stdout=TRUE)
and got this answer
[1] "PATH=\"/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin\"; export PATH;”
which will have to be fiddled with to get something that is usable.
Berend
> Thanks for this,
> John
>
>>
>> Berend
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> http://www.avast.com
>
More information about the R-SIG-Mac
mailing list