Built-in environment variables

The way TeXmacs typesets documents is influenced by so called environment variables. The style-sheet language uses a so called environment (or context) to store both environment variables and macros. The environment variables are subdivided into two catagories: built-in variables and additional variables provided by style files. Built-in variables usually affect the layout, while additional variables mostly serve computational purposes. In the next sections of this chapter, we will describe all built-in environment variables.

A typical built-in environment variable is color. The value of an environment variable may be changed permanently using assign and temporarily using the with primitive:

Some colored text.

Some <with|color|dark red|colored> text.

Counters are typical environment variables defined in style-sheets.

  1. A weirdly

    numbered list...

<enumerate|<document|<item>A weirdly|<assign|item-nr|3><item>numbered list...>>

The typesetting language uses dynamic scoping of variables. That means that macros can access and modify variables in their calling context. In the previous example, the enumerate macro locally initializes item-nr to 0 (uses with) and the item macro increments it by one and shows its value. Since enumerate locally redefines item-nr, the original value of item-nr is restored on exit.

Each document comes with an initial environment with the initial values of environment values, i.e. their values just before we typeset the document. If an environment variable does not occur in the initial environment, then its initial value defaults to its value after typesetting the document style and possible additional packages. The initial environment before typesetting the style files and packages is built-in into the editor.

Some variables, like header and footer variables, must be set inside the document, their initial environment value is ignored. Generally, they should be set by header and sectioning markup.

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".