Debian Codegraph @

texmf-dist/source/latex/xymtex/base/lewisstruc.dtx

raw
1 % \iffalse meta-comment
2 %% File: lewisstruc.dtx
3 %
4 % Copyright 2009, 2010, 2013 by Shinsaku Fujita
5 %
6 % This file is part of XyMTeX system.
7 % -------------------------------------
8 %
9 % This file (lewisstruc.sty) is a successor to:
10 %
11 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 % \typeout{XyMTeX for Drawing Chemical Structural Formulas. Version 1.00}
13 % \typeout{ -- Released December 1, 1993 by Shinsaku Fujita}
14 % Copyright (C) 1993 by Shinsaku Fujita, all rights reserved.
15 %
16 % This file is a part of the macro package ``XyMTeX'' which has been
17 % designed for typesetting chemical structural formulas.
18 %
19 % This file is to be contained in the ``xymtex'' directory which is
20 % an input directory for TeX. It is a LaTeX optional style file and
21 % should be used only within LaTeX, because several macros of the file
22 % are based on LaTeX commands.
23 %
24 % For the review of XyMTeX, see
25 % (1) Shinsaku Fujita, ``Typesetting structural formulas with the text
26 % formatter TeX/LaTeX'', Computers and Chemistry, in press.
27 % The following book deals with an application of TeX/LaTeX to
28 % preparation of manuscripts of chemical fields:
29 % (2) Shinsaku Fujita, ``LaTeX for Chemists and Biochemists''
30 % Tokyo Kagaku Dozin, Tokyo (1993) [in Japanese].
31 %
32 % This work may be distributed and/or modified under the
33 % conditions of the LaTeX Project Public License, either version 1.3
34 % of this license or (at your option) any later version.
35 % The latest version of this license is in
36 % http://www.latex-project.org/lppl.txt
37 % and version 1.3 or later is part of all distributions of LaTeX
38 % version 2005/12/01 or later.
39 %
40 % This work has the LPPL maintenance status `maintained'.
41 % The Current Maintainer of this work is Shinsaku Fujita.
42 %
43 % This work consists of the files lewisstruc.dtx and lewisstruc.ins
44 % and the derived file lewisstruc.sty.
45 %
46 % Please report any bugs, comments, suggestions, etc. to:
47 % Shinsaku Fujita,
48 % Shonan Institute of Chemoinformatics and Mathematical Chemistry
49 % Kaneko 479-7 Ooimachi, Ashigara-Kami-Gun, Kanagawa 250-0019 Japan
50 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 % \def\j@urnalname{lewisstruc}
52 % \def\versi@ndate{November 03, 2009}
53 % \def\versi@nno{ver1.00}
54 % \def\copyrighth@lder{SF}% Shinsaku Fujita
55 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 % \def\j@urnalname{lewisstruc}
57 % \def\versi@ndate{October 01, 2010}
58 % \def\versi@nno{ver5.00}
59 % \def\copyrighth@lder{SF} % Shinsaku Fujita
60 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 %
62 % \fi
63 %
64 % \CheckSum{1697}
65 %% \CharacterTable
66 %% {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
67 %% 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
68 %% Digits \0\1\2\3\4\5\6\7\8\9
69 %% Exclamation \! Double quote \" Hash (number) \#
70 %% Dollar \$ Percent \% Ampersand \&
71 %% Acute accent \' Left paren \( Right paren \)
72 %% Asterisk \* Plus \+ Comma \,
73 %% Minus \- Point \. Solidus \/
74 %% Colon \: Semicolon \; Less than \<
75 %% Equals \= Greater than \> Question mark \?
76 %% Commercial at \@ Left bracket \[ Backslash \\
77 %% Right bracket \] Circumflex \^ Underscore \_
78 %% Grave accent \` Left brace \{ Vertical bar \|
79 %% Right brace \} Tilde \~}
80 %
81 % \setcounter{StandardModuleDepth}{1}
82 %
83 % \StopEventually{}
84 % \MakeShortVerb{\|}
85 %
86 % \iffalse
87 % \changes{v1.00}{2009/11/03}{first edition for LaTeX2e}
88 % \changes{v5.00}{2010/10/01}{the LaTeX Project Public License}
89 % \changes{v5.01}{2013/08/02}{bug fix}
90 % \fi
91 %
92 % \iffalse
93 %<*driver>
94 \NeedsTeXFormat{pLaTeX2e}
95 % \fi
96 \ProvidesFile{lewisstruc.dtx}[2013/08/02 v5.01 lewisstruc package file]
97 % \iffalse
98 \documentclass{ltxdoc}
99 \GetFileInfo{lewisstruc.dtx}
100 %
101 % %%XyMTeX Logo: Definition 2%%%
102 \def\UPSILON{\char'7}
103 \def\XyM{X\kern-.30em\smash{%
104 \raise.50ex\hbox{\UPSILON}}\kern-.30em{M}}
105 \def\XyMTeX{\XyM\kern-.1em\TeX}
106 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107 \title{Lewis Structures by {\sffamily lewisstruc.sty}
108 (\fileversion) of \XyMTeX{}}
109 \author{Shinsaku Fujita \\
110 Shonan Institute of Chemoinformatics and
111 Mathematical Chemistry \\
112 Kanagawa, 258-0019 Japan
113 }
114 \date{\filedate}
115 %
116 \begin{document}
117 \maketitle
118 \DocInput{lewisstruc.dtx}
119 \end{document}
120 %</driver>
121 % \fi
122 %
123 % \section{Introduction}\label{lewisstruc:intro}
124 %
125 % \subsection{Options for {\sffamily docstrip}}
126 %
127 % \DeleteShortVerb{\|}
128 % \begin{center}
129 % \begin{tabular}{|l|l|}
130 % \hline
131 % \emph{option} & \emph{function}\\ \hline
132 % lewisstruc & lewisstruc.sty \\
133 % driver & driver for this dtx file \\
134 % \hline
135 % \end{tabular}
136 % \end{center}
137 % \MakeShortVerb{\|}
138 %
139 % \subsection{Version Information}
140 %
141 % \begin{macrocode}
142 %<*lewisstruc>
143 \typeout{Part of XyMTeX for Drawing Chemical Structural Formulas. Version 5.01}
144 \typeout{ -- Released August 02, 2013 by Shinsaku Fujita}
145 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
146 \def\j@urnalname{lewisstruc}
147 \def\versi@ndate{August 02, 2013}
148 \def\versi@nno{ver5.01}
149 \def\copyrighth@lder{SF} % Shinsaku Fujita
150 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
151 \typeout{XyMTeX Macro File `\j@urnalname' (\versi@nno) <\versi@ndate>%
152 \space[\copyrighth@lder]}
153 % \end{macrocode}
154 %
155 % The definition of the macro \verb/\LewisTetrahedralA/ uses the command
156 % \verb/\tetrahedral/ defined in the \textsf{aliphat} package of
157 % the \XyMTeX{} system.
158 %
159 % \begin{macrocode}
160 \RequirePackage{aliphat}
161 %\@ifundefined{tetrahedral}{\input aliphat.sty\relax}{}
162 % \end{macrocode}
163 %
164 % \section{Basic Macros}
165 % \subsection{Lone Pairs}
166 %
167 % \begin{macro}{\dotnodimension}
168 % A basic command \verb/\dotnodimension/ is used to draw a dot (an electron).
169 % \begin{macrocode}
170 \def\dotnodimension{\smash{\hbox to0pt{\hss.\hss}}}
171 % \end{macrocode}
172 % \end{macro}
173 %
174 % \begin{macro}{\verticalpair}
175 % The command \verb/\verticalpair/ is used to draw a vertical lone pair.
176 % \begin{macro}{\horizontalpair}
177 % The command \verb/\horizontalpair/ is used to draw a vertical lone pair.
178 % \begin{macrocode}
179 \def\verticalpair{\vbox{%
180 \dotnodimension
181 \nointerlineskip
182 \kern0.3em
183 \dotnodimension}}
184 \def\horizontalpair{%
185 \hbox{\dotnodimension\kern0.3em\dotnodimension}}
186 % \end{macrocode}
187 % \end{macro}
188 % \end{macro}
189 %
190 % \begin{macro}{\nwlonepair}
191 % The command \verb/\nwlonepair/ is used to draw a lone pair located at
192 % the northwest position.
193 % \begin{macro}{\selonepair}
194 % The command \verb/\selonepair/ is used to draw a lone pair at
195 % the southest posistion.
196 % \begin{macro}{\swlonepair}
197 % The command \verb/\swlonepair/ is used to draw a lone pair at
198 % the southwest position.
199 % \begin{macro}{\nelonepair}
200 % The command \verb/\nelonepair/ is used to draw a lone pair at
201 % the northeast position.
202 % \begin{macrocode}
203 \def\nwlonepair{%
204 \vtop{\hbox to0.21em{\hss\dotnodimension}%
205 \nointerlineskip
206 \kern0.21em
207 \hbox to0.21em{\dotnodimension\hss}%
208 }}
209 \def\selonepair{%
210 \vbox{\hbox to0.21em{\hss\dotnodimension}%
211 \nointerlineskip
212 \kern0.21em
213 \hbox to0.21em{\dotnodimension\hss}%
214 }}
215 \def\swlonepair{%
216 \vbox{\hbox to0.21em{\dotnodimension\hss}%
217 \nointerlineskip
218 \kern0.21em
219 \hbox to0.21em{\hss\dotnodimension}%
220 }}
221 \def\nelonepair{%
222 \vtop{\hbox to0.21em{\dotnodimension\hss}%
223 \nointerlineskip
224 \kern0.21em
225 \hbox to0.21em{\hss\dotnodimension}%
226 }}
227 % \end{macrocode}
228 % \end{macro}
229 % \end{macro}
230 % \end{macro}
231 % \end{macro}
232 %
233 % \begin{macro}{\LewisSbond}
234 % The command \verb/\LewisSbond/ is used to draw a vertical lone pair
235 % used in a horizontal position. For example, \verb/H\LewisSbond H/
236 % outputs H:H for representing a hydrogen molecule.
237 % \begin{macrocode}
238 \def\LewisSbond{\raise0.12em\hbox to0.25em{\hss\verticalpair\hss}}
239 % \end{macrocode}
240 % \end{macro}
241 %
242 % \begin{macro}{\overpair}
243 % The command \verb/\overpair/ is used to draw a horizontal lone pair
244 % at the head of an atom specified by its argument.
245 % \begin{macro}{\underpair}
246 % The command \verb/\underpair/ is used to draw a horizontal lone pair
247 % under an atom specified by its argument.
248 % \begin{macrocode}
249 \def\overpair#1{\leavevmode\setbox0=\hbox{#1}%
250 \vbox{\hbox to\wd0{\hss\horizontalpair\hss}%
251 \nointerlineskip\kern0.08em
252 \box0}}
253 \def\underpair#1{\leavevmode\setbox0=\hbox{#1}%
254 \dimen0=\wd0
255 \vbox to\ht0{\box0
256 \nointerlineskip
257 \hbox{\vbox to0pt{\kern0.2em
258 \hbox to\dimen0{\hss\horizontalpair\hss}\vss}}%
259 \vss}}%bug fix 2013/08/02 \vss added
260 % \end{macrocode}
261 % \end{macro}
262 % \end{macro}
263 %
264 % \subsection{Atoms Linked by a Lewis Bond}
265 %
266 % An atom (\verb/OverAtom/) which is attached to the top of an atom (\verb/BaseAtom/)
267 % through a Lewis bond is drawn by the following \verb/\overpairover/ command.
268 %
269 % \begin{verbatim}
270 % \overpairover{BaseAtom}{OverAtom}
271 % \end{verbatim}
272 %
273 % \begin{macro}{\overpairover}
274 % \begin{macrocode}
275 \def\overpairover#1#2{\leavevmode\setbox0=\hbox{#1}%
276 \edef\temp@@a{#2}%
277 \dimen0=\wd0%
278 \ifx\temp@@a\empty\box0\else%
279 \vbox{%
280 \hbox to\dimen0{\hss#2\hss}%
281 \nointerlineskip\kern0.2em
282 \hbox to\dimen0{\hss\horizontalpair\hss}%
283 \nointerlineskip\kern0.08em
284 \hbox{\box0}}\fi}
285 % \end{macrocode}
286 % \end{macro}
287 %
288 % An atom (\verb/UnderAtom/) which is attached to the bottom of an atom (\verb/BaseAtom/)
289 % through a Lewis bond is drawn by the following \verb/\overpairover/ command.
290 %
291 % \begin{verbatim}
292 % \underpairunder{BaseAtom}{UnderAtom}
293 % \end{verbatim}
294 %
295 % \begin{macro}{\underpairunder}
296 % \begin{macrocode}
297 \def\underpairunder#1#2{\leavevmode\setbox0=\hbox{#1}%
298 \edef\temp@@a{#2}%
299 \dimen0=\wd0\dimen1=\ht0
300 \ifx\temp@@a\empty\box0\else%
301 \vbox to\dimen1{\hbox{\box0}%
302 \nointerlineskip
303 \hbox{\vbox to0pt{\kern0.18em
304 \hbox to\dimen0{\hss\horizontalpair\hss}%
305 \nointerlineskip\kern0.08em
306 \hbox to\dimen0{\hss#2\hss}%
307 \vss}}%
308 \vss}\fi}%bug fix2013/08/02
309 % \end{macrocode}
310 % \end{macro}
311 %
312 %
313 % An atom (\verb/NWAtom/) which is attached to the northwest of an atom (\verb/BaseAtom/)
314 % through a Lewis bond is drawn by the following \verb/\leftlonepairover/ command.
315 %
316 % \begin{verbatim}
317 % \leftlonepairover{BaseAtom}{NWAtom}
318 % \end{verbatim}
319 %
320 % \begin{macro}{\leftlonepairover}
321 % \begin{macrocode}
322 \def\leftlonepairover#1#2{\leavevmode%
323 \edef\temp@@{#2}%
324 \ifx\temp@@\empty#1\else
325 \hbox to0pt{\hss\raise0.9em\hbox{#2}\kern-0.05em\raise0.8em\hbox{\nwlonepair}\kern-0.1em}#1\fi}
326 % \end{macrocode}
327 % \end{macro}
328 %
329 % An atom (\verb/NEAtom/) which is attached to the northeast of an atom (\verb/BaseAtom/)
330 % through a Lewis bond is drawn by the following \verb/\rightlonepairover/ command.
331 %
332 % \begin{verbatim}
333 % \rightlonepairover{BaseAtom}{NEAtom}
334 % \end{verbatim}
335 %
336 % \begin{macro}{\rightlonepairover}
337 % \begin{macrocode}
338 \def\rightlonepairover#1#2{\leavevmode%
339 #1%
340 \edef\temp@@{#2}%
341 \ifx\temp@@\empty\else
342 \hbox to0pt{\kern-0.1em\raise0.8em\hbox{\nelonepair}\kern-0.05em%
343 \raise0.9em\hbox{#2}\hss}\fi}
344 % \end{macrocode}
345 % \end{macro}
346 %
347 % An atom (\verb/SWAtom/) which is attached to the southwest of an atom (\verb/BaseAtom/)
348 % through a Lewis bond is drawn by the following \verb/\leftlonepairunder/ command.
349 %
350 % \begin{verbatim}
351 % \leftlonepairunder{BaseAtom}{NEAtom}
352 % \end{verbatim}
353 %
354 % \begin{macro}{\leftlonepairunder}
355 % \begin{macrocode}
356 \def\leftlonepairunder#1#2{\leavevmode%
357 \edef\temp@@{#2}%
358 \ifx\temp@@\empty#1\else
359 \hbox to0pt{\hss\lower0.9em\hbox{#2}\kern-0.05em%
360 \lower0.2em\hbox{\swlonepair}\kern-0.1em}#1\fi}
361 % \end{macrocode}
362 % \end{macro}
363 %
364 % An atom (\verb/SEAtom/) which is attached to the southeast of an atom (\verb/BaseAtom/)
365 % through a Lewis bond is drawn by the following \verb/\rightlonepairunder/ command.
366 %
367 % \begin{verbatim}
368 % \rightlonepairunder{BaseAtom}{SEAtom}
369 % \end{verbatim}
370 %
371 % \begin{macro}{\rightlonepairunder}
372 % \begin{macrocode}
373 \def\rightlonepairunder#1#2{\leavevmode%
374 #1%
375 \edef\temp@@{#2}%
376 \ifx\temp@@\empty\else
377 \hbox to0pt{\kern-0.1em\lower0.2em\hbox{\selonepair}\kern-0.05em%
378 \lower0.9em\hbox{#2}\hss}\fi}
379 % \end{macrocode}
380 % \end{macro}
381 %
382 %
383 % Atoms (W, X, Y, and Z) which are attached to a central atom (A)
384 % through Lewis bonds are drawn by the following \verb/\LewistetrahedralA/ command.
385 %
386 % \begin{verbatim}
387 % \LewistetrahedralA{0==A;1==W;2==X;3==Y;4==Z}
388 % \end{verbatim}
389 %
390 % \begin{verbatim}
391 % 1
392 % W
393 % :
394 % 4 Z : A : X 2
395 % :
396 % Y
397 % 3
398 % \end{verbatim}
399 %
400 % Each of the atoms can be omitted.
401 %
402 % \begin{macro}{\LewistetrahedralA}
403 % \begin{macrocode}
404 \def\LewistetrahedralA#1{\begingroup%
405 \let\temp@a=\empty%
406 \let\temp@b=\empty%
407 \let\temp@c=\empty%
408 \let\temp@d=\empty%
409 \let\temp@e=\empty%
410 \@forsemicol\member:=#1\do{%
411 \ifx\member\empty\else
412 \expandafter\@m@mb@r\member;\relax%
413 \expandafter\threech@r\@membera{}{}%
414 \ifx\@memberb\@yl\else
415 \ifcase\@tmpa \edef\temp@a{\@memberb}%central atom
416 \or\edef\temp@b{\@memberb}%
417 \or\edef\temp@c{\@memberb}%
418 \or\edef\temp@d{\@memberb}%
419 \or\edef\temp@e{\@memberb}%
420 \fi%end of ifcase
421 \fi\fi
422 }%
423 \leavevmode%
424 \ifx\temp@e\empty
425 \ifx\temp@c\empty
426 \underpairunder{\overpairover{\temp@a}{\temp@b}}{\temp@d}%
427 \else%c not empty
428 \underpairunder{\overpairover{\temp@a}{\temp@b}}{\temp@d}%
429 \LewisSbond\temp@c
430 \fi
431 \else%e not empty
432 \ifx\temp@c\empty
433 \temp@e\LewisSbond\underpairunder{\overpairover{\temp@a}{\temp@b}}{\temp@d}%
434 \else
435 \temp@e\LewisSbond\underpairunder{\overpairover{\temp@a}{\temp@b}}{\temp@d}%
436 \LewisSbond\temp@c
437 \fi\fi
438 \endgroup
439 }
440 % \end{macrocode}
441 % \end{macro}
442 %
443 % Atoms (W, X, Y, and Z) which are attached to a central atom (A)
444 % through Lewis bonds are drawn by the following \verb/\LewistetrahedralB/ command.
445 %
446 % \begin{verbatim}
447 % \LewistetrahedralB{0==A;1==W;2==X;3==Y;4==Z}
448 % \end{verbatim}
449 %
450 % \begin{verbatim}
451 %
452 % 4 Z W 1
453 % : :
454 % A
455 % : :
456 % 3 Y X 2
457 %
458 % \end{verbatim}
459 %
460 % Each of the atoms can be omitted.
461 %
462 % \begin{macro}{\LewistetrahedralB}
463 % \begin{macrocode}
464 \def\LewistetrahedralB#1{\begingroup%
465 \let\temp@a=\empty%
466 \let\temp@b=\empty%
467 \let\temp@c=\empty%
468 \let\temp@d=\empty%
469 \let\temp@e=\empty%
470 \@forsemicol\member:=#1\do{%
471 \ifx\member\empty\else
472 \expandafter\@m@mb@r\member;\relax%
473 \expandafter\threech@r\@membera{}{}%
474 \ifx\@memberb\@yl\else
475 \ifcase\@tmpa \edef\temp@a{\@memberb}%central atom
476 \or\edef\temp@b{\@memberb}%
477 \or\edef\temp@c{\@memberb}%
478 \or\edef\temp@d{\@memberb}%
479 \or\edef\temp@e{\@memberb}%
480 \fi%end of ifcase
481 \fi\fi
482 }%
483 \leavevmode%
484 \rightlonepairover{%
485 \leftlonepairover{\leftlonepairunder{%
486 \rightlonepairunder{\temp@a}{\temp@c}}{\temp@d}}{\temp@e}}{\temp@b}%
487 \endgroup}
488 % \end{macrocode}
489 % \end{macro}
490 %
491 % \subsection{Lone Pairs around an Atom}
492 %
493 % Four lone pairs which are attached to a central atom (A)
494 % are drawn by the following \verb/\lonepairAitoiv/ command,
495 % where each of the top four argumets takes 0 (absence) or 1 (presence) for
496 % representing the absence or presece of a lone pair. The larst argument
497 % represents the central atom.
498 %
499 % \begin{verbatim}
500 % \lonepairAitoiv{0 or 1}{0 or 1}{0 or 1}{0 or 1}{A}
501 % \end{verbatim}
502 %
503 % \begin{verbatim}
504 % 1
505 % :
506 % 4 : A : 2
507 % :
508 % 3
509 % \end{verbatim}
510 %
511 % \begin{macro}{\lonepairAitoiv}
512 % \begin{macrocode}
513 \def\lonepairAitoiv#1#2#3#4#5{\leavevmode
514 \begingroup\setbox0=\hbox{#5}%
515 \dimen0=\ht0
516 \dimen1=1.22\wd0%
517 \setbox1=\hbox to\wd0{\hss%
518 \smash{%\raise0.01em
519 \hbox to\wd0{\hss%
520 \ifnum#4=0\relax
521 \phantom{\lower0.05em\hbox to0pt{\hss\vbox to\dimen0{\vss\verticalpair\vss}}}%
522 \else
523 \lower0.05em\hbox to0pt{\hss\vbox to\dimen0{\vss\verticalpair\vss}}%
524 \fi%
525 \lower0.2em\hbox{\vbox{\ifnum#1=0\relax
526 \phantom{\hbox to\dimen1{\hss\horizontalpair\hss}}%
527 \else
528 \hbox to\dimen1{\hss\horizontalpair\hss}\fi%
529 \nointerlineskip
530 \kern0.08em
531 \hbox to\dimen1{\hss#5\hss}%
532 \nointerlineskip
533 \kern0.2em
534 \ifnum#3=0\relax
535 \phantom{\hbox to\dimen1{\hss\horizontalpair\hss}}%
536 \else
537 \hbox to\dimen1{\hss\horizontalpair\hss}%
538 \fi
539 }}%
540 \ifnum#2=0\relax
541 \phantom{\lower0.05em\hbox to0pt{\vbox to\dimen0{\vss\verticalpair\vss}\hss}}%
542 \else
543 \lower0.05em\hbox to0pt{\vbox to\dimen0{\vss\verticalpair\vss}\hss}\fi%
544 \hss}}\hss}%
545 \wd1=\wd0 \ht1=\ht0\box1\endgroup}
546 % \end{macrocode}
547 % \end{macro}
548 %
549 % A common code for transforming a command to another command is
550 % defined as the command \verb/\fromfourobjects/
551 %
552 % \begin{macro}{\fromfourobjects}
553 % \begin{macrocode}
554 \def\fromfourobjects#1#2{%
555 \ifnum#1=1234\relax
556 \TEMP@Command{1}{1}{1}{1}{#2}%
557 \else\ifnum#1=123\relax
558 \TEMP@Command{1}{1}{1}{0}{#2}%
559 \else\ifnum#1=124\relax
560 \TEMP@Command{1}{1}{0}{1}{#2}%
561 \else\ifnum#1=134\relax
562 \TEMP@Command{1}{0}{1}{1}{#2}%
563 \else\ifnum#1=234\relax
564 \TEMP@Command{0}{1}{1}{1}{#2}%
565 \else\ifnum#1=12\relax
566 \TEMP@Command{1}{1}{0}{0}{#2}%
567 \else\ifnum#1=13\relax
568 \TEMP@Command{1}{0}{1}{0}{#2}%
569 \else\ifnum#1=14\relax
570 \TEMP@Command{1}{0}{0}{1}{#2}%
571 \else\ifnum#1=23\relax
572 \TEMP@Command{0}{1}{1}{0}{#2}%
573 \else\ifnum#1=24\relax
574 \TEMP@Command{0}{1}{0}{1}{#2}%
575 \else\ifnum#1=34\relax
576 \TEMP@Command{0}{0}{1}{1}{#2}%
577 \else\ifnum#1=1\relax
578 \TEMP@Command{1}{0}{0}{0}{#2}%
579 \else\ifnum#1=2\relax
580 \TEMP@Command{0}{1}{0}{0}{#2}%
581 \else\ifnum#1=3\relax
582 \TEMP@Command{0}{0}{1}{0}{#2}%
583 \else\ifnum#1=4\relax
584 \TEMP@Command{0}{0}{0}{1}{#2}%
585 \else
586 \TEMP@Command{1}{1}{1}{1}{#2}%
587 \fi\fi\fi\fi\fi
588 \fi\fi\fi\fi\fi
589 \fi\fi\fi\fi\fi}
590 % \end{macrocode}
591 % \end{macro}
592 %
593 % The command \verb/\lonepairAitoiv/ is converted into
594 % the command \verb/\lonepairA/, where four lone pairs are
595 % specified by a set of numbers 1234, 234, etc as an optional
596 % argument. The main argument specifies a central atom.
597 %
598 % \begin{verbatim}
599 % \lonepairA[1234, etc.]{A}
600 % \end{verbatim}
601 %
602 % \begin{verbatim}
603 % 1
604 % :
605 % 4 : A : 2
606 % :
607 % 3
608 % \end{verbatim}
609 %
610 % \begin{macro}{\lonepairA}
611 % \begin{macrocode}
612 \def\lonepairA{\@ifnextchar[{\l@nepairA}{\l@nepairA[1234]}}
613 \def\l@nepairA[#1]#2{\leavevmode%
614 \begingroup\let\TEMP@Command=\lonepairAitoiv%
615 \fromfourobjects{#1}{#2}\endgroup}
616 % \end{macrocode}
617 % \end{macro}
618 %
619 % Four unpaired electron which are attached to a central atom (A)
620 % are drawn by the following \verb/\tetraradical/ command,
621 % where each of the top four argumets takes 0 (absence) or 1 (presence) for
622 % representing the absence or presece of an unpaired electron. The larst argument
623 % represents the central atom.
624 %
625 % \begin{verbatim}
626 % \tetraradical{0 or 1}{0 or 1}{0 or 1}{0 or 1}{A}
627 % \end{verbatim}
628 %
629 % \begin{verbatim}
630 % 1
631 % .
632 % 4 . A . 2
633 % .
634 % 3
635 % \end{verbatim}
636 %
637 % \begin{macro}{\chemradical}
638 % \begin{macro}{\tetraradical}
639 % \begin{macrocode}
640 \def\chemradical{\hbox to0pt{\hss.\hss}}
641 \def\tetraradical#1#2#3#4#5{\leavevmode\setbox0=\hbox{#5}%
642 \dimen0=\ht0
643 \dimen1=1.22\wd0%
644 \setbox1=\hbox to\wd0{\hss%
645 \smash{%\raise0.01em
646 \hbox to\wd0{\hss%
647 \ifnum#4=0\relax
648 \phantom{\raise0.02em\hbox to0pt{\hss\vbox to\dimen0{\vss\chemradical\vss}}}%
649 \else
650 \raise0.02em\hbox to0pt{\hss\vbox to\dimen0{\vss\chemradical\vss}}%
651 \fi%
652 %\kern0pt
653 \lower0.22em\hbox{\vbox{%
654 \ifnum#1=0\relax
655 \phantom{\hbox to\dimen1{\hss\chemradical\hss}}%
656 \else
657 \hbox to\dimen1{\hss\chemradical\hss}\fi%
658 \nointerlineskip
659 \kern0.08em
660 \hbox to\dimen1{\hss#5\hss}%
661 \nointerlineskip
662 %\kern0.2em
663 \kern0.12em
664 \ifnum#3=0\relax
665 \phantom{\hbox to\dimen1{\hss\chemradical\hss}}%
666 \else
667 \hbox to\dimen1{\hss\chemradical\hss}%
668 \fi
669 }}%
670 %\kern0pt
671 \ifnum#2=0\relax
672 \phantom{\raise0.02em\hbox to0pt{\vbox to\dimen0{\vss\chemradical\vss}\hss}}%
673 \else
674 \raise0.02em\hbox to0pt{\vbox to\dimen0{\vss\chemradical\vss}\hss}\fi%
675 \hss}}\hss}%
676 \wd1=\wd0 \ht1=\ht0\box1}
677 % \end{macrocode}
678 % \end{macro}
679 % \end{macro}
680 %
681 % The command \verb/\tetraradical/ is converted into
682 % the command \verb/\chemradicalA/, where four unpaired electrons are
683 % specified by a set of numbers 1234, 234, etc. as an optional
684 % argument. The main argument specifies a central atom.
685 %
686 % \begin{verbatim}
687 % \chemradicalA[1234, etc.]{A}
688 % \end{verbatim}
689 %
690 % \begin{verbatim}
691 % 1
692 % .
693 % 4 . A . 2
694 % .
695 % 3
696 % \end{verbatim}
697 %
698 % \begin{macro}{\chemradicalA}
699 % \begin{macrocode}
700 \def\chemradicalA{\@ifnextchar[{\chemr@dicalA}{\chemr@dicalA[1234]}}
701 \def\chemr@dicalA[#1]#2{\leavevmode
702 \begingroup\let\TEMP@Command=\tetraradical%
703 \fromfourobjects{#1}{#2}\endgroup}
704 % \end{macrocode}
705 % \end{macro}
706 %
707 % Four lone pairs which are attached to a central atom (A) in another mode
708 % are drawn by the following \verb/\lonepairBitoiv/ command,
709 % where each of the top four argumets takes 0 (absence) or 1 (presence) for
710 % representing the absence or presece of a lone pair. The larst argument
711 % represents the central atom.
712 %
713 % \begin{verbatim}
714 % \lonepairBitoiv{0 or 1}{0 or 1}{0 or 1}{0 or 1}{A}
715 % \end{verbatim}
716 %
717 % \begin{verbatim}
718 % 4 1
719 % : :
720 % A
721 % : :
722 % 3 2
723 % \end{verbatim}
724 %
725 % \begin{macro}{\lonepairBitoiv}
726 % \begin{macrocode}
727 \def\lonepairBitoiv#1#2#3#4#5{\begingroup\setbox0=\hbox{#5}%
728 \dimen0=\ht0 \dimen1=1.22\wd0%
729 \setbox1=\hbox to\wd0{\hss%
730 \smash{\lower0.04em\hbox to0pt{%
731 \hss\vbox to\dimen0{\vss%
732 \ifnum#4=0\relax \phantom{\nwlonepair}\else
733 \nwlonepair\fi%
734 \nointerlineskip
735 \kern0.45em
736 \ifnum#3=0\relax \phantom{\swlonepair}\else
737 \swlonepair\fi
738 \vss}\kern-0.2em}%
739 \hbox to\dimen1{\hss#5\hss}%
740 \lower0.04em\hbox to0pt{\kern-0.22em%
741 \vbox to\dimen0{\vss%
742 \ifnum#1=0\relax \phantom{\nelonepair}\else
743 \nelonepair\fi%
744 \nointerlineskip
745 \kern0.45em
746 \ifnum#2=0\relax \phantom{\selonepair}\else
747 \selonepair\fi\vss}\hss}%
748 }\hss}%
749 \ht1=\ht0\box1\endgroup}
750 % \end{macrocode}
751 % \end{macro}
752 %
753 % The command \verb/\lonepairBitoiv/ is converted into
754 % the command \verb/\lonepairB/, where four lone pairs are
755 % specified by a set of numbers 1234, 234, etc as an optional
756 % argument. The main argument specifies a central atom.
757 %
758 % \begin{verbatim}
759 % \lonepairB[1234, etc.]{A}
760 % \end{verbatim}
761 %
762 % \begin{verbatim}
763 % 4 1
764 % : :
765 % A
766 % : :
767 % 3 2
768 % \end{verbatim}
769 %
770 % \begin{macro}{\lonepairB}
771 % \begin{macrocode}
772 \def\lonepairB{\@ifnextchar[{\l@nepairB}{\l@nepairB[1234]}}
773 \def\l@nepairB[#1]#2{\leavevmode%
774 \begingroup\let\TEMP@Command=\lonepairBitoiv%
775 \fromfourobjects{#1}{#2}\endgroup}
776 % \end{macrocode}
777 % \end{macro}
778 %
779 % Four unpaired electron which are attached to a central atom (A) in an alternative mode
780 % are drawn by the following \verb/\tetraradicalB/ command,
781 % where each of the top four argumets takes 0 (absence) or 1 (presence) for
782 % representing the absence or presece of an unpaired electron. The larst argument
783 % represents the central atom.
784 %
785 % \begin{verbatim}
786 % \tetraradicalB{0 or 1}{0 or 1}{0 or 1}{0 or 1}{A}
787 % \end{verbatim}
788 %
789 % \begin{verbatim}
790 % 4 1
791 % . .
792 % A
793 % . .
794 % 3 2
795 % \end{verbatim}
796 %
797 % \begin{macro}{\tetraradicalB}
798 % \begin{macrocode}
799 \def\tetraradicalB#1#2#3#4#5{\setbox0=\hbox{#5}%
800 \dimen0=\ht0 \dimen1=1.22\wd0%
801 \setbox1=\hbox to\wd0{\hss%
802 \smash{\lower0.009em\hbox to0pt{%
803 \hss\vbox to\dimen0{\vss%
804 \ifnum#4=0\relax \phantom{\chemradical}\else
805 \chemradical\fi%
806 \nointerlineskip
807 \kern0.7em
808 \ifnum#3=0\relax \phantom{\chemradical}\else
809 \chemradical\fi
810 \vss}\kern-0.05em}%
811 \hbox to\dimen1{\hss#5\hss}%
812 \lower0.009em\hbox to0pt{\kern-0.05em%
813 \vbox to\dimen0{\vss%
814 \ifnum#1=0\relax \phantom{\chemradical}\else
815 \chemradical\fi%
816 \nointerlineskip
817 \kern0.7em
818 \ifnum#2=0\relax \phantom{\chemradical}\else
819 \chemradical\fi\vss}\hss}%
820 }\hss}%
821 \ht1=\ht0\box1}
822 % \end{macrocode}
823 % \end{macro}
824 %
825 % The command \verb/\tetraradicalB/ is converted into
826 % the command \verb/\chemradicalB/, where four unpaired electrons are
827 % specified by a set of numbers 1234, 234, etc. as an optional
828 % argument. The main argument specifies a central atom.
829 %
830 % \begin{verbatim}
831 % \chemradicalB[1234, etc.]{A}
832 % \end{verbatim}
833 %
834 % \begin{verbatim}
835 % 4 1
836 % . .
837 % A
838 % . .
839 % 3 2
840 % \end{verbatim}
841 %
842 % \begin{macro}{\chemradicalA}
843 % \begin{macrocode}
844 \def\chemradicalB{\@ifnextchar[{\chemr@dicalB}{\chemr@dicalB[1234]}}
845 \def\chemr@dicalB[#1]#2{\leavevmode
846 \begingroup\let\TEMP@Command=\tetraradicalB%
847 \fromfourobjects{#1}{#2}\endgroup}
848 % \end{macrocode}
849 % \end{macro}
850 %
851 % \section{Macros for Nested Structures}
852 %
853 % The macro \verb/\LewisTetrahedralA/ is defined as an extension of
854 % \verb/\LewistetrahedralA/, where it supports a nestec structures.
855 % As a basic function of \verb/\LewisTetrahedralA/,
856 % atoms (W, X, Y, and Z) which are attached to a central atom (A)
857 % through Lewis bonds are drawn by the following \verb/\LewisTetrahedralA/ command.
858 %
859 % \begin{verbatim}
860 % \LewisTetrahedralA{0==A;1==W;2==X;3==Y;4==Z}
861 % \end{verbatim}
862 %
863 % \begin{verbatim}
864 % 1
865 % W
866 % :
867 % 4 Z : A : X 2
868 % :
869 % Y
870 % 3
871 % \end{verbatim}
872 %
873 % Each of the atoms can be omitted. The argument of
874 % of the macro \verb/\LewisTetrahedralA/ can accommodate a so-called (yl)-function,
875 % which can draw a nested structure.
876 %
877 % \begin{macro}{\LewisTetrahedralA}
878 % This macro is based on the definition of the macro \verb/\tetrahedral/
879 % defined in the \textsf{aliphat} package.
880 % \begin{macrocode}
881 \def\LewisTetrahedralA{%
882 \@ifnextchar[{\@LewisTetrahedralA[r}{\@LewisTetrahedralA[r]}}
883 \def\@LewisTetrahedralA#1]#2{%
884 \@ifnextchar<{\@@LewisTetrahedralA#1]{#2}}{\@@LewisTetrahedralA#1]{#2}<,,,>}}
885 \def\@@LewisTetrahedralA#1]#2<#3,#4,#5,#6>{%
886 \begingroup
887 \let\Northbond=\Northlonepair
888 \let\Southbond=\Southlonepair
889 \let\Eastbond=\Eastlonepair
890 \let\Westbond=\Westlonepair
891 \let\yltetrahedralposition=\ylLewisTetrahedralAposition
892 \@@tetrahedral#1]#2<#3,#4,#5,#6>%
893 \endgroup
894 \West@bondfalse
895 \East@bondfalse
896 }%end of macro LewisTetrahedralA
897 % \end{macrocode}
898 % \end{macro}
899 %
900 % Note that the innermacros \verb/\Northbond/ etc.\ used in the definition of \verb/\tetrahedral/
901 % are replaced by \verb/\Northlonepair/ etc.
902 %
903 % \begin{macro}{\Northlonepair}
904 % \begin{macrocode}
905 \def\Northlonepair{%
906 \@ifnextchar[{\N@rthlonepair}{\N@rthlonepair[]}}
907 \def\N@rthlonepair[#1]{%
908 \if\@tmpb D\relax%
909 \put(0,60){\hbox to0pt{\hss\horizontalpair\hss}}%
910 \put(0,90){\hbox to0pt{\hss\horizontalpair\hss}}%
911 \putlratom{-40}{120}{\@memberb}%==1 upper substituent
912 \else\if\@tmpb T\relax%
913 \put(0,60){\hbox to0pt{\hss\horizontalpair\hss}}%
914 \put(0,90){\hbox to0pt{\hss\horizontalpair\hss}}%
915 \put(0,120){\hbox to0pt{\hss\horizontalpair\hss}}%
916 \putlratom{-40}{150}{\@memberb}%==1 upper substituent
917 \else\if\@tmpb N\relax%normal single bond
918 \Put@Line(0,52)(0,1){110}%
919 \putlratom{-40}{171}{\@memberb}%==1 upper substituent
920 \else
921 \put(0,60){\hbox to0pt{\hss\horizontalpair\hss}}%
922 \putlratom{-40}{90}{\@memberb}%==1 upper substituent
923 \fi\fi\fi%
924 }
925 % \end{macrocode}
926 % \end{macro}
927 %
928 % \begin{macro}{\Southlonepair}
929 % \begin{macrocode}
930 \def\Southlonepair{%
931 \@ifnextchar[{\S@uthlonepair}{\S@uthlonepair[]}}
932 \def\S@uthlonepair[#1]{%
933 \if\@tmpb D\relax%
934 \put(0,-60){\hbox to0pt{\hss\horizontalpair\hss}}%
935 \put(0,-90){\hbox to0pt{\hss\horizontalpair\hss}}%
936 \putlratom{-40}{-180}{\@memberb}%==3 down substituent
937 \else\if\@tmpb T\relax%
938 \put(0,-60){\hbox to0pt{\hss\horizontalpair\hss}}%
939 \put(0,-90){\hbox to0pt{\hss\horizontalpair\hss}}%
940 \put(0,-120){\hbox to0pt{\hss\horizontalpair\hss}}%
941 \putlratom{-40}{-210}{\@memberb}%==3 down substituent
942 \else\if\@tmpb N\relax%normal single bond
943 \Put@Line(0,-48)(0,-1){110}%
944 \putlratom{-40}{-250}{\@memberb}%==1 upper substituent
945 \else
946 \put(0,-60){\hbox to0pt{\hss\horizontalpair\hss}}%
947 \putlratom{-40}{-150}{\@memberb}%==3 down substituent
948 \fi\fi\fi%
949 }
950 % \end{macrocode}
951 % \end{macro}
952 %
953 % \begin{macro}{\Eastlonepair}
954 % \begin{macrocode}
955 \def\Eastlonepair{%
956 \@ifnextchar[{\E@stlonepair}{\E@stlonepair[]}}
957 \def\E@stlonepair[#1]{%
958 \if\@tmpb D\relax%
959 \put(60,-18){\hbox to0pt{\hss\verticalpair\hss}}%
960 \put(90,-18){\hbox to0pt{\hss\verticalpair\hss}}%
961 \putratom{120}{-33}{\@memberb}%==3 down substituent
962 \else\if\@tmpb T\relax%
963 \put(60,-18){\hbox to0pt{\hss\verticalpair\hss}}%
964 \put(90,-18){\hbox to0pt{\hss\verticalpair\hss}}%
965 \put(120,-18){\hbox to0pt{\hss\verticalpair\hss}}%
966 \putratom{150}{-33}{\@memberb}%==3 down substituent
967 \else\if\@tmpb N\relax%normal single bond
968 \Put@Line(50,0)(1,0){140}%
969 \putratom{190}{-33}{\@memberb}%==1 upper substituent
970 \else
971 \put(60,-18){\hbox to0pt{\hss\verticalpair\hss}}%
972 \putratom{90}{-33}{\@memberb}%==3 down substituent
973 \fi\fi\fi%
974 }
975 % \end{macrocode}
976 % \end{macro}
977 %
978 % \begin{macro}{\Westlonepair}
979 % \begin{macrocode}
980 \def\Westlonepair{%
981 \@ifnextchar[{\W@stlonepair}{\W@stlonepair[]}}
982 \def\W@stlonepair[#1]{%
983 \if\@tmpb D\relax%
984 \put(-65,-18){\hbox to0pt{\hss\verticalpair\hss}}%
985 \put(-95,-18){\hbox to0pt{\hss\verticalpair\hss}}%
986 \putlatom{-120}{-33}{\@memberb}%==3 down substituent
987 \else\if\@tmpb T\relax%
988 \put(-65,-18){\hbox to0pt{\hss\verticalpair\hss}}%
989 \put(-95,-18){\hbox to0pt{\hss\verticalpair\hss}}%
990 \put(-125,-18){\hbox to0pt{\hss\verticalpair\hss}}%
991 \putlatom{-150}{-33}{\@memberb}%==3 down substituent
992 \else\if\@tmpb N\relax%normal single bond
993 \Put@Line(-50,0)(-1,0){140}%
994 \putlatom{-190}{-33}{\@memberb}%==1 upper substituent
995 \else
996 \put(-65,-18){\hbox to0pt{\hss\verticalpair\hss}}%
997 \putlatom{-90}{-33}{\@memberb}%==3 down substituent
998 \fi\fi\fi%
999 }
1000 % \end{macrocode}
1001 % \end{macro}
1002 %
1003 % The macro \verb/\LewisTetrahedralA/ supports a (yl)-function, which
1004 % is based on the x,y-adjustment due to the \verb/\ylLewisTetrahedralAposition/,
1005 % which is defined in a similar way to \verb/\yltetrahedralposition/ used in
1006 % the definition of the macro \verb/\tetrahedral/. The original values are
1007 % left as commented lines in order to compare with the \textsf{aliphat} package
1008 % of the \XyMTeX{} system.
1009 %
1010 % \begin{macro}{\ylLewisTetrahedralAposition}
1011 % \begin{macrocode}
1012 \def\ylLewisTetrahedralAposition#1{%
1013 \@@ylswfalse%%%\@reset@ylsw
1014 \West@bondfalse
1015 \East@bondfalse
1016 \@forsemicol\member:=#1\do{%
1017 \if@@ylsw\else
1018 \ifx\member\empty\else
1019 \expandafter\@m@mb@r\member;\relax
1020 \expandafter\threech@r\@membera{}{}\relax
1021 \ifx\@memberb\@yl\relax\@@ylswtrue\else\@@ylswfalse\fi
1022 \if@@ylsw%
1023 \ifcase\@tmpa%
1024 \or%1
1025 \ifno@centeratom%
1026 \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue%N subst. on 1
1027 \else%
1028 % \gdef\@ylii{0}\gdef\@yli{-52}\global\@ylswtrue%N subst. on 1
1029 \gdef\@ylii{45}\gdef\@yli{33}\global\@ylswtrue%N subst. on 1
1030 \fi%
1031 \or%2
1032 \ifno@centeratom%
1033 \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue%
1034 \else%
1035 % \gdef\@ylii{52}\gdef\@yli{0}\global\@ylswtrue%
1036 \gdef\@ylii{40}\gdef\@yli{30}\global\@ylswtrue%
1037 \fi%
1038 \East@bondtrue%W subst. on 1
1039 \or%3
1040 \ifno@centeratom%
1041 \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue%S subst. on 1
1042 \else%
1043 % \gdef\@ylii{0}\gdef\@yli{52}\global\@ylswtrue%S subst. on 1
1044 \gdef\@ylii{35}\gdef\@yli{40}\global\@ylswtrue%S subst. on 1
1045 \fi%
1046 \or%4
1047 \ifno@centeratom%
1048 \gdef\@ylii{-72}\gdef\@yli{0}\global\@ylswtrue%??????
1049 \else%
1050 % \gdef\@ylii{-52}\gdef\@yli{0}\global\@ylswtrue%
1051 \gdef\@ylii{-40}\gdef\@yli{32}\global\@ylswtrue%
1052 \fi%
1053 \West@bondtrue%E subst. on 1
1054 \fi%end of ifcase
1055 \fi\fi\fi}}%
1056 % \end{macrocode}
1057 % \end{macro}
1058 %
1059 % The macro \verb/\LewisTetrahedralB/ is defined as an extension of
1060 % \verb/\LewistetrahedralB/, where it supports a nestec structures.
1061 % As a basic function of \verb/\LewisTetrahedralB/,
1062 % atoms (W, X, Y, and Z) which are attached to a central atom (A)
1063 % through Lewis bonds are drawn by the following \verb/\LewisTetrahedralB/ command.
1064 %
1065 % \begin{verbatim}
1066 % \LewisteTrahedralB{0==A;1==W;2==X;3==Y;4==Z}
1067 % \end{verbatim}
1068 %
1069 % \begin{verbatim}
1070 %
1071 % 4 Z W 1
1072 % : :
1073 % A
1074 % : :
1075 % 3 Y X 2
1076 %
1077 % \end{verbatim}
1078 %
1079 % Each of the atoms can be omitted.
1080 %
1081 % \begin{macro}{\LewisTetrahedralB}
1082 % \begin{macrocode}
1083 \def\LewisTetrahedralB{%
1084 \@ifnextchar[{\@LewisTetrahedralB[r}{\@LewisTetrahedralB[r]}}
1085 \def\@LewisTetrahedralB#1]#2{%
1086 \begingroup
1087 \let\NEbond=\NEbondlonepair
1088 \let\SEbond=\SEbondlonepair
1089 \let\SWbond=\SWbondlonepair
1090 \let\NWbond=\NWbondlonepair
1091 \let\ylsquareposition=\ylLewisTetrahedralBposition
1092 \@squareplanar#1]{#2}%
1093 \endgroup
1094 }%end of macro LewisTetrahedralB
1095 % \end{macrocode}
1096 % \end{macro}
1097 %
1098 % Note that the inner macros \verb/\NEbond/ etc.\ used in the definition of \verb/\squareplanar/
1099 % are replaced by \verb/\NEbondlonepair/ etc.
1100 %
1101 % \begin{macro}{\NEbondlonepair}
1102 % \begin{macrocode}
1103 \def\NEbondlonepair{%
1104 \begin{sfpicture}(100,300)(0,0)%
1105 \if\@tmpb D\relax%
1106 \put(50,50){\hbox to0pt{\hss\nelonepair\hss}}%
1107 \put(75,75){\hbox to0pt{\hss\nelonepair\hss}}%
1108 \putratom{90}{82}{\@memberb}%==1 northeast substituent
1109 \else\if\@tmpb T\relax%
1110 \put(50,50){\hbox to0pt{\hss\nelonepair\hss}}%
1111 \put(75,75){\hbox to0pt{\hss\nelonepair\hss}}%
1112 \put(100,100){\hbox to0pt{\hss\nelonepair\hss}}%
1113 \putratom{115}{107}{\@memberb}%==1 northeast substituent
1114 \else\if\@tmpb N\relax%normal single bond
1115 \Put@Line(40,47)(1,1){95}%
1116 \putratom{145}{137}{\@memberb}%==1 (northeast substituent)
1117 \else
1118 \put(50,50){\hbox to0pt{\hss\nelonepair\hss}}%
1119 \putratom{65}{57}{\@memberb}%==1 northeast substituent
1120 \fi\fi\fi%
1121 \end{sfpicture}%
1122 }
1123 % \end{macrocode}
1124 % \end{macro}
1125 %
1126 % \begin{macro}{\SEbondlonepair}
1127 % \begin{macrocode}
1128 \def\SEbondlonepair{%
1129 \begin{sfpicture}(100,300)(0,0)%
1130 \if\@tmpb D\relax%
1131 \put(50,-50){\hbox to0pt{\hss\selonepair\hss}}%
1132 \put(75,-75){\hbox to0pt{\hss\selonepair\hss}}%
1133 \putratom{90}{-148}{\@memberb}%==2 southeast substituent
1134 \else\if\@tmpb T\relax%
1135 \put(50,-50){\hbox to0pt{\hss\selonepair\hss}}%
1136 \put(75,-75){\hbox to0pt{\hss\selonepair\hss}}%
1137 \put(100,-100){\hbox to0pt{\hss\selonepair\hss}}%
1138 \putratom{115}{-173}{\@memberb}%==2 southeast substituent
1139 \else\if\@tmpb N\relax%normal single bond
1140 \Put@Line(40,-47)(1,-1){95}%
1141 \putratom{145}{-203}{\@memberb}%==2 (southeast substituent)
1142 \else
1143 \put(50,-50){\hbox to0pt{\hss\selonepair\hss}}%
1144 \putratom{65}{-123}{\@memberb}%==2 southeast substituent
1145 \fi\fi\fi%
1146 \end{sfpicture}%
1147 }
1148 % \end{macrocode}
1149 % \end{macro}
1150 %
1151 % \begin{macro}{\SWbondlonepair}
1152 % \begin{macrocode}
1153 \def\SWbondlonepair{%
1154 \begin{sfpicture}(100,300)(0,0)%
1155 \if\@tmpb D\relax%
1156 \put(-50,-50){\hbox to0pt{\hss\swlonepair\hss}}%
1157 \put(-75,-75){\hbox to0pt{\hss\swlonepair\hss}}%
1158 \putlatom{-90}{-148}{\@memberb}%==3 southeast substituent
1159 \else\if\@tmpb T\relax%
1160 \put(-50,-50){\hbox to0pt{\hss\swlonepair\hss}}%
1161 \put(-75,-75){\hbox to0pt{\hss\swlonepair\hss}}%
1162 \put(-100,-100){\hbox to0pt{\hss\swlonepair\hss}}%
1163 \putlatom{-115}{-173}{\@memberb}%==3 southeast substituent
1164 \else\if\@tmpb N\relax%normal single bond
1165 \Put@Line(-50,-47)(-1,-1){95}%
1166 \putlatom{-163}{-203}{\@memberb}%==3 (southwest substituent)
1167 \else
1168 \put(-50,-50){\hbox to0pt{\hss\swlonepair\hss}}%
1169 \putlatom{-65}{-123}{\@memberb}%==3 southeast substituent
1170 \fi\fi\fi%
1171 \end{sfpicture}%
1172 }
1173 % \end{macrocode}
1174 % \end{macro}
1175 %
1176 %
1177 % \begin{macro}{\NWbondlonepair}
1178 % \begin{macrocode}
1179 \def\NWbondlonepair{%
1180 \begin{sfpicture}(100,300)(0,0)%
1181 \if\@tmpb D\relax%
1182 \put(-50,50){\hbox to0pt{\hss\nwlonepair\hss}}%
1183 \put(-75,75){\hbox to0pt{\hss\nwlonepair\hss}}%
1184 \putlatom{-90}{82}{\@memberb}%==4 northwest substituent
1185 \else\if\@tmpb T\relax%
1186 \put(-50,50){\hbox to0pt{\hss\nwlonepair\hss}}%
1187 \put(-75,75){\hbox to0pt{\hss\nwlonepair\hss}}%
1188 \put(-100,100){\hbox to0pt{\hss\nwlonepair\hss}}%
1189 \putlatom{-115}{107}{\@memberb}%==4 northwest substituent
1190 \else\if\@tmpb N\relax%normal single bond
1191 \Put@Line(-40,47)(-1,1){95}%
1192 \putlatom{-145}{137}{\@memberb}%==4 (northwest substituent)
1193 \else
1194 \put(-50,50){\hbox to0pt{\hss\nwlonepair\hss}}%
1195 \putlatom{-65}{57}{\@memberb}%==1 northwest substituent
1196 \fi\fi\fi%
1197 \end{sfpicture}%
1198 }
1199 % \end{macrocode}
1200 % \end{macro}
1201 %
1202 % The macro \verb/\LewisTetrahedralB/ supports a (yl)-function, which
1203 % is based on the x,y-adjustment due to the \verb/\ylLewisTetrahedralBposition/,
1204 % which is defined in a similar way to \verb/\ylsquareposition/ used in
1205 % the definition of the macro \verb/\squaraplanar/ (renamed from \verb/\square/).
1206 % The original values are left as commented lines in order to compare
1207 % with the \textsf{aliphat} package of the \XyMTeX{} system.
1208 %
1209 % \begin{macro}{\ylLewisTetrahedralBposition}
1210 % \begin{macrocode}
1211 \def\ylLewisTetrahedralBposition#1{%
1212 \@@ylswfalse%%%\@reset@ylsw
1213 \@forsemicol\member:=#1\do{%
1214 \if@@ylsw\else
1215 \ifx\member\empty\else
1216 \expandafter\@m@mb@r\member;\relax
1217 \expandafter\threech@r\@membera{}{}\relax
1218 \ifx\@memberb\@yl\relax\@@ylswtrue\else\@@ylswfalse\fi
1219 \if@@ylsw
1220 \ifcase\@tmpa
1221 \or%
1222 % \gdef\@ylii{-40}\gdef\@yli{-47}\global\@ylswtrue% NE subst. on 1
1223 \gdef\@ylii{-28}\gdef\@yli{40}\global\@ylswtrue% NE subst. on 1
1224 \or%2
1225 % \gdef\@ylii{-40}\gdef\@yli{47}\global\@ylswtrue% SE subst. on 2
1226 \gdef\@ylii{-28}\gdef\@yli{35}\global\@ylswtrue% SE subst. on 2
1227 \or%3
1228 % \gdef\@ylii{50}\gdef\@yli{47}\global\@ylswtrue% SW subst. on 3
1229 \gdef\@ylii{35}\gdef\@yli{22}\global\@ylswtrue% SW subst. on 3
1230 \or%4
1231 % \gdef\@ylii{50}\gdef\@yli{-47}\global\@ylswtrue% NW subst. on 4
1232 \gdef\@ylii{35}\gdef\@yli{40}\global\@ylswtrue% NW subst. on 4
1233 \fi%end of ifcase
1234 \fi\fi\fi}}%
1235 \endinput
1236 %</lewisstruc>
1237 % \end{macrocode}
1238 % \end{macro}
1239 %
1240 % \Finale
1241 %
1242 \endinput