473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 2991
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Marc Giombetti | last post by:
Hello Want to ask your help for the following problem: I want to generate a GIF or PNG image from a latex expression like: $\lim_{x\to -\infty} x^m$ or $\int_{0}^{+\infty} e^{-x^2} dx$ or...
0
by: Bo Peng | last post by:
Dear list, I am writing a manual for my python extension using Python (2.4) latex classes. Everything seems to be fine except that the subscripts are as big as normal text ( see page 55 of...
1
by: Tom | last post by:
I need a very, very minimal LaTeX system on Windows. I only need to have the possibility to get DVI files out of my tex files (with minimal fonts). An I need it without any installer (no settings...
3
by: Kiki Novak | last post by:
Hi, I'm an Austrian writer living in Montpezat (South France), and I'm currently busy converting some of my writings from LaTeX to HTML to publish them on the Internet. The novel I'm working...
8
by: fortuneteller | last post by:
Hello, I'm quite new to python and Scipy. Anyway I want to use it to plot graphs. Does anybody know if there is the possibility to use Latex in SciPy's plotting functions like gplt? Thanks...
0
by: Ravi | last post by:
i tried with MS treeview control but i am unable to implement all the requirements.This requiement like when user login will generate the menu and display it. After that we need to Add or remove...
0
by: giovanni gherdovich | last post by:
Hello, first of all: Is this the right place to ask plastek-related questions? I'm trying to make plastex work on my Ubuntu Dapper Drake. For LaTeX, I have the all-in-one package tetex.
21
by: Grant Edwards | last post by:
I need to be able to generate a PDF report which consists mostly of vector images (which I can generate as encapsulated Postscript, PDF, or SVG). What I need is a way to combine these figures...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.