[R-SIG-Mac] checking for pdflatex

John Fox jfox at mcmaster.ca
Tue Mar 17 16:29:38 CET 2015


Dear Brian,

Would it be acceptable to CRAN for the Rcmdr package to add /user/texbin to the end of the PATH of the R process is it's not already there, restoring the PATH to its previous state when the Commander() function exits, closing the Rcmdr GUI?

That seems innocuous to me. I could add a dialog that asks the user's permission unless an Rcmdr option for this behaviour is set, though for most users that would mean that the dialog would appear every time the Rcmdr is started.

Thanks,
 John

> -----Original Message-----
> From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
> Sent: March-16-15 3:56 PM
> To: jfox at mcmaster.ca; 'Berend Hasselman'
> Cc: r-sig-mac at r-project.org
> Subject: Re: [R-SIG-Mac] checking for pdflatex
> 
> Note that it not just MacTex which uses /usr/texbin.  /usr/texbin is a link to
> /Library/TeX/Distributions/Programs/texbin which is an /etc/alternatives
> scheme to manage multiple TeX distributions which used (prior to Yosemite,
> at least) to be controlled by a Systems Preferences widget.  See
> https://tug.org/mactex/multipletexdistributions.html .
> 
> That does not apply to e.g. Fink or MacPorts distributions of TeX, but people
> using those are not likely to be using R.app.
> 
> /usr/libexec/path_helper is not the whole story either: it reads system
> versions of PATH which might not apply to a user's shell: it does not get my
> settings completely correct (in particular it has /usr/texbin too far down the
> PATH and I had moved it because the system path found the wrong
> 'makeindex').
> 
> 
> On 16/03/2015 18:44, John Fox wrote:
> > 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:bhh at xs4all.nl]
> >> Sent: March-16-15 2:34 PM
> >> To: jfox at mcmaster.ca
> >> Cc: Simon Urbanek; r-sig-mac at r-project.org
> >> Subject: Re: [R-SIG-Mac] checking for pdflatex
> >>
> >> 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:/us
> >> r/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 at r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> >
> 
> 
> --
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Emeritus Professor of Applied Statistics, University of Oxford
> 1 South Parks Road, Oxford OX1 3TG, UK


---
This email has been checked for viruses by Avast antivirus software.



More information about the R-SIG-Mac mailing list