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