Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Philippe Wang <lists@p...>
Subject: Caml code listing inside LaTeX
Hi,

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

the online tool :
   http://philippewang.info/cs.tools.camltotex.php  (*)

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
     \newcommand{\mlkeyword}[1]{\mbox{\color{red}{#1}}}
- 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...

Cheers,

--
  Philippe Wang
    mail[at]philippewang.info


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