RUser4512 - 8 months ago 68

LaTeX Question

I would like to include equations in a documentation generated with ocamldoc. I am using a small (bat) script :

`ocamldoc -latex maths.ml`

pdflatex ocamldoc.out

where maths.ml contains the following comments :

`(** "Given a list of indices \\( v \\) and a vector of weights \f$ w \f$, this returns $ sum_iw_{v_i} $"*)`

let dot_product indices weights = [...]

However, the only thing produced in the pdf file is :

`val dot_product : int list -> float array -> float`

"Given a list of indices \\( v \\) and a vector of weights \f$ w \f$, this returns $ sum_iw_

$"

I tried various ways to indicate the equations ($, \f$, \( ) but none of these were identified. Is there a specific way to indicate equations for them to be recognized by ocamldoc ?

Answer

You can use target specific formatting:

```
{%latex: ... %}
```

Note that in general `ocamldoc`

documentation is rendered to HTML rather than PDFs. So I would not take advantage of that directive and/or care for the HTML output. For sub/super scripts the ocamldoc language supports them directly. For HTML specific output simply do

```
{%html: ... %}
```