%%% ====================================================================
%%% @LaTeX-file{
%%%   filename  = "commath.tex",
%%%   version   = "0.3",
%%%   date      = "2006",
%%%   author    = "Wolfgang Putschögl",
%%%   address   = "Johann Radon Institute for Computational and Applied Mathematics (RICAM)
%%%                Austrian Academy of Sciences
%%%                Altenbergerstraße 69
%%%                A-4040 Linz, Austria",
%%%   email     = "Wolfgang.Putschoegl@oeaw.ac.at",
%%%   codetable = "Western European, iso 8859-15",
%%%   keywords  = "LaTeX",
%%% }
%%% ====================================================================
\NeedsTeXFormat{LaTeX2e} % LaTeX 2.09 can't be used (nor non-LaTeX)
[1994/12/01]             % LaTeX date must December 1994 or later

\documentclass[10pt,a4paper]{article}%report

\usepackage{ifthen}
% DOCUMENT IS COMPLETE OR NOT ? -------------------------------------------
\newboolean{complete}
\setboolean{complete}{true} % default is false
% -------------------------------------------------------------------------

\ifthenelse{\boolean{complete}}{}{
% Prints preliminary version and date on the output
\usepackage{prelim2e}
% This package modifies commands such that the internal the labels are printed
% draft option for draft proceedings; basically 12pt article style
%\usepackage[draft]{showkeys}
% The information for forward/inverse search is only embedded in the corresponding document if it is a draft version
\usepackage{srcltx} % for forward/inverse search
}

%\linespread{1.4}
\pagestyle{headings}

% MISC PACKAGES -----------------------------------------------------------
%\usepackage{eurosym}
\usepackage[english,german]{babel}
\usepackage{tocbibind} % add document elements like bibliography and index to toc

% FONTS -------------------------------------------------------------------
\usepackage[T1]{fontenc}         % for special characters e.g. ö,ä,ß
\usepackage[ansinew]{inputenc}   % for special characters e.g. ö,ä,ß
\usepackage{ae}
\usepackage{mathrsfs} % font \mathscr{L}
% ------------------------------------------------------------------------

% HEADER ------------------------------------------------------------------
\usepackage{fancyhdr}
\pagestyle{fancy}
% with this we ensure that the chapter and section
% headings are in lowercase
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{} %delete the current section for header and footer
\fancyhead[LO]{\bfseries\rightmark}
\renewcommand{\headrulewidth}{0.5pt}
% make space for the rule
\fancyhead[R]{\bfseries\thepage}
\fancypagestyle{plain}{%
\fancyhead{} %get rid of the headers on plain pages
\renewcommand{\headrulewidth}{0pt} % and the line
}

% URL --------------------------------------------------------------------
\usepackage{url}
\newcommand{\urlBiBTeX}[1]{\url{#1}}
%Then in your .bib file, do this for an entry with a URL:
%note = "URL: {\urlBiBTeX{http://coppit.org/}}",
% ------------------------------------------------------------------------

% PDF OPTIONS ------------------------------------------------------------
\newif\ifpdf
\ifx\pdfoutput\undefined
  \pdffalse     % running LaTeX
\else
  \pdfoutput=1  % running PDFLaTeX
  \pdftrue
\fi
% ###
\ifpdf
  \usepackage[pdftex,plainpages=false,pdfpagelabels]{hyperref}
  \pdfcompresslevel=9
  \ifx\hypersetup\undefined\relax\else
  \hypersetup{
  pdftitle         ={The commath LaTeX package},
  pdfauthor        ={Wolfgang Putschögl},
  pdfcreator       ={pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5)},
  pdfproducer      ={pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5)},
  pdfsubject       ={LaTeX},
  pdfkeywords      ={LaTeX},
  bookmarksnumbered={true},
  bookmarksopen    ={true},
  colorlinks       ={true},
  linkcolor        ={blue},
  urlcolor         ={blue},
}
\fi
\else
  \usepackage[dvips]{hyperref}
\fi

% FUZZ -------------------------------------------------------------------
\vfuzz2pt % Don't report over-full v-boxes if over-edge is < 2pt
\hfuzz2pt % Don't report over-full h-boxes if over-edge is < 2pt
% ------------------------------------------------------------------------

\ifthenelse{\boolean{complete}}{
\newcommand{\ind}[1]{\index{#1}{#1}}
}{
\let\ind=\emph
}

% MATH COMMANDS ----------------------------------------------------------

% AMS PACKAGES ------------------------------------------------------------
\usepackage{amsfonts}
% -------------------------------------------------------------------------

% My package
\usepackage{commath}


% ------------------------------------------------------------------------

% INDEX ------------------------------------------------------------------
\ifthenelse{\boolean{complete}}{
\usepackage{makeidx}
\makeindex
}

% TITLE, AUTHOR ETC. -----------------------------------------------------
\title{The \texttt{commath} \LaTeX package v0.3}
\author{Wolfgang Putschögl}
%\date{2005}
% ------------------------------------------------------------------------

\newcommand{\leftmarginpar}[1]{%
  \ifthenelse{\isodd{\thepage}}{%
    \reversemarginpar% typeset number left on odd (right) pages
    }{%
    \normalmarginpar%
    }%
  \marginpar{\hfill #1}}

\begin{document}

\typeout{#####################################}

\selectlanguage{english}
\maketitle

\ifthenelse{\boolean{complete}}{
% TABLE OF CONTENTS ------------------------------------------------------
\tableofcontents
} % End ifthenelse


% INPUT ------------------------------------------------------------------

\pagestyle{fancy}

\begin{abstract}
\begin{center}
The \texttt{commath}-package provides some commands\\
which help you to format formulas flexibly.
\end{center}
\end{abstract}

\section{Introduction}

The purpose of the \texttt{commath}-package is to provide some commands which are supposed to produce better formatting and/or provide a more convenient way of input. For example, the \texttt{commath}-package provides commands for delimiters for which
the size is determined automatically by default or can be controlled by an integer argument. Thus, the size of delimiters can be adapted to the formula by just changing one integer argument.

\section{Acknowledgements}

I want to thank Simon Dreher and Luca Trevisani for useful feedback and hints.

\section{Requirements}

The \texttt{commath}-package requires the \texttt{ifthen}-package and the \texttt{amsmath}-package to be installed. If they were not loaded before they are loaded by the \texttt{commath}-package.

\section{Command overview}

\bigskip\marginpar{\texttt{\ind{d}}}
\noindent
\verb|\dif| is a command for the differential operator. It is simply an upface d to clarify that it is an operator.
E.g.:\\
\begin{tabular}{lc}
\verb|\dif x| \quad & $\dif x$
\end{tabular}

\bigskip\marginpar{\texttt{\ind{D}}}
\noindent
\verb|\Dif| is a command for a derivative operator (e.g.\ Malliavin derivative ...). It is simply an upface D to clarify that it is an operator.
E.g.:\\
\begin{tabular}{lc}
\verb|\Dif X| \quad & $\Dif X$
\end{tabular}

\bigskip\marginpar{\texttt{\ind{od}}}
\noindent
\verb|\od[optional argument]{first argument}{second argument}| is a command for ordinary derivatives. The first argument denotes the function and the second argument denotes the variable with respect to which the derivative is taken. The optional argument denotes the order of differentiation. The style (text style/display style) is determined automatically.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\od{f}{x}| \quad & $\od{f}{x}$\\
\verb|\od[2]{f}{x}| \quad & $\od[2]{f}{x}$
\end{tabular}


\bigskip\marginpar{\texttt{\ind{tnd}}}
\noindent
The \verb|\tod|-command is essentially the same as the \verb|\od|-command except that the style is set to text style.

\bigskip\marginpar{\texttt{\ind{dnd}}}
\noindent
The \verb|\dod|-command is essentially the same as the \verb|\od|-command except that the style is set to display style.


\bigskip\marginpar{\texttt{\ind{pd}}}
\noindent
\verb|\pd[optional argument]{first argument}{second argument}| is a command for partial derivatives. The first argument denotes the function and the second argument denotes the variable with respect to which the derivative is taken. The optional argument denotes the order of differentiation. The style (text style/display style) is determined automatically.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\pd{f}{x}| \quad & $\pd{f}{x}$\\
\verb|\pd[2]{f}{x}| \quad & $\pd[2]{f}{x}$
\end{tabular}


\bigskip\marginpar{\texttt{\ind{tpd}}}
\noindent
The \verb|\tpd|-command is essentially the same as the \verb|\pd|-command except that the style is set to text style.

\bigskip\marginpar{\texttt{\ind{dpd}}}
\noindent
The \verb|\dpd|-command is essentially the same as the \verb|\pd|-command except that the style is set to display style.

\bigskip\marginpar{\texttt{\ind{md}}}
\noindent
\verb|\md{first argument}...{sixth argument}| is a command for mixed partial derivatives. The first argument denotes the function and the second argument denotes the total order of differentiation. The third and the fifth argument are the variables with respect to which we want to differentiate and the fourth and the sixth argument are the corresponding orders of differentiation.
The style (text style/display style) is determined automatically.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\md{f}{5}{x}{2}{y}{3}| \quad & $\md{f}{5}{x}{2}{y}{3}$\\
\end{tabular}


\bigskip\marginpar{\texttt{\ind{tmd}}}
\noindent
The \verb|\tmd|-command is essentially the same as the \verb|\md|-command except that the style is set to text style.

\bigskip\marginpar{\texttt{\ind{dmd}}}
\noindent
The \verb|\dmd|-command is essentially the same as the \verb|\md|-command except that the style is set to display style.

\bigskip\marginpar{\texttt{\ind{del}}}
\noindent
\verb|\del[optional argument]{first argument}| is a command for delimiters (normal parathesis). The value for the optional argument ranges from 0 to 4 with higher values resulting in larger delimiters
The default value for the optional argument is -1 which results in automatic sizing for the parenthesis.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\del{x}| \quad & $\del{x}$\\
\verb|\del[0]{x}| & $\del[0]{x}$\\
\verb|\del[1]{x}| & $\del[1]{x}$\\
\verb|\del[2]{x}| & $\del[2]{x}$\\
\verb|\del[3]{x}| & $\del[3]{x}$\\
\verb|\del[4]{x}| & $\del[4]{x}$
\end{tabular}

\bigskip\marginpar{\texttt{\ind{cbr}}}
\noindent
\verb|\cbr[optional argument]{first argument}| is a command for curly braces. The value for the optional argument ranges from 0 to 4 with higher values resulting in larger braces.
The default value for the optional argument is -1 which results in automatic sizing for the braces.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\cbr{x}| \quad & $\cbr{x}$\\
\verb|\cbr[0]{x}| & $\cbr[0]{x}$\\
\verb|\cbr[1]{x}| & $\cbr[1]{x}$\\
\verb|\cbr[2]{x}| & $\cbr[2]{x}$\\
\verb|\cbr[3]{x}| & $\cbr[3]{x}$\\
\verb|\cbr[4]{x}| & $\cbr[4]{x}$
\end{tabular}

\bigskip\marginpar{\texttt{\ind{set}}}
\noindent
\verb|\set| is the same as \verb|\cbr|

\bigskip\marginpar{\texttt{\ind{sbr}}}
\noindent
\verb|\sbr[optional argument]{first argument}| is a command for square brackets. The value for the optional argument ranges from 0 to 4 with higher values resulting in larger brackets.
The default value for the optional argument is -1 which results in automatic sizing for the brackets.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\sbr{x}| \quad & $\sbr{x}$\\
\verb|\sbr[0]{x}| & $\sbr[0]{x}$\\
\verb|\sbr[1]{x}| & $\sbr[1]{x}$\\
\verb|\sbr[2]{x}| & $\sbr[2]{x}$\\
\verb|\sbr[3]{x}| & $\sbr[3]{x}$\\
\verb|\sbr[4]{x}| & $\sbr[4]{x}$
\end{tabular}

\bigskip

In the following we present commands for all kinds of intervals. The last two letters will imply whether the left and right boundary are open or closed respectively. The value for the optional argument ranges from 0 to 4 with higher values resulting in larger delimiters. The default value for the optional argument is -1 which results in automatic sizing for the delimiters.

\bigskip\marginpar{\texttt{\ind{intoo}}}
\noindent
\verb|\intoo[optional argument]{first argument}| produces an interval where the left and right boundaries are open.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\intoo{x}| \quad & $\intoo{x}$\\
\verb|\intoo[0]{x}| & $\intoo[0]{x}$\\
\verb|\intoo[1]{x}| & $\intoo[1]{x}$\\
\verb|\intoo[2]{x}| & $\intoo[2]{x}$\\
\verb|\intoo[3]{x}| & $\intoo[3]{x}$\\
\verb|\intoo[4]{x}| & $\intoo[4]{x}$
\end{tabular}

\bigskip\marginpar{\texttt{\ind{intcc}}}
\noindent
\verb|\intcc[optional argument]{first argument}| produces an interval where the left and right boundaries are closed.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\intcc{x}| \quad & $\intcc{x}$\\
\verb|\intcc[0]{x}| & $\intcc[0]{x}$\\
\verb|\intcc[1]{x}| & $\intcc[1]{x}$\\
\verb|\intcc[2]{x}| & $\intcc[2]{x}$\\
\verb|\intcc[3]{x}| & $\intcc[3]{x}$\\
\verb|\intcc[4]{x}| & $\intcc[4]{x}$
\end{tabular}

\bigskip\marginpar{\texttt{\ind{intoc}}}
\noindent
\verb|\intoc[optional argument]{first argument}| produces an interval where the left boundary is open and right boundary is closed.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\intoc{x}| \quad & $\intoc{x}$\\
\verb|\intoc[0]{x}| & $\intoc[0]{x}$\\
\verb|\intoc[1]{x}| & $\intoc[1]{x}$\\
\verb|\intoc[2]{x}| & $\intoc[2]{x}$\\
\verb|\intoc[3]{x}| & $\intoc[3]{x}$\\
\verb|\intoc[4]{x}| & $\intoc[4]{x}$
\end{tabular}

\bigskip\marginpar{\texttt{\ind{intco}}}
\noindent
\verb|\intco[optional argument]{first argument}| produces an interval where the left boundary is closed and right boundary is open.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\intco{x}| \quad & $\intco{x}$\\
\verb|\intco[0]{x}| & $\intco[0]{x}$\\
\verb|\intco[1]{x}| & $\intco[1]{x}$\\
\verb|\intco[2]{x}| & $\intco[2]{x}$\\
\verb|\intco[3]{x}| & $\intco[3]{x}$\\
\verb|\intco[4]{x}| & $\intco[4]{x}$
\end{tabular}


\bigskip\marginpar{\texttt{\ind{eval}}}
\noindent
\verb|\eval[optional argument]{first argument}| is a command for the notation of an expression denoted by the first argument evaluated at a particular condition.  The value for the optional argument ranges from 0 to 4 with higher values resulting in larger delimiters. The default value for the optional argument is -1 which results in automatic sizing for the delimiters.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\eval{f(\epsilon)}_{\epsilon=0}| \quad & $\eval{f(\epsilon)}_{\epsilon=0}$\\
\\
\verb|\eval[0]{f(\epsilon)}_{\epsilon=0}| & $\eval[0]{f(\epsilon)}_{\epsilon=0}$\\
\\
\verb|\eval[1]{f(\epsilon)}_{\epsilon=0}| & $\eval[1]{f(\epsilon)}_{\epsilon=0}$\\
\\
\verb|\eval[2]{f(\epsilon)}_{\epsilon=0}| & $\eval[2]{f(\epsilon)}_{\epsilon=0}$\\
\\
\verb|\eval[3]{f(\epsilon)}_{\epsilon=0}| & $\eval[3]{f(\epsilon)}_{\epsilon=0}$\\
\\
\verb|\eval[4]{f(\epsilon)}_{\epsilon=0}| & $\eval[4]{f(\epsilon)}_{\epsilon=0}$
\end{tabular}

\bigskip\marginpar{\texttt{\ind{sVert}}}
\noindent
\verb|\sVert[optional argument]| is essentially the same as \verb|eval|. Use \verb|\sVert| for readability if you don't need automatic sizing of the vert bar.\\
E.g.:\\
\begin{tabular}{lc}
\verb|f(\epsilon)\sVert[0]_{\epsilon=0}| & $f(\epsilon)\sVert[0]_{\epsilon=0}	$\\
\\
\verb|f(\epsilon)\sVert[1]_{\epsilon=0}| & $f(\epsilon)\sVert[1]_{\epsilon=0}$\\
\\
\verb|f(\epsilon)\sVert[2]_{\epsilon=0}| & $f(\epsilon)\sVert[2]_{\epsilon=0}$\\
\\
\verb|f(\epsilon)\sVert[3]_{\epsilon=0}| & $f(\epsilon)\sVert[3]_{\epsilon=0}$\\
\\
\verb|f(\epsilon)\sVert[4]_{\epsilon=0}| & $f(\epsilon)\sVert[4]_{\epsilon=0}$
\end{tabular}

\bigskip
There is also one command included in the package which fixes the alignment of \ind{:=} in mathmode.

% % APPENDIX ---------------------------------------------------------------
% \appendix
% \input{Appendix.tex}

\bigskip\marginpar{\texttt{\ind{envert}}}
\noindent
\verb|\envert}[optional argument]{first argument}| is a command is a command which enclose the argument in vert-bar delimiters.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\envert{x}| \quad & $\envert{x}$\\
\\
\verb|\envert[0]{x}| & $\envert[0]{x}$\\
\\
\verb|\envert[1]{x}| & $\envert[1]{x}$\\
\\
\verb|\envert[2]{x}| & $\envert[2]{x}$\\
\\
\verb|\envert[3]{x}| & $\envert[3]{x}$\\
\\
\verb|\envert[4]{x}| & $\envert[4]{x}$
\end{tabular}


\bigskip\marginpar{\texttt{\ind{abs}}}
\noindent
The \verb|\abs|-command is the same as the \verb|\envert|-command.

\bigskip\marginpar{\texttt{\ind{enVert}}}
\noindent
\verb|\enVert}[optional argument]{first argument}| is a command is a command which enclose the argument in double vert-bar delimiters.\\
E.g.:\\
\begin{tabular}{lc}
\verb|\enVert{x}| \quad & $\enVert{x}$\\
\\
\verb|\enVert[0]{x}| & $\enVert[0]{x}$\\
\\
\verb|\enVert[1]{x}| & $\enVert[1]{x}$\\
\\
\verb|\enVert[2]{x}| & $\enVert[2]{x}$\\
\\
\verb|\enVert[3]{x}| & $\enVert[3]{x}$\\
\\
\verb|\enVert[4]{x}| & $\enVert[4]{x}$
\end{tabular}

\bigskip\marginpar{\texttt{\ind{norm}}}
\noindent
The \verb|\norm|-command is the same as the \verb|\enVert|-command.

\bigskip\marginpar{\texttt{\ind{fullfunction}}}
\noindent
\verb|\fullfunction{first argument}....{fifth argument}| is a command which nicely formats a function. The first argument denotes the function name, the second the domain and the third the image of the function. The forth is the parameter which is mapped to the expression denoted by argument five.\\
E.g.:\\
\verb|\fullfunction{f}{\mathbb R}{\mathbb R}{x}{\sqrt{x}}| results in
$$
\fullfunction{f}{\mathbb R}{\mathbb R}{x}{\sqrt{x}}
$$


\bigskip\marginpar{\texttt{\ind{thmref}}}
\noindent
\verb|\thmref{first argument}| is a command to reference theorems where the first argument is the label of the corresponding theorem. The result of \verb|\thmref{label}| will be Theorem (number of the label) and analogously for the subsequent commands. The number of the theorem is not separated from the word Theorem by e.g.\! a linebreak.

\bigskip\marginpar{\texttt{\ind{exref}}}
\noindent
\verb|\exref{first argument}| is a command to reference examples where the first argument is the label of the corresponding example.

\bigskip\marginpar{\texttt{\ind{defnref}}}
\noindent
\verb|\defnref{first argument}| is a command to reference definitions where the first argument is the label of the corresponding definition.

\bigskip\marginpar{\texttt{\ind{secref}}}
\noindent
\verb|\secref{first argument}| is a command to reference sections where the first argument is the label of the corresponding section.

\bigskip\marginpar{\texttt{\ind{lemref}}}
\noindent
\verb|\lemref{first argument}| is a command to reference lemmas where the first argument is the label of the corresponding lemma.

\bigskip\marginpar{\texttt{\ind{propref}}}
\noindent
\verb|\propref{first argument}| is a command to reference propositions where the first argument is the label of the corresponding proposition.

\bigskip\marginpar{\texttt{\ind{remref}}}
\noindent
\verb|\remref{first argument}| is a command to reference remarks where the first argument is the label of the corresponding remark.

\bigskip\marginpar{\texttt{\ind{figref}}}
\noindent
\verb|\figref{first argument}| is a command to reference figures where the first argument is the label of the corresponding figure.

\bigskip\marginpar{\texttt{\ind{colref}}}
\noindent
\verb|\colref{first argument}| is a command to reference corollaries where the first argument is the label of the corresponding corollary.

\bigskip\marginpar{\texttt{\ind{appref}}}
\noindent
\verb|\appref{first argument}| is a command to reference the Appendix where the first argument is the label of the corresponding Appendix.

\bigskip\marginpar{\texttt{\ind{assref}}}
\noindent
\verb|\assref{first argument}| is a command to reference assumptions where the first argument is the label of the corresponding Assumption.
% ------------------------------------------------------------------------

\ifthenelse{\boolean{complete}}{
% INDEX ------------------------------------------------------------------
\printindex
} %End ifthenelse

\typeout{#####################################}
\end{document}
% ------------------------------------------------------------------------
% EOF
