![]() |
TeXmacs documents | ![]() |
Whereas TeXmacs document fragments can be general TeXmacs trees, TeXmacs documents are trees of a special form which we will describe now. The root of a TeXmacs document is necessarily a document tag. The children of this tag are necessarily of one of the following forms:
This mandatory tag specifies the version of TeXmacs which was used to save the document.
An optional project to which the document belongs.
An optional style and additional packages for the document.
This tag specifies the body of your document. It is only omitted when the body is empty.
Optional specification of the initial environment for the document, with information about the page size, margins, etc.. The table is of the form <collection|binding-1|\(\cdots\)|binding-n>. Each binding-i is of the form <associate|var-i|val-i> and associates the initial value val-i to the environment variable var-i. The initial values of environment variables which do not occur in the table are determined by the style file and packages. Some purely interactive variables (like the screen dimensions and, in most cases, the zoom factor) are never saved in this table.
An optional table of the same form as the initial table. It is preserved when loading and saving the document, but is currently not used by the typesetter.
An optional table which associates arbitrary content to keys. Such attachments are saved along with the document, but are not part of its body; they are accessed from Scheme using get-attachment, set-attachment and list-attachments. For instance, the bibliographic database of a document may be stored in an attachment.
An optional list of all valid references to labels in the document. Even though this information can be automatically recovered by the typesetter, this recovery requires several passes. In order to make the behaviour of the editor more natural when loading files, references are therefore stored along with the document.
The table is of a similar form as above. In this case a tuple is associated to each label. This tuple is either of the form <tuple|content|page-nr> or <tuple|content|page-nr|file>. The content corresponds to the displayed text when referring to the label, page-nr to the corresponding page number, and the optional file to the file where the label was defined (this is only used when the file is part of a project).
This optional tag specifies all auxiliary data attached to the document. Usually, such auxiliary data can be recomputed automatically from the document, but such recomputations may be expensive and even require tools which are not necessarily installed on your system. The table, which is specified in a similar way as above, associates auxiliary content to a key. Standard keys include bib, toc, idx, gly, etc.
Example 1. An article with the simple text “hello world!” is represented as