generate LaTeX/TeX syntax highlighted code

J

John Hunter

Are there any tools that can be used to process python code and
generate LaTeX/TeX output with syntax highlighted code?

John Hunter
 
B

Brian Gough

John Hunter said:
Are there any tools that can be used to process python code and
generate LaTeX/TeX output with syntax highlighted code?

Try lgrind.
 
J

John Hunter

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

http://groups.google.com/groups?hl=...grind%20python&hl=en&lr=&ie=UTF-8&sa=N&tab=wg

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

Thanks!
John Hunter
 
M

Marc 'BlackJack' Rintsch

Are there any tools that can be used to process python code and
generate LaTeX/TeX output with syntax highlighted code?

The listings package has Python support. From the README:

Abstract
--------

The `listings' package is a source code printer for LaTeX.
You can typeset stand alone files as well as listings with
an environment similar to `verbatim' as well as you can
print code snippets using a command similar to \verb'.
Many parameters control the output and if your preferred
programming language isn't already supported, you can make
your own definition.

Ciao,
Marc 'BlackJack' Rintsch
 
J

Jussi Jumppanen

John Hunter said:
Are there any tools that can be used to process python code and
generate LaTeX/TeX output with syntax highlighted code?

Take a look at the Doxygen tool:

http://www.doxygen.org

It will produce LaTex documentation directly from the from
source code and understands C++, C, Java, IDL, to some
extent Objective-C, PHP, C# and D.

FYI I also wrote a zOxygen Windows based utility that wraps
around the Doxygen tool:

http://www.zeusedit.com/zoxygen.html

It is designed to simplify the process of document creation
process for the case where you have a large number of project
source files.

Jussi Jumppanen
http://www.zeusedit.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top