Alexander Engelhardt
Alexander Engelhardt

Reputation: 1712

How to export syntax highlighted RMarkdown code to PDF?

For a thesis, I would like to attach the code (not the output) of my .Rmd document, ideally with the pretty syntax highlighting that RStudio does.

Is there a way to export highlighted RMarkdown code to a file, ideally PDF?

Upvotes: 1

Views: 955

Answers (1)

rsmith54
rsmith54

Reputation: 805

I would check this out.

http://rmarkdown.rstudio.com/pdf_document_format.html#appearance_and_style

I think it should be as simple as

---
title: "Habits"
output:
  pdf_document:
    highlight: tango
---

Upvotes: 1

Related Questions