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

ocamldoc-latex error
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
 Date: -- (:) From: David Allsopp Subject: RE: [Caml-list] ocamldoc-latex error
> I just compiled Camomile 0.7.1, and generated the latex documentation
> with 'make doclatex'. Much to my surprise, when I attempt to process the
>   LaTeX file with either the 'latex' or 'pdflatex' program, I get the
> following error:
>
>    ! You can't use macro parameter character #' in horizontal mode.
>    <argument> ...n Unicode Technical Report \verb ##
>                                                    21
>    l.9 ...ned in Unicode Technical Report \verb#21}

This is not a TeX bug, as you correctly surmised...

> I am using TeXLive 2007.2 ... given the caution with which TeX is
> developed, it's hard to believe this is a bug in the TeX distribution.
> On the other hand, it's hard to believe that OCamlDoc is generating
> incorrect LaTeX code. Maybe some misconfiguration in my TeX
> installation? Any hints appreciated.
>
> BTW, if I edit the generated LaTeX file, replacing every instance of
> \verb# with \#{}, it runs fine.

ocamldoc should be doing this -- the \catcode value for # is 6 (The TeXbook,
pp. 37, 343) which means that it cannot be used as a basic character. Note
that # only needs to be written \# -- the braces are unnecessary as \# is a
parameter-less macro (in fact, it's a \chardef). From what I can see, the
bug is on line 89 of ocamldoc/odoc_latex.ml. Without seeing the faulty TeX
file, I can't confirm it for certain, but I would imagine that the problem
is that \verb is being used inside a \def or \newcommand which won't work
without a lot of (unnecessary) \catcode trickery surrounding the macro
definition. You could possibly say that it's a bug in LaTeX because \verb
should really be declared \outer in the LaTeX sources but that's a bit
off-topic for this list...

David

`