[R] latex{Hmisc} cannot find xdvi on MAC OS X
Bill Northcott
w.northcott at unsw.edu.au
Fri Jan 25 05:39:21 CET 2008
On 24/01/2008, at 10:00 PM, Kevin E. Thorpe wrote:
>
> When she does something like latex(describe(dataframe)), the latex
> file is produced, the dvi file is successfully written but then
> the error "sh: line 1: xdvi: command not found" appears.
>
> I started a terminal and a "which xdvi" returned the path
> where it found xdvi. So, it appears that xdvi is in the
> PATH.
Firstly if you have questions about R on MacOS you be much more likely
to get a useful reply on r-sig-mac rather than this list.
Secondly for the benefit of the non-Mac types here I will try to
explain what is going on.
On most UNIXen or Linux virtually all process are launched from a
shell process. Hence they inherit the environment of a standard
shell, and it makes sense to think of 'the' PATH or 'the' environment.
MacOS works differently. Most processes are not launched from a
shell. The only time you really have a shell involved is if you open
the Terminal app. Then you get a Quartz window running a shell and
any process you start from that shell will inherit the shell's
environment variables.
However, if you start the R GUI app from the Finder or Dock, there is
no shell in the process hierarchy (use '/Applications/Utilities/
Activity Monitor' to view the process hierarchy) and the environment
variables for the R app and anything it invokes are set up in
the .plist files in the R Application bundle. Those environment
variables are not going to include the Tex paths like /usr/texbin or /
usr/local/tetex/bin etc..
Three ways to get over it:
1. Launch a command line R session from a Terminal shell.
2. Start the GUI app from a Terminal shell with 'open /Applications/
R.app'
3. Set the PATH in your R code
Finally, the way to check your PATH in R is Sys.getenv("PATH"). Which
for the R 2.6.1 GUI app on this PowerMac G5 gives "/usr/bin:/bin:/usr/
sbin:/sbin:/usr/local/bin"
Hope this helps
Bill Northcott
More information about the R-help
mailing list