title: Rmarkdown knit error: Fault/access violation in generated code
body: <p>I've got a particular bug in my environment such that I cannot consistently knit Rmarkdown files to HTML, Word documents, or PDFs. The ability to knit varies across by file type. </p>
  
  <ul>
  <li>HTML - Sometimes it knits</li>
  <li>Word document - Sometimes it knits</li>
  <li>PDF - Never knits. Always throws the same error</li>
  </ul>
  
  <p>The error is:</p>
  
  <pre><code>Segmentation fault/access violation in generated code
  Error: pandoc document conversion failed with error 1
  </code></pre>
  
  <p>Up until a week ago, I was able to knit to all three file types in the same environment so this is a relatively recent bug. The high-level specs of my environment are:</p>
  
  <ul>
  <li>OS: Windows 10</li>
  <li>R: 3.4.3</li>
  <li>RStudio: 1.1.419</li>
  <li>knitr: 1.19</li>
  <li>rmarkdown: 1.8</li>
  <li>pandoc: 1.19.2.1</li>
  <li>MiKTeX : 2.9</li>
  </ul>
  
  <p>As an example of the inconsistency in the ability to knit, I crated a new .Rmd file in RStudio which creates the familiar standard template of <code>summary(cars)</code> and <code>plot(pressure)</code> etc. I didn't change anything about it. I was able to knit it successfully to HTML once, Word .docx once, and then I tried to knit to PDF and got the error above. I then went back and attempted to knit to both HTML and Word and received the error even though nothing changed from the original knit. This is just an example of the type of behavior. Different documents behave differently.</p>
  
  <p>To troubleshoot, I've reinstalled R and RStudio (I believe pandoc comes up with the RStudio install so I've effectively reinstalled pandoc too). The reinstallation did not help. I've tried clearing the Knitr Cache. That didn't work either. I've browsed SO and the internet and found a few similar errors related to the Glasgow-Haskell compiler, but I have no idea what that is and if it's the source of the issue. </p>
  
  <p>Here is an example of the .Rmd file that throws the error:</p>
  
  <pre><code>---
  title: "Untitled"
  author: "Vypa"
  date: "February 8, 2018"
  output:
    html_document: default
  ---
  
  ```{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 &lt;http://rmarkdown.rstudio.com&gt;.
  
  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.
  </code></pre>
  
  <p>And here is the full console error:</p>
  
  <pre><code>Segmentation fault/access violation in generated code
  Error: pandoc document conversion failed with error 1
  In addition: Warning message:
  running command '"C:/Users/Vypa/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS tst.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output tst.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\Vypa\Documents\R\R-3.4.3\library\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:\Users\Vypa\AppData\Local\Temp\RtmpI9Gxsx\rmarkdown-str5db029544a23.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"' had status 1 
  Execution halted
  </code></pre>
  
  <p>Any help or thoughts would be appreciated.</p>