R Markdown to PDF document

Create using R markdown reports into PDF document.

I think my codes are correct, however I am getting this error message when I select Knit to PDF.

No TeX installation detected (TeX is required to create PDF output). You should install a recommended TeX distribution for your platform:

_ Windows: MiKTeX (Complete) - http://miktex.org/2.9/setup_
_ (NOTE: Be sure to download the Complete rather than Basic installation)_

However it works fine with Knit to HTML.
Please advise !

If you are on Windows, have you installed MikTeX on your device and added it to the system PATH?

I would advice to use tinytex to get pdf with Rmarkdown:

I did install it but how do you add it to your system's path ?

Ok, how do I use it with that, do you have examples ? Thx

Have you read the documentation in the link I provided ?
It says that once you have installed tinytex,

To compile an R Markdown document to PDF, there is nothing else you have to know.

Pretty easy right ?

Ok I did as follows:

I click File, New File, R script then enter this code below and ran it to install the tinytex package.
I checked on it to use it.

Then I click on File, New File, and click on R markdown and gave it a title, author, and click on the PDF
format. I save it to the directory as doc.Rmd.

Then in the doc.Rmd tab I select Knit and choose Knit to HMTL. It works fine and produced the report.
Then I choose Knit to PDF and it gives me the error message as below. It doesn't seem like the tinytex package is working or I am not using it right.

Windows: MiKTeX (Complete) - http://miktex.org/2.9/setup
_ (NOTE: Be sure to download the Complete rather than Basic installation)_

The steps to add to PATH:

  1. Search path on from Start menu.
  2. Open Edit system environment variables
  3. Select Environment variables
  4. Edit PATH by adding the full location of \miktex\bin.

But I agree with @cderv that tinytex is a better option, especially as now rmarkdown imports it automatically.

You will need to install the TinyTeX distribution first. Use this:


Thank you for your advise and suggestions.
Tried many attempts and going through some errors while installing along the way but kept on trying and it finally work. I was able to Knit to PDF now.

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

Thank you cderv ... !

1 Like

This topic was automatically closed 7 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.