Help on knitting RMD file to PDF

Hi everyone ,

I am having issues with knitting my RMD file into PDF. I installed tiny tex ran the install tiny tex command from inside it , but to no avail.

I followed some of the tips mentioned in yehui debugging as well but still it refuses to work.

I also did package update. any suggestions

Also till i installed and ran tiny text , the rest of my libraries were running fine but suddenly some of my libraries like tidy verse and ggplot are giving errors.
I had run all my code today morning and it was working fine but now suddenly there are issues.

This the error it is giving.

Error: package or namespace load failed for ‘tidyverse’:

.onAttach failed in attachNamespace() for 'tidyverse', details:

call: NULL

error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc,

.libPaths()), versionCheck = vI[[i]]):

namespace ‘rlang’ 1.0.2 is already loaded, but >= 1.1.0 is required

In addition: Warning messages:

1: package ‘tidyverse’ was built under R version 4.1.3

2: package ‘ggplot2’ was built under R version 4.1.3

Start with reinstalling rlang :


thanks I did install rlang and the rest of the libraries are loading correctly.

But I am still not able to knit PDF from RMD . It does not show any specific error either.
Just says cannot compile pdf

It was working earlier - couple of hours before but when I did a package update and reinstalled tinytex that it stopped working.

Simple test code i tried for this rmd to knit to pdf:

new code to test
checking for packages which are not there and loading all the libraries

if(!require(tidyverse)) install.packages("tidyverse", repos = "")
if(!require(ggplot2)) install.packages("ggplot2", repos = "")
if(!require(dplyr)) install.packages("dplyr", repos = "")
if(!require(corrplot)) install.packages("corrplot", repos = "")
if(!require(randomForest)) install.packages("randomForest", repos = "")
if(!require(rpart)) install.packages("rpart", repos = "")
if(!require(caret)) install.packages("caret", repos = "")
if(!require(rpart.plot)) install.packages("rpart.plot", repos = "")
if(!require(e1071)) install.packages("e1071", repos = "")


study the data

z<- x+y

End of file

Hello @rrao ,
it is annoying that there is no clear error message but apparently that is the way it is.
I do not know how experienced you are with R and Tex so my suggestions and questions may be far of the mark:

  • Did you try compiling the very simple default program?
    Use the menu options File | New File | R Markdown... | and in the pop-up window pick PDF.
    Save the file (e.g. as mytemp.Rmd) and click the Knit button.
    What messages do you see in e.g. the render panel? Is the corresponding mytemp.pdf created?
    If so, there is something special in your R-code, but the compile process works.
  • If this does not work, add the keep_tex statement in the YAML of the saved file (and of course) save again and click the Knit button again:
title: "Untitled"
author: "My name"
date: "`r Sys.Date()`"
    keep_tex: true 

Again the pdf-file will most certainly not be there, but a 'mytemp.tex` should be produced. Is it?

  • Try rmarkdown::render('mytemp.Rmd'). Maybe this shows a message that previously did not appear.
  • Show us the result of

This shows your operation system and the status of the most relevant packages

  • Which version of RStudio are you using?
    Use Help in the RStudio menu structure and About RStudio
  • In your first post you indicated that you installed the R package tinytex and also the TEX compiler.
    Can you check if the compiler was correctly installed by e.g. compiling a tex-file outside RStudio?

I hope this helps and good luck.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.