LaTeX Wiki
Advertisement

A LaTeX environment is one of the following:

Float environments[]

Text inside a float environment is "floated" according to its placement, an optional parameter. The standard report and article classes use the default placement [tbp]. The float environments are figure and table.

Figure environment[]

\begin{figure}[placement]
  % body of the figure
  \caption{figure title}
\end{figure}

Placement is one of the following

h (Here) - at the position in the text where the table environment appears.
t (Top) - at the top of a text page.
b (Bottom) - at the bottom of a text page.
p (Page) of floats - on a separate float page, which is a page containing no text, only floats.

Table environment[]

The table environment has the same characteristics as the figure environment.[improvement needed: elaborate]

List environments[]

The list environments are description, enumerate, itemize, and the generic list, which is seldom used in text, but often in macros. Within a list environment item commands are used to identify the items in the list.

description environment[]

The description environment produces a labeled list.

\begin{description}
\item [label] First item
\item [label] Second item

...

\end{description}

enumerate environment[]

The enumerate environment produces a numbered list. At least one item is needed. Enumerate lists can be nested inside other enumerate lists, up to four levels deep.

\begin{enumerate}
\item First item
\item Second item

...

\end{enumerate}

itemize environment[]

The itemize environment creates an unnumbered, or "bulleted" list.

\begin{itemize}
\item First item
\item Second item

...

\end{itemize}

list environment[]

\begin{list}{label}{fmt-params}
\item First item
\item Second item

...

\end{list}

label
specifies how items should be labeled. This argument is a piece of text that is inserted in a box to form the label. This argument can and usually does contain other LaTeX commands.
fmt-params
contains commands to change the spacing parameters for the list. An empty argument will select all default spacing which should suffice for most cases.
The format parameters are: (See external reference for a diagram of these)

\itemsep
\labelsep
\labelwidth
\leftmargin
\listparindent
\parsep
\parskip
\partopsep
\rightmargin
\topsep

Math environments[]

The math environments are math, displaymath, array, eqnarray, equation, and theorem

math environment[]

The math environment is used within paragraph mode to place mathematical symbols inline with the paragraph's text. The following are all equivalent:

\( … \)
$ … $
\begin{math}…\end{math}

In a wiki, the <math> ... </math> tags create a math environment.

displaymath environment[]

The following are equivalent:

\[ … \]
$$ … $$
\begin{displaymath}…\end{displaymath}

Note: The AMS Short Math Guide recommends against using $$ ... $$ to enter displaymath mode, because it is not documented in the TeX manual, and because it interferes with the proper operation of the fleqn option.

array environment[]

Main article: array (LaTeX environment)

The array environment is used to make a table of information, with column alignment (left, center, or right) and optional vertical lines separating the columns.

\begin{array}{col1col2…coln}
item11 & item12 … & item1n\\
item21 & item22 … & item2n\\

...

itemn1 & itemn2 … & itemnn\\
\end{array}

Each of col1, col2, etc. is a single letter,

c - for centred
l - for flush left
r - for flush right
The column format letters can be interspersed with vertical bars (|), which result in rendering vertical bars as needed in the formatted matrix.

If a horizontal line is needed in the matrix, \hline can be used.

Within the matrix itself, columns are separated by an &, and each row ends with a double backslash, \\.

eqnarray environment[]

\begin{eqnarray}
math formula 1
math formula 2

...

\end{eqnarray}

The eqnarray environment is

An equation number is placed on every line unless that line has a \nonumber command. The command \lefteqn is used for splitting long formulas across lines. It typesets its argument in display style flush left in a box of zero width.

equation environment[]

The equation environment centers the equation, and places an equation number in the right margin.

\begin{equation}
... math formula
\end{equation}

An asterisk is used for unnumbered equations:

\begin{equation*}
... math formula
\end{equation*}

An equation can be given a label using the \label command, which can later be referenced using the \eqref command.

\begin{equation}\label{xyz}
... math formula
\end{equation}

Later, the equation can be referenced, as an example, by
... using equation \eqref{xyz}, one can derive the following...
\eqref{xyz} generates a parenthesized equation number; it is equivalent to (\ref{xyz}). The preamble command, \numberwithin{equation}{section} can be used to number equations with the two-level name m.n (section number.equation number).

The subequations environment affixes letters a, b, c... to the end of the equation number within the environment.

\begin{equation}\label{first}
x=y+z
\end{equation}
some intervening text
\begin{subequations}\label{grp}
\begin{align}
a&=b+c\label{second}\\
d&=e+f+g\label{third}\\
h&=i+j\label{fourth}
\end{align}
\end{subequations}

numbers equation x=y+z as, for example, 2.9, then the group a=b+c, d=e+f+g, and h=i+j will be numbered, respectively, 2.10a, 2.10b, and 2.10c. The "parent" equation number, 2.10, is assigned to the label "grp".

The multiline environment lets you split equations over multiple lines, aligning the beginning of the equation with the left margin, and the end of it with the right margin. Equations are numbered.

\begin{multline}
a+b+c+d+e+f\\
+i+j+k+l+m+n
\end{multline}

The gather environment gathers and centers equations; each equation is numbered; not available in wiki.

\begin{gather} a_1=b_1+c_1\\
a_2=b_2+c_2-d_2+e_2
\end{gather}

The align environment lets you use the ampersand (&) to align multiple equations; each equation is numbered; not available in wiki.

\begin{align}
a_{11}& =b_{11}&
a_{12}& =b_{12}\\
a_{21}& =b_{21}&
a_{22}& =b_{22}+c_{22} \end{align}

The flalign environment lets you use the ampersand (&) to align multiple equations. The leftmost and rightmost columns are aligned with the margins.

\begin{flalign*}
a_{11}& =b_{11}&
a_{12}& =b_{12}\\
a_{21}& =b_{21}&
a_{22}& =b_{22}+c_{22} \end{flalign*}

theorem environment[]

The theorem environment produces "Therem x" in bold face, followed by your theorem text. [improvement needed: elaborate - how is theorem name specified?]

\begin{theorem}
... theorem text
\end{theorem}

Matrix environments[]

Main article: matrix (LaTeX environment)

The matrix environments are matrix, pmatrix, bmatrix, Bmatrix, vmatrix, Vmatrix, and smallmatrix. Each provides a table for expressions, aligned in rows and columns. The main difference between the various types of matrix is the kind of delimeters that surround them.

Each row of a matrix ends with two backslashes (\\). Each column ends with an ampersand (&).

Cases environment[]

The cases environment is used to left-brace a group of equations or a piecewise-defined function, for example,

LaTeX markup... ...results in: ...is used for:
f(n) = \begin{cases} n/2 &\mbox{if } n \equiv 0 \\
(3n +1)/2 & \mbox{if } n \equiv 1. \end{cases} \pmod{2}
function defined piecewise

align and alignat environments[]

The align environment can be used to align equations.

LaTeX markup... ...results in: ...is used for:
\begin{align}
f(x) & = (a+b)^2 \\
& = a^2+2ab+b^2
\end{align}
aligning a series of equations

The alignat environment can be used to align equations, and explicitly specify the number of "equation" columns. An equation column has two parts, separated by the equals-sign. Essentially, this is an array with alternating right-aligned and left-aligned columns. The required parameter of alignat is the maximum number of ampersands in a row plus 1, and then divided by 2. One use of alignat is to explicitly specify the amount of horizontal space between columns by including the required spacing in the first row.

LaTeX markup... ...results in: ...is used for:
\begin{alignat}{2}
r&l\quad\quad\quad&r&l\\
a& =b &\quad\quad c& =d\\
aaa& =bbb& ccc& =ddd
\end{alignat}
aligning a series of equations, specifying the number of right-left pairs

For some reason, in the wikia wiki, the "align" and "alignat" environments cause errors.

[improvement needed: elaborate]

Paragraph environments[]

The paragraph environments are center, flushleft, flushright, minipage, quotation, quote, verbatim, and verse. Within a paragraph environment, each line must be terminated with a double backslash, \\.

Related commands are centering, raggedright, raggedleft, parbox, footnote, footnotetext, and verb

center environment[]

The center environment allows you to create a paragraph consisting of lines that are centered within the left and right margins on the current page.

flushleft environment[]

The flushleft environment allows you to create a paragraph consisting of lines that are flushed left, to the left-hand margin.

flushright environment[]

The flushright environment allows you to create a paragraph consisting of lines that are flushed right, to the right-hand margin.

minipage environment[]

The minipage environment is similar to the \parbox command. It is not advisable to nest minipage environments, because it messes up footnote positioning.

\begin{minipage}[position]{width}
... text
\end{minipage}

quotation environment[]

The margins of the quotation environment are indented on the left and the right. The text is justified at both margins and there is paragraph indentation.

quote environment[]

The margins of the quotation environment are indented on the left and the right. The text is justified at both margins without paragraph indentation

verbatim environment[]

Uses typewriter (\tt) style, similar to the \verb command.

verse environment[]

The verse environment is designed for poetry. The margins are indented on the left and the right. End each lines with \\, and use a blank line to separate the stanzas.

Picture environment[]

\begin{picture}(width,height)(x offset,y offset)

... picture commands

\end{picture}

picture commands are
\circle
\dashbox
\frame
\framebox
\line
\linethickness
\makebox
\multiput
\oval
\put
\shortstack
\vector

[improvement needed: elaborate]

Table environments[]

tabbing environment[]

In the tabbing environment,

  • Tab stops are set with \=.
  • \> advances to the next tab stop.
  • \+ ends a line, and begins the next line one tab stop to the right.
  • \- ends a line, and begins the next line one tab stop to the left.

[improvement needed: elaborate]

\begin{tabbing} function \= fact(n : integer) : integer;

\> begin \= \+
\> if \= n $>$ 1 then \+
fact := n * fact(n-1) \-
else \+
fact := 1; \-\-
end;

\end{tabbing}

[improvement needed: formatting]

Related commands are

\=
\>
\+
\-
\A
\'
\`
\kill
\pushtabs
\poptabs
\cline
\hline
\multicolumn
\vline

tabular environment[]

The tabular environment uses ampersands (&) to separate columns.

\begin{tabular}[pos]{cols}
column 1 entry & column 2 entry … & column n entry

...

\end{tabular}

or

\begin{tabular*}{width}[pos]{cols}
column 1 entry & column 2 entry … & column n entry

...

\end{tabular*}

[improvement needed: elaborate]

Other environments[]

Thebibliography environment[]

The thebibliography environment is used to print a bibliography. Related commands are bibitem, cite, nocite

\begin{thebibliography}{widest-label}
\bibitem[label]{cite_key}

...

\end{thebibliography}

Titlepage environment[]

The titlepage environment is used to print a title page. It has no printed page number or page heading. The following page is numbered page 1. A related commands is maketitle.

\begin{titlepage}

... title page text

\end{titlepage}

External references[]

Advertisement