The HaTeX library

HaTeX is a Haskell library that implements the LaTeX syntax, plus some abstractions on top.

Check a list of usage examples in the Examples directory of the repository in GitHub. A good starting point is simple.hs. Run any example script executing the main function.

How to contribute

There are the options for potential contributors:

Related projects

  • haskintex: Tool to use Haskell (and, additionaly, the HaTeX library) within a LaTeX file.
  • TeX-my-math: Experimental library to ease the production of mathematical expressions using HaTeX.


HaTeX Changelog

This is the logchange of HaTeX. It is not exhaustive. For a full list of changes, see the commit history of the git repository:

Changelog by versions

  • QuickCheck instance fix.

  • Define (<>) instead of mappend.
  • Use fmap instead of liftM.
  • New function: applyDOIReferenceResolves.
  • Make parser test more lenient (it was commented due to issue #144).
  • Metadata update.
  • Unify files ReleaseNotes and

From to

  • Relax transformers dependency upper bound from < 0.6 to < 0.7.

From to

  • Allow bytestring version 0.11 (#153).
  • Allow hashable 1.4 and text 2.0 (#154).

From to

  • Add more math symbols. (leftaroundabout)

From to

  • New render method: renderBuilder.

From to

From to

  • More liftLX, commX and envX functions. (KommuSoft)
  • New module: Text.LaTeX.Packages.Acronym. (KommuSoft)
  • Expanded BibLaTeX module with new functionality. (leftaroundabout)
  • Dropped support for GHC-7.8 (and earlier versions).

From to

  • Replace wl-pprint-extras with prettyprinter in the latex pretty-printer.
  • Now ‘table’ takes a list of positions. (breaking change)
  • Added constructors Here and ForcePos to the Pos type.
  • Make argument of ‘nopagebreak’ optional.

From to

  • Fix build with GHC 8.4.1 (#113) (leftaroundabout).
  • Added Multirow, Bigstrut, and Lscape modules (#107, #111) (romildo).
  • More spacing and line breaking commands (#108, #110) (romildo).

From to

  • Warning: Using is not recommended, since it fails to build with GHC 8.4.1. Please, upgrade to

  • New bibtex module (leftaroundabout).

  • New function ‘squareBraces’ (NorfairKing).

  • New function ‘table’ (leftaroundabout).

From to

  • Semigroup instance for LaTeX.
  • Data, Generic, and Typeable instances for LaTeX
  • and related types.

From to

  • New math space commands (romildo).
  • New function: mapLaTeXT (ddssff).
  • Some fixes for qrcode package (L3n41c).

From to

  • New ‘array’ command (NorfairKing).
  • Added package options for the hyperref package related to PDF metadata (dmcclean).
  • QRCode module (dmcclean).
  • New math symbols (leftaroundabout).
  • Added ‘cases’ environment (NorfairKing).
  • Changed the way subscripts and superscripts work. See #67. Also #78.
  • LaTeX parser is now configurable. Currently, only configurable option is verbatim environments.

From to

  • New differentiation symbols (AMSMath).
  • Fix for integralFromTo.
  • Extend definitions for the Num class instance of LaTeXT.
  • Show and Eq instances of LaTeXT dissappear if base version is greater or equal to

From to

  • Full compatibility without warnings with GHC-7.10.

From to

  • Pretty-printer: Use softline instead of line after commands.
  • Compatibility with GHC-7.10.
  • Added accent commands to AMSMath (dmcclean).
  • Missing Num and Floating class methods now have a default implementation, using the new operatorname function (dmcclean).
  • Added imath and jmath to AMSMath (dmcclean).
  • Support for parsec-3.1.9 (snoyberg).

Thanks to Douglas McClean (dmcclean@GitHub) for the AMSMath additions.

From to

  • New package implemented: relsize. Thanks José Romildo Malaquias.
  • Fixed bug in autoBrackets (#42).

From to

  • New package implemented: AMSSymb.
  • Package beamer further developed.
  • Bug fix: #35.
  • Added common numeric sets to AMSSymb.
  • Breaking change: AMSMath functions ‘pm’ and ‘mp’ changed their type from LaTeXC l => l -> l -> l to LaTeXC l => l.
  • Additions to the AMSMath module.

From to

  • Fixed link in cabal file.
  • Added support for arguments delimited by parenthesis (experimental).
  • More tests on parsing.
  • Parser now backtracks when failing in argument parsing.

From to

  • New function matrixTabular to create tables from matrices.
  • Modified LaTeX Monoid instance to make monoid laws hold.
  • Some documentation improvements.
  • Added this CHANGELOG!


  • Num instance for LaTeXT.
  • New re-exports: liftIO.
  • Relaxed transformers package dependency to: >= 0.2.2 && < 0.4
  • Changed infix rule of (=:) and (/=:).
  • More documentation notes.
  • New functions: hfill, vfill.
  • The internal representation of LaTeXT has changed to prevent a set of errors.
  • Changes in Text.LaTeX.
  • Several minor fixes.


  • New functions ‘protectString’ and ‘protectText’.
  • New function ‘rendertexM’.
  • New environments: ‘figure’ and ‘caption’.
  • New example: simple.hs.
  • Updated version of transfomers to 0.3.*.
  • Trees implemented: datatype and Qtree package.
  • Render instances for Integer and Double.
  • New docs.
  • Class system implemented. Monad modules dropped.

  • This version only fix the patch that makes HaTeX compatible with GHC 7.4.



  • Parser implemented (New dependency on parsec).
  • Greek alphabet added to AMSMath.
  • New LaTeX package: graphicx.
  • Function ‘documentclass’ changed.

Other changes:

  • Dependency changed from mtl to transformers.
  • New commands: par, textwidth and linewidth.
  • New environment: minipage.
  • Compatibility with GHC 7.4 (with CPP extension).
  • Function ‘lift’ is now re-exported in Text.LaTeX.Base.Writer module.
  • New function ‘renderChars’ in the Render module.
  • ReadMe edited, now with ToDo list.


  • Dependency relaxed from ‘mtl == 2.’ to ’transformers == 0.2.’.



  • Added warnings (See Text.LaTeX.Base.Warnings).
  • Added an “Examples” directory.
  • Num instance for LaTeX and LaTeXT.
  • New package implemented “AMSThm” (See Text.LaTeX.Packages.AMSThm).

Changes by modules:

Base modules:

  • Text.LaTeX.Base.Syntax: Added Eq instance to LaTeX and TeXArg.
  • Text.LaTeX.Base.Writer: Added MonadTrans instance to LaTeXT. New functions: execLaTeXTWarn, liftFun, liftOp.
  • Text.LaTeX.Base.Types: Added Eq instance to Label.
  • Text.LaTeX.Base: Added Num instance to LaTeX.
  • Text.LaTeX.Base.Monad: Added Num instance to LaTeXT.
  • Text.LaTeX.Base.Commands: New function: between.

Package modules:

  • Text.LaTeX.Packages.AMSMath: New symbols: (=:) , (/=:) , forall , dagger, ddagger, in_ , ni, (<:) , (<=:), (>:) , (>=:)


  • First release of the third version of HaTeX.