Stan forum Syntax highlighting for knitr / Latex

I am writing a report which will for some parts serve as a Stan tutorial for my coworkers, and will thus include quite a few chunks of stan code. I am using knitr / Latex and would like to replicate Stan forum syntax highlighting which I find very cool and readable, How should I do that ? Is there a special add on / latex code chunk floating around somwhere ?

I am aware of @jrnold, listings plugging lstbayes but I am really looking for a markdown type rendition

For LaTeX/PDF, there is Stan syntax highlighting support pygments and a knitr pyments engine (https://rdrr.io/github/hrbrmstr/knitrengines/man/knitr_pygments_engine.html). Pandoc should support Stan syntax highlighting soon (it uses the syntax highlighting in KDE, and KDE accepted my pull request for Stan syntax highlighting).

3 Likes