Remove italics (# comments) in Rmarkdown code chunks in pdf

294 Views Asked by At

I am looking to find a way to remove the italicized comments in Rmarkdown code chunks

---
output:
  pdf_document:
    keep_tex: true
    number_section: no
---

```{r}
# This is a test.
```

And the results.

enter image description here

Is there a way to make it not italicized?

Thank you,

1

There are 1 best solutions below

0
W. Joel Schneider On BEST ANSWER

Several code highlight styles do not italicize the comments, including haddock, kate, and zenburn. See here for a preview of available styles.

---
output:
  pdf_document:
    keep_tex: true
    number_section: no
    highlight: kate
---

If you need to create a custom syntax highlighting theme, instructions in the pandoc manual are here.