[R-SIG-Mac] checking for pdflatex

John Fox jfox at mcmaster.ca
Mon Mar 16 18:53:20 CET 2015

Dear Berend,

> -----Original Message-----
> From: Berend Hasselman [mailto:bhh at xs4all.nl]
> Sent: March-16-15 1:27 PM
> To: jfox at mcmaster.ca
> Cc: Simon Urbanek; r-sig-mac at r-project.org
> Subject: Re: [R-SIG-Mac] checking for pdflatex
> > On 16-03-2015, at 17:25, John Fox <jfox at mcmaster.ca> wrote:
> >
> > Dear Simon,
> >
> > Thanks for this, and to the others who responded to my question. The FAQ
> and Matt Denwood's response jogged my memory, and reminded me that I
> encountered this problem before.
> >
> > In this case, I don't see a good solution, but I'll think about the problem
> some more.
> >
> > Without providing too many tedious details, the development version of
> the Rcmdr package checks at startup what resources are available to it,
> including pdflatex, and configures itself accordingly. Having inexperienced
> users edit, e.g., their .Renviron files is probably a non-starter. The Rcmdr
> could offer to do this at the user's option (it already provides dialogs that
> guide the user to locations of missing software like LaTeX and pandoc), but
> I'd still have to be able to figure out whether pdflatex is available and if so
> where it's located.
> >
> > Ian Gow suggested using locate, but I apparently can't rely on a locate
> database having been compiled -- it wasn't on my Mac -- and the overhead
> of compiling the locate db is excessive for a start-up check.
> >
> > Again, thanks for explaining the problem.
> 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.

Thanks for this,

> Berend

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

More information about the R-SIG-Mac mailing list