Objective Caml to LaTeX2e Objective Caml Listing
Objective Caml code
This is a small prototype that allows you to color (objective)
caml code such as it can be taken as a code listing in a LaTeX2e file.
The goal is to be able to color code with a very simple and generic program.
a PDF file that shows some results...
The main motivation is that
the verbatim environment is not suitable for beamer slides.
The need to declare a frame as fragile so that the frame code is extracted into another file is acceptable... But the slides numbers turn fool !
- I do not like the "listings" latex package
(not pretty at all, and some things may not be implemented).
This program should work with *any* encoding
LaTeX can handle. And you can afterwards highlight important
parts as you can modify at your ease the generated code!
- This is written in OCaml... Why in OCaml and not (La)TeX ?
It is only about 200 lines of ocamllex code and 30 lines of ocaml code.
And as said above, it is only a prototype written very quickly.
The generation is very fast. (I do not know yet if LaTeX likes it...)
Even if the colors wouldn't be the right ones, you can give some LaTeX2e code.
So it's somehow re-entrant. And I want it to be able to take any syntax and do
its job the way we expect it (well, nothing is really magic, so you would have
to specify somethings...).
- Free (i.e. release of source code) ? It will be soon (hopefully before this -2007- autumn) !
- easy portable generated code : does not need an extra package (but may look (very?) ugly...)
- usable with any encoding that latex accepts
- looks like verbatim but with colors
- easy to change the colors
- nested comments, strings inside comments
- can chop the generated tabular
- lines numbers (can be removed easily by just removing `#1' in the definition of the \mlcodeline command)
- This program has not been tested with files containing the \r character.
The end of line is \n only. (too boring to write the few lines of code to handle it). (but it works fine with Safari 3 client and a Linux server)
When an update is occuring, the tool wouldn't work for a few seconds.
If you see that it doesn't work, wait a few seconds and submit again.
(if it still doesn't work, please let me know)
"longtable" environment is not compatible with the "twocolumn" option.
If you're using the "twocolumn" option, turn it off (\onecolumn) or
replace longtable by tabular. (if you have a better idea, please let me
Please report bugs to mail[at]philippewang.info.
Your feedbacks are welcome. Your requests for features too. ;-)
2007 08 15 - GetPDF button to get a PDF file from your input
2007 08 07 - bug correction : some comments were not correctly parsed (because of bad operator parsing)
2007 08 03 - add pretty print option (pretty printing by camlp4, so the parser is not exactly the same as ocaml's default parser, say, 99% compatible)
2007 07 17 - use of longtable environment (with longtable package) instead of tabular,
as though the tabular is automatically splitted
(so "max succesive lines" becomes a bit obsolete)
2007 06 29 - bug correction about spaces and ~ characters.
2007 06 26 - deletion of unwanted backslashes automatically added by php
2007 06 24 - encoding charset issue solved
(use of utf-8 instead of iso-latin-1).
It works with non pure-ascii characters
2007 06 23 - major update :
use of alltt package (better final look & better code),
use of more manually declared text symbols (some are not necessary, they will be removed later),
update of the preview pdf
2007 06 23 - bug correction : characters were not correctly colored
2007 06 23 - previous bug correction + add sample button
2007 06 22 - introduction of a weird bug after update
(sorry for those who have tried and seen nothing)
2007 06 22 - 17:42 CEST - first version
this page has been requested 9653 times since june 2007