summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xymtex/base/polymers.sty
blob: 60f751d18ba8e4c93debfbc0ed50e12a3afffac6 (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
%%
%% This is file `polymers.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% polymers.dtx  (with options: `polymers')
%% 
%% This is a generated file.
%% 
%% Copyright 1996,1998,2001,2002,2004,2010 by Shinsaku Fujita
%% all rights reserved.
%% This style file is created for drawing chemical structural formulas
%% This style file is to be contained in the ``xymtex'' directory which
%% is an input directory for TeX.
%% 
%% This file is part of the XyMTeX system.
%% =======================================
%% Old Versions:
%% Version 1.01 Released on August 16, 1996
%% Version 1.02 Released on October 31, 1996 (private version)
%% Version 2.00 Released on December 25, 1998
%% Version 2.01 Released on June 20, 2001 (private version)
%% Version 3.00 Released on April 30, 2002
%% Version 4.00 Released on May 30, 2002 (private version)
%% Version 4.00 Released on August 30, 2004
%% 
%% The Present Version:
%% Version 5.00 Released on October 01, 2010
%% 
%% 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.
%% 
%% =======================================
%% 
%% File: polymers.dtx
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
\typeout{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]}
\@ifundefined{setsixringv}{\input chemstr.sty\relax}{}
\@ifundefined{Westbond}{\input aliphat.sty\relax}{}
\@ifundefined{bzdrv}{\input carom.sty\relax}{}
\unitlength=0.1pt
\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}
\def\leftPMdelim#1{$\mathstrut #1$}
\def\leftpmdelim{\leftPMdelim{\biggm(}}
\def\rightPMdelim#1#2{%
 $\mathstrut #1_{\mkern-5mu #2}$}
\def\rightpmdelim#1{\rightPMdelim{\biggm)}{#1}}
\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}}
\def\rightPolymer#1#2#3{%
\begin{sfpicture}(0,0)(0,0)
\putratom{0}{0}{#2}
\putratom{-150}{0}{%
 $\mathstrut#1_{\mkern-2mu #3}$}
\end{sfpicture}}
\def\rightpolymer#1#2{\rightPolymer{\biggm)}{#1}{#2}}
\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}}
\def\rightsqrPolymer#1#2#3{%
\begin{sfpicture}(0,0)(0,0)
\putratom{0}{0}{#2}
\putratom{-150}{0}{%
 $\mathstrut #1_{#3}$}
\end{sfpicture}}
\def\rightSqrpolymer#1#2{\rightsqrPolymer{\Biggm]}{#1}{#2}}
\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}}
\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}}
\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}}
\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}$}}}}}
\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}}%
\newif\if@centbondsw \@centbondswfalse
\newif\if@centatswi \@centatswifalse
\newif\if@centatswii \@centatswiifalse
\def\polyethylene{\@ifnextchar[{\@polyethylene}{\@polyethylene[]}}
\def\@polyethylene[#1]#2#3{%
 \begin{sfpicture}(1100,600)(-400,-300)%
  \OrigptOutput(400,300){polyethylene}%
\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%
\@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%
\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
\Put@Direct(-200,-33){\leftpmdelim}%
\Put@Direct(400,-33){\rightpmdelim{\numrepeated}}%
\end{sfpicture}}%end of macro polyethylene
\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
\endinput
%%
%% End of file `polymers.sty'.