Skip to content

building a package on a Mac: pdflatex

19 messages · Simon Urbanek, Federico Calboli, David Winsemius +6 more

#
Hi All,

I am building a package on my MBP (latest R, latest OSX, TexLive 2010), and I am incurring in some annoying problems with R CMD check:

* checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typically indicates Rd problems.
* checking PDF version of manual without hyperrefs or index ... ERROR
Re-running with no redirection of stdout/stderr.
Hmm ... looks like a package
Error in texi2dvi("Rd2.tex", pdf = (out_ext == "pdf"), quiet = FALSE,  : 
 pdflatex is not available
Error in running tools::texi2dvi

My comment is, pdflatex *is* availiable:

$ :/usr/local/texlive/2010/bin/universal-darwin$ ls -l pdflatex 
lrwxr-xr-x  1 root  wheel  6 21 Oct  2010 pdflatex -> pdftex

and

$ :/usr/local/texlive/2010/bin/x86_64-darwin$ ls -l pdflatex 
lrwxr-xr-x  1 root  wheel  6 21 Oct  2010 pdflatex -> pdftex

How do I get R CMD check to play nice with my latex installation? I could just ssh the lot to a Linux machine, but that's too much of a defeat...

Best,

Federico




--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com
#
On 5 Jul 2011, at 10:44, Federico Calboli wrote:
Before anyone asks:

$ :/usr/local/texlive/2010/bin/x86_64-darwin$ ls /usr/texbin/pdflatex 
/usr/texbin/pdflatex

so that's not the issue.

bw

F



--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com
#
Federico,

both are entirely irrelevant - run
system("pdflatex --version")
in R - that is the only thing that counts. If it shows an error, then you don't have pdflatex on your PATH which would be the problem. As a side note, you are showing two separate TeX packages which may not help you to find out what breaks in your setup in general ...

Cheers,
Simon
On Jul 5, 2011, at 5:51 AM, Federico Calboli wrote:

            
#
Simon,
thanks for the hint. Unfortunately:

system("pdflatex --version")
/bin/sh: pdflatex: command not found

doing a simple

PATH=$PATH:/user/texbin 

fixed it if I use R and package.skeleton() from the terminal. If I use the R gui (from the standard R 2.13.0 CRAN download) it still does not find pdflatex and does not build a usable package skeleton.

In any case, your hit solved my issue. Now, how do I set the path for the R gui?

BW

Federico


--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com
#
On Jul 5, 2011, at 9:10 AM, Federico Calboli wrote:

            
When the answer to this is posted, I am wondering if it could be put  
in the Mac R FAQ because it seems that I have read several questions  
of late that involve users puzzling where to set various paths for  
Finder,  bash, and R that are stored in different places/environments.  
It would be good not to need to search for a r-sig-mac posting but  
rather refer to a "central document".
#
Hi Federico,
On Jul 5, 2011, at 18.51 , Federico Calboli wrote:

            
My environment is different to yours, but these may help:

1. Add this line to (or create a new file) ~/.profile

test -d /usr/local/texlive/2010 && PATH=/usr/local/texlive/2010/bin/x86_64-darwin:$PATH &&
                            MANPATH=/usr/local/texlive/2010/texmf/doc/man:$MANPATH

2. Edit R

#!/bin/sh
# Shell wrapper for R executable.

export PATH=/usr/local/texlive/2010/bin/x86_64-darwin:$PATH  # THIS IS THE ADDED LINE

R_HOME_DIR=/sw/Library/Frameworks/R.framework/Resources
if test "${R_HOME_DIR}" = "/sw/Library/Frameworks/lib/R"; then


--
BABA Yoshihiko
Urban Design Laboratory, Tokyo University
#
On 5 Jul 2011, at 14:48, David Winsemius wrote:

            
As a matter of completeness, PATH=$PATH:/user/texbin did not alter my path 'globally', and immediately broke in a new terminal tab.  

I solved the issue globally with

sudo sh -c 'echo "/usr/texbin">>/etc/paths.d/texbin' [the reader should be warned I use bash by default on my terminal]

which does work if I use R in a terminal and I call system('pdflatex --version'). This solution also allowed a perfectly clean R CMD check.

On the other hand, from the GUI [R.app GUI 1.40 (5751) x86_64-apple-darwin9.8.0],
/bin/sh: pdflatex: command not found

bw

F





Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com
#
On 5 July 2011 15:00, Federico Calboli <f.calboli at imperial.ac.uk> wrote:
Another way to do this would be to change the PATH variable in your
~/.bashrc (or other shell-specific startup file).
I think what you want here is Sys.setenv() in R, e.g.,:
  Sys.setenv(PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin")

You should be able to set this in your ~/.Rprofile


Cheers,
Martin
#
Hi,

To alter the PATH variables that your GUI apps see, you need to play
with your ~/.MacOSX/environment.plist file -- or apparently even
messing with /etc/launchd.conf (if you launch with spotllight, I
guess).

See here:
http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x

Googling for "environment.plist os x" will also bring in a lot more info.

HTH,
-steve


On Tue, Jul 5, 2011 at 10:00 AM, Federico Calboli
<f.calboli at imperial.ac.uk> wrote:

  
    
#
On Jul 5, 2011, at 9:10 AM, Federico Calboli wrote:

            
Well, the R way regardless of where you are is to use .Renviron - that works anywhere including the shell and the GUI. What you set there is really up to you - you can set R_PDFLATEXCMD to be on the safe side or you can set PATH instead.

Cheers,
Simon
#
On Jul 5, 2011, at 9:48 AM, David Winsemius wrote:

            
But that is largely irrelevant to R. R has its own mechanisms that are well documented in the R documentation, so you can use environment.plist or .profile if you are so inclined, but I would not recommend it, mainly because it will still lead to discrepancies between the GUI and the shell. Moreover, it's not R specific so it will influence other apps that may not expect it. Also it's easy to forget about such things when you are upgrading the system. So, I'm saying just use .Renviron and/or .Rprofile and all is well :).

Cheers,
Simon
#
On 5 Jul 2011, at 15:19, Simon Urbanek wrote:

            
I created a .Rprofie with 

Sys.setenv(PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin") ## as suggested by Martin Ellis [thanks!]

and all is well :)

bw

F


--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com
#
And note too that this is looking first for a script texi2dvi.  If you 
have that, *it* will look for pdflatex, possibly already knowing where 
to look.

Also note that both the usual texi2dvi and tools::texi2dvi will 
consult environment variables such as PDFLATEX.

If you have a standard Mac TeX installation such as MacTeX, it should 
contain texi2dvi.  So this seems to be entirely a path problem.
On Tue, 5 Jul 2011, Simon Urbanek wrote:

            

  
    
#
On 5 Jul 2011, at 16:01, Prof Brian Ripley wrote:

            
while it was entirely a path problem, the latest (2010) MacTex does *not* contain texi2dvi:

which texi2dvi
/usr/bin/texi2dvi

and 

$:/usr/local/texlive/2010/bin/x86_64-darwin$ ls texi*
texindy

but no texi2dvi. I did ask other mactex users and they also do not have texi2dvi

F
--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com
#
On Tue, Jul 5, 2011 at 11:23 AM, Federico Calboli
<f.calboli at imperial.ac.uk> wrote:
Well, I have texi2dvi and I use MacTex and I am on a fresh install
(new laptop) of snow leopard + latest mactex.  I am using the big
1.6GB "all of mactex" package you can download.

Kasper
#
On 5 Jul 2011, at 16:26, Kasper Daniel Hansen wrote:
Me too. Have you tried 

which texi2dvi

and 

find /usr/local/texlive/ -name texi2dvi

I do not have a texi2dvi binary in the texlive directory.

F

--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com
#
On Tue, 5 Jul 2011, Federico Calboli wrote:

            
Well, I did say it is a script, and on my Mac it is in 
/usr/bin/texi2dvi .

  
    
#
On 05-07-2011, at 17:39, Prof Brian Ripley wrote:

            
The texi2dvi issue has been discussed in the past:

http://macosx-tex.576846.n2.nabble.com/Duplicate-texi-executables-on-Leopard-td623925.html


I inspected the macTeX-2010.mkpg with Pacifist. It does not contain the texi2dvi script.
MacTeX uses the latexmk perl script.

/usr/texbin is on my PATH and running which -a texi2dvi gives: /usr/bin/texi2dvi


AFAICT, texi2dvi is Apple provided. It is also quite old (at least if the 2004 refers to texi2dvi):

Running texi2dvi --version in Terminal gives:

texi2dvi (GNU Texinfo 4.8) 1.34

Copyright (C) 2004 Free Software Foundation, Inc.
There is NO warranty.  You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING.

Result of ls -l /usr/bin/texi*

-rwxr-xr-x  1 root  wheel   28218 12 Nov  2010 /usr/bin/texi2dvi
-rwxr-xr-x  1 root  wheel   28218 24 Sep  2007 /usr/bin/texi2dvi.old
-rwxr-xr-x  1 root  wheel  557096 12 Nov  2010 /usr/bin/texi2html
-rwxr-xr-x  1 root  wheel  557096 24 Sep  2007 /usr/bin/texi2html.old
-rwxr-xr-x  1 root  wheel     660 12 Nov  2010 /usr/bin/texi2pdf
-rwxr-xr-x  1 root  wheel     660 24 Sep  2007 /usr/bin/texi2pdf.old
-rwxr-xr-x  1 root  wheel  109520 12 Nov  2010 /usr/bin/texindex
-rwxr-xr-x  1 root  wheel  102048 24 Sep  2007 /usr/bin/texindex.old

I don't know where the .old versions come from.

Berend

Running Mac OS X 10.6.8 and R version 2.13.0 Patched (2011-04-26 r55655)
#
Yes, most open-source software on Mac OS X is old.  One issue is 
GPL-3: texinfo was an early adopter, and AFAIR texinfo 4.8 was the 
last GPL-2 release.

My point was (and remains) that if you have your paths set up 
correctly, tools::texi2dvi will use the texi2dvi script and not 
pdflatex directly.  And that this is all in the R-admin manual.
On Wed, 6 Jul 2011, Berend Hasselman wrote: