RUser4512 RUser4512 - 1 year ago 126
LaTeX Question

Include math equation with ocamldoc

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

ocamldoc -latex
pdflatex ocamldoc.out

where 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 Source

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: ... %}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download