Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %% File: polymers.dtx
3 %
4 % Copyright 1996, 1998, 2001, 2002, 2004. 2010 by Shinsaku Fujita
5 %
6 % This file is part of XyMTeX system.
7 % -------------------------------------
8 %
9 % This file is a part of the macro package ``XyMTeX'' which has been
10 % designed for typesetting chemical structural formulas.
11 %
12 % This file is to be contained in the ``xymtex'' directory which is
13 % an input directory for TeX. It is a LaTeX optional style file and
14 % should be used only within LaTeX, because several macros of the file
15 % are based on LaTeX commands.
16 %
17 % For the review of XyMTeX, see
18 % (1) Shinsaku Fujita, ``Typesetting structural formulas with the text
19 % formatter TeX/LaTeX'', Computers and Chemistry, in press.
20 % The following book deals with an application of TeX/LaTeX to
21 % preparation of manuscripts of chemical fields:
22 % (2) Shinsaku Fujita, ``LaTeX for Chemists and Biochemists''
23 % Tokyo Kagaku Dozin, Tokyo (1993) [in Japanese].
24 %
25 % This work may be distributed and/or modified under the
26 % conditions of the LaTeX Project Public License, either version 1.3
27 % of this license or (at your option) any later version.
28 % The latest version of this license is in
29 % http://www.latex-project.org/lppl.txt
30 % and version 1.3 or later is part of all distributions of LaTeX
31 % version 2005/12/01 or later.
32 %
33 % This work has the LPPL maintenance status `maintained'.
34 % The Current Maintainer of this work is Shinsaku Fujita.
35 %
36 % This work consists of the files polymers.dtx and polymers.ins
37 % and the derived file polymers.sty.
38 %
39 % Please report any bugs, comments, suggestions, etc. to:
40 % Shinsaku Fujita,
41 % Shonan Institute of Chemoinformatics and Mathematical Chemistry
42 % Kaneko 479-7 Ooimachi, Ashigara-Kami-Gun, Kanagawa 250-0019 Japan
43 % (old address)
44 % Ashigara Research Laboratories, Fuji Photo Film Co., Ltd.,
45 % Minami-Ashigara, Kanagawa-ken, 250-01, Japan.
46 % (old address)
47 % Department of Chemistry and Materials Technology,
48 % Kyoto Institute of Technology, \\
49 % Matsugasaki, Sakyoku, Kyoto, 606 Japan
50 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 % \def\j@urnalname{polymers}
52 % \def\versi@ndate{August 16, 1996}
53 % \def\versi@nno{ver1.00}
54 % \def\copyrighth@lder{SF} % Shinsaku Fujita
55 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 % \def\j@urnalname{polymers}
57 % \def\versi@ndate{October 31, 1998}
58 % \def\versi@nno{ver1.02}
59 % \def\copyrighth@lder{SF} % Shinsaku Fujita
60 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 % \def\j@urnalname{polymers}
62 % \def\versi@ndate{December 25, 1998}
63 % \def\versi@nno{ver2.00}
64 % \def\copyrighth@lder{SF} % Shinsaku Fujita
65 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 % \def\j@urnalname{polymers}
67 % \def\versi@ndate{June 20, 2001}
68 % \def\versi@nno{ver2.01}
69 % \def\copyrighth@lder{SF} % Shinsaku Fujita
70 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 % \def\j@urnalname{polymers}
72 % \def\versi@ndate{April 30, 2002}
73 % \def\versi@nno{ver3.00}
74 % \def\copyrighth@lder{SF} % Shinsaku Fujita
75 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 % \def\j@urnalname{polymers}
77 % \def\versi@ndate{May 30, 2002}
78 % \def\versi@nno{ver4.00}
79 % \def\copyrighth@lder{SF} % Shinsaku Fujita
80 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81 % \def\j@urnalname{polymers}
82 % \def\versi@ndate{August 30, 2004}
83 % \def\versi@nno{ver4.01}
84 % \def\copyrighth@lder{SF} % Shinsaku Fujita
85 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
86 %
87 % \fi
88 %
89 % \CheckSum{480}
90 %% \CharacterTable
91 %% {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
92 %% 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
93 %% Digits \0\1\2\3\4\5\6\7\8\9
94 %% Exclamation \! Double quote \" Hash (number) \#
95 %% Dollar \$ Percent \% Ampersand \&
96 %% Acute accent \' Left paren \( Right paren \)
97 %% Asterisk \* Plus \+ Comma \,
98 %% Minus \- Point \. Solidus \/
99 %% Colon \: Semicolon \; Less than \<
100 %% Equals \= Greater than \> Question mark \?
101 %% Commercial at \@ Left bracket \[ Backslash \\
102 %% Right bracket \] Circumflex \^ Underscore \_
103 %% Grave accent \` Left brace \{ Vertical bar \|
104 %% Right brace \} Tilde \~}
105 %
106 % \setcounter{StandardModuleDepth}{1}
107 %
108 % \StopEventually{}
109 % \MakeShortVerb{\|}
110 %
111 % \iffalse
112 % \changes{v1.00}{1996/07/07}{first edition for LaTeX2e}
113 % \changes{v1.02}{1998/10/31}{revised edition for LaTeX2e}
114 % \changes{v2.00}{1998/12/25}{enhanced edition for LaTeX2e}
115 % \changes{v2.01}{2001/06/20}{Size reduction and Clip information}
116 % \changes{v3.00}{2002/04/30}{sfpicture environment, etc.}
117 % \changes{v4.00}{2002/05/30}{PostScript output and ShiftPicEnv}
118 % \changes{v4.01}{2004/08/30}{Minor additions}
119 % \changes{v5.00}{2010/10/01}{for bond coloring and the LaTeX Project Public License}
120 % \fi
121 %
122 % \iffalse
123 %<*driver>
124 \NeedsTeXFormat{pLaTeX2e}
125 % \fi
126 \ProvidesFile{polymers.dtx}[2010/10/01 v5.00 XyMTeX{} package file]
127 % \iffalse
128 \documentclass{ltxdoc}
129 \GetFileInfo{polymers.dtx}
130 %
131 % %%XyMTeX Logo: Definition 2%%%
132 \def\UPSILON{\char'7}
133 \def\XyM{X\kern-.30em\smash{%
134 \raise.50ex\hbox{\UPSILON}}\kern-.30em{M}}
135 \def\XyMTeX{\XyM\kern-.1em\TeX}
136 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
137 \title{Polymers by {\sffamily polymers.sty}
138 (\fileversion) of \XyMTeX{}}
139 \author{Shinsaku Fujita \\
140 Shonan Institute of Chemoinformatics and Mathematical Chemistry, \\
141 Kaneko 479-7 Ooimachi, Ashigara-Kami-Gun, Kanagawa 250-0019 Japan
142 % % (old address)
143 % %Department of Chemistry and Materials Technology, \\
144 % %Kyoto Institute of Technology, \\
145 % %Matsugasaki, Sakyoku, Kyoto, 606-8585 Japan
146 % %% (old address)
147 % %% Ashigara Research Laboratories,
148 % %% Fuji Photo Film Co., Ltd., \\
149 % %% Minami-Ashigara, Kanagawa, 250-01 Japan
150 }
151 \date{\filedate}
152 %
153 \begin{document}
154 \maketitle
155 \DocInput{polymers.dtx}
156 \end{document}
157 %</driver>
158 % \fi
159 %
160 % \section{Introduction}\label{polymers:intro}
161 %
162 % \subsection{Options for {\sffamily docstrip}}
163 %
164 % \DeleteShortVerb{\|}
165 % \begin{center}
166 % \begin{tabular}{|l|l|}
167 % \hline
168 % \emph{option} & \emph{function}\\ \hline
169 % polymers & polymers.sty \\
170 % driver & driver for this dtx file \\
171 % \hline
172 % \end{tabular}
173 % \end{center}
174 % \MakeShortVerb{\|}
175 %
176 % \subsection{Version Information}
177 %
178 % \begin{macrocode}
179 %<*polymers>
180 \typeout{XyMTeX for Drawing Chemical Structural Formulas. Version 5.00}
181 \typeout{ -- Released October 01, 2010 by Shinsaku Fujita}
182 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
183 \def\j@urnalname{polymers}
184 \def\versi@ndate{October 01, 2010}
185 \def\versi@nno{ver5.00}
186 \def\copyrighth@lder{SF} % Shinsaku Fujita
187 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
188 \typeout{XyMTeX Macro File `\j@urnalname' (\versi@nno) <\versi@ndate>%
189 \space[\copyrighth@lder]}
190 % \end{macrocode}
191 %
192 % \section{List of commands for polymers.sty}
193 %
194 % \begin{verbatim}
195 % **********************************
196 % * polymers.sty: list of commands *
197 % **********************************
198 %
199 % <Delimeters for polymer units>
200 %
201 % \leftPMdelim \rightPMdelim
202 % \leftpmdelim \rightpmdelim
203 %
204 % \leftPolymer \leftpolymer
205 % \rightPolymer \rightpolymer
206 %
207 % \leftsqrPolymer \leftSqrpolymer
208 % \lsqrdelimiter \leftsqrpolymer
209 %
210 % \rightsqrPolymer \rightSqrpolymer
211 % \rsqrdelimiter \rightsqrpolymer
212 %
213 % \@sqrpolymer
214 % \sqrpolymer \Sqrpolymer
215 % \mpolymer
216 %
217 % <Bonds for polymers>
218 %
219 % \WestPbond \EastPbond
220 % \sbond
221 %
222 % <Polymers>
223 %
224 % \polyethylene \@polyethylene
225 % \polystyrene \@polystyrene
226 %
227 % \end{verbatim}
228 %
229 % \section{Input of basic macros}
230 %
231 % To assure the compatibility to \LaTeX{}2.09 (the native mode),
232 % the commands added by \LaTeXe{} have not been used in the resulting sty
233 % files ({\sf polymers.sty} for the present case). Hence, the combination
234 % of |\input| and |\@ifundefined| is used to crossload sty
235 % files ({\sf chemstr.sty} etc. for the present case) in place of the
236 % |\RequirePackage| command of \LaTeXe{}.
237 %
238 % \begin{macrocode}
239 % *************************
240 % * input of basic macros *
241 % *************************
242 \@ifundefined{setsixringv}{\input chemstr.sty\relax}{}
243 \@ifundefined{Westbond}{\input aliphat.sty\relax}{}
244 \@ifundefined{bzdrv}{\input carom.sty\relax}{}
245 \unitlength=0.1pt
246 % \end{macrocode}
247 %
248 % \begin{macrocode}
249 % ****************************************************
250 % * For separating an augument list to each argument *
251 % ****************************************************
252 %
253 \def\@forsemicol#1:=#2\do#3{%
254 %% \edef\@fortmp{#2}\ifx\@fortmp\@empty%
255 \expandafter\def\expandafter\@fortmp\expandafter{#2}%
256 \ifx\@fortmp\@empty%
257 \else%
258 \expandafter\@forl@@p#2;\@nil;\@nil\@@#1{#3}\fi}
259 % \end{macrocode}
260 %
261 % \section{Delimeters for polymer units}
262 %
263 % \subsection{Right and left delimeters}
264 %
265 % A polymer structure has a unit surrounded by
266 % parentheses or other delimeters. For drawing a
267 % parenthesis as the part of a substituent,
268 % the following commands are prepared.
269 %
270 % \subsubsection{Parentheses}
271 %
272 % \begin{macro}{\leftPMdelim}
273 % \begin{macro}{\leftpmdelim}
274 % \begin{macrocode}
275 % ********************************
276 % * Delimeters for polymer units *
277 % ********************************
278 \def\leftPMdelim#1{$\mathstrut #1$}
279 \def\leftpmdelim{\leftPMdelim{\biggm(}}
280 % \end{macrocode}
281 % \end{macro}
282 % \end{macro}
283 %
284 % \begin{macro}{\rightPMdelim}
285 % \begin{macro}{\rightpmdelim}
286 % \begin{macrocode}
287 \def\rightPMdelim#1#2{%
288 $\mathstrut #1_{\mkern-5mu #2}$}
289 \def\rightpmdelim#1{\rightPMdelim{\biggm)}{#1}}
290 % \end{macrocode}
291 % \end{macro}
292 % \end{macro}
293 %
294 % The command |\leftpolymer| typesets the left parenthesis of
295 % a polymer unit.
296 % The command |\leftPolymer| is the inner commend of |\leftpolymer|,
297 % where a delimeter can be selected as an argument.
298 %
299 % \begin{macro}{\leftPolymer}
300 % \begin{macro}{\leftpolymer}
301 % \begin{macrocode}
302 \def\leftPolymer#1#2{%
303 \begin{sfpicture}(0,0)(0,0)
304 \putlatom{0}{0}{#2}
305 \putlatom{120}{0}{$#1$}
306 \end{sfpicture}}
307 \def\leftpolymer#1{\leftPolymer{\biggm(}{#1}}
308 % \end{macrocode}
309 % \end{macro}
310 % \end{macro}
311 %
312 % The command |\rightpolymer| typesets the left parenthesis of
313 % a polymer unit along with a repeating number as a subscript.
314 % The command |\rightPolymer| is the inner commend of |\rightpolymer|,
315 % where a delimeter can be selected as an argument.
316 %
317 % \begin{macro}{\Rightpolymer}
318 % \begin{macro}{\rightpolymer}
319 % \begin{macrocode}
320 \def\rightPolymer#1#2#3{%
321 \begin{sfpicture}(0,0)(0,0)
322 \putratom{0}{0}{#2}
323 \putratom{-150}{0}{%
324 % $\mathstrut#1_{\mkern-3mu \mbox{\scriptsize\rm #3}}$}
325 $\mathstrut#1_{\mkern-2mu #3}$}
326 \end{sfpicture}}
327 \def\rightpolymer#1#2{\rightPolymer{\biggm)}{#1}{#2}}
328 % \end{macrocode}
329 % \end{macro}
330 % \end{macro}
331 %
332 % \subsubsection{Brackets}
333 %
334 % The command |\leftSqrpolymer| typesets the left bracket of
335 % a polymer unit.
336 % The command |\leftsqrPolymer| is the inner commend of |\leftSqrpolymer|,
337 % where a delimeter can be selected as an argument.
338 % The bracket selected by the command |\leftSqrpolymer| is
339 % a \TeX{} big mathematical symbol,
340 % the line of which is
341 % boldfaced.
342 %
343 % \begin{macro}{\leftsqrPolymer}
344 % \begin{macro}{\leftSqrpolymer}
345 % \begin{macrocode}
346 \def\leftsqrPolymer#1#2{%
347 \begin{sfpicture}(0,0)(0,0)
348 \putlatom{0}{0}{#2}
349 \putlatom{120}{0}{$#1$}
350 \end{sfpicture}}
351 \def\leftSqrpolymer#1{\leftsqrPolymer{\Biggm[}{#1}}
352 % \end{macrocode}
353 % \end{macro}
354 % \end{macro}
355 %
356 % The command |\rightSqrpolymer| typesets the right bracket of
357 % a polymer unit.
358 % The command |\rightsqrPolymer| is the inner commend of |\rightSqrpolymer|,
359 % where a delimeter can be selected as an argument.
360 % The bracket selected by the command |\rightSqrpolymer| is
361 % a \TeX{} big mathematical symbol,
362 % the line of which is boldfaced.
363 %
364 % \begin{macro}{\rightsqrPolymer}
365 % \begin{macro}{\rightSqrpolymer}
366 % \begin{macrocode}
367 \def\rightsqrPolymer#1#2#3{%
368 \begin{sfpicture}(0,0)(0,0)
369 \putratom{0}{0}{#2}
370 \putratom{-150}{0}{%
371 % $\mathstrut #1_{\mbox{\scriptsize\rm #3}}$}
372 $\mathstrut #1_{#3}$}
373 \end{sfpicture}}
374 \def\rightSqrpolymer#1#2{\rightsqrPolymer{\Biggm]}{#1}{#2}}
375 % \end{macrocode}
376 % \end{macro}
377 % \end{macro}
378 %
379 % For drawing polymer brackets of thin line width,
380 % we prepare the command |\lsqrdelimiter|. The height of
381 % the bracket can be designated by the argument of this
382 % command. The command
383 % is used to define the command |\leftsqrpolymer|.
384 % This command typesets a left bracket of thin line width.
385 %
386 % \begin{macro}{\lsqrdelimiter}
387 % \begin{macro}{\leftsqrpolymer}
388 % \begin{macrocode}
389 \def\lsqrdelimiter#1{%
390 \hbox{\vrule \@width\fboxrule
391 $\vcenter to#1{%
392 \hrule \@height\fboxrule \@width\fboxsep
393 \vfill
394 \hrule \@height\fboxrule \@width\fboxsep}$}}
395 \def\leftsqrpolymer#1{%
396 \leftsqrPolymer{\lsqrdelimiter{300\unitlength}}{#1}}
397 % \end{macrocode}
398 % \end{macro}
399 % \end{macro}
400 %
401 % The command |\rsqrdelimiter| is
402 % used to define the command |\rightsqrpolymer|, which
403 % typesets a right bracket of thin line width.
404 %
405 % \begin{macro}{\rsqrdelimiter}
406 % \begin{macro}{\rightsqrpolymer}
407 % \begin{macrocode}
408 \def\rsqrdelimiter#1{%
409 \hbox{$\vcenter to#1{%
410 \hrule \@height\fboxrule \@width\fboxsep \vfill
411 \hrule \@height\fboxrule \@width\fboxsep}$\kern-\fboxrule
412 \vrule \@width\fboxrule\kern2pt}}
413 \def\rightsqrpolymer#1#2{%
414 \rightsqrPolymer{\rsqrdelimiter{300\unitlength}}{#1}{#2}}
415 % \end{macrocode}
416 % \end{macro}
417 % \end{macro}
418 %
419 % \subsection{Pairs of delimeters}
420 %
421 % The command |\sqrpolymer| typesets a pair of thin-line brackets that
422 % surrounds a polymer unit after measuring the height of
423 % the unit. On the other hand,
424 % the command |\Sqrpolymer| typesets a pair of thick-line brackets.
425 % Both of the commands are based on the inner macro |\@sqrpolymer|,
426 % in which a line width is designated by means of an argument.
427 %
428 % \begin{macro}{\@sqrpolymer}
429 % \begin{macro}{\sqrpolymer}
430 % \begin{macro}{\Sqrpolymer}
431 % \begin{macrocode}
432 \long\def\@sqrpolymer#1#2#3{%
433 \begingroup \fboxrule=#1
434 \leavevmode\setbox\@tempboxa\hbox{#2}\@tempdima\fboxrule
435 \advance\@tempdima \fboxsep \advance\@tempdima \dp\@tempboxa
436 \@tempdimb=\wd\@tempboxa
437 \advance\@tempdimb by \fboxsep
438 \advance\@tempdimb by \fboxsep
439 \advance\@tempdimb by \fboxrule
440 \advance\@tempdimb by \fboxrule
441 \hbox{\lower \@tempdima\hbox
442 {\vbox{
443 \hbox to\@tempdimb{%
444 \vrule \@height \fboxrule \@width\fboxsep\hfill
445 \vrule \@height \fboxrule \@width\fboxsep}
446 \nointerlineskip
447 \hbox{\vrule \@width \fboxrule \hskip\fboxsep
448 \vbox{\vskip\fboxsep \copy\@tempboxa\vskip\fboxsep}\hskip
449 \fboxsep\vrule \@width \fboxrule}
450 \nointerlineskip
451 \hbox to\@tempdimb{%
452 \vrule \@height \fboxrule \@width\fboxsep\hfill
453 \vrule \@height \fboxrule \@width\fboxsep}}}}%
454 \kern2pt\lower\@tempdima\hbox{\scriptsize$#3$}\endgroup}
455 \long\def\sqrpolymer#1#2{\@sqrpolymer{0.4pt}{#1}{#2}}
456 \long\def\Sqrpolymer#1#2{\@sqrpolymer{1pt}{#1}{#2}}
457 % \end{macrocode}
458 % \end{macro}
459 % \end{macro}
460 % \end{macro}
461 %
462 % The command |\mpolymer| typesets a pair of parentheses that
463 % surrounds a polymer unit after measuring the height of
464 % the unit.
465 %
466 % \begin{macro}{\mpolymer}
467 % \begin{macrocode}
468 \long\def\mpolymer#1#2{%
469 \leavevmode\setbox\@tempboxa\hbox{#1}\@tempdima\fboxrule
470 \advance\@tempdima \fboxsep \advance\@tempdima \dp\@tempboxa
471 \hbox{\lower \@tempdima\hbox{\vbox{\hbox{\hskip\fboxsep%
472 $\left(\vcenter{\vskip\fboxsep \copy\@tempboxa\vskip\fboxsep}%
473 \right)_{#2}$}}}}}
474 % \end{macrocode}
475 % \end{macro}
476 %
477 % \section{Commands for drawing polymers}
478 %
479 % \subsection{Bonds for polymers}
480 %
481 % The original commands
482 % |\Westbond| and |\Eastbond| are changed into
483 % |\WestPbond| and |\EastPbond|, where each bond is lengthened
484 % for making a space for drawing delimiters.
485 %
486 % \begin{macro}{\WestPbond}
487 % \begin{macro}{\EastPbond}
488 % \begin{macro}{\sbond}
489 % \begin{macrocode}
490 % **********************
491 % * Bonds for polymers *
492 % **********************
493 \def\WestPbond{%
494 \begin{sfpicture}(100,100)(0,0)%
495 \Put@Direct(-100,0){\Westbond}%
496 \Put@Line(-60,0)(-1,0){90}%
497 \end{sfpicture}}%
498 \def\EastPbond{%
499 \begin{sfpicture}(100,100)(0,0)%
500 \Put@Direct(100,0){\Eastbond}%
501 \Put@Line(60,0)(1,0){90}%
502 \end{sfpicture}}%
503 \def\sbond{%
504 \begin{sfpicture}(160,0)(0,0)%
505 \Put@Line(0,33)(1,0){160}%
506 \end{sfpicture}}%
507 % \end{macrocode}
508 % \end{macro}
509 % \end{macro}
510 % \end{macro}
511 %
512 % \subsection{Polyethylene unit}
513 %
514 % The command |\polyethylene| is used to draw polyethylene derivatives,
515 % in which each substituent is designated by the |SUBSLIST|.
516 % The following numbering is used in this macro.
517 %
518 % \begin{verbatim}
519 % ********************
520 % * polyethylene unit*
521 % ********************
522 %
523 % The following numbering is adopted in this macro.
524 %
525 % | 1 6 |
526 % | |
527 % | | | |
528 % 2 ---- (1) -- (2) ---- 5
529 % | | (0) | |
530 % | |
531 % | 3 4 |0
532 % \end{verbatim}
533 %
534 % The command |\polyethylene| has arguments,
535 % |CALIST| and |SUBSLIST|, as well as an optional argument |AUXLIST|.
536 % \begin{verbatim}
537 % \polyethylene[AUXLIST]{CALIST}{SUBSLIST}
538 % \end{verbatim}
539 %
540 % The optional argument |AUXLIST| is used for
541 % typesetting auxiliary symbols on central atoms.
542 % \begin{verbatim}
543 % AUXLIST =
544 %
545 % {n+} : + charge (or another one chararacter) on the center
546 % \end{verbatim}
547 %
548 % The argument |CALIST| is used for indicating center atoms.
549 % \begin{verbatim}
550 % CALIST: central atom list
551 %
552 % for 1 : cetral atom (e.g. 1==C)
553 % 2 : cetral atom (e.g. 2==C)
554 % 0 : cetral bond (e.g. 0D==)
555 % \end{verbatim}
556 %
557 % The argument |SUBSLIST| is used for indicating substituents.
558 % \begin{verbatim}
559 % SUBSLIST: list of substituents
560 %
561 % for n = 1 to 4
562 %
563 % nT : triple bond at n-atom
564 % nD : double bond at n-atom
565 % n or nS : single bond at n-atom
566 % nA : alpha single bond at n-atom
567 % nB : beta single bond at n-atom
568 % \end{verbatim}
569 %
570 % \begin{macro}{\if@centbondsw}
571 % \begin{macro}{\if@centatswi}
572 % \begin{macro}{\if@centatswii}
573 % \begin{macrocode}
574 \newif\if@centbondsw \@centbondswfalse
575 \newif\if@centatswi \@centatswifalse
576 \newif\if@centatswii \@centatswiifalse
577 % \end{macrocode}
578 % \end{macro}
579 % \end{macro}
580 % \end{macro}
581 %
582 % \changes{v5.00}{2010/10/01}{for bond coloring}
583 % \begin{macro}{\polyethylene}
584 % \begin{macro}{\@polyethylene}
585 % \begin{macrocode}
586 \def\polyethylene{\@ifnextchar[{\@polyethylene}{\@polyethylene[]}}
587 \def\@polyethylene[#1]#2#3{%
588 \begin{sfpicture}(1100,600)(-400,-300)%
589 \OrigptOutput(400,300){polyethylene}%
590 % \end{macrocode}
591 %
592 % \begin{macrocode}
593 % ************
594 % * aux list *
595 % ************
596 \def\@@@temp{#1}%
597 \ifx\@@@temp\empty\else
598 \@tfor\member:=#1\do{%
599 \expandafter\twoch@@r\member{}{}%
600 \ifcase\@@tmpa%
601 \or\relax\putratom{47}{50}{\scriptsize\@@tmpb}%
602 \or\relax\putratom{347}{50}{\scriptsize\@@tmpb}%
603 \fi}\fi%
604 % \end{macrocode}
605 %
606 % \begin{macrocode}
607 % *****************
608 % * central atoms *
609 % *****************
610 \@forsemicol\member:=#2\do{%
611 \ifx\member\empty\else%
612 \expandafter\@m@mb@r\member;\relax%
613 \expandafter\threech@r\@membera{}{}%
614 \ifcase\@tmpa \global\@centbondswtrue\Put@Direct(20,0){\Eastbond}%
615 \or\global\@centatswitrue\putlratom{-40}{-33}{\@memberb}%
616 \or\global\@centatswiitrue\putlratom{260}{-33}{\@memberb}%
617 \fi\fi}%
618 \if@centatswi \else\putlratom{-40}{-33}{C}\fi%
619 \if@centatswii \else\putlratom{260}{-33}{C}\fi%
620 \if@centbondsw \else\Put@Line(70,0)(1,0){160}\fi%
621 \global\@centbondswfalse%
622 \global\@centatswifalse%
623 \global\@centatswiifalse%
624 % \end{macrocode}
625 %
626 % \begin{macrocode}
627 % ****************
628 % * Substituents *
629 % ****************
630 \gdef\numrepeated{x}%
631 \@forsemicol\member:=#3\do{%
632 \ifx\member\empty\else%
633 \expandafter\@m@mb@r\member;\relax%
634 \expandafter\threech@r\@membera{}{}%
635 \ifcase\@tmpa \gdef\numrepeated{\@memberb}%
636 \or\setBScolor{\Put@Direct(0,0){\Northbond}}%
637 \or\setBScolor{\Put@Direct(0,0){\WestPbond}}%
638 \or\setBScolor{\Put@Direct(0,0){\Southbond}}%
639 \or\setBScolor{\Put@Direct(300,0){\Southbond}}%
640 \or\setBScolor{\Put@Direct(300,0){\EastPbond}}%
641 \or\setBScolor{\Put@Direct(300,0){\Northbond}}%
642 \fi\fi}%end of ifcase
643 % \end{macrocode}
644 %
645 % \begin{macrocode}
646 % **************
647 % * Delimeters *
648 % **************
649 \Put@Direct(-200,-33){\leftpmdelim}%
650 \Put@Direct(400,-33){\rightpmdelim{\numrepeated}}%
651 \end{sfpicture}}%end of macro polyethylene
652 % \end{macrocode}
653 % \end{macro}
654 % \end{macro}
655 %
656 % \subsection{Polyestyrene unit}
657 %
658 % The command |\polyestrene| is used to draw polystyrene derivatives,
659 % in which substituents on both the polymer chain and the phenyl group
660 % are designated by the |SUBSLIST| and |PHSUBSLIST|, respectively.
661 % The following numbering is adopted in this macro.
662 % \begin{verbatim}
663 % ********************
664 % * polystyrene unit *
665 % ********************
666 %
667 % | 1 6 |
668 % | |
669 % | | | |
670 % 2 ---- (1) -- (2) ---- 5
671 % | | (0) | |
672 % | | |
673 % | 3 | |0
674 % / `
675 % 6 | | 2
676 % | |
677 % 5 ` / 3
678 % `
679 % 4
680 % \end{verbatim}
681 %
682 % The command |\polyethylene| has arguments,
683 % |CALIST|, |SUBSLIST| and |PHSUBSLIST|,
684 % as well as an optional argument |AUXLIST|.
685 % \begin{verbatim}
686 % \polystyrene[AUXLIST]{CALIST}{SUBSLIST}{PHSUBSLIST}
687 % \end{verbatim}
688 %
689 % The optional argument |AUXLIST| is used for
690 % typesetting auxiliary symbols on central atoms.
691 % \begin{verbatim}
692 % AUXLIST =
693 %
694 % {n+} : + charge (or another one chararacter) on the center
695 % \end{verbatim}
696 %
697 % The argument |CALIST| is used for indicating center atoms.
698 % \begin{verbatim}
699 % CALIST: central atom list
700 %
701 % for 1 : cetral atom (e.g. 1==C)
702 % 2 : cetral atom (e.g. 2==C)
703 % 0 : cetral bond (e.g. 0D==)
704 % \end{verbatim}
705 %
706 % The argument |SUBSLIST| is used for indicating substituents on
707 % the polymer chain.
708 % \begin{verbatim}
709 % SUBSLIST: list of substituents
710 %
711 % for n = 1 to 4
712 %
713 % nT : triple bond at n-atom
714 % nD : double bond at n-atom
715 % n or nS : single bond at n-atom
716 % nA : alpha single bond at n-atom
717 % nB : beta single bond at n-atom
718 % \end{verbatim}
719 %
720 % The argument |PHSUBSLIST| is used for indicating substituents on
721 % the phenyl group.
722 % \begin{verbatim}
723 % PHSUBSLIST: list of phenyl substituents
724 %
725 % for n = 2 to 6
726 %
727 % n or nS : single bond at n-atom
728 % \end{verbatim}
729 %
730 % \begin{macro}{\polyethylene}
731 % \begin{macro}{\@polyethylene}
732 % \begin{macrocode}
733 \def\polystyrene{\@ifnextchar[{\@polystyrene}{\@polystyrene[]}}
734 \def\@polystyrene[#1]#2#3#4{%
735 \begin{sfpicture}(1100,1200)(0,-640)%
736 \OrigptOutput(0,640){polystyrene}%
737 \begingroup \origptfalse
738 \Put@Direct(0,0){\polyethylene[#1]{#2}{#3}}%
739 \Put@Line(700,0)(0,1){240}%
740 \Put@Direct(300,-646){\bzdrv{#4}}%
741 \endgroup
742 \end{sfpicture}}%end of macro polystyrene
743 %</polymers>
744 % \end{macrocode}
745 % \end{macro}
746 % \end{macro}
747 %
748 % \Finale
749 %
750 \endinput