| 1 |
% \iffalse meta-comment |
| 2 |
%% File: sizeredc.dtx |
| 3 |
% |
| 4 |
% Copyright 1996, 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 sizeredc.dtx and sizeredc.ins |
| 37 |
% and the derived file sizeredc.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{sizeredc} |
| 52 |
% \def\versi@ndate{June 12, 2001} |
| 53 |
% \def\versi@nno{ver1.00} |
| 54 |
% \def\copyrighth@lder{SF} % Shinsaku Fujita |
| 55 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 56 |
% \def\j@urnalname{sizeredc} |
| 57 |
% \def\versi@ndate{April 30, 2002} |
| 58 |
% \def\versi@nno{ver1.01} |
| 59 |
% \def\copyrighth@lder{SF} % Shinsaku Fujita |
| 60 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 61 |
% \def\j@urnalname{sizeredc} |
| 62 |
% \def\versi@ndate{August 30, 2004} |
| 63 |
% \def\versi@nno{ver4.01} |
| 64 |
% \def\copyrighth@lder{SF} % Shinsaku Fujita |
| 65 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 66 |
% |
| 67 |
% \fi |
| 68 |
% |
| 69 |
% \CheckSum{428} |
| 70 |
%% \CharacterTable |
| 71 |
%% {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 |
| 72 |
%% 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 |
| 73 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 74 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 75 |
%% Dollar \$ Percent \% Ampersand \& |
| 76 |
%% Acute accent \' Left paren \( Right paren \) |
| 77 |
%% Asterisk \* Plus \+ Comma \, |
| 78 |
%% Minus \- Point \. Solidus \/ |
| 79 |
%% Colon \: Semicolon \; Less than \< |
| 80 |
%% Equals \= Greater than \> Question mark \? |
| 81 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 82 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 83 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 84 |
%% Right brace \} Tilde \~} |
| 85 |
% |
| 86 |
% \setcounter{StandardModuleDepth}{1} |
| 87 |
% |
| 88 |
% \StopEventually{} |
| 89 |
% \MakeShortVerb{\|} |
| 90 |
% |
| 91 |
% \iffalse |
| 92 |
% \changes{v1.00}{2001/06/12}{first edition for LaTeX2e} |
| 93 |
% \changes{v1.01}{2002/04/30}{2nd edition for XyMTeX v3.00} |
| 94 |
% \changes{v4.01}{2004/08/30}{Adjust XyMTeX v4.01} |
| 95 |
% \changes{v5.00}{2010/10/01}{the LaTeX Project Public License} |
| 96 |
% \fi |
| 97 |
% |
| 98 |
% \iffalse |
| 99 |
%<*driver> |
| 100 |
\NeedsTeXFormat{pLaTeX2e} |
| 101 |
% \fi |
| 102 |
\ProvidesFile{sizeredc.dtx}[2010/10/01 v5.00 XyMTeX{} package file] |
| 103 |
% \iffalse |
| 104 |
\documentclass{ltxdoc} |
| 105 |
\GetFileInfo{sizeredc.dtx} |
| 106 |
% |
| 107 |
% %%XyMTeX Logo: Definition 2%%% |
| 108 |
\def\UPSILON{\char'7} |
| 109 |
\def\XyM{X\kern-.30em\smash{% |
| 110 |
\raise.50ex\hbox{\UPSILON}}\kern-.30em{M}} |
| 111 |
\def\XyMTeX{\XyM\kern-.1em\TeX} |
| 112 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 113 |
\title{Size Reduction of Structural Formulas |
| 114 |
by {\sffamily sizeredc.sty} (\fileversion) of \XyMTeX{}} |
| 115 |
\author{Shinsaku Fujita \\ |
| 116 |
Shonan Institute of Chemoinformatics and Mathematical Chemistry, \\ |
| 117 |
Kaneko 479-7 Ooimachi, Ashigara-Kami-Gun, Kanagawa 250-0019 Japan |
| 118 |
% % (old address) |
| 119 |
% %Department of Chemistry and Materials Technology, \\ |
| 120 |
% %Kyoto Institute of Technology, \\ |
| 121 |
% %Matsugasaki, Sakyoku, Kyoto, 606-8585 Japan |
| 122 |
% %% (old address) |
| 123 |
% %% Ashigara Research Laboratories, |
| 124 |
% %% Fuji Photo Film Co., Ltd., \\ |
| 125 |
% %% Minami-Ashigara, Kanagawa, 250-01 Japan |
| 126 |
} |
| 127 |
\date{\filedate} |
| 128 |
% |
| 129 |
\begin{document} |
| 130 |
\maketitle |
| 131 |
\DocInput{sizeredc.dtx} |
| 132 |
\end{document} |
| 133 |
%</driver> |
| 134 |
% \fi |
| 135 |
% |
| 136 |
% \section{Introduction}\label{sizeredc:intro} |
| 137 |
% |
| 138 |
% \subsection{Options for {\sffamily docstrip}} |
| 139 |
% |
| 140 |
% \DeleteShortVerb{\|} |
| 141 |
% \begin{center} |
| 142 |
% \begin{tabular}{|l|l|} |
| 143 |
% \hline |
| 144 |
% \emph{option} & \emph{function}\\ \hline |
| 145 |
% sizeredc & sizeredc.sty \\ |
| 146 |
% driver & driver for this dtx file \\ |
| 147 |
% \hline |
| 148 |
% \end{tabular} |
| 149 |
% \end{center} |
| 150 |
% \MakeShortVerb{\|} |
| 151 |
% |
| 152 |
% \subsection{Version Information} |
| 153 |
% |
| 154 |
% \begin{macrocode} |
| 155 |
%<*sizeredc> |
| 156 |
\typeout{XyMTeX for Drawing Chemical Structural Formulas. Version 5.00} |
| 157 |
\typeout{ -- Released October 01, 2010 by Shinsaku Fujita} |
| 158 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 159 |
\def\j@urnalname{sizeredc} |
| 160 |
\def\versi@ndate{October 01, 2010} |
| 161 |
\def\versi@nno{ver5.00} |
| 162 |
\def\copyrighth@lder{SF} % Shinsaku Fujita |
| 163 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 164 |
\typeout{XyMTeX Macro File `\j@urnalname' (\versi@nno) <\versi@ndate>% |
| 165 |
\space[\copyrighth@lder]} |
| 166 |
% \end{macrocode} |
| 167 |
% |
| 168 |
% \section{Macros for Size Reduction} |
| 169 |
% \subsection{Division of Integers} |
| 170 |
% |
| 171 |
% \begin{macro}{\DIVIDE} |
| 172 |
% The macro |\DIVIDE| is used to the devision of an integer |
| 173 |
% by a divisor. The result (rounded to an integer) is stored |
| 174 |
% in a control sequence such as |\Quatient|. |
| 175 |
% \begin{verbatim} |
| 176 |
% \DIVDE{integer}{divisor}\Quatient |
| 177 |
% \end{verbatim} |
| 178 |
% |
| 179 |
% \begin{macrocode} |
| 180 |
\newcount\@tempcntx \newcount\@tempcnty \newcount\@tempcntz |
| 181 |
\newif\ifseifuflag \seifuflagfalse |
| 182 |
\def\DIVIDE#1#2#3{% |
| 183 |
\seifuflagfalse \@tempcntx=#1 |
| 184 |
\ifnum\@tempcntx<0 \@tempcntx=-\@tempcntx\seifuflagtrue\fi |
| 185 |
\divide\@tempcntx by#2\relax |
| 186 |
\ifnum\@tempcntx<0 \@tempcntx=-\@tempcntx |
| 187 |
\ifseifuflag \seifuflagfalse \else \seifuflagtrue\fi\fi |
| 188 |
\@tempcntz=\@tempcntx%%store |
| 189 |
\@tempcnty=\@tempcntx \multiply\@tempcnty by#2% |
| 190 |
\ifnum\@tempcnty<0 \@tempcnty=-\@tempcnty\fi |
| 191 |
\@tempcntx=#1% |
| 192 |
\ifnum\@tempcntx<0 \@tempcntx=-\@tempcntx\fi |
| 193 |
\advance\@tempcntx by-\@tempcnty% |
| 194 |
\multiply\@tempcntx by10 \edef\s{\the\@tempcntx}% |
| 195 |
\divide\@tempcntx by#2 |
| 196 |
\ifnum\@tempcntx<0 \@tempcntx=-\@tempcntx\fi |
| 197 |
\ifnum\@tempcntx>4\relax \advance\@tempcntz by1\fi |
| 198 |
\ifseifuflag \xdef#3{-\the\@tempcntz}% |
| 199 |
\else\xdef#3{\the\@tempcntz}\fi} |
| 200 |
% \end{macrocode} |
| 201 |
% \end{macro} |
| 202 |
% |
| 203 |
% \subsection{Size Reduction of Formulas} |
| 204 |
% |
| 205 |
% \begin{macro}{\LineTemp} |
| 206 |
% The macro |\LineTemp| is used to redefine the |\line| commond of |
| 207 |
% the \LaTeXe{} picture environment. Thereby, the macro |
| 208 |
% |\LineTemp(a,b){c}| is transformed into the macro |
| 209 |
% |\drawline(0,0)(c, ca/b)| for epic.sty, where |ca/b| is |
| 210 |
% calculated by the macro |\DIVIDE| defined above. |
| 211 |
% |
| 212 |
% \begin{macrocode} |
| 213 |
\newcount\@xArg \newcount\@yArg |
| 214 |
\def\LineTemp(#1,#2)#3{\begingroup |
| 215 |
\@xArg #1\relax \@yArg #2\relax |
| 216 |
\ifnum\@xArg<0 \@tempcntx=-#3 \else |
| 217 |
\ifnum\@xArg>0 \@tempcntx=#3 \else \@tempcntx=0 \fi\fi |
| 218 |
\@tempcnty=#3 |
| 219 |
\multiply\@tempcnty by\@yArg\relax |
| 220 |
\ifnum\@tempcnty<0 \@tempcnty=-\@tempcnty\fi |
| 221 |
\ifnum\@xArg<0 \@xArg=-\@xArg\fi |
| 222 |
\ifnum\@xArg=0 \edef\RR{#3}\else |
| 223 |
{\DIVIDE{\@tempcnty}{\@xArg}\RR}\fi |
| 224 |
\@tempcnty=\RR% |
| 225 |
\ifnum\@yArg<0 \ifnum\@tempcnty>0 \@tempcnty=-\@tempcnty\fi\fi |
| 226 |
\drawline(0,0)(\the\@tempcntx,\the\@tempcnty)% |
| 227 |
\endgroup} |
| 228 |
% \end{macrocode} |
| 229 |
% \end{macro} |
| 230 |
% |
| 231 |
% The if-phrase |\ifsizereduction| is to determine whether |
| 232 |
% size-reduction is carried out or not. |
| 233 |
% Then, |\LineTemp| is substituted for the original |\line| |
| 234 |
% if |\sizereductiontrue| is declared and if |\unitlength| |
| 235 |
% is smaller than 0.1pt. |
| 236 |
% |
| 237 |
% \begin{macro}{\line} |
| 238 |
% \begin{macro}{\ifsizereduction} |
| 239 |
% \begin{macrocode} |
| 240 |
\RequirePackage{epic}% |
| 241 |
\newif\ifsizereduction \sizereductionfalse |
| 242 |
%\let\@ldline=\line |
| 243 |
\def\reduced@line(#1,#2)#3{\ifsizereduction |
| 244 |
\ifdim\unitlength<0.1pt \LineTemp(#1,#2){#3}\else |
| 245 |
\@ldline(#1,#2){#3}\fi |
| 246 |
\else\@ldline(#1,#2){#3}\fi} |
| 247 |
\let\line=\reduced@line |
| 248 |
% \end{macrocode} |
| 249 |
% \end{macro} |
| 250 |
% \end{macro} |
| 251 |
% |
| 252 |
% The command |\changeunitlength| is used to set |\unitlength| |
| 253 |
% and to declare |\sizereductiontrue| |
| 254 |
% if |\unitlength| is smaller than 0.1pt. |
| 255 |
% The font size of substituents is changed by |\substfontsize| |
| 256 |
% according to the size reduction. |
| 257 |
% |
| 258 |
% \changes{v4.00}{2002/5/30}{Added: \cs{substfontsize}} |
| 259 |
% |
| 260 |
% \begin{macro}{\@changeunitlength} |
| 261 |
% \begin{macrocode} |
| 262 |
\def\@changeunitlength#1{\unitlength=#1\relax |
| 263 |
\ifdim\unitlength<0.1pt \sizereductiontrue |
| 264 |
\ifdim\unitlength<0.062pt \let\substfontsize=\tiny \else |
| 265 |
\ifdim\unitlength<0.072pt \let\substfontsize=\scriptsize \else |
| 266 |
\ifdim\unitlength<0.082pt \let\substfontsize=\footnotesize |
| 267 |
\fi\fi\fi |
| 268 |
\else\let\substfontsize=\normalsize |
| 269 |
\fi} |
| 270 |
\let\changeunitlength=\@changeunitlength |
| 271 |
% \end{macrocode} |
| 272 |
% \end{macro} |
| 273 |
% |
| 274 |
% The reduced setting is the original LaTeX picture environment but |
| 275 |
% include the size-reduction mechanism. |
| 276 |
% To switch the size-reduction meachism and the pstricks mechanism, |
| 277 |
% we can use a switching command such as |\originalpicture|. |
| 278 |
% \changes{v3.00}{2002/4/30}{New environment: sfpicture} |
| 279 |
% |
| 280 |
% \begin{macro}{\reducedsizepicture} |
| 281 |
% \begin{macrocode} |
| 282 |
\def\reducedsizepicture{% |
| 283 |
\@ifnextchar[{\reduced@picture}{\reduced@picture[0.1pt]}} |
| 284 |
\def\reduced@picture[#1]{% |
| 285 |
\sizereductiontrue |
| 286 |
\let\sfpicture=\picture |
| 287 |
\let\endsfpicture=\endpicture |
| 288 |
\let\Put@Direct=\put |
| 289 |
\let\Multiput@Direct=\multiput |
| 290 |
\let\thicklines=\@ldthicklines |
| 291 |
\let\thinlines=\@ldthinlines |
| 292 |
\let\line=\reduced@line |
| 293 |
\let\dotorline=\d@t@rline |
| 294 |
\let\Put@Line=\Put@@Line |
| 295 |
\let\Put@sCircle=\Put@@sCircle |
| 296 |
\let\Put@oCircle=\Put@@oCircle |
| 297 |
\xymtexpsswfalse |
| 298 |
\let\changeunitlength=\@changeunitlength |
| 299 |
\changeunitlength{#1}} |
| 300 |
\reducedsizepicture%size-reduction setting |
| 301 |
% \end{macrocode} |
| 302 |
% \end{macro} |
| 303 |
% |
| 304 |
% |
| 305 |
% The command |\lineslope| of epic.sty has been redefined |
| 306 |
% to give a more precise result. |
| 307 |
% |
| 308 |
% \begin{macro}{\lineslope} |
| 309 |
% \begin{macrocode} |
| 310 |
\let\oldlineslope=\lineslope%used only in the manual |
| 311 |
\def\lineslope(#1,#2){% |
| 312 |
\begingroup |
| 313 |
\ifdim #1 <0pt \@xdim= -#1 \else\@xdim=#1\fi |
| 314 |
\ifdim #2 <0pt \@ydim= -#2 \else\@ydim=#2\fi |
| 315 |
%\typeout{LLL= \the#1, \the#2} |
| 316 |
\multiply\@xdim by10\relax%by S. Fujita 2001/6/20 |
| 317 |
\multiply\@ydim by10\relax%by S. Fujita 2001/6/20 |
| 318 |
%\typeout{xdim,ydim= \the\@xdim, \the\@ydim} |
| 319 |
\ifdim\@xdim >\@ydim \@tempdima=\@xdim \@xdim=\@ydim \@ydim=\@tempdima |
| 320 |
\@flippedargstrue\else\@flippedargsfalse\fi% x < y |
| 321 |
\ifdim\@ydim >1pt \@tempcntx=\@ydim |
| 322 |
\divide\@tempcntx by 65536% now \@tempcntx=integral part of #1. |
| 323 |
\divide\@xdim \@tempcntx\fi |
| 324 |
%\typeout{xdim: \the\@xdim}% |
| 325 |
\ifdim\@xdim <.083333pt \@xarg=1 \@yarg=0 |
| 326 |
\else\ifdim\@xdim <.183333pt \@xarg=6 \@yarg=1 |
| 327 |
\else\ifdim\@xdim <.225pt \@xarg=5 \@yarg=1 |
| 328 |
\else\ifdim\@xdim <.291666pt \@xarg=4 \@yarg=1 |
| 329 |
\else\ifdim\@xdim <.366666pt \@xarg=3 \@yarg=1 |
| 330 |
\else\ifdim\@xdim <.45pt \@xarg=5 \@yarg=2 |
| 331 |
\else\ifdim\@xdim <.55pt \@xarg=2 \@yarg=1 |
| 332 |
\else\ifdim\@xdim <.633333pt \@xarg=5 \@yarg=3 |
| 333 |
\else\ifdim\@xdim <.708333pt \@xarg=3 \@yarg=2 |
| 334 |
\else\ifdim\@xdim <.775pt \@xarg=4 \@yarg=3 |
| 335 |
\else\ifdim\@xdim <.816666pt \@xarg=5 \@yarg=4 |
| 336 |
\else\ifdim\@xdim <.916666pt \@xarg=6 \@yarg=5 |
| 337 |
\else \@xarg=1 \@yarg=1% |
| 338 |
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi |
| 339 |
\if@flippedargs\relax\else\@tempcntx=\@xarg \@xarg=\@yarg |
| 340 |
\@yarg=\@tempcntx\fi |
| 341 |
\ifdim #1 <0pt \global\@xarg= -\@xarg\else\global\@xarg= \@xarg\fi |
| 342 |
\ifdim #2 <0pt \global\@yarg= -\@yarg\else\global\@yarg= \@yarg\fi |
| 343 |
%%\typeout{closest slope integers = \the\@xarg, \the\@yarg} |
| 344 |
\endgroup} |
| 345 |
%</sizeredc> |
| 346 |
% \end{macrocode} |
| 347 |
% \end{macro} |
| 348 |
% |
| 349 |
% \Finale |
| 350 |
% |
| 351 |
\endinput |