generate LaTeX/TeX syntax highlighted code

John Hunter jdhunter at
Tue Jul 6 16:44:07 CEST 2004

>>>>> "Brian" == Brian Gough <bjg at> writes:

    Brian> John Hunter <jdhunter at> writes:
    >> Are there any tools that can be used to process python code and
    >> generate LaTeX/TeX output with syntax highlighted code?

    Brian> Try lgrind.

Just did a little googling and found this in the lgrind FAQ

My source code doesn't seem to align properly. What am I doing wrong?

    LGrind uses by default a proportional font for its output. That's part
    of the beauty. However, aligning with spaces doesn't work, since they
    are relative horizontal motions. When using tabs, everything is fine. If
    the standard tab width of 8 is too big for you, fiddle around with your
    editor to save the file with tabwidth 4, say, and then use '-t 4' as an
    option to LGrind.

Should I be worried?  Will I need to preprocess my python and convert
spaces to tabs?

Also, I did some searching on google groups - it appears you need to
specify the syntax for python.  I found this post from 1998

Do you have something more recent, or is this what you use?

John Hunter

More information about the Python-list mailing list