Skip to content

Instantly share code, notes, and snippets.

@benmarwick
Last active December 18, 2015 20:59
Show Gist options
  • Select an option

  • Save benmarwick/5844476 to your computer and use it in GitHub Desktop.

Select an option

Save benmarwick/5844476 to your computer and use it in GitHub Desktop.
Markdown chunk for quick and easy R markdown to PDF
# Load packages
setwd(wd) # assumes wd has been set earlier in the doc
require(knitr)
require(markdown)
 
# process .md and .pdf files (including smart punctuation and grey background of code blocks)
filen <- "names" # name of this markdown file without suffix
knit(paste0(filen,".md"))
system(paste0("pandoc -s ", paste0(filen,"-out.md"), " -t latex -o ", paste0(filen,".pdf"), " --highlight-style=tango  -S"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment