473,837 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3013
John Hunter <jd******@ace.b sd.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.b sd.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************ *************** *********@pytho n.org>,
John Hunter <jd******@ace.b sd.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{lis tings}

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************ *************** *********@pytho n.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.b sd.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************ *************** *********@pytho n.org>,
John Hunter <jd******@ace.b sd.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.u ci.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{lis tings}

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
2476
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 whatever?
0
1587
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 http://bp6.stat.rice.edu:8080/simuPOP_doc/userGuide.pdf ). I doubt that the following piece of code in python.sty is causing the problem but can not fix it. (I get errors when commenting out this block of code.) Does anyone know what is happening here?
1
2083
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 in registry and no or less enviroment variables). I know this was asked a few time here but I haven't found any suitable information yet. I posted some time ago under "minimal latex for windows"...
3
5148
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 on has two different first-person narrators, formally distinguished by the use of italics. One of them (Violetta) only appears in italics, the other one (Victor) in normal fonts. This is a formal help for the reader to distinguish the two...
8
3407
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 for your help, Matthias
0
1539
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 the nodes from the tree from client side. 1.Selected node should be highlighted and non active. 2.some group of pages related to same category EX : registration process Aggrement,userinformation,login information and
0
1695
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
2254
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 into a single PDF document. Right now the reports consist entire of these figures, so I just write the figures out to temp files and then use os.system() to run ghostscript with appropriate options to combine them into a single PDF file. I'd...
0
9843
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9682
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10875
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10566
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7806
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5669
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5848
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4040
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.