summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xymtex/base/sizeredc.sty
blob: d3a7e3deb2a8d4994ad69b0bc19b9ab824c12884 (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
%%
%% This is file `sizeredc.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% sizeredc.dtx  (with options: `sizeredc')
%% 
%% This is a generated file.
%% 
%% Copyright 1996, 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:
%% Released on June 20, 2001 version 1.00
%% Released on April 30, 2002 version 1.01
%% Released on Auguts 30, 2004 version 4.01 (for XyMTeX 4.01)
%% 
%% 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 sizeredc.dtx and sizeredc.ins
%% and the derived file sizeredc.sty.
%% 
%% =======================================
%% 
%% File: sizeredc.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{sizeredc}
\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]}
\newcount\@tempcntx \newcount\@tempcnty \newcount\@tempcntz
\newif\ifseifuflag \seifuflagfalse
\def\DIVIDE#1#2#3{%
\seifuflagfalse \@tempcntx=#1
\ifnum\@tempcntx<0 \@tempcntx=-\@tempcntx\seifuflagtrue\fi
\divide\@tempcntx by#2\relax
\ifnum\@tempcntx<0 \@tempcntx=-\@tempcntx
\ifseifuflag \seifuflagfalse \else \seifuflagtrue\fi\fi
\@tempcntz=\@tempcntx%%store
\@tempcnty=\@tempcntx \multiply\@tempcnty by#2%
\ifnum\@tempcnty<0 \@tempcnty=-\@tempcnty\fi
\@tempcntx=#1%
\ifnum\@tempcntx<0 \@tempcntx=-\@tempcntx\fi
\advance\@tempcntx by-\@tempcnty%
\multiply\@tempcntx by10 \edef\s{\the\@tempcntx}%
\divide\@tempcntx by#2
\ifnum\@tempcntx<0 \@tempcntx=-\@tempcntx\fi
\ifnum\@tempcntx>4\relax \advance\@tempcntz by1\fi
\ifseifuflag \xdef#3{-\the\@tempcntz}%
\else\xdef#3{\the\@tempcntz}\fi}
\newcount\@xArg \newcount\@yArg
\def\LineTemp(#1,#2)#3{\begingroup
\@xArg #1\relax \@yArg #2\relax
\ifnum\@xArg<0 \@tempcntx=-#3 \else
\ifnum\@xArg>0 \@tempcntx=#3 \else \@tempcntx=0 \fi\fi
\@tempcnty=#3
\multiply\@tempcnty by\@yArg\relax
\ifnum\@tempcnty<0 \@tempcnty=-\@tempcnty\fi
\ifnum\@xArg<0 \@xArg=-\@xArg\fi
\ifnum\@xArg=0 \edef\RR{#3}\else
{\DIVIDE{\@tempcnty}{\@xArg}\RR}\fi
\@tempcnty=\RR%
\ifnum\@yArg<0 \ifnum\@tempcnty>0 \@tempcnty=-\@tempcnty\fi\fi
\drawline(0,0)(\the\@tempcntx,\the\@tempcnty)%
\endgroup}
\RequirePackage{epic}%
\newif\ifsizereduction \sizereductionfalse
\def\reduced@line(#1,#2)#3{\ifsizereduction
\ifdim\unitlength<0.1pt \LineTemp(#1,#2){#3}\else
\@ldline(#1,#2){#3}\fi
\else\@ldline(#1,#2){#3}\fi}
\let\line=\reduced@line
\def\@changeunitlength#1{\unitlength=#1\relax
\ifdim\unitlength<0.1pt \sizereductiontrue
\ifdim\unitlength<0.062pt \let\substfontsize=\tiny \else
\ifdim\unitlength<0.072pt \let\substfontsize=\scriptsize \else
\ifdim\unitlength<0.082pt \let\substfontsize=\footnotesize
\fi\fi\fi
\else\let\substfontsize=\normalsize
\fi}
\let\changeunitlength=\@changeunitlength
\def\reducedsizepicture{%
\@ifnextchar[{\reduced@picture}{\reduced@picture[0.1pt]}}
\def\reduced@picture[#1]{%
\sizereductiontrue
\let\sfpicture=\picture
\let\endsfpicture=\endpicture
\let\Put@Direct=\put
\let\Multiput@Direct=\multiput
\let\thicklines=\@ldthicklines
\let\thinlines=\@ldthinlines
\let\line=\reduced@line
\let\dotorline=\d@t@rline
\let\Put@Line=\Put@@Line
\let\Put@sCircle=\Put@@sCircle
\let\Put@oCircle=\Put@@oCircle
\xymtexpsswfalse
\let\changeunitlength=\@changeunitlength
\changeunitlength{#1}}
\reducedsizepicture%size-reduction setting
\let\oldlineslope=\lineslope%used only in the manual
\def\lineslope(#1,#2){%
\begingroup
\ifdim #1 <0pt \@xdim= -#1 \else\@xdim=#1\fi
\ifdim #2 <0pt \@ydim= -#2 \else\@ydim=#2\fi
\multiply\@xdim by10\relax%by S. Fujita 2001/6/20
\multiply\@ydim by10\relax%by S. Fujita 2001/6/20
\ifdim\@xdim >\@ydim \@tempdima=\@xdim \@xdim=\@ydim \@ydim=\@tempdima
\@flippedargstrue\else\@flippedargsfalse\fi% x < y
\ifdim\@ydim >1pt \@tempcntx=\@ydim
            \divide\@tempcntx by 65536% now \@tempcntx=integral part of #1.
            \divide\@xdim \@tempcntx\fi
\ifdim\@xdim <.083333pt \@xarg=1 \@yarg=0
 \else\ifdim\@xdim <.183333pt \@xarg=6 \@yarg=1
 \else\ifdim\@xdim <.225pt  \@xarg=5 \@yarg=1
 \else\ifdim\@xdim <.291666pt  \@xarg=4 \@yarg=1
 \else\ifdim\@xdim <.366666pt  \@xarg=3 \@yarg=1
 \else\ifdim\@xdim <.45pt  \@xarg=5 \@yarg=2
 \else\ifdim\@xdim <.55pt  \@xarg=2 \@yarg=1
 \else\ifdim\@xdim <.633333pt  \@xarg=5 \@yarg=3
 \else\ifdim\@xdim <.708333pt  \@xarg=3 \@yarg=2
 \else\ifdim\@xdim <.775pt  \@xarg=4 \@yarg=3
 \else\ifdim\@xdim <.816666pt  \@xarg=5 \@yarg=4
 \else\ifdim\@xdim <.916666pt  \@xarg=6 \@yarg=5
       \else \@xarg=1 \@yarg=1%
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\if@flippedargs\relax\else\@tempcntx=\@xarg \@xarg=\@yarg
  \@yarg=\@tempcntx\fi
\ifdim #1 <0pt \global\@xarg= -\@xarg\else\global\@xarg= \@xarg\fi
\ifdim #2 <0pt \global\@yarg= -\@yarg\else\global\@yarg= \@yarg\fi
%%\typeout{closest slope integers = \the\@xarg, \the\@yarg}
\endgroup}
\endinput
%%
%% End of file `sizeredc.sty'.