1

I have been having a ton of trouble for awhile now attempting to make PDF docs from Rmarkdown in Rstudio. My goal is to create the "Journal of Statistical Software" format and when I run the example script provided, I get an error.

Script:

--- author: - name: FirstName LastName affiliation: University/Company address: > First line Second line email: [email protected] url: http://rstudio.com - name: Second Author affiliation: Affiliation title: formatted: "A Capitalized Title: Something about a Package \\pkg{foo}" # If you use tex in the formatted title, also supply version without plain: "A Capitalized Title: Something about a Package foo" # For running headers, if needed short: "\\pkg{foo}: A Capitalized Title" abstract: > The abstract of the article. keywords: # at least one keyword must be supplied formatted: [keywords, not capitalized, "\\proglang{Java}"] plain: [keywords, not capitalized, Java] preamble: > \usepackage{amsmath} output: rticles::jss_article --- # Introduction This template demonstrates some of the basic latex you'll need to know to create a JSS article. ## Code formatting Don't use markdown, instead use the more precise latex commands: * \proglang{Java} * \pkg{plyr} * \code{print("abc")} # R code Can be inserted in regular R markdown blocks. ```{r} x <- 1:10 x ``` 

When doing this my error is:

pandoc.exe: pdflatex not found. pdflatex is needed for pdf output. Error: pandoc document conversion failed with error 41 In addition: Warning message: running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS Untitled.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output Untitled.pdf --template "C:\Users\OPTIMA~1\DOCUME~1\R\WIN-LI~1\3.3\rticles\RMARKD~1\TEMPLA~1\JSS_AR~1\RESOUR~1\template.tex" --highlight-style tango --latex-engine pdflatex' had status 41 Execution halted 

I know it has to do with download MikTex but I haven't been able to find an easy step-by-step way of downloading this in order to run PDF docs in RMarkdown from RStudio.

Any help would be great and if you know any ways of doing this directly from R instead of downloading something from the web then that would be the easiest solution I would think.

Thanks!

4
  • pandoc needs pdflatex to create pdf. Under Windows you could use miktex which you can find here miktex.org/download Commented Mar 20, 2017 at 15:34
  • I got the same error when copying and pasting it into a new Rmd file, but using the RStudio dialogue box to open the template knits fine. Bug, I guess. Commented Mar 20, 2017 at 15:37
  • That worked @Wolfgang not sure why that didn't work in the past but excited about starting to create PDF's now! Thanks Commented Mar 20, 2017 at 15:52
  • If you can put your explanation down as an answer I can give you credit. Commented Mar 20, 2017 at 15:52

1 Answer 1

2

pandoc uses pdflatex to create pdf output, it is therefore mandatory to be installed.

Under Windows you could use miktex which you can find under https://miktex.org/download

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.