By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,928 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,928 IT Pros & Developers. It's quick & easy.

generate LaTeX/TeX syntax highlighted code

P: n/a

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

John Hunter
Jul 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
John Hunter <jd******@ace.bsd.uchicago.edu> writes:
Are there any tools that can be used to process python code and
generate LaTeX/TeX output with syntax highlighted code?


Try lgrind.

--
Brian Gough

Network Theory Ltd,
Publishing the Python Manuals --- http://www.network-theory.co.uk/
Jul 18 '05 #2

P: n/a
>>>>> "Brian" == Brian Gough <bj*@network-theory.co.uk> writes:

Brian> John Hunter <jd******@ace.bsd.uchicago.edu> 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

http://groups.google.com/groups?hl=e...3DN%26tab%3Dwg

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

Thanks!
John Hunter
Jul 18 '05 #3

P: n/a
In article <ma************************************@python.org >,
John Hunter <jd******@ace.bsd.uchicago.edu> wrote:
Are there any tools that can be used to process python code and
generate LaTeX/TeX output with syntax highlighted code?


\usepackage{listings}

http://www.ctan.org/tex-archive/macr...trib/listings/

--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
Jul 18 '05 #4

P: n/a
In <ma************************************@python.org >, John Hunter wrote:
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
Jul 18 '05 #5

P: n/a
> John Hunter <jd******@ace.bsd.uchicago.edu> wrote:
Are there any tools that can be used to process python code and
generate LaTeX/TeX output with syntax highlighted code?


The SciTE text editor enables you to export to LaTeX (also to PDF,
HTML, XML, and RTF). See:

http://scintilla.sourceforge.net/SciTE.html

Dave
--
Dave Kuhlman
http://www.rexx.com/~dkuhlman
Jul 18 '05 #6

P: n/a
In article <ma************************************@python.org >,
John Hunter <jd******@ace.bsd.uchicago.edu> wrote:
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
Jul 18 '05 #7

P: n/a
>>>>> "David" == David Eppstein <ep******@ics.uci.edu> writes:
Are there any tools that can be used to process python code and
generate LaTeX/TeX output with syntax highlighted code?


David> \usepackage{listings}

David> http://www.ctan.org/tex-archive/macr...trib/listings/

.... beyond my wildest dreams...

JDH
Jul 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.