Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Knit PDf file from RStudio

Tags:

linux

markdown

r

I am trying to Knit PDf file from RStudio, and I am getting the following error:

! LaTeX Error: File `framed.sty' not found.

  • R version: 3.2.2 (2015-08-14)
  • Platform: x86_64-redhat-linux-gnu on AWS EC2
like image 999
ronencozen Avatar asked Dec 13 '15 15:12

ronencozen


People also ask

How do I Knit a document in R?

If you are using RStudio, then the “Knit” button (Ctrl+Shift+K) will render the document and display a preview of it.

How do I publish an R file as a PDF?

Having saved your R Markdown file, it's time to process it and generate a PDF file. You can do this by clicking the Knit PDF button above the text. Your PDF file will be generated and opened as shown below.

Why is my R Markdown not knitting to PDF?

Looks like you have a character in your document that is not compatible with the inputenc LaTeX package. You may need to change the encoding if you are using non-English characters in your document.


3 Answers

I know this is kind of old, but I tried all this answers in my ubuntu and it didn't work, finally I found that yihui developed the tinytex package, the only thing you have to do is run the following code:

install.packages(c('tinytex', 'rmarkdown')) tinytex::install_tinytex() 

and you are set, this works cross platform

Cheers

like image 193
Derek Corcoran Avatar answered Sep 21 '22 21:09

Derek Corcoran


While trying to knit PDF file from R Studio.

Error-1: ! LaTeX Error: File `framed.sty' not found.

Reference: https://github.com/rstudio/rmarkdown/issues/39

Solution:

You need to install the framed LaTeX package.

yum -y install texlive-framed 

Error-2: ! LaTeX Error: File `titling.sty' not found.

Reference: https://github.com/rstudio/rmarkdown/issues/359

Solution:

wget http://mirrors.ctan.org/macros/latex/contrib/titling.zip  unzip titling.zip     # (might need to sudo yum install unzip)  cd titling  latex titling.ins  sudo mkdir -p /usr/share/texlive/texmf-dist/tex/latex/titling  sudo cp titling.sty /usr/share/texlive/texmf-dist/tex/latex/titling/  sudo texhash 
like image 45
ronencozen Avatar answered Sep 21 '22 21:09

ronencozen


I had a similar problem with titling.sty. The solution was to install a package that contained the missing file.

Ubuntu:

On my ubuntu it was:

sudo apt install texlive-latex-extra

Remember, that you can always find a package that contains a given file by using apt-file:

sudo apt-file search titling.sty

Of course, you'll have to install the apt-file package first (and refresh the file database) if you haven't done it before:

sudo apt install apt-file
sudo apt-file update
like image 43
Łukasz Dumiszewski Avatar answered Sep 21 '22 21:09

Łukasz Dumiszewski