Can't creat PDF, can't find tinytex or Miktex files???

I'm trying to do R Markdown for PDF and understand that I need tinytex package or download the Complete version of MikTex. I have done both, but I am unable to create a PDF. I am trying to produce the output for the given RMD code when you open your first RMD window thing. I am VERY new to R. but a fast learner. My colleague is also having the same troubles as I am. here is the error message I get when I knit the code:

processing file: 0_-_Initial_New_RMD_code.Rmd
  |.........                                                        |  14%
  ordinary text without R code

  |...................                                              |  29%
label: setup (with options) 
List of 1
 $ include: logi FALSE

  |............................                                     |  43%
  ordinary text without R code

  |.....................................                            |  57%
label: cars
  |..............................................                   |  71%
  ordinary text without R code

  |........................................................         |  86%
label: pressure (with options) 
List of 1
 $ echo: logi FALSE

  |.................................................................| 100%
  ordinary text without R code


output file: 0_-_Initial_New_RMD_code.knit.md

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS 0_-_Initial_New_RMD_code.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output 0_-_Initial_New_RMD_code.tex --template "\\pmicdfs01\PLP_Homes\mvandeynze\R\win-library\3.5\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" --variable "compact-title:yes" 
Error: Failed to compile 0_-_Initial_New_RMD_code.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips.
In addition: Warning message:
In system2(..., stdout = FALSE, stderr = FALSE) : '"pdflatex"' not found
Execution halted

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)

  Mac OS X: TexLive 2013 (Full) - http://tug.org/mactex/
  (NOTE: Download with Safari rather than Chrome _strongly_ recommended)

  Linux: Use system package manager

Then here is the code I am trying to knit: (it showed up in the window when I first opened up the RMD code window.

title: "TESTING EVERYTHING"
author: "Morgan :)"
date: "July 9, 2019"
output: pdf_document
---

{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)


## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

{r cars}
summary(cars)


## Including Plots

You can also embed plots, for example:

{r pressure, echo=FALSE}
plot(pressure)


Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

maybe it's because the code shouldn't create an output, but IDK anything. I've looked up many help forums and my colleague has as well and I can't seem to figure it out. I haven't changed anything in the code to knit it. for posting I have just removed the ```s so that it's separate from my question and thoughts.

Welcome to the community!

Installing the tinytex R package is not sufficient. You will have to install TinyTeX, the LaTeX distribution. If you have already downloaded the R package, run tinytex::install_tinytex() and follow the instructions.

You can find more information here.

If you want to use MikTeX (it's not recommended anymore), you'll have to add it to the system PATH. Please check whether you've done that or not.

Hope this helps.

2 Likes

yes this was perfect! Thanks so much!

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:

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