[R-SIG-Mac] checking for pdflatex

Berend Hasselman bhh at xs4all.nl
Mon Mar 16 18:26:42 CET 2015


> 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))
    }

Berend



More information about the R-SIG-Mac mailing list