<Edward Grefenstette – Donnerstag, 21. Mai 2009 00:27> > On May 20, 10:10 pm, John Reid <j.r...@mail.cryst.bbk.ac.uk> wrote: >> Alan G Isaac wrote: >> > The listings package is great and highly configurable. >> > Note that you can also input entire files of Python code >> > or pieces of them based on markers. Really quite great. >> >> I tried listings. I believe pygments makes better formatted output (at >> least out of the box). > > I'm trying to figure out how to use pygments. Are there any good usage > examples out there?
It's not really difficult. First choose a pygments style and create the latex definitions for it (STYLENAME serves as placeholder here): pygmentize -S STYLENAME -f latex > pygments_style.tex Now import the required packages and the style definitions: \usepackage{color] \usepackage{fancyvbr} \input{pygments_style.tex} These packages are included in Tetex as well as in Texlive, if not, you can of course install them from CTAN. To format a snippet of code, run pygmentize and copy the output into your document: pygmentize -f latex a_python_file.py That's it. -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list