I am interested in putting some of my functional programs (Haskell/OCaml/Coq) in a LaTeX document.
What is the best way to do this?
Options I have considered:
- Pasting actual Haskell code and using the
minted
package for syntax highlighting.- This is nice for certain pieces of code, but does not appropriately take advantage of LaTeX. For example, if I have a variable named w_1, I would like for it to render it as a subscript. I would also like to be able to render certain symbols (say greek letters) without using Unicode in my LaTeX source.
- Formatting with
algorithms2e
- This is not particularly helpful since this package is meant for procedural algorithms. So, while there is a mechanism to deal with
for
, there is no mechanism to deal withwhere
orlet
- This is not particularly helpful since this package is meant for procedural algorithms. So, while there is a mechanism to deal with
- Formatting Equations using a
\begin{aligned*} ... \end{aligned*}
block.- This works pretty well when the function is a series of top level pattern matches. However, there is still no support for
where
syntax, or a way of formattingcase ... of ...
- This works pretty well when the function is a series of top level pattern matches. However, there is still no support for