[R-SIG-Mac] checking for pdflatex

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


Dear Gabor,

> -----Original Message-----
> From: Gábor Csárdi [mailto:csardi.gabor at gmail.com]
> Sent: March-16-15 12:39 PM
> To: John Fox
> Cc: Simon Urbanek; R-SIG-Mac
> Subject: Re: [R-SIG-Mac] checking for pdflatex
> 
> John,
> 
> my guess is that on OSX, >95% of the users have https://tug.org/mactex/,
> which seems to have pdflatex in /usr/texbin. If it is not there, then most
> likely the user does not have pdflatex installed, and you can give a note or
> warning about it.

If that's the case, then this certainly makes sense as a solution. In fact, if the Rcmdr (development version) doesn't detect pdflatex it provides a menu item and dialog under its Tools menu that will take the user to <http://www.tug.org/mactex/>.

> 
> If you want to be sure, you can check other tex distributions for OSX, to be
> honest I don't know any other. Based on http://mactex-
> wiki.tug.org/wiki/index.php/Distribution_Matrix pretty much MacTeX is the
> only player. Maybe people also install TeX with brew, so it might be worth
> checking that, too.

I think that I'll initially go for the simpler solution. I suspect that most Rcmdr Mac OS X users won't have LaTeX installed prior to installing the Rcmdr package. I can put an explanation in the help page for the dialog.

Thanks for the suggestion,
 John

> 
> Gabor
> 
> On Mon, Mar 16, 2015 at 12:25 PM, 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.
> 
> 	John
> 
> 	> -----Original Message-----
> 	> From: Simon Urbanek [mailto:simon.urbanek at r-project.org]
> 	> Sent: March-16-15 10:39 AM
> 	> To: John Fox
> 	> Cc: Ian Gow; r-sig-mac at r-project.org
> 	> Subject: Re: [R-SIG-Mac] checking for pdflatex
> 	>
> 	> John,
> 	>
> 	> see R for Mac FAQ 10.13: I get “command not found” in the GUI yet
> it works
> 	> in the Terminal – why?
> 	>
> 	> Cheers,
> 	> Simon
> 	>
> 	>
> 	> > On Mar 15, 2015, at 6:21 PM, John Fox <jfox at mcmaster.ca>
> wrote:
> 	> >
> 	> > Dear Ian,
> 	> >
> 	> > Thanks for this. Please see below:
> 	> >
> 	> >> -----Original Message-----
> 	> >> From: Ian Gow [mailto:iandgow at gmail.com]
> 	> >> Sent: March-15-15 5:07 PM
> 	> >> To: John Fox
> 	> >> Cc: r-sig-mac at r-project.org
> 	> >> Subject: Re: [R-SIG-Mac] checking for pdflatex
> 	> >>
> 	> >> I think it's driven by the PATH variable, which appears to differ
> for
> 	> >> me between RStudio and R from Terminal on the one hand and
> R.app on
> 	> >> the other.
> 	> >
> 	> > Yes, I understand that, though I don't understand why there's a
> 	> > difference in the path.
> 	> >
> 	> >>
> 	> >>> Sys.getenv("PATH")
> 	> >> [1] "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
> 	> >>> Sys.which("pdflatex")
> 	> >> pdflatex
> 	> >>       ""
> 	> >>
> 	> >> If I add
> 	> >>
> 	> >> Sys.setenv(PATH=paste(Sys.getenv("PATH"),"/opt/local/bin",
> sep=":"))
> 	> >>
> 	> >> to ~/.Rprofile then R.app finds pdflatex (from MacPorts in my
> case).
> 	> >>
> 	> >>> Sys.which("pdflatex")
> 	> >>                  pdflatex
> 	> >> "/opt/local/bin/pdflatex"
> 	> >>> Sys.getenv("PATH")
> 	> >> [1] "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin"
> 	> >
> 	> > The problem for me is to determine whether pdflatex is installed
> 	> > *without* knowing in advance where it's installed. I haven't
> described
> 	> > the purpose of this, and, in the interest of brevity, won't for the
> 	> > time-being, but it may also prove necessary to determine where
> pdflatex
> 	> resides.
> 	> >
> 	> > Best,
> 	> > John
> 	> >
> 	> >>
> 	> >>
> 	> >> On 15 Mar 2015, at 16:46, John Fox wrote:
> 	> >>
> 	> >>> Dear list members,
> 	> >>>
> 	> >>> I need to determine whether pdflatex is installed and have
> been
> 	> >>> doing that via Sys.which("pdflatex"). This works when R is run
> in a
> 	> >>> terminal window (or in RStudio):
> 	> >>>
> 	> >>>> Sys.which("pdflatex")
> 	> >>>           pdflatex
> 	> >>> "/usr/texbin/pdflatex"
> 	> >>>
> 	> >>> but not from R.app:
> 	> >>>
> 	> >>>> Sys.which("pdflatex")
> 	> >>> pdflatex
> 	> >>>   ""
> 	> >>>
> 	> >>> The session info is the same in both cases:
> 	> >>>
> 	> >>> -------------- snip ----------------
> 	> >>>
> 	> >>>> sessionInfo()
> 	> >>> R version 3.1.3 (2015-03-09)
> 	> >>> Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under:
> OS X
> 	> >>> 10.10.2 (Yosemite)
> 	> >>>
> 	> >>> locale:
> 	> >>> [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-
> 	> 8/en_CA.UTF-
> 	> >> 8
> 	> >>>
> 	> >>> attached base packages:
> 	> >>> [1] stats     graphics  grDevices utils     datasets  methods   base
> 	> >>>
> 	> >>> -------------- snip ----------------
> 	> >>>
> 	> >>> Why is the result different? Is there a better way to check for
> the
> 	> >>> presence of pdflatex?
> 	> >>>
> 	> >>> Any help would be appreciated.
> 	> >>>
> 	> >>> Thanks,
> 	> >>> John
> 	> >>>
> 	> >>> ------------------------------------------------
> 	> >>> John Fox, Professor
> 	> >>> McMaster University
> 	> >>> Hamilton, Ontario, Canada
> 	> >>> http://socserv.mcmaster.ca/jfox/
> 	> >>>
> 	> >>> _______________________________________________
> 	> >>> R-SIG-Mac mailing list
> 	> >>> R-SIG-Mac at r-project.org
> 	> >>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 	> >
> 	> >
> 	> > ---
> 	> > 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
> 	> >
> 
> 
> 	---
> 	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
> 
> 



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



More information about the R-SIG-Mac mailing list