Documents are trees

TeXmacs represents all texts by trees (for a fixed text, the corresponding tree is called the edit tree). The inner nodes of such a tree are labeled by standard operators of type tree_label (see Basic/Data/tree.gen.h). The labels of the leaves of the tree are strings, which are either invisible (such as lengths or macro definitions), or visible (the real text). TeXmacs trees can be written using different notations. For instance, the tree

represents the formula

x + y + frac (1, 2) + sqrt (y + z)

and can also be written as

(concat
  "x+y"
  (frac "1" "2")
  "+"
  (sqrt "y+z"))

in Scheme notation.

The meaning of the text and the way it is typeset essentially depends on the current environment. The environment mainly consists of a hash table which maps environment variables to their tree values. The current language, the current font and the current color are examples of system environment variables; new variables can be defined by the user. For instance, the Scheme expression

(concat
  "Some "
  (with "color" "blue" "blue")
  " text.")

represents the document fragment

Some blue text

The TeXmacs primitive with indicates a local change of an environment variable.

In the sequel, we will describe in more detail the different stardard TeXmacs operators and environment variables. It should be noticed that the TeXmacs data format is still subject to change. In the last section we will describe these changes. Usually, the changes will not be noticed by the user, since they are always accompanied by conversion programs which automatically update to the new format. However, they are sometimes important for developers, although most changes just concern the addition of new primitives.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".