% \iffalse meta-comment
%% File: bondcolor.dtx
%
%  Copyright 2010 by Shinsaku Fujita
%
%  This file is part of XyMTeX system.
%  -------------------------------------
%
% This file (bondcolor.sty) is a successor to:
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \typeout{XyMTeX for Drawing Chemical Structural Formulas. Version 1.00}
% \typeout{       -- Released December 1, 1993 by Shinsaku Fujita}
% Copyright (C) 1993 by Shinsaku Fujita, all rights reserved.
%
% 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 bondcolor.dtx and bondcolor.ins
% and the derived file lewisstruc.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
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{bondcolor}
% \def\versi@ndate{October 01, 2010}
% \def\versi@nno{ver5.00}
% \def\copyrighth@lder{SF}% Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \fi
%
% \CheckSum{960}
%% \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{v5.00}{2010/10/01}{First release for XyMTeX5.00}
% \fi
%
% \iffalse
%<*driver>
\NeedsTeXFormat{pLaTeX2e}
% \fi
\ProvidesFile{bondcolor.dtx}[2010/10/01 v5.00 bondcolor package file]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{lewisstruc.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{Bond Coloring by {\sffamily bondcolor.sty} 
(\fileversion) of \XyMTeX{}}
\author{Shinsaku Fujita \\ 
Shonan Institute of Chemoinformatics and 
Mathematical Chemistry \\
Kanagawa, 258-0019 Japan 
}
\date{\filedate}
%
\begin{document}
   \maketitle
   \DocInput{bondcolor.dtx}
\end{document}
%</driver>
% \fi
%
% \section{Introduction}\label{bondcolor:intro}
%
% \subsection{Options for {\sffamily docstrip}}
%
% \DeleteShortVerb{\|}
% \begin{center}
% \begin{tabular}{|l|l|}
% \hline
% \emph{option} & \emph{function}\\ \hline
% bondcolor & bondcolor.sty \\
% driver & driver for this dtx file \\
% \hline
% \end{tabular}
% \end{center}
% \MakeShortVerb{\|}
%
% \subsection{Version Information}
%
%    \begin{macrocode}
%<*bondcolor>
\typeout{Part of XyMTeX for Drawing Chemical Structural Formulas. Version 5.00}
\typeout{       -- Released October 01, 2010 by Shinsaku Fujita}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\j@urnalname{bondcolor}
\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}
%
%    \begin{macrocode}
\RequirePackage{chemstr}
\RequirePackage{hetarom}
\RequirePackage{hetaromh}
\RequirePackage{methylen}
%    \end{macrocode}
%
% \section{Substitution Bond Coloring}
%
% \begin{macro}{\ifcolorBLsw}
% A switch |\ifcolorBLsw| is introduced to judging whether the present process 
% is in BONDLIST or in ATOMLIST.  
% 
%    \begin{macrocode}
\newif\ifcolorBLsw \colorBLswfalse
%    \end{macrocode}
% \end{macro}
% 
% The macro |\RightAtomBond| is defined to color substitution bonds (and substituents), 
% when it is to be designated in ATOMLIST or in BONDLIST of a command for drawing 
% a structural formula.  
%
% \begin{verbatim}
%   \RightAtomBond(x,y)[COLOR]<CLIPPING>{SUBSTLIST}
% \end{verbatim}
%
% The first optional argument (x,y) represents increments of x-, and y-coordinates, 
% which may be added if adjustment is necessary. The default value is (0,0). 
% The second optional argument [COLOR] is a command of coloring (e.g., |\red|). 
% The default value is |\black|. 
% The third optional argument <CLIPPING> accomodates \verb/<s>/ for non-clipping and 
% a vacant or omitted argument represents a clipping of a corner. 
% The defalt value is a vacant value. 
% The fourth argument is a SUBSLIST, in which a substitution number 1--8 represents 
% a bond slope to be drawn. Slopes to cover a right-handed half circle are numbered 
% on a similar line to those of the |\ryl| macro, as follows: 
% \begin{verbatim}
%     SLOPE    
%       
%       1      : (0,1)
%       2      : (3,5)
%       3      : (1,1)
%       4      : (1,0)
%       5      : (5,-3)
%       6      : (1,-1)
%       7      : (3,-5)
%       8      : (0,-1)
% \end{verbatim}
% As for the format of the SUBSLIST, see the specification of the |\ryl| command. 
%
% \begin{macro}{\RightAtomBond}
% \begin{macro}{\Right@tomBond}
% \begin{macro}{\Right@tomB@nd}
% \begin{macro}{\Right@t@mB@nd}
%    \begin{macrocode}
\def\RightAtomBond{%
\@ifnextchar({\Right@tomBond}{\Right@tomBond(0,0)}}
\def\Right@tomBond(#1,#2){%
\@ifnextchar[{\Right@tomB@nd(#1,#2)}{\Right@tomB@nd(#1,#2)[\black]}}
\def\Right@tomB@nd(#1,#2)[#3]{%
\@ifnextchar<{\Right@t@mB@nd(#1,#2)[#3]}{\Right@t@mB@nd(#1,#2)[#3]<>}}
\def\Right@t@mB@nd(#1,#2)[#3]<#4>#5{%
\begingroup
\global\let\FuseWarning=\futileFuseWarning
\let\setbscolor=#3\relax
\@ifundefined{@tmpb}{\edef\@tmpb{0}}{}%dummy
\@ifundefined{@@tmpa}{\colorBLswfalse}{\if\@@tmpa @\relax\else
\edef\@@tmpa{a}\colorBLswtrue\fi}%enforced setting
%\@tempcntXa=\z@ \@tempcntYa=\z@
\@tempcntXa=#1\relax \@tempcntYa=#2\relax
\if\@tmpb s\relax
  \@clipfusefalse
\else
 \if#4s\relax
  \@clipfusefalse
 \else
   \ifcolorBLsw
     \@clipfusetrue
     \advance\@tempcntXa by5\relax%tentative value
     \advance\@tempcntYa by-15\relax%tentative value
   \colorBLswfalse
  \else
   \@clipfusetrue
   \advance\@tempcntXa by40\relax%tentative value
   \advance\@tempcntYa by38\relax%tentative value
\fi\fi\fi
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting substituents %
% %%%%%%%%%%%%%%%%%%%%%%%%
\@forsemicol\member:=#5\do{%
\ifx\member\empty\else%
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\let\local@tmpa=\@tmpa%global to local 2002/5/30 by SF
\ifcase\local@tmpa%
\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{{\setbscolor\setatombonda}\addbscolor{}{}}%2010/10/01% 0 (upward) (0,1)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondF}\addbscolor{}{}}%2010/10/01%%1 (3,5)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondA}\addbscolor{}{}}%2010/10/01%%2 (1,1)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondf}\addbscolor{}{}}%2010/10/01%%3 (5,3)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondb}\addbscolor{}{}}%2010/10/01%%4 (1,0)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombonde}\addbscolor{}{}}%2010/10/01%%5 (5,-3)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondB}\addbscolor{}{}}%2010/10/01%\or%6 (1,-1)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondE}\addbscolor{}{}}%2010/10/01%%7 (3,-5)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondc}\addbscolor{}{}}%2010/10/01%%8 (0,-1)
\fi%end of ifcase
\fi}\endgroup}%end of definition of \RightAtomBond 
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% The macro |\LeftAtomBond| is defined to color substitution bonds (and substituents), 
% when it is to be designated in ATOMLIST or in BONDLIST of a command for drawing 
% a structural formula.  
%
% \begin{verbatim}
%   \LeftAtomBond(x,y)[COLOR]<CLIPPING>{SUBSTLIST}
% \end{verbatim}
%
% The first optional argument (x,y) represents increments of x-, and y-coordinates, 
% which may be added if adjustment is necessary. The default value is (0,0). 
% The second optional argument [COLOR] is a command of coloring (e.g., |\red|). 
% The default value is |\black|. 
% The third optional argument <CLIPPING> accomodates \verb/<s>/ for non-clipping and 
% a vacant or omitted argument represents a clipping of a corner. 
% The defalt value is a vacant value. 
% The fourth argument is a SUBSLIST, in which a substitution number 1--8 represents 
% a bond slope to be drawn. Slopes to cover a left-handed half circle are numbered 
% on a similar line to those of the |\lyl| macro, as follows: 
%
% \begin{verbatim}
%     SLOPE 
%       1      : (0,1)
%       2      : (-3,5)
%       3      : (-1,1)
%       4      : (-1,0)
%       5      : (-5,-3)
%       6      : (-1,-1)
%       7      : (-3,-5)
%       8      : (0,-1)
% \end{verbatim}
% As for the format of the SUBSLIST, see the specification of the |\lyl| command. 
%
% \begin{macro}{\LeftAtomBond}
% \begin{macro}{\Left@tomBond}
% \begin{macro}{\Left@tomB@nd}
% \begin{macro}{\Left@t@mB@nd}
%    \begin{macrocode}
\def\LeftAtomBond{%
\@ifnextchar({\Left@tomBond}{\Left@tomBond(0,0)}}
\def\Left@tomBond(#1,#2){%
\@ifnextchar[{\Left@tomB@nd(#1,#2)}{\Left@tomB@nd(#1,#2)[\black]}}
\def\Left@tomB@nd(#1,#2)[#3]{%
\@ifnextchar<{\Left@t@mB@nd(#1,#2)[#3]}{\Left@t@mB@nd(#1,#2)[#3]<>}}
\def\Left@t@mB@nd(#1,#2)[#3]<#4>#5{%
\begingroup
\global\let\FuseWarning=\futileFuseWarning
\let\setbscolor=#3\relax
\@ifundefined{@tmpb}{\edef\@tmpb{0}}{}%dummy
\@ifundefined{@@tmpa}{\colorBLswfalse}{\if\@@tmpa @\relax\else
\edef\@@tmpa{a}\colorBLswtrue\fi}%enforced setting
%\@tempcntXa=\z@ \@tempcntYa=\z@
\@tempcntXa=#1\relax \@tempcntYa=#2\relax
\if\@tmpb s\relax
  \@clipfusefalse
\else
 \if#4s\relax
  \@clipfusefalse
 \else
   \ifcolorBLsw
     \@clipfusetrue
     \advance\@tempcntXa by5\relax%tentative value
     \advance\@tempcntYa by-15\relax%tentative value
   \colorBLswfalse
  \else
   \@clipfusetrue
   \advance\@tempcntXa by40\relax%tentative value
   \advance\@tempcntYa by38\relax%tentative value
\fi\fi\fi
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting substituents %
% %%%%%%%%%%%%%%%%%%%%%%%%
\@forsemicol\member:=#5\do{%
\ifx\member\empty\else%
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\let\local@tmpa=\@tmpa%global to local 2002/5/30 by SF
\ifcase\local@tmpa%
\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{{\setbscolor\setatombonda}\addbscolor{}{}}%2010/10/01% 0 (upward) (0,1)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondD}\addbscolor{}{}}%2010/10/01%%1 (-3,5)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondH}\addbscolor{}{}}%2010/10/01%%2 (-1,1)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondd}\addbscolor{}{}}%2010/10/01%%3 (-5,3)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondh}\addbscolor{}{}}%2010/10/01%%4 (-1,0)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondg}\addbscolor{}{}}%2010/10/01%%5 (-5,-3)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondC}\addbscolor{}{}}%2010/10/01%%6 (-1,-1)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondG}\addbscolor{}{}}%2010/10/01%%7 (-3,-5)
\or{\setbscolor\Put@Direct(\the\@tempcntXa,\the\@tempcntYa)%
{\setatombondc}\addbscolor{}{}}%2010/10/01%%8 (0,-1)
\fi%end of ifcase
\fi}\endgroup}%end of definition of \LeftAtomBond 
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \section{Double Bond Coloring}
% 
% \begin{macro}{\addvbonda etc.}
% Basic commands \verb/\addvbonda/ etc. are used to add 
% colored double bonds in commands of 
% drawing six-membered vertical-type structural formulas, where 
% the letter \texttt{v} of \texttt{add--v--bond--a} means a vertical type. 
% The suffix \texttt{a} is a bond specifier. 
%    \begin{macrocode}
\def\addvbonda{\put(0,-406){\bonda}}
\def\addvbondb{\put(-171,-303){\bondb}}
\def\addvbondc{\put(-171,-103){\bondc}}
\def\addvbondd{\put(0,0){\bondd}}
\def\addvbonde{\put(171,-103){\bonde}}
\def\addvbondf{\put(171,-303){\bondf}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\addvibonda etc.}
% Basic commands \verb/\addvibonda/ etc. are used to add 
% colored double bonds in commands of 
% drawing six-membered inverse-vertical-type structural formulas, 
% where the letter \texttt{vi} 
% of \texttt{add--vi--bond--a} means an inverse vertical type. 
% The suffix \texttt{a} is a bond specifier. 
%    \begin{macrocode}
\def\addvibonda{\put(0,0){\bondc}}
\def\addvibondb{\put(-171,-103){\bondb}}
\def\addvibondc{\put(-171,-303){\bonda}}
\def\addvibondd{\put(0,-406){\bondf}}
\def\addvibonde{\put(171,-303){\bonde}}
\def\addvibondf{\put(171,-103){\bondd}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\addhbonda etc.}
% Basic commands \verb/\addhbonda/ etc. are used to add 
% colored double bonds in commands of 
% drawing six-membered horizontal-type structural formulas, 
% where the letter \texttt{h} 
% of \texttt{add--h--bond--a} means a horizontal type. 
% The suffix \texttt{a} is a bond specifier. 
%    \begin{macrocode}
\def\addhbonda{\put(0,0){\hbonda}}
\def\addhbondb{\put(-103,-171){\hbondb}}
\def\addhbondc{\put(-303,-171){\hbondc}}
\def\addhbondd{\put(-406,0){\hbondd}}
\def\addhbonde{\put(-303,171){\hbonde}}
\def\addhbondf{\put(-103,171){\hbondf}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\addhibonda etc.}
% Basic commands \verb/\addhibonda/ etc. are used to add 
% colored double bonds in commands of 
% drawing six-membered inverse horizontal-type structural formulas, 
% where the letter \texttt{hi} 
% of \texttt{add--hi--bond--a} means an inverse horizontal type. 
% The suffix \texttt{a} is a bond specifier. 
%    \begin{macrocode}
\def\addhibonda{\put(-403,0){\hbondc}}
\def\addhibondb{\put(-303,-171){\hbondb}}
\def\addhibondc{\put(-103,-171){\hbonda}}
\def\addhibondd{\put(0,0){\hbondf}}
\def\addhibonde{\put(-103,171){\hbonde}}
\def\addhibondf{\put(-303,171){\hbondd}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\addvvbonda etc.}
% Basic commands \verb/\addvvbonda/ etc. are used to add 
% colored double bonds in commands of 
% drawing five-membered vertical-type structural formulas, where 
% the first letter \texttt{v} of \texttt{add--v--v--bond--a} means 
% a five-membered ring (roman numeral) and the latter \texttt{v} 
% means a vertical type. 
% The suffix \texttt{a} is a bond specifier. 
%    \begin{macrocode}
\def\addvvbonda{\put(0,0){\bondc}}
\def\addvvbondb{\put(-171,-103){\bondb}}
\def\addvvbondc{\put(-171,-103){\bondhoriz}}
\def\addvvbondd{\put(171,-303){\bonde}}
\def\addvvbonde{\put(171,-103){\bondd}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\addvvibonda etc.}
% Basic commands \verb/\addvvibonda/ etc. are used to add 
% colored double bonds in commands of 
% drawing five-membered inverse vertical-type structural formulas, where 
% the first letter \texttt{v} of \texttt{add--v--vi--bond--a} means 
% a five-membered ring (roman numeral) and the latter \texttt{vi} 
% means an inverse vertical type. The suffix \texttt{a} is a bond specifier. 
%    \begin{macrocode}
\def\addvvibonda{\put(0,-406){\bonda}}
\def\addvvibondb{\put(-171,-303){\bondb}}
\def\addvvibondc{\put(-171,-103){\bondhorizi}}
\def\addvvibondd{\put(171,-103){\bonde}}
\def\addvvibonde{\put(171,-303){\bondf}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\addvhbonda etc.}
% Basic commands \verb/\addvhbonda/ etc. are used to add 
% colored double bonds in commands of 
% drawing five-membered horizontal-type structural formulas, where 
% the first letter \texttt{v} of \texttt{add--v--h--bond--a} means 
% a five-membered ring (roman numeral) and the latter \texttt{h} 
% means a horizontal type. 
% The suffix \texttt{a} is a bond specifier. 
%    \begin{macrocode}
\def\addvhbonda{\put(-403,0){\hbondc}}
\def\addvhbondb{\put(-303,-171){\hbondb}}
\def\addvhbondc{\put(-303,-171){\hbondvert}}
%\def\addvhbondd{\put(0,0){\hbondf}}
\def\addvhbondd{\put(-103,171){\hbonde}}
\def\addvhbonde{\put(-303,171){\hbondd}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\addvhibonda etc.}
% Basic commands \verb/\addvhibonda/ etc. are used to add 
% colored double bonds in commands of 
% drawing five-membered inverse horizontal-type structural formulas, where 
% the first letter \texttt{v} of \texttt{add--v--hi--bond--a} means 
% a five-membered ring (roman numeral) and the latter \texttt{hi} 
% means an inverse horizontal type. The suffix \texttt{a} is a bond specifier. 
%    \begin{macrocode}
\def\addvhibonda{\put(0,0){\hbonda}}
\def\addvhibondb{\put(-103,-171){\hbondb}}
\def\addvhibondc{\put(-303,-171){\hbondverti}}
%\def\addvhibondd{\put(-406,0){\hbondd}}
\def\addvhibondd{\put(-303,171){\hbonde}}
\def\addvhibonde{\put(-103,171){\hbondf}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\MethyleneBonda etc.}
% Basic commands \verb/\MethyleneBonda/ etc. are used to add 
% colored double bonds in commands of drawing dimethylene to decamethylene units 
% of normal type, where the suffix \texttt{a}, etc. are bond specifiers. 
%    \begin{macrocode}
\def\MethyleneBonda{\Put@Direct(171,-303){\bondA}}
\def\MethyleneBondb{\Put@Direct(0,-406){\bondB}}
\def\MethyleneBondc{\Put@Direct(171,-303){\bondA}}
\def\MethyleneBondd{\Put@Direct(0,-406){\bondB}}
\def\MethyleneBonde{\Put@Direct(171,-303){\bondA}}
\def\MethyleneBondf{\Put@Direct(0,-406){\bondB}}
\def\MethyleneBondg{\Put@Direct(171,-303){\bondA}}
\def\MethyleneBondh{\Put@Direct(0,-406){\bondB}}
\def\MethyleneBondi{\Put@Direct(171,-303){\bondA}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\MethyleneBondA etc.}
% Basic commands \verb/\MethyleneBondA/ etc. are used to add 
% colored double bonds in commands of drawing dimethylene to decamethylene units 
% of normal type, where the suffix \texttt{A}, etc. are bond specifiers. 
% A double bond corresponding to the suffix \texttt{A} appears an alternate side 
% the counterpart due to the suffix \texttt{a}. 
%    \begin{macrocode}
\def\MethyleneBondA{\Put@Direct(0,-406){\bondAA}}
\def\MethyleneBondB{\Put@Direct(-171,-303){\bondBB}}
\def\MethyleneBondC{\Put@Direct(0,-406){\bondAA}}
\def\MethyleneBondD{\Put@Direct(-171,-303){\bondBB}}
\def\MethyleneBondE{\Put@Direct(0,-406){\bondAA}}
\def\MethyleneBondF{\Put@Direct(-171,-303){\bondBB}}
\def\MethyleneBondG{\Put@Direct(0,-406){\bondAA}}
\def\MethyleneBondH{\Put@Direct(-171,-303){\bondBB}}
\def\MethyleneBondI{\Put@Direct(0,-406){\bondAA}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\MethyleneiBonda etc.}
% Basic commands \verb/\MethyleneiBonda/ etc. are used to add 
% colored double bonds in commands of drawing dimethylene to decamethylene units 
% of inverse type, where the suffix \texttt{a}, etc. are bond specifiers. 
%    \begin{macrocode}
\def\MethyleneiBonda{\Put@Direct(171,-103){\bondAi}}
\def\MethyleneiBondb{\Put@Direct(0,0){\bondBi}}
\def\MethyleneiBondc{\Put@Direct(171,-103){\bondAi}}
\def\MethyleneiBondd{\Put@Direct(0,0){\bondBi}}
\def\MethyleneiBonde{\Put@Direct(171,-103){\bondAi}}
\def\MethyleneiBondf{\Put@Direct(0,0){\bondBi}}
\def\MethyleneiBondg{\Put@Direct(171,-103){\bondAi}}
\def\MethyleneiBondh{\Put@Direct(0,0){\bondBi}}
\def\MethyleneiBondi{\Put@Direct(171,-103){\bondAi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\MethyleneiBondA etc.}
% Basic commands \verb/\MethyleneiBondA/ etc. are used to add 
% colored double bonds in commands of drawing dimethylene to decamethylene units 
% of inverse type, where the suffix \texttt{A}, etc. are bond specifiers. 
% A double bond corresponding to the suffix \texttt{A} appears an alternate side 
% the counterpart due to the suffix \texttt{a}. 
%    \begin{macrocode}
\def\MethyleneiBondA{\Put@Direct(0,0){\bondAAi}}
\def\MethyleneiBondB{\Put@Direct(-171,-103){\bondBBi}}
\def\MethyleneiBondC{\Put@Direct(0,0){\bondAAi}}
\def\MethyleneiBondD{\Put@Direct(-171,-103){\bondBBi}}
\def\MethyleneiBondE{\Put@Direct(0,0){\bondAAi}}
\def\MethyleneiBondF{\Put@Direct(-171,-103){\bondBBi}}
\def\MethyleneiBondG{\Put@Direct(0,0){\bondAAi}}
\def\MethyleneiBondH{\Put@Direct(-171,-103){\bondBBi}}
\def\MethyleneiBondI{\Put@Direct(0,0){\bondAAi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adddbcolor}
% The user command \verb/\adddbcolor/ is used to specify a color of 
% a double bond to be changed. The first argument specifies types of 
% structures to be drawn by designating \texttt{v}, \texttt{vi}, etc. 
% The vacant argument and \texttt{i} correspond to polymethylene units 
% defined in \textsf{methylen} package. 
% The second argument specifies a color to be changed. 
% The command \verb/\adddbcolor/ is placed in a bond list. 
%    \begin{macrocode}
\def\adddbcolor#1#2{%
\global\let\FuseWarning=\futileFuseWarning
\global\@dbondcolortrue
\edef\@@tmpBondSp{#1}%
\edef\@@tmpBondSpi{i}%
\ifx\@@tmpBondSp\empty\relax%\tetrahemethylene etc.
{\Put@Direct(0,0){#2\expandafter\csname MethyleneBond\@@tmpa\endcsname}}%
\else\ifx\@@tmpBondSp\@@tmpBondSpi\relax%\tetramethyleni etc.
{\Put@Direct(0,0){#2\csname MethyleneiBond\@@tmpa\endcsname}}%
\else
{\Put@Direct(0,0){#2\csname add#1bond\@@tmpa\endcsname}}%
\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \section{Skeletal Bond Coloring}
%
% \begin{macro}{\addskbcolor}
% The user command \verb/\addskbcolor/ is used to specify a color of 
% a skeletal bond to be changed. The first argument specifies types of 
% structures to be drawn by designating \texttt{v}, \texttt{h}, etc. 
% The second argument specifies a color to be changed. 
% The command \verb/\addskbcolor/ is placed in a skeletal bond list. 
%    \begin{macrocode}
\def\addskbcolor#1#2{%
\iflongskbond
{#2\expandafter\csname\skbondreplace\endcsname}%
\else 
\if#1\empty\relax
{#2\expandafter\csname skbond\skbondreplace\endcsname}%
\else\if#1v\relax
{#2\expandafter\csname skbond\skbondreplace\endcsname}%
\else
{#2\expandafter\csname #1skbond\skbondreplace\endcsname}%
\fi\fi\fi%
\global\let\FuseWarning=\futileFuseWarning%for methylen package
\global\@dbondcolortrue%for heterarom and heteraromh packages
}
%
%\def\addskbcolor#1#2{%
%      \edef\@@tmpsBondSp{#1}%
%      \edef\@@tmpsBondSpv{v}%
%\iflongskbond
%{#2\expandafter\csname\skbondreplace\endcsname}%
%\else 
%\ifx\@@tmpsBondSp\empty\relax
%{#2\expandafter\csname skbond\skbondreplace\endcsname}%
%\else\ifx\@@tmpsBondSp\@@tmpsBondSpv\relax
%{#2\expandafter\csname skbond\skbondreplace\endcsname}%
%\else
%{#2\expandafter\csname #1skbond\skbondreplace\endcsname}%
%\fi\fi\fi%
%\global\let\FuseWarning=\futileFuseWarning%for methylen package
%\global\@dbondcolortrue%for heterarom and heteraromh packages
%}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\red etc.}
% \changes{v5.00}{2010/10/01}{Colors for TeX/LaTeX mode}
%    \begin{macrocode}
\def\red{\color{red}}
\def\blue{\color{blue}}
\def\green{\color{green}}
\def\black{\color{black}}
\def\cyan{\color{cyan}}
\def\yellow{\color{yellow}}
\def\magenta{\color{magenta}}
\def\white{\color{white}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xymcolor}
% \begin{macro}{\red etc.}
% These macros are defined to avoid \texttt{**Warning** color stack underflow} 
% during processing by the dvipdfmx converter. 
% \changes{v5.00}{2010/10/01}{Added: Colors for TeX/LaTeX mode}
%    \begin{macrocode}
\def\xymcolor#1#2{\mbox{\color{#1}#2}}
\def\redx#1{\xymcolor{red}{#1}}
\def\bluex#1{\xymcolor{blue}{#1}}
\def\greenx#1{\xymcolor{green}{#1}}
\def\blackx#1{\xymcolor{black}{#1}}
\def\cyanx#1{\xymcolor{cyan}{#1}}
\def\yellowx#1{\xymcolor{yellow}{#1}}
\def\magentax#1{\xymcolor{magenta}{#1}}
\def\whitex#1{\xymcolor{white}{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\Color@@Line}
% \begin{macro}{\Color@Line}
% \changes{v5.00}{2010/10/01}{Colors for TeX/LaTeX mode}
% The |\Color@Line| macro is used to erase an old line by setting color to be white. 
%    \begin{macrocode}
\def\Color@@Line{%
\@ifnextchar[{\C@lor@@Line}{\C@lor@@Line[0.4pt]}}
\def\C@lor@@Line[#1](#2,#3)(#4,#5)#6#7{%
\begingroup
\@tempdima=#1\relax
\ifdim\@tempdima=0.4pt\else
\XyMTeXWarning{The line width is ineffective for TeX/LaTeX mode}%
\fi
\put(0,0){\csname #7\endcsname \Put@Line(#2,#3)(#4,#5){#6}}%
\endgroup}%end of \Color@@Line
\let\Color@Line=\Color@@Line%for TeX/LaTeX mode
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\replaceSKbond}
% The user command \verb/\replaceSKbond/ is used to specify a color of 
% a skeletal bond to be changed. The first optional argument specifies 
% the bond width to be changed if necessary. 
% The arguments in the first pair of parentheses specify the original point. 
% The arguments in the second pair of parentheses specify the slope e.g., (5,3). 
% The next argument indicates the projection length to the x-axis. 
% The last argument indicates a color to be applied. 
% The command \verb/\replaceSKbond/ is placed in a bond list. 
%    \begin{macrocode}
\def\replaceSKbond{%
\@ifnextchar[{\repl@ceSKbond}{\repl@ceSKbond[0.4pt]}}
\def\repl@ceSKbond[#1](#2,#3)(#4,#5)#6#7{\begingroup%
\global\let\FuseWarning=\futileFuseWarning
\global\@dbondcolortrue
\def\thinLineWidth{#1}%
\@tempdima=#1 \advance\@tempdima by1.2pt
\put(0,0){\Color@Line[\the\@tempdima](#2,#3)(#4,#5){#6}{white}}%
\put(0,0){#7\Put@Line(#2,#3)(#4,#5){#6}}\endgroup}%
%
%\def\replaceSKbond{%
%\@ifnextchar[{\repl@ceSKbond}{\repl@ceSKbond[0.4pt]}}
%\def\repl@ceSKbond[#1](#2,#3)(#4,#5)#6#7{\begingroup%
%\global\let\FuseWarning=\futileFuseWarning
%\global\@dbondcolortrue
%\def\thinLineWidth{#1}%
%\@tempdima=#1 \advance\@tempdima by1.2pt
%\put(0,0){\edef\thinLineWidth{\the\@tempdima}\white\Put@Line(#2,#3)(#4,#5){#6}}%
%\put(0,0){#7\Put@Line(#2,#3)(#4,#5){#6}}\endgroup}%
%
\endinput
%</bondcolor>
%    \end{macrocode}
% \end{macro}
%
% \Finale
%
\endinput
