Dear list, I want to run latex from an R script: system("latex mysource.tex") or: texi2dvi("mysource.tex", pdf = TRUE, clean = FALSE, quiet = TRUE, texi2dvi = latex) but latex does not seem to be on the search path: /bin/sh: line 1: latex: command not found. Although 'printenv PATH' tells me that the usr/texbin is looked for executables: /Library/Frameworks/Python.framework/Versions/Current/bin:/sw/bin:/sw/ sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/texbin:/usr/ X11R6/bin Or am I wrong here? In any case this is strange because if I call latex from the Terminal shell it runs without problems. On the other hand texi2dvi from the tools package also does not work (for the same reason?) I use R version 2.6.2 on Intel Mac OS X 10.4.11 Why is there a difference between the way the call to latex behaves directly in the shell or via the R system () command? Thanks in advance for any advice! Christoph ________________________________________________________ Christoph Heibl Systematic Botany Ludwig-Maximilians-Universit?t M?nchen Menzinger Str. 67 D-80638 M?nchen GERMANY phone: +49-(0)89-17861-251 e-mail: heibl at lmu.de http://www.botanik.biologie.uni-muenchen.de/botsyst/heibl/ch-home.html SAVE PAPER - THINK BEFORE YOU PRINT
Christoph Heibl wrote:> Dear list, > > I want to run latex from an R script: > > system("latex mysource.tex") > > or: > > texi2dvi("mysource.tex", pdf = TRUE, clean = FALSE, quiet > = TRUE, texi2dvi = latex) > > but latex does not seem to be on the search path: > > /bin/sh: line 1: latex: command not found. > > Although 'printenv PATH' tells me that the usr/texbin is looked for > executables: > > /Library/Frameworks/Python.framework/Versions/Current/bin:/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/texbin:/usr/X11R6/bin > > > Or am I wrong here? > > In any case this is strange because if I call latex from the Terminal > shell it runs without problems. On the other hand texi2dvi from the > tools package also does not work (for the same reason?) > > I use R version 2.6.2 on Intel Mac OS X 10.4.11 > > Why is there a difference between the way the call to latex behaves > directly in the shell or via the R system () command? >There can be several reasons, all depending crucially on your particular setup. You might be better off on the R-sig-Mac list, but I'd start by looking at system("echo $PATH") or system("printenv PATH"). Presumably that does not include /usr/texbin (if that is where latex resides). One potential reason that it could be different from the command line lies in the shell startup files -- which ones get executed depends on whether or not it is a login shell. Another possibility is that R itself is setting the PATH: try Sys.getenv("PATH").> Thanks in advance for any advice! > Christoph > > > > > > > > > > > ________________________________________________________ > > Christoph Heibl > > Systematic Botany > Ludwig-Maximilians-Universit?t M?nchen > Menzinger Str. 67 > D-80638 M?nchen > GERMANY > > phone: +49-(0)89-17861-251 > e-mail: heibl at lmu.de > > http://www.botanik.biologie.uni-muenchen.de/botsyst/heibl/ch-home.html > > SAVE PAPER - THINK BEFORE YOU PRINT > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
Are you running R from the shell, or R.app? I don't own or use a Mac, but I've seen something like this happen to people running R through ESS on some Emacs on a Mac. Apologies for lack of precision here in terminology, but it had something to do with the PATH getting set through a shell initialization file (e.g., .cshrc, .bashrc). Thus, starting in a shell, the path was set properly. But the path was not set in the 'Mac GUI environment', so things started 'from there' (i.e., by clicking something), did not know about the path. If it is a situation like the above, it really has nothing to do with R directly. If that is the problem, there is probably some way to set environment variables so that the Mac GUI shell knows about them. HTH, Erik Iverson Christoph Heibl wrote:> Dear list, > > I want to run latex from an R script: > > system("latex mysource.tex") > > or: > > texi2dvi("mysource.tex", pdf = TRUE, clean = FALSE, quiet = > TRUE, texi2dvi = latex) > > but latex does not seem to be on the search path: > > /bin/sh: line 1: latex: command not found. > > Although 'printenv PATH' tells me that the usr/texbin is looked for > executables: > > /Library/Frameworks/Python.framework/Versions/Current/bin:/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/texbin:/usr/X11R6/bin > > > Or am I wrong here? > > In any case this is strange because if I call latex from the Terminal > shell it runs without problems. On the other hand texi2dvi from the > tools package also does not work (for the same reason?) > > I use R version 2.6.2 on Intel Mac OS X 10.4.11 > > Why is there a difference between the way the call to latex behaves > directly in the shell or via the R system () command? > > Thanks in advance for any advice! > Christoph > > > > > > > > > > > ________________________________________________________ > > Christoph Heibl > > Systematic Botany > Ludwig-Maximilians-Universit?t M?nchen > Menzinger Str. 67 > D-80638 M?nchen > GERMANY > > phone: +49-(0)89-17861-251 > e-mail: heibl at lmu.de > > http://www.botanik.biologie.uni-muenchen.de/botsyst/heibl/ch-home.html > > SAVE PAPER - THINK BEFORE YOU PRINT > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >