Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Caml code listing inside LaTeX
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-06-22 (19:07)
From: Philippe Wang <lists@p...>
Subject: Caml code listing inside LaTeX

If ever you are interested in putting some caml code inside your latex 
document, *without* using verbatim environment or listings package,

the online tool :  (*)

takes some caml code and returns LaTeX code.

The applied treatments are :
- colors
- nested comments (even with strings such as "*)" inside) are detected
- based on LaTeX macros such as
     \DeclareTextSymbol{\BS}{T1}{92} % backslash
- the code is put in a tabular environment

Well, it's very small : 300 lines of code for the moment (about 230 
lines of ocamllex and 30 lines of ocaml...).

It could have certainly been written in camlp4 or in latex, but well, 
they are not (yet) my cup of tea.

Hopefully, it will be released under a free license next month (if you 
are interested in this program, which license do you want ?)

The main goals are :
- no use of verbatim, so that it can be used with beamer without the 
[fragile] option
- no use of the listings package (because it don't like it)

It certainly contains bugs, it was never proved or certified, and 
probably never will be...


  Philippe Wang

(*) I used php because cgi in pure caml is very complicated on the 
hosting server