At 01:44 AM 9/13/2005, Taco Hoekwater wrote:
Andre van der Vlies wrote:
I use 'lgrind' to format my 'source code' (C, python, sricpts, etc.). I like the 'layout' (highlighting, line numbering...). Is there something equivalent (or better :) in/for ConTeXt?
I personally do not know of anything that is comparable right away, but I could be wrong.
I don't know of anything either. The LaTeX "listings" package is mostly just TeX at its core, so it's feasible to think of translating it -- but, even if it's only 5% LaTeX, that's still quite a lot of code, so it's still a good bit of work! The lgrind documentation does refer to an earlier tgrind which worked in Plain TeX; this might also work in ConTeXt.
Side note: I looked at the source of lgrind and it looks rather simple, so it may be possible to replace the lgrind executable with a perl (or ruby) script that can be targeted at ConTeXt as well as LaTeX.
In my opinion, that would be a useful thing, since lgrind itself is non-free. (Specifically, it's based on code with a "no-commercial" license.) An implementation that was careful to avoid any literal copying would get around that, and be a useful thing to have. Meanwhile, though, after looking through the code, I don't think there's actually much need to modify the executable. Lgrind mostly doesn't write LaTeX (which is why Andre found it so obscure) -- it writes TeXcode that uses its own simple commands, which are then defined in lgrind.sty. To use Lgrind in ConTeXt, one needs to translate the style file into a t-lgrind.tex, at which point the same Lgrind output files can be used in both systems. If you do re-implement it as a Python script, I would suggest keeping things similarly flexible, as it would be good to be able to use the re-implementation in LaTeX as well (due to the aforementioned license issues, an also just because it's convenient to be able to use the same system, for those of us likely to be writing papers in LaTeX and presentations in ConTeXt). - Brooks