I am using LaTeX to write a document about Python. This document will contain code snippets (examples).
I could use the verbatim
environment, but before I embark onto it, I'd like to know if you are aware of any LaTeX style file which provides an environment for Python code. Syntax highlight would be a plus.
Thanks.
Edit:
I must point out that the package minted
is exactly what I was looking for. It has beautiful syntax highlighting and it is very simple to use. Check this question to know more about it.
Take a look at this question Source code highlighting in LaTeX for more information.
You should also look at the pygments program for source code highlighting.
I personally use Emacs org-mode with #+BEGIN_SRC python
and let htmlize.el
take care of the highlighting during export. You can see a sample here (This is an HTML export but with the latest version of org-mode, it can use the listings LaTeX package to colourise exported PDFs too).
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