%%%%%%%%%%%%%%%%%% echem.sty %%%%%%%%%%%%%%%%%%%%%%%
% (c) Ingo Kloeckl
% 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; either
% version 1 of the License, or any later version.

% History
% 20.12.1999 v1.0  IK 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{calc}

\newsavebox{\cbox}

% Symbol fuer einzelnes Elektron
\newcommand{\echdot}
{{\unitlength=.08\baselineskip%
  \begin{picture}(0,0)
    \put(0,0){\circle*{2}}
  \end{picture}}}
% liegender Balken fuer Elektronenpaar
\newcommand{\echhbar}
{{\unitlength=.08\baselineskip%
  \linethickness{0.8\unitlength}%
  \begin{picture}(0,0)
    \put(-3,0){\line(1,0){6}}
  \end{picture}}}
% aufrechter Balken fuer Elektronenpaar
\newcommand{\echvbar}
{{\unitlength=.08\baselineskip%
  \linethickness{0.8\unitlength}%
  \begin{picture}(2,0)(-1,0)
    \put(0,-3){\line(0,1){6}}
  \end{picture}}}

% die horizontalen Symbole (upper und lower)
\newcommand{\hdu}[2][\echdot]
{\sbox{\cbox}{#2}%
 \makebox[0pt][l]{\raisebox{1.3\ht\cbox}
   {\makebox[\wd\cbox]{#1}}}%
}
\newcommand{\hddu}[1]
{\sbox{\cbox}{#1}%
 \makebox[0pt][l]{\raisebox{1.3\ht\cbox}
   {\makebox[\wd\cbox]
     {\echdot\hspace*{0.6\ht\cbox}\echdot}}}%
}
\newcommand{\hdl}[2][\echdot]
{\sbox{\cbox}{#2}%
 \makebox[0pt][l]{\raisebox{-\dp\cbox-0.3\ht\cbox}
   {\makebox[\wd\cbox]{#1}}}%
}
\newcommand{\hddl}[1]
{\sbox{\cbox}{#1}%
 \makebox[0pt][l]{\raisebox{-\dp\cbox-0.3\ht\cbox}
   {\makebox[\wd\cbox]
     {\echdot\hspace*{0.6\ht\cbox}\echdot}}}%
}

% die vertikalen Symbole
\newcommand{\vd}[2][\echdot]
{\sbox{\cbox}{#2}\hspace*{0.1\ht\cbox}%
 \raisebox{0.5\ht\cbox}{#1}%
 \hspace*{0.1\ht\cbox}%
}
\newcommand{\vdd}[1]
{\sbox{\cbox}{#1}\hspace*{0.1\ht\cbox}%
 \makebox[0pt][l]{\raisebox{0.2\ht\cbox}{\echdot}}%
 \raisebox{0.8\ht\cbox}{\echdot}%
 \hspace*{0.1\ht\cbox}%
}

% liegende eckige Klammer unten
\newcommand{\atomconnect}[3]
{\sbox{\cbox}{#1#2#3}%
 \makebox[0pt][l]%
 {\raisebox{-\dp\cbox-.5em}[0pt][1em]%
  {\makebox[\wd\cbox][l]{%
   \sbox{\cbox}{#1}\hspace{.5\wd\cbox}%
   \rule{0.5pt}{0.5em}\hrulefill\rule{0.5pt}{0.5em}%
   \sbox{\cbox}{#3}\hspace{.5\wd\cbox}}%
  }}%
 #1#2#3}

% einige hilfreiche Abk"urzungen
\newcommand{\2}{\ensuremath{_2}}
\renewcommand{\3}{\ensuremath{_3}}
\newcommand{\sbond}{\,\ensuremath{\cdot}\,}
\newcommand{\dbond}{\,=\,}


%%%%%%%%%%%%%%%%%% end of echem.sty %%%%%%%%%%%%%%%%%%%%%%%