% \iffalse meta-comment %% File: lewisstruc.dtx % % Copyright 2009, 2010, 2013 by Shinsaku Fujita % % This file is part of XyMTeX system. % ------------------------------------- % % This file (lewisstruc.sty) is a successor to: % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \typeout{XyMTeX for Drawing Chemical Structural Formulas. Version 1.00} % \typeout{ -- Released December 1, 1993 by Shinsaku Fujita} % Copyright (C) 1993 by Shinsaku Fujita, all rights reserved. % % This file is a part of the macro package ``XyMTeX'' which has been % designed for typesetting chemical structural formulas. % % This file is to be contained in the ``xymtex'' directory which is % an input directory for TeX. It is a LaTeX optional style file and % should be used only within LaTeX, because several macros of the file % are based on LaTeX commands. % % For the review of XyMTeX, see % (1) Shinsaku Fujita, ``Typesetting structural formulas with the text % formatter TeX/LaTeX'', Computers and Chemistry, in press. % The following book deals with an application of TeX/LaTeX to % preparation of manuscripts of chemical fields: % (2) Shinsaku Fujita, ``LaTeX for Chemists and Biochemists'' % Tokyo Kagaku Dozin, Tokyo (1993) [in Japanese]. % % 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. % % Please report any bugs, comments, suggestions, etc. to: % Shinsaku Fujita, % Shonan Institute of Chemoinformatics and Mathematical Chemistry % Kaneko 479-7 Ooimachi, Ashigara-Kami-Gun, Kanagawa 250-0019 Japan % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \def\j@urnalname{lewisstruc} % \def\versi@ndate{November 03, 2009} % \def\versi@nno{ver1.00} % \def\copyrighth@lder{SF}% Shinsaku Fujita % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \def\j@urnalname{lewisstruc} % \def\versi@ndate{October 01, 2010} % \def\versi@nno{ver5.00} % \def\copyrighth@lder{SF} % Shinsaku Fujita % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \fi % % \CheckSum{1697} %% \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 \~} % % \setcounter{StandardModuleDepth}{1} % % \StopEventually{} % \MakeShortVerb{\|} % % \iffalse % \changes{v1.00}{2009/11/03}{first edition for LaTeX2e} % \changes{v5.00}{2010/10/01}{the LaTeX Project Public License} % \changes{v5.01}{2013/08/02}{bug fix} % \fi % % \iffalse %<*driver> \NeedsTeXFormat{pLaTeX2e} % \fi \ProvidesFile{lewisstruc.dtx}[2013/08/02 v5.01 lewisstruc package file] % \iffalse \documentclass{ltxdoc} \GetFileInfo{lewisstruc.dtx} % % %%XyMTeX Logo: Definition 2%%% \def\UPSILON{\char'7} \def\XyM{X\kern-.30em\smash{% \raise.50ex\hbox{\UPSILON}}\kern-.30em{M}} \def\XyMTeX{\XyM\kern-.1em\TeX} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \title{Lewis Structures by {\sffamily lewisstruc.sty} (\fileversion) of \XyMTeX{}} \author{Shinsaku Fujita \\ Shonan Institute of Chemoinformatics and Mathematical Chemistry \\ Kanagawa, 258-0019 Japan } \date{\filedate} % \begin{document} \maketitle \DocInput{lewisstruc.dtx} \end{document} % % \fi % % \section{Introduction}\label{lewisstruc:intro} % % \subsection{Options for {\sffamily docstrip}} % % \DeleteShortVerb{\|} % \begin{center} % \begin{tabular}{|l|l|} % \hline % \emph{option} & \emph{function}\\ \hline % lewisstruc & lewisstruc.sty \\ % driver & driver for this dtx file \\ % \hline % \end{tabular} % \end{center} % \MakeShortVerb{\|} % % \subsection{Version Information} % % \begin{macrocode} %<*lewisstruc> \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]} % \end{macrocode} % % The definition of the macro \verb/\LewisTetrahedralA/ uses the command % \verb/\tetrahedral/ defined in the \textsf{aliphat} package of % the \XyMTeX{} system. % % \begin{macrocode} \RequirePackage{aliphat} %\@ifundefined{tetrahedral}{\input aliphat.sty\relax}{} % \end{macrocode} % % \section{Basic Macros} % \subsection{Lone Pairs} % % \begin{macro}{\dotnodimension} % A basic command \verb/\dotnodimension/ is used to draw a dot (an electron). % \begin{macrocode} \def\dotnodimension{\smash{\hbox to0pt{\hss.\hss}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\verticalpair} % The command \verb/\verticalpair/ is used to draw a vertical lone pair. % \begin{macro}{\horizontalpair} % The command \verb/\horizontalpair/ is used to draw a vertical lone pair. % \begin{macrocode} \def\verticalpair{\vbox{% \dotnodimension \nointerlineskip \kern0.3em \dotnodimension}} \def\horizontalpair{% \hbox{\dotnodimension\kern0.3em\dotnodimension}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\nwlonepair} % The command \verb/\nwlonepair/ is used to draw a lone pair located at % the northwest position. % \begin{macro}{\selonepair} % The command \verb/\selonepair/ is used to draw a lone pair at % the southest posistion. % \begin{macro}{\swlonepair} % The command \verb/\swlonepair/ is used to draw a lone pair at % the southwest position. % \begin{macro}{\nelonepair} % The command \verb/\nelonepair/ is used to draw a lone pair at % the northeast position. % \begin{macrocode} \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}% }} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\LewisSbond} % The command \verb/\LewisSbond/ is used to draw a vertical lone pair % used in a horizontal position. For example, \verb/H\LewisSbond H/ % outputs H:H for representing a hydrogen molecule. % \begin{macrocode} \def\LewisSbond{\raise0.12em\hbox to0.25em{\hss\verticalpair\hss}} % \end{macrocode} % \end{macro} % % \begin{macro}{\overpair} % The command \verb/\overpair/ is used to draw a horizontal lone pair % at the head of an atom specified by its argument. % \begin{macro}{\underpair} % The command \verb/\underpair/ is used to draw a horizontal lone pair % under an atom specified by its argument. % \begin{macrocode} \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 % \end{macrocode} % \end{macro} % \end{macro} % % \subsection{Atoms Linked by a Lewis Bond} % % An atom (\verb/OverAtom/) which is attached to the top of an atom (\verb/BaseAtom/) % through a Lewis bond is drawn by the following \verb/\overpairover/ command. % % \begin{verbatim} % \overpairover{BaseAtom}{OverAtom} % \end{verbatim} % % \begin{macro}{\overpairover} % \begin{macrocode} \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} % \end{macrocode} % \end{macro} % % An atom (\verb/UnderAtom/) which is attached to the bottom of an atom (\verb/BaseAtom/) % through a Lewis bond is drawn by the following \verb/\overpairover/ command. % % \begin{verbatim} % \underpairunder{BaseAtom}{UnderAtom} % \end{verbatim} % % \begin{macro}{\underpairunder} % \begin{macrocode} \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 % \end{macrocode} % \end{macro} % % % An atom (\verb/NWAtom/) which is attached to the northwest of an atom (\verb/BaseAtom/) % through a Lewis bond is drawn by the following \verb/\leftlonepairover/ command. % % \begin{verbatim} % \leftlonepairover{BaseAtom}{NWAtom} % \end{verbatim} % % \begin{macro}{\leftlonepairover} % \begin{macrocode} \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} % \end{macrocode} % \end{macro} % % An atom (\verb/NEAtom/) which is attached to the northeast of an atom (\verb/BaseAtom/) % through a Lewis bond is drawn by the following \verb/\rightlonepairover/ command. % % \begin{verbatim} % \rightlonepairover{BaseAtom}{NEAtom} % \end{verbatim} % % \begin{macro}{\rightlonepairover} % \begin{macrocode} \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} % \end{macrocode} % \end{macro} % % An atom (\verb/SWAtom/) which is attached to the southwest of an atom (\verb/BaseAtom/) % through a Lewis bond is drawn by the following \verb/\leftlonepairunder/ command. % % \begin{verbatim} % \leftlonepairunder{BaseAtom}{NEAtom} % \end{verbatim} % % \begin{macro}{\leftlonepairunder} % \begin{macrocode} \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} % \end{macrocode} % \end{macro} % % An atom (\verb/SEAtom/) which is attached to the southeast of an atom (\verb/BaseAtom/) % through a Lewis bond is drawn by the following \verb/\rightlonepairunder/ command. % % \begin{verbatim} % \rightlonepairunder{BaseAtom}{SEAtom} % \end{verbatim} % % \begin{macro}{\rightlonepairunder} % \begin{macrocode} \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} % \end{macrocode} % \end{macro} % % % Atoms (W, X, Y, and Z) which are attached to a central atom (A) % through Lewis bonds are drawn by the following \verb/\LewistetrahedralA/ command. % % \begin{verbatim} % \LewistetrahedralA{0==A;1==W;2==X;3==Y;4==Z} % \end{verbatim} % % \begin{verbatim} % 1 % W % : % 4 Z : A : X 2 % : % Y % 3 % \end{verbatim} % % Each of the atoms can be omitted. % % \begin{macro}{\LewistetrahedralA} % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} % % Atoms (W, X, Y, and Z) which are attached to a central atom (A) % through Lewis bonds are drawn by the following \verb/\LewistetrahedralB/ command. % % \begin{verbatim} % \LewistetrahedralB{0==A;1==W;2==X;3==Y;4==Z} % \end{verbatim} % % \begin{verbatim} % % 4 Z W 1 % : : % A % : : % 3 Y X 2 % % \end{verbatim} % % Each of the atoms can be omitted. % % \begin{macro}{\LewistetrahedralB} % \begin{macrocode} \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} % \end{macrocode} % \end{macro} % % \subsection{Lone Pairs around an Atom} % % Four lone pairs which are attached to a central atom (A) % are drawn by the following \verb/\lonepairAitoiv/ command, % where each of the top four argumets takes 0 (absence) or 1 (presence) for % representing the absence or presece of a lone pair. The larst argument % represents the central atom. % % \begin{verbatim} % \lonepairAitoiv{0 or 1}{0 or 1}{0 or 1}{0 or 1}{A} % \end{verbatim} % % \begin{verbatim} % 1 % : % 4 : A : 2 % : % 3 % \end{verbatim} % % \begin{macro}{\lonepairAitoiv} % \begin{macrocode} \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} % \end{macrocode} % \end{macro} % % A common code for transforming a command to another command is % defined as the command \verb/\fromfourobjects/ % % \begin{macro}{\fromfourobjects} % \begin{macrocode} \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} % \end{macrocode} % \end{macro} % % The command \verb/\lonepairAitoiv/ is converted into % the command \verb/\lonepairA/, where four lone pairs are % specified by a set of numbers 1234, 234, etc as an optional % argument. The main argument specifies a central atom. % % \begin{verbatim} % \lonepairA[1234, etc.]{A} % \end{verbatim} % % \begin{verbatim} % 1 % : % 4 : A : 2 % : % 3 % \end{verbatim} % % \begin{macro}{\lonepairA} % \begin{macrocode} \def\lonepairA{\@ifnextchar[{\l@nepairA}{\l@nepairA[1234]}} \def\l@nepairA[#1]#2{\leavevmode% \begingroup\let\TEMP@Command=\lonepairAitoiv% \fromfourobjects{#1}{#2}\endgroup} % \end{macrocode} % \end{macro} % % Four unpaired electron which are attached to a central atom (A) % are drawn by the following \verb/\tetraradical/ command, % where each of the top four argumets takes 0 (absence) or 1 (presence) for % representing the absence or presece of an unpaired electron. The larst argument % represents the central atom. % % \begin{verbatim} % \tetraradical{0 or 1}{0 or 1}{0 or 1}{0 or 1}{A} % \end{verbatim} % % \begin{verbatim} % 1 % . % 4 . A . 2 % . % 3 % \end{verbatim} % % \begin{macro}{\chemradical} % \begin{macro}{\tetraradical} % \begin{macrocode} \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% %\kern0pt \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.2em \kern0.12em \ifnum#3=0\relax \phantom{\hbox to\dimen1{\hss\chemradical\hss}}% \else \hbox to\dimen1{\hss\chemradical\hss}% \fi }}% %\kern0pt \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} % \end{macrocode} % \end{macro} % \end{macro} % % The command \verb/\tetraradical/ is converted into % the command \verb/\chemradicalA/, where four unpaired electrons are % specified by a set of numbers 1234, 234, etc. as an optional % argument. The main argument specifies a central atom. % % \begin{verbatim} % \chemradicalA[1234, etc.]{A} % \end{verbatim} % % \begin{verbatim} % 1 % . % 4 . A . 2 % . % 3 % \end{verbatim} % % \begin{macro}{\chemradicalA} % \begin{macrocode} \def\chemradicalA{\@ifnextchar[{\chemr@dicalA}{\chemr@dicalA[1234]}} \def\chemr@dicalA[#1]#2{\leavevmode \begingroup\let\TEMP@Command=\tetraradical% \fromfourobjects{#1}{#2}\endgroup} % \end{macrocode} % \end{macro} % % Four lone pairs which are attached to a central atom (A) in another mode % are drawn by the following \verb/\lonepairBitoiv/ command, % where each of the top four argumets takes 0 (absence) or 1 (presence) for % representing the absence or presece of a lone pair. The larst argument % represents the central atom. % % \begin{verbatim} % \lonepairBitoiv{0 or 1}{0 or 1}{0 or 1}{0 or 1}{A} % \end{verbatim} % % \begin{verbatim} % 4 1 % : : % A % : : % 3 2 % \end{verbatim} % % \begin{macro}{\lonepairBitoiv} % \begin{macrocode} \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} % \end{macrocode} % \end{macro} % % The command \verb/\lonepairBitoiv/ is converted into % the command \verb/\lonepairB/, where four lone pairs are % specified by a set of numbers 1234, 234, etc as an optional % argument. The main argument specifies a central atom. % % \begin{verbatim} % \lonepairB[1234, etc.]{A} % \end{verbatim} % % \begin{verbatim} % 4 1 % : : % A % : : % 3 2 % \end{verbatim} % % \begin{macro}{\lonepairB} % \begin{macrocode} \def\lonepairB{\@ifnextchar[{\l@nepairB}{\l@nepairB[1234]}} \def\l@nepairB[#1]#2{\leavevmode% \begingroup\let\TEMP@Command=\lonepairBitoiv% \fromfourobjects{#1}{#2}\endgroup} % \end{macrocode} % \end{macro} % % Four unpaired electron which are attached to a central atom (A) in an alternative mode % are drawn by the following \verb/\tetraradicalB/ command, % where each of the top four argumets takes 0 (absence) or 1 (presence) for % representing the absence or presece of an unpaired electron. The larst argument % represents the central atom. % % \begin{verbatim} % \tetraradicalB{0 or 1}{0 or 1}{0 or 1}{0 or 1}{A} % \end{verbatim} % % \begin{verbatim} % 4 1 % . . % A % . . % 3 2 % \end{verbatim} % % \begin{macro}{\tetraradicalB} % \begin{macrocode} \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} % \end{macrocode} % \end{macro} % % The command \verb/\tetraradicalB/ is converted into % the command \verb/\chemradicalB/, where four unpaired electrons are % specified by a set of numbers 1234, 234, etc. as an optional % argument. The main argument specifies a central atom. % % \begin{verbatim} % \chemradicalB[1234, etc.]{A} % \end{verbatim} % % \begin{verbatim} % 4 1 % . . % A % . . % 3 2 % \end{verbatim} % % \begin{macro}{\chemradicalA} % \begin{macrocode} \def\chemradicalB{\@ifnextchar[{\chemr@dicalB}{\chemr@dicalB[1234]}} \def\chemr@dicalB[#1]#2{\leavevmode \begingroup\let\TEMP@Command=\tetraradicalB% \fromfourobjects{#1}{#2}\endgroup} % \end{macrocode} % \end{macro} % % \section{Macros for Nested Structures} % % The macro \verb/\LewisTetrahedralA/ is defined as an extension of % \verb/\LewistetrahedralA/, where it supports a nestec structures. % As a basic function of \verb/\LewisTetrahedralA/, % atoms (W, X, Y, and Z) which are attached to a central atom (A) % through Lewis bonds are drawn by the following \verb/\LewisTetrahedralA/ command. % % \begin{verbatim} % \LewisTetrahedralA{0==A;1==W;2==X;3==Y;4==Z} % \end{verbatim} % % \begin{verbatim} % 1 % W % : % 4 Z : A : X 2 % : % Y % 3 % \end{verbatim} % % Each of the atoms can be omitted. The argument of % of the macro \verb/\LewisTetrahedralA/ can accommodate a so-called (yl)-function, % which can draw a nested structure. % % \begin{macro}{\LewisTetrahedralA} % This macro is based on the definition of the macro \verb/\tetrahedral/ % defined in the \textsf{aliphat} package. % \begin{macrocode} \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 % \end{macrocode} % \end{macro} % % Note that the innermacros \verb/\Northbond/ etc.\ used in the definition of \verb/\tetrahedral/ % are replaced by \verb/\Northlonepair/ etc. % % \begin{macro}{\Northlonepair} % \begin{macrocode} \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% } % \end{macrocode} % \end{macro} % % \begin{macro}{\Southlonepair} % \begin{macrocode} \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% } % \end{macrocode} % \end{macro} % % \begin{macro}{\Eastlonepair} % \begin{macrocode} \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% } % \end{macrocode} % \end{macro} % % \begin{macro}{\Westlonepair} % \begin{macrocode} \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% } % \end{macrocode} % \end{macro} % % The macro \verb/\LewisTetrahedralA/ supports a (yl)-function, which % is based on the x,y-adjustment due to the \verb/\ylLewisTetrahedralAposition/, % which is defined in a similar way to \verb/\yltetrahedralposition/ used in % the definition of the macro \verb/\tetrahedral/. The original values are % left as commented lines in order to compare with the \textsf{aliphat} package % of the \XyMTeX{} system. % % \begin{macro}{\ylLewisTetrahedralAposition} % \begin{macrocode} \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{0}\gdef\@yli{-52}\global\@ylswtrue%N subst. on 1 \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{52}\gdef\@yli{0}\global\@ylswtrue% \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{0}\gdef\@yli{52}\global\@ylswtrue%S subst. on 1 \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{-52}\gdef\@yli{0}\global\@ylswtrue% \gdef\@ylii{-40}\gdef\@yli{32}\global\@ylswtrue% \fi% \West@bondtrue%E subst. on 1 \fi%end of ifcase \fi\fi\fi}}% % \end{macrocode} % \end{macro} % % The macro \verb/\LewisTetrahedralB/ is defined as an extension of % \verb/\LewistetrahedralB/, where it supports a nestec structures. % As a basic function of \verb/\LewisTetrahedralB/, % atoms (W, X, Y, and Z) which are attached to a central atom (A) % through Lewis bonds are drawn by the following \verb/\LewisTetrahedralB/ command. % % \begin{verbatim} % \LewisteTrahedralB{0==A;1==W;2==X;3==Y;4==Z} % \end{verbatim} % % \begin{verbatim} % % 4 Z W 1 % : : % A % : : % 3 Y X 2 % % \end{verbatim} % % Each of the atoms can be omitted. % % \begin{macro}{\LewisTetrahedralB} % \begin{macrocode} \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 % \end{macrocode} % \end{macro} % % Note that the inner macros \verb/\NEbond/ etc.\ used in the definition of \verb/\squareplanar/ % are replaced by \verb/\NEbondlonepair/ etc. % % \begin{macro}{\NEbondlonepair} % \begin{macrocode} \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}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\SEbondlonepair} % \begin{macrocode} \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}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\SWbondlonepair} % \begin{macrocode} \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}% } % \end{macrocode} % \end{macro} % % % \begin{macro}{\NWbondlonepair} % \begin{macrocode} \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}% } % \end{macrocode} % \end{macro} % % The macro \verb/\LewisTetrahedralB/ supports a (yl)-function, which % is based on the x,y-adjustment due to the \verb/\ylLewisTetrahedralBposition/, % which is defined in a similar way to \verb/\ylsquareposition/ used in % the definition of the macro \verb/\squaraplanar/ (renamed from \verb/\square/). % The original values are left as commented lines in order to compare % with the \textsf{aliphat} package of the \XyMTeX{} system. % % \begin{macro}{\ylLewisTetrahedralBposition} % \begin{macrocode} \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{-40}\gdef\@yli{-47}\global\@ylswtrue% NE subst. on 1 \gdef\@ylii{-28}\gdef\@yli{40}\global\@ylswtrue% NE subst. on 1 \or%2 % \gdef\@ylii{-40}\gdef\@yli{47}\global\@ylswtrue% SE subst. on 2 \gdef\@ylii{-28}\gdef\@yli{35}\global\@ylswtrue% SE subst. on 2 \or%3 % \gdef\@ylii{50}\gdef\@yli{47}\global\@ylswtrue% SW subst. on 3 \gdef\@ylii{35}\gdef\@yli{22}\global\@ylswtrue% SW subst. on 3 \or%4 % \gdef\@ylii{50}\gdef\@yli{-47}\global\@ylswtrue% NW subst. on 4 \gdef\@ylii{35}\gdef\@yli{40}\global\@ylswtrue% NW subst. on 4 \fi%end of ifcase \fi\fi\fi}}% \endinput % % \end{macrocode} % \end{macro} % % \Finale % \endinput