typesetpy
When writing my master't thesis I needed
to typeset some Python code. I looked at all programs I could
find that were supposed to do something similar, but all of them
failed already on my first requirement. Source code must be
typeset using a fixed-width font, but none of the programs I
tried managed to use constant font width throughout the source.
I wrote my own typesetter, a small Python parser which generates
LaTeX code suitable for either inclusion in another LaTeX
document or as a stand-alone LaTeX document.
It works with both normal LaTeX and latex2html, and puts labels
on function definitions to make it possible to get references to
both side and line number. To see what the result looks like,
see both the ps/pdf (page 43 and forward) and html versions of the thesis.
Downloadtypesetpy --help produces:
This is typesetpy version 0.5. Copyright (C) 2005 Jörgen Cederlöf <jc@lysator.liu.se> Usage: typesetpy [--standalone] [--latex2html] input.py output.tex <label> --standalone creates a standalone LaTeX document. The name of the python file will be used as label if label is not given on the command line. Due to incompabilities between latex and latex2html, two modes are supported. With --latex2html a latex file suitable for latex2html is generated, but it won't work with normal latex. Reference function foo when label is bar with: \ref{functiondef:bar:foo} For further information on how to use the generated files, see the comments in their preambles. For more information on typesetpy, see: http://www.lysator.liu.se/~jc/typesetpy.html |
|
Jörgen Cederlöf <jc@lysator.liu.se> |