%%
%% This is file `Mathmode.ltx',
%%
%% IMPORTANT NOTICE:
%%
%% Herbert Voss <hvoss@tug.org>
%% (C) 2008/2009/2010
%%
%% 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.47}
%
\listfiles
\documentclass[11pt,a4paper,english,twoside]{article}
\usepackage{fixltx2e}%% the official fixes for LaTeX2e
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%\usepackage{pamathx}%    use this if you have the commercial palatino math font
%\usepackage{arev}%  use this if you do not have the palatino math font
\usepackage{bera}
%\usepackage{lmodern}
%\usepackage[scaled=0.85]{luximono}%  use this if you do not have the palatino math font
%
\usepackage[marginparwidth=80pt,bmargin=3cm,tmargin=2cm]{geometry}
\usepackage{ifpdf}
\usepackage{ifvtex}
\ifvtex\pdffalse\fi
\usepackage{comment}
\usepackage{graphicx}
\usepackage{varwidth}
\usepackage{paralist}
\usepackage{array}
\usepackage{delarray}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsopn}
\usepackage{bm}
\usepackage{upgreek}
\usepackage{ragged2e}
\usepackage{cancel}
\newcommand\hcancel[2][black]{\setbox0=\hbox{#2}%
	\rlap{\raisebox{.45\ht0}{\textcolor{#1}{\rule{\wd0}{1pt}}}}#2}
\DeclareMathOperator{\Res}{Res}
\usepackage{amscd}
\usepackage{accents}
\usepackage{dsfont}
\usepackage{multirow}
\usepackage{bigdelim}
\usepackage{framed}
\usepackage{longtable}
\usepackage{varioref}
%
\ifvtex
  \usepackage{pstricks}
  \usepackage{pst-node}
\else\ifpdf\usepackage{xcolor}\else
  \usepackage{pstricks}
  \usepackage{pst-node}
\fi\fi
\usepackage{makeidx}
\makeindex
\usepackage{url}
\usepackage{setspace}
\usepackage{framed}
%
%
\DeclareMathDelimiter{\Norm}
   {\mathord}{largesymbols}{"3E}{largesymbols}{"3E}
%
\makeatletter
\def\mathllap{\mathstrut\mathpalette\mathllapinternal}
%\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}$}%
}
\def\bijmap{\ensuremath{%
	\mathrlap{\rightarrowtail}\rightarrow}}
% extensible Arrow
\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}
%
%
\def\@bracketheight{2pt}
\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}
\def\overbracket{\@ifnextchar[{\@overbracket}{\@overbracket[\@bracketheight]}}
%
\def\@overbracket[#1]{\@ifnextchar[{\@over@bracket[#1]}{\@over@bracket[#1][0.3em]}}
\def\@over@bracket[#1][#2]#3{%\message {Overbracket: #1,#2,#3}
   \mathop {\vbox {\m@th \ialign {##\crcr \noalign {\kern 3\p@
   \nointerlineskip }\downbracketfill {#1}{#2}
        \crcr \noalign {\kern 3\p@ }
        \crcr  $\hfil \displaystyle {#3}\hfil $%
        \crcr} }}\limits}
\def\downbracketfill#1#2{$\m@th \setbox \z@ \hbox {$\braceld$}
    \edef\@bracketheight{\the\ht\z@}\downbracketend{#1}{#2}
    \leaders \vrule \@height #1 \@depth \z@ \hfill
    \leaders \vrule \@height #1 \@depth \z@ \hfill
\downbracketend{#1}{#2}$}
\def\downbracketend#1#2{\vrule depth #2 width #1\relax}
%
\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}%
}

\usepackage[allowspaces]{empheq}% defines also harpoon macros
\usepackage{mathtools}
\usepackage{nicefrac}

\newcommand*{\threesim}{%
  \mathrel{\vcenter{\offinterlineskip
  \hbox{$\sim$}\vskip-.35ex\hbox{$\sim$}\vskip-.35ex\hbox{$\sim$}}}}
%
\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]{%
  \parindent=0pt%
  \def\@xarraycr{%
    \global\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
\def\zero{\multicolumn{1}{>{\columncolor{white}}c}{0}}
\def\colCell#1#2{\multicolumn{1}{>{\columncolor{#1}}c}{#2}}
%% For printing a cirumflex inside a formula
\newcommand{\mathcircumflex}[0]{\mbox{\^{}}}
\providecommand{\tabularnewline}{\\}
\usepackage{exscale}
\usepackage{relsize}
\usepackage{xspace}
\usepackage[mathscr]{eucal}
\usepackage{dsfont}
\usepackage[bottom]{footmisc}
\usepackage{esint}
\usepackage{esvect}
\usepackage{remreset}
\usepackage{calc}
\usepackage{cool}
\usepackage{xypic}
\usepackage{fancyhdr}
%
\pagestyle{fancy}
\fancyhead[LE,RO]{\leftmark}
\fancyhead[LO,RE]{\rightmark}
\fancyhead[C]{}
\fancyfoot[LO,RE]{\footnotesize\ttfamily\jobname.tex\quad v.\MathmodeVersion}
%\cfoot{}
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[C]{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
%
\definecolor{umbra}{rgb}{0.8,0.8,0.5}
\definecolor{gray90}{gray}{0.9}
%
\addtocontents{toc}{\hfill Page\endgraf\vspace{-4ex}}
\addtocontents{lof}{\ Figure\hfill Page}
\addtocontents{lot}{\ Table\hfill Page}
\makeatletter
\renewcommand\@pnumwidth{3.5em}
\renewcommand*\l@subsection{\@dottedtocline{2}{1.75em}{3.25em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{4em}{4em}}
\makeatother
\let\myPart\part
\renewcommand\part[1]{\clearpage\myPart{#1}}
%
%%%%%%%%%%%%% Math symbols %%%%%%%%%%%%%%%%%
\newcommand{\mysin}{\operatorname{mysin}}
\newcommand{\eqdef}{\ensuremath{\mathrel{\stackrel{\mathrm{def}}{=}}}}
\newcommand{\eqexcl}{\ensuremath{\mathrel{\stackrel{\mathrm{!}}{=}}}}
\newcommand{\eqhat}{\ensuremath{\mathrel{\widehat{=}}}}
%
\newlength{\fullwidth}
\setlength\fullwidth{\textwidth}
%\addtolength\fullwidth{\marginparsep}
%\addtolength\fullwidth{\marginparwidth}
\addtolength\fullwidth{\evensidemargin}
%
\newlength{\LBoxWidth}
\newcommand{\LyXBox}[1]{%
  \settowidth{\LBoxWidth}{#1}
  \fbox{\parbox[c]{\LBoxWidth}{#1}}\xspace%
}
\newcommand{\logo}{%
  \bgroup
  \psset{unit=1in,linewidth=2pt}
  \psline(-2.5,2.5)(-2.5,-\paperheight)
  \psline(-2,2.5)(-2,-\paperheight)
  \rput[lb]{90}(-2.05,-0.7\paperheight){\red\Huge\textbf{\AllTeX}}
  \rput[lb]{90}(-2.15,-0.1\paperheight){\red\Huge\textbf{Documentation}}
  \egroup
}
\newcommand*{\CMD}[1]{{\tt\textbackslash#1}}
%
\makeatletter
\def\La{%
  L\kern-.36em{%
    \setbox0\hbox{T}%
    \vbox to\ht0{%
      \hbox{$\m@th$%
        \csname S@\f@size\endcsname
        \fontsize\sf@size\z@
        \math@fontsfalse\selectfont A}%
      \vss%
    }%
  }%
}
\def\AllTeX{(\La\kern-.075em)\kern-.075em\TeX\xspace}
\def\AMS{American Mathematical Society\xspace}
\def\AmS{$\mathcal{A}$\kern-.1667em\lower.5ex\hbox
    {$\mathcal{M}$}\kern-.125em$\mathcal{S}$\xspace}
\def\AmSmath{\AmS{}math\xspace}
\def\AmSLaTeX{\AmS-\LaTeX\xspace}
\def\AmSTeX{\AmS-\TeX\xspace}
\makeatother
%
\def\cIndex#1{\index{#1@\CMD{#1}}}
%
\usepackage{showexpl}
\lstset{language=[AlLaTeX]TeX}
%
\usepackage{microtype}
\usepackage[%
	pdftitle={TeX Mathmode},%
	pdfauthor={Herbert Voss},%
	urlcolor=blue,%
	linktocpage,%
	a4paper,%
	colorlinks=true]{hyperref}
\usepackage{hypcap}
\usepackage{babel}

\def\tIndex#1{\index{#1@{\UrlFont\texttt{#1}}}}
\def\cIndex#1{\index{#1@\CMD{#1}}}
\def\pIndex#1{\index{Parameter@\textbf{Parameter}!{\UrlFont\texttt{#1}}}}
\def\PIndex#1{\texttt{#1}\index{Package@\textbf{Package}!\texttt{#1}}}
\def\Index#1{#1\index{#1}}
\def\CIndex#1{\CMD{#1}\index{#1@\CMD{#1}}\index{Macro@\textbf{Macro}!\CMD{#1}}}
\def\DIndex#1{\texttt{#1}\index{#1@\texttt{#1}}\index{File@\textbf{File}!\texttt{#1}}}
\def\LIndex#1{\CMD{#1}\index{#1@\CMD{#1}}\index{Length@\textbf{Length}!\CMD{#1}}}
\def\ZIndex#1{\texttt{#1}\index{#1@\texttt{#1}}\index{Counter@\textbf{Counter}!\texttt{#1}}}
\def\zIndex#1{\index{#1@\texttt{#1}}\index{Counter@\textbf{Counter}!\texttt{#1}}}
\def\FIndex#1{\texttt{#1}\index{#1@\texttt{#1}}\index{Font@\textbf{Font}!\texttt{#1}}}
\def\UIndex#1{\texttt{#1} environment\index{Environment@\textbf{Environment}!\texttt{#1}}\index{#1@\texttt{#1}}}
\def\uIndex#1{\texttt{#1}\index{Environment@\textbf{Environment}!\texttt{#1}}\index{#1@\texttt{#1}}}
%
\newcommand*\eg{e.g.,\xspace}
\newcommand*\Eg{E.g.,\xspace}
\newcommand*\etc{etc.\@\xspace}
\newcommand*\dy{\,\mathrm{d}y}
\newcommand*\dx{\,\mathrm{d}x}
\newcommand*\dyx{\,\frac{\mathrm{d}y}{\mathrm{d}x}}
\newcommand*\ds{\,\mathrm{d}s}
\newcommand*\dt{\,\mathrm{d}t}
\newcommand*\dst{\,\frac{\mathrm{d}s}{\mathrm{d}t}}
%
%
\def\Mbox#1{\par
\vspace{2ex}
\noindent
\resizebox{\linewidth}{!}{\fbox{\includegraphics{#1}}}\par\medskip}

\usepackage{braket}% there were problems when loading before other packages ...

%------------------------------------------ Index macros -------------------------------------
\def\Lcs#1{{\ttfamily\textbackslash#1}%
    \index{Macro!#1@\texttt{\textbackslash#1}}\index{#1@\texttt{\textbackslash#1}}}
\def\LMcs#1{{\ttfamily\bfseries\textbackslash#1}%
    \index{Macro!#1@\textbf{\texttt{\textbackslash#1}}}\index{#1@\textbf{\texttt{\textbackslash#1}}}}
\def\Ldim#1{{\ttfamily\textbackslash#1}%
    \index{Dimension!#1@\texttt{\textbackslash#1}}\index{#1@\texttt{\textbackslash#1}}}
\def\LMdim#1{{\ttfamily\bfseries\textbackslash#1}%
    \index{Dimension!#1@\textbf{\texttt{\textbackslash#1}}}\index{#1@\textbf{\texttt{\textbackslash#1}}}}
\def\Lskip#1{{\ttfamily\textbackslash#1}%
    \index{Skip!#1@\texttt{\textbackslash#1}}\index{#1@\texttt{\textbackslash#1}}}
\def\LMskip#1{{\ttfamily\bfseries\textbackslash#1}%
    \index{Skip!#1@\textbf{\texttt{\textbackslash#1}}}\index{#1@\textbf{\texttt{\textbackslash#1}}}}

\def\LMcsStar#1{\LMcs{#1*}}
\def\LMcsOptStar#1{{\ttfamily\bfseries\textbackslash#1\OptArg{*}}}
\def\LMctr#1{{\ttfamily\bfseries#1}}
\def\Loption#1{{\ttfamily#1}}
\def\LClass#1{{\ttfamily#1}}
\def\nxLcs#1{{\ttfamily\textbackslash#1}}
\def\Lenv#1{{\ttfamily#1}}
\def\nxLenv#1{{\ttfamily#1}}
\def\Larg#1{{\itshape\ttfamily#1}}
\def\Largb#1{{\itshape\ttfamily\{#1\}}}
\def\Larga#1{{\itshape\ttfamily<#1>}}
\def\Largr#1{{\itshape\ttfamily(#1)}}
\def\Largs#1{{\itshape\ttfamily[#1]}}
\def\LMBEG#1{{\ttfamily\textbackslash begin\{\textbf{#1}\}}}
\def\LMBEGStar#1{{\ttfamily\textbackslash begin\{\textbf{#1*}\}}}
\def\LMBEGOptStar#1{{\ttfamily\textbackslash begin\{\textbf{#1\OptArg{*}}\}}}
\def\LEND#1{{\ttfamily\textbackslash end\{#1\}}}
\def\LENDStar#1{{\ttfamily\textbackslash end\{#1*\}}}
\def\LENDOptStar#1{{\ttfamily\textbackslash end\{#1\OptArg{*}\}}}
\def\OptArg#1{{\colorbox{black!20}{\ttfamily#1}}}
\def\Coordx#1{$x_{#1}$}
\def\Coordy#1{$y_{#1}$}
\def\Coordz#1{$z_{#1}$}
\def\Coord#1{\Coordx{#1},\kern 1pt\Coordy{#1}}
\def\CAny{\Coordx{},\kern 1pt\Coordy{}}
\def\CIIIAny{\Coordx{},\kern 1pt\Coordy{},\kern 1pt\Coordz{}}%  hv
% with brackets
\def\coord#1{(\Coordx{#1},\kern 1pt\Coordy{#1})}
\def\coordiii#1{(\Coordx{#1},\kern 1pt\Coordy{#1},\kern 1pt\Coordy{#1})}% hv
\def\coordx#1{($x_{#1}$)}
\def\coordy#1{($y_{#1}$)}
\def\coordz#1{($z_{#1}$)}
\def\cAny{(\Coordx{},\kern 1pt\Coordy{})}
\def\ciiiAny{(\Coordx{},\kern 1pt\Coordy{},\kern 1pt\Coordy{})}% hv

\def\mPar#1{\marginpar[\RaggedLeft\small#1]{\RaggedRight\small#1}}
\usepackage{layout}

\graphicspath{{images/}}
\begin{document}

\input{MathmodeOrig.tex}

\end{document}
