%%
%% This is file `Mathmode.tex',
%%
%% IMPORTANT NOTICE:
%%
%% Herbert Voss <voss@pstricks.de>
%% 2005-06-30
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%%
%% DESCRIPTION:
%%   `Mathmode' is a document how the math mode works inside LaTeX
%%
\def\MathmodeVersion{2.09}
\ifvtex\title{\logo Math mode - v.\MathmodeVersion}\else
  \ifpdf\title{Math mode - v.\MathmodeVersion}\else
    \title{\logo Math mode - v.\MathmodeVersion}\fi\fi
%
\author{Herbert Vo\ss\footnote{\sloppy Thanks for the feedback to:
  Hendri Adriaens;
  Alexander Boronka; Christian Faulhammer; Jos\'e{} Luis G\'omez Dans;
  Azzam Hassam; Martin Hensel; 
  Morten H\o{}gholm; M. Kalidoss; Dan Lasley; 
  Angus Leeming; Tim Love;
  Hendrik Maryns; Heinz Mezera;
  David Neuway;
  Joachim Punter;
  Carl Riehm; Will Robertson; Christoph Rumsm\"uller;
  Jos\'e{} Carlos Santos;  Jens Schwaiger; Uwe Siart; Martin Sievers; Heiko Stamer; Uwe St\"ohr;
  Carsten Thiel;
  David Weenink;
  Zou Yuan-Chuan;
  Michael Zedler;
  and last but not least a special thanks to Monika Hattenbach for her 
  excellent job of proofreading.
}}
\date{\today}

\maketitle

\begin{abstract}
More than once people say that \TeX{} was designed for mathematical or technical purpose.
This maybe true when we remember the reasons why Donald Knuth created \TeX{}. But nowadays 
there are a lot
of examples where \TeX{} was used for publications without any mathematical or technical background.
Nevertheless, we have to consider, that writing publications with a lot of mathematical
material is one of the important advantages of \TeX{} and it seems that is impossible to
know all existing macros and options of \AllTeX{} and the several additional packages,
especially \AmSmath. This is the reason why I tried to collect all important
facts in this paper.

\vspace{3cm}
\noindent Please report typos or any other comments to this documentation to
\href{mailto:voss@perce.de}{voss@perce.de}.
\noindent This document was written with the \LaTeX{} editor \verb+Kile 1.8+ \verb+(Qt 3.3+ \verb+KDE 3.4)+  
\href{http://sourceforge.net/projects/kile/}{http://sourceforge.net/projects/kile/} and the PDF output
was built with the Linux version of \texttt{V\TeX/Free}, Version 8.46 
(\href{http://www.micropress-inc.com/linux/}{http://www.micropress-inc.com/linux/})

This file can be redistributed and/or modified under the terms
of the LaTeX Project Public License Distributed from \verb+CTAN+ archives
in directory \url{CTAN://macros/latex/base/lppl.txt}.

\end{abstract}


\clearpage
\tableofcontents{}

\part{Standard \protect\LaTeX{} math mode}

\section{Introduction}
The following sections describe all the math commands which are available
without any additional package. Most of them also work with special
packages and some of them are redefined. At first some important facts for typesetting math expressions.

\section{The Inlinemode}\label{sec:The-Inlinemode}
As the name says this are always math expressions which are in a standard
textline, like this one: $f(x)=\int_{a}^{b}\frac{\sin x}{x}dx$. There
are no limitations for the height of the math expressions, so that
the layout may be very lousy if you insert a big matrix in an inline mode
like this:
$\underline{A}=\left[\begin{array}{ccc}
a & b & c\\
d & e & f\\
g & h & i\end{array}\right]$. In this case it is better to use the \verb|\smallmatrix| environment
$\underline{A}=\left[\begin{smallmatrix}%
a & b & c\cr
d & e & f\cr
g & h & i\end{smallmatrix}\right]$ from the \AmSmath{} package (see section \vref{sec:ams-matrix}) or the
displaymath mode\index{Display math mode} (section \ref{display} on page \pageref{display}).

This inline mode is possible with three different commands:

\bigskip
\begin{minipage}{0.35\fullwidth}
\(\sum_{i=1}^{n}i=\frac{1}{2}n\cdot(n+1)\)\\[10pt]
$\sum_{i=1}^{n}i=\frac{1}{2}n\cdot(n+1)$\\[10pt]
\begin{math}
  \sum_{i=1}^{n}i=\frac{1}{2}n\cdot(n+1)
\end{math}
\end{minipage}\hfill
\begin{minipage}{0.62\fullwidth}
\begin{lstlisting}
\(\sum_{i=1}^{n}i=\frac{1}{2}n\cdot(n+1)\)\\[10pt]
$\sum_{i=1}^{n}i=\frac{1}{2}n\cdot(n+1)$\\[10pt]
\begin{math}
  \sum_{i=1}^{n}i=\frac{1}{2}n\cdot(n+1)
\end{math}
\end{lstlisting}
\end{minipage}

\begin{enumerate}
\item \CMD{( ... }\CMD{)}     \marginpar{\CMD{(}...\CMD{)}}, the problem is that \verb+\(+ is 
not a robust macro (see section~\vref{subsec:mathInTitles}).
\item \verb+$ ... $+   \marginpar{\$...\$}
\item \CMD{begin\{math\}} ... \CMD{end\{math\}}, also not robust%
\marginpar{\CMD{begin\{math\}}\\...\\\CMD{end\{math\}}}
\end{enumerate}

In general \verb+$...$+ is the best choice, but this does not work in environments like \verb+verbatim+
or \verb+alltt+. In this case \verb+\(...\)+ works.


\subsection{Limits}\label{sub:Limits-Inline}

In the inline mode the limits\index{limits@\textbackslash limits} are by default only in
super\index{Superscript} or subscript mode\index{Subscript} and
the fractions\index{Fraction} are always in the scriptstyle\footnote{See section \vref{sec:Styles}.}\index{scriptstyle} 
font size. For
example: $\int_{1}^{\infty}\frac{1}{x^2}dx=1$, which is not too
big for the textline. You %
\marginpar{\CMD{limits}}can change this with the command \CMD{limits},
which must follow a math operator\footnote{To define a new operator see
page~\pageref{OperatorNames}}\index{Math operator} like %
\marginpar{\CMD{int}\\\CMD{lim}\\\CMD{prod}\\\CMD{sum}}
 an integral (\CMD{int}\index{int@\textbackslash int}), a sum (\CMD{sum}\index{sum@\textbackslash sum}),
a product (\CMD{prod}\index{prod@\textbackslash prod}) or a limes
(\CMD{lim}\index{lim@\textbackslash lim}). But this $\int\limits_{1}^{\infty}\frac{1}{x^2}dx=1$ 
does not look very nice in a text line when it appears between two lines,
especially when there are multiline limits.\footnote{For more
information about limits see section \vref{sub:Multiple-Limits} or section \vref{sec:limit-AMS}.}


\subsection{Fraction command}\label{sub:fraction command}

For inlined formulas the fractions\index{Fraction} are by default
in the scriptstyle\index{scriptstyle@\textbackslash scriptstyle} (see tabular \vref{cap:Mathstyles}),
which is good for typesetting $y=\frac{a}{b+1}$, because the
linespacing %
\marginpar{\CMD{frac}}is nearly the same, but not optimal, when the formula shows some important
facts. There are two solutions to get a better reading:

\begin{enumerate}
\item choose the display mode instead of the inline mode, which is the better
one;
\item set the fontstyle to \verb+displaystyle+\index{displaystyle@\textbackslash displaystyle}, which makes
the fraction $y={\displaystyle\frac{a}{b+1}}$ more readable but
the linespacing increases which is always a bad solution and should
only be used when the first solution makes no sense.\footnote{For an abbreviation see
section \vref{sec:ams-fraction}, there is a special \CMD{dfrac} macro.}

\bigskip
\begin{minipage}{0.25\fullwidth}
$y=\frac{a}{b+1}={\displaystyle\frac{a}{b+1}}$
\end{minipage}\hfill
\begin{minipage}{0.72\fullwidth}
\begin{lstlisting}
$y=\frac{a}{b+1}={\displaystyle\frac{a}{b+1}}$
\end{lstlisting}
\end{minipage}
\end{enumerate}


\subsection[Math in Chapter/Section Titles]{\label{inline-chapter}Math in \CMD{part},
\CMD{chapter}, \CMD{section},
... titles like $f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)$}\label{subsec:mathInTitles}

All commands which appear in positions like contents, index, header,
... must be robust\footnote{%
\texttt{robust} means that the macro is not expanded before it is moved
into for example the tableofcontents file (\texttt{*.toc}).  No robustness is 
often a problem, when a macro is part of another macro.}
which is the case for \verb+$...$+ but not for \verb+\(\...\)+.
If you do not have any contents, index, a.s.o.
you can write the mathstuff in \CMD{chapter}\index{chapter@\textbackslash chapter},
\CMD{section}\index{section@\textbackslash section},
a.s.o without any restriction. Otherwise use \verb+\protect\(+ and \verb+\protect\)+ or the
\verb+$...$+ version.

The whole math expression appears in the default font shape and not
in bold like the other text. Section \vref{sec:titleItem}  describes how the math
expressions can be printed also in bold.

\marginpar{\CMD{texorpdfstring}}%
There are problems with \verb+hyperref+\index{hyperref.sty} when there is a non
text part in a title. It is possible to tell \verb+hyperref+\index{hyperref.sty} to use different
commands, one for the title and another one for the bookmarks\index{texorpdfstring@\textbackslash texorpdfstring}:

\begin{verbatim}
\texorpdfstring{<TeX part>}{<hyperref part>}
\end{verbatim}

E.g. 

\begin{minipage}{\fullwidth}
\begin{lstlisting}
\texorpdfstring{$\int f(x)\,dx$}{Integral function}
\end{lstlisting}
\end{minipage}



\subsection{Equation numbering}

It is obvious that the numbering of inline mathstuff makes no sense!

\subsection{Framed math}
With the \verb|\fbox| macro everything of inline math can be framed\index{Framed inline
math}\index{boxed inline math}, like the following one: 

\bigskip
\begin{minipage}{0.325\fullwidth}
\fbox{$f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)$}
\end{minipage}\hfill
\begin{minipage}{0.67\fullwidth}
\begin{lstlisting}
\fbox{$f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)$}
\end{lstlisting}
\end{minipage}


Parameters are the width of \verb|\fboxsep| and \verb|\fboxrule|, the predefined values
from \verb|latex.ltx| are:

\bigskip
\begin{minipage}{\fullwidth}
\begin{lstlisting}
\fboxsep = 3pt
\fboxrule = .4pt
\end{lstlisting}
\end{minipage}

The same is possible with the \verb|\colorbox|
\colorbox{yellow}{$f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)$}
from the color package.

\bigskip
\begin{minipage}{\fullwidth}
\begin{lstlisting}
\colorbox{yellow}{$f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)$}
\end{lstlisting}
\end{minipage}



\subsection{Linebreak}

\LaTeX{} can break an inline formula only when a relation symbol ($=, <, >, \ldots$) or a
binary operation symbol ($+,-, \ldots$) exists and at least one of these symbols appears at
the outer level of a formula.
Thus \verb|$a+b+c$| can be broken across lines, but \verb|${a+b+c}$| not.

\begin{itemize}
\item The default: \hspace{1cm}
$f(x)=a_nx^n+a_{n-1}x^{n-1}+a_{n-2}x^{n-2}+\ldots
	+a_ix^i	+a_2x^2	+a_1x^1	+a_0$
\item The same inside a group \{...\}:
${f(x)=a_nx^n+a_{n-1}x^{n-1}+a_{n-2}x^{n-2}+\ldots
	+a_ix^i	+a_2x^2	+a_1x^1	+a_0}$

\item Without any symbol: \hspace{4cm}
$f(x)=a_n\left(a_{n-1}\left(a_{n-2}\left(\ldots\right)\ldots\right)\ldots\right)$
\end{itemize}

If it is not possible to have any mathsymbol, then split the inline formula in two
or more pieces (\verb|$...$ $...$|). If you do not want a linebreak for the whole
document, you can set in the preamble:
\begin{verbatim}
\relpenalty=9999
\binoppenalty=9999
\end{verbatim}

\noindent
which is the extreme case of grudgingly allowing breaks in extreme cases.


\subsection{Whitespace}\label{subsec:whitespace}
\LaTeX{} defines the length \verb|\mathsurround|\index{mathsurround@\textbackslash mathsurround} with the default value of
\verb|0pt|. This length is added before and after an inlined math expression (see table \vref{tab:whitespace}).

\begin{table}[htb]
\hspace*{-0.1\linewidth}%
\begin{tabular}{@{}cc@{}}
foo \fbox{$ f(x)=\int_1^{\infty}\frac{1}{x^2}dx=1 $} bar & 
\begin{minipage}{0.7\linewidth}
\begin{lstlisting}
foo \fbox{$ f(x)=\int_1^{\infty}\frac{1}{x^2}dx=1 $} bar
\end{lstlisting}
\end{minipage}\tabularnewline
%
foo \rule{20pt}{\ht\strutbox}\fbox{$ f(x)=\int_1^{\infty}\frac{1}{x^2}dx=1 $}\rule{20pt}{\ht\strutbox} bar & 
\begin{minipage}{0.7\linewidth}
\begin{lstlisting}
foo \rule{20pt}{\ht\strutbox}\fbox{$ f(x)=\int_1^{\infty}\frac{1}{x^2}dx=1 $}\rule{20pt}{\ht\strutbox} bar
\end{lstlisting}
\end{minipage}\tabularnewline
\setlength{\mathsurround}{20pt}foo \fbox{$ f(x)=\int_1^{\infty}\frac{1}{x^2}dx=1 $} bar & 
\begin{minipage}{0.7\linewidth}
\begin{lstlisting}
\setlength{\mathsurround}{20pt}
foo \fbox{$ f(x)=\int_1^{\infty}\frac{1}{x^2}dx=1 $} bar
\end{lstlisting}
\end{minipage}
\end{tabular}
%
\caption{Meaning of \CMD{mathsurround}}\label{tab:whitespace}
\end{table}


\subsection{\AmSmath for the inline mode}

None of the \AmSmath-functions are available in inline mode.

\section{Displaymath mode}\label{display}
This means, that every formula gets its own paragraph (line). There are
some differences in the layout to the one from the title
of \ref{inline-chapter}.


\subsection{\texttt{equation} environment}

For example:

\bigskip\noindent
\begin{tabular}{cc}
\begin{minipage}{0.35\linewidth}
\begin{equation}
  f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)
\end{equation}
\end{minipage} & 
\begin{minipage}{0.63\linewidth}
\begin{lstlisting}
\begin{equation}
  f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)
\end{equation}
\end{lstlisting}
\end{minipage}
\end{tabular}

\bigskip
The delimiters\index{Delimiter}
\CMD{begin\{equation\} ... }\CMD{end\{equation\}} are the only difference to the inline version. There
are some equivalent commands for the display-math mode:

\begin{enumerate}
\marginpar{\CMD{begin\{displaymath\}}\\
\ldots\\
\CMD{end\{displaymath\}}}%
\item \CMD{begin\{displaymath\}}\ldots\CMD{end\{displaymath\}}, same as
\CMD{[} \ldots \CMD{]}
%
\item \CMD{[\ldots}\CMD{]}. (see above) the short form of a displayed formula, no number%
\marginpar{\texttt{\textbackslash[\ldots\textbackslash{}]}}
\[
f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)
\]
displayed, no number. Same as 1.
%
\item \CMD{begin\{equation\}\ldots}\CMD{end\{equation\}}%
\marginpar{\CMD{begin\{equation\}}\\
\ldots\\
\CMD{end\{equation\}}}%
%
\begin{equation}
f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)\end{equation}
\\
displayed, a sequential equation number, which may be reset when
starting a new chapter or section.


\begin{enumerate}
\item There is only \textbf{one} equation number for the whole environment.
\item \marginpar{\CMD{nonumber}}There exists no star-version of the equation environment
because \verb|\[...\]| is the equivalent. With the tag
\CMD{nonumber}\index{nonumber@\textbackslash nonumber} it is possible to suppress the equation number:

\begin{minipage}{0.5\linewidth}
\begin{equation}
  f(x)= [...] \nonumber
\end{equation}
\end{minipage}%
\begin{minipage}{0.6\linewidth}
\begin{lstlisting}
\begin{equation}
  f(x)= [...] \nonumber
\end{equation}
\end{lstlisting}
\end{minipage}
%
\end{enumerate}
\end{enumerate}


\subsection{\texttt{eqnarray} environment}\label{display:eqnarray}

This is by default an array with three columns and as many rows as
you like. \marginpar{\CMD{begin\{eqnarray\}}\\
...\\
\CMD{end\{eqnarray\}}} It is nearly the same as an array with a \verb|rcl|  column definition.

It is \textbf{not possible} to change the internal behaviour of the \verb|eqnarray| environment without
rewriting the environment.
It is always an impli\-cit array with \textbf{three} columns and the horizontal
alignment \verb|right-center-left (rcl)| and small \textbf{symbol} sizes for the
middle column. All this can not be changed by the user without rewriting
the whole environment in \verb|latex.ltx|.

\bigskip\noindent
\begin{tabular}{cc}
\begin{minipage}{0.35\linewidth}
\begin{eqnarray*}
\mathrm{left} & \mathrm{middle} & \mathrm{right}\\
\frac{1}{\sqrt{n}}= & \frac{\sqrt{n}}{n}= & \frac{n}{n\sqrt{n}}
\end{eqnarray*} 
\end{minipage} &
\begin{minipage}{0.63\linewidth}
\begin{lstlisting}
\begin{eqnarray*}
\mathrm{left} & \mathrm{middle} & \mathrm{right}\\
\frac{1}{\sqrt{n}}= & \frac{\sqrt{n}}{n}= & \frac{n}{n\sqrt{n}}
\end{eqnarray*}
\end{lstlisting}
\end{minipage}
\end{tabular}

\bigskip
The \verb|eqnarray| environment should not be used as an array. As seen in the above
example the typesetting is wrong for the middle column. The numbering of eqnarray
environments is always for every row, means,
that four lines get four different equation numbers (for the labels see section \ref{sec:Labels}):

\bigskip
\begin{minipage}{0.5\columnwidth}
\begin{eqnarray}
y & = & d\label{eq:2}\\
y & = & cx+d\\
y & = & bx^{2}+cx+d\\
y & = & ax^{3}+bx^{2}+cx+d\label{eq:5}
\end{eqnarray}
\end{minipage}\hfill
\begin{minipage}{0.43\columnwidth}
\begin{lstlisting}
\begin{eqnarray}
y & = & d\label{eq:2}\\
y & = & cx+d\\
y & = & bx^{2}+cx+d\\
y & = & ax^{3}+bx^{2}+cx+d\label{eq:5}
\end{eqnarray}
\end{lstlisting}
\end{minipage}


\medskip
Toggling numbering off/on for \textbf{all} rows is possible
with the starred version of eqnarray.

\medskip
\begin{minipage}{0.45\columnwidth}
\begin{eqnarray*}
y & = & d\label{eq:3}\\
y & = & cx+d\\
y & = & bx^{2}+cx+d\\
y & = & ax^{3}+bx^{2}+cx+d\label{eq:4}
\end{eqnarray*}
\end{minipage}
\begin{minipage}{0.53\columnwidth}
\begin{lstlisting}
\begin{eqnarray*}
y & = & d\label{eq:3}\\
y & = & cx+d\\
y & = & bx^{2}+cx+d\\
y & = & ax^{3}+bx^{2}+cx+d\label{eq:4}
\end{eqnarray*}
\end{lstlisting}
\end{minipage}

\medskip
Toggling off/on for \textbf{single} rows is possible with the above
mentioned \CMD{nonumber}\index{nonumber@\textbackslash nonumber} tag at the end of a row
(before the newline command).
For example:

\medskip
\begin{minipage}{0.45\columnwidth}
\begin{eqnarray}
	y & = & d\nonumber \\
	y & = & cx+d\nonumber \\
	y & = & bx^{2}+cx+d\nonumber \\
	y & = & ax^{3}+bx^{2}+cx+d
\end{eqnarray}
\end{minipage}
\begin{minipage}{0.53\columnwidth}
\begin{lstlisting}
\begin{eqnarray}
	y & = & d\nonumber \\
	y & = & cx+d\nonumber \\
	y & = & bx^{2}+cx+d\nonumber \\
	y & = & ax^{3}+bx^{2}+cx+d
\end{eqnarray}
\end{lstlisting}
\end{minipage}


\subsubsection{Short commands}\label{subsec:shortcommand}
It is possible to define short commands for the \verb|eqnarray| environment
\begin{lstlisting}
\makeatletter
\newcommand{\be}{%
  \begingroup
% \setlength{\arraycolsep}{2pt}
  \eqnarray%
  \@ifstar{\nonumber}{}%
}
\newcommand{\ee}{\endeqnarray\endgroup}
\makeatother
\end{lstlisting}

\makeatletter
\newcommand{\be}{%
    \begingroup
%    \setlength{\arraycolsep}{2pt}
    \eqnarray%
	\@ifstar{\nonumber}{}%
}
\newcommand{\ee}{\endeqnarray\endgroup}
\makeatother

Now you can write the whole equation as


\begin{showexample}[width=0.5\columnwidth,wide]
\be
  f(x) &=& \int\frac{\sin x}{x}dx
\ee
\end{showexample}

\medskip
\noindent or, if you do not want to have a numbered equation as

\begin{showexample}[width=0.5\columnwidth,wide]
\be*
  f(x) &=& \int\frac{\sin x}{x}dx
\ee
\end{showexample}


\subsection{Equation numbering}\label{sub:Equationnumbering}

For all equations which can have one or %
\marginpar{\CMD{nonumber}}more equation numbers (for every line/row) the numbering
for the whole equation can be disabled with switching from the unstarred to the star
version. This is still for the whole formula and doesn't work for single rows.
In this case use the \CMD{nonumber} tag.

\begin{itemize}
\item This doc is written with the article-class, which counts the equations
continuously over all parts/sections. You can change this behaviour
in different ways (see the following subsections).
\item In standard \LaTeX{} it is a problem with too long equations and the
equation number, which may be printed with the equation one upon the other. In this case
use the \AmSmath package, where the number is set above or below
of a too long equation (see equation \vref{eq:braces}).
\item For counting subequations see section \vref{ams:subeqn}.
\end{itemize}

\subsubsection{Changing the style}

\marginpar{\CMD{theequation}}%
With the beginning of Section \vref{sec:alignat environment} the
counting changes from ``\ref{eq:IntoSection}{}'' into the new style
``\ref{eq:newCounting}''. The command sequence is

\begin{lstlisting}
\renewcommand\theequation{%
  \thepart-\arabic{equation}%
}
\end{lstlisting}
See section \vref{sec:Equation-numbering} for the \AmSmath command.


\subsubsection{Resetting a counter style}

Removing a given reset is possible with the package \verb+remreset+.%
\footnote{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/supported/carlisle/remreset.sty}{CTAN://macros/latex/contrib/supported/carlisle/remreset.sty}} Write into the %
\marginpar{\CMD{@removefromreset}} preamble

\begin{lstlisting}
\makeatletter
\@removefromreset{equation}{section}
\makeatother
\end{lstlisting}
or anywhere in the text.

Now the equation counter is no longer reset when a new section starts.
You can see this after section~\vref{split}.


\subsubsection{Equation numbers on the left side}

Choose package \texttt{leqno}%
\footnote{\href{http://www.ctan.org/tex-archive/macros/latex/unpacked/leqno.sty}{CTAN://macros/latex/unpacked/leqno.sty}}
or have a look at your document class, if such an option exists.

\subsubsection{Changing the equation number style}
The number style can be changed with a redefinition of

\begin{verbatim}
\def\@eqnnum{{\normalfont \normalcolor (\theequation)}}
\end{verbatim}

For example: if you want the numbers not in parentheses write

\begin{lstlisting}
\makeatletter
\def\@eqnnum{{\normalfont \normalcolor \theequation}}
\makeatother
\end{lstlisting}

For \AmSmath there is another macro, see section~\ref{sec:Equation-numbering} on
page~\pageref{sec:Equation-numbering}.

\subsubsection{More than one equation counter}
You can have more than the default equation counter. With the following code you
can easily toggle between roman and arabic equation counting.
\makeatletter
%Roman counter
\newcounter{roem}
\renewcommand{\theroem}{\roman{roem}}

% save the original counter
\newcommand{\c@org@eq}{}
\let\c@org@eq\c@equation
\newcommand{\org@theeq}{}
\let\org@theeq\theequation

%\setroem sets roman counting
\newcommand{\setroem}{
  \let\c@equation\c@roem
  \let\theequation\theroem}

%\setarab the arabic counting
\newcommand{\setarab}{
  \let\c@equation\c@org@eq
  \let\theequation\org@theeq}
\makeatother

\begin{lstlisting}
%code by Heiko Oberdiek
\makeatletter
%Roman counter
\newcounter{roem}
\renewcommand{\theroem}{\roman{roem}}

% save the original counter
\newcommand{\c@org@eq}{}
\let\c@org@eq\c@equation
\newcommand{\org@theeq}{}
\let\org@theeq\theequation

%\setroem sets roman counting
\newcommand{\setroem}{
  \let\c@equation\c@roem
  \let\theequation\theroem}

%\setarab the arabic counting
\newcommand{\setarab}{
  \let\c@equation\c@org@eq
  \let\theequation\org@theeq}
\makeatother
\end{lstlisting}

The following examples show how it works:

\noindent
\begin{minipage}{1.2\linewidth}
\begin{minipage}{0.38\linewidth}
\begin{align}
f(x) &= \int\sin x dx\label{eq:arab1}\\
g(x) &= \int\frac{1}{x}dx
\end{align}
%
\setroem
%
\begin{align}
F(x) &=-\cos x\\
G(x) &=\ln x\label{eq:rom1}
\end{align}
%
\setarab
%
\begin{align}
f^{\prime} (x) &= \sin x\\
g^{\prime} (x) &= \frac{1}{x}\label{eq:arab2}
\end{align}
\end{minipage}\hfill
\begin{minipage}{0.58\linewidth}
\begin{lstlisting}
\begin{align}
f(x) &= \int\sin x dx\label{eq:arab1}\\
g(x) &= \int\frac{1}{x}dx
\end{align}
%
\setroem
%
\begin{align}
F(x) &=-\cos x\\
G(x) &=\ln x\label{eq:rom1}
\end{align}
%
\setarab
%
\begin{align}
f^{\prime} (x) &= \sin x\\
g^{\prime} (x) &= \frac{1}{x}\label{eq:arab2}
\end{align}
\end{lstlisting}
\end{minipage}
\end{minipage}

\medskip
There can be references to these equations in the usual way, like eq.\ref{eq:arab1},
\ref{eq:arab2} and for the roman one eq.\ref{eq:rom1}.


\subsection{Labels}\label{sec:Labels}

Every numbered equation can have a label\index{Label} to which a
reference\index{Reference} is possible.

\begin{itemize}
\item There is one restriction for the label names, they cannot include
one of \LaTeX{}'s command characters.\footnote{\$ \_ \^{} \textbackslash{} \& \% \{ \}}
\item The label names are replaced by the equation number.
\end{itemize}
%
\marginpar{\CMD{tag}}If you do not want a reference to the equation number but to a self
defined name then use the \AmS{}math command \CMD{tag{...}},
which is described in section \vref{sec:Labels-and-Tags}\index{tag@\textbackslash tag}.

\subsection{Frames}\label{sec:Frames}
Similiar to the inline mode, displayed equations can also be framed with
the \verb|\fbox|\index{fbox@\textbackslash fbox} command, like equation \ref{eq:frame0}.
The only difference is
the fact, that the equation must be packed into a parbox or minipage. It is
nearly the same for a colored box, where the \verb|\fbox{...}| has to be
replaced with \verb|\colorbox{yellow}{...}|. The package \verb|color.sty| must
be loaded and --important -- the \verb|calc.sty| package to get a correct boxwidth.

\noindent\fbox{\parbox{\linewidth-2\fboxsep-2\fboxrule}{%
\begin{equation}\label{eq:frame0}
f(x)=\int_1^{\infty}\dfrac{1}{x^2}dx=1
\end{equation}%
}}

\medskip
\begin{lstlisting}
\noindent\fbox{\parbox{\linewidth-2\fboxsep-2\fboxrule}{%
\begin{equation}\label{eq:frame0}
	f(x)=\int_1^{\infty}\dfrac{1}{x^2}dx=1
\end{equation}%
}}
\end{lstlisting}


If the equation number should not be part of the frame, then it is a bit
complicated. There is one tricky solution, which puts an unnumbered equation
just beside an empty numbered equation. The \verb|\hfill| is only useful for
placing the equation number right aligned, which is not the default. The
following four equations \ref{eq:frame2}-\ref{eq:frame5} are the same,
only the second one written with the \verb|\myMathBox| macro which has the
border and background color as optional arguments with the defaults
\verb|white| for background and \verb|black| for the frame. If there is only
one optional argument, then it is still the one for the frame color (\ref{eq:frame3}).

\makeatletter
\def\myMathBox{\@ifnextchar[{\my@MBoxi}{\my@MBoxi[black]}}
\def\my@MBoxi[#1]{\@ifnextchar[{\my@MBoxii[#1]}{\my@MBoxii[#1][white]}}
\def\my@MBoxii[#1][#2]#3#4{%
  \par\noindent%
  \fcolorbox{#1}{#2}{%
     \parbox{\linewidth-\labelwidth-2\fboxrule-2\fboxsep}{#3}%
  }%
  \parbox{\labelwidth}{%
    \begin{eqnarray}\label{#4}\end{eqnarray}%
  }%
  \par%
}
\makeatother

\begin{lstlisting}
\makeatletter
\def\myMathBox{\@ifnextchar[{\my@MBoxi}{\my@MBoxi[black]}}
\def\my@MBoxi[#1]{\@ifnextchar[{\my@MBoxii[#1]}{\my@MBoxii[#1][white]}}
\def\my@MBoxii[#1][#2]#3#4{%
  \par\noindent%
  \fcolorbox{#1}{#2}{%
     \parbox{\linewidth-\labelwidth-2\fboxrule-2\fboxsep}{#3}%
  }%
  \parbox{\labelwidth}{%
    \begin{eqnarray}\label{#4}\end{eqnarray}%
  }%
  \par%
}
\makeatother
\end{lstlisting}

\begin{equation}\label{eq:frame2}
	f(x)=x^2 +x
\end{equation}
\myMathBox[red]{\[f(x)=x^2 +x\]}{eq:frame3}
\myMathBox[red][yellow]{\[f(x)=x^2 +x\]}{eq:frame4}
\myMathBox{\[f(x)=x^2 +x\]}{eq:frame5}

\medskip
\begin{lstlisting}
\begin{equation}\label{eq:frame2}
	f(x)=x^2 +x
\end{equation}
\myMathBox[red]{\[f(x)=x^2 +x\]}{eq:frame3}
\myMathBox[red][yellow]{\[f(x)=x^2 +x\]}{eq:frame4}
\myMathBox{\[f(x)=x^2 +x\]}{eq:frame5}
\end{lstlisting}

If you are using the \AmSmath package, then try the solutions from section
\vref{sec:ams-frames}.

\section{\texttt{array} environment}
\marginpar{\CMD{begin\{array\}}\\...\\\CMD{end\{array\}}}
This is simply the same as the eqnarray environment only with the
possibility of variable rows \textbf{and} columns and the fact, that
the whole formula has only \textbf{one} equation number and that the
\verb|array| environment can only be part of another math environment,
like \verb|equation| or \verb|displaymath|.

\begin{equation}
\left.%
\begin{array}{r@{\quad}ccrr}
	\textrm{a}) & y & = & c & (constant)\\
	\textrm{b}) & y & = & cx+d & (linear)\\
	\textrm{c}) & y & = & bx^{2}+cx+d & (square)\\
	\textrm{d}) & y & = & ax^{3}+bx^{2}+cx+d & (cubic)
\end{array}%
\right\} 	\textrm{Polynomes}
\end{equation}


\begin{lstlisting}
\begin{equation}
\left.%
\begin{array}{r@{\\
\quad}ccrr}
	\textrm{a}) & y & = & c & (constant)\\
	\textrm{b}) & y & = & cx+d & (linear)\\
	\textrm{c}) & y & = & bx^{2}+cx+d & (square)\\
	\textrm{d}) & y & = & ax^{3}+bx^{2}+cx+d & (cubic)
\end{array}%
\right\} 	\textrm{Polynomes}
\end{equation}
\end{lstlisting}


The horizontal alignment of the columns is the same as the one from the
\texttt{tabular} environment.

For arrays with delimiters see section \vref{delarray}.

\subsection{Cases structure}

If you do not want to use the \AmSmath package then write your own
cases structure\index{cases@\textbackslash cases} with the \verb|array| environment:

\begin{showexample}[pos=b]
\begin{equation}
x=\left\{ \begin{array}{cl}
0 & \textrm{if A=...}\\
1 & \textrm{if B=...}\\
x & \textrm{this runs with as much text as you like, but without an raggeright text.}\end{array}\right.
\end{equation}
\end{showexample}


It is obvious, that we need a \CMD{parbox} if the text is longer than the possible linewidth.

\begin{showexample}[pos=b]
\begin{equation}
x = \left\{%
   \begin{array}{l>{\raggedright}p{.5\textwidth}}%
      0 & if A=...\tabularnewline
      1 & if B=...\tabularnewline
      x & \parbox{0.5\columnwidth}{this runs with as much text as you like, %
          because an automatic linebreak is given with %
          a raggedright text. Without this %
          \raggedright command, you'll get a formatted %
          text like the following one ... but with a parbox ... it works}
    \end{array}%
  \right. %
\end{equation}
\end{showexample}



\subsection{\texttt{arraycolsep}}\label{sec:arraycolsep}
\marginpar{\CMD{arraycolsep}}All the foregoing math environments use the array to typeset the math
expression. The predefined separation between two columns is the length
\verb|\arraycolsep|, which is set by nearly all document classes to \verb|5pt|,
which seems to be too big. The following equation is typeset with the
default value and the second one with \verb|\arraycolsep=1.4pt|


\bgroup
\fboxsep=0pt
\def\xstrut{\vphantom{\int\frac{\sin x}{x}}}
\begin{eqnarray*}
\boxed{f(x)\xstrut} & \boxed{=\xstrut} & \boxed{\int\frac{\sin x}{x}dx}
\end{eqnarray*}

\vspace{-2ex}
\arraycolsep=1.4pt
\begin{eqnarray*}
\boxed{f(x)\xstrut} & \boxed{=\xstrut} & \boxed{\int\frac{\sin x}{x}dx}
\end{eqnarray*}
\egroup

If this modification should be valid for all arrays/equations, then write it into the
preamble, otherwise put it into a group or define your own environment as done
in section \vref{subsec:shortcommand}.

\begin{lstlisting}
\bgroup
\arraycolsep=1.4pt
\begin{eqnarray}
f(x) & = & \int\frac{\sin x}{x}dx
\end{eqnarray}
\egroup
\end{lstlisting}

\begin{lstlisting}
\makeatletter
\newcommand{\be}{%
    \begingroup
    \setlength{\arraycolsep}{1.4pt}
[ ... ]
\end{lstlisting}

\section{Matrix}\label{sec:matrix}
\marginpar{\CMD{matrix}\\\CMD{bordermatrix}}\TeX{} knows two macros and \LaTeX{} one more for typesetting a matrix\index{bordermatrix@\textbackslash bordermatrix}:

\begin{showexample}
$\begin{matrix}
  A & B & C \\
  d & e & f \\
  1 & 2 & 3 \\
\end{matrix}$
\end{showexample}
\vspace{-10pt}
\begin{showexample}
$\bordermatrix{%
   & 0 & 1 & 2 \cr
 0 & A & B & C \cr
 1 & d & e & f \cr
 2 & 1 & 2 & 3 \cr
}$
\end{showexample}

\iffalse   % smallmatrix belongs to amsmath
\begin{minipage}{0.4\textwidth}
\begin{center}
$
\begin{smallmatrix}%
 A & B & C \\
 d & e & f \\
 1 & 2 & 3
\end{smallmatrix}
$
\end{center}
\end{minipage}\hfill
\begin{minipage}{0.4\textwidth}
\begin{lstlisting}
\begin{smallmatrix}%
 A & B & C \\
 d & e & f \\
 1 & 2 & 3
\end{smallmatrix}
\end{lstlisting}
\end{minipage}
\fi

The first two macros are listed here for some historical reason, because the \verb|array| or especially the
\AmSmath package offers the same or better macros/environments. Nevertheless it is
possible to redefine the \verb|bordermatrix| macro to get other parentheses and a star
version which takes the left top part as matrix:

\makeatletter
\newif\if@borderstar
\def\bordermatrix{\@ifnextchar*{%
	\@borderstartrue\@bordermatrix@i}{\@borderstarfalse\@bordermatrix@i*}%
}
\def\@bordermatrix@i*{\@ifnextchar[{\@bordermatrix@ii}{\@bordermatrix@ii[()]}}
\def\@bordermatrix@ii[#1]#2{%
\begingroup
	\m@th\@tempdima8.75\p@\setbox\z@\vbox{%
		\def\cr{\crcr\noalign{\kern 2\p@\global\let\cr\endline }}%
		\ialign {$##$\hfil\kern 2\p@\kern\@tempdima & \thinspace %
			\hfil $##$\hfil && \quad\hfil $##$\hfil\crcr\omit\strut %
			\hfil\crcr\noalign{\kern -\baselineskip}#2\crcr\omit %
			\strut\cr}}%
	\setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}%
	\setbox\tw@\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
	\setbox\tw@\hbox{%
		$\kern\wd\@ne\kern -\@tempdima\left\@firstoftwo#1%
			\if@borderstar\kern2pt\else\kern -\wd\@ne\fi%
		\global\setbox\@ne\vbox{\box\@ne\if@borderstar\else\kern 2\p@\fi}%
		\vcenter{\if@borderstar\else\kern -\ht\@ne\fi%
			\unvbox\z@\kern-\if@borderstar2\fi\baselineskip}%
		\if@borderstar\kern-2\@tempdima\kern2\p@\else\,\fi\right\@secondoftwo#1 $%
	}\null \;\vbox{\kern\ht\@ne\box\tw@}%
\endgroup
}
\makeatother

\begin{showexample}
$\bordermatrix{%
  &  1 &  2 \cr
1 & x1 & x2 \cr
2 & x3 & x4 \cr
3 & x5 & x6
}$
\end{showexample}
\vspace{-10pt}
\begin{showexample}
$\bordermatrix[{[]}]{%
  &  1 &  2 \cr
1 & x1 & x2 \cr
2 & x3 & x4 \cr
3 & x5 & x6
}$
\end{showexample}
\vspace{-10pt}
\begin{showexample}
$\bordermatrix[\{\}]{%
  &  1 &  2 \cr
1 & x1 & x2 \cr
2 & x3 & x4 \cr
3 & x5 & x6
}$
\end{showexample}
\vspace{-10pt}
\begin{showexample}
$\bordermatrix*{%
 x1 & x2 & 1 \cr
 x3 & x4 & 2 \cr
 x5 & x6 & 3 \cr
  1 &  2
}$
\end{showexample}
\vspace{-10pt}
\begin{showexample}
$\bordermatrix*[{[]}]{%
 x1 & x2 & 1 \cr
 x3 & x4 & 2 \cr
 x5 & x6 & 3 \cr
  1 &  2
}$
\end{showexample}
\vspace{-10pt}
\begin{showexample}
$\bordermatrix*[\{\}]{%
 x1 & x2 & 1 \cr
 x3 & x4 & 2 \cr
 x5 & x6 & 3 \cr
  1 &  2
}$
\end{showexample}


There is now an optional argument for the parenthesis with \verb|()| as the default one. To get such a behaviour, write into the preamble:
\begin{lstlisting}[xleftmargin=-0.75cm,xrightmargin=-0.75cm]
\makeatletter
\newif\if@borderstar
\def\bordermatrix{\@ifnextchar*{%
	\@borderstartrue\@bordermatrix@i}{\@borderstarfalse\@bordermatrix@i*}%
}
\def\@bordermatrix@i*{\@ifnextchar[{\@bordermatrix@ii}{\@bordermatrix@ii[()]}}
\def\@bordermatrix@ii[#1]#2{%
\begingroup
  \m@th\@tempdima8.75\p@\setbox\z@\vbox{%
    \def\cr{\crcr\noalign{\kern 2\p@\global\let\cr\endline }}%
    \ialign {$##$\hfil\kern 2\p@\kern\@tempdima & \thinspace %
    \hfil $##$\hfil && \quad\hfil $##$\hfil\crcr\omit\strut %
    \hfil\crcr\noalign{\kern -\baselineskip}#2\crcr\omit %
    \strut\cr}}%
  \setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}%
  \setbox\tw@\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
  \setbox\tw@\hbox{%
    $\kern\wd\@ne\kern -\@tempdima\left\@firstoftwo#1%
      \if@borderstar\kern2pt\else\kern -\wd\@ne\fi%
    \global\setbox\@ne\vbox{\box\@ne\if@borderstar\else\kern 2\p@\fi}%
    \vcenter{\if@borderstar\else\kern -\ht\@ne\fi%
      \unvbox\z@\kern-\if@borderstar2\fi\baselineskip}%
      \if@borderstar\kern-2\@tempdima\kern2\p@\else\,\fi\right\@secondoftwo#1 $%
  }\null \;\vbox{\kern\ht\@ne\box\tw@}%
\endgroup
}
\makeatother
\end{lstlisting}

The \verb|matrix| macro cannot be used together with the \AmSmath package, it redefines
this macro (see section \vref{sec:ams-matrix}). 

\section{Super/Subscript and limits}\label{sec:limits}
Writing $a_{min}$ and $a_{max}$ gives the same depth for the subscript, but
writing them in upright mode with \verb+\mbox+ gives a different depth: $a_{\mbox{min}}$ and $a_{\mbox{max}}$.
The problem is the different height, which can be modified in several ways
\begin{itemize}
\item  \verb+$a_{\mbox{\vphantom{i}max}}+: $a_{\mbox{min}}$ and $a_{\mbox{\vphantom{i}max}}$;
\item \verb+$a_{\mathrm{max}}+: $a_{\mathrm{min}}$ and $a_{\mathrm{max}}$;
\item \verb+$a_{\max}+: $a_{\min}$ and $a_{\max}$. Both are predefined operators (see section~\vref{sec:ltxOperators}).
\end{itemize}


\subsection{Multiple limits}\label{sub:Multiple-Limits}

\marginpar{\CMD{atop}}For general information about limits\index{Limits} read section
\vref{sub:Limits-Inline}. With the \CMD{atop}\index{atop@\textbackslash atop} command
multiple limits for a sum\index{sum@\textbackslash sum} or prod\index{prod@\textbackslash prod}
are possible. The syntax is:

\begin{showexample}[width=0.4\linewidth]
\[ {above \atop below} \]
\end{showexample}

\noindent which is nearly the same as a fraction without a rule. This can
be enhanced to \verb|a\atop b\atop c| and so on. For equation \ref{eq:atop} do the following steps:

\begin{showexample}[width=0.4\linewidth]
\begin{equation}\label{eq:atop}
\sum_{{1\le j\le p\atop {%
  {1\le j\le q\atop 1\le k\le r}}}%
}a_{ij}b_{jk}c_{ki}
\end{equation}
\end{showexample}


\bigskip
There are other solutions to get multiple limits, e.g. an array,
which is not the best solution because the space between the lines
is too big. The \AmSmath package provides several commands for limits (section \ref{sec:limit-AMS}) and the \CMD{underset} and \CMD{overset} commands (see section \ref{sec:misc-AMS}).

\subsection{Problems}

\begin{equation}\label{eq:disp-limits}
\fboxsep=0pt\fboxrule=0.1pt
\boxed{\sum_{
	{{1\le j\le p\atop {%
		{1\le j\le q\atop 1\le k\le r}}}%
	}}%
}\boxed{a_{ij}b_{jk}c_{ki}}
\end{equation}

The equation \ref{eq:disp-limits} shows that the horizontal alignment
is not optimal, because the math expression on the right follows at the
end of the limits which are a unit together with the sum symbol. There
is an elegant solution with \AmSmath, described in subsection
\vref{subsec:ams-limits}. If you do not want to use \AmSmath,
then use \CMD{makebox}. But there is a problem when the general fontsize
is increased, \CMD{makebox} knows nothing about the actual math font
size. Equation \ref{eq:disp-limits2} shows the effect and equation
\ref{eq:disp-limits3} the view without the boxes.

\vspace{\abovedisplayskip}
\begin{subequations}
\begin{minipage}{0.45\textwidth}
\begin{equation}\label{eq:disp-limits2}
\fboxsep=0pt\fboxrule=0.1pt
\boxed{\sum_{%
	\makebox[0pt]{$%
		{{\scriptscriptstyle 1\le j\le p\atop {%
		{1\le j\le q\atop 1\le k\le r}}}}%
	$}%
	}%
}\boxed{a_{ij}b_{jk}c_{ki}}
\end{equation}
\end{minipage}\hfill
\begin{minipage}{0.45\textwidth}
\begin{equation}\label{eq:disp-limits3}
\sum_{%
	\makebox[0pt]{$%
		{{\scriptscriptstyle 1\le j\le p\atop {%
		{1\le j\le q\atop 1\le k\le r}}}}%
	$}}a_{ij}b_{jk}c_{ki}
\end{equation}
\end{minipage}
\end{subequations}

\medskip
\begin{lstlisting}
\begin{equation}
\sum_{\makebox[0pt]{$%
	{{\scriptscriptstyle 1\le j\le p\atop {%
	{1\le j\le q\atop 1\le k\le r}}}}%
  $}}a_{ij}b_{jk}c_{ki}
\end{equation}
\end{lstlisting}


\section{Roots}\label{sec:Roots}

The square root\index{Root} \CMD{sqrt}\index{sqrt@\textbackslash sqrt} is the default 
for \LaTeX{} and the $n$-th root can be inserted with the optional parameter \CMD{sqrt[n]\{\ldots\}}.
\marginpar{\CMD{sqrt}}.

\begin{center}
\begin{tabular}{cc}
  \verb|\sqrt{x}|    & $\sqrt{x}$\\
  \verb|\sqrt[3]{x}| & $\sqrt[3]{x}$
\end{tabular}
\end{center}

There is a different typesetting in roots. Equation \vref{eq:root1}
has different heights for the roots, whereas equation \vref{eq:root2}
has the same one. This is possible with the %
\marginpar{\CMD{vphantom}}%
\verb+\vphantom+\index{vphantom@\textbackslash vphantom} command,
which reserves the vertical space (without a horizontal one) of the
parameter height.

\begin{showexample}[width=0.35\linewidth,wide]
\begin{equation}
  \sqrt{a}\,%
  \sqrt{T}\,%
  \sqrt{2\alpha k_{B_1}T^i}\label{eq:root1}
\end{equation}
\end{showexample}


\vspace{-10pt}
\begin{showexample}[width=0.35\linewidth,wide]
\begin{equation}\label{eq:root2}
  \sqrt{a\vphantom{k_{B_1}T^i}}\,%
  \sqrt{T\vphantom{k_{B_1}T^i}}\,%
  \sqrt{2\alpha k_{B_1}T^i}
\end{equation}
\end{showexample}


The typesetting looks much  better, especially when the formula
has different roots in a row, like equation \vref{eq:root1}. Using
\AmSmath with the \CMD{smash} command%
\footnote{The \CMD{smash} command exists also in \LaTeX{}
but without an optional argument, which makes the use for roots possible.%
} gives some more possibilities for the typesetting of roots (see section
\vref{sec:Roots-ams}).


\section[Brackets, braces \ldots]{Brackets, braces and parentheses}\label{sec:Brackets,-Braces-and}

This is one of the major problems inside the math mode, because there is often a need for different brackets, braces and parentheses in different size. At first we had to admit, that
there is a difference between the characters ``\verb|()[]/\|
$\lbrace\rbrace$
|
$\Vert$
$\lfloor\rfloor$
$\lceil\rceil$
$\langle\rangle$
$\uparrow\Uparrow$
$\downarrow\Downarrow$
$\updownarrow\Updownarrow${}''
and their use as an argument %
\marginpar{\CMD{leftX}\\\CMD{rightX}} of the \CMD{left}\index{left@\textbackslash left}
and \CMD{right}\index{right@\textbackslash right}
command, where \LaTeX{} stretches the size in a way that everything between
the pair of left and right parentheses is smaller than the parentheses themselves. In some cases%
\footnote{See section \vref{cap:Use-of-the-vphantom} for example.%
} it may be useful to choose a fixed height, which is possible with
the \CMD{big}-series. Instead of writing \CMD{leftX}
or \CMD{rightX} one of the following commands can
be chosen:

\medskip
\marginpar{\CMD{bigX}\\\CMD{BigX}\\\CMD{biggX}\\\CMD{BiggX}}
\index{big@\textbackslash big}\index{Big@\textbackslash Big}%
\index{bigg@\textbackslash bigg}\index{Bigg@\textbackslash Bigg}
\begin{tabular}{rl}
default & ()[]/\textbackslash$\lbrace\rbrace$|$\Vert$ $\lfloor\rfloor$
$\lceil\rceil$ $\langle\rangle$ $\uparrow\Uparrow$ $\downarrow\Downarrow$%
$\updownarrow\Updownarrow$\\[2pt]
\CMD{bigX} & $\big(\big)$ $\big[\big]$
$\bigl/\big\backslash\big\{\big\}$
$\big|$ $\big\Vert$ $\big\lfloor\big\rfloor$ $\big\lceil\big\rceil$
$\big\langle\big\rangle$ $\big\uparrow\big\Uparrow$ $\big\downarrow\big\Downarrow$
$\big\updownarrow\big\Updownarrow$\\[2pt]
\CMD{BigX} & $\Big(\Big)$
$\Big[\Big]$ $\Bigl/\Big\backslash\Big\{\Big\}$
$\Big|$ $\Big\Vert$ $\Big\lfloor\Big\rfloor$
$\Big\lceil\Big\rceil$ $\Big\langle\Big\rangle$
$\Big\uparrow\Big\Uparrow$ $\Big\downarrow\Big\Downarrow$
$\Big\updownarrow\Big\Updownarrow$\\[4pt]
\CMD{biggX} & $\bigg(\bigg)$
$\bigg[\bigg]$ $\biggl/\bigg\backslash\bigg\{\bigg\}$%
$\bigg|$ $\bigg\Vert$ $\bigg\lfloor\bigg\rfloor$ $\bigg\lceil\bigg\rceil$
$\bigg\langle\bigg\rangle$ $\bigg\uparrow\bigg\Uparrow$
$\bigg\downarrow\bigg\Downarrow$ $\bigg\updownarrow\bigg\Updownarrow$\\[8pt]
\CMD{Big}gX & $\Bigg(\Bigg)$
$\Bigg[\Bigg]$ $\Biggl/\Bigg\backslash\Bigg\{\Bigg\}$
$\Bigg|$ $\Bigg\Vert$ $\Bigg\lfloor\Bigg\rfloor$
$\Bigg\lceil\Bigg\rceil$ $\Bigg\langle\Bigg\rangle$
$\Bigg\uparrow\Bigg\Uparrow$ $\Bigg\downarrow\Bigg\Downarrow$%
$\Bigg\updownarrow\Bigg\Updownarrow$
\end{tabular}

\medskip{}
Only a few commands can be written in a short form like \CMD{big(}.
The ``X{}'' has to be replaced with one of the following characters
or commands from table \ref{tab:big}, which shows the parentheses
character, its code for the use with one of the ``big{}'' commands
and an example with the code for that.

\marginpar{\CMD{biglX}\\\CMD{bigrX}}%
For all commands there exists a left/right version  \CMD{bigl}\index{bigl@\textbackslash bigl}, 
\CMD{bigr}\index{bigr@\textbackslash bigr}, \CMD{Bigl}\index{Bigl@\textbackslash Bigl}
and so on, which only makes sense when writing things like:

\begin{showexample}[width=0.3\linewidth,wide]
\begin{align} 
  \biggl)\times \frac{a}{b} \times\biggr( 
\end{align}
\begin{align} 
  \bigg)\times \frac{a}{b} \times\bigg( 
\end{align}
\end{showexample}

\LaTeX{} takes the \verb|\biggl)| as a mathopen symbol, which has by default
another horizontal spacing.

In addition to the above additional commands there exist some more:
\CMD{bigm}\index{bigm@\textbackslash bigm}, \CMD{Bigm}\index{Bigm@\textbackslash Bigm}, \CMD{biggm}\index{biggm@\textbackslash biggm} and \CMD{Biggm}\index{Biggm@\textbackslash Biggm},
which work as the standard ones (without the addtional ``m{}'')
but add some more horizontal space%
\marginpar{\CMD{bigmX}\\\CMD{bigmX}} between the delimiter and the formula before and after (see table \ref{cap:Difference-between-the-bigg}).

\begin{table}[htb]
\begin{showexample}
$3\bigg|a^2-b^2-c^2\bigg|+2$
\end{showexample}
\vspace{-15pt}
\begin{showexample}
$3\biggm|a^2-b^2-c^2\biggm|+2$
\end{showexample}
\caption{Difference between the default
\CMD{bigg} and the \CMD{biggm} command}\label{cap:Difference-between-the-bigg}
\end{table}


\newcommand{\xstrut}{\rule{0pt}{0.55cm}}
{\setlength{\hangindent}{-\marginparwidth}
\begin{longtable}{l>{\raggedright}p{2.4cm}l>{\raggedright}p{5.7cm}}
Char & Code & Example & Code\tabularnewline
\hline
\endhead
\xstrut$(\ )$ & ( ) & %
	$3\Big(a^{2}+b^{c^{2}}\Big)$ & %
	\texttt{3\CMD{Big}( a\^{}2+b\^{}\{c\^{}2\}\CMD{Big})}\tabularnewline
%
\xstrut$[\ ]$ & {[} {]}&
$3\Big[a^{2}+b^{c^{2}}\Big]$&
\texttt{3\CMD{Big}{[} a\^{}2+b\^{}\{c\^{}2\}\CMD{Big}{]}}\tabularnewline
%
\xstrut$/\ \backslash$ & \texttt{/}\CMD{backslash} & $3\Big/a^{2}+b^{c^{2}}\Big\backslash$ &
\texttt{3\CMD{Big}/ a\^{}2+b\^{}\{c\^{}2\}\CMD{Big}\CMD{backslash}}\tabularnewline
%
\xstrut$\{\ \}$ & \CMD{\{}\CMD{\}}\\
 & $3\Big\{ a^{2}+b^{c^{2}}\Big\}$ &
\texttt{3\CMD{Big}\CMD{\{} a\^{}2+b\^{}\{c\^{}2\}\CMD{Big}\CMD{\}}}\tabularnewline
%
\xstrut$\vert\ \Vert$ & | \CMD{Vert} & $3\Big|a^{2}+b^{c^{2}}\Big\Vert$ & \texttt{3\CMD{Big}|a\^{}2+b\^{}\{c\^{}2\}\CMD{Big}\CMD{Vert}}\tabularnewline
%
\xstrut$\lfloor\ \rfloor$ & \CMD{lfloor} \CMD{rfloor} & %
	$3\Big\lfloor a^{2}+b^{c^{2}}\Big\rfloor$ & %
	\texttt{3\CMD{Big}\CMD{lfloor} a\^{}2+b\^{}\{c\^{}2\}
		\CMD{Big}\CMD{rfloor}}\tabularnewline
%
\xstrut$\lceil\ \rceil$ & \CMD{lceil}\CMD{rceil} &
	$3\Big\lceil a^{2}+b^{c^{2}}\Big\rceil$ &
	 \texttt{3\CMD{Big}\CMD{lceil} a\^{}2+b\^{}\{c\^{}2\} \CMD{Big}%
	 	\CMD{rceil}}\tabularnewline
%
\xstrut$\langle\ \rangle$ & \CMD{langle}\CMD{rangle} &
	$3\Big\langle a^{2}+b^{c^{2}}\Big\rangle$ &
	\texttt{3\CMD{Big}\CMD{langle} a\^{}2+b\^{}\{c\^{}2\}%
		\CMD{Big}\CMD{rangle}}\tabularnewline
%
\xstrut$\uparrow\ \Uparrow$ &
	\CMD{uparrow} \CMD{Uparrow} &
	$3\Big\uparrow a^{2}+b^{c^{2}}\Big\Uparrow$ &
	\texttt{3\CMD{Big}\CMD{uparrow} a\^{}2+b\^{}\{c\^{}2\}%
		\CMD{Big}\CMD{Uparrow}}\tabularnewline
%
\xstrut$\downarrow\ \Downarrow$ & \CMD{downarrow} \CMD{Downarrow} &
	$3\Big\downarrow a^{2}+b^{c^{2}}\Big\Downarrow$ &
	\texttt{3\CMD{Big}\CMD{downarrow} a\^{}2+b\^{}\{c\^{}2\}
		\CMD{Big}\CMD{Downarrow}}\tabularnewline
%
\xstrut$\updownarrow\ \Updownarrow$ & \CMD{updownarrow} \CMD{Updownarrow} &
	$3\Big\updownarrow a^{2}+b^{c^{2}}\Big\Updownarrow$ &
	\texttt{3\CMD{Big}\CMD{updownarrow} a\^{}2+b\^{}\{c\^{}2\}
		\CMD{Big}\CMD{Updownarrow}}\tabularnewline
& & &\\
\caption{Use of the different parentheses for the ``big{}'' commands} \label{tab:big}\tabularnewline
\end{longtable}}


\subsection{Examples}
\subsubsection{Braces over several lines}\label{cap:Use-of-the-vphantom}
The following equation in the single line mode looks like


\begin{equation}
\frac{1}{2}\Delta(f_{ij}f^{ij})=2\left(\sum_{i<j}\chi_{ij}(\sigma_{i}-\sigma_{j})^{2}+f^{ij}\nabla_{j}\nabla_{i}(\Delta f)+\nabla_{k}f_{ij}\nabla^{k}f^{ij}+f^{ij}f^{k}[2\nabla_{i}R_{jk}-\nabla_{k}R_{ij}]\right)\label{eq:braces}
\end{equation}


\noindent and is too long for the text width and the equation number has to be placed
under the equation.\footnote{In standard \LaTeX{} the equation and the number are
printed one over the other for too long
formulas. Only \AmSmath puts it one line over (left numbers) or under (right
numbers) the formula.} With the array environment the formula can be split in two smaller
pieces:

{\arraycolsep=2pt
\begin{equation}
\begin{array}{rcl}
	\frac{1}{2}\Delta(f_{ij}f^{ij}) & = & 2\left({\displaystyle
	\sum_{i<j}}\chi_{ij}(\sigma_{i}-\sigma_{j})^{2}+f^{ij}%
	\nabla_{j}\nabla_{i}(\Delta f)+\right.\\
&	& \left.+\nabla_{k}f_{ij}\nabla^{k}f^{ij}+f^{ij}f^{k}[2
	\nabla_{i}R_{jk}-\nabla_{k}R_{ij}]\right)
\end{array}
\end{equation}
}


It is obvious that there is a problem with the right closing parentheses.
Because of the two pairs ``\verb|\left( ... \right.|''
and ``\verb|\left. ... \right)|''
they have a different size because every pair does it in its own
way. Using the \CMD{Bigg} command changes this into a better
typesetting:

{\arraycolsep=2pt
\begin{equation}
\begin{array}{rcl}
	\frac{1}{2}\Delta(f_{ij}f^{ij}) & = & 2\Bigg({\displaystyle
	\sum_{i<j}}\chi_{ij}(\sigma_{i}-\sigma_{j})^{2}+f^{ij}%
	\nabla_{j}\nabla_{i}(\Delta f)+\\
&	& +\nabla_{k}f_{ij}\nabla^{k}f^{ij}+f^{ij}f^{k}[2
	\nabla_{i}R_{jk}-\nabla_{k}R_{ij}]\Bigg)
\end{array}
\end{equation}
}
\begin{lstlisting}
{\arraycolsep=2pt
\begin{equation}
\begin{array}{rcl}
	\frac{1}{2}\Delta(f_{ij}f^{ij}) & = & 2\Bigg({\displaystyle
	\sum_{i<j}}\chi_{ij}(\sigma_{i}-\sigma_{j})^{2}+f^{ij}%
	\nabla_{j}\nabla_{i}(\Delta f)+\\
&	& +\nabla_{k}f_{ij}\nabla^{k}f^{ij}+f^{ij}f^{k}[2
	\nabla_{i}R_{jk}-\nabla_{k}R_{ij}]\Bigg)
\end{array}
\end{equation}
}
\end{lstlisting}

Section~\vref{sec:Specials-for-multline} shows another solution
for getting the right size for parentheses when breaking the equation
in smaller pieces.

\begin{align*}
  B(r,\phi,\lambda) = & \,\dfrac{\mu}{r} 
    \Bigg[\sum_{n=2}^{\infty} \Bigg( \left( \dfrac{R_e}{r} \right)^n J_nP_n(s\phi) \\
  & +\sum_{m=1}^n \left( \dfrac{R_e}{r} \right) ^n
   (C_{nm}\cos m\lambda+S_{nm}\sin m\lambda)P_{nm}(s\phi) \Bigg)\Bigg]
\end{align*}

\begin{lstlisting}
\begin{align*}
  B(r,\phi,\lambda) = & \,\dfrac{\mu}{r} 
    \Bigg[\sum_{n=2}^{\infty} \Bigg( \left( \dfrac{R_e}{r} \right)^n J_nP_n(s\phi) \\
  & +\sum_{m=1}^n \left( \dfrac{R_e}{r} \right) ^n
   (C_{nm}\cos m\lambda+S_{nm}\sin m\lambda)P_{nm}(s\phi) \Bigg)\Bigg]
\end{align*}
\end{lstlisting}


\subsubsection{Middle bar}
See section \vref{sec:braket} for examples and the use of package \verb|braket.sty|.

\subsection{New delimiters}\label{subsec:delim}
The default delimiters\index{Delimiter} are defined in the file \verb|fontmath.ltx|\index{fontmath.ltx}
which is stored in general
in \path{[TEXMF]/tex/latex/base/fontmath.ltx}. If we need for example a thicker vertical symbol
than the existing \verb|\vert| symbol we can define in the preamble:

\begin{lstlisting}
\DeclareMathDelimiter{\Norm}
   {\mathord}{largesymbols}{"3E}{largesymbols}{"3E}
\end{lstlisting}

The character number $3E_{16}$ (decimal $62$) from the \verb|cmex10|\index{cmex10} font is the small
thick vertical rule. Now the new delimiter \verb|\Norm| can be used in the usual way:

\begin{showexample}[width=0.3\linewidth,wide]
$\left\Norm *BLA* \right\Norm$

$\left\Norm \dfrac{*BLA*}{*BLUB*} \right\Norm$
\end{showexample}



\subsection{Problems with parentheses}\label{subsec:Problems-with-parenthesis}
\marginpar{\CMD{delimitershortfall}\\\CMD{delimiterfactor}}It is obvious that the following
equation has not the right size of the parenthesis in the
second integral, the inner one should be a bit smaller than the outer one.
\begin{showexample}[width=0.425\linewidth,wide]
\[
\int_\gamma F'(z) dz =\int_\alpha^\beta
F'\left(\gamma (t)\right)\cdot\gamma '(t)dt
\]
\end{showexample}

The problem is that \TeX{} controlls the height of the parenthesis with
\verb|\delimitershortfall|\index{delimitershortfall@\textbackslash delimitershortfall} and \verb|\delimiterfactor|\index{delimiterfactor@\textbackslash delimiterfactor}, with the default values
\begin{verbatim}
\delimitershortfall=5pt
\delimiterfactor=901
\end{verbatim}

\verb|\delimiterfactor/1000| is the relative size of the parenthesis for a given formula
environment. They could be of \verb|\delimitershortfall| too short. These values are valid
at the end of the formula, the best way is to set them straight before the math environment
or globally for all in the preamble.


\begin{showexample}[width=0.425\linewidth,wide]
{\delimitershortfall=-1pt
\[
\int_\gamma F'(z) dz =\int_\alpha^\beta
F'\left(\gamma (t)\right)\cdot\gamma '(t)dt
\]}
\end{showexample}

\section{Text in math mode}\label{sec:Text}

Standard \index{Text}text in math mode should be written in upright shape and not
in the italic\index{Italic} one. This shape is reserved for the variable
names: $\boxed{{I\  am\ \textrm{text}\  inside\  math.}}$ (see also 
(\vref{cap:Spaces-in-math mode}). There are different ways to write text inside math.

\marginpar{\CMD{textstyle}\\\CMD{mbox}}

\begin{itemize}
\marginpar{\CMD{mathrm}}
\item \CMD{mathrm}. It is like math mode (no spaces), but in upright mode
\item \CMD{textrm}. Upright mode with printed spaces (real textmode)
\item \CMD{mbox}. The font size is still the one from \CMD{textstyle} (see section \vref{sec:Styles}), so that you have to place additional
commands when you use \CMD{mbox} in a super- or subscript for limits.
\end{itemize}

Inserting long text is possible with a \verb+parbox+, which can be aligned as usual to the top,
bottom or center, e.g.\index{Text!\textbackslash parbox}
\begin{eqnarray}
  a+b+c+d+ef & = & g+h+i+j+k %
  \qquad\textrm{\parbox[t]{.25\linewidth}{%
     this is a very long description of a formula}%
  }
\end{eqnarray}

\begin{lstlisting}
\begin{eqnarray}
  a+b+c+d+ef & = & g+h+i+j+k %
  \qquad\textrm{\parbox[t]{.25\linewidth}{%
     this is a very long description of a formula}%
  }
\end{eqnarray}
\end{lstlisting}

Additional commands for text inside math are provided by \AmSmath (see
section \vref{sec:Text-in-math mode}).


\section{Font commands}

\subsection{Old-style font commands}

Should never be used, but are still present and supported by \LaTeX{}. The
default syntax for the old commands is

\begin{lstlisting}
{\XX test}
\end{lstlisting}
Table~\vref{cap:Old-Fontstyle-commands} shows what has to be replaced for the \verb+XX+.
The major difference to the new style is that these
\CMD{XX} are toggling the actual math mode into
the ``XX{}'' one, whereas the new commands start a group which
switches back to the mode before at its end.

\begin{table}[!htb]
\centering\begin{tabular}{rc|rc|rc|cc|cc}
\CMD{bf}\index{bf@\textbackslash bf} & ${\bf {\bf test}}$ &
\CMD{cal}\index{cal@\textbackslash cal} & ${\cal TEST}$ &
\CMD{it}\index{it@\textbackslash it} &
${\it test}$ &
\CMD{rm}\index{rm@\textbackslash rm} &
${\rm test}$ &
\CMD{tt}\index{tt@\textbackslash tt} &
${\tt test}$\tabularnewline
\end{tabular}
\caption{Old font style commands}\label{cap:Old-Fontstyle-commands}
\end{table}

\subsection{New-style font commands}\label{sub:New-Style-Fontcommands}

%
\marginpar{\CMD{mathrm}\\
\CMD{mathfrak}\\
\CMD{mathcal}\\
\CMD{mathsf}\\
\CMD{mathbb}\\
\CMD{mathtt}\\
\CMD{mathit}\\
\CMD{mathbf}}

The default syntax is

\begin{lstlisting}
\mathXX{test}
\end{lstlisting}
Table~\ref{cap:Fonts-in-math-mode} shows what has to be
replaced for the XX. See section \vref{sec:euscript.sty} for additional packages.

\begin{table}[htb]
\includegraphics{styles}

\iffalse
%\vspace{0.5ex}
%\rule{0.3\columnwidth}{0.5pt}\\
%{}\textsuperscript{a}{\small Not available for lower letters. For mathcal there exists a
%  non free font for lower letters (http://www.yandy.com)}
%\caption{Fonts in math mode}\label{cap:Styles-in-math mode}
%\end{table}

%\begin{comment}

\begin{table}[!htb]
\begin{minipage}{\linewidth}
\centering
\begin{tabularx}{.9\linewidth}{l|X}
\textbf{Command} & \textbf{Test}\tabularnewline\hline
default & $ABCDEFGHIJKLMNOPQRSTUVWXYZ$

$abcdefghijklmnopqrstuvwxyz$\tabularnewline
\CMD{mathfrak} &
$\mathfrak{{ABCDEFGHIJKLMNOPQRSTUVWXYZ}}$
$\mathfrak{{abcdefghijklmnopqrstuvwxyz}}$\tabularnewline
\CMD{mathcal}%
\footnote{Not available for lower letters. For mathcal exists a
  non free font for lower letters (http://www.yandy.com)}\addtocounter{mpfootnote}{-1} &
$\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\tabularnewline
\CMD{mathsf}&
$\mathsf{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$
$\mathsf{abcdefghijklmnopqrstuvwxyz}$\tabularnewline

\CMD{mathbb}${}^a$ & $\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\tabularnewline
\CMD{mathtt} & $\mathtt{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$

$\mathtt{abcdefghijklmnopqrstuvwxyz}$\tabularnewline
\CMD{mathit} & $\mathit{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$

$\mathit{abcdefghijklmnopqrstuvwxyz}$\tabularnewline
\CMD{mathrm} & $\mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$

$\mathrm{abcdefghijklmnopqrstuvwxyz}$\tabularnewline
\CMD{mathbf} & $\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$

$\mathbf{abcdefghijklmnopqrstuvwxyz}$\tabularnewline

\CMD{mathds}${}^b$ & $\mathds{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\tabularnewline
\end{tabularx}
\end{minipage}
\fi

\caption{Fonts in math mode}\label{cap:Fonts-in-math-mode}
\end{table}

\index{mathfrak@\textbackslash mathfrak}\index{mathsf@\textbackslash mathsf}
\index{mathbb@\textbackslash mathbb}\index{mathcal@\textbackslash mathcal}
\index{mathbf@\textbackslash mathbf}\index{mathit@\textbackslash mathit}
\index{mathrm@\textbackslash mathrm}\index{mathtt@\textbackslash mathtt}
\index{mathds@\textbackslash mathds}\index{double stroke}
\index{dsfont@\texttt{dsfont}}\index{Set symbol}
%\end{comment}

\section{Space}
\subsection{Math typesetting}\label{subsec:mathskip}

\marginpar{\CMD{thinmuskip}\\
\CMD{medmuskip}\\
\CMD{thickmuskip}}
\LaTeX\ defines the three math lengths\footnote{For more
information see: \url{http://www.tug.org/utilities/plain/cseq.html}} with the following
values\footnote{see \texttt{\small fontmath.ltx}}:

\begin{lstlisting}
\thinmuskip=3mu
\medmuskip=4mu plus 2mu minus 4mu
\thickmuskip=5mu plus 5mu
\end{lstlisting}

\noindent where \verb|mu| is the abbreviation for \verb|math unit|.
\[
1 \mathrm{mu}= \dfrac{1}{18} \mathrm{em}
\]

\begin{table}[htb]
\centering
\begin{tabular}{ll}
\fboxsep=0pt
\text{default} & $\boxed{f(x)=x^2+3x_0\cdot\sin x}$\\
\CMD{thinmuskip=0mu} & {\thinmuskip=0mu $\boxed{f(x)=x^2+3x_0\cdot\sin x}$}\\
\CMD{medmuskip=0mu} & {\medmuskip=0mu $\boxed{f(x)=x^2+3x_0\cdot\sin x}$}\\
\CMD{thickmuskip=0mu} & {\thickmuskip=0mu $\boxed{f(x)=x^2+3x_0\cdot\sin x}$}\\
all set to zero & {\thickmuskip=0mu\thinmuskip=0mu\medmuskip=0mu $\boxed{f(x)=x^2+3x_0\cdot\sin x}$}\\
\end{tabular}
\caption{The meaning of the math spaces}\label{tab:mathSpaces}
\end{table}

These lengths can have all glue and are
used for the horizontal spacing in math expressions where \TeX{} puts spaces between symbols
and operators. The meaning of these different
horizontal skips is shown in table \ref{tab:mathSpaces}. For a better typesetting \LaTeX{}
inserts different spaces between the symbols.

\begin{description}
\item[\CMD{thinmuskip}] space between ordinary and operator atoms
\item[\CMD{medmuskip}] space between ordinary and binary atoms in display and text styles
\item[\CMD{thickmuskip}] space between ordinary and relation atoms in display and text styles
\end{description}

\subsection{Additional horizontal spacing}
\marginpar{\CMD{thinspace}\\
\CMD{medspace}\\
\CMD{thickspace}\\
\CMD{negthinspace}\\
\CMD{negmedspace}\\
\CMD{negthickspace}}

\begin{table}[!htb]
\def\arraystretch{1.2}
\centering
\begin{tabular}{ll|ll}
\multicolumn{2}{l|}{Positive Space}&\multicolumn{2}{l}{Negative Space}\\\hline
\verb|$ab$|   & $\boxed{a}\boxed{b}$\\
\verb|$a b$|  & $\boxed{a} \boxed{b}$\\
\verb|$a\ b$| & $\boxed{a}\ \boxed{b}$\\
\verb|$a\mbox{\textvisiblespace}b$| & $\boxed{a}\mbox{\textvisiblespace}\boxed{b}$\\
\verb|$a\,b$|\index{,@\textbackslash ,} (\verb|$a\thinspace b$|)\index{thinspace@\textbackslash thinspace} & $\boxed{a}\,\boxed{b}$&
\verb|$a\! b$|\index{negthinspace@\textbackslash negthinspace} & $\boxed{a}\!\boxed{b}$\\
\verb|$a\: b$|\index{:@\textbackslash :} (\verb|$a\medspace b$|)\index{medspace@\textbackslash medspace}&
$\boxed{a}\:\boxed{b}$&
\verb|$a\negmedspace b$|\index{negmedspace@\textbackslash negmedspace} & $\boxed{a}\negmedspace\boxed{b}$\\
\verb|$a\; b$|\index{;@\textbackslash ;} (\verb|$a\thickspace b$|\index{thickspace@\textbackslash thickspace}&
$\boxed{a}\;\boxed{b}$&
\verb|$a\negthickspace b$|\index{negthickspace@\textbackslash negthickspace}&
$\boxed{a}\negthickspace\boxed{b}$\\
\verb|$a\quad b$|\index{quad@\textbackslash quad} & $\boxed{a}\quad\boxed{b}$\\
\verb|$a\qquad b$|\index{qquad@\textbackslash qquad} & $\boxed{a}\qquad\boxed{b}$\\
\verb|$a\hspace{0.5cm}b$|\index{hspace@\textbackslash hspace}& $\boxed{a}\hspace{0.5cm}\boxed{b}$&
\verb|$a\hspace{-0.5cm}b$| & $\boxed{a}\hspace{-0.5cm}\boxed{b}$\\
\verb|$a\kern0.5cm b$|\index{kern@\textbackslash kern} & $\boxed{a}\kern0.5cm \boxed{b}$ & \verb|$a\kern-0.5cm b$| & $\boxed{a}\kern-0.5cm \boxed{b}$\\
\verb|$a\hphantom{xx}b$|\index{hphantom@\textbackslash hphantom} & $\boxed{a}\hphantom{xx}\boxed{b}$\\
\verb|$axxb$| & $\boxed{a}xx\boxed{b}$
\end{tabular}
\caption{Spaces in math mode}\label{cap:Spaces-in-math mode}
\end{table}


LaTeX defines the following short commands:

\begin{verbatim}
\def\>{\mskip\medmuskip}
\def\;{\mskip\thickmuskip}
\def\!{\mskip-\thinmuskip}
\end{verbatim}
In math mode there is often a need for additional tiny spaces between variables,
e.g. $L\dfrac{di}{dt}$ written with a tiny space between $L$ and
$\dfrac{di}{dt}$ looks nicer: $L\:\dfrac{di}{dt}$. Table \ref{cap:Spaces-in-math mode}
shows a list of all commands for horizontal space which can be used
in math mode. The ``space{}'' is seen ``between{}'' the boxed a
and b. For all examples a is \texttt{\textbackslash{}boxed\{a\}} and
b is \texttt{\textbackslash{}boxed\{b\}}. The short forms for some
\marginpar{\CMD{hspace}\\
\CMD{hphantom}\\
\CMD{kern}}spaces may cause problems with other packages. In this case use the
long form of the commands.

\subsection{Problems}\label{space:problems}
Using \verb+\hphantom+\index{hphantom@\textbackslash hphantom}\index{phantom@\textbackslash phantom}
in mathmode depends to on object. \verb+\hphantom+ reserves only the space of
the exact width without any additional space. In the following example the second line is
wrong: \verb+& \hphantom{\rightarrow} b\\+. It does not reserve any additional space.

\begin{showexample}[width=0.15\linewidth,wide]
\begin{align*}
a & \rightarrow b\\
  & \hphantom{\rightarrow} b\\
  & \mkern\thickmuskip\hphantom{\rightarrow}\mkern\thickmuskip b\\
  & \mathrel{\hphantom{\rightarrow}} b
\end{align*}
\end{showexample}

This only works when the math symbol is a mathrel one, otherwise you have to change the
horizontal space to \verb+\medmuskip+ or \verb+\thinmuskip+. For more informations
about the math objects look into \verb+fontmath.ltx+ or \verb+amssymb.sty+ or use the \verb+\show+
macro, which prints out the type of the mathsymbol, e.g.: \verb+\show\rightarrow+ with the
output:

\begin{lstlisting}
> \rightarrow=\mathchar"3221.
l.20 \show\rightarrow
\end{lstlisting}

The first digit represents the type:

\begin{tabular}{l@{ : }l}
0 & ordinary\\
1 & large operator\\
2 & binary operation\\ 
3 & relation\\
4 & opening\\
5 & closing\\
6 & punctuation\\ 
7 & variable family
\end{tabular}


%\iffalse
\begingroup
\thinmuskip=3mu
\medmuskip=4mu plus 2mu minus 4mu
\thickmuskip=5mu plus 5mu

\medskip
Grouping a math symbol can change the behaviour in horizontal spacing. Compare
$50\mkern\thinmuskip\times\mkern\thinmuskip10^{12}$ and $50{\times}10^{12}$, the first one is typeset with 
\verb+$50\times10^{12}$+ and the second one with \verb+$50{\times}10^{12}$+.
\endgroup
%\fi
Another possibilty is to use the \verb+numprint+ package.\footnote{%
\href{ftp://ftp.dante.de/tex-archive/macros/latex/contrib/numprint/}%
{CTAN://macros/latex/contrib/numprint/}}

\subsection{Dot versus comma}\label{subsec:dot-comma}
\marginpar{\CMD{mathpunct}\\\CMD{mathord}}%
In difference to a decimal point\index{decimal point} and a \index{comma}comma as a marker of thousends a lot of
countries prefer it vice versa. To get the same behaviour the meaning of \index{dot}dot and
comma has to be changed:

\begin{align}
1,234,567.89 & \textrm{ default}\\
1.234.567,89 & \textrm{ vice versa, wrong spacing}\\\label{eq:comma}
1\mathpunct{.}234\mathpunct{.}567{,}89 & \textrm{ correct spacing}
\end{align}


\begin{lstlisting}
1,234,567.89 & \textrm{ default}\\
1.234.567,89 & \textrm{ vice versa, wrong spacing}\\
1\mathpunct{.}234\mathpunct{.}567{,}89 & \textrm{ correct spacing}
\end{lstlisting}

The original definitions from \verb+fontmath.ltx+\footnote{%
Located in \url{texmf/tex/latex/base/}} are

\begin{verbatim}
\DeclareMathSymbol{,}{\mathpunct}{letters}{"3B}
\DeclareMathSymbol{.}{\mathord}{letters}{"3A}
\end{verbatim}

\noindent\index{mathord@\textbackslash mathord}\index{mathpunct@\textbackslash mathpunct}and can be changed for a documentwide other behaviour. In the above equation~\ref{eq:comma} the comma is only set in a pair of braces \verb+{,}+, which is the same as writing \verb+\mathord{,}+ because LaTeX{} handles everything
inside of parenthises as a formula, which gets the same spacing. 

It is also possible to use the package \verb+icomma.sty+\footnote{%
\href{ftp://ftp.dante.de/tex-archive/macros/latex/contrib/was/}%
{CTAN:// macros/latex/contrib/was/}} for a documentwide
correct spacing.

\subsection{Vertical whitespace}\label{subsec:whitespace}
\subsubsection{Before/after math expressions}\label{subsubsec:displayskip}

There are four predefined lengths, which control the vertical whitespace
of displayed formulas:
\begin{verbatim}
\abovedisplayskip=12pt plus 3pt minus 9pt
\abovedisplayshortskip=0pt plus 3pt
\belowdisplayskip=12pt plus 3pt minus 9pt
\belowdisplayshortskip=7pt plus 3pt minus 4pt
\end{verbatim}
\index{abovedisplayskip@\textbackslash abovedisplayskip}
\index{abovedisplayshortskip@\textbackslash abovedisplayshortskip}
\index{belowdisplayskip@\textbackslash belowdisplayskip}
\index{belowdisplayshortskip@\textbackslash belowdisplayshortskip}
The short skips are used if the formula starts behind the end of the foregoing
last line. Only for demonstration the shortskips
are set to \verb|0pt| in the following examples and the normal skips to \verb|20pt| without any glue:

\medskip
\noindent\fbox{\begin{minipage}{\linewidth-2\fboxsep-2\fboxrule}
\abovedisplayshortskip=0pt
\belowdisplayshortskip=0pt
\abovedisplayskip=20pt
\belowdisplayskip=20pt
\noindent The line ends before.
\begin{equation}
f(x) =  \int\frac{\sin x}{x}dx
\end{equation}
\noindent The line doesn't end before the formula.
\begin{equation}
f(x) =  \int\frac{\sin x}{x}dx
\end{equation}
\noindent And the next line starts as usual with some text ...
\end{minipage}}

\medskip
\begin{lstlisting}
\abovedisplayshortskip=0pt
\belowdisplayshortskip=0pt
\abovedisplayskip=20pt
\belowdisplayskip=20pt
\noindent The line ends before.
\begin{equation}
	f(x) =  \int\frac{\sin x}{x}dx
\end{equation}
\noindent The line doesn't end before the formula.
\begin{equation}
	f(x) =  \int\frac{\sin x}{x}dx
\end{equation}
\noindent And the next line starts as usual with some text ...
\end{lstlisting}

\subsubsection{Inside math expressions}\label{subsec:vspacing}

\paragraph{\CMD{\textbackslash [<length>]}}
This works inside the math mode in the same way as in the text mode.


\paragraph{\CMD{jot}}\marginpar{\CMD{jot}}
The vertical space between the lines for all math expressions which allow multiple
lines  can be changed with the length
\verb|\jot|\index{jot@\textbackslash jot}, which is predefined as

\begin{verbatim}
\newdimen\jot \jot=3pt
\end{verbatim}

The following three formulas show this for the default value, \verb|\jot=0pt|  and \verb|\jot=10pt|.

\begin{minipage}{0.3\linewidth}
\begin{eqnarray*}
	y & = & d\\
	y & = & c\frac{1}{x}+d\\
	y & = & b\frac{1}{x^{2}}+cx+d\\
\end{eqnarray*}
\end{minipage}\hfill
\begin{minipage}{0.3\linewidth}
\jot=0pt
\begin{eqnarray*}
	y & = & d\\
	y & = & c\frac{1}{x}+d\\
	y & = & b\frac{1}{x^{2}}+cx+d\\
\end{eqnarray*}
\end{minipage}\hfill
\begin{minipage}{0.3\linewidth}
\jot=10pt
\begin{eqnarray*}
	y & = & d\\
	y & = & c\frac{1}{x}+d\\
	y & = & b\frac{1}{x^{2}}+cx+d\\
\end{eqnarray*}
\end{minipage}

Defining a new environment with a parameter makes things easier, because changes to the
length are locally.
\begin{lstlisting}
\newenvironment{mathspace}[1]{%
  \setlength{\jot}{#1}%
  \ignorespaces%
}{%
  \ignorespacesafterend%
}
\end{lstlisting}

\paragraph{\CMD{arraystretch}}\cIndex{arraystretch}
\marginpar{\CMD{arraystretch}}%
The vertical space between the lines for all math expressions which contain an
\verb+array+ environment can be changed with the command
\verb|\arraystretch|, which is predefined
as
\begin{verbatim}
\def\arraystretch{1}
\end{verbatim}

Renewing this definition is global to all following math expressions, so it should be used
in the same way as \verb+\jot+.

\paragraph{\CMD{vskip}}\cIndex{vskip}\index{Vertical spacing}\index{Spacing!vertical}
Another spacing for single lines is possible with the \CMD{vskip} macro:

\begin{LTXexample}[width=0.4\linewidth]
\[
\begin{pmatrix}
0 & 1 & 1 & 0 & 0 & 1 \\
1 & 0 & 0 & 1 & 1 & 0 \\
\noalign{\vskip2pt}
0 & 1 & 1 & 0 & \dfrac{1}{\sqrt{2}} & 1\\
\noalign{\vskip2pt}
1 & 0 & 1 & 0 & 1 & 0 \\
0 & 1 & 0 & 1 & 0 & 1 \\
\end{pmatrix}
\]
\end{LTXexample}



\paragraph{Package \texttt{setspace}}
\PIndex{setspace}
To have all formulas with another vertical spacing, one can choose
the package \verb+setspace+ and redefining some of the math macros, e.g.

\begingroup
\newcommand*\Array[2][1]{\setstretch{#1}\array{#2}}
\let\endArray\endarray

\begin{lstlisting}
\newcommand*\Array[2][1]{\setstretch{#1}\array{#2}}
\let\endArray\endarray
\end{lstlisting}

\begin{showexample}[width=0.25\linewidth]
\[
\begin{Array}[2]{cc}
a =&b\\
a =&b\\
a =&b
\end{Array}
\]

text $\begin{Array}{cc}
a =&b\\
a =&b\\
a =&b
\end{Array}$ text
\end{showexample}
\endgroup

\section{Styles}\label{sec:Styles}

\begin{table}[htb]
\newlength\formula
\settowidth{\formula}{$f(t)=\frac{T}{2\pi }\int \frac{1}{\sin \frac{\omega }{t}}dt$}
\begin{tabular}{l|ll}
Mode & Inline & Displayed\\\hline
default & $f(t)=\frac{T}{2\pi}\int\frac{1}{\sin\frac{\omega}{t}}dt$&
\begin{minipage}{\formula}\[
f(t)=\frac{T}{2\pi}\int\frac{1}{\sin\frac{\omega}{t}}dt\]
\end{minipage}\\
\CMD{displaystyle} &
${\displaystyle f(t)=\frac{T}{2\pi}\int\frac{1}{\sin\frac{\omega}{t}}dt}$&
\begin{minipage}{\formula}\[
{\displaystyle f(t)=\frac{T}{2\pi}\int\frac{1}{\sin\frac{\omega}{t}}dt}\]
\end{minipage}\\
\CMD{scriptstyle} &
${\scriptstyle {\textstyle f(t)=\frac{T}{2\pi}\int\frac{1}{\sin\frac{\omega}{t}}dt}}$&
\begin{minipage}{\formula}\[
{\textstyle {\scriptstyle f(t)=\frac{T}{2\pi}\int\frac{1}{\sin\frac{\omega}{t}}dt}}\]
\end{minipage}\tabularnewline
\CMD{scriptscriptstyle} &
${\scriptscriptstyle f(t)=\frac{T}{2\pi}\int\frac{1}{\sin\frac{\omega}{t}}dt}$&
\begin{minipage}{\formula}\[
{\scriptscriptstyle f(t)=\frac{T}{2\pi}\int\frac{1}{\sin\frac{\omega}{t}}dt}\]
\end{minipage}\tabularnewline
\CMD{textstyle} &
${\textstyle f(t)=\frac{T}{2\pi}\int\frac{1}{\sin\frac{\omega}{t}}dt}$&
\begin{minipage}{\formula}\[
{\textstyle f(t)=\frac{T}{2\pi}\int\frac{1}{\sin\frac{\omega}{t}}dt}\]
\end{minipage}
\end{tabular}
\caption{Math styles}\label{cap:Mathstyles}
\end{table}

\makeatletter
\newenvironment{smallequation}[1]{%
  \skip@=\baselineskip
  #1%
  \baselineskip=\skip@
  \equation
}{\endequation \ignorespacesafterend}
\makeatother

This depends on the environment in which they are used. An inline
formula has a default math %
\marginpar{\CMD{textstyle}\\
\CMD{displaystyle}\\
\CMD{scriptstyle}\\
\CMD{scripscriptstyle}} fontsize called \CMD{textstyle}\index{textstyle@\textbackslash textstyle},
which is smaller than the one for a display formula (see section \ref{display}), which is called
\CMD{displaystyle}\index{displaystyle@\textbackslash displaystyle}.
Beside this predefinition there are two other special fontstyles for
math, \CMD{scriptstyle}\index{scriptstyle@\textbackslash scriptstyle}
and \CMD{scriptscriptstyle}\index{scriptscriptstyle@\textbackslash scriptscriptstyle}.
They are called ``style{}'' in difference to ``size{}'', because
they have a dynamic character, their real fontsize belongs to the
environment in which they are used. A fraction for example is by default in scriptstyle when it is in an
inline formula like this $\frac{a}{b}$, which can be changed to
${\displaystyle \frac{a}{b}}$.
This may be in some cases useful but it looks in general ugly because
the line spacing is too big.
These four styles\index{Style} are predefined and together in a
logical relationship. It is no problem to use the other styles like
\CMD{large}\index{large@\textbackslash large},
\CMD{Large}\index{Large@\textbackslash Large},
... \textbf{outside} the math environment. For example a fraction written with
\CMD{Huge}\index{Huge@\textbackslash Huge}: {\Huge$\frac{a}{b}$}
(\verb|\Huge$\frac{a}{b}$|). This may cause some problems when you want to write
a displayed formula in another fontsize\index{Font size}, because it also affects the interline spacing of
the preceding part of the paragraph.
If you end the paragraph, you get problems with spacing and page breaking
above the equations.  So it is better to declare the font size and then
restore the baselines:
\begin{smallequation}{\tiny}
\int_1^2\,\frac{1}{x^2}\,dx=0.5
\end{smallequation}
\begin{lstlisting}
\makeatletter
\newenvironment{smallequation}[1]{%
  \skip@=\baselineskip
  #1%
  \baselineskip=\skip@
  \equation
}{\endequation \ignorespacesafterend}
\makeatother

\begin{smallequation}{\tiny}
\int_1^2\,\frac{1}{x^2}\,dx=0.5
\end{smallequation}
\end{lstlisting}
If you use this the other way round for huge fontsizes, don't forget to load package
\verb+exscale+ (see section~\vref{sec:exscale}). Also see this section for diffent symbol sizes.



\section{Dots\label{sec:Dots}}

\marginpar{\CMD{cdots}\\
\CMD{dots}\\
\CMD{dotsb}\\
\CMD{dotsc}\\
\CMD{dotsi}\\
\CMD{dotsm}\\
\CMD{dotso}\\
\CMD{ldots}\\
\CMD{vdots}}%
In addition to the above decorations there are some more different
dots which are single commands and not by default over/under a letter.
It is not easy to see the differences between some of them. Dots from
lower left to upper right are possible with \verb|\reflectbox{$\ddots$}|\index{reflectbox@\textbackslash reflectbox}
\reflectbox{$\ddots$}

\begin{table}[htb]
\centering\begin{tabular}{*{5}{rc}}
\CMD{cdots}\index{cdots@\textbackslash cdots}&$\cdots$ &
\CMD{ddots}\index{ddots@\textbackslash ddots}&$\ddots$ &
\CMD{dotsb}\index{dotsb@\textbackslash dotsb}&$\dotsb$ &
\CMD{dotsc}\index{dotsc@\textbackslash dotsc}&$\dotsc$ &
\CMD{dotsi}\index{dotsi@\textbackslash dotsi}&$\dotsi$ \\\hline
\CMD{dotsm}\index{dotsm@\textbackslash dotsm}&$\dotsm$ &
\CMD{dotso}\index{dotso@\textbackslash dotso}&$\dotso$ &
\CMD{ldots}\index{ldots@\textbackslash ldots}&$\ldots$ &
\CMD{vdots}\index{vdots@\textbackslash vdots}&$\vdots$
\end{tabular}
\caption{Dots in math mode}
\end{table}



\section{Accents}\label{sec:Accents}

The letter ``a{}'' is only for demonstration.  The table \ref{cap:Accents-in-math mode}
shows all in standard \LaTeX{} available accents and also the ones placed under a character.
With package \verb|amssymb| it is easy to define new accents. For
more information see section \vref{amssymb}  or
other possibilities at section \vref{sec:package-accent}.


\begin{table}[htb]
\makebox[\textwidth]{%
\begin{tabular}{rc|rc|rc}
\CMD{acute}\index{acute@\textbackslash acute} &$\acute{a}$&
\CMD{bar}\index{bar@\textbackslash bar}&$\bar{a}$&
\CMD{breve}\index{breve@\textbackslash breve} & $\breve{a}$\\
\CMD{bar}\index{bar@\textbackslash bar}&$\bar{a}$&
\CMD{breve}\index{breve@\textbackslash breve} &$\breve{a}$\tabularnewline
\CMD{check}\index{check@\textbackslash check} &$\check{a}$&
\CMD{dddot} \index{dddot@\textbackslash dddot}&$\dddot{a}$&
\CMD{ddot}\index{ddot@\textbackslash ddot}&$\ddot{a}$\tabularnewline
\CMD{dot}\index{dot@\textbackslash dot}&$\dot{a}$&
\CMD{grave}\index{grave@\textbackslash grave}&$\grave{a}$&
\CMD{hat}\index{hat@\textbackslash hat}&$\hat{a}$\tabularnewline
\CMD{mathring}\index{mathring@\textbackslash mathring}&$\mathring{a}$&
\CMD{overbrace}\index{overbrace@\textbackslash overbrace}&$\overbrace{a}$&
\CMD{overleftarrow}\index{overleftarrow@\textbackslash overleftarrow}&$\overleftarrow{a}$\tabularnewline
\CMD{overleftrightarrow}\index{overleftrightarrow@\textbackslash overleftrightarrow}&$\overleftrightarrow{a}$&
\CMD{overline}\index{overline@\textbackslash overline}&$\overline{a}$&
\CMD{overrightarrow}\index{overrightarrow@\textbackslash overrightarrow}&$\overrightarrow{a}$\tabularnewline
\CMD{tilde}\index{tilde@\textbackslash tilde}&$\tilde{a}$&
\CMD{underbar}\index{underbar@\textbackslash underbar}&$\underbar{a}$&
\CMD{underbrace}\index{underbrace@\textbackslash underbrace}&$\underbrace{a}$\tabularnewline
\CMD{underleftarrow}\index{underleftarrow@\textbackslash underleftarrow}&$\underleftarrow{a}$&
\CMD{underleftrightarrow}\index{underleftrightarrow@\textbackslash underleftrightarrow}&
$\underleftrightarrow{a}$&
\CMD{underline}\index{underline@\textbackslash underline}&$\underline{a}$\tabularnewline
\CMD{underrightarrow}\index{underrightarrow@\textbackslash underrightarrow}&$\underrightarrow{a}$&
\CMD{vec}\index{vec@\textbackslash vec}&$\vec{a}$&
\CMD{widehat}\index{widehat@\textbackslash widehat}&$\widehat{a}$\tabularnewline
\CMD{widetilde}\index{widetilde@\textbackslash widetilde}&$\widetilde{a}$ & & & &
\end{tabular}%
}
\caption{Accents in math mode}\label{cap:Accents-in-math mode}
\end{table}

The letters \verb+i+ and \verb+j+ can be substituted with the macros \verb+\imath+ and \verb+\jmath+ when an accents is placed over these letters and the dot should
disappear: $\vec{\imath}\ \dddot{\jmath}$ (\verb+$\vec{\imath}\ \dddot{\jmath}$+).
\index{imath@\textbackslash imath}\index{jmath@\textbackslash jmath}

Accents can be used in different ways, e.g. strike a single character with a horizontal line like
\verb+$\mathaccent`-A$+: $\mathaccent`-A$ or \verb+$\mathaccent\mathcode`-A$+: $\mathaccent\mathcode`-A$.
In section \vref{cancel.sty} is a better solution for more than one character.

\subsection{Over- and underbrackets}
There are no \CMD{underbracket}\index{underbracket@\textbackslash{}underbracket} and \CMD{overbracket}\index{overbracket@\textbackslash{}overbracket}
commands in the list of accents. They can be defined in the preamble
with the following code.

\begin{lstlisting}[xleftmargin=-1cm,xrightmargin=-1cm]
\makeatletter
\def\underbracket{%
	\@ifnextchar[{\@underbracket}{\@underbracket [\@bracketheight]}%
}
\def\@underbracket[#1]{%
	\@ifnextchar[{\@under@bracket[#1]}{\@under@bracket[#1][0.4em]}%
}
\def\@under@bracket[#1][#2]#3{%\message {Underbracket: #1,#2,#3}
	\mathop{\vtop{\m@th \ialign {##\crcr $\hfil \displaystyle {#3}\hfil $%
	\crcr \noalign {\kern 3\p@ \nointerlineskip }\upbracketfill {#1}{#2}
     \crcr \noalign {\kern 3\p@ }}}}\limits}
\def\upbracketfill#1#2{$\m@th \setbox \z@ \hbox {$\braceld$}
                  \edef\@bracketheight{\the\ht\z@}\bracketend{#1}{#2}
                  \leaders \vrule \@height #1 \@depth \z@ \hfill
                  \leaders \vrule \@height #1 \@depth \z@ \hfill \bracketend{#1}{#2}$}
\def\bracketend#1#2{\vrule height #2 width #1\relax}
\makeatother
\end{lstlisting}

\begin{enumerate}
\item \verb/\underbrace{...}/ is an often used command:
\begin{eqnarray}
\underbrace{{x^{2}+2x+1}} & = & f(x)\\
\left(x+1\right)^{2}\,\,\,\nonumber
\end{eqnarray}

\item Sometimes an under\textbf{bracket} is needed, which can be used in
	more ways than \verb/\underbrace{...}/.  An example for \verb/\underbracket{...}/:


\begin{eqnarray*}
\textrm{Hate Science  }& \underbracket[0.5pt]{1\rightarrow2\rightarrow3\rightarrow4}
    \underbracket[0.75pt][0.75em]{\rightarrow5\rightarrow6\rightarrow7}
    \underbracket[1pt][1em]{\rightarrow8\rightarrow9\rightarrow10} & \textrm{Love Science}\\
 & \textrm{low}\hspace{1.5cm}\textrm{medium}\hspace{1.5cm}\textrm{high}
 \end{eqnarray*}


\end{enumerate}

\subsubsection{Use of \CMD{underbracket\{...\}}}

The \verb/\underbracket{...}/ command has two optional parameters:

\begin{itemize}
\item the line thickness in any valid latex unit, e.g. \verb/1pt/
\item the height of the edge brackets, e.g. \verb/1em/
\end{itemize}
using without any parameters gives the same values for thickness and
height as predefined for the \verb/\underbrace/ command.


\vspace{0.3cm}
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
1.& \verb/$\underbracket{foo~bar}$/ & $\underbracket{foo~bar}$ \tabularnewline\hline
2.& \verb/$\underbracket[2pt]{foo~bar}$/ & $\underbracket[2pt]{foo~bar}$ \tabularnewline\hline
3.& \verb/$\underbracket[2pt][1em] {foo~bar}$/& $\underbracket[2pt][1em] {foo~bar}$\tabularnewline\hline
\end{tabular}
\end{center}


\subsubsection{Overbracket}

In addition to the underbracket an overbracket is also useful, which can be used in
more ways than \verb/\overbrace{...}/. For example:


\begin{eqnarray*}
\textrm{Hate Science  }& \overbracket[0.5pt]{1\rightarrow2\rightarrow3\rightarrow4}
    \overbracket[0.75pt][0.75em]{\rightarrow5\rightarrow6\rightarrow7}
    \overbracket[1pt][1em]{\rightarrow8\rightarrow9\rightarrow10} & \textrm{Love Science}\\
 & \textrm{low}\hspace{1.5cm}\textrm{medium}\hspace{1.5cm}\textrm{high}\nonumber
 \end{eqnarray*}


The \verb/\overbracket{...}/ command has two optional parameters:

\begin{itemize}
\item the line thickness in any valid latex unit, e.g. \verb/1pt/
\item the height of the edge brackets, e.g. \verb/1em/
\end{itemize}
using without any parameters gives the same values for thickness and
height as predefined for the \verb/\overbrace/ command.


\vspace{0.3cm}
\begin{center}\begin{tabular}{|c|c|c|}
\hline
1.&\verb/$\overbracket {foo\ bar}$/ & $\overbracket {foo\ bar}$ \tabularnewline\hline
2.&\verb/$\overbracket[2pt] {foo\ bar}$/ &$\overbracket[2pt] {foo\ bar}$ \tabularnewline\hline
3.&\verb/$\overbracket[2pt] [1em] {foo\ bar}$/&$\overbracket[2pt] [1em] {foo\ bar}$\tabularnewline\hline
\end{tabular}
\end{center}


\subsection{Vectors}

Especially for vectors\index{Vector} there is the \verb|esvect.sty|\index{esvect.sty}%
\footnote{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/esvect/}%
	{CTAN://macros/latex/contrib/esvect/}} package, which looks better than the
\CMD{overrightarrow}\index{overrightarrow@\textbackslash overrightarrow}, f.ex:

\begin{table}[htb]
\centering\begin{tabular}{c|c}
\textbackslash{}vv\{...\}&\textbackslash{}overrightarrow\{...\}\tabularnewline\hline
$\vv{a}$ & $\overrightarrow{a}$\tabularnewline
$\vv{abc}$ & $\overrightarrow{abc}$\tabularnewline
$\vv{\imath}$ & $\overrightarrow{\imath}$\tabularnewline
$\vv*{A}{x}$ & $\overrightarrow{A}_{x}$\tabularnewline
\end{tabular}
\caption{Vectors with package \texttt{esvect.sty} (in the right column the
default one from \LaTeX{})}
\end{table}


Look into the documentation for more details about \verb|esvect.sty|.

\section{Exponents and indices}\label{sec:exponents}
The two active characters \verb|_| and \verb|^| can only be used in math mode. The
\textbf{following} character will be printed as an index (\verb|$y=a_1x+a_0$|: $y=a_1x+a_0$)
or as an exponent (\verb|$x^2+y^2=r^2$|: $x^2+y^2=r^2$). For more than the next character
put it inside of \verb|{}|, like \verb|$a_{i-1}+a_{i+1}<a_i$|: $a_{i-1}+a_{i+1}<a_i$.

Especially for multiple exponents \index{Multiple exponents}
there are several possibilities. For example:
\begin{equation}
((x^2)^3)^4 = {({(x^2)}^3)}^4 = {\left({\left(x^2\right)}^3\right)}^4
\end{equation}

\begin{lstlisting}
((x^2)^3)^4 =
{({(x^2)}^3)}^4 =
{\left({\left(x^2\right)}^3\right)}^4
\end{lstlisting}

For variables with both exponent\index{Exponent} and indices index\index{Indices} the order is not important, \verb|$a_1^2$| is
exactly the same than \verb|$a^2_1$|: $a_1^2=a^2_1$


\section{Operators}\label{sec:ltxOperators}

They are written in upright font shape and are placed with some additional
space before and after for a better typesetting. With the \AmSmath
package it is possible to define one's own operators\index{Operator} (see
section \vref{OperatorNames}). Table~\vref{tab:operator} and \vref{tab:operator2} show a list of
the predefined ones for standard \LaTeX{}.

\begin{table}[htb]
\centering
\begin{tabular}{llllll}
\verb+\coprod+  &$\coprod$  &\verb+\bigvee+   &$\bigvee$   &\verb+\bigwedge+&$\bigwedge$\\
\verb+\biguplus+&$\biguplus$&\verb+\bigcap+   &$\bigcap$   &\verb+\bigcup+  &$\bigcup$   \\
\verb+\intop+   &$\intop$   &\verb+\int+      &$\int$      &\verb+\prod+    &$\prod$ \\
\verb+\sum+     &$\sum$     &\verb+\bigotimes+&$\bigotimes$&\verb+\bigoplus+&$\bigoplus$\\
\verb+\bigodot+ &$\bigodot$ &\verb+\ointop+   &$\ointop$   &\verb+\oint+    &$\oint$\\
\verb+\bigsqcup+&$\bigsqcup$&\verb+\smallint+ &$\smallint$
\end{tabular}
\caption{The predefined operators of \texttt{fontmath.ltx}}\label{tab:operator}
\end{table}
The difference between \verb+\intop+ and \verb+\int+ is that the first one has by default
over/under limits and the second subscript/superscript limits. Both can be changed
with the \verb+\limits+ or \verb+\nolimits+ command. The same behaviour happens to the
\verb+\ointop+ and \verb+\oint+ Symbols.

\begin{table}[htb]
\centering
\begin{tabular}{llllll}
\verb+\log+   & $\log$    &\verb+\lg+     & $\lg$      &\verb+\ln+     & $\ln$     \\
\verb+\lim+   & $\lim$    &\verb+\limsup+ & $\limsup$  &\verb+\liminf+ & $\liminf$ \\
\verb+\sin+   & $\sin$    &\verb+\arcsin+ & $\arcsin$  &\verb+\sinh+   & $\sinh$   \\
\verb+\cos+   & $\cos$    &\verb+\arccos+ & $\arccos$  &\verb+\cosh+   & $\cosh$   \\
\verb+\tan+   & $\tan$    &\verb+\arctan+ & $\arctan$  &\verb+\tanh+   & $\tanh$   \\
\verb+\cot+   & $\cot$    &\verb+\coth+   & $\coth$    &\verb+\sec+    & $\sec$    \\
\verb+\csc+   & $\csc$    &\verb+\max+    & $\max$     &\verb+\min+    & $\min$    \\
\verb+\sup+   & $\sup$    &\verb+\inf+    & $\inf$     &\verb+\arg+    & $\arg$    \\
\verb+\ker+   & $\ker$    &\verb+\dim+    & $\dim$     &\verb+\hom+    & $\hom$    \\
\verb+\det+   & $\det$    &\verb+\exp+    & $\exp$     &\verb+\Pr+     & $\Pr$     \\
\verb+\gcd+   & $\gcd$    &\verb+\deg+    & $\deg$     &\verb+\bmod+   & $\bmod$   \\
\verb+\pmod{a}+& $\pmod{a}$
\end{tabular}
\caption{The predefined operators of \texttt{latex.ltx}}\label{tab:operator2}
\end{table}


\makeatletter
\newcommand\foo{\mathop{\operator@font foo}\nolimits}
\makeatother
For more predefined operator names see table~\vref{tab:amsopn}. It is easy to define a new operator with
\begin{lstlisting}
\makeatletter
\newcommand\foo{\mathop{\operator@font foo}\nolimits}
\makeatother
\end{lstlisting}

Now you can use \verb|\foo| in the usual way:
\begin{showexample}[width=4cm]
\[ \foo_1^2 = x^2 \]
\end{showexample}
In this example \verb|\foo| is defined with \verb|\nolimits|, means that limits\index{Limits} are placed in
superscript/subscript mode and not over under. This is still possible with \verb|\limits| in the
definition or the equation:
\begin{showexample}[width=4cm]
\[ \foo\limits_1^2 = x^2 \]
\end{showexample}

\AmSmath has an own macro for a definition, have a look at section \vref{OperatorNames}.


\section{Greek letters}\label{sec:greek}
The \AmSmath package simulates a bold font for the greek letters, it writes a greek character twice with a small kerning.  The \verb|\mathbf{<character>}| doesn't work with lower greek character. See
section \vref{sec:greek-AMS} for the \verb|\pmb| macro, which makes it possible to print bold lower greek\index{Greek} letters. Not all upper case letters have own macro names. If there is no difference to the roman font, then the default letter is used, e.g.: A for the upper case of
$\alpha$. Table \ref{tab:greek-letters} shows only those upper case letters which have own macro names. Some of the lower case letters have an additional \verb|var| option for
an alternative.

\bgroup
\tabcolsep=3pt
\begin{longtable}{lclccc}
lower & default &  upper & default & \verb|\mathbf| & \verb|\mathit|\\\hline
\endhead
\verb|\alpha| & $\alpha$ \\
\verb|\beta|  & $\beta$  \\
\verb|\gamma| & $\gamma$
	& \verb|\Gamma| & $\Gamma$ & $\mathbf{\Gamma}$ & $\mathit{\Gamma}$\\
\verb|\delta| & $\delta$
	& \verb|\Delta| & $\Delta$ & $\mathbf{\Delta}$ & $\mathit{\Delta}$\\
\verb|\epsilon|  & $\epsilon$\\
\verb|\varepsilon|  & $\varepsilon$\\
\verb|\zeta|  & $\zeta$\\
\verb|\eta|  & $\eta$ \\
\verb|\theta|  & $\theta$
	& \verb|\Theta| & $\Theta$ & $\mathbf{\Theta}$ & $\mathit{\Theta}$\\
\verb|\vartheta|  & $\vartheta$\\
\verb|\iota|  & $\iota$\\
\verb|\kappa|  & $\kappa$\\
\verb|\delta| & $\lambda$
	& \verb|\Lambda| & $\Lambda$ & $\mathbf{\Lambda}$ & $\mathit{\Lambda}$\\
\verb|\mu|  & $\mu$ \\
\verb|\nu|  & $\nu$\\
\verb|\xi|  & $\xi$
	& \verb|\Xi| & $\Xi$ & $\mathbf{\Xi}$ & $\mathit{\Xi}$\\
\verb|\pi|  & $\pi$
	& \verb|\Pi| & $\Pi$ & $\mathbf{\Pi}$ & $\mathit{\Pi}$\\
\verb|\varpi|  & $\varpi$ \\
\verb|\rho|  & $\rho$\\
\verb|\varrho|  & $\varrho$\\
\verb|\sigma| & $\sigma$
	& \verb|\Sigma| & $\Sigma$ & $\mathbf{\Sigma}$ & $\mathit{\Sigma}$\\
\verb|\varsigma| & $\varsigma$\\
\verb|\tau|  & $\tau$\\
\verb|\upsilon|  & $\upsilon$
	& \verb|\Upsilon| & $\Upsilon$ & $\mathbf{\Upsilon}$ & $\mathit{\Upsilon}$\\
\verb|\phi|  & $\phi$
	& \verb|\Phi| & $\Phi$ & $\mathbf{\Phi}$ & $\mathit{\Phi}$\\
\verb|\varphi|  & $\varphi$\\
\verb|\chi|  & $\chi$ \\
\verb|\psi|  & $\psi$
	& \verb|\Psi| & $\Psi$ & $\mathbf{\Psi}$ & $\mathit{\Psi}$\\
\verb|\omega| & $\omega$
	& \verb|\Omega| & $\Omega$ & $\mathbf{\Omega}$ & $\mathit{\Omega}$\\[5pt]
\caption{The greek letters}\label{tab:greek-letters}\\
\end{longtable}
\egroup

Bold greek letters are possible with the package \verb+bm+ (see section \vref{sec:bm})
and if they should also be upright with the package \verb+upgreek+:
\index{greek}\index{greek!upright}\index{greek!bold}

\medskip
\verb+$\bm{\upalpha}, \bm{\upbeta} ... $+ $ \bm{\upalpha}, \bm{\upbeta} ... $




\section{Pagebreaks}
\marginpar{\CMD{allowdisplaybreaks}}By default a displayed formula cannot have a pagebreak. This makes some sense, but sometimes it gives a better typesetting when a pagebreak is possible.

\begin{verbatim}
\allowdisplaybreaks
\end{verbatim}

\index{allowdisplaybreaks@\textbackslash allowdisplaybreaks} This macro enables \TeX{} to insert pagebreaks into displayed formulas whenever a newline command appears.\index{Pagebreak} With the command \verb+\displaybreak+ it is also possible to insert a pagebreak at any place.\index{displaybreak@\textbackslash displaybreak}

\section{\CMD{stackrel}}

\CMD{stackrel}\index{stackrel@\textbackslash stackrel}
puts a character on top of another one which may be important if a
used symbol is not predefined. For example ``$\stackrel{\wedge}{=}$''
(\verb|\stackrel{\wedge}{=}|).
The syntax is


\begin{lstlisting}
\stackrel{top}{base}
\end{lstlisting}
Such symbols may be often needed so that a macro  definition in the preamble makes some sense:

\begin{lstlisting}
\newcommand{\eqdef}{%
	\ensuremath{%
		\stackrel{\mathrm{def}}{=}%
	}%
}
\end{lstlisting}
With the \CMD{ensuremath}\index{ensuremath@\textbackslash ensuremath}
command we can use the new \CMD{eqdef} command in text
and in math mode, \LaTeX{} switches automatically in math mode, which
saves some keystrokes like the following command, which is written
without the delimiters (\texttt{\$...\$}) for the math mode \eqdef ,
only \CMD{eqdef} with a space at the end. In math mode
together with another material it may look like $\vec{x}\eqdef\left(x_{1},\ldots,x_{n}\right)$ and as command sequence

\begin{lstlisting}
$\vec{x}\eqdef\left(x_{1},\ldots,x_{n}\right)$
\end{lstlisting}

The fontsize of the top is one size smaller than the one from the
base, but it is no problem to get both the same size, just increase the
top or decrease the base.

\section{\CMD{choose}}

\CMD{choose}\index{choose@\textbackslash choose}\index{Binom}
is like \CMD{atop}\index{atop@\textbackslash atop}
with delimiters or like \CMD{frac}\index{frac@\textbackslash frac}
without the fraction line and also with delimiters. It is often used
for binoms and has the following syntax:

\begin{lstlisting}
{above \choose below}
\end{lstlisting}
The two braces are not really important but it is safe to use them.

\begin{equation}
{{m+1 \choose n}}={{m \choose n}}+{{m \choose k-1}}\label{eq:choose}
\end{equation}

\begin{lstlisting}
{{m+1 \choose n}}={{m \choose n}}+{{m \choose k-1}}\label{eq:choose}
\end{lstlisting}


See section \vref{sub:Binoms} for the \AmSmath equivalents and enhancements.

\section{Color in math expressions}\label{sec:color}
\index{Color}There is no difference in using colored text and colored math expressions. With
\begin{verbatim}
\usepackage{color}
\end{verbatim}

\noindent in the preamble the macro \verb|\textcolor{<color>}{<text or math>}| exists.
\begin{equation}
\textcolor{blue}{f(x)} = \int\limits_1^{\infty}\textcolor{red}{\frac{1}{x^2}}\,dx=1
\end{equation}

\begin{lstlisting}
\begin{equation}
\textcolor{blue}{f(x)} = \int\limits_1^{\infty}\textcolor{red}{\frac{1}{x^2}}\,dx=1
\end{equation}
\end{lstlisting}

If all math expressions should be printed in the same color, then it is better
to use the \verb+everydisplay+ macro (section~\vref{sec:other}).


\section{Boldmath}\label{sec:boldmath}

\marginpar{\CMD{mathversion}\\\CMD{boldmath}\\\CMD{unboldmath}}%
Writing a whole formula in bold\index{boldmath@\textbackslash boldmath} is possible with the command sequence
\verb|\boldmath ... \unboldmath|, which itself must be written in textmode (outside the
formula) or with the command \verb+{\mathversion{bold} ... }+.
\index{mathversion@\textbackslash mathversion}\index{boldmath@\textbackslash
boldmath}\index{unboldmath@\textbackslash unboldmath}

\noindent\begin{minipage}{0.49\linewidth}
\[
\sum_{%
	\makebox[0pt]{$%
		{{\scriptscriptstyle 1\le j\le p\atop {%
		{1\le j\le q\atop 1\le k\le r}}}}%
	$}%
	}a_{ij}b_{jk}c_{ki}
\]
\end{minipage}\hfill
\begin{minipage}{0.49\linewidth}
\boldmath
\[
\sum_{%
	\makebox[0pt]{$%
		{{\scriptscriptstyle 1\le j\le p\atop {%
		{1\le j\le q\atop 1\le k\le r}}}}%
	$}%
	}a_{ij}b_{jk}c_{ki}
\]
\unboldmath
\end{minipage}

\medskip
\begin{lstlisting}
\boldmath
\[
\sum_{%
	\makebox[0pt]{$%
		{{\scriptscriptstyle 1\le j\le p\atop {%
		{1\le j\le q\atop 1\le k\le r}}}}%
	$}%
	}a_{ij}b_{jk}c_{ki}
\]
\unboldmath
\end{lstlisting}

The \verb+\mathversion+ macro defines a math style which is valid for all following
math expressions. If you want to have all math in bold then use this macro instead of
\verb+\boldmath+. But it is no problem to put \verb+\mathversion+ inside a group to hold
the changes locally.

{\mathversion{bold}%
\begin{equation}
y(x) = ax^3+bx^2+cx+d
\end{equation}}

\begin{lstlisting}
{\mathversion{bold}%
\begin{equation}
y(x) = ax^3+bx^2+cx+d
\end{equation}}
\end{lstlisting}


Single characters inside a formula can be written in bold with \verb|mathbf|, but only in upright mode, which is in general not useful as shown in equation~\ref{eq:bold}. It is better
to use package \verb|bm.sty| (see section \vref{sec:bm}).

\begin{equation}\label{eq:bold}
\sum_{%
	\makebox[0pt]{$%
		{{\scriptscriptstyle 1\le j\le p\atop {%
		{1\le j\le q\atop 1\le k\le r}}}}%
	$}%
	}a_{ij}\mathbf{b_{jk}}c_{ki}
\end{equation}

\subsection[Bold math titles and items]{Bold math expressions as part of titles and items}\label{sec:titleItem}
By default the titles in sections, subsections, a.s.o. are printed in bold. Same for the
\verb|description| environment. The problem is that a math expression in one of these
environments is printed in default font shape, like the following example for a \verb|section| and
\verb|description| environment:

\medskip
\fbox{%
\begin{minipage}{.75\linewidth}
\section*{\thesection\ Function $f(x)=x^2$}
\begin{description}
\item[This is $y=f(x)$] Only a demonstration.
\item[And $z=f(x,y)$] Another demonstration.
\end{description}
\end{minipage}%
}

\medskip
With a redefinition of the \verb|section| and \verb|item| macros it is possible to get everything in bold font.

\medskip
\fbox{%
\begin{minipage}{.75\linewidth}
\let\itemOld\item
\makeatletter
\renewcommand\item[1][]{%
    \def\@tempa{#1}
    \ifx\@tempa\@empty\itemOld\else\boldmath\itemOld[#1]\unboldmath\fi%
}
\makeatother
\section*{\thesection\ \boldmath Function $f(x)=x^2$\unboldmath}
\begin{description}
\item[This is $y=f(x)$] Only a demonstration.
\item[And $z=f(x,y)$] Another demonstration.
\end{description}
\end{minipage}%
}


\medskip
\begin{lstlisting}
\let\itemOld\item
\makeatletter
\renewcommand\item[1][]{%
    \def\@tempa{#1}
    \ifx\@tempa\@empty\itemOld\else\boldmath\itemOld[#1]\unboldmath\fi%
}
\makeatother
\let\sectionOld\section
\renewcommand\section[2][\empty]{%
	\boldmath\sectionOld[#1]{#2}\unboldmath%
}
\end{lstlisting}

\section{Multiplying numbers}
When the dot is used as the decimal marker as in the United States, the preferred sign
for the multiplication of
numbers or values of quantities is a cross (\verb|\times| $\times$ ), not a half-high and
centered dot (\verb|\cdot| $\cdot$ ).

When the comma is used as the decimal marker as in Europe, the preferred sign for the
multiplication of
numbers is the half-high dot. The multiplication of quantity symbols (or numbers in
parentheses or values of
quantities in parentheses) may be indicated in one of the following ways: $ab$,
$a\cdot b$, $a\times b$.

For more information see ``Nist Guide to SI Units -More on Printing and Using Symbols and
Numbers in Scientific and
Technical Documents''\footnote{\url{http://physics.nist.gov/Pubs/SP811/sec10.html}} or
the German DIN 1304, Teil 1.


\section{Other macros}\label{sec:other}
\marginpar{\CMD{everymath}\\\CMD{everydisplay}\\\CMD{underline}}%
There are some other macros which are not mentioned in the foregoing text. Here comes
a not really complete list of these macros.
\begin{description}
\item[\CMD{everymath}] \index{everymath@\textbackslash everymath} puts the argument before
any inlined math expression, e.g. \verb+\everymath{\small}+.
\item[\CMD{everydisplay}] \index{everydisplay@\textbackslash everydisplay} puts  the
argument before any displayed math expression, e.g. \verb+\everydisplay{\color{blue}}+.
\item[\CMD{underline}] \index{underline@\textbackslash underline} underlines a math
expression and has to be used inside the math mode.
\[
\underline{F(x)=\int f(x)\,dx}
\]
\end{description}



\part{\texorpdfstring{\AmSmath}{amsmath} package}\label{par:AMSmath-package}

In general the \AmS packages are at least a collection of three different ones:
\begin{enumerate}
\item \verb|amsmath.sty|
\item \verb|amssymb.sty|
\item \verb|amsfonts.sty|
\end{enumerate}
In the following only the first one is described in detail.

The \AmSmath has the following options:

\bigskip\noindent
\begin{tabularx}{\linewidth}{@{}lX@{}}
\verb+centertags+\index{centertags} & (default) For a split equation, place
equation numbers vertically centered on the total height of the equation.\\\hline
\verb+tbtags+\index{tbtags} & `Top-or-bottom tags' For a split equation,
place equation numbers level with the last (resp. first) line, if
numbers are on the right (resp. left).\\\hline
\verb+sumlimits+\index{sumlimits} & (default) Place the subscripts and superscripts
of summation symbols above and below, in displayed equations. This
option also affects other symbols of the same type -- $\prod$, $\coprod$,
$\bigotimes$, $\bigoplus$, and so forth -- but excluding integrals
(see below).\\\hline
\verb+nosumlimits+\index{nosumlimits} & Always place the subscripts and
superscripts of summation-type symbols to the side, even in displayed
equations.\\\hline
\verb+intlimits+\index{intlimits} & Like sumlimits, but for integral symbols.\\\hline
\verb+nointlimits+\index{nointlimits} & (default) Opposite of intlimits.\\\hline
\verb+namelimits+\index{namelimits} & (default) Like sumlimits, but for
certain `operator names' such as \verb+det+, \verb+inf+, \verb+lim+, \verb+max+, \verb+min+, that traditionally
have subscripts placed underneath when they occur in a displayed equation.\\\hline
\verb+nonamelimits+\index{nonamelimits} & Opposite of namelimits.\\\hline
\end{tabularx}
\bigskip

To use one of these package options, put the option name in the optional
argument, e.g.,
\verb|\usepackage[intlimits]{amsmath}|. The   %%% ----- Martin -----
\AmSmath also recognises the following options which are normally
selected (implicitly or explicitly) through the \verb|documentclass|
command, and thus need not be repeated in the option list of the \verb|\usepackage{amsmath}| statement.    %%% ----- Martin -----

\bigskip\noindent
\begin{tabularx}{\linewidth}{@{}lX@{}}
\verb+leqno+\index{leqno} & Place equation numbers on the left.\\\hline
\verb+reqno+\index{reqno} & (default) Place equation numbers on the right.\\\hline
\verb+fleqn+\index{fleqn} & Position equations at a fixed indent from the
left margin rather than centered in the text column. \AmSmath defines the
length \CMD{mathindent} and uses it when the equations have only one
tabbing character (\verb+&+).\index{mathindent@\textbackslash mathindent}\\\hline
\end{tabularx}

\bigskip\noindent All math environments are displayed ones, so  there is no special inline
math.

\section{\texttt{align} environments}

There are four different align environments, described in the following
subsections. Their behaviour is shown in table \ref{cap:align}. The
code for all align environments was:

\begin{lstlisting}
\begin{<name>}
   <name> &= x & x &= x\\
   <name> &= x & x &= x
\end{<name>}
\end{lstlisting}

\begin{table}[htb]
\begin{align*}
\framebox[0.125\columnwidth]{align} &= \framebox[0.125\columnwidth]{x} & \framebox[0.125\columnwidth]{x}&= & \framebox[0.125\columnwidth]{x}\\
\framebox[0.125\columnwidth]{align}&= \framebox[0.1\columnwidth]{x} & \framebox[0.1\columnwidth]{x} &= \framebox[0.1\columnwidth]{x}
\end{align*}

\begin{alignat*}{2}
\framebox[0.125\columnwidth]{alignat} &= \framebox[0.125\columnwidth]{x} & \framebox[0.125\columnwidth]{x} &= \framebox[0.125\columnwidth]{x}\\
\framebox[0.125\columnwidth]{alignat} &= \framebox[0.1\columnwidth]{x} & \framebox[0.1\columnwidth]{x} &= \framebox[0.1\columnwidth]{x}
\end{alignat*}

\begin{flalign*}
\framebox[0.125\columnwidth]{flalign} &= \framebox[0.125\columnwidth]{x} & \framebox[0.125\columnwidth]{x} &= \framebox[0.125\columnwidth]{x}\\
\framebox[0.125\columnwidth]{flalign} &= \framebox[0.1\columnwidth]{x} & \framebox[0.1\columnwidth]{x} &= \framebox[0.1\columnwidth]{x}
\end{flalign*}

\begin{xalignat*}{2}
\framebox[0.125\columnwidth]{xalignat} &= \framebox[0.125\columnwidth]{x} & \framebox[0.125\columnwidth]{x} &= \framebox[0.125\columnwidth]{x}\\
\framebox[0.125\columnwidth]{xalignat} &= \framebox[0.1\columnwidth]{x} & \framebox[0.1\columnwidth]{x} &= \framebox[0.1\columnwidth]{x}
\end{xalignat*}

\begin{xxalignat}{2}
\framebox[0.125\columnwidth]{xxalignat} &= \framebox[0.125\columnwidth]{x} & \framebox[0.125\columnwidth]{x} &= \framebox[0.125\columnwidth]{x}\\
\framebox[0.125\columnwidth]{xxalignat} &= \framebox[0.1\columnwidth]{x} & \framebox[0.1\columnwidth]{x} &= \framebox[0.1\columnwidth]{x}
\end{xxalignat}

\caption{Comparison between the different align environments
with the same code, where the first three can have an equation number}\label{cap:align}
\end{table}

In difference to the \verb+eqnarray+ environment from standard \LaTeX{} 
(section~\ref{display:eqnarray}),  the ``three'' parts
of one equation \verb+expr.-symbol-expr.+ are divided by only one ampersand    %%% ----- Martin -----
in two parts. In general the ampersand should be before the symbol to get the right spacing, e.g.
\verb+y &= x+. Compare the following three equations, the second one has a wrong spacing.    %%% ----- Martin -----


\begin{minipage}{0.4\linewidth}
\begin{align}
\rnode[lt]{a}{y} &= \rnode[rt]{A}{x}
\end{align}
\vspace*{-3\abovedisplayskip}
\begin{align}
y =& x
\end{align}
\vspace*{-3\abovedisplayskip}
\begin{align}
\rnode[lb]{b}{y} ={}& \rnode[rb]{B}{x}
\end{align}
\ncline[nodesep=-10pt,linewidth=0.1pt]{A}{B}
\ncline[nodesepA=-11pt,nodesepB=-10pt,linewidth=0.1pt]{a}{b}
\end{minipage}
\hfill\begin{minipage}{0.4\linewidth}
\begin{lstlisting}
  y &= x
  y =& x
  y ={}& x
\end{lstlisting}
\end{minipage}

\subsection{The default \texttt{align} environment}

The \texttt{eqnarray} environment has a not so good spacing between
the cells. Writing the equations no. \ref{eq:2} to \ref{eq:5} with
the \texttt{align} environment gives:

\begin{align}
	y & =d\label{eq:IntoSection}\\
	y & =cx+d\\
	y_{12} & =bx^{2}+cx+d\\
	y(x) & =ax^{3}+bx^{2}+cx+d
\end{align}

\noindent The code looks like:
\begin{lstlisting}
\begin{align}
	y & =d\label{eq:IntoSection}\\
	y & =cx+d\\
	y_{12} & =bx^{2}+cx+d\\
	y(x) & =ax^{3}+bx^{2}+cx+d
\end{align}
\end{lstlisting}

\begin{itemize}
\item The \texttt{align} environment has an implicit \textbf{\{rlrl...\}}
horizontal alignment with a vertical column-alignment, e.g.:
\begin{showexample}[width=0.5\linewidth]
\begin{align*}
  1 & 2 & 3
\end{align*}
\end{showexample}

\item A nonumber-version \texttt{\small \textbackslash{}begin\{align{*}\}...\textbackslash{}end\{align{*}\}}
exists.
\item Unnumbered single rows are possible with \CMD{nonumber}.    %%% ----- Martin -----
\item The \texttt{align} environment takes the whole horizontal space if
you have more than two columns:
\begin{align}
y & =d & z & =1\\
y & =cx+d & z & =x+1\\
y_{12} & =bx^{2}+cx+d & z & =x^{2}+x+1\nonumber \\
y(x) & =ax^{3}+bx^{2}+cx+d & z & =x^{3}+x^{2}+x+1
\end{align}

\end{itemize}
The code for this example looks like%
\begin{lstlisting}
\begin{align}
	y & =d & z & =1\\
	y & =cx+d & z & =x+1\\
	y_{12} & =bx^{2}+cx+d & z & =x^{2}+x+1\nonumber \\
	y(x) & =ax^{3}+bx^{2}+cx+d & z & =x^{3}+x^{2}+x+1
\end{align}
\end{lstlisting}

\subsection{\texttt{alignat} environment\label{sec:alignat environment}}
\marginpar{\CMD{begin\{align\}\\...\\\CMD{end\{align\}}}}
\renewcommand{\theequation}{%
  \thepart-\arabic{equation}%
}

\begin{leftbar}
>From now the counting of the equation changes. It is introduced with a foregoing command,
which doesn't really make sense, it is only for demonstration:\\
\verb|\renewcommand{\theequation}{\thepart-\arabic{equation}}|.
\end{leftbar}


This means  ``align at several places{}'' and is something like
more than two \verb+align+ environment side by side.
Parameter is the number of the \verb+align+ environments, which
is not important for the user. The
above last \verb+align+ example looks like:

\begin{alignat}{2}
y & =d & z & =1\label{eq:newCounting}\\
y & =cx+d & z & =x+1\\
y_{12} & =bx^{2}+cx+d & z & =x^{2}+x+1\nonumber \\
y(x) & =ax^{3}+bx^{2}+cx+d\quad & z & =x^{3}+x^{2}+x+1\end{alignat}


The parameter was 2 and it is 3 for the following example:    %%% ----- Martin -----

\begin{alignat}{3}
i_{11} & =0.25 & i_{12} & =i_{21} & i_{13} & =i_{23}\nonumber \\
i_{21} & =\frac{1}{3}i_{11} & i_{22} & =0.5i_{12} & i_{23} & =i_{31}\\
i_{31} & =0.33i_{22}\quad & i_{32} & =0.15i_{32}\quad & i_{33} & =i_{11}\end{alignat}


For this example the code is:
\begin{lstlisting}[xleftmargin=-1cm,xrightmargin=-1.5cm]
\begin{alignat}{3}
  i_{11} & =0.25 & i_{12} & =i_{21} & i_{13} & =i_{23}\nonumber\\
  i_{21} & =\frac{1}{3}i_{11} & i_{22} & =0.5i_{12}& i_{23} & =i_{31}\\
  i_{31} & =0.33i_{22}\quad & i_{32} & =0.15i_{32}\quad & i_{33} & =i_{11}
\end{alignat}
\end{lstlisting}

With the \verb+alignat+ environment one can easily align equations vertically
at more than one marker:

\begin{alignat}{3}
   abc &= xxx             &&= xxxxxxxxxxxx &&= aaaaaaaaa \\
   ab  &= yyyyyyyyyyyyyyy &&= yyyy         &&= ab
\end{alignat}
\begin{lstlisting}
\begin{alignat}{3}
   abc &= xxx             &&= xxxxxxxxxxxx &&= aaaaaaaaa \\
   ab  &= yyyyyyyyyyyyyyy &&= yyyy         &&= ab
\end{alignat}
\end{lstlisting}




\begin{itemize}
\item The \texttt{alignat} environment has an implicit \{rlrl...rlrl\}
horizontal alignment with a vertical column alignment.
\item A nonumber-version \texttt{\small
\textbackslash{}begin\{alignat{*}\}...\textbackslash{}end\{alignat{*}\}}
exists.
\item Unnumbered single rows are possible with \CMD{nonumber}.    %%% ----- Martin -----
\end{itemize}

\subsection{\texttt{flalign} environment}\label{ams:flalign}
\marginpar{\CMD{begin\{flalign\}\\...\\\CMD{end\{flalign\}}}}This is the new replacement for the \texttt{xalignat} and \texttt{xxalignat}
environments. It is nearly the same as the  \texttt{xalignat} environment, only
more ``out spaced'' and ``left aligned''. 

\begin{showexample}[width=0.5\linewidth]
\begin{flalign}
i_{11} & =0.25\nonumber \\
i_{21} & =\frac{1}{3}i_{11}\\
i_{31} & =0.33i_{22}
\end{flalign}
\end{showexample}

\medskip
As seen, the equations are not really left aligned, when they have only one
ampersand. In this case \verb+flalign+ has the same behaviour as the \verb+align+
environment.


When there are more than one tabbing characters (\verb+&+), then the equations are
really left aligned. This is also an easy way to get an equation with only one
ampersand left aligned, see equation \ref{eq:leftaligned} below.
\begin{flalign}
i_{11} & =0.25 & i_{12} & =i_{21} & i_{13} & =i_{23}\nonumber \\
i_{21} & =\frac{1}{3}i_{11} & i_{22} & =0.5i_{12} & i_{23} & =i_{31}\\
i_{31} & =0.33i_{22} & i_{32} & =0.15i_{32} & i_{33} & =i_{11}
\end{flalign}
The code looks like:

\begin{lstlisting}[xleftmargin=-1cm,xrightmargin=-1.5cm]
\begin{flalign}
  i_{11} & =0.25 & i_{12} & =i_{21} & i_{13} & =i_{23}\nonumber\\
  i_{21} & =\frac{1}{3}i_{11} & i_{22} & =0.5i_{12}& i_{23} & =i_{31}\\
  i_{31} & =0.33i_{22}\quad & i_{32} & =0.15i_{32}\quad & i_{33} & =i_{11}
\end{flalign}
\end{lstlisting}

\medskip
This environment can be used to mix centered and left aligned\index{Left aligned}
equations without
using the document wide valid option \verb|fleqn|.
\begin{align}\label{eq:centered}
	f(x) & = \int\frac{1}{x^2}\,dx
\end{align}

\begin{flalign}\label{eq:leftaligned}
	f(x) & = \int\frac{1}{x^2}\,dx &
\end{flalign}
Equation \ref{eq:leftaligned} is left aligned in fact of the second tabbing
character \verb|&|.

\begin{lstlisting}
\begin{align}\label{eq:centered}
	f(x) & = \int\frac{1}{x^2}\,dx
\end{align}

\begin{flalign}\label{eq:leftaligned}
	f(x) & = \int\frac{1}{x^2}\,dx &
\end{flalign}
\end{lstlisting}

Another case is placing text left aligned, whereas the formulas should be right aligned.

\begin{flalign*}
                && 12(x-1)+20(y-3)+14(z-2) &= 0\\
\text{same as } &&               6x+10y+7z &= 0
\end{flalign*}

\begin{lstlisting}
\begin{flalign*}
                && 12(x-1)+20(y-3)+14(z-2) &= 0\\
\text{same as } &&               6x+10y+7z &= 0
\end{flalign*}
\end{lstlisting}


\subsection{\texttt{xalignat} environment}
\marginpar{\CMD{begin\{xalignat\}\\...\\\CMD{end\{xalignat\}}}}%
This is an obsolete macro but still supported by the \AmSmath package.
Same as \texttt{alignat} environment, only a little more ``out spaced{}''.
\begin{xalignat}{3}
i_{11} & =0.25 & i_{12} & =i_{21} & i_{13} & =i_{23}\nonumber \\
i_{21} & =\frac{1}{3}i_{11} & i_{22} & =0.5i_{12} & i_{23} & =i_{31}\\
i_{31} & =0.33i_{22} & i_{32} & =0.15i_{32} & i_{33} & =i_{11}
\end{xalignat}
The same code looks like:

\begin{lstlisting}[xleftmargin=-1cm,xrightmargin=-1.5cm]
\begin{xalignat}{3}
  i_{11} & =0.25 & i_{12} & =i_{21} & i_{13} & =i_{23}\nonumber\\
  i_{21} & =\frac{1}{3}i_{11} & i_{22} & =0.5i_{12}& i_{23} & =i_{31}\\
  i_{31} & =0.33i_{22}\quad & i_{32} & =0.15i_{32}\quad & i_{33} & =i_{11}
\end{xalignat}
\end{lstlisting}

\subsection{\texttt{xxalignat} environment}
\marginpar{\CMD{begin\{xxalignat\}\\...\\\CMD{end\{xxalignat\}}}}%
Like \texttt{xalignat}  an obsolete macro but still supported by the \AmSmath package.
Same as \texttt{align} environment, only extremely ``out spaced{}'',
therefore no equation number!
\begin{xxalignat}{3}
i_{11} & =0.25 & i_{12} & =i_{21} & i_{13} & =i_{23}\\
i_{21} & =\frac{1}{3}i_{11} & i_{22} & =0.5i_{12} & i_{23} & =i_{31}\\
i_{31} & =0.33i_{22} & i_{32} & =0.15i_{32} & i_{33} & =i_{11}
\end{xxalignat}
The same code looks like:

\begin{lstlisting}[xleftmargin=-1cm,xrightmargin=-1.5cm]
\begin{xxalignat}{3}
  i_{11} & =0.25 & i_{12} & =i_{21} & i_{13} & =i_{23}\nonumber\\
  i_{21} & =\frac{1}{3}i_{11} & i_{22} & =0.5i_{12}& i_{23} & =i_{31}\\
  i_{31} & =0.33i_{22} & i_{32} & =0.15i_{32} & i_{33} & =i_{11}
\end{xxalignat}
\end{lstlisting}

\subsection{\texttt{aligned} environment}\label{sec:aligned}
\marginpar{\CMD{begin\{aligned\}\\...\\\CMD{end\{aligned\}}}}In difference to the \verb|split| environment (section \vref{split})\index{Split equation}, the \verb|aligned| environment allows more than one horizontal alignment but has also only one equation number:
\begin{equation}
\begin{aligned}
    2x+3 &= 7  &     2x+3-3 &=7-3    \\
    2x   &= 4  & \frac{2x}2 &=\frac42\\
    x    &= 2
\end{aligned}
\end{equation}

\begin{lstlisting}
\begin{equation}
\begin{aligned}
    2x+3 &= 7  &     2x+3-3 &= 7-3    \\
    2x   &= 4  & \frac{2x}2 &= \frac42\\
    x    &= 2
\end{aligned}
\end{equation}
\end{lstlisting}

The \verb|aligned| environment is similar to the \verb|array|\index{array} environment, there exists no
starred version and it has only one equation number and has to be part of another math environment, which should be \verb|equation| environment. The advantage of \verb|aligned| is the much
 better horizontal and vertical spacing.    %%% ----- Martin -----


\subsection{Problems}
When using one of the \verb+align+ environments, there should be no \verb+\\+ at the
end of the last line, otherwise you'll get another equation number for this  ``empty{}'' line:    %%% ----- Martin -----

\begin{showexample}[width=0.65\linewidth]
\begin{align}
    2x+3 &= 7\\
\end{align}
\end{showexample}

\begin{showexample}[width=0.65\linewidth]
\begin{align}
    2x+3 &= 7
\end{align}
\end{showexample}
\section{Other environments}

\subsection{\texttt{gather} environment}
\marginpar{\CMD{begin\{gather\}\\...\\\CMD{end\{gather\}}}}
This is like a multi line environment with no special horizontal alignment.
All rows are centered and can have an own equation number:
\begin{gather}
i_{11}=0.25\\
i_{21}=\frac{1}{3}i_{11}\nonumber \\
i_{31}=0.33i_{22}
\end{gather}
For this example the code looks like:
\begin{lstlisting}
\begin{gather}
  i_{11} = 0.25\\
  i_{21} = \frac{1}{3}i_{11}\nonumber\\
  i_{31} =0.33i_{22}
\end{gather}
\end{lstlisting}

\begin{itemize}
\item The \texttt{gather}\index{gather} environment has an implicit \texttt{\{c\}}
horizontal alignment with no vertical column alignment. It is just
like an one column array/table.
\item A nonumber-version \texttt{\small \textbackslash{}begin\{gather{*}\}...\textbackslash{}end\{gather{*}\}}
exists.
Look at section \vref{split} for an example.
\end{itemize}

\subsection{\texttt{multline} environment}
\marginpar{\CMD{begin\{multline\}\\...\\\CMD{end\{multline\}}}}
This is also like a multi line%
\footnote{It is no typo, the name of the environment is \texttt{multline}, no
missing i here!} environment with a special vertical alignment. The \textbf{first}
row is \textbf{left aligned}, the second and all following ones except
the last one are \textbf{centered} and the \textbf{last} line is \textbf{right
aligned}. It is often used to write extremely long formulas:


\begin{lstlisting}[xleftmargin=-1cm,xrightmargin=-1.5cm]
\begin{multline}
  A = \lim _{n\rightarrow \infty }\Delta x\left( a^{2}+\left( a^{2}+2a\Delta x
          +\left( \Delta x\right) ^{2}\right)\right.\\
  +\left( a^{2}+2\cdot 2a\Delta x+2^{2}\left( \Delta x\right) ^{2}\right)\\
  +\left( a^{2}+2\cdot 3a\Delta x+3^{2}\left( \Delta x\right) ^{2}\right)\\
  + \ldots\\
  \left.+\left( a^{2}+2\cdot (n-1)a\Delta x +(n-1)^{2}\left( \Delta x\right) ^{2}\right) \right)\\
  = \frac{1}{3}\left( b^{3}-a^{3}\right)
\end{multline}
\end{lstlisting}
\begin{multline}
A=\lim_{n\rightarrow\infty}\Delta x\left(a^{2}+\left(a^{2}+2a\Delta x+\left(\Delta x\right)^{2}\right)\right.\label{eq:reset}\\
+\left(a^{2}+2\cdot2a\Delta x+2^{2}\left(\Delta x\right)^{2}\right)\\
+\left(a^{2}+2\cdot3a\Delta x+3^{2}\left(\Delta x\right)^{2}\right)\\
+\ldots\\
\left.+\left(a^{2}+2\cdot(n-1)a\Delta x+(n-1)^{2}\left(\Delta x\right)^{2}\right)\right)\\
=\frac{1}{3}\left(b^{3}-a^{3}\right)
\end{multline}


\begin{figure}[htb]
\begin{multline}
\framebox[0.5\columnwidth]{x}\\
\framebox[0.5\columnwidth]{x}\\
\framebox[0.5\columnwidth]{x}\\
\shoveright{\framebox[0.5\columnwidth]{x}}\\
\framebox[0.5\columnwidth]{x}\\
\framebox[0.5\columnwidth]{x}
\end{multline}
\caption{\texttt{multline} Alignment demo
(the fourth row is shifted to the right with \CMD{shoveright})}
\label{cap:multline-Alignment-Demo}
\end{figure}

\begin{figure}[htb]
\begin{minipage}[c]{0.45\textwidth}%
\fbox{\parbox{\columnwidth}{\begin{multline}
\framebox[0.5\columnwidth]{\textrm{\textbackslash multlinegap=}}\\
\framebox[0.5\columnwidth]{\the\multlinegap}\end{multline}
}}
\end{minipage}%
\hfill{}\begin{minipage}[c]{0.45\textwidth}%
{\setlength{\multlinegap}{0pt}\fbox{\parbox{\columnwidth}{\begin{multline}
\framebox[0.5\columnwidth]{\textbackslash\textrm{multlinegap=}}\\
\framebox[0.5\columnwidth]{\the\multlinegap}\end{multline}
}}}
\end{minipage}%
\caption{\label{cap:multlinegap}Demonstration of \CMD{multlinegap} (default is 0pt)}
\end{figure}



\begin{itemize}
\item A nonumber-version \CMD{begin\{multline{*}\}...}\CMD{end\{multline{*}\}}
exists.
\item By default only the last line (for right equation numbers) or the
first line (for left equation numbers) gets a number, the others can't.
\item The alignment of a single line can be changed with the command
\CMD{shoveright}\index{shoveright@\textbackslash shoveright} (figure \vref{cap:multline-Alignment-Demo})
\item The first line and the last line have a small gap to the text border.%
\footnote{When the first (numbers left) or last line (numbers right) has an
equation number then \CMD{multlinegap} is not used
for these ones, only for the line without a number.} See figure \ref{cap:multlinegap}, where the length of \CMD{multlinegap}\index{multlinegap@\textbackslash multlinegap}
is set to \texttt{0pt} for the right one.
\end{itemize}

\subsection{\texttt{split} environment}\label{split}
\marginpar{\CMD{begin\{split\}\\...\\\CMD{end\{split\}}}}%
\makeatletter
\@removefromreset{equation}{section}
\makeatother
%
\begin{leftbar}
>From now on the counting of the equations changes. It is introduced with a foregoing command, which doesn't really make sense, it is only for demonstration:    %%% ----- Martin -----
\begin{lstlisting}
\makeatletter
\@removefromreset{equation}{section}
\makeatother
\end{lstlisting}
\end{leftbar}


The \verb|split| environment is like the \verb|multline|\index{multline}
or \verb|array| environment for equations longer than the column
width. Just like the array environment and in contrast to \verb|multline|,
\verb|split| can only be used as \textbf{part of another environment}.
\verb|split| itself has no own numbering, this is given by the other
environment. Without an ampersand all lines in the split environment
are right-aligned and can be aligned at a special point by using an
ampersand. In difference to the \verb|aligned| environment (section \vref{sec:aligned}), the \verb|split| environment permits more than one horizontal alignment.

It is important that the split environment has another behaviour when used inside one of the    %%% ----- Martin -----
``old'' \LaTeX{} environments \verb+\[...\]+ or \verb+\begin{equation}+ \verb+...+\verb+ \end{equation}+, in this
case more than one horizontal alignment tabs are possible.

\hspace*{-\marginparwidth}%
\begin{minipage}{0.5\columnwidth}
\[
\begin{split}
   \framebox[0.35\columnwidth]{x}\\
   \framebox[0.75\columnwidth]{x}\\
   \framebox[0.65\columnwidth]{x}\\
   \framebox[0.95\columnwidth]{x}
\end{split}
\]
\end{minipage}\hfill%
\begin{minipage}{0.5\columnwidth}
\footnotesize\begin{verbatim}
\[
\begin{split}
   \framebox[0.35\columnwidth]{x}\\
   \framebox[0.75\columnwidth]{x}\\
   \framebox[0.65\columnwidth]{x}\\
   \framebox[0.95\columnwidth]{x}
\end{split}
\]
\end{verbatim}
\end{minipage}
\vspace{2ex}

\hspace*{-\marginparwidth}%
\begin{minipage}{0.5\columnwidth}
\[
\begin{split}
   \vec{a} = {}&\framebox[0.35\columnwidth]{x}\\
             &\framebox[0.75\columnwidth]{x}\\
             &\framebox[0.65\columnwidth]{x}\\
             &\framebox[0.95\columnwidth]{x}
\end{split}
\]
\end{minipage}\hspace{1cm}%
\begin{minipage}{0.5\columnwidth}
\footnotesize\begin{verbatim}
\[
\begin{split}
   \vec{a} = {}&\framebox[0.35\columnwidth]{x}\\
             &\framebox[0.75\columnwidth]{x}\\
             &\framebox[0.65\columnwidth]{x}\\
             &\framebox[0.95\columnwidth]{x}
\end{split}
\]
\end{verbatim}
\end{minipage}
\vspace{1ex}

The following example shows the \texttt{split} environment as part
of the \texttt{equation} environment:

\begin{equation}
\begin{split}A_{1} & =\left|\int_{0}^{1}(f(x)-g(x))dx\right|+\left|\int_{1}^{2}(g(x)-h(x))dx\right|\\
 & =\left|\int_{0}^{1}(x^{2}-3x)dx\right|+\left|\int_{1}^{2}(x^{2}-5x+6)dx\right|\\
 & =\left|\frac{x^{3}}{3}-\frac{3}{2}x^{2}\right|_{0}^{1}+\left|\frac{x^{3}}{3}-\frac{5}{2}x^{2}+6x\right|_{1}^{2}\\
 & =\left|\frac{1}{3}-\frac{3}{2}\right|+\left|\frac{8}{3}-\frac{20}{2}+12-\left(\frac{1}{3}-\frac{5}{2}+6\right)\right|\\
 & =\left|-\frac{7}{6}\right|+\left|\frac{14}{3}-\frac{23}{6}\right|=\frac{7}{6}+\frac{5}{6}=2\,\textrm{FE}\end{split}
\label{eq:Beispiel-Integral}\end{equation}


\begin{lstlisting}[xleftmargin=-1cm,xrightmargin=-1.5cm]
\begin{equation}
  \begin{split}
    A_{1} & = \left| \int _{0}^{1}(f(x)-g(x))dx\right| +\left|
			\int _{1}^{2}(g(x)-h(x))dx\right| \\
          & = \left| \int _{0}^{1}(x^{2}-3x)dx\right| +\left|
			\int _{1}^{2}(x^{2}-5x+6)dx\right| \\
          & = \left| \frac{x^{3}}{3}-\frac{3}{2}x^{2}\right| _{0}^{1}+
			\left| \frac{x^{3}}{3}-
                \frac{5}{2}x^{2}+6x\right| _{1}^{2}\\
          & = \left| \frac{1}{3}-\frac{3}{2}\right| +\left|
			\frac{8}{3}-\frac{20}{2}+12-
                \left( \frac{1}{3}-\frac{5}{2}+6\right) \right| \\
          & = \left| -\frac{7}{6}\right| +\left| \frac{14}{3}-\frac{23}{6}
			\right| =\frac{7}{6}+\frac{5}{6}=2\, \textrm{FE}
  \end{split}
\end{equation}
\end{lstlisting}

\bigskip{}
The same using the \verb|array| environment with \verb|{rl}|-alignment
instead of \verb|split| gives same horizontal alignment, but another    %%% ----- Martin -----
vertical spacing%
\footnote{Can be changed with \texttt{\textbackslash renewcommand\textbackslash arraystretch\{1.5\}}} and the
symbols are only in scriptsize and not textsize:\footnote{See section \vref{sec:Styles}}    %%% ----- Martin -----

\begin{equation}
\begin{array}{rl}
A_{1} & =\left|\int_{0}^{1}(f(x)-g(x))dx\right|+\left|\int_{1}^{2}(g(x)-h(x))dx\right|\\
 & =\left|\int_{0}^{1}(x^{2}-3x)dx\right|+\left|\int_{1}^{2}(x^{2}-5x+6)dx\right|\\
 & =\left|\frac{x^{3}}{3}-\frac{3}{2}x^{2}\right|_{0}^{1}+\left|\frac{x^{3}}{3}-\frac{5}{2}x^{2}+6x\right|_{1}^{2}\\
 & =\left|\frac{1}{3}-\frac{3}{2}\right|+\left|\frac{8}{3}-\frac{20}{2}+12-\left(\frac{1}{3}-\frac{5}{2}+6\right)\right|\\
 & =\left|-\frac{7}{6}\right|+\left|\frac{14}{3}-\frac{23}{6}\right|=\frac{7}{6}+\frac{5}{6}=2\,\textrm{FE}
 \end{array}
 \end{equation}


\begin{itemize}
\item There exists no starred version (\texttt{\textbackslash{}begin\{split{*}\}})    %%% ----- Martin -----
of the \texttt{split} environment.
\end{itemize}

\subsection[Specials]{Specials for \texttt{multline} and \texttt{split}
environments}\label{sec:Specials-for-multline}

With the multline environment the equation~\vref{eq:braces} looks like:

\begin{multline}
\frac{1}{2}\Delta(f_{ij}f^{ij})=2\left(\sum_{i<j}\chi_{ij}(\sigma_{i}-\sigma_{j})^{2}+f^{ij}\nabla_{j}\nabla_{i}(\Delta f)+\right.\\
+\left.\nabla_{k}f_{ij}\nabla^{k}f^{ij}+f^{ij}f^{k}\left[2\nabla_{i}R_{jk}-\nabla_{k}R_{ij}\right]\right)\end{multline}


\noindent which is again a bad typesetting because of the two unequal parentheses.
Each one has a size which is correct for the line but not for the
whole formula. \LaTeX{} accepts only pairs of parentheses for one
line and has an ``empty{}'' parentheses, the dot ``\texttt{\textbackslash{}left.}''
or ``\texttt{\textbackslash{}right.}''{} to get only one of the ``pair{}''.
There are different solutions to get the right size of the parentheses.
One of them is to use the \CMD{vphantom} command,
which reserves the vertical space without any horizontal one, like
a vertical rule without any thickness. The sum symbol from the first
line is the biggest one and responsible for the height, so this one is
the argument of \CMD{vphantom} which has to be
placed anywhere.

\begin{multline}
\frac{1}{2}\Delta(f_{ij}f^{ij})=
	2\left(\sum_{i<j}\chi_{ij}(\sigma_{i}-
	\sigma_{j})^{2}+f^{ij}\nabla_{j}\nabla_{i}(\Delta f)+\right.\\
	\left.+\nabla_{k}f_{ij}\nabla^{k}f^{ij}+
	f^{ij}f^{k}\left[2\nabla_{i}R_{jk}-
	\nabla_{k}R_{ij}\right]\vphantom{\sum_{i<j}}\right)
\end{multline}

\begin{lstlisting}[xleftmargin=-1cm,xrightmargin=-1.5cm]
\begin{multline}
\frac{1}{2}\Delta(f_{ij}f^{ij})=
	2\left(\sum_{i<j}\chi_{ij}(\sigma_{i}-
	\sigma_{j})^{2}+f^{ij}\nabla_{j}\nabla_{i}(\Delta f)+\right.\\
	\left.+\nabla_{k}f_{ij}\nabla^{k}f^{ij}+
	f^{ij}f^{k}\left[2\nabla_{i}R_{jk}-
	\nabla_{k}R_{ij}\right]\vphantom{\sum_{i<j}}\right)
\end{multline}
\end{lstlisting}

Instead of using the \CMD{vphantom} command it is
also possible to use fixed-width parentheses, which is described in
section \vref{sec:Brackets,-Braces-and}.


\subsection{\texttt{cases} environment }

This gives support for an often used mathematical construct.\index{cases@\textbackslash cases}
You can also choose the more than once described way to convert some
text into math, like
{\footnotesize\begin{verbatim}
$x=\begin{cases}
 0 & \text{if A=...}\\
 1 & \text{if B=...}\\
 x & \textrm{this runs with as much text as you like,
      but without an automatic linebreak, it runs out
      of page....}
\end{cases}$%$    %%% ----- Martin -----(wegen EMacs Syntaxhighlighting)
\end{verbatim}}
\noindent which gives equation~\vref{eq:cases}. It is obvious what the problem
is.

\begin{eqnarray}
x & = & \begin{cases}
0 & \text{if A=...}\\
1 & \text{if B=...}\\
x & \textrm{this runs with as much text as you like, but without a linebreak, it runs out of page....}\end{cases}\label{eq:cases}\end{eqnarray}


In this case it is better to use a parbox\index{parbox@\textbackslash parbox}
for the text part with a \texttt{flushleft} command for a better view.

\begin{equation}
x=\begin{cases}
0 & \text{if A=...}\\
1 & \text{if B=...}\\
x & \parbox{5cm}{\flushleft this runs with as much text as you like, but without an automatic linebreak, it runs out of page....}\end{cases}\end{equation}



\begin{lstlisting}
\begin{equation}
x=\begin{cases}
  0 & \text{if A=...}\\
  1 & \text{if B=...}\\
  x & \parbox{5cm}{%
      \flushleft%
      this runs with as much text as you like,
      but without an automatic linebreak,
      it runs out of page....}%
\end{cases}
\end{equation}
\end{lstlisting}

\begin{leftbar}
>From now on the counting of the equations changes. It is introduced with a foregoing command, which doesn't really make sense, it is only for demonstration:    %%% ----- Martin -----
\begin{lstlisting}
\renewcommand\theequation{\arabic{equation}}
\end{lstlisting}
\end{leftbar}

\renewcommand\theequation{\arabic{equation}}


\subsection{Matrix environments}\label{sec:ams-matrix}
\begin{table}[htb]
\centering\begin{tabular}{rcrcrc}
\textbackslash{}Vmatrix\index{Vmatrix@\textbackslash Vmatrix}&
$\begin{Vmatrix}a & b\\
c & d\end{Vmatrix}$&
\textbackslash{}Bmatrix\index{Bmatrix@\textbackslash Bmatrix}&
$\begin{Bmatrix}a & b\\
c & d\end{Bmatrix}$&
\textbackslash{}matrix\index{matrix@\textbackslash matrix}&
$\begin{matrix}a & b\\
c & d\end{matrix}$\tabularnewline
\rule{0pt}{0.85cm}\textbackslash{}vmatrix\index{vmatrix@\textbackslash vmatrix}&
$\begin{vmatrix}a & b\\
c & d\end{vmatrix}$&
\textbackslash{}bmatrix\index{bmatrix@\textbackslash bmatrix}&
$\begin{bmatrix}a & b\\
c & d\end{bmatrix}$&
\textbackslash{}pmatrix\index{pmatrix@\textbackslash pmatrix}&
$\begin{pmatrix}a & b\\
c & d\end{pmatrix}$\tabularnewline[10pt]
&&&&\textbackslash{}smallmatrix\index{smallmatrix@\textbackslash smallmatrix}&
$\begin{smallmatrix}a & b\\
c & d\end{smallmatrix}$
\end{tabular}
\caption{Matrix environments}
\end{table}

All matrix environments can be nested and an element may also contain
any other math environment, so that very complex structures are possible.
By default all cells have a centered alignment, which is often not the best
when having different decimal numbers or plus/minus values. Changing the
alignment to right (not for the \verb+smallmatrix+) is possible with
\marginpar{%
\texttt{matrix}\\
\texttt{vmatrix}\\
\texttt{Vmatrix}\\
\texttt{bmatrix}\\
\texttt{Bmatrix}\\
\texttt{pmatrix}\\
\texttt{smallmatrix}%
}%

\begin{lstlisting}
\makeatletter
\def\env@matrix{\hskip -\arraycolsep
  \let\@ifnextchar\new@ifnextchar
  \array{*\c@MaxMatrixCols r}}
\makeatother
\end{lstlisting}

The special matrix environment \verb+smallmatrix+, which decreases
horizontal and vertical space is typeset in scriptstyle. The \verb|smallmatrix|
\index{smallmatrix@\textbackslash smallmatrix} environment makes some sense
in the inline mode to decrease the line height.
For dots over several columns look for \CMD{hdotsfor} in the following section.



\section{Vertical whitespace}\label{sec:ams-whitespace}
See section~\vref{subsec:whitespace} for the lengths which control the
vertical whitespace. There is no difference to \AmSmath.

\section{Dots}\label{sec:ams-dots}

In addition to section~\vref{sec:Dots} \AmSmath has two more commands
for dots: \CMD{dddot}\{...\}\footnote{already mentioned in section \ref{sec:Accents}} and \CMD{ddddot}\{...\}
\index{dddot@\textbackslash dddot}\index{ddddot@\textbackslash ddddot}

\verb|$\dddot{y}$|: $\dddot{y}$

\verb|$\ddddot{y}$|: $\ddddot{y}$


Another interesting dot command is \CMD{hdotsfor}\index{hdotsfor@\textbackslash hdotsfor}
with the syntax:

\begin{lstlisting}
\hdotsfor[<spacing factor>]{<number of columns>}
\end{lstlisting}

With the spacing factor the width of the dots can be stretched or
shrinked. The number of columns allows a continuing dotted line over
more columns. Equation \ref{eq:tridiagonal} shows the definition
of a tridiagonal matrix.

\begin{equation}
\underline{A}=\left[\begin{array}{ccccccc}
a_{11} & a_{12} & 0 & \ldots & \ldots & \ldots & 0\\
a_{21} & a_{22} & a_{23} & 0 & \ldots & \ldots & 0\\
0 & a_{32} & a_{33} & a_{34} & 0 & \ldots & 0\\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots\\
\hdotsfor{7}\cr\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots\\
0 & \ldots & 0 & a_{n-2,n-3} & a_{n-2,n-2} & a_{n-2,n-1} & 0\\
0 & \ldots & \ldots & 0 & q_{n-1,n-2} & a_{n-1,n-1} & a_{n-1,n}\\
0 & \ldots & \ldots & \ldots & 0 & a_{n,n-1} & a_{nn}
\end{array}\right]\label{eq:tridiagonal}
\end{equation}

\begin{lstlisting}[xleftmargin=-1cm,xrightmargin=-1.5cm]
\begin{equation}
\underline{A}=\left[\begin{array}{ccccccc}
a_{11} & a_{12} & 0 & \ldots & \ldots & \ldots & 0\\
a_{21} & a_{22} & a_{23} & 0 & \ldots & \ldots & 0\\
0 & a_{32} & a_{33} & a_{34} & 0 & \ldots & 0\\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots\\
\hdotsfor{7}\cr\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots\\
0 & \ldots & 0 & a_{n-2,n-3} & a_{n-2,n-2} & a_{n-2,n-1} & 0\\
0 & \ldots & \ldots & 0 & q_{n-1,n-2} & a_{n-1,n-1} & a_{n-1,n}\\
0 & \ldots & \ldots & \ldots & 0 & a_{n,n-1} & a_{nn}
\end{array}\right]
\end{equation}
\end{lstlisting}


\section{\texttt{fraction} commands}\label{sec:ams-fraction}


\subsection{Standard}

Additional to the font size problem described in subsection~\vref{sub:fraction command}
\AmSmath supports some more commands for fractions\index{Fraction}. The \CMD{frac} command
described in \cite{MathGuide}, does no more exist in \AmSmath.    %%% ----- Martin -----

\begin{itemize}
\item The global fraction definition has five parameters\index{genfrac@\textbackslash genfrac}
\index{fraction@\textbackslash frac}
\begin{lstlisting}[xleftmargin=-1em,xrightmargin=-1em]
\genfrac{<left delim>}{<right  delim>}{<thickness>}{<mathstyle>}{<nominator>}{<denominator>}
\end{lstlisting}
where thickness can have any length with a valid unit like \\
\verb|genfrac{}{}{1pt}{}{x^2+x+1}{3x-2}|
$\rightarrow\genfrac{}{}{1pt}{}{x^2+x+1}{3x-2}$
\item \CMD{cfrac}\index{cfrac@\textbackslash cfrac} (continued fraction) which is
by default set in the display mathstyle and useful for fractions like
\begin{equation}
\cfrac{1}{\sqrt{2}+\cfrac{1}{\sqrt{3}+\cfrac{1}{\sqrt{4}+\cfrac{1}{\ldots}}}}\label{cfrac}
\end{equation}
which looks with the default \CMD{frac} command like
\begin{equation}
	\frac{1}{\sqrt{2}+\frac{1}{\sqrt{3}+\frac{1}{\sqrt{4}+\frac{1}{\ldots}}}}
\end{equation}
where the mathstyle decreases for every new level in the fraction.
The \CMD{cfrac} command can be called with an optional
parameter which defines the placing of the nominator, which can be
\texttt{[l]}eft, \texttt{[r]}ight or \texttt{[c]}enter (the default - see
equation~\ref{cfrac}):\\
\begin{minipage}[c]{0.40\textwidth}%
\[
\cfrac[l]{1}{\sqrt{2}+\cfrac[l]{1}{\sqrt{3}+\cfrac[l]{1}{\sqrt{4}+\cfrac[l]{1}{\ldots}}}}
\]
\end{minipage}%
\hfill{}\begin{minipage}[c]{0.40\textwidth}%
\[\cfrac[r]{1}{\sqrt{2}+\cfrac[r]{1}{\sqrt{3}+\cfrac[r]{1}{\sqrt{4}+\cfrac[r]{1}{\ldots}}}}\]
\end{minipage}%

\item \CMD{dfrac}\index{dfrac@\textbackslash dfrac}
which takes by default the displaystyle\index{displaystyle@\textbackslash displaystyle}, so that
fractions in inline mode $\dfrac{1}{2}$ have the same size than in
display mode.
\item \CMD{tfrac}\index{tfrac@\textbackslash tfrac} (vice versa to \CMD{dfrac}) which takes by default
the scriptstyle\index{scriptstyle@\textbackslash scriptstyle}, so that fractions in display
mode have the same size than in inline mode.
\end{itemize}

\[\tfrac{2}{3} \text{\hspace{0.5cm}\CMD{tfrac\{2\}\{3\}}} \]
\[\frac{2}{3} \text{\hspace{0.5cm}\CMD{frac\{2\}\{3\}}} \]


\subsection{Binoms}\label{sub:Binoms}

\marginpar{\CMD{binom}\\\CMD{dbinom}\\\CMD{tbinom}}They are like fractions without a rule and its syntax is different
to the \CMD{choose} command from standard \LaTeX{}
(see section \vref{sub:fraction command}). \AmSmath{} provides three
different commands for binoms just like the ones for fractions.

\begin{table}[htb]
\centering%
\begin{tabular}{lcl}
Command & Inlinemath & Displaymath\tabularnewline
\hline
\texttt{\textbackslash{}binom\{m\}\{n\}} & $\binom{m}{n}$&
${\displaystyle \binom{m}{n}}$\tabularnewline
\texttt{\rule{0pt}{0.75cm}\textbackslash{}dbinom\{m\}\{n\}}&
$\dbinom{m}{n}$&
${\displaystyle \dbinom{m}{n}}$\tabularnewline
\texttt{\rule{0pt}{0.5cm}\textbackslash{}tbinom\{m\}\{n\}}&
$\tbinom{m}{n}$&
${\displaystyle \tbinom{m}{n}}$\tabularnewline
\end{tabular}
\caption{binom commands}
\end{table}


\section{Roots}\label{sec:Roots-ams}

The typesetting for roots\index{uproot@\textbackslash uproot} is sometimes not
the best. Some solutions for better typesetting are %
\marginpar{\CMD{leftroot}\\\CMD{uproot}}%
described in section~\vref{sec:Roots} for standard \LaTeX{}. \AmSmath
has some more commands for the $n$-th root:

\begin{lstlisting}
\sqrt[\leftroot{<number>}\uproot{<number>}<root>]{< ... >}
\end{lstlisting}

\noindent \verb+<number>+ indicates a value for the points%
\footnote{In PostScript units (bp -- Big Points).} of which the root can be
adjusted to the left and/or to the top, e.g.:
$\sqrt[k_n]{a}$ (\verb+$\sqrt[k_n]{a}$+) has a too deep exponent, whereas $\sqrt[\uproot{2}k_n]{a}$ \verb+$\sqrt[\uproot{2}k_n]{a}$+ looks nicer.



\subsection{Roots with \CMD{smash} command}

\marginpar{\CMD{smash}}The default for a root\index{Root} with $\lambda_{k_{i}}$ as root
argument looks like $\sqrt{\lambda_{k_{i}}}$, which may be not the    %%% ----- Martin -----
best typesetting. It is possible to reduce the lowest point of the root
to the baseline with the \CMD{smash} command: $\sqrt{\lambda_{k_{i}}}\xrightarrow{\text{with \textbackslash smash}}\sqrt{\smash[b]{\lambda_{k_{i}}}}$


The syntax of the \CMD{smash} command%
\footnote{In \texttt{latex.ltx} \CMD{smash} is defined without an optional argument.} renewed by the \AmSmath  package is    %%% ----- Martin -----

\begin{lstlisting}
\smash[<position>]{<argument>}
\end{lstlisting}
The optional argument for the position can be:

\begin{description}
\item [t]keeps the bottom and annihilates the top
\item [b]keeps the top and annihilates the bottom
\item [tb]annihilates top and bottom (the default)
\end{description}

\section{Accents}\label{amssymb}

With the macro \verb|\mathaccent| it is easy to define new accent types, for example

\begin{lstlisting}
\def\dotcup{$\mathaccent\cdot\cup$}
\end{lstlisting}

$\mathaccent\cdot\cup$

\def\curvearrowleftright{%
	\ensuremath{%
		\mathaccent\curvearrowright{\mkern-5mu\curvearrowleft}%
	}%
}

Overwriting of two symbols is also possible:

{\huge
$\curvearrowleft\curvearrowright\curvearrowleftright$}

In this case the second symbol has to be shifted to the left for a length    %%% ----- Martin -----
of $5mu$ (mu: math unit\index{Math unit}).

\begin{lstlisting}
\def\curvearrowleftright{%
	\ensuremath{%
		\mathaccent\curvearrowright{\mkern-5mu\curvearrowleft}%
	}%
}
\end{lstlisting}

For other possibilities to define new accents see section \vref{sec:package-accent}.    %%% ----- Martin -----

\section{\CMD{mod} command}

In standard \LaTeX{} the modulo command is not an operator, though    %%% ----- Martin -----
it is often used in formulas. \AmSmath provides two (three) different
commands for modulo, which are listed in tabular~\vref{cap:The-modulo commands}.

\begin{itemize}
\item They all insert some useful space before and behind the mod-operator.
\end{itemize}

\begin{table}[htb]
\centering\begin{tabular}{rrl}
a\textbackslash{}mod\{n\^{}2\}=b&
$\rightarrow$&
$a\mod{n^{2}}=b$\tabularnewline
a\textbackslash{}pmod\{n\^{}2\}=b&
$\rightarrow$&
$a\pmod{n^{2}}=b$\tabularnewline
a\textbackslash{}pod\{n\^{}2\}=b&
$\rightarrow$&
$a\pod{n^{2}}=b$\tabularnewline
\end{tabular}
\caption{\label{cap:The-modulo commands}The modulo commands and their meaning}
\end{table}



\section{Equation numbering\label{sec:Equation-numbering}}

See section \vref{sub:Equationnumbering} for equation numbering\index{Equation!numbering}.
It is mostly the %
\marginpar{\textbackslash{}numberwithin%
}same, only one command is new to \AmSmath. If you want
a numbering like ``\ref{eq:IntoSection}{}'' then write either in the preamble    %%% ----- Martin -----
or like this example anywhere in your doc:

\begin{lstlisting}
\numberwithin{equation}{section}
\end{lstlisting}

\begin{leftbar}
\numberwithin{equation}{section}From now on the numbering looks like    %%% ----- Martin -----
equation \vref{eq:IntoSection}. For the book-class you can get the
same for chapters.
\end{leftbar}

If you want to get rid of the parentheses then write in the preamble:    %%% ----- Martin -----

\begin{lstlisting}
\makeatletter
\def\tagform@#1{\maketag@@@{\ignorespaces#1\unskip\@@italiccorr}}
\makeatother
\end{lstlisting}

Now the following four subequation numbers have no parentheses.




\makeatletter
\let\oldTagForm\tagform@
\def\tagform@#1{\maketag@@@{\ignorespaces#1\unskip\@@italiccorr}}
\makeatother

\subsection{Subequations}\label{ams:subeqn}

Amsmath supports this with the environment \verb|subequation|\index{Subequations}.
For example:
\begin{subequations}
\begin{align}
y & =  d\\
y & =  cx+d\\
y & =  bx^{2}+cx+d\\
y & =  ax^{3}+bx^{2}+cx+d
\end{align}
\end{subequations}

\begin{lstlisting}
\begin{subequations}
\begin{align}
y & =  d\\
y & =  cx+d\\
y & =  bx^{2}+cx+d\\
y & =  ax^{3}+bx^{2}+cx+d
\end{align}
\end{subequations}
\end{lstlisting}

\makeatletter
\let\tagform@\oldTagForm
\makeatother


Inside of subequations only complete other environments (\texttt{\textbackslash{}begin\{...\}
... \textbackslash{}end\{...\}}) are possible.

\begin{lstlisting}
\renewcommand{\theequation}{%
  \theparentequation{}-\arabic{equation}%
}
\end{lstlisting}

\begin{subequations}
\renewcommand{\theequation}{%
  \theparentequation -\arabic{equation}%
}%
\begin{align}
y & =  d\\
y & =  cx+d\label{eq:subequation-neu}\\
y & =  bx^{2}+cx+d\\
y & =  ax^{3}+bx^{2}+cx+d
\end{align}
\end{subequations}

A ref to a subequation is possible like the one to equation \ref{eq:subequation-neu}.
The environment chooses the same counter ``\texttt{equation}''
but saves the old value into ``\texttt{parentequation}''.

\newcounter{mySubCounter}
\newcommand{\twocoleqn}[2]{
    \setcounter{mySubCounter}{0}%
    \let\OldTheEquation\theequation%
    \renewcommand{\theequation}{\OldTheEquation\alph{mySubCounter}}%
    \noindent%
    \begin{minipage}{.49\textwidth}
          \begin{equation}\refstepcounter{mySubCounter}
            #1
        \end{equation}
    \end{minipage}\hfill%
    \addtocounter{equation}{-1}%
    \begin{minipage}{.49\textwidth}
        \begin{equation}\refstepcounter{mySubCounter}
            #2
        \end{equation}
    \end{minipage}
    \let\theequation\OldTheEquation
}

It is also possible to place two equations side by side with counting as subfigures:

\twocoleqn{y=f(x)}{y=f(z)}

\vspace{1ex}
In this case, the \AmSmath internal subfigure counter cannot be used and an own
counter has to be defined:

\begin{lstlisting}
\newcounter{mySubCounter}
\newcommand{\twocoleqn}[2]{
    \setcounter{mySubCounter}{0}%
    \let\OldTheEquation\theequation%
    \renewcommand{\theequation}{\OldTheEquation\alph{mySubCounter}}%
    \noindent%
    \begin{minipage}{.49\textwidth}
          \begin{equation}\refstepcounter{mySubCounter}
            #1
        \end{equation}
    \end{minipage}\hfill%
    \addtocounter{equation}{-1}%
    \begin{minipage}{.49\textwidth}
        \begin{equation}\refstepcounter{mySubCounter}
            #2
        \end{equation}
    \end{minipage}%
    \let\theequation\OldTheEquation
}
[ ... ]
\twocoleqn{y=f(x)}{y=f(z)}
\end{lstlisting}


\section{Labels and tags}\label{sec:Labels-and-Tags}

For the \CMD{label} command\index{label@\textbackslash label} \marginpar{\textbackslash{}tag%
}
see section \vref{sec:Labels}, it is just the same behaviour. \AmSmath
allows to define own single ``equation numbers\index{Equation number}''
with the \CMD{tag} command. 
\begin{align}
f(x) & =a\tag{linear}\label{eq:linear}\\
g(x) & =dx^{2}+cx+b\tag{quadratic}\label{eq:quadratic}\\
h(x) & =\sin x\tag*{trigonometric}
\end{align}

\begin{lstlisting}
\begin{align}
f(x) & =a\tag{linear}\label{eq:linear}\\
g(x) & =dx^{2}+cx+b\tag{quadratic}\label{eq:quadratic}\\
h(x) & =\sin x\tag*{trigonometric}
\end{align}
\end{lstlisting}

\begin{itemize}
\item The \CMD{tag} command is also possible for unnumbered
equations, \LaTeX{} changes the behaviour when a tag is detected.
\item There exists a starred version \verb|\tag{*}{...}|,    %%% ----- Martin -----
which supresses any annotations like parentheses for equation numbers\index{Equation!number}.
\item There exist two package options for tags, \verb|ctagsplit|\index{ctagsplit}    %%% ----- Martin -----
and \verb|righttag|\index{righttag} (look at the beginning of this
part on page~\pageref{par:AMSmath-package}).
\end{itemize}


\section{Limits}\label{sec:limit-AMS}

By default the sum/prod has the limits above/below and the integral
at the side. To get the same behaviour for all symbols which can have
limits load the package \AmSmath in the preamble as    %%% ----- Martin -----

\begin{lstlisting}
\usepackage[sumlimits,intlimits]{amsmath}
\end{lstlisting}

There exist also options for the vice versa (see page~\pageref{par:AMSmath-package}).    %%% ----- Martin -----
See also section~\ref{sec:misc-AMS} for the additional commands \CMD{underset} and \CMD{overset}.



\subsection{Multiple limits}

For general information about limits\index{Limits} read section
\vref{sub:Limits-Inline}. Standard \LaTeX{} provides the \texttt{\textbackslash{}atop}\index{atop@\textbackslash atop} command
for multiple limits (section \vref{sub:Multiple-Limits}). \AmSmath \marginpar{\textbackslash{}substack%
}
has an additional command for that, which
can have several lines with the following syntax:
\marginpar{\CMD{begin\{Sb\}}\\...\\\CMD{end\{Sb\}}\\\CMD{begin\{Sp\}}\\...\\\CMD{end\{Sp\}}%
}

\begin{lstlisting}
\substack{...\\...\\...}
\end{lstlisting}

The environments described in \cite{MathGuide}

\begin{lstlisting}
\begin{Sb} ... \end{Sb}
\begin{Sp} ... \end{Sp}
\end{lstlisting}
are obsolete and no more part of \AmSmath.

The example equation \vref{eq:atop} with the \CMD{substack}\index{substack@\textbackslash substack} command
looks like:

\begin{equation}\label{eq:multlimits}
\sum_{\substack{1\le i\le p\\
1\le j\le q\\
1\le k\le r}
}a_{ij}b_{jk}c_{ki}
\end{equation}


Insert these limits in the following way:
\begin{lstlisting}
\begin{equation}
	\sum_{%
		\substack{1\le i\le p\\
			1\le j\le q\\
			1\le k\le r}
		}%
	a_{ij}b_{jk}c_{ki}
\end{equation}
\end{lstlisting}

\subsection{Problems}\label{subsec:ams-limits}

There are still some problems with limits and the following math
expression. For example:

\[
X = \sum_{1\le i\le j\le n}X_{ij}
\]
\begin{lstlisting}
\[
X = \sum_{1\le i\le j\le n}X_{ij}
\]
\end{lstlisting}

\noindent does not look nice because of the long limit. Using a
\CMD{makebox} also does not really solve the problem, because
\CMD{makebox} is in \TeX{} horizontal mode and knows nothing about
the appropriate math font size, because limits have a smaller font size.
It is better to define a \CMD{mathclap}\index{mathclap@\textbackslash mathclap} macro, similiar to the two
macros \CMD{llap} and \CMD{rlap} and uses the also new defined \CMD{mathclap} macro\index{clap@\textbackslash clap}:

\begin{lstlisting}
\def\mathllap{\mathpalette\mathllapinternal}
\def\mathllapinternal#1#2{%
	\llap{$\mathsurround=0pt#1{#2}$}% $
}
\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\def\mathclap{\mathpalette\mathclapinternal}
\def\mathclapinternal#1#2{%
	\clap{$\mathsurround=0pt#1{#2}$}%
}
\def\mathrlap{\mathpalette\mathrlapinternal}
\def\mathrlapinternal#1#2{%
	\rlap{$\mathsurround=0pt#1{#2}$}% $
}
\end{lstlisting}


Now we can write limits which have a boxwidth of 0pt and the right font
size and the following math expression appears just behind the symbol:

\[
X = \sum_{\mathclap{1\le i\le j\le n}}X_{ij}
\]
\begin{lstlisting}
\[
X = \sum_{\mathclap{1\le i\le j\le n}}X_{ij}
\]
\end{lstlisting}

Another problem occurs when having operators with stacked limits in braces:\index{substack@\textbackslash substack}
\index{Braces!Problems}
\index{Stacked limits}
\begin{align}
\left[\sum_{\substack{i,j\\i>j}} \dots \right]
\end{align}

This case is not easy to handle when some other math expressions are around the braces
which should be on the same baseline. However, the following may help in some cases
to get better looking braces.

\begin{LTXexample}[width=0.45\linewidth,wide]
\begin{align}
foo \left[\begin{array}{@{}c@{}}
    \displaystyle\sum_{\substack{i,j\\i>j}} \dots
  \end{array}\right] bar
\end{align}
\end{LTXexample}


\subsection{\CMD{sideset}}

This is a command for a very special purpose, to combine over/under
limits with superscript/subscripts for \marginpar{\CMD{sideset}}the
sum-symbol. For example: it is not possible to place the prime
for the equation \ref{eq:sideset} near to the sum\index{sum@\textbackslash sum} symbol,
because it becomes an upper limit when writing without an preceeding \verb|{}|.
\begin{equation}
\sum_{n<k\atop n\ \textrm{odd}}{}'nE_{n}\label{eq:sideset}
\end{equation}

The command \CMD{sideset}\index{sideset@\textbackslash sideset}
has the syntax

\begin{lstlisting}
\sideset{<before>}{<behind>}
\end{lstlisting}

It can place characters on all four corners of the sum-symbol:
\[
\sideset{_{LowerLeft}^{UpperLeft}}{_{LowerRight}^{UpperRight}}\sum_{B}^{T}
\]

\begin{lstlisting}
\[
\sideset{_{LowerLeft}^{UpperLeft}}{_{LowerRight}^{UpperRight}}\sum_{B}^{T}
\]
\end{lstlisting}

Now it is possible to write the equation \ref{eq:sideset} in a proper
way with the command \verb|\sideset{}{'}| before
the sum symbol:
\begin{equation}
\sideset{}{'}\sum_{n<k\atop n\ \textrm{odd}}nE_{n}
\end{equation}


\section{Operator names}\label{OperatorNames}

\marginpar{\CMD{operatorname}}%
By default variables are written in italic\index{Italic} and operator
names\index{Operator!names} in upright mode, like $y=\sin(x)$.%
\footnote{See section \vref{sec:ltxOperators}, where all the standard \LaTeX{}    %%% ----- Martin -----
known operator names are listed. Package \AmSmath has
some more (see documentation).} This happens only for the known operator names, but creating a new
one is very easy with:

\begin{lstlisting}
\newcommand{\mysin}{\operatorname{mysin}}
\end{lstlisting}

Now \CMD{mysin} is also written in upright mode
$y=\mysin(x)$ and with some additional space before and behind.

It is obvious, that only those names can be defined as new operator
names which are not commands in another way. Instead of using the
new definition as an operator, it is also possible to use the text
mode. But it is better to have all operators of the same type, so that
changing the style will have an effect for all operators.

\marginpar{\CMD{operatornamewithlimits}}%
The new defined operator names cannot have limits\index{Limits}, only
superscript/subscript is possible. \verb+amsopn.sty+ has an additional command
\CMD{operatornamewithlimits}\index{operatornamewithlimits@\textbackslash operatornamewithlimits},
which supports over/under limits like the one from \CMD{int}
or \CMD{sum}.

\marginpar{\CMD{mathop}}
It is also possible to use the macro \verb+\mathop+ to declare anything
as operator, like
\[ \sideset{_1}{}{\mathop{\mathrm{B}}} \]
\begin{lstlisting}
\[ \sideset{_1}{}{\mathop{\mathrm{B}}} \]
\end{lstlisting}
With this definition it is possible to use \CMD{sideset} for a forgoing index, which
is only possible for an operator.

For a real \LaTeX{} definition have a look at section \vref{sec:ltxOperators}.


\section{Text in math mode}\label{sec:Text-in-math mode}

If you need complex structures between formulas, look also at section \ref{sec:verticalAlignment}.

\subsection{\CMD{text} command}
\marginpar{%
\CMD{text}\\
\CMD{mbox}\\
\CMD{textnormal}\\
\CMD{mathrm}%
}%
This is the equivalent command to \CMD{mathrm}\index{mathrm@\textbackslash mathrm}
or \CMD{mbox}\index{mbox@\textbackslash mbox}
from the standard \LaTeX{} (section~\vref{sec:Text}) with the exception, that \CMD{mathrm}
always uses the roman font and \CMD{text} the actual one and that the font size is different
when used in super- and subscript. 

For example: $\boxed{f(x)=x\quad\text{this was math}}$.

\bigskip
{\sffamily\huge
$A^{\mbox{text}}_{\mbox{text}}$\quad
$A^{\text{text}}_{\text{text}}$\quad
$A^{\textnormal{text}}_{\textnormal{text}}$\quad
$A^{\mathrm{text}}_{\mathrm{text}}$
}
\medskip
\begin{lstlisting}
$\boxed{f(x)=x\quad\text{this was math}}$

{\sffamily\huge
$A^{\mbox{text}}_{\mbox{text}}$\quad
$A^{\text{text}}_{\text{text}}$\quad
$A^{\textnormal{text}}_{\textnormal{text}}$\quad
$A^{\mathrm{text}}_{\mathrm{text}}$ 
}
\end{lstlisting}

The \verb+\text+ macro can be used at any place and can be in some cases a better
solution as \verb+\intertext+ (see section~\ref{subsec:intertext}).

\begin{flalign*}
             && 12(x-1) + 20(y-3) + 14(z-2) & = 0 &&\\
  \text{and} &&               6x + 10y + 7z & = 0  &&
\end{flalign*}

\begin{align}
            && 12(x-1) + 20(y-3) + 14(z-2) & = 0\\
  \text{and} &&               6x + 10y + 7z & = 0 
\end{align}

\begin{lstlisting}
\begin{flalign*}
             && 12(x-1) + 20(y-3) + 14(z-2) & = 0 &&\\
  \text{and} &&               6x + 10y + 7z & = 0  &&
\end{flalign*}

\begin{align}
            && 12(x-1) + 20(y-3) + 14(z-2) & = 0\\
  \text{and} &&               6x + 10y + 7z & = 0 
\end{align}
\end{lstlisting}



\subsection{\CMD{intertext} command}\label{subsec:intertext}

This is useful when you want to place some text between two parts
of math stuff without leaving the math mode, like the name
``intertext\index{intertext@\textbackslash intertext}''    %%% ----- Martin -----
says. For example we write the equation~\vref{eq:Beispiel-Integral}
with an additional command after the second line.

\[
  \begin{split}
    A_{1} & = \left| \int _{0}^{1}(f(x)-g(x))dx\right| +\left| \int _{1}^{2}(g(x)-h(x))dx\right| \\
          & = \left| \int _{0}^{1}(x^{2}-3x)dx\right| +\left| \int _{1}^{2}(x^{2}-5x+6)dx\right| \\
          \intertext{Now the limits of the integrals are used}
          & = \left| \frac{x^{3}}{3}-\frac{3}{2}x^{2}\right| _{0}^{1}+\left| \frac{x^{3}}{3}-
                \frac{5}{2}x^{2}+6x\right| _{1}^{2}\\
          & = \left| \frac{1}{3}-\frac{3}{2}\right| +\left| \frac{8}{3}-\frac{20}{2}+12-
                \left( \frac{1}{3}-\frac{5}{2}+6\right) \right| \\
          & = \left| -\frac{7}{6}\right| +\left| \frac{14}{3}-\frac{23}{6}\right| =\frac{7}{6}+
                \frac{5}{6}=2\, \textrm{FE}
  \end{split}
\]

The code looks like:\\


\begin{lstlisting}[xleftmargin=-1cm,xrightmargin=-1.5cm]
\begin{equation}
  \begin{split}
    A_{1} & = \left| \int _{0}^{1}(f(x)-g(x))dx\right| +\left| \int _{1}^{2}(g(x)-h(x))dx\right| \\
          & = \left| \int _{0}^{1}(x^{2}-3x)dx\right| +\left| \int _{1}^{2}(x^{2}-5x+6)dx\right| \\
          \intertext{Now the limits of the integrals are used}
          & = \left| \frac{x^{3}}{3}-\frac{3}{2}x^{2}\right| _{0}^{1}+\left| \frac{x^{3}}{3}-
                \frac{5}{2}x^{2}+6x\right| _{1}^{2}\\
          & = \left| \frac{1}{3}-\frac{3}{2}\right| +\left| \frac{8}{3}-\frac{20}{2}+12-
                \left( \frac{1}{3}-\frac{5}{2}+6\right) \right| \\
          & = \left| -\frac{7}{6}\right| +\left| \frac{14}{3}-\frac{23}{6}\right| =\frac{7}{6}+
                \frac{5}{6}=2\, \textrm{FE}
  \end{split}
\end{equation}
\end{lstlisting}

Writing very long text is possible by using a \verb+parbox+, see section~\vref{sec:Text} for    %%% ----- Martin -----
an example with \verb+\textrm+, which behaves in the same way as \verb+\text+.




\section{Extensible arrows}
\marginpar{%
  \CMD{xrightarrow}\\
  \CMD{xleftarrow}\\
  \CMD{xmapsto}}To write something like $\xrightarrow[\text{below}]{\text{above the arrow}}$ you can use the following macro

\begin{verbatim}
$\xrightarrow[\text{below}]{\text{above the arrow}}$
\end{verbatim}
\index{Arrows}\index{Extensible arrows}

\noindent and the same with \verb|\xleftarrow|. You can define your own extensible arrow macros
if you need other than these two predefined ones. To get a doublelined extensible
arrow like \verb|$\Longleftrightarrow$| ($\Longleftrightarrow$) but with the same
behaviour as an extensible one, write in the preamble    %%% ----- Martin -----

\begin{lstlisting}
\newcommand\xLongLeftRightArrow[2][]{%
    \ext@arrow 0055{\LongLeftRightArrowfill@}{#1}{#2}}
\def\LongLeftRightArrowfill@{%
	\arrowfill@\Leftarrow\Relbar\Rightarrow}
\newcommand\xlongleftrightarrow[2][]{%
    \ext@arrow 0055{\longleftrightarrowfill@}{#1}{#2}}
\def\longleftrightarrowfill@{%
	\arrowfill@\leftarrow\relbar\rightarrow}
\end{lstlisting}

The three parts \verb|\Leftarrow\Relbar\Rightarrow| define left|middle|right of the
arrow, where the middle part would be stretched in a way that the arrow is at least
as long as the text above and/or below it. This macro has one optional and one
standard parameter. The optional one is written below and the standard one above this    %%% ----- Martin -----
arrow. Now we can write

\begin{verbatim}
$\xLongLeftRightArrow[\text{below}]{\text{above the arrow}}$
$\xlongleftrightarrow[\text{below}]{\text{above the arrow}}$
\end{verbatim}

\noindent to get $\xLongLeftRightArrow[\text{below}]{\text{above the arrow}}$ or
$\xlongleftrightarrow[\text{below}]{\text{above the arrow}}$. 
The ``number'' $0055$ after \verb+\ext@arrow+ defines the position relative to the extended error and is
not a number but four parameters for additional space in the math unit \verb+mu+.
\index{mapstofill@\CMD{mapstofill}}

\makeatletter
\def\mapstofill@{%
  \arrowfill@{\mapstochar\relbar}\relbar\rightarrow}
\renewcommand*\xmapsto[6][]{%
  \ext@arrow #3#4#5#6\mapstofill@{#1}{#2}}
\makeatother
\begin{lstlisting}
\def\mapstofill@{%
  \arrowfill@{\mapstochar\relbar}\relbar\rightarrow}
\newcommand*\xmapsto[2][]{%
  \ext@arrow <four digits>\mapstofill@{#1}{#2}}
\end{lstlisting}

{\fboxsep=0pt
\verb+$\ext@arrow 0000$+\quad{\huge $\xmapsto[\fbox{under}]{\fbox{over}}0000$}

\verb+$\ext@arrow 9000$+\quad{\huge $\xmapsto[\fbox{under}]{\fbox{over}}9000$}

\verb+$\ext@arrow 0900$+\quad{\huge $\xmapsto[\fbox{under}]{\fbox{over}}0900$}

\verb+$\ext@arrow 0009$+\quad{\huge $\xmapsto[\fbox{under}]{\fbox{over}}0009$}

\verb+$\ext@arrow 0090$+\quad{\huge $\xmapsto[\fbox{under}]{\fbox{over}}0090$}

\verb+$\ext@arrow 0099$+\quad{\huge $\xmapsto[\fbox{under}]{\fbox{over}}0099$}

\verb+$\ext@arrow 9999$+\quad{\huge $\xmapsto[\fbox{under}]{\fbox{over}}9999$}
}

% $
\begin{itemize}
\item 1st digit: space left
\item 2nd digit: space right
\item 3rd digit: space left and right
\item 4th digit: space relativ to the tip of the ``arrow''
\end{itemize}

The two macros \verb+\xrightarrow+ and \verb+\xleftarrow+ are defined as:
\begin{lstlisting}
\newcommand{\xrightarrow}[2][]{\ext@arrow 0359\rightarrowfill@{#1}{#2}}
\newcommand{\xleftarrow}[2][]{\ext@arrow 3095\leftarrowfill@{#1}{#2}}
\end{lstlisting}



\section{Frames}\label{sec:ams-frames}
\marginpar{\CMD{boxed}}%
\AmSmath knows the macro \verb|\boxed|\index{boxed@\textbackslash boxed} which can
be used for inline $a\boxed{b+c}$ and displayed math expressions:

\begin{align}
\boxed{f(x)=\int_1^{\infty}\frac{1}{x^2}\,dt=1}
\end{align}

\begin{lstlisting}
\begin{align}
\boxed{f(x)=\int_1^{\infty}\frac{1}{x^2}\,dt=1}
\end{align}
\end{lstlisting}

For coloured boxes use package \verb|empheq|. For an example see section \vref{sec:empheq}.

\section{Greek letters}\label{sec:greek-AMS}
\marginpar{\CMD{pmb}}%
The \AmSmath package simulates a bold font for the greek letters by writing a greek    %%% ----- Martin -----
character twice with a small kerning. This is done with the macro
\verb|\pmb{<letter>}|\index{pmb@\textbackslash pmb}\index{Bold greek letters}. The
\verb|\mathbf{<character>}| doesn't work with lower greek character.

\begin{tabular}{cc}
$\alpha$ & $\pmb{\alpha}$\\
$\beta$ & $\pmb{\beta}$\\
$\gamma$ & $\pmb{\gamma}$\\
$\delta$ & $\pmb{\delta}$\\
$\epsilon$ & $\pmb{\epsilon}$\\
$\ldots$   & $\ldots$
\end{tabular}


\section{Miscellaneous commands}\label{sec:misc-AMS}

There are several commands which can be used in math mode:\marginpar{\CMD{overset}\\\CMD{underset}\\\CMD{boxed}}

Some examples are shown in table~\vref{cap:Different-Mathcommands-supported-AMS}.

\begin{table}[htb]
\centering
{\renewcommand{\arraystretch}{2}
\begin{tabular}{r|>{\raggedright}p{2cm}}
\verb|$\underset{under}{baseline}$| \index{underset@\textbackslash underset} &
$\underset{under}{baseline}$\tabularnewline
\verb|$\overset{over}{baseline}$| \index{overset@\textbackslash overset} &
$\overset{over}{baseline}$\tabularnewline
\end{tabular}}
\caption{Different mathcommands}\label{cap:Different-Mathcommands-supported-AMS}
\end{table}

\CMD{underset} is a useful macro for having limits under non-operators (see page~\pageref{sec:amsopn}).    %%% ----- Martin -----


\part{\TeX{} and math}

There is in general no need to use the \TeX{} macros, because the ones defined with \LaTeX{}
or with \AmSmath{} are much more useful. Nevertheless there may be situations, where someone    %%% ----- Martin -----
has to use one of the \TeX{} macros or special \TeX{} math length. One can not expect, that all
macros work in the usual way, a lot of them are redefined by \LaTeX{}    %%% ----- Martin -----
or \AmSmath{}. On the other hand some of these basic macros or length definitions are used
in the \TeX{} way, so it might be interesting to have all declared in a short way for some
information.

\section{Length registers}

\subsection{\CMD{abovedisplayshortskip}}
\cIndex{abovedisplayshortskip}A length with glue, see section~\ref{subsubsec:displayskip} for an example.

\subsection{\CMD{abovedisplayskip}}
\cIndex{abovedisplayskip}A length with glue, see section~\ref{subsubsec:displayskip} for an example.

\subsection{\CMD{belowdisplayshortskip}}
\cIndex{belowdisplayshortskip}A length with glue, see section~\ref{subsubsec:displayskip} for an example.

\subsection{\CMD{belowdisplayskip}}
\cIndex{belowdisplayskip}A length with glue, see section~\ref{subsubsec:displayskip} for an example.


\subsection{\CMD{delimiterfactor}}
\cIndex{delimiterfactor}The height of a delimiter is often not optimally calculated by \TeX{}. In some cases it is    %%% ----- Martin -----
too short. With \verb+\delimiterfactor+ one can correct this height. The delimiterheight
is $<\textrm{calculated height}>\cdot <\textrm{\#1}>/1000$ where \verb+#1+ is the parameter of
\verb+\delimiterfactor+. The default value is $901$.

\begin{showexample}[width=0.4\linewidth]
\[
y = \left\{%
 \begin{array}{ll}
   x^2+2x  &\textrm{if }x<0,\\
   x^3     &\textrm{if }0\le x<1,\\
   x^2+x   &\textrm{if }1\le x<2,\\
   x^3-x^2 &\textrm{if }2\le x.
 \end{array}%
\right.
\]
\end{showexample}

\begin{showexample}[width=0.4\linewidth]
\[
\delimiterfactor=1500
y = \left\{%
 \begin{array}{ll}
   x^2+2x  &\textrm{if }x<0,\\
   x^3     &\textrm{if }0\le x<1,\\
   x^2+x   &\textrm{if }1\le x<2,\\
   x^3-x^2 &\textrm{if }2\le x.
 \end{array}%
\right.
\]
\end{showexample}

\subsection{\CMD{delimitershortfall}}
\cIndex{delimitershortfall}Additionally to the forgoing \verb+\delimiterfactor+ one can modify the height of the
delimiter with another value. \TeX{} makes the delimiter larger than the values of
$<\textrm{calculated height}>\cdot <\textrm{delimiterfactor}>/1000$ and $<\textrm{calculated height}>-<\textrm{delimitershortfall}>$. This makes it possible to always get different heights    %%% ----- Martin -----
of a sequence of delimiters. 

\begin{showexample}[width=0.3\linewidth]
$x\cdot\left(\left(x^2-y^2\right)-3\right)$\\[7pt]

$
\delimitershortfall-1pt
x\cdot\left(\left(x^2-y^2\right)-3\right)$
\end{showexample}

\begin{showexample}[width=0.2\linewidth]
$\left(\left(\left(A\right)\right)\right)$\\[7pt]

$\delimitershortfall-1pt
\left(\left(\left(A\right)\right)\right)$
\end{showexample}


\subsection{\CMD{displayindent}}
\cIndex{displayindent}This is the left shift amount of a line holding displayed equation. By default it is $0pt$ but
gets the value of an indented paragraph when there is an environment like the quotation one.

The following formula is typeset in the usual way without modifying anything.

\[ f(x) = \int \frac{\sin x}{x}dx \]

Now we start a quotation environment which sets \verb+\labelwidth+ to new values for a greater    %%% ----- Martin -----
left margin.

\begin{itemize}
\item The following formula is typeset in the usual way without modifying anything.

\[ f(x) = \int \frac{\sin x}{x}dx \]

\item Now we write the same equation, but now with modifying \verb+\displayindent+, it is set to
the negative \verb+\labelwidth+:

\[
  \displayindent=-\labelwidth
  f(x) = \int \frac{\sin x}{x}dx 
\]
\end{itemize}

\begin{lstlisting}
\[
  \displayindent=-\leftskip 
  f(x) = \int \frac{\sin x}{x}dx 
\]
\end{lstlisting}

\subsection{\CMD{displaywidth}}
\cIndex{displaywidth}The width of the line holding a displayed equation, which is by default \verb+\linewidth+. In the
second example the formula is centered for a display width of \verb+0.5\linewidth+.

\[ f(x) = \int \frac{\sin x}{x}dx \]
\[
  \displaywidth=0.5\linewidth
  f(x) = \int \frac{\sin x}{x}dx 
\]
\begin{lstlisting}
\[ f(x) = \int \frac{\sin x}{x}dx \]
\[
  \displaywidth=0.5\linewidth
  f(x) = \int \frac{\sin x}{x}dx 
\]
\end{lstlisting}

\subsection{\CMD{mathsurround}}
\cIndex{mathsurround}Extra space added when switching in and out of the 
inline math mode (see section~\ref{subsec:whitespace}).

\subsection{\CMD{medmuskip}}
\cIndex{medmuskip}See section~\ref{subsec:mathskip} for an example.

\subsection{\CMD{mkern}}
\cIndex{mkern}Similiar to \verb+\kern+, but adds a math kern item to the current math list. Length must be a math unit.

\subsection{\CMD{mskip}}
\cIndex{mskip}Similiar to \verb+\skip+, but adds math glue to the current math list. Length must be a math unit.

\subsection{\CMD{muskip}}
\cIndex{muskip}Assigns a length with a math unit to one of the 256 \verb+\muskip+ register.

\subsection{\CMD{muskipdef}}
\cIndex{muskipdef}Defines a symbolic name for a \verb+\muskip+ register.

\subsection{\CMD{nonscript}}
\cIndex{nonscript}Ignores immediately following glue or kern in script and scriptscript styles, which makes
a redefinition of \verb+\mathchoice+ superfluous.

\subsection{\CMD{nulldelimiterspace}}
\cIndex{nulldelimiterspace}This is the width of a null or missing delimiter, e.g. \verb+\right.+ or for the left one.

\subsection{\CMD{predisplaysize}}
\cIndex{predisplaystyle}Is the effective width of the line preceeding a displayed equation, whether 
\verb+\abovedisplayskip+ or \verb+abovedisplayshortskip+ is used for the vertical skip. 

\subsection{\CMD{scriptspace}}
\cIndex{scriptspace}The space inserted after an exponent or index, predefined as \verb+\scriptspace=0.5pt+    %%% ----- Martin -----

\subsection{\CMD{thickmuskip}}
\cIndex{thickmuskip}See section~\ref{subsec:mathskip}.

\subsection{\CMD{thinmuskip}}
\cIndex{thinmuskip}The short version for positive skip is defined as \verb+\def\,{\mskip\thinmuskip}+ and the one
for a negative skip as \verb+\def\!{\mskip-\thinmuskip}+ (see also section~\ref{subsec:mathskip}).


\begin{showexample}[width=0.35\linewidth]
$\sqrt 2 x$ -- $\sqrt 2\,x$\\
$\sqrt{\log x}$ -- $\sqrt{\,\log x}$\\
$P\left({1/\sqrt n}\right)$ -- $P\left({1/ \sqrt n}\,\right)$\\[8pt]
 $[0,1)$ -- $[\,0,1)$\\
$x^2/2$ -- $x^2\!/2$\\
\end{showexample}

\begin{showexample}[width=0.35\linewidth]
\[\int\int_D dxdy \quad 
  \int\!\int_D dx\,dy\]
\[\int\!\!\int_D dx\,\,dy \quad 
  \int\!\!\!\int_D dx\,\,\,dy\]
\[\int\!\!\!\!\int_D dx\,\,\,\,dy \quad 
  \int\!\!\!\!\!\int_D dx\,\,\,\,\,dy\]
\[\int\!\!\!\int_D dx\,dy\]
\end{showexample}

\subsection{\CMD{medmuskip}}
See section~\ref{subsec:mathskip}.


\section{Math font macros}
\subsection{\CMD{delcode}}
\cIndex{delcode}Each character has not only a \verb+\catcode+ and \verb+\mathcode+ but also a \verb+\delcode+
which defines for a single chracter how it should look when used as a math delimiter.

\subsection{\CMD{delimiter}}
\cIndex{delimiter}Every character can be declared as a delimiter, but \TeX{} must know which characters
should be used for the default and the big size. For \LaTeX{} the macro \verb+\DeclareMathDelimiter+ should be used (see section~\ref{subsec:delim}). 

In the following example \verb+\tdela+ is the character $0x22$ ($\uparrow$) from font number $2$ (\verb+csmy+)  and character $0x78$ from font number $3$ (\verb+cmex+) for the big version.  
\verb+\tdelb+ is the same vice versa ($\downarrow$).
\begin{showexample}[width=0.35\linewidth]
\def\tdela{\delimiter"4222378\relax}
\def\tdelb{\delimiter"5223379\relax}

$\tdela x-y\tdelb(x+y)=x^2-y^2$

\[\tdela\sum_{n=0}^\infty {1\over2^n}\tdelb^2 = 4\]

\[\left\tdela\sum_{n=0}^\infty {1\over2^n}\right\tdelb^2 = 4\]
\end{showexample}

\subsection{\CMD{displaystyle}}
\cIndex{displaystyle}See section~\ref{sec:Styles} for an example.

\subsection{\CMD{fam}}
\cIndex{fam}When \TeX{} switches into the math mode, it typesets everything using one of the 16 
possible families of fonts. \verb+\fam+ in an internal register where other macros can check which font is the actual one. At the beginning \TeX{} starts with \verb+\fam=-1+.

\bigskip
\begin{center}
\begin{tabular}{ll}
\verb+\fam=-1+ & $\fam=-1 123abcABC\alpha\beta\gamma$\\
\verb+\fam=0+  & $\fam=0 123abcABC\alpha\beta\gamma$\\
\verb+\fam=1+  & $\fam=1 123abcABC\alpha\beta\gamma$\\
\verb+\fam=2+  & $\fam=2 123abcABC\alpha\beta\gamma$\\
\verb+\fam=3+  & $\fam=3 123abcABC\alpha\beta\gamma$\\
\verb+\fam=4+  & $\fam=4 123abcABC\alpha\beta\gamma$\\
\verb+\fam=5+  & $\fam=5 123abcABC\alpha\beta\gamma$
\end{tabular}
\end{center}


\begin{showexample}[width=0.3\linewidth]
$\mathrm{123abcABC\alpha\beta\gamma (\the\fam)}$\\[5pt]
$\mathbf{123abcABC\alpha\beta\gamma (\the\fam)}$\\[5pt]
$\mathit{123abcABC\alpha\beta\gamma (\the\fam)}$\\[5pt]
$\mathtt{123abcABC\alpha\beta\gamma (\the\fam)}$\\[5pt]
$\mathsf{123abcABC\alpha\beta\gamma (\the\fam)}$\\[5pt]
$\mathnormal{123abcABC\alpha\beta\gamma (\the\fam)}$
\end{showexample}


\subsection{\CMD{mathaccent}}
\cIndex{mathaccent}Requires three parameter as one number, the class, the font family and the character.

\begin{showexample}[width=0.3\linewidth]
\def\dA{\mathaccent"7015\relax}
{\Large $\dA{A}$}
\end{showexample}

\subsection{\CMD{mathbin}}
\cIndex{mathbin}Declares a following character as a binary symbol with another spacing before and behind such
a symbol.

\begin{showexample}[width=0.3\linewidth]
{\Large 
$a|b \quad a\mathbin| b$}
\end{showexample}

\subsection{\CMD{mathchar}}
\cIndex{mathchar}Declares a math character by three integer numbers as Parameters, giving its class,     %%% ----- Martin -----
font family, and font position. In the following example \verb+\mathchar+ defines a 
character of class 1 (big operators), font family 3 (math extension font) and number
58 (big sum character).

\begin{showexample}[width=0.3\linewidth]
{\Large 
$a\sum\limits_{i=1}^{\infty} b \quad 
 a\mathchar"1358\limits_{i=1}^{\infty} b$}
\end{showexample}

\subsection{\CMD{mathchardef}}
\cIndex{mathchardef}This is in principle the same as \verb+\mathchar+, it only allows to make such definitions permanent.     %%% ----- Martin -----

\begin{showexample}[width=0.25\linewidth]
\bgroup
\mathchardef\sum="1358
$a\sum\limits_{i=1}^{\infty}\sqrt{i+1}$\\[5pt]
\egroup
 
$a\sum\limits_{i=1}^{\infty}\sqrt{i+1}$ 
\end{showexample}


\subsection{\CMD{mathchoice}}
\cIndex{mathchoice}Specifies specific subformula sizes for the 4 main styles: \verb+displaystyle+ -- \verb+textstyle+ --
\verb+scriptstyle+ -- \verb+scriptscriptstyle+.

\begin{showexample}[width=0.15\linewidth]
\Large
\def\myRule{{%
  \color{red}%
  \mathchoice{\rule{2pt}{20pt}}{\rule{1pt}{10pt}}%
    {\rule{0.5pt}{5pt}}{\rule{0.25pt}{2.5pt}}%
    \mkern2mu}}
$\myRule\sum\limits_{\myRule i=1}^{\myRule\infty}%
 \myRule\frac{\myRule\sqrt{\myRule i+1}}{\myRule i^2}$
\end{showexample}

\subsection{\CMD{mathclose}}\label{subsec:mathclose}
\cIndex{mathclose}Assigns class 5 (closing character) to the following parameter, which can hold a single character
or a subformula.

\begin{showexample}[width=0.2\linewidth]
{\large
$A:\frac{B}{C}:D$\\[5pt]
$A\mathopen:\frac{B}{C}\mathclose: D $}
\end{showexample}


\subsection{\CMD{mathcode}}
\cIndex{mathcode}A math font is far different from a text font. A lot of the characters has to be defined with 
\verb+\mathcode+, which defines the character with its class, font family and character number, e.g.
\verb+\mathcode`\<="313C+. It defines the character ``<''{} as a realtion symbol (class 3) from
the font family 1 and the character number 0x3C, which is 60 decimal.

\subsection{\CMD{mathop}}
\cIndex{mathop}Assigns class 1 (large operator) to the parameter, which can be a single character or a subformula.

\begin{showexample}[width=0.2\linewidth]
\[ A_{i=1}^{\infty} \]
\[ \mathop{A}_{i=1}^{\infty} \]
\end{showexample}

\subsection{\CMD{mathopen}}
\cIndex{mathopen}Vice versa to \verb+\mathclose+ (see section~\ref{subsec:mathclose}).


\subsection{\CMD{mathord}}
\cIndex{mathord}Assigns class 0 (ordinary character) to the following parameter, which can be a single character 
or a subformula.

\begin{showexample}[width=0.2\linewidth]
{\large
$y = f(x)$\\[5pt]
$y \mathord= f(x)$}
\end{showexample}

\subsection{\CMD{mathpunct}}
\cIndex{mathpunct}Assigns class 6 (punctuation) to the following parameter, which can be a single character
or a subformula (see section~\ref{subsec:dot-comma} for an example).

\subsection{\CMD{mathrel}}
\cIndex{mathrel}Assigns class 3 (relation) to the following parameter, which can be a single character
or a subformula.

\begin{showexample}[width=0.25\linewidth]
{\large
$x_1 o x_2 o x_3$\\[5pt]
$x_1\mathrel o x_2\mathrel o x_3$}
\end{showexample}


\subsection{\CMD{scriptfont}}
\cIndex{scriptfont}Specifies the scriptstyle font (used for super/subscript) for a family.

\begin{showexample}[width=0.25\linewidth]
$A_1$
\font\tenxii=cmr12
\scriptfont0=\tenxii
$A_1$ 
\end{showexample}


\subsection{\CMD{scriptscriptfont}}
\cIndex{scriptscriptfont}Specifies the scriptscriptstyle font for a family. 

\subsection{\CMD{scriptscriptstyle}}
\cIndex{scriptscriptstyle}Selects scriptscript style for the following characters.

\subsection{\CMD{scriptstyle}}
\cIndex{scriptstyle}Selects script style for the following characters.


\subsection{\CMD{skew}}
\cIndex{skew}Especially for italic characters double accents are often misplaced. \verb+\skew+ has three arguments
\begin{description}
\item[horizontal shift:] A value in math units for the additional shift of the accent.
\item[the accent:] The symbol which is placed above the character.
\item[the character:] This is in general a single character, but can also include itself an accent.
\end{description}

\AmSmath\ redefines the setting of double accents. This is the reason why there are only a few
cases where someone has to use \verb+\skew+ when \verb+amsmath.sty+ is loaded, like
in this document.

\begin{showexample}[width=0.2\linewidth]
\large
$\tilde i$ \qquad $\tilde{A}$\\[5pt]
$\skew{3}{\tilde}{i}$ \qquad $\skew{7}{\tilde}{A}$
\end{showexample}

\subsection{\CMD{skewchar}}
\cIndex{skewchar}Is -1 or the character (reference symbol) used to fine-tune the positioning of math accents.

\subsection{\CMD{textfont}}
\cIndex{textfont}Specifies the text font for a family.

\subsection{\CMD{textstyle}}
\cIndex{textstyle}Selects the text style for the following characters.



\section{Math macros}


\subsection{\CMD{above}}
\cIndex{above}
\begin{showexample}[width=0.2\linewidth]
$a\above0pt b$\\[8pt]

${a\above1pt b}$\\[8pt]

${a\above2.5pt b}$\\[8pt]

$\displaystyle{a\above0pt b}$
\end{showexample}



\subsection{\CMD{abovewithdelims}}
\cIndex{abovewithdelims}
\begin{showexample}[width=0.2\linewidth]
$a\abovewithdelims()0pt b$\\[8pt]

\def\fdelimA{\abovewithdelims\{)1.0pt}
${a\fdelimA b}$\\[8pt]

\def\fdelimB{\abovewithdelims[]2.0pt}
${a\fdelimB b}$\\[8pt]

\def\fdelimC{\abovewithdelims\{.0pt}
$\displaystyle{a\fdelimC b}$
\end{showexample}

\subsection{\CMD{atop}}
\cIndex{atop}

\begin{showexample}[width=0.2\linewidth]
$a\atop b$\\[8pt]

$({n \atop k}) = {n!\above1pt k!(n-k)!}$\\[8pt]

$\displaystyle{a\atop b}$
\end{showexample}


\subsection{\CMD{atopwithdelims}}
\cIndex{atopwithdelims}
\begin{showexample}[width=0.2\linewidth]
$a\atopwithdelims() b$\\[8pt]

${n \atopwithdelims() k} = {n!\above1pt k!(n-k)!}$\\[8pt]

$\displaystyle{a\atopwithdelims\{. b}$
\end{showexample}

\subsection{\CMD{displaylimits}}
\cIndex{displaylimits}Resets the conventions for using limits with operators to the standard for the used environment.

\subsection{\CMD{eqno}}\label{subsec:eqno}
\cIndex{eqno}Puts an equation number at the right margin, the parameter can hold anything. \verb+\eqno+ places
only the parameter, but doesn't increase any equation counter.

\begin{showexample}[width=0.5\linewidth]
\[ y=f(x) \eqno{(A12)} \]
\end{showexample}

\subsection{\CMD{everydisplay}}
\cIndex{everydisplay}Inserts the parameter at the start of every switch to display math mode.

\begin{showexample}[width=0.4\linewidth]
\everydisplay{\color{red}
}
\[ f(x) = \int \frac{\sin x}{x}dx \]
\[ g(x) = \int \frac{\sin^2 x}{x^2}dx \]
\end{showexample}

\subsection{\CMD{everymath}}
\cIndex{everymath}Same as \verb+\everydisplay+, but now for the inline mode. In the following example
the displaystyle is used (besides using color red) for every inline math expression.    %%% ----- Martin -----

\bgroup
\begin{showexample}[width=0.45\linewidth]
\everymath{\color{red}%
  \displaystyle}
\[ f(x) = \int \frac{\sin x}{x}dx \]
Instead of $\frac{\sin x}{x}$ 
  now with $\frac{\cos x}{x}$:
\[ g(x) = \int \frac{\cos x}{x}dx \]
\end{showexample}
\egroup

Pay attention for side effects on footnotes and other macros which use the math mode for superscript
and other math related modes. In this case you'll get the footnotes also in red.

\subsection{\CMD{left}}
\cIndex{left}\TeX{} calculates the size of the following delimiter needed at the left side of a formula.
Requires an additional \verb+right+.

\subsection{\CMD{leqno}}
\cIndex{leqno}Vice versa to \verb+\eqno+ (see section~\ref{subsec:eqno}).

\subsection{\CMD{limits}}
\cIndex{limits}Typesets limits above and/or below operators (see section~\ref{sec:limits}).

\subsection{\CMD{mathinner}}
\cIndex{mathinner}Defines the following parameter as subformula.

\subsection{\CMD{nolimits}}
\cIndex{nolimits}The opposit of \verb+\limits+, instead of above/below limits are placed to the right of large 
operators (class 1).


\subsection{\CMD{over}}
\cIndex{over}Is equivalent to the fraction macro of \LaTeX{} and equivalent to the 
\verb+\overwithdelims+, see section~\ref{subsec:overwithdelims}.

\begin{showexample}[width=0.2\linewidth]
$ {a\over b} \qquad {{m\over n}\over{a+b}} $
\[ {m\over n}\over{a+b} \]
\end{showexample}


\subsection{\CMD{overline}}
\cIndex{overline}Puts a line over the following character or subformula and has the same problems with different
heights as underlines (see section~\ref{subsec:underline}).

\begin{showexample}[width=0.2\linewidth]
$\overline{x}+\overline{y}=\overline{z}$\\
\let\ol\overline
$ \ol{x} + \ol{A} = \ol{z} $\\[5pt]
\def\yPh{\vphantom{A}}
$ \ol{x\yPh} + \ol{A} = \ol{z\yPh} $
\end{showexample}

\subsection{\CMD{overwithdelims}}\label{subsec:overwithdelims}
\cIndex{overwithdelims}Is a generalized fraction command with preset fraction bar thickness.    %%% ----- Martin -----

\begin{showexample}[width=0.25\linewidth]
$ {a\overwithdelims() b} \qquad {{m\over n}\overwithdelims[]{a+b}} $
\[ {m\over n}\overwithdelims\{.{a+b} \]
\end{showexample}


\subsection{\CMD{radical}}
\cIndex{radical}Makes a radical atom from the delimiter (27-bit number) and the math field.

\begin{showexample}[width=0.2\linewidth]
\def\mySqrt{\radical"0270371\relax}
$ \mySqrt{\frac{1}{7}} $\\[5pt]

\def\mySqrt{\radical"0270372\relax}
$ \mySqrt{\frac{1}{7}} $\\[5pt]

\def\mySqrt{\radical"0270373\relax}
$ \mySqrt{\frac{1}{7}} $\\[5pt]

\def\mySqrt{\radical"0270374\relax}
$ \mySqrt{\frac{1}{7}} $\\[5pt]
\end{showexample}

\subsection{\CMD{right}}
\cIndex{right}Opposite to \verb+\left+, makes \TeX{} calculate the size of the delimiter needed at the right of a formula.

\subsection{\CMD{underline}}\label{subsec:underline}
\cIndex{underline}When there is a combination of variables with and without an index, the underlines are typeset    %%% ----- Martin -----
with a different depth. Using \verb+\vphantom+ in this case is a good choice. 

\begin{showexample}[width=0.2\linewidth]
$\underline{x}+\underline{y}=\underline{z}$\\

\let\ul\underline
\def\yPh{\vphantom{y}}
$ \ul{x\yPh} + \ul{y} = \ul{z\yPh} $\\

$ \ul{x_1} + \ul{y_2} = \ul{z_3} $
\end{showexample}

\subsection{\CMD{vcenter}}
\cIndex{vcenter}Centers vertical material with respect to the axis.


\section{Math penalties}

\subsection{\CMD{binoppenalty}}
\cIndex{binoppenalty}A penalty for  breaking math expressions between lines in a paragraph. TeX breaks lines only
when the binary symbol is not the last one and when the penalty is below 10,000.

\subsection{\CMD{displaywidowpenalty}}
\cIndex{displaywidowpenalty}The penalty which is added after the penultimate line immediately preceeding a display math formula.

\subsection{\CMD{postdisplaypenalty}}
\cIndex{postdisplaypenalty}Is added immediately after a math display ends.

\subsection{\CMD{predisplaypenalty}}
\cIndex{predisplaypenalty}Is added immediately before a math display starts.

\subsection{\CMD{relpenalty}}
\cIndex{relpenalty}The penalty for a line break after a relation symbol (if a break is possible).


\part{Other packages}
The following sections are not a replacement for the package documentation!
\section{List of available math packages}


\begin{center}
\noindent
\begin{tabular}{llll}
\href{http://www.dante.de/CTAN/help/Catalogue/entries/accents.html}{accents}&
\href{http://www.dante.de/CTAN/help/Catalogue/entries/alphalph.html}{alphalph}&
\href{http://www.dante.de/CTAN/help/Catalogue/entries/amsart.html}{amsart}&
\href{http://www.dante.de/CTAN/help/Catalogue/entries/amsbook.html}{amsbook}\\
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amsbsy.html}{amsbsy}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amscd.html}{amscd}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amscls.html}{amscls}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amsfonts.html}{amsfonts}\\
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amslatex.html}{amslatex}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amsltx11.html}{amsltx11}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amsmath.html}{amsmath}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amsppt.html}{amsppt}\\
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amsppt1.html}{amsppt1}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amsproc.html}{amsproc}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amssym.html}{amssym (plain TeX)}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amssymb.html}{amssymb (LaTeX)}\\
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amstex.html}{amstex (Plain TeX)}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amstext.html}{amstext}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/amsthm.html}{amsthm}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/bez123.html}{bez123}\\
\href{http://www.dante.de/CTAN//help/Catalogue/entries/bitfield.html}{bitfield}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/brclc.html}{brclc}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/breqn.html}{breqn}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/cancel.html}{cancel}\\
\href{http://www.dante.de/CTAN//help/Catalogue/entries/cases.html}{cases}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/comma.html}{comma}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/datenumber.html}{datenumber}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/diagxy.html}{diagxy}\\
\href{http://www.dante.de/CTAN//help/Catalogue/entries/doublestroke.html}{doublestroke}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/easyeqn.html}{easyeqn}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/easybmat.html}{easybmat}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/easymat.html}{easymat}\\
\href{http://www.dante.de/CTAN//help/Catalogue/entries/eqnarray.html}{eqnarray}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/esvect.html}{esvect}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/fixmath.html}{fixmath}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/fltpoint.html}{ftlpoint}\\
\href{http://www.dante.de/CTAN//help/Catalogue/entries/icomma.html}{icomma}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/leftidx.html}{leftidx}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/mathdots.html}{mathdots}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/mathematica.html}{mathematica}\\
\href{http://www.dante.de/CTAN//help/Catalogue/entries/mil3.html}{mil3}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/mtbe.html}{mtbe}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/nath.html}{Nath}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/numprint.html}{numprint}\\
\href{http://www.dante.de/CTAN//help/Catalogue/entries/random.html}{random}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/romannum.html}{romannum}&
\href{http://www.dante.de/CTAN//help/Catalogue/entries/texaide.html}{TeXaide}&
\end{tabular}
\end{center}

The following examples depend on the listed versions of the packages:    %%% ----- Martin -----

{\small
\begin{verbatim}
  amsopn.sty    1999/12/14 v2.01 operator names
      bm.sty    1999/07/05 v1.0g Bold Symbol Support (DPC/FMi)
  empheq.sty    2004/08/03 v2.11 Emphasizing equations (MH)
   amscd.sty    1999/11/29 v2.0
 accents.sty    2000/08/06 v1.2 Math Accent Tools
  framed.sty    2002/12/29 v 0.5: framed or shaded text with page breaks
  pstcol.sty    2001/06/20 v1.1 PSTricks color colompatibility (DPC)
pstricks.sty    2004/05/06 v0.2k LaTeX wrapper for `PSTricks' (RN,HV)
pstricks.tex    2003/03/07 v97 patch 15 `PSTricks' (tvz)
pst-node.sty    1997/03/25 package wrapper for PSTricks pst-node.tex
delarray.sty    1994/03/14 v1.01 array delimiter package (DPC)
   xypic.sty    1999/02/16 Xy-pic version 3.7
 exscale.eps    Graphic file (type veps)
\end{verbatim}
}


\section{\texttt{accents}}\label{sec:package-accent}
\index{Accent}If you want to write for example an underlined M, then you can do it by    %%% ----- Martin -----

\medskip
\begin{tabular}{ll}
\verb|\underline{$M$}| & \underline{$M$}\\
\verb|\underbar{$M$}|  & \underbar{$M$}\\
\verb|\underaccent{\bar}{M}| & $\underaccent{\bar}{M}$
\end{tabular}
\medskip

As seen, there is no difference between \verb|\underline| and \verb|\underbar|. For    %%% ----- Martin -----
some reasons it may be better to use the package \verb|accents.sty| with the
\verb|\underaccents| macro.

\section{\texttt{amscd} -- commutative diagrams}

\verb|amscd.sty|\index{amscd.sty} is part of the \AmSmath bundle
or available at CTAN%
\footnote{\href{http://www.ctan.org/tex-archive/macros/latex/required/amslatex/math/amscd.dtx}%
{CTAN://macros/latex/required/amslatex/math/amscd.dtx}} and has no options for the
\verb|\usepackage| command.
\texttt{amscd.sty} does not support diagonal arrows but is much     %%% ----- Martin -----
easier to handle than the complex pstricks\index{pstricks.sty} or
the xypic\index{xypic.sty} package. On the other hand simple diagrams
can be written with the array environment or look at \cite{taylor00}.

\[
\begin{CD}
  R\times S\times T @>\text{restriction}>> S\times T \\
        @VprojVV                            @VVprojV \\
  R\times S         @<<\text{inclusion}<        S
\end{CD}
\]

\begin{lstlisting}
\[
\begin{CD}
  R\times S\times T @>\text{restriction}>> S\times T \\
        @VprojVV                            @VVprojV \\
  R\times S         @<<\text{inclusion}<        S
\end{CD}
\]
\end{lstlisting}


\section{\texttt{amsopn}}\label{sec:amsopn}
With this package it is very easy to declare new math operators, which are written in
upright mode:

$\underset{s=p}{Res}\quad\text{versus}\quad\underset{s=p}{\Res}$

\medskip
\begin{lstlisting}
\documentclass[10pt]{article}
\usepackage{amsmath}
\usepackage{amsopn}
\DeclareMathOperator{\Res}{Res}
\begin{document}
$\underset{s=p}{Res}\quad\underset{s=p}{\Res}$
\end{document}
\end{lstlisting}

Table~\ref{tab:amsopn} shows the predefined operatornames of \verb+amsopn+.

\begin{table}[htb]
\centering
\begin{tabular}{llllll}
\verb+\arccos+ & $\arccos$ & \verb+\arcsin+ & $\arcsin$ & \verb+\arctan+ & $\arctan$\\
\verb+\arg+    & $\arg$    & \verb+\cos+    & $\cos$    & \verb+\cosh+   & $\cosh$\\
\verb+\cot+    & $\cot$    & \verb+\coth+   & $\coth$   & \verb+\csc+    & $\csc$\\
\verb+\deg+    & $\deg$    & \verb+\det+    & $\det$    & \verb+\dim+    & $\dim$\\
\verb+\exp+    & $\exp$    & \verb+\gcd+    & $\gcd$    & \verb+\hom+    & $\hom$\\
\verb+\inf+    & $\inf$    & \verb+\injlim+ & $\injlim$ & \verb+\ker+    & $\ker$\\
\verb+\lg+     & $\lg$     & \verb+\lim+    & $\lim$    & \verb+\liminf+ & $\liminf$\\
\verb+\limsup+ & $\limsup$ & \verb+\ln+     & $\ln$     & \verb+\log+    & $\log$\\
\verb+\max+    & $\max$    & \verb+\min+    & $\min$    & \verb+\Pr+     & $\Pr$\\
\verb+\projlim+& $\projlim$& \verb+\sec+    & $\sec$    & \verb+\sin+    & $\sin$\\
\verb+\sinh+   & $\sinh$   & \verb+\sup+    & $\sup$    & \verb+\tan+    & $\tan$\\
\verb+\tanh+   & $\tanh$
\end{tabular}
\caption{The predefined operators of \texttt{amsopn.sty}}\label{tab:amsopn}
\end{table}


\section{\texttt{bigdel}}\label{sec:bigdelim}
This is a very useful package together with the \verb|multirow.sty| package.
In the following example we need additional parentheses for a different
number of rows. This is also possible with the \verb|array| environment,
but not as easy as with \verb|bigdelim.sty|. The trick is that you need one
separate column for a big delimiter, but with empty cells in all rows, which
the delimiter spans.

\[
  \begin{pmatrix}
     & x_{11} & x_{12} & \dots & x_{1p} & \rdelim\}{4}{3cm}[some text]\\
     \ldelim[{5}{1cm}[text] & x_{21} & x_{22} & \dots & x_{2p} \\
     & \vdots\\
     & x_{n_1 1}& x_{n_1 2} & \dots & x_{n_1 p}\\
     & x_{n_1+1,1}&x_{n_1+1,2} & \dots & x_{n_1+1, p} &
         \rdelim\}{3}{3cm}[some more text]\\
     & \vdots\\
     & x_{n_1+n_2, 1} & x_{n_1+n_2,2} & \dots & x_{n_1+n_2,p}\\
     & \vdots \\
  \end{pmatrix}
\]

\begin{lstlisting}[xleftmargin=-1cm,xrightmargin=-1.5cm]
\[
  \begin{pmatrix}
     & x_{11} & x_{12} & \dots & x_{1p} & \rdelim\}{4}{3cm}[some text]\\
     \ldelim[{5}{1cm}[text] & x_{21} & x_{22} & \dots & x_{2p} \\
     & \vdots\\
     & x_{n_1 1}& x_{n_1 2} & \dots & x_{n_1 p}\\
     & x_{n_1+1,1}&x_{n_1+1,2} & \dots & x_{n_1+1, p} &
         \rdelim\}{3}{3cm}[some more text]\\
     & \vdots\\
     & x_{n_1+n_2, 1} & x_{n_1+n_2,2} & \dots & x_{n_1+n_2,p}\\
     & \vdots \\
  \end{pmatrix}
\]
\end{lstlisting}

As seen in the above listing the left big delimiter is placed in the first
column, all other rows start with second column. It is possible to use all
columns above and below the delimiter. For the \verb|array| environment
there must be two more columns defined, in case of a big delimiter left and
right. The syntax of \verb|\ldelim| and \verb|\rdelim| is:
\begin{verbatim}
\ldelim<delimiter>{<n rows>}{<added horizontal space>}[<text>]
\rdelim<delimiter>{<n rows>}{<added horizontal space>}[<text>]
\end{verbatim}

Any delimiter which is possible for the \verb|\left| or \verb|\right| command
is allowed, e.g.: ``\verb/()[]{}|/''. The text is an optional argument and    %%% ----- Martin -----
always typeset in text mode.

\section{\texttt{bm}}\label{sec:bm}
By default the math macro \verb|mathbf| writes everything in bold and in upright mode
$\mathbf{y=f(x)}$  (\verb|$\mathbf{y=f(x)}$|), but it should be in italic mode especially
for variables $\bm{y=f(x)}$ (\verb|$\bm{y=f(x)}$|). For writing a whole formula in bold
have a look at section \vref{sec:boldmath}.


\section{\texttt{braket}}\label{sec:braket}
It is available at
 \href{http://www.ctan.org/tex-archive/macros/latex/contrib/other/misc/braket.sty}%
{CTAN://macros/latex/contrib/other/misc/braket.sty}
and provides several styles for writing math expressions inside brakets. For example:

\[ \left\{ x\in\mathbf{R} | 0<{|x|}<\frac{5}{3}\right\} \]

\begin{lstlisting}
\[ \left\{ x\in\mathbf{R} | 0<{|x|}<\frac{5}{3}\right\} \]
\end{lstlisting}

\noindent looks not quit right and it is not really easy to get the first vertical line in the same
size as the outer braces. Some solution may be using \CMD{vphantom}:    %%% ----- Martin -----

\[
\left\{\vphantom{\frac{5}{3}}x\in\mathbf{R} \right|\left. 0<{|x|}<\frac{5}{3}\right\}
\]

\begin{lstlisting}
\[
\left\{\vphantom{\frac{5}{3}}x\in\mathbf{R} \right|\left. 0<{|x|}<\frac{5}{3}\right\}
\]
\end{lstlisting}

\verb|braket.sty| has the macros

\begin{lstlisting}
\Bra{<math expression>}
\Ket{<math expression>}
\Braket{<math expression>}
\Set{<math expression>}
\end{lstlisting}

\noindent and the same with a leading lower letter, which are not really interesting.

\[ \Bra{x\in\mathbf{R} | 0<|x|<\frac{5}{3}} \]
\[ \Ket{x\in\mathbf{R} | 0<|x|<\frac{5}{3}} \]
\[ \Braket{x\in\mathbf{R} | 0<|x|<\frac{5}{3}} \]
\[ \Braket{x\in\mathbf{R} | 0<\vert x\vert <\frac{5}{3}} \]
\[ \Set{x\in\mathbf{R} | 0<|x|<\frac{5}{3}} \]

\begin{lstlisting}
\[ \Bra{x\in\mathbf{R} | 0<|x|<\frac{5}{3}} \]
\[ \Ket{x\in\mathbf{R} | 0<|x|<\frac{5}{3}} \]
\[ \Braket{x\in\mathbf{R} | 0<|x|<\frac{5}{3}} \]
\[ \Braket{x\in\mathbf{R} | 0<\vert x\vert <\frac{5}{3}} \]
\[ \Set{x\in\mathbf{R} | 0<|x|<\frac{5}{3}} \]
\end{lstlisting}

The difference between the \CMD{Set} and the \CMD{Braket} macro is the  handling of the
vertical lines. In \CMD{Set} only the first one gets the same size as the
braces\index{Braces} and in \CMD{Braket} all.

\[  \Braket{ \phi | \frac{\partial^2}{\partial t^2} | \psi }\]
\[  \Set{ \phi | \frac{\partial^2}{\partial t^2} | \psi }\]
\begin{lstlisting}
\[\Braket{\phi | \frac{\partial^2}{\partial t^2} | \psi}\]
\[\Set{\phi | \frac{\partial^2}{\partial t^2} | \psi}\]
\end{lstlisting}


\CMD{Bra} and \CMD{Ket} do nothing with the inner vertical lines.


\section{\texttt{cancel}}\label{cancel.sty}
This is a nice package for canceling anything in mathmode with a slash, backslash or a \verb+X+. To get
a horizontal line we can define an additional macro called \verb+hcancel+ with an optional argument
for the line color (requires package \verb+color+):
\begin{lstlisting}
\newcommand\hcancel[2][black]{\setbox0=\hbox{#2}%
	\rlap{\raisebox{.45\ht0}{\textcolor{#1}{\rule{\wd0}{1pt}}}}#2}
\end{lstlisting}

It is no problem to redefine the \verb+cancel+ macros to get also colored lines. A horizontal line for
single characters is also decribed in section \vref{sec:Accents}.

\medskip
\noindent
\verb+\cancel+: $f(x)=\dfrac{\left(x^2+1\right)\cancel{(x-1)}}{\cancel{(x-1)}(x+1)}$\\[0.5cm]
\verb+\bcancel+: $\bcancel{3}\qquad\bcancel{1234567}$\\[0.5cm]
\verb+\xcancel+: $\xcancel{3}\qquad\xcancel{1234567}$\\[0.5cm]
\verb+\hcancel+: $\hcancel{3}\qquad\hcancel[red]{1234567}$

\bigskip
\begin{lstlisting}
$f(x)=\dfrac{\left(x^2+1\right)\cancel{(x-1)}}{\cancel{(x-1)}(x+1)}$\\[0.5cm]
$\bcancel{3}\qquad\bcancel{1234567}$\\[0.5cm]
$\xcancel{3}\qquad\xcancel{1234567}$\\[0.5cm]
$\hcancel{3}\qquad\hcancel[red]{1234567}$
\end{lstlisting}


\section{\texttt{delarray}}\label{delarray}

Package \texttt{delarray.sty}%
\footnote{\href{http://www.ctan.org/tex-archive/macros/latex/required/tools/delarray.dtx}{CTAN://macros/latex/required/tools/delarray.dtx}%
} supports different delimiters which are defined together with the
beginning of an array:

\begin{lstlisting}
\begin{array}<delLeft>{cc}<delRight>
...
\end{lstlisting}

\noindent defines an array with two centered columns and the delimiters\\
``\texttt{<delLeft><delRight>}{}'', e.g. ``\texttt{()}{}''.

\medskip{}
\begin{minipage}[c]{0.45\textwidth}%
\begin{lstlisting}
\[
A=\begin{array}({cc})
	a & b\\
	c & d
\end{array}
\]
\end{lstlisting}

\end{minipage}%
\hfill{}\begin{minipage}[c]{0.45\textwidth}%
\[
A=\begin{array}({cc})
a & b \\
c & d
\end{array}
\]
\end{minipage}%

\medskip{}

\verb|delarray.sty| expects a pair of delimiters. If you need only
one (like the cases structure) then use the dot for an ``empty''
delimiter, e.g.

\medskip{}
\begin{minipage}[c]{0.45\textwidth}%
\begin{lstlisting}
\[
A=\begin{array}\{{cc}.
	a & b\\
	c & d
\end{array}
\]
\end{lstlisting}

\end{minipage}%
\hfill{}\begin{minipage}[c]{0.45\textwidth}%
\[A=\begin{array}\{{cc}.
a & b \\
c & d
\end{array}\]
\end{minipage}%

\medskip{}

\noindent which is a useful command for a cases structure without the \AmSmath package, which is described in the \AmSmath part.


\section{\texttt{empheq}}\label{sec:empheq}

This package supports different frames for math environments of the \AmSmath
package. It doesn't support  all the environments from standard \LaTeX{} which    %%% ----- Martin -----
are not modified by \AmSmath, e.g. \verb|eqnarray|.

With the optional argument of the environment \verb|empheq| the preferred box type
can be specified. A simple one is \verb|\fbox|

\begin{empheq}[box=\fbox]{align}
	f(x)=\int_1^{\infty}\frac{1}{x^2}\,dt=1
\end{empheq}

\begin{lstlisting}
\begin{empheq}[box=\fbox]{align}
	f(x)=\int_1^{\infty}\frac{1}{x^2}\,dt=1
\end{empheq}
\end{lstlisting}

The same is possible with the macro \verb|\colorbox|:
\begin{empheq}[box={\fboxsep=10pt\colorbox{yellow}}]{align}
	f(x)=\int_1^{\infty}\frac{1}{x^2}\,dt=1
\end{empheq}

\begin{lstlisting}
\begin{empheq}[box={\fboxsep=10pt\colorbox{yellow}}]{align}
	f(x)=\int_1^{\infty}\frac{1}{x^2}\,dt=1
\end{empheq}
\end{lstlisting}

The key \verb|box| can hold any possible \LaTeX{} command sequence. Boxing
subequations is also no problem, the \verb|empheq| environment works in the same way:

\begin{subequations}
\begin{empheq}[box={\fboxsep=10pt\colorbox{cyan}}]{align}
	f(x) & =\int_1^{\infty}\frac{1}{x^1}\,dt=1\\
	f(x) & =\int_2^{\infty}\frac{1}{x^2}\,dt=0.25
\end{empheq}
\end{subequations}

\begin{lstlisting}
\begin{subequations}
\begin{empheq}[box={\fboxsep=10pt\colorbox{cyan}}]{align}
	f(x) & =\int_1^{\infty}\frac{1}{x^2}\,dt=1\\
	f(x) & =\int_2^{\infty}\frac{1}{x^2}\,dt=0.25
\end{empheq}
\end{subequations}
\end{lstlisting}

For more information on \verb|empheq| have a look at the documentation of the package
which is available at any CTAN server.

\section{\texttt{esint}}\label{sec:esint}
This is a very useful package when you want nice double or triple integral or curve
integral symbols. The ones from \verb|wasysym|%
\footnote{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/wasysym/}%
{CTAN://macros/latex/contrib/wasysym/}} are not the best.
\verb|esint|\footnote{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/esint/}%
{CTAN://macros/latex/contrib/esint/}
\href{http://www.ctan.org/tex-archive/fonts/ps-type1/esint/}{CTAN://fonts/ps-type1/esint/}} supports the following symbols:

\allowdisplaybreaks
\begin{align}
\text{\CMD{int}}      &: \int\\
\text{\CMD{iint}}     &: \iint\\
\text{\CMD{iiintop}}  &: \iiintop\\
\text{\CMD{iiiintop}} &: \iiiintop\\
\text{\CMD{dotsintop}}&: \dotsintop\\
\text{\CMD{ointop}}   &: \ointop\\
\text{\CMD{oiint}}    &: \oiint\\
\text{\CMD{sqint}}    &: \sqint\\
\text{\CMD{sqiint}}   &: \sqiint\\
\text{\CMD{ointctrclockwise}}    &: \ointctrclockwise\\
\text{\CMD{ointclockwise}}       &: \ointclockwise\\
\text{\CMD{varointclockwise}}    &: \varointclockwise\\
\text{\CMD{varointctrclockwise}} &: \varointctrclockwise\\
\text{\CMD{fint}}        &: \fint\\
\text{\CMD{varoiint}}    &: \varoiint\\
\text{\CMD{landupint}}   &: \landupint\\
\text{\CMD{landdownint}} &: \landdownint
\end{align}


\section{\texttt{eucal} and \texttt{euscript.sty}}\label{sec:euscript.sty}

These packages should be part of your local \TeX{} installation, because
they come with the \AmSmath packages. Otherwise get them from CTAN%
\footnote{\href{http://www.ctan.org/tex-archive/fonts/amsfonts/latex/euscript.sty}%
{CTAN://fonts/amsfonts/latex/euscript.sty}}. They support a scriptwriting of only uppercase
letters:

\begin{center}
\texttt{\textbackslash{}mathscr\{...\}}\index{EuScript@\textbackslash EuScript}
{$\EuScript{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$}
\end{center}

Read the documentation for the interdependence to the    %%% ----- Martin -----
\verb|\mathcal| command. For the above example the
package \verb|eucal.sty| was loaded with the option \verb|mathscr|.


\section{\texttt{exscale}}\label{sec:exscale}

The following formula is written with the default fontsize where everything
looks more or less well:

\[
\int_{-1}^{+1}\frac{f(x)}{\sqrt{1-x^{2}}}\,%
dx\approx\frac{\pi}{n}\sum_{i=1}^{n}f\left(\cos\left(\frac{2i-1}{2n}\right)\right)\]


Writing the same with the fontsize \texttt{\textbackslash{}huge} gives
a surprising result, which belongs to the historical development of
\LaTeX{}, the int\index{int@\textbackslash int} and sum\index{sum@\textbackslash sum} symbols
are not stretched. This extreme fontsize is often needed for slides
and not only written ``just for fun{}''.

\begin{center}
\includegraphics{exscale}
\end{center}

Using the \texttt{exscale.sty}%
\footnote{\href{http://www.ctan.org/tex-archive/macros/latex/base/}%
{CTAN://macros/latex/base/}} package, which should be part of any local \TeX{}
installation, all symbols get the right size.

\begin{minipage}[c]{1.0\textwidth}%
\centering\huge\[
\int_{-1}^{+1}\frac{f(x)}{\sqrt{1-x^{2}}}\, dx\approx\frac{\pi}{n}%
\sum_{i=1}^{n}f\left(\cos\left(\frac{2i-1}{2n}\right)\right)\]
\end{minipage}%

\section{\texttt{relsize}}\label{sec:relsize}
Often consecutives math operators are used, like two sum symbols, e.g.:
\[  \sum\sum_{i=1}^n i^2 \]


As seen the sums are of the same size. To increase the first operator size, someone
can use the \verb+\scalebox+ macro from \verb+graphicx+ and write an own macro    %%% ----- Martin -----
\verb+\Sum+, e.g.:\index{Operator!size}\index{Size!Operator}

\begin{lstlisting}
\def\Sum{\ensuremath\mathop{\scalebox{1.2}{$\displaystyle\sum$}}}
\[ \Sum_{j=1}\sum_{i=1}^\infty i \]
\end{lstlisting}

\def\Sum{\ensuremath\mathop{\scalebox{1.2}{$\displaystyle\sum$}}}
\[ \Sum_{j=1}\sum_{i=1}^\infty i \]

Another solution is to use the \verb+relsize+\footnote{\href{http://www.ctan.org/tex-archive/macros/latex/ltxmisc/}%
{CTAN://macros/latex/ltxmisc/}} package together with the \verb+exscale+
one. \verb+relsize+ defines a useful macro \verb+mathlarger+:

\begin{showexample}
\[ \mathlarger{\sum}\sum_{i=1}^n i^2 \]
\end{showexample}


\section{\texttt{xypic}}\label{xypic.sty}

The \texttt{xymatrix}\index{xymatrix@\textbackslash xymatrix} macro is part of the
\verb+xypic+ package%
\footnote{\href{http://www.ctan.org/tex-archive/support/latex2html/}%
{CTAN://macros/generic/diagrams/xypic/xy-3.7/}} which can be loaded with several options
which are not so important.%
\footnote{For more information look at the style file \texttt{xy.sty}, which
is often saved in \texttt{/usr/share/texmf/tex/generic}}.

\begin{equation}
\xymatrix{A\POS[];[d]**\dir{~},[];[dr]**\dir{-} & B & C\\
D & E\POS[];[l]**\dir{.},[];[r]**\dir{~} & F\POS[];[dl]**\dir{~}\\
G & H & I}
\label{eq:xymatrix}
\end{equation}


This matrix was created with

\begin{lstlisting}
\[
\xymatrix{ A\POS [];[d]**\dir {~},[];[dr]**\dir {-} & B & C\\
 D & E\POS [];[l]**\dir {.},[];[r]**\dir {~} & F\POS [];[dl]**\dir {~}\\
 G & H & I}
\]
\end{lstlisting}


\part{Special symbols}

In this section only those symbols are defined, which are not part of the    %%% ----- Martin -----
list of all available symbols:
\href{http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf}%
{CTAN://info/symbols/comprehensive/symbols-a4.pdf}. With
\verb+fontmath.ltx+ \LaTeX{} itself defines the following special symbols for using inside math:    %%% ----- Martin -----

\begin{table}[htb]
\centering
\begin{tabular}{l|c}
Name & Meaning\\\hline
\verb+\mathparagraph+ & $\mathparagraph$\\
\verb+\mathsection+ & $\mathsection$\\
\verb+\mathdollar+ & $\mathdollar$\\
\verb+\mathsterling+ & $\mathsterling$\\
\verb+\mathunderscore+ & $\mathunderscore$\\
\verb+\mathellipsis+ & $\mathellipsis$\\
\end{tabular}
\caption{Predefined math symbols from \texttt{fontmath.ltx}}\label{fontmath.ltx}
\end{table}

\section{Integral symbols}
\index{Integral symbols}

\def\Xint#1{\mathchoice
   {\XXint\displaystyle\textstyle{#1}}%
   {\XXint\textstyle\scriptstyle{#1}}%
   {\XXint\scriptstyle\scriptscriptstyle{#1}}%
   {\XXint\scriptscriptstyle\scriptscriptstyle{#1}}%
   \!\int}
\def\XXint#1#2#3{{\setbox0=\hbox{$#1{#2#3}{\int}$}
     \vcenter{\hbox{$#2#3$}}\kern-.5\wd0}}
\def\ddashint{\Xint=}
\def\dashint{\Xint-}
\def\clockint{\Xint\circlearrowright} % GOOD!
\def\counterint{\Xint\rotcirclearrowleft} % Good for Computer Modern!
\def\rotcirclearrowleft{\mathpalette{\RotLSymbol{-30}}\circlearrowleft}
\def\RotLSymbol#1#2#3{\rotatebox[origin=c]{#1}{$#2#3$}}

\begin{center}
\begin{tabular}{lc}
Name & Symbol\\\hline
\verb|\dashint| & $\dashint$\\
\verb|\ddashint| & $\ddashint$\\
\verb|\clockint| & $\clockint$\\
\verb|\counterint| & $\counterint$
\end{tabular}
\end{center}

For all new integral symbols limits can be used in the usual way:

\begin{equation}
\ddashint_01=\dashint_10<\oint\limits_{-\infty}^\infty = \clockint\counterint_A
\end{equation}

\begin{lstlisting}
\ddashint_01=\dashint_10<\oint\limits_{-\infty}^\infty = \clockint\counterint_A
\end{lstlisting}

Put the following definitions into the preamble to use one or all of these new
integral symbols.

\begin{lstlisting}
\def\Xint#1{\mathchoice
   {\XXint\displaystyle\textstyle{#1}}%
   {\XXint\textstyle\scriptstyle{#1}}%
   {\XXint\scriptstyle\scriptscriptstyle{#1}}%
   {\XXint\scriptscriptstyle\scriptscriptstyle{#1}}%
   \!\int}
\def\XXint#1#2#3{{\setbox0=\hbox{$#1{#2#3}{\int}$}
     \vcenter{\hbox{$#2#3$}}\kern-.5\wd0}}
\def\ddashint{\Xint=}
\def\dashint{\Xint-}
\def\clockint{\Xint\circlearrowright} % GOOD!
\def\counterint{\Xint\rotcirclearrowleft} % Good for Computer Modern!
\def\rotcirclearrowleft{\mathpalette{\RotLSymbol{-30}}\circlearrowleft}
\def\RotLSymbol#1#2#3{\rotatebox[origin=c]{#1}{$#2#3$}}
\end{lstlisting}

%\clearpage
\section{Harpoons}
\LaTeX{} knows no stretchable harpoon\index{Harpoon} symbols, like \verb|\xrightarrow|.
The following code defines several harpoon symbols.%
\index{xrightharpoondown@\textbackslash xrightharpoondown}
\index{xrightharpoonup@\textbackslash xrightharpoonup}
\index{xleftharpoondown@\textbackslash xleftharpoondown}
\index{xleftharpoonup@\textbackslash xleftharpoonup}
\index{xleftrightharpoons@\textbackslash xleftrightharpoons}
\index{xrightleftharpoons@\textbackslash xrightleftharpoons}%
%
\marginpar{\CMD{xrightharpoondown}\\%
\CMD{xrightharpoonup}\\%
\CMD{xleftharpoondown}\\%
\CMD{xleftharpoonup}\\%
\CMD{xleftrightharpoons}\\%
\CMD{xrightleftharpoons}%
}

\begin{lstlisting}
\def\rightharpoondownfill@{%
	\arrowfill@\relbar\relbar\rightharpoondown}
\def\rightharpoonupfill@{%
	\arrowfill@\relbar\relbar\rightharpoonup}
\def\leftharpoondownfill@{%
	\arrowfill@\leftharpoondown\relbar\relbar}
\def\leftharpoonupfill@{%
	\arrowfill@\leftharpoonup\relbar\relbar}
\newcommand{\xrightharpoondown}[2][]{%
	\ext@arrow 0359\rightharpoondownfill@{#1}{#2}}
\newcommand{\xrightharpoonup}[2][]{%
	\ext@arrow 0359\rightharpoonupfill@{#1}{#2}}
\newcommand{\xleftharpoondown}[2][]{%
	\ext@arrow 3095\leftharpoondownfill@{#1}{#2}}
\newcommand{\xleftharpoonup}[2][]{%
	\ext@arrow 3095\leftharpoonupfill@{#1}{#2}}
\newcommand{\xleftrightharpoons}[2][]{\mathrel{%
	\raise.22ex\hbox{%
		$\ext@arrow 3095\leftharpoonupfill@{\phantom{#1}}{#2}$}%
	\setbox0=\hbox{%
		$\ext@arrow 0359\rightharpoondownfill@{#1}{\phantom{#2}}$}%
	\kern-\wd0 \lower.22ex\box0}%
}
\newcommand{\xrightleftharpoons}[2][]{\mathrel{%
	\raise.22ex\hbox{%
		$\ext@arrow 3095\rightharpoonupfill@{\phantom{#1}}{#2}$}%
	\setbox0=\hbox{%
		$\ext@arrow 0359\leftharpoondownfill@{#1}{\phantom{#2}}$}%
	\kern-\wd0 \lower.22ex\box0}%
}
\end{lstlisting}

\begin{tabular}{ll}
\verb|\xrightharpoondown[under]{over}| & $\xrightharpoondown[under]{over}$\\[10pt]
\verb|\xrightharpoonup[under]{over}|   & $\xrightharpoonup[under]{over}$ \\[10pt]
\verb|\xleftharpoondown[under]{over}|  & $\xleftharpoondown[under]{over}$\\[10pt]
\verb|\xleftharpoonup[under]{over}|    & $\xleftharpoonup[under]{over}$  \\[10pt]
\verb|\xleftrightharpoons[under]{over}|& $\xleftrightharpoons[under]{over}$\\[10pt]
\verb|\xrightleftharpoons[under]{over}|& $\xrightleftharpoons[under]{over}$
\end{tabular}


\section{Bijective mapping arrow}

To get something like \bijmap~we can define:
\begin{lstlisting}
\def\bijmap{%
	\ensuremath{%
		\mathrlap{\rightarrowtail}\rightarrow%
	}%
}
\end{lstlisting}

This uses the \verb+\mathrlap+ definition from section~\vref{subsec:ams-limits}. With this
definition a huge symbol is also possible: \verb+{\Huge\bijmap}+ {\Huge\bijmap}.

\section{Stacked equal sign}
There are several symbols stacked with an equal sign, e.g. \verb+\doteq+, \verb+\equiv+ or
\verb+\cong+ ($\doteq$, $\equiv{}$, $\cong$ ). But there are still some missing, which are
shown in table~\ref{tab:equal} and the following definitions.

\begin{table}[htb]
\centering
\begin{tabular}{ll}
\verb+\eqdef+ & \eqdef\\
\verb+\eqexcl+ & \eqexcl\\
\verb+\eqhat+ & \eqhat
\end{tabular}
\caption{New symbols in combination with the equal sign}\label{tab:equal}
\end{table}

\begin{lstlisting}
\newcommand{\eqdef}{\ensuremath{\stackrel{\mathrm{def}}{=}}}
\newcommand{\eqexcl}{\ensuremath{\stackrel{\mathrm{!}}{=}}}
\newcommand{\eqhat}{\ensuremath{\widehat{=}}}
\end{lstlisting}

\section{Other symbols}

\begin{minipage}{0.7\linewidth}
\begin{lstlisting}
\newcommand*{\threesim}{%
  \mathrel{\vcenter{\offinterlineskip
  \hbox{$\sim$}\vskip-.35ex\hbox{$\sim$}\vskip-.35ex\hbox{$\sim$}}}}
$\threesim ABC$
\end{lstlisting}%
\end{minipage}\hfill
\begin{minipage}{0.15\linewidth}
$\threesim ABC$
\end{minipage}




\part{Examples}

\section{Matrix}
\subsection{Identity matrix}

There are several possibilities to write this matrix. Here is a solution
with the default array environment.

\begin{minipage}[c]{0.4\textwidth}%
\[
\left(\begin{array}{ccccc}
1\\
 & 1 &  & \text{{\huge{0}}}\\
 &  & 1\\
 & \text{{\huge{0}}} &  & 1\\
 &  &  &  & 1\end{array}\right)\]

\end{minipage}%
\hfill{}\begin{minipage}[c]{0.49\textwidth}%
\begin{lstlisting}
\[
\left(\begin{array}{ccccc}
1\\
 & 1 &  & \text{{\huge{0}}}\\
 &  & 1\\
 & \text{{\huge{0}}} &  & 1\\
 &  &  &  & 1\end{array}\right)
\]
\end{lstlisting}
\end{minipage}%

\subsection{System of linear equations}

\begin{LTXexample}[pos=t]
\[
\begin{array}{l@{\:=\:}*{5}{l@{\:+\:}}l}
y_1 & x_{11} & x_{12} & x_{13} & \dots & x_{1(n-1)} & x_{1n} \\
y_2 & x_{21} & x_{22} & x_{23} & \dots & x_{2(n-1)} & x_{2n} \\
\ \vdots &\ \vdots &\ \vdots &\ \vdots &\ \vdots &\ \vdots &\ \vdots\\
y_{n-1} & x_{(n-1)1} & x_{(n-1)2} & x_{(n-1)3} & \dots & x_{(n-1)3} & x_{(n-1)n}\\
y_n & x_{n1} & x_{n2} & x_{n3} & \dots & x_{(n-1)(n-1)} & x_{nn}
\end{array} 
\]
\end{LTXexample}

\section{Cases structure}

\index{Cases!numbered lines}Sometimes it is better to use the array environment instead of amsmath's    %%% ----- Martin -----
cases environment. To get optimal horizontal spacing for the conditions,
there are two matrixes in series, one $3\times 1$ followed by $3\times 3$ matrix.
To minimize the horizontal space around the variable $z$ a

\begin{lstlisting}
\addtolength{\arraycolsep}{-3pt}
\end{lstlisting}
is a useful command.

\begin{equation}
\addtolength{\arraycolsep}{-3pt}
I(z)=\delta_{0}\left\{%
	\begin{array}{lcrcl}
		D+z & \quad & -D & \le z\le & -p\\
		D-\frac{1}{2}\left(p-\frac{z^{2}}{p}\right)%
			 & \quad & -p & \le z\le & \phantom{-}p\\
		D-z & \quad & p & \le z\le & \phantom{-}D
	\end{array}\right.
\end{equation}

\begin{lstlisting}
\addtolength{\arraycolsep}{-3pt}
I(z)=\delta_{0}\left\{%
	\begin{array}{lcrcl}
		D+z & \quad & -D & \le z\le & -p\\
		D-\frac{1}{2}\left(p-\frac{z^{2}}{p}\right)%
			 & \quad & -p & \le z\le & \phantom{-}p\\
		D-z & \quad & p & \le z\le & \phantom{-}D
	\end{array}\right.
\end{equation}
\end{lstlisting}


The \CMD{phantom}\index{phantom@\textbackslash phantom} command
replaces exactly that place with whitespace which the argument needs.

\subsection{Cases with numbered lines}
This is not possible in an easy way, because \verb+cases+ uses the array
environment for typesetting which has by default no numbering. However, there
are some tricky ways to get numbered lines. The following three examples
use the \verb+tabular+, the \verb+tabularx+ and the \verb+array+ environment.   

\bigskip\noindent
\begin{tabular}{rc}
\ldelim\{{2}{2.75cm}[some text here] &      %%% ----- Martin -----
   \parbox{{\linewidth-3cm-4\tabcolsep}}{
   \vspace*{1ex}
   \begin{flalign}
     x & = 2\quad\text{if }y >2 &\\
     x & = 3\quad\text{if }y \le 2&
   \end{flalign}}
\end{tabular}

\bigskip
\begin{lstlisting}
\begin{tabular}{rc}
\ldelim\{{2}{2.75cm}[some text here] &      %%% ----- Martin -----
   \parbox{{\linewidth-3cm-4\tabcolsep}}{
   \vspace*{1ex}
   \begin{flalign}
     x & = 2\quad\text{if }y >2 &\\
     x & = 3\quad\text{if }y \le 2&
   \end{flalign}}
\end{tabular}
\end{lstlisting}


\bigskip\noindent
\begin{tabularx}{\linewidth}{rXc}
\ldelim\{{2}{2.75cm}[some text here]     %%% ----- Martin -----
  & $ x = 2\quad\text{if }y > 2  $ & \refstepcounter{equation}(\theequation)\\
  & $ x = 3\quad\text{if }y \le 2$ &\refstepcounter{equation}(\theequation)
\end{tabularx}

\bigskip
\begin{lstlisting}
\begin{tabularx}{\linewidth}{rXc}
\ldelim\{{2}{2.75cm}[some text here]     %%% ----- Martin -----
  & $ x = 2\quad\text{if }y > 2  $ & \refstepcounter{equation}(\theequation)\\
  & $ x = 3\quad\text{if }y \le 2$ &\refstepcounter{equation}(\theequation)
\end{tabularx}
\end{lstlisting}


\bigskip
\[
\begin{array}{rc@{\qquad}c}
\ldelim\{{2}{2.75cm}[some text here]     %%% ----- Martin -----
  & x = 2\quad\text{if }y > 2  & \refstepcounter{equation}(\theequation)\\
  & x = 3\quad\text{if }y \le 2& \refstepcounter{equation}(\theequation)
\end{array}
\]


\bigskip
\begin{lstlisting}
\[
\begin{array}{rc@{\qquad}c}
\ldelim\{{2}{2.75cm}[some text here]     %%% ----- Martin -----
  & x = 2\quad\text{if }y > 2  & \refstepcounter{equation}(\theequation)\\
  & x = 3\quad\text{if }y \le 2& \refstepcounter{equation}(\theequation)
\end{array}
\]
\end{lstlisting}



\section{Arrays}

There is a general rule that a lot of mathematical stuff should be
divided in smaller pieces. But sometimes it is difficult to get a nice
horizontal alignment when splitting a formula. The following ones
uses the \texttt{array} environment to get a proper alignment.


\subsection{Quadratic equation}

\begin{equation}
\begin{array}{rcll}
y & = & x^{2}+bx+c\\
  & = & x^{2}+2\cdot{\displaystyle\frac{b}{2}x+c}\\
  & = & \underbrace{x^{2}+2\cdot\frac{b}{2}x+\left(\frac{b}{2}\right)^{2}}-{\displaystyle%
 \left(\frac{b}{2}\right)^{2}+c}\\
 &  & \qquad\left(x+{\displaystyle \frac{b}{2}}\right)^{2}\\
 & = & \left(x+{\displaystyle \frac{b}{2}}\right)^{2}-\left({\displaystyle%
 \frac{b}{2}}\right)^{2}+c & \left|+\left({\displaystyle%
 \frac{b}{2}}\right)^{2}-c\right.\\
y+\left({\displaystyle \frac{b}{2}}\right)^{2}-c & = & \left(x+{\displaystyle%
 \frac{b}{2}}\right)^{2} & \left|(\textrm{Scheitelpunktform})\right.\\
y-y_{S} & = & (x-x_{S})^{2}\\
S(x_{S};y_{S}) & \,\textrm{bzw.}\, & S\left(-{\displaystyle%
 \frac{b}{2};\,\left({\displaystyle \frac{b}{2}}\right)^{2}-c}\right)
\end{array}
\end{equation}

\begin{lstlisting}
\begin{equation}
\begin{array}{rcll}
y & = & x^{2}+bx+c\\
  & = & x^{2}+2\cdot{\displaystyle\frac{b}{2}x+c}\\
  & = & \underbrace{x^{2}+2\cdot\frac{b}{2}x+\left(\frac{b}{2}\right)^{2}}-{\displaystyle%
 \left(\frac{b}{2}\right)^{2}+c}\\
 &  & \qquad\left(x+{\displaystyle \frac{b}{2}}\right)^{2}\\
 & = & \left(x+{\displaystyle \frac{b}{2}}\right)^{2}-\left({\displaystyle%
\frac{b}{2}}\right)^{2}+c & \left|+\left({\displaystyle%
\frac{b}{2}}\right)^{2}-c\right.\\
y+\left({\displaystyle \frac{b}{2}}\right)^{2}-c & = & \left(x+{\displaystyle%
\frac{b}{2}}\right)^{2} & \left|(\textrm{Scheitelpunktform})\right.\\
y-y_{S} & = & (x-x_{S})^{2}\\
S(x_{S};y_{S}) & \,\textrm{bzw.}\, & S\left(-{\displaystyle%
\frac{b}{2};\,\left({\displaystyle \frac{b}{2}}\right)^{2}-c}\right)
\end{array}
\end{equation}
\end{lstlisting}



\subsection{Vectors and matrices}
\index{Vector}
\begin{equation}
\begin{array}{rcl}
\underline{RS} & = & \left(\begin{array}{cccccccc}
01 & a4 & 55 & 87 & 5a & 58 & db & 9e\\
a4 & 56 & 82 & f3 & 1e & c6 & 68 & e5\\
02 & a1 & fc & c1 & 47 & ae & 3d & 19\\
a4 & 55 & 87 & 5a & 58 & db & 9e & 03\end{array}\right)\\
\\
\left(\begin{array}{c}
	s_{i,0}\\
	s_{i,1}\\
	s_{i,2}\\
	s_{i,3}
\end{array}\right) & = & \underline{RS}\cdot%
\left(\begin{array}{c}
	m_{8i+0}\\
	m_{8i+1}\\
	\cdots\\
	m_{8i+6}\\
	m_{8i+7}
\end{array}\right)\\
\\
S_{i} & = & \sum_{j=0}^{3}s_{i,j}\cdot2^{8j}\qquad i=0,1,...,k-1\\
\\
S & = & \left(S_{k-1},S_{k-2},...,S_{1},S_{0}\right)
\end{array}
\end{equation}

\begin{lstlisting}
\begin{equation}
\begin{array}{rcl}
\underline{RS} & = & \left(\begin{array}{cccccccc}
01 & a4 & 55 & 87 & 5a & 58 & db & 9e\\
a4 & 56 & 82 & f3 & 1e & c6 & 68 & e5\\
02 & a1 & fc & c1 & 47 & ae & 3d & 19\\
a4 & 55 & 87 & 5a & 58 & db & 9e & 03\end{array}\right)\\
\\
\left(\begin{array}{c}
	s_{i,0}\\
	s_{i,1}\\
	s_{i,2}\\
	s_{i,3}
\end{array}\right) & = & \underline{RS}\cdot%
\left(\begin{array}{c}
	m_{8i+0}\\
	m_{8i+1}\\
	\cdots\\
	m_{8i+6}\\
	m_{8i+7}
\end{array}\right)\\
\\
S_{i} & = & \sum_{j=0}^{3}s_{i,j}\cdot2^{8j}\qquad i=0,1,...,k-1\\
\\
S & = & \left(S_{k-1},S_{k-2},...,S_{1},S_{0}\right)
\end{array}
\end{equation}
\end{lstlisting}


\subsection{Cases with (eqn)array environment}

This solution is important when \AmSmath can't be used.    %%% ----- Martin -----

$\lim\limits_{n->\infty}q^{n}=\left\{%
	\begin{array}{lc@{\kern2pt}c@{\kern2pt}r}
		\textrm{divergent}\  & q & \le & -1\\
		0 & |q| & < & 1\\
		1 &  q  & = & 1\\
		\infty  & q & > & 1
	\end{array}\right.$

\medskip
\begin{lstlisting}
$\lim\limits_{n->\infty}q^{n}=\left\{%
	\begin{array}{lc@{\kern2pt}c@{\kern2pt}r}
		\textrm{divergent}\  & q & \le & -1\\
		0 & |q| & < & 1\\
		1 &  q  & = & 1\\
		\infty  & q & > & 1
	\end{array}\right.$
\end{lstlisting}
%$

\subsection{Arrays inside arrays}
The array environment is a powerful one because it can be nested in several ways:

\[
\left(
\begin{array}{c@{}c@{}c}
\begin{array}{|cc|}
\hline
a_{11} & a_{12} \\
a_{21} & a_{22} \\
\hline
\end{array} & 0 & 0 \\
0 & \begin{array}{|ccc|}
    \hline
    b_{11} & b_{12} & b_{13}\\
    b_{21} & b_{22} & b_{23}\\
    b_{31} & b_{32} & b_{33}\\
    \hline
    \end{array} & 0 \\
0 & 0 & \begin{array}{|cc|}
        \hline
        c_{11} & c_{12} \\
        c_{21} & c_{22} \\
        \hline
        \end{array} \\
\end{array}
\right)
\]

\begin{lstlisting}
\[
\left(
\begin{array}{c@{}c@{}c}
	\begin{array}{|cc|}\hline
		a_{11} & a_{12} \\
		a_{21} & a_{22} \\\hline
	\end{array} & \mathbf{0} & \mathbf{0} \\
	\mathbf{0} &
	\begin{array}{|ccc|}\hline
		b_{11} & b_{12} & b_{13}\\
		b_{21} & b_{22} & b_{23}\\
		b_{31} & b_{32} & b_{33}\\\hline
	\end{array} & \mathbf{0} \\
	\mathbf{0} & \mathbf{0} &
	\begin{array}{|cc|}\hline
		c_{11} & c_{12} \\
		c_{21} & c_{22} \\\hline
	\end{array} \\
\end{array}
\right)
\]
\end{lstlisting}

\[
Y^1=
\begin{array}{c}
	\null\\[1ex]% kann weg
	\left[\begin{array}{rrrr}
		0 & 0 & 1 & 0\\
		1 & 0 & 1 & 0\\
		1 & 1 & 1 & 1
	\end{array}\right]\\[3ex]\hline
	\begin{array}{rrrr}
%		\hdotsfor{4}\\% statt \\[3ex]\hline
		2 & 1 &3 & 1
	\end{array}
\end{array}
\]

\begin{lstlisting}
\[
Y^1=
\begin{array}{c}
	\null\\[1ex]% only vor vertical alignment
	\left[\begin{array}{rrrr}
		0 & 0 & 1 & 0\\
		1 & 0 & 1 & 0\\
		1 & 1 & 1 & 1
	\end{array}\right]\\[3ex]\hline
	\begin{array}{rrrr}
%		\hdotsfor{4}\\%( needs \AmSmath) instead of \\[3ex]\hline
		2 & 1 &3 & 1
	\end{array}
\end{array}
\]
\end{lstlisting}

\subsection{Colored cells}\label{sub:color}
In general there is no difference in coloring tabular or array cells. The following example
shows how one can put \index{color}colors in rows, columns and cells.
\index{rowcolor@\textbackslash rowcolor}\index{columncolor@\textbackslash columncolor}

\medskip
\includegraphics[width=\columnwidth]{colArray}
%\[
%\left[\,
%\begin{array}{*{5}{>{\columncolor[gray]{0.95}}c}}
%  {h_{k,1,0}(n)} & {h_{k,1,1}(n)} & {h_{k,1,2}(n)} & \zero & \zero \\
%  {h_{k,2,0}(n)} & {h_{k,2,1}(n)} & {h_{k,2,2}(n)} & \zero & \zero \\
%  {h_{k,3,0}(n)} & {h_{k,3,1}(n)} & {h_{k,3,2}(n)} & \zero & \zero \\
%  {h_{k,4,0}(n)} & \colCell{umbra}{h_{k,4,1}(n)} & {h_{k,4,2}(n)} & \zero & \zero \\
%  \zero & {h_{k,1,0}(n-1)} & {h_{k,1,1}(n-1)} & {h_{k,1,2}(n-1)} & \zero \\
%  \zero & {h_{k,2,0}(n-1)} & {h_{k,2,1}(n-1)} & {h_{k,2,2}(n-1)} & \zero \\
%  \zero & {h_{k,3,0}(n-1)} & {h_{k,3,1}(n-1)} & {h_{k,3,2}(n-1)} & \zero \\
%  \zero & \colCell{umbra}{h_{k,4,0}(n-1)} & {h_{k,4,1}(n-1)} & {h_{k,4,2}(n-1)} & \zero \\
%  \zero & \zero & {h_{k,1,0}(n-2)} & {h_{k,1,1}(n-2)} & {h_{k,1,2}(n-2)}\\
%  \rowcolor[gray]{0.75}%
%  \zero & \zero & {h_{k,2,0}(n-2)} & {h_{k,2,1}(n-2)} & {h_{k,2,2}(n-2)}\\
%  \zero & \zero & {h_{k,3,0}(n-2)} & {h_{k,3,1}(n-2)} & {h_{k,3,2}(n-2)}\\
%  \zero & \zero & {h_{k,4,0}(n-2)} & {h_{k,4,1}(n-2)} & {h_{k,4,2}(n-2)}
%\end{array} \,\right]
%\end]


\medskip
\begin{lstlisting}[xrightmargin=-1cm]
...
\usepackage{array}
\usepackage{colortbl}
\definecolor{umbra}{rgb}{0.8,0.8,0.5}
\def\zero{\multicolumn{1}{>{\columncolor{white}}c}{0}}
\def\colCell#1#2{\multicolumn{1}{>{\columncolor{#1}}c}{#2}}
\begin{document}
\[\left[\,
\begin{array}{*{5}{>{\columncolor[gray]{0.95}}c}}
  h_{k,1,0}(n) & h_{k,1,1}(n) & h_{k,1,2}(n) & \zero & \zero\\
  h_{k,2,0}(n) & h_{k,2,1}(n) & h_{k,2,2}(n) & \zero & \zero\\
  h_{k,3,0}(n) & h_{k,3,1}(n) & h_{k,3,2}(n) & \zero & \zero\\
  h_{k,4,0}(n)} & \colCell{umbra}{h_{k,4,1}(n)} & h_{k,4,2}(n) & \zero & \zero\\
  \zero & h_{k,1,0}(n-1) & h_{k,1,1}(n-1) & h_{k,1,2}(n-1) & \zero\\
  \zero & h_{k,2,0}(n-1) & h_{k,2,1}(n-1) & h_{k,2,2}(n-1) & \zero\\
  \zero & h_{k,3,0}(n-1) & h_{k,3,1}(n-1) & h_{k,3,2}(n-1) & \zero\\
  \zero & \colCell{umbra}{h_{k,4,0}(n-1)} & h_{k,4,1}(n-1) & h_{k,4,2}(n-1) & \zero\\
  \zero & \zero & h_{k,1,0}(n-2) & h_{k,1,1}(n-2) & h_{k,1,2}(n-2)\\
  \zero & \zero & h_{k,2,0}(n-2) & h_{k,2,1}(n-2) & h_{k,2,2}(n-2)\\
  \zero & \zero & h_{k,3,0}(n-2) & h_{k,3,1}(n-2) & h_{k,3,2}(n-2)\\
  \zero & \zero & h_{k,4,0}(n-2) & h_{k,4,1}(n-2) & h_{k,4,2}(n-2)
\end{array} \,\right]_{12\times 5}\]
...
\end{lstlisting}



\section{Over- and underbraces}
\subsection{Braces and roots}
To put an underbrace in a root without enlarging the root symbol is possible with
the \verb+\makebox+ macro:

\[ z =\;\;\underbrace{\makebox[\widthof{~$x^2+y^2$}][r]{$\sqrt{x^2+y^2}$}}_{=z^2} \]

\begin{lstlisting}
\[
z =\;\;\underbrace{%
  \makebox[\widthof{~$x^2+y^2$}][r]{%
     $\sqrt{x^2+y^2}$}}_{=z^2}
\]
\end{lstlisting}



\subsection{Overlapping braces}
Overlapping under- and overbraces like%
\parbox{10em}{\begin{align*}
\qquad\overbrace{\qquad\qquad}^o\qquad\\[-16pt]
\underbrace{\qquad\qquad}_{u1}\underbrace{\qquad\qquad}_{u2}
\end{align*}} needs some tricky code, because we cannot have parts of the argument inside
\verb+overbrace+\index{overbrace@\textbackslash overbrace} and also \verb+underbrace+.
\index{underbrace@\textbackslash underbrace} The following equation~\vref{eq:pqFormel}
is an example for such a construction:

\begin{align}\label{eq:pqFormel}
y &= 2x^2 -3x +5\nonumber\\
  & \hphantom{= \ 2\left(x^2-\frac{3}{2}\,x\right. }%
         \textcolor{blue}{%
              \overbrace{\hphantom{+\left(\frac{3}{4}\right)^2- %
                  \left(\frac{3}{4}\right)^2}}^{=0}}\nonumber\\[-11pt]
  &= 2\left(\textcolor{red}{%
     \underbrace{%
         x^2-\frac{3}{2}\,x + \left(\frac{3}{4}\right)^2}%
     }%
     \underbrace{%
        - \left(\frac{3}{4}\right)^2 + \frac{5}{2}}%
     \right)\\
  &= 2\left(\qquad\textcolor{red}{\left(x-\frac{3}{4}\right)^2}
     \qquad + \ \frac{31}{16}\qquad\right)\nonumber\\
y\textcolor{blue}{-\frac{31}{8}}
  &= 2\left(x\textcolor{cyan}{-\frac{3}{4}}\right)^2\nonumber
\end{align}

\medskip
\begin{lstlisting}
\begin{align}\label{eq:pqFormel}
y &= 2x^2 -3x +5\nonumber\\
  & \hphantom{= \ 2\left(x^2-\frac{3}{2}\,x\right. }%
         \textcolor{blue}{%
              \overbrace{\hphantom{+\left(\frac{3}{4}\right)^2- %
                  \left(\frac{3}{4}\right)^2}}^{=0}}\nonumber\\[-11pt]
  &= 2\left(\textcolor{red}{%
     \underbrace{%
         x^2-\frac{3}{2}\,x + \left(\frac{3}{4}\right)^2}%
     }%
     \underbrace{%
        - \left(\frac{3}{4}\right)^2 + \frac{5}{2}}%
     \right)\\
  &= 2\left(\qquad\textcolor{red}{\left(x-\frac{3}{4}\right)^2}
     \qquad + \ \frac{31}{16}\qquad\right)\nonumber\\
y\textcolor{blue}{-\frac{31}{8}}
  &= 2\left(x\textcolor{cyan}{-\frac{3}{4}}\right)^2\nonumber
\end{align}
\end{lstlisting}

\subsection[Vertical alignment]{Vertical alignment of different braces}
When having several braces in one formula line, then it looks better when all
braces are also on the same line, e.g.:

\begin{equation}
	\binom{x_R}{y_R} = \underbrace{r\vphantom{\binom{A}{B}}}_{\text{Scaling}}\cdot%
    \underbrace{%
		\begin{pmatrix}
    		\sin \gamma & -\cos \gamma \\
    		\cos \gamma & \sin \gamma \\
		\end{pmatrix}%
    }_{\text{Rotation}}
	\binom{x_K}{y_K} +
    \underbrace{\binom{t_x}{t_y}}_{\text{Translation}}
\end{equation}

\begin{lstlisting}
\begin{equation}
	\binom{x_R}{y_R} = \underbrace{r\vphantom{\binom{A}{B}}}_{\text{Skaling}}\cdot%
    \underbrace{%
		\begin{pmatrix}
    		\sin \gamma & -\cos \gamma \\
    		\cos \gamma & \sin \gamma \\
		\end{pmatrix}%
    }_{\text{Rotation}}
	\binom{x_K}{y_K} +
    \underbrace{\binom{t_x}{t_y}}_{\text{Translation}}
\end{equation}
\end{lstlisting}

It is again the \verb+\vphantom+ macro which reserves the needed vertical space.
Nevertheless the horizontal space around the \verb+r+ of the first underbrace and the last \verb|+| should
be decreased to get a better typesetting. This is possible with \verb+\hspace+ or
simply \verb+\kern+:

\[ \binom{x_R}{y_R} = %
    \kern-10pt\underbrace{r\vphantom{\binom{A}{B}}}_{\text{Skaling}}\kern-10pt%
    \cdot\underbrace{%
      \begin{pmatrix}
        \sin \gamma & -\cos \gamma \\
        \cos \gamma & \sin \gamma \\
      \end{pmatrix}%
    }_{\text{Rotation}}
  \binom{x_K}{y_K} +\kern-5pt%
  \underbrace{\binom{t_x}{t_y}}_{\text{Translation}} \]

\begin{lstlisting}
\[ \binom{x_R}{y_R} = %
    \kern-10pt\underbrace{r\vphantom{\binom{A}{B}}}_{\text{Skaling}}\kern-10pt%
    \cdot\underbrace{%
      \begin{pmatrix}
        \sin \gamma & -\cos \gamma \\
        \cos \gamma & \sin \gamma \\
      \end{pmatrix}%
    }_{\text{Rotation}}
  \binom{x_K}{y_K} +\kern-5pt%
  \underbrace{\binom{t_x}{t_y}}_{\text{Translation}} \]
\end{lstlisting}


\subsection[Alignment]{Vertical and horizontal alignment}
The forgoing example simply uses \verb+\hspace+ to decrease the horizontal width between two
\index{underbrace@\textbackslash underbrace} underbraces. This may be okay for a single solution, but in general it is better to have some    %%% ----- Martin -----
code which works in any case.

The following example looks simple but it needs some tricky code to get vertical and horizontal
alignment.\index{substack@\textbackslash substack}

\def\num#1{\hphantom{#1}}
\def\vsp{\vphantom{\rangle_1}}

\begin{equation*}
    \frac{300}{5069}%
    \underbrace{\longmapsto\vphantom{\frac{1}{1}}}_{%
	   \mathclap{\substack{%
	     \Delta a=271\num9\vsp \\[2pt]
	     \Delta b=4579\vsp\\[2pt]
	     \text{$1$ iteration}%
	   }}} \frac{29}{490}%
	\underbrace{\longmapsto \frac{19}{321}\longmapsto}_{%
      \mathclap{\substack{%
	     \Delta a=10\num{9}=\langle271\rangle_{29}\num{20}\\[2pt]
         \Delta b=169=\langle4579\rangle_{490}\\[2pt]
         \text{$2$ iterations}
      }}} \frac{9}{152}
    \underbrace{\longmapsto \frac{8}{135}\longmapsto\dots\longmapsto}_{%
      \substack{%
	    \Delta a=1\num{7}=\langle10\rangle_{9}\num{119}\\[2pt]
	    \Delta b=17=\langle169\rangle_{152}\\[2pt]
	    \text{$8$ iterations}
      }} \frac{1}{16}
    \underbrace{\longmapsto\dots\longmapsto\vphantom{\frac{8}{135}}}_{%
      \substack{%
	     \Delta a=0=\langle1\rangle_{1}\num{76} \\[2pt]
	     \Delta b=1=\langle17\rangle_{16} \\[2pt]
         \text{$8$ iterations}
      }} \frac{1}{1}
\end{equation*}

It uses the macro \verb+\mathclap+ defined in section\vref{subsec:ams-limits}
\index{mathclap@\textbackslash mathclap}\index{vphantom@\textbackslash vphantom}\index{hphantom@\textbackslash hphantom}
, which gives a better result.    %%% ----- Martin -----
It is also possible to use \verb+\makebox[0pt]{...}+ but it works only in text mode
and this needs some more \verb+$...$+.\index{substack@\textbackslash substack}

\begin{lstlisting}
\def\num#1{\hphantom{#1}}
\def\vsp{\vphantom{\rangle_1}}

\begin{equation*}
    \frac{300}{5069}%
    \underbrace{\longmapsto\vphantom{\frac{1}{1}}}_{%
	   \mathclap{\substack{%
	     \Delta a=271\num9\vsp \\[2pt]
	     \Delta b=4579\vsp\\[2pt]
	     \text{$1$ iteration}%
	   }}} \frac{29}{490}%
	\underbrace{\longmapsto \frac{19}{321}\longmapsto}_{%
      \mathclap{\substack{%
	     \Delta a=10\num{9}=\langle271\rangle_{29}\num{20}\\[2pt]
         \Delta b=169=\langle4579\rangle_{490}\\[2pt]
         \text{$2$ iterations}
      }}} \frac{9}{152}
    \underbrace{\longmapsto \frac{8}{135}\longmapsto\dots\longmapsto}_{%
      \substack{%
	    \Delta a=1\num{7}=\langle10\rangle_{9}\num{119}\\[2pt]
	    \Delta b=17=\langle169\rangle_{152}\\[2pt]
	    \text{$8$ iterations}
      }} \frac{1}{16}
    \underbrace{\longmapsto\dots\longmapsto\vphantom{\frac{8}{135}}}_{%
      \substack{%
	     \Delta a=0=\langle1\rangle_{1}\num{76} \\[2pt]
	     \Delta b=1=\langle17\rangle_{16} \\[2pt]
         \text{$8$ iterations}
      }} \frac{1}{1}
\end{equation*}
\end{lstlisting}


\section{Integrals}\label{sec:Integrals}
\index{underset@\textbackslash underset}
\def\Q#1#2{\frac{\partial #1}{\partial #2}}
%
The \emph{first theorem of Green} is:
\[
\underset{\mathcal{G}\quad}\iiint\!%
	\left[u\nabla^{2}v+\left(\nabla u,\nabla v\right)\right]d^{3}V%
	=\underset{\mathcal{S}\quad}\oiint u\Q{v}{n}d^{2}A
\]

The \emph{second theorem of Green} is:

\[
\underset{{\mathcal{G}\quad}}\iiint\!%
	\left[u\nabla^{2}v-v\nabla^{2}u\right]d^{3}V%
	=\underset{\mathcal{S}\quad}\oiint%
	\left(u\Q{v}{n}-v\Q{u}{n}\right)d^{2}A
\]


They are both written with the \texttt{esint.sty} package%
\footnote{See section~\vref{sec:Integrals}.}, which gives nice integral symbols.  The \LaTeX{} code for the first equation is:

\begin{lstlisting}
\[
\underset{\mathcal{G}\quad}\iiint\!%
	\left[u\nabla^{2}v+\left(\nabla u,\nabla v\right)\right]d^{3}V%
	=\underset{\mathcal{S}\quad}\oiint u\Q{v}{n}d^{2}A
\]
\end{lstlisting}

\noindent with the following definition in the preamble for the partial derivation:

\begin{lstlisting}
\def\Q#1#2{\frac{\partial#1}{\partial #2}}
\end{lstlisting}

\noindent which makes things easier to write.

%--------------------------------------------------------------------------
\section{Vertical alignment}\label{sec:verticalAlignment}
%--------------------------------------------------------------------------
\subsection{Example 1}
%--------------------------------------------------------------------------
Sometimes it may be useful to have a vertical alignment over the whole page with a mix of    %%% ----- Martin -----
formulas and text. Section \ref{sec:Text-in-math mode} shows the use of \CMD{intertext}.
There is another trick to get all formulas vertical aligned.  Let's have the following
formulas distributed over the whole page:

\begin{align*}
     f(x) &= a\\
     g(x) &= x2-4x\\
f(x)-g(x) &= x2+x3+x\\
        g &= x2+x3+x4+x5+b
\end{align*}

They all have a different length of the left and right side. Now we want to write some
text and other objects between them, but let the alignment untouched. We choose the
longest left and the longest right side and take them for scaling with the \CMD{hphantom}
command:

\begin{verbatim}
\hphantom{\mbox{$f(x)-g(x)$}} & \hphantom{\mbox{$= x^2+x^3+x^4+x^5+b$}}
\end{verbatim}

This is the first (empty) line in every equation where now all other lines are aligned to
this one. For example:

\medskip\noindent
\rule{\columnwidth}{1pt}
\newcommand{\x}{blah blah blah blah blah blah blah blah }
\addtolength{\abovedisplayshortskip}{-1cm} % decrease the skip
\addtolength{\abovedisplayskip}{-1cm}
\x\x\x\x\x
\begin{align}
\hphantom{\mbox{$f(x)-g(x)$}} & \hphantom{\mbox{$= x^2+x^3+x^4+x^5+b$}}\nonumber\\
f(x) &= a\\
g(x) &= x^2-4x
\end{align}

\x\x\x\x\x
\begin{align}
\hphantom{\mbox{$f(x)-g(x)$}} & \hphantom{\mbox{$= x^2+x^3+x^4+x^5+b$}}\nonumber\\
f(x)-g(x) &= x^2+x^3+x
\end{align}
\x\x\x\x\x

\begin{align}
\hphantom{\mbox{$f(x)-g(x)$}} & \hphantom{\mbox{$= x^2+x^3+x^4+x^5+b$}}\nonumber\\
g(x) &= x^2+x^3+x^4+x^5+b
\end{align}
\x\x\x\x\x
% restore old values
\addtolength{\abovedisplayshortskip}{1cm}
\addtolength{\abovedisplayskip}{1cm}

\noindent
\rule{\columnwidth}{1pt}
\medskip

The phantom line is empty but leaves the vertical space for a line. This could be
corrected with decreasing the \CMD{abovedisplayshortskip} length and restoring them
after the whole sequence of commands. The code of the above looks like:

\begin{lstlisting}
\newcommand{\x}{blah blah blah blah blah blah blah blah }
\addtolength{\abovedisplayshortskip}{-1cm} % decrease the skip
\addtolength{\abovedisplayskip}{-1cm}
\x\x\x\x\x
\begin{align}
\hphantom{\mbox{$f(x)-g(x)$}} & \hphantom{\mbox{$= x^2+x^3+x^4+x^5+b$}}\nonumber\\
f(x) &= a\\
g(x) &= x^2-4x
\end{align}

\x\x\x\x\x
\begin{align}
\hphantom{\mbox{$f(x)-g(x)$}} & \hphantom{\mbox{$= x^2+x^3+x^4+x^5+b$}}\nonumber\\
f(x)-g(x) &= x^2+x^3+x
\end{align}
\x\x\x\x\x

\begin{align}
\hphantom{\mbox{$f(x)-g(x)$}} & \hphantom{\mbox{$= x^2+x^3+x^4+x^5+b$}}\nonumber\\
g(x) &= x^2+x^3+x^4+x^5+b
\end{align}
\x\x\x\x\x
% restore old values
\addtolength{\abovedisplayshortskip}{1cm}
\addtolength{\abovedisplayskip}{1cm}
\end{lstlisting}




Another case of aligning equations inside an itemize environment is the following one.
With the \verb+\makebox+ macro one can have the same size on the left side of the
equal sign to get a vertical alignment.

\newsavebox\lW
\sbox\lW{$P_{3}+P_{2}-P_{1}$}%   $

\begin{itemize}
\item first function \\
  $\displaystyle\makebox[\wd\lW][r]{$P_1$}=\sum_a \in A$
\item but another one \\
  $\makebox[\wd\lW][r]{$\sin\left(P_1\right)$}=blabla$
\item or perhaps \\
  $P_{3}+P_{2}-P_{1}=blablub$
\end{itemize}


\begin{lstlisting}
\newsavebox\lW
\sbox\lW{$P_{3}+P_{2}-P_{1}$}

\begin{itemize}
\item first function \\
  $\displaystyle\makebox[\wd\lW][r]{$P_1$}=\sum_a \in A$
\item but another one \\
  $\makebox[\wd\lW][r]{$\sin\left(P_1\right)$}=blabla$
\item or perhaps \\
  $P_{3}+P_{2}-P_{1}=blablub$
\end{itemize}
\end{lstlisting}
%$

%--------------------------------------------------------------------------
\subsection{Example 2}
%--------------------------------------------------------------------------
This one comes from Hartmut Henkel and offers a special form of placing
additional text between the equation and the equationnumber. This makes only
sense when you load the documentclass with the option \verb+fleqn+. The example
places the additional text at \verb+0.5\textwidth+, changing this value is no
problem.

\clearpage
\medskip
\noindent\rule{\linewidth}{1pt}
\begingroup
\small
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text

\makeatletter
\@fleqntrue
\let\old@mathmargin=\@mathmargin
\@mathmargin=-1sp
\let\oldmathindent=\mathindent
\let\mathindent=\@mathmargin
\newsavebox{\myendhook} % hier gehen die Tabellen rein
\def\tagform@#1{{(\maketag@@@{\ignorespaces#1\unskip\@@italiccorr)}
  \makebox[0pt][r]{% hinter der Zeilennummer aufgehängt
    \makebox[0.5\textwidth][l]{\usebox{\myendhook}}%
  }%
  \global\sbox{\myendhook}{}% Box wird geleert
}}
\makeatother
\sbox{\myendhook}{%
\begin{footnotesize}%
\begin{tabular}{@{}ll}
$a_0$ & Bohrscher Radius ($\mathrm{= 0{,}53\,\mbox{\AA}}$)\\
$e$ & Elementarladung\\
$N_{si}$ & Anzahl der Siliziumatome\\
& pro Einheitsvolumen\\
$m$ & Atomgewicht\\
$Z$ & Kernladungszahl
\end{tabular}
\end{footnotesize}}

\begin{equation}
\varepsilon = \frac{E \cdot 4 \cdot \pi \cdot \varepsilon_{0}
\cdot a_0 \cdot \left( Z_i^{\frac{2}{3}} + Z_{Si}^{\frac{2}{3}}
\right)^{-\frac{1}{2}}} {Z_i \cdot Z_{Si} \cdot e2 \cdot \left( 1
+ \frac{m_i}{m_{Si}} \right)}\,;
\end{equation}

\sbox{\myendhook}{abc}

\begin{equation}
a2+b2=c2
\end{equation}

\begin{equation}
z = 9
\end{equation}
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text

\endgroup
\noindent\rule{\linewidth}{1pt}

\medskip
This solution works only with \AmSmath{}, without you have to redefine the
\LaTeX{} macro, which creates the equation number.

\begin{lstlisting}
\newsavebox{\myendhook} % hier gehen die Tabellen rein
\def\tagform@#1{{(\maketag@@@{\ignorespaces#1\unskip\@@italiccorr)}
  \makebox[0pt][r]{% hinter der Zeilennummer aufgehaengt
    \makebox[0.4\textwidth][l]{\usebox{\myendhook}}%
  }%
  \global\sbox{\myendhook}{}% Box wird geleert
}}

[ ... ]

\sbox{\myendhook}{%
\begin{footnotesize}%
\begin{tabular}{@{}ll}
$a_0$ & Bohrscher Radius ($\mathrm{= 0{,}53\,\mbox{\AA}}$)\\
$e$ & Elementarladung\\
$N_{si}$ & Anzahl der Siliziumatome\\
& pro Einheitsvolumen\\
$m$ & Atomgewicht\\
$Z$ & Kernladungszahl
\end{tabular}
\end{footnotesize}}

\begin{equation}
\varepsilon = \frac{E \cdot 4 \cdot \pi \cdot \varepsilon_{0}
\cdot a_0 \cdot \left( Z_i^{\frac{2}{3}} + Z_{Si}^{\frac{2}{3}}
\right)^{-\frac{1}{2}}} {Z_i \cdot Z_{Si} \cdot e2 \cdot \left( 1
+ \frac{m_i}{m_{Si}} \right)}\,;
\end{equation}

\sbox{\myendhook}{abc}

\begin{equation}
a2+b2=c2
\end{equation}

\begin{equation}
z = 9
\end{equation}
\end{lstlisting}


%------------------------------------------------------------------------------
\section{Node connections}
%------------------------------------------------------------------------------
This is a typical application for PSTricks and it needs the package \verb+pst-node+
and doesn't work with \verb+pdflatex+. Use \verb+VTeX+, \verb+ps4pdf+ or \verb+ps2pdf+.

\medskip
\noindent\fbox{\includegraphics[width=\linewidth]{node}}

\iffalse
\noindent\fbox{\parbox{\linewidth-2\fboxsep-2\fboxrule}{%
\psset{nodesep=3pt}
\definecolor{lila}{rgb}{0.6,0.2,0.5}
\definecolor{darkyellow}{rgb}{1,0.9,0}
Die Bindungsenergie im Tr\"opfchenmodell setzt sich aus
folgenden Teilen zusammen:
\begin{itemize}
\item dem \rnode{b}{Oberfl\"achenanteil}
\item dem \rnode{a}{Volumenanteil},\\[0.75cm]
\def\xstrut{\vphantom{\frac{(A)^1}{(B)^1}}}
\begin{equation}
E =
\rnode[t]{ae}{\psframebox*[fillcolor=darkyellow,
  linestyle=none]{\xstrut a_vA}} +
\rnode[t]{be}{\psframebox*[fillcolor=lightgray,
  linestyle=none]{\xstrut -a_fA^{2/3}}} +
\rnode[t]{ce}{\psframebox*[fillcolor=green,
  linestyle=none]{\xstrut -a_c\dfrac{Z(Z-1)}{A^{1/3}}}} +
\rnode[t]{de}{\psframebox*[fillcolor=cyan,
  linestyle=none]{\xstrut -a_s\frac{(A-2Z)^2}{A}}} +
\rnode[t]{ee}{\psframebox*[fillcolor=yellow,
  linestyle=none]{\xstrut E_p}}
\end{equation}\\
\item dem \rnode{c}{Coulomb-Anteil}
\item der \rnode{d}{Symmetrieenergie}
\item sowie einem \rnode{e}{Paarbildungsbeitrag}.
\end{itemize}
\nccurve[angleA=-90,angleB=90]{->}{a}{ae}
\nccurve[angleB=45]{->}{b}{be}
\nccurve[angleB=-90]{->}{c}{ce}
\nccurve[angleB=-90]{->}{d}{de}
\nccurve[angleB=-90]{->}{e}{ee}
}}
\fi

\medskip
\begin{lstlisting}[tabsize=4]
\psset{nodesep=3pt}
\definecolor{lila}{rgb}{0.6,0.2,0.5}
\definecolor{darkyellow}{rgb}{1,0.9,0}
Die Bindungsenergie im Tr\"opfchenmodell setzt sich aus
folgenden Teilen zusammen:
\begin{itemize}
\item dem \rnode{b}{Oberfl\"achenanteil}
\item dem \rnode{a}{Volumenanteil},\\[1cm]
\def\xstrut{\vphantom{\frac{(A)^1}{(B)^1}}}
\begin{equation}
E =
\rnode[t]{ae}{\psframebox*[fillcolor=darkyellow,
  linestyle=none]{\xstrut a_vA}} +
\rnode[t]{be}{\psframebox*[fillcolor=lightgray,
  linestyle=none]{\xstrut -a_fA^{2/3}}} +
\rnode[t]{ce}{\psframebox*[fillcolor=green,
  linestyle=none]{\xstrut -a_c\frac{Z(Z-1)}{A^{1/3}}}} +
\rnode[t]{de}{\psframebox*[fillcolor=cyan,
  linestyle=none]{\xstrut -a_s\frac{(A-2Z)^2}{A}}} +
\rnode[t]{ee}{\psframebox*[fillcolor=yellow,
  linestyle=none]{\xstrut E_p}}
\end{equation}\\[0.25cm]
\item dem \rnode{c}{Coulomb-Anteil}
\item der \rnode{d}{Symmetrieenergie}
\item sowie einem \rnode{e}{Paarbildungsbeitrag}.
\end{itemize}
\nccurve[angleA=-90,angleB=90]{->}{a}{ae}
\nccurve[angleB=45]{->}{b}{be}
\nccurve[angleB=-90]{->}{c}{ce}
\nccurve[angleB=-90]{->}{d}{de}
\nccurve[angleB=-90]{->}{e}{ee}
\end{lstlisting}




%-----------------------------------------------------------------------------
\section[Special Placement]{Special placement of displayed equations}
%-----------------------------------------------------------------------------




%-----------------------------------------------------------------------------
\subsection{Formulas side by side}\label{sec:sidebyside}
%-----------------------------------------------------------------------------

Sometimes it may be useful to have numbered formulas side by side like the following ones:

%\begin{framed}
\begin{mtabular}{*{2}{m{0.35\linewidth}m{0.15\linewidth}}}
\begin{align*} \oint E ds=0 \end{align*} & \eqnCnt %
	& \begin{align*} \nabla\cdot B=0 \end{align*} & \eqnCnt[\label{blah}]\\
\begin{align*} a =\frac{c}{d} \end{align*} & \eqnCnt %
	& \begin{align*} b = 1 \end{align*} & \eqnCnt\\
\begin{align*} c =1 \end{align*} & \eqnCnt[\label{blub}]
	& \begin{align*} \int 2x dx = x^2+C \end{align*} & \eqnCnt
\end{mtabular}
%\end{framed}


And again a default display equation:
\begin{align}
F(x) &= \int_0^\infty\dfrac{1}{x}\,dx
\end{align}

\begin{lstlisting}[tabsize=4]
\begin{mtabular}{*{2}{m{0.35\linewidth}m{0.15\linewidth}}}
\begin{align*} \oint E ds=0 \end{align*} & \eqnCnt %
	& \begin{align*} \nabla\cdot B=0 \end{align*} & \eqnCnt[\label{blah}]\\
\begin{align*} a =\frac{c}{d} \end{align*} & \eqnCnt %
	& \begin{align*} b = 1 \end{align*} & \eqnCnt\\
\begin{align*} c =1 \end{align*} & \eqnCnt[\label{blub}]
	& \begin{align*} \int 2x dx = x^2+C \end{align*} & \eqnCnt
\end{mtabular}
\end{lstlisting}

The new environment \verb|mtabular| has two arguments, one optional and one which is the same
as the one from the \verb|tabular| environment. With the option \verb|long| it is possible to have    %%% ----- Martin -----
all the formulas in a \verb|longtable| environment, which allows a pagebreak. The new macro
\verb|\eqnCnt| controls the counting of these equations as subequations for one tabular
line. This macro can have an optional argument for a label. At least it counts the equations. If the
equation number is not centered to the foregoing equation, then it needs some more horizontal
space in the tabular column.

\begin{verbatim}
\eqnCnt[<optional label>]
\end{verbatim}

The vertical space is controlled by the length \verb|mtabskip|, which is by default \verb|-1.25cm| and can be modified in the usual way.

To define all these macros write into the preamble:
\begin{lstlisting}[tabsize=4]
\usepackage{amsmath}
\newcounter{subequation}
%
\newlength\mtabskip\mtabskip=-1.25cm
%
\newcommand\eqnCnt[1][]{%
	\refstepcounter{subequation}%
	\begin{align}#1\end{align}%
	\addtocounter{equation}{-1}%
}
\def\mtabLong{long}
\makeatletter
\newenvironment{mtabular}[2][\empty]{%
	\def\@xarraycr{%
		\stepcounter{equation}%
		\setcounter{subequation}{0}%
		\@ifnextchar[\@argarraycr{\@argarraycr[\mtabskip]}%
	}
	\let\theoldequation\theequation%
	\renewcommand\theequation{\theoldequation.\alph{subequation}}
	\edef\mtabOption{#1}
	\setcounter{subequation}{0}%
	\tabcolsep=0pt
	\ifx\mtabOption\mtabLong\longtable{#2}\else\tabular{#2}\fi%
}{%
	\ifx\mtabOption\mtabLong\endlongtable\else\endtabular\fi%
	\let\theequation\theoldequation%
	\stepcounter{equation}
}
\makeatother
\end{lstlisting}


As seen in equation~\ref{blub} and equation~\ref{blah}, everything is 
nonsense ... And the following tabular is defined as a longtable to enable pagebreaks. 


\vspace*{10cm}
%\begin{framed}
\begin{mtabular}[long]{*{2}{m{0.35\linewidth}m{0.15\linewidth}}}
\begin{align*} \oint E ds=0 \end{align*} & \eqnCnt %
	& \begin{align*} \nabla\cdot B=0 \end{align*} & \eqnCnt\\
\begin{align*} a =\frac{c}{d} \end{align*} & \eqnCnt %
	& \begin{align*} b = 1 \end{align*} & \eqnCnt\\
\begin{align*} c =1 \end{align*} & \eqnCnt
	& \begin{align*} \int 2x dx = x^2+C \end{align*} & \eqnCnt\\
\begin{align*} \oint E ds=0 \end{align*} & \eqnCnt %
	& \begin{align*} \nabla\cdot B=0 \end{align*} & \eqnCnt\\
\begin{align*} a =\frac{c}{d} \end{align*} & \eqnCnt %
	& \begin{align*} b = 1 \end{align*} & \eqnCnt\\
\begin{align*} c =1 \end{align*} & \eqnCnt
	& \begin{align*} \int 2x dx = x^2+C \end{align*} & \eqnCnt\\
\begin{align*} \oint E ds=0 \end{align*} & \eqnCnt %
	& \begin{align*} \nabla\cdot B=0 \end{align*} & \eqnCnt[\label{blah2}]\\
\begin{align*} a =\frac{c}{d} \end{align*} & \eqnCnt %
	& \begin{align*} b = 1 \end{align*} & \eqnCnt\\
\begin{align*} c =1 \end{align*} & \eqnCnt[\label{blub2}]
	& \begin{align*} \int 2x dx = x^2+C \end{align*} & \eqnCnt\\
\begin{align*} \oint E ds=0 \end{align*} & \eqnCnt %
	& \begin{align*} \nabla\cdot B=0 \end{align*} & \eqnCnt\\
\begin{align*} a =\frac{c}{d} \end{align*} & \eqnCnt %
	& \begin{align*} b = 1 \end{align*} & \eqnCnt\\
\begin{align*} c =1 \end{align*} & \eqnCnt
	& \begin{align*} \int 2x dx = x^2+C \end{align*} & \eqnCnt
\end{mtabular}
%\end{framed}

As seen in equation~\ref{blub2} and equation~\ref{blah2}, everything is nonsense ...


And again a default display equation:
\begin{align}
F(x) &= \int_0^\infty\dfrac{1}{x}\,dx
\end{align}

\begin{lstlisting}[tabsize=4]
\begin{mtabular}[long]{*{2}{m{0.375\linewidth}m{0.125\linewidth}}}
\begin{align*} \oint E ds=0 \end{align*} & \eqnCnt %
	& \begin{align*} \nabla\cdot B=0 \end{align*} & \eqnCnt\\
\begin{align*} a =\frac{c}{d} \end{align*} & \eqnCnt %
	& \begin{align*} b = 1 \end{align*} & \eqnCnt\\
\begin{align*} c =1 \end{align*} & \eqnCnt
	& \begin{align*} \int 2x dx = x^2+C \end{align*} & \eqnCnt\\

[ ... ]
\end{lstlisting}

%-----------------------------------------------------------------------------
\subsection[Itemize environment]{Formulas inside an itemize enviroment}\label{sec:itemize}
%-----------------------------------------------------------------------------
Without any modification it is not possible to get a numbered equation
at the same height as the symbol of the itemize environment\index{itemize@\texttt{itemize}}. This depends on    %%% ----- Martin -----
the \CMD{abovedisplayskip}. The formula has to be raised up for exactly this length.

\begin{lstlisting}
\def\itemMath#1{%
    \raisebox{-\abovedisplayshortskip}{%
        \parbox{0.75\linewidth}{%
            \begin{equation}#1\end{equation}}}}
%
\begin{itemize}
\item \itemMath{ f = l }
\item \itemMath{ g(x) = \int f(x) dx }
\end{itemize}
\end{lstlisting}

\def\itemMath#1{%
    \raisebox{-\abovedisplayshortskip}{%
        \parbox{0.75\linewidth}{%
            \begin{equation}#1\end{equation}}}}
%
\begin{itemize}
\item \itemMath{ f = l }
\item \itemMath{ g(x) = \int f(x) dx }
\end{itemize}


\part{Lists, bibliography and index}
\bgroup
\lhead{}\rhead{}
\clearpage\phantomsection\addcontentsline{toc}{section}{List of Figures}
\listoffigures
\clearpage\phantomsection\addcontentsline{toc}{section}{List of Tables}
\listoftables
\clearpage\phantomsection\addcontentsline{toc}{section}{Bibliography}

{\nocite{*}
\raggedright
\bibliography{Mathmode}
\bibliographystyle{plain}
}
\clearpage\addcontentsline{toc}{section}{Index}
{\let\BSL\textbackslash
\renewcommand\textbackslash{{\tt\BSL}}
\printindex{}
}
\egroup

