# TeX-my-math: Render general Haskell math to LaTeX. Or: math typesetting with high signal-to-noise–ratio.

[ gpl, library, math, program ] [ Propose Tags ]

This is an attempt to get convenient math syntax in HaTeX (i.e., in data structures compatible / convertable to those from http://hackage.haskell.org/package/HaTeX).

The idea is to combine these features:

• Full access to the math-typesetting power of LaTeX. It should be possible to express any formula that might be found in a typical mathematics or physics journal article. This should also include expression which are not quite well-defined from a programming point of view, but are clear to the intended audience.

• Idiomatic Haskell syntax. Who wants to bother with unreadable expressions involving either hundreds of double-backslashes or extra syntax overhead in wrapping them explicitly into HaTeX?

Ideally, one would write expressions as if only meaning Haskell to calculate them, but get the result back as a full pretty-printing LaTeX math string. /And the actual calculated result as well/, if possible!

To this end, we use a minimal symbolic-manipulation EDSL, namely dumb-cas, set up in a way so the leaves of the syntax tree, i.e. the individual symbols, are represented by LaTeX expressions in memory and by single-letter variables in the Haskell code. These can then be combined with operators corresponding to LaTeX's maths operators, to obtain a very compact and almost WYSIWYG-like code appearance, while retaining the ability to apply any LaTeX-specific tweaks whenever necessary. At the same time, because the AST is fully precedence-aware, it is safely possible to transform the expressions via e.g. Template Haskell, to actually compute concrete numerical results, or apply exact symbolic-manipulation techniques.  ## Modules

• Math
• LaTeX
• Internal
• Math.LaTeX.Internal.Display
• Math.LaTeX.Internal.MathExpr
• Math.LaTeX.Prelude
• Math.LaTeX.StringLiterals