LaTeX Environments

The following list of LaTeX environments are only the ones used in the creation of the sample file number.tex. Of course there are many other environments that one can learn and I recommend G. Gratzer's books for this based on their depth and readability.



\begin{align}...\end{align}:
The generic align environment looks like this:

\begin{align}
& = { } \label{ } \\
& = { } \label{ } \\
& = { } \notag
\end{align}

Notes:
  1. the align environment is in math mode by default
  2. & determine position of alignment
  3. end each line (except the last) with \\
  4. each equation is automatically numbered unless you include the \notag command just before the end-of-line command \\
  5. there are several variants to the align environment
  6. You can cross-reference the equations of align if you have created a label using \label{equation1} and then referncing it with \ref{equation1}


As an example, suppose the desired output is:

Cut and past the "generic align environment" above into you editor and simply insert the necessary mathematics. In this case, we type:

\begin{align}
zw &= (3+2i)(2-i) \notag \\
&= 6-3i+4i-2i^2 \notag \\
&= 8+i \notag
\end{align}





\begin{tabular}...\end{tabular}:
The generic tabular environment looks like this:

\begin{tabular}{|c||c|c|} \hline
{ } & { } & { } \\ \hline \hline
{ } & { } & { } \\ \hline
{ } & { } & { } \\ \hline
\end{tabular}


Notes:
  1. & separates the columns of the table
  2. each line of the table ends with \\
  3. end each line (except the last) with \\
  4. if you want a horizontal line to separate one row from another then use the command \hline at the end of the row
  5. the argument of the command \begin{tabular}{...} specifies: (i) number of columns in the table; (ii) whether the data is to be left justified (l), right justified (r) or centered (c); and (iii) you may put a vertcal bar, |, between the l-r-c justifiers to put a vertical line to separate the columns of the table.
  6. there is a command multicolumn that allows you to build more sophisticated tables where the horizontal and vertical lines don't go the entire length of the table.
  7. Notice in the above table we put two \hline commands after the first row and two vertical bars after the first c in the argument of command \begin{tabular}. This is to separate the labels in the first row and column from the actual table entries.
  8. To label your table with a caption, you need to use insert the tabular environment inside a table environment
  9. In addition to "tabular" LaTeX is another table building environment called "tabbing"


As an example, suppose the desired output is:

Cut and past the "generic tabular environment" above into you editor and simply insert the necessary mathematics. In this case, we type:

\begin{tabular}{|c||c|c|} \hline
{} & \textit{orient. preserving} & \textit{orient. reversing}
\\ \hline \hline
\textit{fixed points} & rotation & reflection \\ \hline
\textit{no fixed points} & translation & glide reflection \\ \hline
\end{tabular}




\begin{cases}...\end{cases}:
The generic cases environment looks like this:

\begin{equation}\label{ }
f(x)=
\begin{cases}
{ }, & \text{if $...$} \\
{ }, & \text{if $...$} \\
{ }, & \text{if $...$}
\end{cases}
\end{equation}

Notes:
  1. the cases environment is not in math mode by default so in order to display the equation we enclose it between
    1. \[...\] or
    2. $$...$$ or
    3. \begin{equation}...\end{equation}.
    If you want to label and cross-reference it you need to use the latter of these three.
  2. & the "name" of the function, f(x) above, goes outside the cases environment
  3. end each line (except the last) with \\
  4. \\
  5. & determines the position of alignment
  6. the commas need to be typed in - they are not included by default


As an example, suppose the desired output is:

Cut and past the "generic cases environment" above into you editor and simply insert the necessary mathematics. In this case, we type:

\[
f(x)=
\begin{cases}
x^2-c, & \text{if $x \le 3$} \\
x^2+c, & \text{if $3 < x \le 5$} \\
x^2-c, & \text{otherwise} \\
\end{cases}
\]




\begin{enumerate}...\end{enumerate}:
The generic enumerate environment looks like this:

\begin{enumerate}
\item
{ } \label{...}
\item
{ } \label{...}
\item
{ } \label{...}
\end{enumerate}


Notes:
  1. Begin each new item that you want numbered with the \item command but don't end it with \\
  2. individual items can be labeled and cross-referenced in the usual manner with the \label and \ref commands.
  3. There are two variant of the enumerate environment
    1. The "itemize" environment works exactly the same way except it does not number the items, but rather it produces a "bulleted" list.
    2. The "description" environment also works the same way except that the \item command now has an argument: \item{...} and whatever caption you put in the argument appears in bold print at the beginning of the item instead of a number or bullet.
  4. enumerate, itemize and description can be nested and can also be put inside a theorem-like structure such as a Theorem, Definition, etc.


    As an example, suppose the desired output is:

    Cut and past the "generic enumerate environment" above into you editor and simply insert the necessary mathematics. In this case, we type:

    A \textit{critical number} of a function $f$ is a number $x=c$ satisfying:

    \begin{enumerate}
    \item
    $c \in \text{dom}(f)$ \,and
    \item
    $f'(c) =0$ \, or
    \item
    $f'(c)$ \, does not exist
    \end{enumerate}




    \begin{CD}...\end{CD}:
    The generic CD environment looks like this:

    \[
    \begin{CD}\label{...}
    {top_left_corner} @> {top_label} >> {top_right_corner} \\
    @ V{left_label} VV @ VV {right_label} V \\
    {bottom_left_corner} @>> {bottom_label} > {bottom_right_corner} \\
    \end{CD}
    \]


    Notes:
    1. In order to use this environment you need to have the amscd package loaded which is done with the \usepackage{amscd} command that goes in the preamble.
    2. The environment is eclosed in
      \begin{CD} and \end{CD}
    3. end each row (except the last) with \\
    4. "vertices of the diagram are refered to as "corners" above.
    5. a horizontal row arrow is produced with (i) @>>> or (ii) @> {...} >> or (iii) @>> {...} > depending on whether you want no label, a label above the arrow or below the arrow respectively.
    6. a vertical row arrow is produced with (i) @VVV or (ii) @V {...} VV or (iii) @VV {...} V depending on whether you want no label, a label to the left of the arrow or to the right of the arrow respectively.
    7. Sometimes a commutative diagram is triangular in which case we typeset a square diagram and use @= to indicate equality.
    8. Commutative diagrams do not have to have the same number of row as columns but they are on a rectangular grid.
    9. There are more complicated programs available for more sophisticated diagrams.
    10. If you include a label then you can cross-reference your diagram with the \label and \ref commands.


    As an example, suppose the desired output is:

    Cut and past the "generic commutative diagram environment" above into you editor and simply insert the necessary mathematics. In this case, we type:

    \[
    \begin{CD}
    {G} @> {f} >> {H} \\
    @ V{\phi} VV @ VV {\psi} V \\
    {X} @>> {T} > {Y} \\
    \end{CD}
    \]



    \begin{figure}...\end{figure}:
    The generic figure environment looks like this:

    \begin{figure}[h]
    \begin{center}
    \scalebox{...}{\includegraphics{***.eps}}
    \caption{...}\label{...}
    \end{center}
    \end{figure}


    Notes:
    1. In order to use this environment you need to have the graphics package loaded which is done with the \usepackage{graphics} command that goes in the preamble.
    2. The environment is eclosed in \begin{figure} and \end{figure}
    3. The argument to \figure[...] has various options:
      1. [b] stands for bottom of page
      2. [t] stands for top of page
      3. [h] stands for here
      4. [p] stands for separate page
      5. [!ht] stands for here or at the top no matter how it disobeys the rules

    4. The argument to scalebox is a number between 0 and 1, 0.5 for example scaling the figure 50%.
    5. The graphics object must be in the same directory or folder as the source file and the admissible graphics types depends on your printer. eps files work well with LaTeX.
    6. The caption appears below the figure, the figure is automatically numberes and if you use the \listoffigures command all this information appears in the table listing all the figures in your document.
    7. The label must be put at the end of the caption and the figure may be cross-referenced in the usual way with the \label and \ref commands..
    8. Commutative diagrams do not have to have the same number of row as columns but they are on a rectangular grid.
    9. There are more complicated programs available for more sophisticated diagrams.


    As an example, suppose the desired output is the graph of a quartic polynomial that you have generated with a computer algebra system:

    Cut and past the "generic figure environment" above into your editor and simply insert the necessary code in the braces. In this case, we type:

    \begin{figure}[h]
    \begin{center}
    \scalebox{0.80}{\includegraphics{quartic.eps}}
    \caption{Quartic polynomial with }\label{quartic}
    \end{center}
    \end{figure}




    \begin{table}...\end{table}:

    \begin{table}[h]
    \begin{center}
    Use the tabular environments and put your table here.
    \caption{...}\label{...}
    \end{center}
    \end{table}



    \begin{Thm}...\end{Thm}:
    1. Your preamble should include the amsthm package and both the theoremstyle command and \theoremstyle command commands.
    2. Typeset your theorems, propositions, lemmas, corollaries, definitions, remarks inside the appropriate environment \begin{Thm}...\end{Thm} or \begin{Def}...\end{Def} and the formating and style will be determined by the theoremstyle command.
    3. You can label and cross-reference the theorem-like structure in the usual way with the \label and \ref commands.



    \begin{equation}...\end{equation}:
    LaTeX knows that it is typesetting math if it sees $...$. If you want to "display" math, centered on a separate line, then you include the code between double dollar signs $$...$$. As an alternative to $$...$$ and more in the spirit of LaTeX, one can use \[...\]. There is a third a final way to display a math. However, this last method allows you to label your equation and cross-reference it with the \label and \ref commands. Thus the generic equation environment looks like:

    \begin{equation}\label{...} *** \end{equation}



    \begin{center}...\end{center}:
    This is a straightforward environment that simply centers whatever you put inside it. Variant of this environment are \begin{flushleft}...\end{flushleft} and \begin{flushright}...\end{flushright}


    \begin{proof}...\end{proof}:
    Provided you are using the amsthm package , after you have stated the theorem, proposition, Lemma, etc in a \begin{Thm}...\end{Thm} environment, then you can include the proof inside the environment \begin{proof}...\end{proof}. This will determine the spacing before and after the proof, provide the word proof in italics and include the end of proof symbol at the end of the last line.


    \begin{abstract}...\end{abstract}:
    In the topmatter of your article just after the date you can type the abstract to your document in this environment and it both indents and chooses a smaller font to typeset the abstract.


    \begin{document}...\end{document}:
    The body of your document is contained between these commands. The only commands that appears before them are those in the preamble such as documentclass , newtheorem , usepackage and your macros via newcommand .


    \begin{quote}...\end{quote}:
    If your document contains a quote you can include it in this environment and it will be properly indented and can be cross-referenced with the \label and \ref commands