Pandoc is used to generate a PDF from an R markdown document that has a chunk that generates a plot using ggplot2 and a custom function, progress.plot. The chunk looks like this
progress.plot(student)
The PDF is generated using a LaTeX engine. I think it uses PDFlatex via pandoc. This is causing a problem that appears to be close to the pandoc metal.
It seems like pandoc uses a temporary folder to store the diagram I generate with ggplot2. The name of that folder has as underscore. This means the path to the graphic file, a string that's used in the .tex source file, has an underscore. And the latex compiler doesn't like that.
The "_files" in the latex log snippet, above, is the name of a folder created by pandoc (or Rmarkdown). I am getting a "Missing $ inserted" error before the latex compiler craps out. No PDF is generated and the directory with the figure is deleted.
Is there a pandoc/Rmarkdown configuration change to take the underscore out of the temporary directory's name? Or is there any other workaround that will allow me to generate figures to include in my R markdown document?
I my case knitting a Rmd file with a graph always produces an intermediary folder with the graph.
The folder name is the name of the Rmd file followed by _files . Note the underscore.
When I knit (use knit btton in RStudio) atest.Rmd with the following contents
Knit-ing your code works fine. Replacing my function throws a different type of error. Thanks for opening a new approach for debugging. I appreciate it.