TeXmacs trees |
All TeXmacs documents or document fragments can be thought of as trees. For instance, the tree
typically represents the formula
x + y +
|
(1) |
Each of the internal nodes of a TeXmacs tree is a string symbol and each of the leafs is an ordinary string. A string symbol is different from a usual string only from the efficiency point of view: TeXmacs represents each symbol by a unique number, so that it is extremely fast to test weather two symbols are equal.
Currently, all strings are represented using the universal TeXmacs encoding. This encoding coincides with the Cork font encoding for all characters except “<” and “>”. Character sequences starting with “<” and ending with “>” are interpreted as special extension characters. For example, <alpha> stands for the letter α. The semantics of characters in the universal TeXmacs encoding does not depend on the context (currently, cyrillic characters are an exception, but this should change soon). In other words, the universal TeXmacs encoding may be seen as an analogue of Unicode. In the future, we might actually switch to Unicode.
The string leafs either contain ordinary text or special data. TeXmacs supports the following atomic data types:
When storing a document as a file on your harddisk or when copying a
document fragment to the clipboard, TeXmacs trees have to be
represented as strings. The conversion without loss of information of
abstract TeXmacs trees into strings is called serialization
and the inverse process parsing. TeXmacs provides three ways
to serialize trees, which correspond to the standard TeXmacs
format, the XML format and the
However, it should be emphasized that the preferred syntax for
modifying TeXmacs documents is the screen display inside the editor.
If that seems surprising to you, consider that a syntax is a way to
represent information in a form suitable to understanding and
modification. The on-screen typeset representation of a document,
together with its interactive behaviour, is a particularly concrete
syntax. Moreover, in the