I using RStudio and Pandoc to output my document created in markdown to PDF. Pandoc always convert the code blocks in markdown using verbatim environment. Does anyone know how to switch the default conversion environment from verbatim to listing?

  • I uses Knitr to generate the output, I understand that I can use --listings command, but have not figured how. Anyone know how?
    – Justintosh
    Dec 27, 2017 at 0:34

1 Answer 1


pandoc 1.8 released[1] in 2011 added a --listings option to "Use the listings package for LaTeX code blocks" instead of doing the highlighting in pandoc. Refer to the manual: https://pandoc.org/MANUAL.html.

[1] https://pandoc.org/releases.html#pandoc-1.8-2011-01-30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.