[Edu-sig] Writing books/manuals containing code
Alexander Schliep
schliep at molgen.mpg.de
Mon Sep 5 13:10:06 CEST 2005
Hi everyone,
LaTeX is (rightfully so, IMHO) the standard for scientific publishing, in
particular for books if there is any math context. To automate the
production of PDFs with up-to-date code examples, sample outputs and
figures (that is sometimes more difficult) you can use make. Appropriate
rules create output such that myscript.py produces myscript.out whenever
myscript.py is changed.
Both code and output can be incorporated and pretty-printed using the
listings package; the only bummer is that you have to reference line
numbers. It would be nice if you could reference particular pieces more
easily; Knuth's original programming tools seemed not that much more
helpful for the lots of theory and small sample programs and their output
type publications.
I use pyexpect to capture the output of an interactive session given
some commands a user would type in a file. I just stumbled over
http://starship.python.net/crew/bhoel/PyLaTeX-0.2/README.html
which is another way to have Python code in LaTeX.
Best,
Alexander
--
Alexander Schliep schliep at molgen.mpg.de
More information about the Edu-sig
mailing list