3

When I attempt to build my package, saber, I get the following error message in the RStudio Compile PDF window.

Unabled to find specified LaTeX program 'pdfLaTeX' on the system path

The R-bloggers post describes the problem I'm experiencing. So I run:

> Sys.which("pdflatex")
pdflatex 
      "" 
> Sys.getenv("PATH")
[1] "/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

That second path seems absolutely wrong. The problem is, I'm still in my first year working on a linux-based system and have no idea what to change so that pdfLaTeX is in the path. I admittedly don't spend a lot of time running commands in the terminal, and need some guidance on how to get this fixed so I can build the package without errors. How do I find, then change the PATH so that pdfLaTeX is in the path?

> version
               _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          1.0                         
year           2014                        
month          04                          
day            10                          
svn rev        65387                       
language       R                           
version.string R version 3.1.0 (2014-04-10)
nickname       Spring Dance          
3
  • how did you install texlive? Regular apt-get? If not then its inside the directory you unzipped texlive.
    – rafee
    Jul 8, 2014 at 23:06
  • I ran the install-tl script and it didn't seem like it did anything, just disappeared. Jul 8, 2014 at 23:09
  • I always suggest installing via apt-get instead of these. Even though its not a traditional solution, but I recommend installing texlive via repository and that should solve problem.
    – rafee
    Jul 8, 2014 at 23:11

2 Answers 2

5

You need to install texlive. Use this at the command line:

sudo apt-get install texlive
# or if you want all the packages (big install)
sudo apt-get install texlive-full

It will be installed into a location that is already on your path too so you won't need to fiddle with the PATH to get it to work once it's installed.

0
0

Get to a terminal and type:

which pdflatex

You'll probably get something like:

/usr/bin/pdflatex

Check if that folder appears in the output of the PATH variable.

4
  • if which pdflatex could bring a result, that would mean its already in path
    – rafee
    Jul 8, 2014 at 23:06
  • Isn't that equivalent to Sys.which("pdflatex") in R? They both return an empty string. Jul 8, 2014 at 23:07
  • @RichardScriven Yes - which implies you need to install a latex distribution. texlive is the easiest and my answer gives the shell command to do so. I've never used the install-tl script you talk about but honestly it's easy enough to install texlive via the command line I'm not sure why you would want to use a script.
    – Dason
    Jul 8, 2014 at 23:34
  • @Dason thanks, it's running right now with no problems. Jul 8, 2014 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.