Scientific Literate Programming using LaTeX
Context
This is a code fontifier based upon tfontedpr by Van Jacobson
of Lawrence Berkeley Laboratory (van@lbl-rtsg.arpa).
Whereas tfontedpr uses the tgrind style only, sltex uses an
improved "tgrinds" LaTeX style for literate programming using
standard LaTeX.
Purpose
Do write comments in LaTeX in your source code, and get a pretty
listing with high level comments. This means, you can write code
at the same time you describe the algorithms using Maths Formulas,
including graphics, tables... all what LaTeX offers !
Usage
The use of this program is very easy, with many command line
options that overload a user's configuration file. The use of various
LaTeX styles is made this way.
Genesis
The idea came to me in 1995, while doing a PhD Thesis
in Numerical Analysis, where I was implementing a new method to solve
frequency Maxwell equations. I had to write the algorithms, then to
implement. Having comments in LaTeX inside the fortran source files
was very helpful. Also, when a variable appears many times, instead of
describing it each time, I could place the description in an included
LaTeX file. So, when an array changes meaning, changing the description
is made only once.
It is only recently I compiled tfontedpr on Linux, using the port
made by Luis A. Fernandes. I added a clean 8bit support.
The program architecture is a bit complicated:
- - the user program is a Perl script, slptex.pl; it calls
- - the tfontedpr C program to convert code into LaTeX, fontifying
key words from the language, detecting start and end blocks,
detecting routine declarations,
- - then, a C++ program, called ToTex, converts the precedent
output to LaTeX.
- - LaTeX, BibTeX and makeindex compilation are done,
- - Configuration file is stored (for instance to save that there
is no BibTeX entry in the source code, so as to remove the
bibliography section).
Platforms
Working platforms are SunOS and Solaris since 1996, Linux since
now. It should also work on alpha-processors, HPPA-Risc.
It probably works on Windows.
Audience
The targeted audience is the one of people typesetting documents in
LaTeX and writting source code (C, C++, fortran, Perl...) so mainly
scientits, this is why it is called slptex, that stands for
"Scientific Literate Programming using LaTeX".