%%
%% This is file `lewisstruc.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% lewisstruc.dtx  (with options: `lewisstruc')
%% 
%% This is a generated file.
%% 
%% Copyright 2009,2010,2013 by Shinsaku Fujita
%% all rights reserved.
%% This style file is created for drawing chemical structural formulas
%% This style file is to be contained in the ``xymtex'' directory which
%% is an input directory for TeX.
%% 
%% This file is part of the XyMTeX system.
%% =======================================
%% Old Versions:
%% Version 1.00 Released on November 03, 2009
%% Version 5.00 Released on October 01, 2010
%% 
%% The Present Version:
%% Version 5.01 Released on August 02, 2013
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% The Current Maintainer of this work is Shinsaku Fujita.
%% 
%% This work consists of the files lewisstruc.dtx and lewisstruc.ins
%% and the derived file lewisstruc.sty.
%% 
%% =======================================
%% 
%% File: lewisstruc.dtx
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
\typeout{Part of XyMTeX for Drawing Chemical Structural Formulas. Version 5.01}
\typeout{       -- Released August 02, 2013 by Shinsaku Fujita}
\def\j@urnalname{lewisstruc}
\def\versi@ndate{August 02, 2013}
\def\versi@nno{ver5.01}
\def\copyrighth@lder{SF} % Shinsaku Fujita
\typeout{XyMTeX Macro File `\j@urnalname' (\versi@nno) <\versi@ndate>%
\space[\copyrighth@lder]}
\RequirePackage{aliphat}
\def\dotnodimension{\smash{\hbox to0pt{\hss.\hss}}}
\def\verticalpair{\vbox{%
\dotnodimension
\nointerlineskip
\kern0.3em
\dotnodimension}}
\def\horizontalpair{%
\hbox{\dotnodimension\kern0.3em\dotnodimension}}
\def\nwlonepair{%
\vtop{\hbox to0.21em{\hss\dotnodimension}%
\nointerlineskip
\kern0.21em
\hbox to0.21em{\dotnodimension\hss}%
}}
\def\selonepair{%
\vbox{\hbox to0.21em{\hss\dotnodimension}%
\nointerlineskip
\kern0.21em
\hbox to0.21em{\dotnodimension\hss}%
}}
\def\swlonepair{%
\vbox{\hbox to0.21em{\dotnodimension\hss}%
\nointerlineskip
\kern0.21em
\hbox to0.21em{\hss\dotnodimension}%
}}
\def\nelonepair{%
\vtop{\hbox to0.21em{\dotnodimension\hss}%
\nointerlineskip
\kern0.21em
\hbox to0.21em{\hss\dotnodimension}%
}}
\def\LewisSbond{\raise0.12em\hbox to0.25em{\hss\verticalpair\hss}}
\def\overpair#1{\leavevmode\setbox0=\hbox{#1}%
\vbox{\hbox to\wd0{\hss\horizontalpair\hss}%
\nointerlineskip\kern0.08em
\box0}}
\def\underpair#1{\leavevmode\setbox0=\hbox{#1}%
\dimen0=\wd0
\vbox to\ht0{\box0
\nointerlineskip
\hbox{\vbox to0pt{\kern0.2em
\hbox to\dimen0{\hss\horizontalpair\hss}\vss}}%
\vss}}%bug fix 2013/08/02 \vss added
\def\overpairover#1#2{\leavevmode\setbox0=\hbox{#1}%
\edef\temp@@a{#2}%
\dimen0=\wd0%
\ifx\temp@@a\empty\box0\else%
\vbox{%
\hbox to\dimen0{\hss#2\hss}%
\nointerlineskip\kern0.2em
\hbox to\dimen0{\hss\horizontalpair\hss}%
\nointerlineskip\kern0.08em
\hbox{\box0}}\fi}
\def\underpairunder#1#2{\leavevmode\setbox0=\hbox{#1}%
\edef\temp@@a{#2}%
\dimen0=\wd0\dimen1=\ht0
\ifx\temp@@a\empty\box0\else%
\vbox to\dimen1{\hbox{\box0}%
\nointerlineskip
\hbox{\vbox to0pt{\kern0.18em
\hbox to\dimen0{\hss\horizontalpair\hss}%
\nointerlineskip\kern0.08em
\hbox to\dimen0{\hss#2\hss}%
\vss}}%
\vss}\fi}%bug fix2013/08/02
\def\leftlonepairover#1#2{\leavevmode%
\edef\temp@@{#2}%
\ifx\temp@@\empty#1\else
\hbox to0pt{\hss\raise0.9em\hbox{#2}\kern-0.05em\raise0.8em\hbox{\nwlonepair}\kern-0.1em}#1\fi}
\def\rightlonepairover#1#2{\leavevmode%
#1%
\edef\temp@@{#2}%
\ifx\temp@@\empty\else
\hbox to0pt{\kern-0.1em\raise0.8em\hbox{\nelonepair}\kern-0.05em%
\raise0.9em\hbox{#2}\hss}\fi}
\def\leftlonepairunder#1#2{\leavevmode%
\edef\temp@@{#2}%
\ifx\temp@@\empty#1\else
\hbox to0pt{\hss\lower0.9em\hbox{#2}\kern-0.05em%
\lower0.2em\hbox{\swlonepair}\kern-0.1em}#1\fi}
\def\rightlonepairunder#1#2{\leavevmode%
#1%
\edef\temp@@{#2}%
\ifx\temp@@\empty\else
\hbox to0pt{\kern-0.1em\lower0.2em\hbox{\selonepair}\kern-0.05em%
\lower0.9em\hbox{#2}\hss}\fi}
\def\LewistetrahedralA#1{\begingroup%
\let\temp@a=\empty%
\let\temp@b=\empty%
\let\temp@c=\empty%
\let\temp@d=\empty%
\let\temp@e=\empty%
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\ifx\@memberb\@yl\else
\ifcase\@tmpa \edef\temp@a{\@memberb}%central atom
\or\edef\temp@b{\@memberb}%
\or\edef\temp@c{\@memberb}%
\or\edef\temp@d{\@memberb}%
\or\edef\temp@e{\@memberb}%
\fi%end of ifcase
\fi\fi
}%
\leavevmode%
\ifx\temp@e\empty
\ifx\temp@c\empty
\underpairunder{\overpairover{\temp@a}{\temp@b}}{\temp@d}%
\else%c not empty
\underpairunder{\overpairover{\temp@a}{\temp@b}}{\temp@d}%
\LewisSbond\temp@c
\fi
\else%e not empty
\ifx\temp@c\empty
\temp@e\LewisSbond\underpairunder{\overpairover{\temp@a}{\temp@b}}{\temp@d}%
\else
\temp@e\LewisSbond\underpairunder{\overpairover{\temp@a}{\temp@b}}{\temp@d}%
\LewisSbond\temp@c
\fi\fi
\endgroup
}
\def\LewistetrahedralB#1{\begingroup%
\let\temp@a=\empty%
\let\temp@b=\empty%
\let\temp@c=\empty%
\let\temp@d=\empty%
\let\temp@e=\empty%
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\ifx\@memberb\@yl\else
\ifcase\@tmpa \edef\temp@a{\@memberb}%central atom
\or\edef\temp@b{\@memberb}%
\or\edef\temp@c{\@memberb}%
\or\edef\temp@d{\@memberb}%
\or\edef\temp@e{\@memberb}%
\fi%end of ifcase
\fi\fi
}%
\leavevmode%
\rightlonepairover{%
\leftlonepairover{\leftlonepairunder{%
\rightlonepairunder{\temp@a}{\temp@c}}{\temp@d}}{\temp@e}}{\temp@b}%
\endgroup}
\def\lonepairAitoiv#1#2#3#4#5{\leavevmode
\begingroup\setbox0=\hbox{#5}%
\dimen0=\ht0
\dimen1=1.22\wd0%
\setbox1=\hbox to\wd0{\hss%
\smash{%\raise0.01em
\hbox to\wd0{\hss%
\ifnum#4=0\relax
\phantom{\lower0.05em\hbox to0pt{\hss\vbox to\dimen0{\vss\verticalpair\vss}}}%
\else
\lower0.05em\hbox to0pt{\hss\vbox to\dimen0{\vss\verticalpair\vss}}%
\fi%
\lower0.2em\hbox{\vbox{\ifnum#1=0\relax
\phantom{\hbox to\dimen1{\hss\horizontalpair\hss}}%
\else
\hbox to\dimen1{\hss\horizontalpair\hss}\fi%
\nointerlineskip
\kern0.08em
\hbox to\dimen1{\hss#5\hss}%
\nointerlineskip
\kern0.2em
\ifnum#3=0\relax
\phantom{\hbox to\dimen1{\hss\horizontalpair\hss}}%
\else
\hbox to\dimen1{\hss\horizontalpair\hss}%
\fi
}}%
\ifnum#2=0\relax
\phantom{\lower0.05em\hbox to0pt{\vbox to\dimen0{\vss\verticalpair\vss}\hss}}%
\else
\lower0.05em\hbox to0pt{\vbox to\dimen0{\vss\verticalpair\vss}\hss}\fi%
\hss}}\hss}%
\wd1=\wd0 \ht1=\ht0\box1\endgroup}
\def\fromfourobjects#1#2{%
\ifnum#1=1234\relax
\TEMP@Command{1}{1}{1}{1}{#2}%
\else\ifnum#1=123\relax
\TEMP@Command{1}{1}{1}{0}{#2}%
\else\ifnum#1=124\relax
\TEMP@Command{1}{1}{0}{1}{#2}%
\else\ifnum#1=134\relax
\TEMP@Command{1}{0}{1}{1}{#2}%
\else\ifnum#1=234\relax
\TEMP@Command{0}{1}{1}{1}{#2}%
\else\ifnum#1=12\relax
\TEMP@Command{1}{1}{0}{0}{#2}%
\else\ifnum#1=13\relax
\TEMP@Command{1}{0}{1}{0}{#2}%
\else\ifnum#1=14\relax
\TEMP@Command{1}{0}{0}{1}{#2}%
\else\ifnum#1=23\relax
\TEMP@Command{0}{1}{1}{0}{#2}%
\else\ifnum#1=24\relax
\TEMP@Command{0}{1}{0}{1}{#2}%
\else\ifnum#1=34\relax
\TEMP@Command{0}{0}{1}{1}{#2}%
\else\ifnum#1=1\relax
\TEMP@Command{1}{0}{0}{0}{#2}%
\else\ifnum#1=2\relax
\TEMP@Command{0}{1}{0}{0}{#2}%
\else\ifnum#1=3\relax
\TEMP@Command{0}{0}{1}{0}{#2}%
\else\ifnum#1=4\relax
\TEMP@Command{0}{0}{0}{1}{#2}%
\else
\TEMP@Command{1}{1}{1}{1}{#2}%
\fi\fi\fi\fi\fi
\fi\fi\fi\fi\fi
\fi\fi\fi\fi\fi}
\def\lonepairA{\@ifnextchar[{\l@nepairA}{\l@nepairA[1234]}}
\def\l@nepairA[#1]#2{\leavevmode%
\begingroup\let\TEMP@Command=\lonepairAitoiv%
\fromfourobjects{#1}{#2}\endgroup}
\def\chemradical{\hbox to0pt{\hss.\hss}}
\def\tetraradical#1#2#3#4#5{\leavevmode\setbox0=\hbox{#5}%
\dimen0=\ht0
\dimen1=1.22\wd0%
\setbox1=\hbox to\wd0{\hss%
\smash{%\raise0.01em
\hbox to\wd0{\hss%
\ifnum#4=0\relax
\phantom{\raise0.02em\hbox to0pt{\hss\vbox to\dimen0{\vss\chemradical\vss}}}%
\else
\raise0.02em\hbox to0pt{\hss\vbox to\dimen0{\vss\chemradical\vss}}%
\fi%
\lower0.22em\hbox{\vbox{%
\ifnum#1=0\relax
\phantom{\hbox to\dimen1{\hss\chemradical\hss}}%
\else
\hbox to\dimen1{\hss\chemradical\hss}\fi%
\nointerlineskip
\kern0.08em
\hbox to\dimen1{\hss#5\hss}%
\nointerlineskip
\kern0.12em
\ifnum#3=0\relax
\phantom{\hbox to\dimen1{\hss\chemradical\hss}}%
\else
\hbox to\dimen1{\hss\chemradical\hss}%
\fi
}}%
\ifnum#2=0\relax
\phantom{\raise0.02em\hbox to0pt{\vbox to\dimen0{\vss\chemradical\vss}\hss}}%
\else
\raise0.02em\hbox to0pt{\vbox to\dimen0{\vss\chemradical\vss}\hss}\fi%
\hss}}\hss}%
\wd1=\wd0 \ht1=\ht0\box1}
\def\chemradicalA{\@ifnextchar[{\chemr@dicalA}{\chemr@dicalA[1234]}}
\def\chemr@dicalA[#1]#2{\leavevmode
\begingroup\let\TEMP@Command=\tetraradical%
\fromfourobjects{#1}{#2}\endgroup}
\def\lonepairBitoiv#1#2#3#4#5{\begingroup\setbox0=\hbox{#5}%
\dimen0=\ht0 \dimen1=1.22\wd0%
\setbox1=\hbox to\wd0{\hss%
\smash{\lower0.04em\hbox to0pt{%
\hss\vbox to\dimen0{\vss%
\ifnum#4=0\relax \phantom{\nwlonepair}\else
\nwlonepair\fi%
\nointerlineskip
\kern0.45em
\ifnum#3=0\relax \phantom{\swlonepair}\else
\swlonepair\fi
\vss}\kern-0.2em}%
\hbox to\dimen1{\hss#5\hss}%
\lower0.04em\hbox to0pt{\kern-0.22em%
\vbox to\dimen0{\vss%
\ifnum#1=0\relax \phantom{\nelonepair}\else
\nelonepair\fi%
\nointerlineskip
\kern0.45em
\ifnum#2=0\relax \phantom{\selonepair}\else
\selonepair\fi\vss}\hss}%
}\hss}%
\ht1=\ht0\box1\endgroup}
\def\lonepairB{\@ifnextchar[{\l@nepairB}{\l@nepairB[1234]}}
\def\l@nepairB[#1]#2{\leavevmode%
\begingroup\let\TEMP@Command=\lonepairBitoiv%
\fromfourobjects{#1}{#2}\endgroup}
\def\tetraradicalB#1#2#3#4#5{\setbox0=\hbox{#5}%
\dimen0=\ht0 \dimen1=1.22\wd0%
\setbox1=\hbox to\wd0{\hss%
\smash{\lower0.009em\hbox to0pt{%
\hss\vbox to\dimen0{\vss%
\ifnum#4=0\relax \phantom{\chemradical}\else
\chemradical\fi%
\nointerlineskip
\kern0.7em
\ifnum#3=0\relax \phantom{\chemradical}\else
\chemradical\fi
\vss}\kern-0.05em}%
\hbox to\dimen1{\hss#5\hss}%
\lower0.009em\hbox to0pt{\kern-0.05em%
\vbox to\dimen0{\vss%
\ifnum#1=0\relax \phantom{\chemradical}\else
\chemradical\fi%
\nointerlineskip
\kern0.7em
\ifnum#2=0\relax \phantom{\chemradical}\else
\chemradical\fi\vss}\hss}%
}\hss}%
\ht1=\ht0\box1}
\def\chemradicalB{\@ifnextchar[{\chemr@dicalB}{\chemr@dicalB[1234]}}
\def\chemr@dicalB[#1]#2{\leavevmode
\begingroup\let\TEMP@Command=\tetraradicalB%
\fromfourobjects{#1}{#2}\endgroup}
\def\LewisTetrahedralA{%
\@ifnextchar[{\@LewisTetrahedralA[r}{\@LewisTetrahedralA[r]}}
\def\@LewisTetrahedralA#1]#2{%
\@ifnextchar<{\@@LewisTetrahedralA#1]{#2}}{\@@LewisTetrahedralA#1]{#2}<,,,>}}
\def\@@LewisTetrahedralA#1]#2<#3,#4,#5,#6>{%
\begingroup
\let\Northbond=\Northlonepair
\let\Southbond=\Southlonepair
\let\Eastbond=\Eastlonepair
\let\Westbond=\Westlonepair
\let\yltetrahedralposition=\ylLewisTetrahedralAposition
\@@tetrahedral#1]#2<#3,#4,#5,#6>%
\endgroup
\West@bondfalse
\East@bondfalse
}%end of macro LewisTetrahedralA
\def\Northlonepair{%
\@ifnextchar[{\N@rthlonepair}{\N@rthlonepair[]}}
\def\N@rthlonepair[#1]{%
  \if\@tmpb D\relax%
    \put(0,60){\hbox to0pt{\hss\horizontalpair\hss}}%
    \put(0,90){\hbox to0pt{\hss\horizontalpair\hss}}%
    \putlratom{-40}{120}{\@memberb}%==1 upper substituent
  \else\if\@tmpb T\relax%
    \put(0,60){\hbox to0pt{\hss\horizontalpair\hss}}%
    \put(0,90){\hbox to0pt{\hss\horizontalpair\hss}}%
    \put(0,120){\hbox to0pt{\hss\horizontalpair\hss}}%
    \putlratom{-40}{150}{\@memberb}%==1 upper substituent
  \else\if\@tmpb N\relax%normal single bond
    \Put@Line(0,52)(0,1){110}%
    \putlratom{-40}{171}{\@memberb}%==1 upper substituent
  \else
    \put(0,60){\hbox to0pt{\hss\horizontalpair\hss}}%
    \putlratom{-40}{90}{\@memberb}%==1 upper substituent
   \fi\fi\fi%
}
\def\Southlonepair{%
\@ifnextchar[{\S@uthlonepair}{\S@uthlonepair[]}}
\def\S@uthlonepair[#1]{%
  \if\@tmpb D\relax%
    \put(0,-60){\hbox to0pt{\hss\horizontalpair\hss}}%
    \put(0,-90){\hbox to0pt{\hss\horizontalpair\hss}}%
    \putlratom{-40}{-180}{\@memberb}%==3 down substituent
  \else\if\@tmpb T\relax%
    \put(0,-60){\hbox to0pt{\hss\horizontalpair\hss}}%
    \put(0,-90){\hbox to0pt{\hss\horizontalpair\hss}}%
    \put(0,-120){\hbox to0pt{\hss\horizontalpair\hss}}%
    \putlratom{-40}{-210}{\@memberb}%==3 down substituent
  \else\if\@tmpb N\relax%normal single bond
    \Put@Line(0,-48)(0,-1){110}%
    \putlratom{-40}{-250}{\@memberb}%==1 upper substituent
  \else
    \put(0,-60){\hbox to0pt{\hss\horizontalpair\hss}}%
    \putlratom{-40}{-150}{\@memberb}%==3 down substituent
   \fi\fi\fi%
}
\def\Eastlonepair{%
\@ifnextchar[{\E@stlonepair}{\E@stlonepair[]}}
\def\E@stlonepair[#1]{%
  \if\@tmpb D\relax%
    \put(60,-18){\hbox to0pt{\hss\verticalpair\hss}}%
    \put(90,-18){\hbox to0pt{\hss\verticalpair\hss}}%
    \putratom{120}{-33}{\@memberb}%==3 down substituent
  \else\if\@tmpb T\relax%
    \put(60,-18){\hbox to0pt{\hss\verticalpair\hss}}%
    \put(90,-18){\hbox to0pt{\hss\verticalpair\hss}}%
    \put(120,-18){\hbox to0pt{\hss\verticalpair\hss}}%
    \putratom{150}{-33}{\@memberb}%==3 down substituent
  \else\if\@tmpb N\relax%normal single bond
    \Put@Line(50,0)(1,0){140}%
    \putratom{190}{-33}{\@memberb}%==1 upper substituent
  \else
    \put(60,-18){\hbox to0pt{\hss\verticalpair\hss}}%
    \putratom{90}{-33}{\@memberb}%==3 down substituent
   \fi\fi\fi%
}
\def\Westlonepair{%
\@ifnextchar[{\W@stlonepair}{\W@stlonepair[]}}
\def\W@stlonepair[#1]{%
  \if\@tmpb D\relax%
    \put(-65,-18){\hbox to0pt{\hss\verticalpair\hss}}%
    \put(-95,-18){\hbox to0pt{\hss\verticalpair\hss}}%
    \putlatom{-120}{-33}{\@memberb}%==3 down substituent
  \else\if\@tmpb T\relax%
    \put(-65,-18){\hbox to0pt{\hss\verticalpair\hss}}%
    \put(-95,-18){\hbox to0pt{\hss\verticalpair\hss}}%
    \put(-125,-18){\hbox to0pt{\hss\verticalpair\hss}}%
    \putlatom{-150}{-33}{\@memberb}%==3 down substituent
  \else\if\@tmpb N\relax%normal single bond
    \Put@Line(-50,0)(-1,0){140}%
    \putlatom{-190}{-33}{\@memberb}%==1 upper substituent
  \else
    \put(-65,-18){\hbox to0pt{\hss\verticalpair\hss}}%
    \putlatom{-90}{-33}{\@memberb}%==3 down substituent
   \fi\fi\fi%
}
\def\ylLewisTetrahedralAposition#1{%
\@@ylswfalse%%%\@reset@ylsw
\West@bondfalse
\East@bondfalse
\@forsemicol\member:=#1\do{%
\if@@ylsw\else
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax
\expandafter\threech@r\@membera{}{}\relax
\ifx\@memberb\@yl\relax\@@ylswtrue\else\@@ylswfalse\fi
\if@@ylsw%
\ifcase\@tmpa%
 \or%1
  \ifno@centeratom%
   \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue%N subst. on 1
  \else%
   \gdef\@ylii{45}\gdef\@yli{33}\global\@ylswtrue%N subst. on 1
  \fi%
 \or%2
  \ifno@centeratom%
    \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue%
  \else%
    \gdef\@ylii{40}\gdef\@yli{30}\global\@ylswtrue%
  \fi%
  \East@bondtrue%W subst. on 1
 \or%3
  \ifno@centeratom%
   \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue%S subst. on 1
  \else%
   \gdef\@ylii{35}\gdef\@yli{40}\global\@ylswtrue%S subst. on 1
  \fi%
 \or%4
  \ifno@centeratom%
   \gdef\@ylii{-72}\gdef\@yli{0}\global\@ylswtrue%??????
  \else%
   \gdef\@ylii{-40}\gdef\@yli{32}\global\@ylswtrue%
  \fi%
     \West@bondtrue%E subst. on 1
\fi%end of ifcase
\fi\fi\fi}}%
\def\LewisTetrahedralB{%
\@ifnextchar[{\@LewisTetrahedralB[r}{\@LewisTetrahedralB[r]}}
\def\@LewisTetrahedralB#1]#2{%
\begingroup
\let\NEbond=\NEbondlonepair
\let\SEbond=\SEbondlonepair
\let\SWbond=\SWbondlonepair
\let\NWbond=\NWbondlonepair
\let\ylsquareposition=\ylLewisTetrahedralBposition
\@squareplanar#1]{#2}%
\endgroup
}%end of macro LewisTetrahedralB
\def\NEbondlonepair{%
\begin{sfpicture}(100,300)(0,0)%
  \if\@tmpb D\relax%
    \put(50,50){\hbox to0pt{\hss\nelonepair\hss}}%
    \put(75,75){\hbox to0pt{\hss\nelonepair\hss}}%
    \putratom{90}{82}{\@memberb}%==1 northeast substituent
  \else\if\@tmpb T\relax%
    \put(50,50){\hbox to0pt{\hss\nelonepair\hss}}%
    \put(75,75){\hbox to0pt{\hss\nelonepair\hss}}%
    \put(100,100){\hbox to0pt{\hss\nelonepair\hss}}%
    \putratom{115}{107}{\@memberb}%==1 northeast substituent
  \else\if\@tmpb N\relax%normal single bond
    \Put@Line(40,47)(1,1){95}%
    \putratom{145}{137}{\@memberb}%==1 (northeast substituent)
  \else
    \put(50,50){\hbox to0pt{\hss\nelonepair\hss}}%
    \putratom{65}{57}{\@memberb}%==1 northeast substituent
   \fi\fi\fi%
\end{sfpicture}%
}
\def\SEbondlonepair{%
\begin{sfpicture}(100,300)(0,0)%
  \if\@tmpb D\relax%
    \put(50,-50){\hbox to0pt{\hss\selonepair\hss}}%
    \put(75,-75){\hbox to0pt{\hss\selonepair\hss}}%
    \putratom{90}{-148}{\@memberb}%==2 southeast substituent
  \else\if\@tmpb T\relax%
    \put(50,-50){\hbox to0pt{\hss\selonepair\hss}}%
    \put(75,-75){\hbox to0pt{\hss\selonepair\hss}}%
    \put(100,-100){\hbox to0pt{\hss\selonepair\hss}}%
    \putratom{115}{-173}{\@memberb}%==2 southeast substituent
  \else\if\@tmpb N\relax%normal single bond
    \Put@Line(40,-47)(1,-1){95}%
    \putratom{145}{-203}{\@memberb}%==2 (southeast substituent)
  \else
    \put(50,-50){\hbox to0pt{\hss\selonepair\hss}}%
    \putratom{65}{-123}{\@memberb}%==2 southeast substituent
   \fi\fi\fi%
\end{sfpicture}%
}
\def\SWbondlonepair{%
\begin{sfpicture}(100,300)(0,0)%
  \if\@tmpb D\relax%
    \put(-50,-50){\hbox to0pt{\hss\swlonepair\hss}}%
    \put(-75,-75){\hbox to0pt{\hss\swlonepair\hss}}%
    \putlatom{-90}{-148}{\@memberb}%==3 southeast substituent
  \else\if\@tmpb T\relax%
    \put(-50,-50){\hbox to0pt{\hss\swlonepair\hss}}%
    \put(-75,-75){\hbox to0pt{\hss\swlonepair\hss}}%
    \put(-100,-100){\hbox to0pt{\hss\swlonepair\hss}}%
    \putlatom{-115}{-173}{\@memberb}%==3 southeast substituent
  \else\if\@tmpb N\relax%normal single bond
    \Put@Line(-50,-47)(-1,-1){95}%
    \putlatom{-163}{-203}{\@memberb}%==3 (southwest substituent)
  \else
    \put(-50,-50){\hbox to0pt{\hss\swlonepair\hss}}%
    \putlatom{-65}{-123}{\@memberb}%==3 southeast substituent
   \fi\fi\fi%
\end{sfpicture}%
}
\def\NWbondlonepair{%
\begin{sfpicture}(100,300)(0,0)%
  \if\@tmpb D\relax%
    \put(-50,50){\hbox to0pt{\hss\nwlonepair\hss}}%
    \put(-75,75){\hbox to0pt{\hss\nwlonepair\hss}}%
    \putlatom{-90}{82}{\@memberb}%==4 northwest substituent
  \else\if\@tmpb T\relax%
    \put(-50,50){\hbox to0pt{\hss\nwlonepair\hss}}%
    \put(-75,75){\hbox to0pt{\hss\nwlonepair\hss}}%
    \put(-100,100){\hbox to0pt{\hss\nwlonepair\hss}}%
    \putlatom{-115}{107}{\@memberb}%==4 northwest substituent
  \else\if\@tmpb N\relax%normal single bond
    \Put@Line(-40,47)(-1,1){95}%
    \putlatom{-145}{137}{\@memberb}%==4 (northwest substituent)
  \else
    \put(-50,50){\hbox to0pt{\hss\nwlonepair\hss}}%
    \putlatom{-65}{57}{\@memberb}%==1 northwest substituent
   \fi\fi\fi%
\end{sfpicture}%
}
\def\ylLewisTetrahedralBposition#1{%
\@@ylswfalse%%%\@reset@ylsw
\@forsemicol\member:=#1\do{%
\if@@ylsw\else
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax
\expandafter\threech@r\@membera{}{}\relax
\ifx\@memberb\@yl\relax\@@ylswtrue\else\@@ylswfalse\fi
\if@@ylsw
\ifcase\@tmpa
 \or%
     \gdef\@ylii{-28}\gdef\@yli{40}\global\@ylswtrue% NE subst. on 1
 \or%2
     \gdef\@ylii{-28}\gdef\@yli{35}\global\@ylswtrue% SE subst. on 2
 \or%3
     \gdef\@ylii{35}\gdef\@yli{22}\global\@ylswtrue% SW subst. on 3
 \or%4
     \gdef\@ylii{35}\gdef\@yli{40}\global\@ylswtrue% NW subst. on 4
\fi%end of ifcase
\fi\fi\fi}}%
\endinput
%%
%% End of file `lewisstruc.sty'.
