# LaTeX environments

Last revision August 3, 2004

Various parameters control how the output text will be formatted, for example, whether you are creating normal paragraphs or indented lists or tables, what the margin widths are, what font to use, etc. Collectively, a set of these parameters is referred to as an environment.

In LaTeX, you can define multiple sets of environments, each of which affects a different part of the text.

You start with an initial environment for the document as a whole. You can then start a new environment for a sub-set of the document; the old environment table is stored off to the side and a new one set up, consisting of the old values plus any modifications you make by commands within this sub-set of the document.

Local environments can be nested to a large number of levels. When an inner environment ends, the table for the enclosing environment is restored. The advantage of this is that you can temporarily change a parameter, such as a margin setting, and not have to explicitly change it back yourself. LaTeX will automatically restore the old value when the current environment ends.

The "scope" of an environment refers to the portion of the document that is included in that environment. There are two ways to specify the scope of a local environment:

1. Enclose a sub-set of the document (text and commands) within a matching pair of left and right curly braces. Use commands within those braces to modify environment settings for that sub-set of the text. Sets of such brace-delimited-text can be nested within other sets.
2. Use the special commands \begin and \end to use one of the pre-defined environments. Both of these commands require the environment name as an argument. For example,

\begin{center}
... some text ...
\end{center}

Defines a center environment that applies to all text between the \begin and \end commands (this environment centers lines of text instead of filling them flush against the left and right margins). Again, environments defined this way can be nested within other environments.