R Markdown to PDF document

rmarkdown
#1

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 !

0 Likes

LaTex tables in R/Rmarkdown file
#2

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

0 Likes

#3

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

0 Likes

#4

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

0 Likes

#5

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

0 Likes

#6

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 ?

0 Likes

#7

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.
install.packages('tinytex')

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)_

0 Likes

#8

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:

install.packages('tinytex')
tinytex::install_tinytex()
0 Likes

#9

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.

0 Likes

#10

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:

0 Likes

#11

Thank you cderv ... !

1 Like

closed #12

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.

0 Likes