Version française
Home     About     Download     Resources     Contact us    
Browse thread
Syntaxe Caml en LaTeX
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Syntaxe Caml en LaTeX
On Monday 30 May 2005 00:25, Martin Jambon wrote:
> On Sun, 29 May 2005, Pierre-Etienne Meunier wrote:
> > I'd like to include Caml code in a LaTeX file, but since it is pretty
> > big, I want it to be easily readable. Then I want to keep the colored
> > syntax, like in tuareg for emacs. Do you know how to do it ?
>
> I don't know what people have used so far (you can ask Jon Harrop what he
> used for his book
> http://www.ffconsultancy.com/products/ocaml_for_scientists/).

I wrote a little program to color syntax-highlight LyX files by treating 
anything in typewriter font as code. This has several advantages - no need to 
annotate by hand, code can be extracted and even tested, easy to alter the 
document self-consistently and so on.

I chose to put all code snippets on their own minipage, to help lay them out 
aesthetically. However, LaTeX does a poor job of distributing them on the 
page, so any alterations to the document need to be carefully checked to make 
sure the LaTeX output hasn't become very ugly (e.g. huge gaps).

I think the solution I used works reasonably well but there is plenty of room 
for improvement. Ideally, I'd like to get rid of LaTeX...

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists