HaTeX- The Haskell LaTeX library.

Safe HaskellNone




LaTeX standard commands and environments.


Basic functions

raw :: LaTeXC l => Text -> lSource

Insert a raw piece of Text. This functions doesn't care about LaTeX reserved characters, it insert the text just as it is received.

Warning: This function is unsafe, in the sense that it does not check that the input text is a valid LaTeX block. Make sure any braces, commands or environments are properly closed.

between :: Monoid m => m -> m -> m -> mSource

Calling between c l1 l2 puts c between l1 and l2 and appends them.

 between c l1 l2 = l1 <> c <> l2

comment :: LaTeXC l => Text -> lSource

Create a comment.

(%:) :: LaTeXC l => l -> Text -> lSource

This operator appends a comment after a expression. For example:

 textbf "I'm just an example." %: "Insert a few words here."

The implementation is

 (%:) l = (l <>) . comment

Since you are writing in Haskell, you may not need to output comments as you can add them in the Haskell source. I added this feature for completeness. It may be useful for debugging the output as well.

Preamble commands

title :: LaTeXC l => l -> lSource

Set the title of your document.

author :: LaTeXC l => l -> lSource

Set the author(s) of the document.

date :: LaTeXC l => l -> lSource

Set a date for your document.

institute :: LaTeXC l => Maybe l -> l -> lSource

Set either an institute or an organization for the document. It does not work for a document of the article class.

thanks :: LaTeXC l => l -> lSource



:: LaTeXC l 
=> [ClassOption]

Class options

-> ClassName

Class name

-> l 

Set the document class. Needed in all documents.

usepackage :: LaTeXC l => [l] -> PackageName -> lSource

Import a package. First argument is a list of options for the package named in the second argument.


Document classes

Class options

landscape :: ClassOptionSource

Changes the layout of the document to print in landscape mode

openright :: ClassOptionSource

Makes chapters begin either only on right hand pages

openany :: ClassOptionSource

Makes chapters begin on the next page available.

fleqn :: ClassOptionSource

Typesets displayed formulae left-aligned instead of centred.

leqno :: ClassOptionSource

Places the numbering of formulae on the left hand side instead of the right.

Paper sizes

data PaperType Source

LaTeX available paper types.



Page styles

markboth :: LaTeXC l => l -> l -> lSource

Used in conjunction with myheadings for setting both the left and the right heading.

markright :: LaTeXC l => l -> lSource

Used in conjunction with myheadings for setting the right heading.

Body commands

document :: LaTeXC l => l -> lSource

The document environment contains the body of the document.

maketitle :: LaTeXC l => lSource

Generate the title. It normally contains the title name of your document, the author(s) and date.

Document structure

tableofcontents :: LaTeXC l => lSource

Create the table of contents, automatically generated from your sections, subsections, and other related stuff.

abstract :: LaTeXC l => l -> lSource

Abstract section.


part :: LaTeXC l => l -> lSource

chapter :: LaTeXC l => l -> lSource

section :: LaTeXC l => l -> lSource

Start a new section with a given title.

subsection :: LaTeXC l => l -> lSource

Start a new subsection.

subsubsection :: LaTeXC l => l -> lSource

Start a new subsubsection.

paragraph :: LaTeXC l => l -> lSource

Start a paragraph.

subparagraph :: LaTeXC l => l -> lSource

Start a subparagraph (minimal level of sectioning).

Logos & symbols

today :: LaTeXC l => lSource

Render the date at compilation time.

thePage :: LaTeXC l => lSource

Render the current page.

tex :: LaTeXC l => lSource

TeX logo.

latex :: LaTeXC l => lSource

The LaTeX logo.

laTeX2 :: LaTeXC l => lSource

LaTeX logo.

ldots :: LaTeXC l => lSource

Horizontal dots.

vdots :: LaTeXC l => lSource

Vertical dots.

ddots :: LaTeXC l => lSource

Diagonal dots.

HaTeX specific

hatex :: LaTeXC l => lSource

Print the HaTeX logo.

hatex3 :: LaTeXC l => lSource

Print the HaTeX 3 logo.

hatex_version :: LaTeXC l => lSource

Print the HaTeX logo, beside the complete version number.

Document layout

par :: LaTeXC l => lSource

Start a new paragraph

newline :: LaTeXC l => lSource

Start a new line.

lnbk :: LaTeXC l => lSource

Start a new line. In a tabular, it starts a new row, so use newline instead.

linebreak :: LaTeXC l => l -> lSource

nolinebreak :: LaTeXC l => l -> lSource

pagebreak :: LaTeXC l => l -> lSource

nopagebreak :: LaTeXC l => l -> lSource

hfill :: LaTeXC l => lSource

Fill out all available horizontal space.

vfill :: LaTeXC l => lSource

Fill out all available vertical space.

stretch :: LaTeXC l => Int -> lSource

Document measures

Formatting text

verbatim :: LaTeXC l => Text -> lSource

The point of verbatim is to include text that will not be parsed as LaTeX in any way at all, but should simply appear as given in the document, in a separate display in typewriter font.

verb :: LaTeXC l => Text -> lSource

Include text, as given and in typewriter, but in-line. Note that, for LaTeX-specific technical reasons, verbatim text can generally only be used "at the top level", not in e.g. section titles or other command-arguments.

Unlike verbatim, which LaTeX implements as an ordinary environment, its command verb uses a syntax trick to avoid braking its parsing when the literal text contains a closing brace: rather than using braces at all, the first character after \verb will be the right delimiter as well. Translating this method to HaTeX wouldn't really make sense since Haskell has string literals with their own escaping possibilities; instead, we make it secure by automatically choosing a delimiter that does not turn up in the given string.


textbf :: LaTeXC l => l -> lSource

Set the given argument to bold font face.

textit :: LaTeXC l => l -> lSource

texttt :: LaTeXC l => l -> lSource

Set the given argument to monospaced font.

textrm :: LaTeXC l => l -> lSource

textsf :: LaTeXC l => l -> lSource

textmd :: LaTeXC l => l -> lSource

textup :: LaTeXC l => l -> lSource

textsl :: LaTeXC l => l -> lSource

textsc :: LaTeXC l => l -> lSource

Set the given argument to small caps format.

textnormal :: LaTeXC l => l -> lSource

underline :: LaTeXC l => l -> lSource

emph :: LaTeXC l => l -> lSource


Sizes are sorted from smallest to biggest.

tiny :: LaTeXC l => l -> lSource

scriptsize :: LaTeXC l => l -> lSource

footnotesize :: LaTeXC l => l -> lSource

small :: LaTeXC l => l -> lSource

normalsize :: LaTeXC l => l -> lSource

large :: LaTeXC l => l -> lSource

large2 :: LaTeXC l => l -> lSource

large3 :: LaTeXC l => l -> lSource

huge :: LaTeXC l => l -> lSource

huge2 :: LaTeXC l => l -> lSource


Math environments, such as equation, defined in Text.LaTeX.Packages.AMSMath.

enumerate :: LaTeXC l => l -> lSource

Environment of ordered lists. Use item to start each list item.

itemize :: LaTeXC l => l -> lSource

Environment of unordered lists. Use item to start each list item.

item :: LaTeXC l => Maybe l -> lSource

An item of a list (see enumerate or itemize). The optional argument sets the design of the item.

flushleft :: LaTeXC l => l -> lSource

Left-justify the argument.

flushright :: LaTeXC l => l -> lSource

Right-justify the argument.

center :: LaTeXC l => l -> lSource

Center-justify the argument.

quote :: LaTeXC l => l -> lSource

verse :: LaTeXC l => l -> lSource

cite :: LaTeXC l => l -> lSource

description :: LaTeXC l => l -> lSource



:: LaTeXC l 
=> Maybe Pos

Optional position

-> l


-> l

Minipage content

-> l 

Minipage environment.



:: LaTeXC l 
=> Maybe Pos

Optional position

-> l

Figure content

-> l 

Figure environment.

Page numbering

arabic :: LaTeXC l => lSource

Arabic numerals.

roman :: LaTeXC l => lSource

Lowercase roman numerals.

roman_ :: LaTeXC l => lSource

Uppercase roman numerals.

alph :: LaTeXC l => lSource

Lowercase letters.

alph_ :: LaTeXC l => lSource

Uppercase letters.


mbox :: LaTeXC l => l -> lSource

fbox :: LaTeXC l => l -> lSource

parbox :: LaTeXC l => Maybe Pos -> Measure -> l -> lSource

makebox :: LaTeXC l => Maybe Measure -> Maybe Pos -> l -> lSource



:: LaTeXC l 
=> Maybe Measure

Optional lifting.

-> Measure


-> Measure


-> l 

Produce a simple black box.

Cross references

caption :: LaTeXC l => l -> lSource

label :: LaTeXC l => l -> lSource

ref :: LaTeXC l => l -> lSource

pageref :: LaTeXC l => l -> lSource




:: LaTeXC l 
=> Maybe Pos

This optional parameter can be used to specify the vertical position of the table. Defaulted to Center.

-> [TableSpec]

Table specification of columns and vertical lines.

-> l

Table content. See &, lnbk, hline and cline.

-> l

Resulting table syntax.

The tabular environment can be used to typeset tables with optional horizontal and vertical lines.

(&) :: LaTeXC l => l -> l -> lSource

Column separator.

hline :: LaTeXC l => lSource

Horizontal line.

cline :: LaTeXC l => Int -> Int -> lSource

cline i j writes a partial horizontal line beginning in column i and ending in column j.

multicolumn :: LaTeXC l => Int -> [TableSpec] -> l -> lSource

Cell taking multiple columns.


footnote :: LaTeXC l => l -> lSource

protect :: LaTeXC l => l -> lSource

hyphenation :: LaTeXC l => l -> lSource

hyp :: LaTeXC l => lSource

qts :: LaTeXC l => l -> lSource

Quotation marks.

External files

input :: LaTeXC l => FilePath -> lSource

Import an external file and insert its content as it is.

include :: LaTeXC l => FilePath -> lSource

Similar to input, but forces a page break.

Note: the file you are including cannot include other files.