472,096 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,096 software developers and data experts.

generate LaTeX/TeX syntax highlighted code


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
7 2951
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
>>>>> "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
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
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
> 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
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
>>>>> "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.

Similar topics

1 post views Thread by Marc Giombetti | last post: by
8 posts views Thread by fortuneteller | last post: by
reply views Thread by giovanni gherdovich | last post: by
21 posts views Thread by Grant Edwards | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.