> On Mar 17, 2015, at 10:41 AM, John Fox <j...@mcmaster.ca> wrote: > > Dear Simon, > > Sorry to prolong this, but I have two additional questions: > > (1) Is there a reason that R.app uses a different default PATH than R in a > terminal window does? That is, why not make them the same? I suspect that > there's a consideration that I'm not aware of. >
See the FAQ I was pointing to. > (2) Would it still be objectionable if I reverted to the previous solution of > having the Rcmdr package add "/usr/texbin" to the current PATH if it's not > already present rather than replacing the PATH? Though that wouldn't be as > bullet-proof, it would cover the large majority of cases, and wouldn't > potentially surprise a user by removing a directory from the PATH. > I guess that would be less disruptive. If the user has picked a custom order at least it would be preserved. But as noted earlier I also think that this should be better fixed in rmarkdown - preferably by using the full path so it doesn't depend on PATH. I'm told RStudio is providing pandoc binaries so I would guess it's easy for them to guarantee the functionality but JJ is included so he can weigh in. Cheers, Simon > Thanks, > John > >> -----Original Message----- >> From: Simon Urbanek [mailto:simon.urba...@r-project.org] >> Sent: March-17-15 10:34 AM >> To: JJ Allaire >> Cc: j...@mcmaster.ca; Berend Hasselman; r-sig-mac@r-project.org >> Subject: Re: [R-SIG-Mac] checking for pdflatex >> >> JJ, >> >> this is unrelated - this is about apps started via LS not using shell >> profiles. (The >> issue you refer to has been fixed long time ago on our end). >> >> Cheers, >> Simon >> >> >> >>> On Mar 17, 2015, at 6:21 AM, JJ Allaire <j...@rstudio.com> wrote: >>> >>> Sounds like this may be targeted at fixing the OS X Yosemite bug >>> wherein some environment variables for GUI applications are >>> duplicated: >>> >>> http://tex.stackexchange.com/questions/208181/why-did-my-tex-related- >> g >>> ui-program-stop-working-in-mac-os-x-yosemite >>> >>> Until Apple fixes this issue I think that GUI applications need to >>> clean the duplicated environment variables received at launch time. >>> Here's what we do in RStudio: >>> >>> https://github.com/rstudio/rstudio/commit/09c9be12 >>> >>> >>> >>> >>> On Mon, Mar 16, 2015 at 9:12 PM, John Fox <j...@mcmaster.ca> wrote: >>>> Dear Simon, >>>> >>>>> -----Original Message----- >>>>> From: Simon Urbanek [mailto:simon.urba...@r-project.org] >>>>> Sent: March-16-15 3:57 PM >>>>> To: j...@mcmaster.ca >>>>> Cc: Berend Hasselman; r-sig-mac@r-project.org >>>>> Subject: Re: [R-SIG-Mac] checking for pdflatex >>>>> >>>>> >>>>>> On Mar 16, 2015, at 3:43 PM, John Fox <j...@mcmaster.ca> wrote: >>>>>> >>>>>> Dear all, >>>>>> >>>>>> I've now implemented Simon's solution, setting the path in the >>>>>> .onLoad() >>>>> function of the Rcmdr package and resetting it to its pre-existing >>>>> value in .onUnload(). This seems to work fine for me and, I hope, >>>>> will be a more robust solution. >>>>>> >>>>> >>>>> I don't think messing with PATH of the R process is a good idea - as >>>>> a user I'd be somewhat unpleasantly surprised if you changed the >>>>> PATH of my running session. I'm not quite sure what's your >>>>> intention, but I would suggest using the setting to locate the >>>>> binary to run it explicitly - that is what R does normally. If you >>>>> rely on some scripts that you don't control, then I would suggest >>>>> setting it in the shell that you start the script with, but not in the R >> process itself. >>>> >>>> That occurred to me, but the problem arises when a function in the >> rmarkdown package calls pandoc and pandoc fails to run pdflatex. I don't >> think that I have control over this. >>>> >>>> I'm cc'ing J. J. Alaire, the maintainer of the rmarkdown package in >>>> case he sees a solution in that package. The problem doesn't of >>>> course occur when rmarkdown is run from RStudio (or a terminal) but >>>> only from R.app, as I explained initially. (J.J.: Please let me know >>>> if this is unclear, and I can send you the rest of this thread.) >>>> >>>> OTOH, I doubt whether Rcmdr users will care that the package alters the >> PATH of the R process (though it would be better to avoid that). >>>> >>>> Best, >>>> John >>>> >>>>> >>>>> Cheers, >>>>> Simon >>>>> >>>>> >>>>> >>>>>> Thanks again to everyone for their help. >>>>>> >>>>>> John >>>>>> >>>>>>> -----Original Message----- >>>>>>> From: R-SIG-Mac [mailto:r-sig-mac-boun...@r-project.org] On Behalf >>>>>>> Of John Fox >>>>>>> Sent: March-16-15 2:45 PM >>>>>>> To: 'Berend Hasselman' >>>>>>> Cc: r-sig-mac@r-project.org >>>>>>> Subject: Re: [R-SIG-Mac] checking for pdflatex >>>>>>> >>>>>>> Dear Berend and Simon, >>>>>>> >>>>>>> I've now tried Berend's solution and it appears to work fine: If >>>>>>> necessary, I add /usr/texbin to the path when the Rcmdr GUI starts >>>>>>> up and restore the path to its previous state when it closes. >>>>>>> >>>>>>> I agree that Simon's solution will be more flexible since it >>>>>>> should work if pdflatex is located elsewhere (as long as it's on >>>>>>> the path reported by path_helper), and I'll give that a try as well. >>>>>>> >>>>>>> Thanks again for all the help, >>>>>>> John >>>>>>> >>>>>>>> -----Original Message----- >>>>>>>> From: Berend Hasselman [mailto:b...@xs4all.nl] >>>>>>>> Sent: March-16-15 2:34 PM >>>>>>>> To: j...@mcmaster.ca >>>>>>>> Cc: Simon Urbanek; r-sig-mac@r-project.org >>>>>>>> Subject: Re: [R-SIG-Mac] checking for pdflatex >>>>>>>> >>>>>>>> John, >>>>>>>> >>>>>>>>> On 16-03-2015, at 18:53, John Fox <j...@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.s >>>>>>>> ep) >>>>>>>> ) >>>>>>>>>> } >>>>>>>>> >>>>>>>>> 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 >>>>>>>> :/u >>>>>>>> sr >>>>>>>> /texbi >>>>>>>> n\"; 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 >>>>>>>>> >>>>>>> >>>>>>> >>>>>>> --- >>>>>>> This email has been checked for viruses by Avast antivirus software. >>>>>>> >>>>>>> _______________________________________________ >>>>>>> R-SIG-Mac mailing list >>>>>>> R-SIG-Mac@r-project.org >>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac >>>>>> >>>>>> >>>>>> --- >>>>>> This email has been checked for viruses by Avast antivirus software. >>>>>> http://www.avast.com >>>>>> >>>> >>>> >>>> --- >>>> This email has been checked for viruses by Avast antivirus software. >>>> http://www.avast.com >>>> >>> > > > --- > This email has been checked for viruses by Avast antivirus software. > http://www.avast.com > _______________________________________________ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac