%
%      Some new commands for math documents
%
%				By: Gabriel Zachmann
%
% Should be included after amsmath.sty (if any)
%


\RequirePackage{amssymb}
\RequirePackage{array}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                            Special Symbols
%  
%  Most symbols work inside and outside math mode.
%
%  Number sets: \R \Aff \E \N
%  Vectors: \vc v
%  Subscripts, superscript:  \trp \deg \sbr \spr
%  Slash fraction: \sfrac[\mathrm]{v}{3}
%  Short cdots: \scdots
%  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%  sets
\newcommand{\R}{\ensuremath{\mathbb{R}}}
\newcommand{\Aff}{\ensuremath{\R^3}}
\newcommand{\E}{\ensuremath{\mathbb{E}}}
\newcommand{\N}{\ensuremath{\mathbb{N}}}
\newcommand{\Z}{\ensuremath{\mathbb{Z}}}

%  vectors
\newcommand{\vc}[1]{\ensuremath{\mathbf{#1}}}

%  transpose
\newcommand{\trp}{^\mathsf{T} }

%  degree symbol
\renewcommand{\deg}{\textdegree}

%  fraction using slash (plucked from c.t.t and modified by me)
\DeclareRobustCommand{\sfrac}[3][\mathit]{%
  \smash[b]{%
  \hspace{0.1em}\raisebox{0.4ex}{$#1{#2}$}%
  \hspace{-0.1em}/\hspace{-0.07em}%
  \mbox{$#1{#3}$}}}
%\DeclareRobustCommand{\sfrac}[3][\mathit]{\hspace{0.1em}%
%  \raisebox{0.4ex}{$#1{\scriptstyle #2}$}\hspace{-0.1em}/\hspace{-0.07em}%
%  \mbox{$#1{\scriptstyle #3}$}}

%  Super- or subscript in roman
\newcommand{\sbr}[1]{\ensuremath{_{\mathrm{#1}}}}
\newcommand{\spr}[1]{\ensuremath{^{\mathrm{#1}}}}

%  "Short" cdots (only 2 dots)
\newcommand{\scdots}{\hspace*{-0.5ex}\cdotp\cdotp\hspace*{-0.5ex}}



%
%  \shortintertext
%
%  Tighter intertext for short interjections, like ``and'', ``with'', etc.
%  Copied from amsmath.sty
%  Uses \{above|below}displayshortskip instead of \{above|below}displayskip
%  Donald Arsenau suggests to use abovedisplayshortskip for both above
%  and below.
%
% Sollte vielleicht eigene spacing parameter nehmen,
% da \*displayshortskip von latex zurueck gesetzt werden!

\def\shortintertext#1{%
\ifvmode\else\\\@empty\fi
\noalign{%
  \penalty\postdisplaypenalty\vskip\aboveshortintertextskip
  \vbox{\normalbaselines
	\ifdim\linewidth=\columnwidth
	\else \parshape\@ne \@totalleftmargin \linewidth
	\fi
	\noindent#1\par}%
  \penalty\predisplaypenalty\vskip\belowshortintertextskip%
}%
}

\newskip \aboveshortintertextskip
\aboveshortintertextskip 0.4\baselineskip plus 0.3\baselineskip minus 0.2\baselineskip
\newskip \belowshortintertextskip
\belowshortintertextskip 0.4\baselineskip plus 0.3\baselineskip minus 0.2\baselineskip



%
%  Square root symbol with little hook at the end
%  (from comp.text.tex)
%

\let\originalsqrt\sqrt
\def\varsqrt #1#2{{\setbox0=\hbox{$#1\originalsqrt{#2\hskip2pt}$}%
                    \dimen0=\ht0 \advance\dimen0-.5pt
    \dimen2=\dimen0
         \advance\dimen2 -1.5pt
         \ifdim \dimen2 >10pt \advance\dimen2-.5pt \fi
         \ifdim \dimen2 >15pt \advance\dimen2 -1pt \fi
    \box0 \kern-.4pt
    \vrule width.4pt height\dimen0 depth -\dimen2 \kern.8pt
  }}

\def\Sqrt {\mathpalette \varsqrt }
\let\sqrt\Sqrt

