How do I highlight python code in my Rnw
files (LaTeX files)? I'm using RStudio's "Compile PDF" function to run pdflatex
.
There are two related questions (Q1, Q2) for markdown files, but this questions is specific to Rnw
files.
Example:
\documentclass{article}
\begin{document}
<<>>=
print("This is R")
@
<<engine='python'>>=
print "This is python"
@
\end{document}
Install highlight: andre-simon.de. See @Yihui's post in the question's comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With