Document model for formatted text documents

This module defines classes for the abstract representation of a document, which can be rendered into different formats. Currently (incomplete) support for str, RTF, TeX, PDF (through TeX) and HTML.

Documents are represented with classes inheriting from two base classes:

FMTextElement(content[, tag, options])

A text element along with formatting specification

FMText([content, tag, options])

List of FMTextElement items

Subclasses for specific purposes:

Table(columns[, rules, title, caption, rows])

A table

Image([name, format, alt, buf, height, width])

Represent an image file

Figure(content[, caption, options])

Represent a figure with figure caption

Section(heading[, content])

Document section containing a title and content

Report(title[, author, date, content, …])

Document consisting of several sections plus a title

Functions for export:


Copy an FMText object to the clipboard as PDF


Copy an FMText object to the clipboard as tex code

save_html(fmtext[, path, embed_images, meta])

Save an FMText object in HTML format

save_pdf(fmtext[, path])

Save an FMText object as a PDF (requires LaTeX installation)

save_rtf(fmtext[, path])

Save an FMText object in Rich Text format

save_tex(fmtext[, path])

Save an FMText object as TeX code