% ccycle.sty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\typeout{XyMTeX for Drawing Chemical Structural Formulas. Version 1.00}
\typeout{       -- Released December 1, 1993 by Shinsaku Fujita}
\typeout{}
% 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].  
%
% Copying of this file is authorized only if either
%  (1) you make absolutely no changes to your copy, including name and 
%     directory name; or
%  (2) if you do make changes, 
%     (a) you name it something other than the names included in the 
%         ``xymtex'' directory and 
%     (b) you are requested to leave this notice intact.
% This restriction ensures that all standard styles are identical.
%
% Please report any bugs, comments, suggestions, etc. to:
%   Shinsaku Fujita, 
%   Ashigara Research Laboratories, Fuji Photo Film Co., Ltd., 
%   Minami-Ashigara, Kanagawa-ken, 250-01, Japan.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\j@urnalname{ccycle}
\def\versi@ndate{December 01, 1993}
\def\versi@nno{ver1.00}
\def\copyrighth@lder{SF} % Shinsaku Fujita
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\typeout{XyMTeX Macro File `\j@urnalname' (\versi@nno) <\versi@ndate>\space%
 [\copyrighth@lder]}
%
% ********************************
% * ccycle.sty: list of commands *
% ********************************
%
%  Setting of Bonds
%
%     \@chaira (for cyclohexane chair)
%     \@chairb
%     \@chairc
%     \@chaird
%     \@chaire
%     \@chairf
%
%     \@borna (for bornanes)
%     \@bornb
%     \@bornc
%     \@bornd
%     \@borne
%     \@bornf
%     \@borng
%
%  Basic Macros
%
%     \chair                     \@chair
%     \bicychepv                 \@bicychepv
%     \bicycheph                 \@bicycheph
%     \bornane                   \@bornane
%     \adamantane                \@damantane
%
% *************************
% * input of basic macros *
% *************************
\@ifundefined{setsixringv}{\input chemstr.sty\relax}{}
\unitlength=0.1pt
% **********************************************
% * treatment of the chair form of cyclohexane *
% **********************************************
%%%%%%%%%%%%%%%
% subst. on 1 %
%%%%%%%%%%%%%%%
\def\@chaira{%
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
           \put(0,0){\line(-1,1){120}}% single bond at 1
           \putlatom{-130}{110}{\@memberb}% left type
    \else\if\@tmpc a%(a) axial
           \put(0,0){\line(0,1){168}}% single bond at 1 axial
           \putlratom{-42}{180}{\@memberb}% left & right type
    \else\if\@tmpc e%(e) beta
           \put(0,0){\line(-5,-3){144}}% single bond at 1 equatorial
           \putlatom{-160}{-130}{\@memberb}% left type
    \fi\fi\fi%
   \else \if\@tmpb D%double bond
           \putlatom{-130}{110}{\@memberb}% left type
           \put(-10,-10){\line(-1,1){120}}% double bond at 1
           \put(10,10){\line(-1,1){120}}% double bond at 1
          \else%
           \putlatom{-130}{110}{\@memberb}% left type
           \put(0,0){\line(-1,1){120}}% single bond at 1
   \fi\fi}%
%%%%%%%%%%%%%%%
% subst. on 2 %
%%%%%%%%%%%%%%%
\def\@chairb{%
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
           \put(170,-226){\line(-1,-1){120}}% single bond at 2
           \putlatom{40}{-416}{\@memberb}% left type
    \else\if\@tmpc a%(a) axial
           \put(170,-226){\line(0,-1){168}}% single bond at 2 axial
           \putlratom{138}{-486}{\@memberb}% left & right type
    \else\if\@tmpc e%(e) beta
           \put(170,-226){\line(-5,3){144}}% single bond at 2 equatorial
           \putlatom{10}{-174}{\@memberb}% left type
    \fi\fi\fi%
   \else \if\@tmpb D%double bond
           \putlatom{40}{-416}{\@memberb}% left type
           \put(160,-216){\line(-1,-1){120}}% double bond at 2
           \put(180,-236){\line(-1,-1){120}}% double bond at 2
          \else%
           \putlatom{40}{-416}{\@memberb}% left type
           \put(170,-226){\line(-1,-1){120}}% single bond at 2
   \fi\fi}%
%%%%%%%%%%%%%%%
% subst. on 3 %
%%%%%%%%%%%%%%%
\def\@chairc{%
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
           \put(573,-91){\line(5,4){170}}% single bond at 3
           \putratom{753}{21}{\@memberb}% right type
    \else\if\@tmpc a%(a) axial
           \put(573,-91){\line(0,1){168}}% single bond at 3 axial
           \putlratom{533}{101}{\@memberb}% left type
    \else\if\@tmpc e%(e) beta
           \put(573,-91){\line(5,-3){144}}% single bond at 3 equatorial
           \putlatom{753}{-260}{\@memberb}% left type
    \fi\fi\fi%
   \else \if\@tmpb D%double bond
           \putratom{733}{41}{\@memberb}% right type
           \put(563,-83){\line(5,4){170}}% double bond at 3
           \put(583,-99){\line(5,4){170}}% double bond at 3
          \else%
           \put(573,-91){\line(5,4){170}}% single bond at 3
           \putratom{753}{21}{\@memberb}% right type
   \fi\fi}%
%%%%%%%%%%%%%%%
% subst. on 4 %
%%%%%%%%%%%%%%%
\def\@chaird{%
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
           \put(843,-181){\line(1,-1){120}}% single bond at 4
           \putratom{953}{-371}{\@memberb}% right type
    \else\if\@tmpc a%(a) axial
           \put(843,-181){\line(0,-1){168}}% single bond at 4 axial
           \putlratom{801}{-440}{\@memberb}% left & right type
    \else\if\@tmpc e%(e) beta
           \put(843,-181){\line(5,3){144}}% single bond at 4 equatorial
           \putratom{1003}{-111}{\@memberb}% right type
    \fi\fi\fi%
   \else \if\@tmpb D%double bond
           \putratom{953}{-371}{\@memberb}% right type
           \put(833,-191){\line(1,-1){120}}% double bond at 4
           \put(853,-171){\line(1,-1){120}}% double bond at 4
          \else%
           \put(843,-181){\line(1,-1){120}}% single bond at 4
           \putratom{953}{-371}{\@memberb}% right type
   \fi\fi}%
%%%%%%%%%%%%%%%
% subst. on 5 %
%%%%%%%%%%%%%%%
\def\@chaire{%
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
           \put(673,46){\line(1,1){120}}% single bond at 5
           \putratom{803}{158}{\@memberb}% right type
    \else\if\@tmpc a%(a) axial
           \put(673,46){\line(0,1){168}}% single bond at 5 axial
           \putlratom{633}{238}{\@memberb}% left & right type
    \else\if\@tmpc e%(e) beta
           \put(673,46){\line(5,-3){144}}% single bond at 5 equatorial
           \putratom{823}{-103}{\@memberb}% right type
    \fi\fi\fi%
   \else \if\@tmpb D%double bond
           \putratom{803}{158}{\@memberb}%  right type
           \put(663,53){\line(1,1){120}}% double bond at 5
           \put(683,38){\line(1,1){120}}% double bond at 5
          \else%
           \put(673,46){\line(5,4){170}}% single bond at 5
           \putratom{853}{158}{\@memberb}% right type
   \fi\fi}%
%%%%%%%%%%%%%%%
% subst. on 6 %
%%%%%%%%%%%%%%%
\def\@chairf{%
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
           \put(270,-90){\line(-5,-4){170}}% single bond at 2
           \putlatom{100}{-280}{\@memberb}% left type
    \else\if\@tmpc a%(a) axial
           \put(270,-90){\line(0,-1){168}}% single bond at 2 axial
           \putlratom{238}{-350}{\@memberb}% left type
    \else\if\@tmpc e%(e) beta
           \put(270,-90){\line(-5,3){144}}% single bond at 2 equatorial
           \putratom{100}{18}{\@memberb}% left type
    \fi\fi\fi%
   \else \if\@tmpb D%double bond
           \putlatom{100}{-280}{\@memberb}% left or right type
           \put(260,-80){\line(-5,-4){170}}% double bond at 2
           \put(280,-100){\line(-5,-4){170}}% double bond at 2
          \else%
           \putlatom{100}{-280}{\@memberb}% left type
           \put(270,-90){\line(-5,-4){170}}% single bond at 2
   \fi\fi}%
%
% ***************************
% * cyclohexane derivatives *
% *  (chair type)           *
% ***************************
% The following numbering is adopted in this macro. 
%
%          6            4
%       *      `  5  *
%     1  *  2        *
%              `  3
%
%   \chair[BONDLIST]{SUBSLIST}          
%
%     BONDLIST = 
%
%           none       :  cyclohexane
%           a          :  1,2-double bond
%           b          :  2,3-double bond
%           c          :  4,3-double bond
%           d          :  4,5-double bond
%           e          :  5,6-double bond
%           f          :  6,1-double bond
%
%     SUBSLIST: list of substituents (max 8 substitution positions)
%
%       for n = 1 to 6 
%
%           nD         :  exocyclic double bond at n-atom
%           nSa        :  axial single bond at n-atom
%           nSe        :  equatorial single bond at n-atom
%
%       e.g. 
%        
%        \chair{1==Cl;2==F}
%        \chair[a]{1==Cl;4==F;2==CH$_{3}$}
%        \chair[eb]{1D==O;4Se==MeO;4Sa==OMe;5==Cl;6==Cl}
%
\def\chair{\@ifnextchar[{\@chair}{\@chair[r]}}
\def\@chair[#1]#2{%
% skeletal bonds
 \begin{picture}(1200,800)(-400,-240)
  \iforigpt \put(-400,-240){\circle*{50}}%
           \put(0,0){\circle{50}}% 
   \typeout{command `chair' origin: (0,0) ---> (400,240)}
  \fi%
   \thicklines%
      \put(0,0){\line(3,-4){170}}%          % bond 1 to 2
      \put(170,-226){\line(3,1){403}}%      %      2 to 3
      \put(573,-91){\line(3,-1){270}}%      %      3 to 4
   \thinlines%
      \put(843,-181){\line(-3,4){170}}%     %      4 to 5
      \put(673,46){\line(-3,-1){403}}%      %      5 to 6
%      \put(270,-90){\line(3,1){403}}%      %      6 to 5
      \put(0,0){\line(3,-1){270}}%          %      1 to 6
% inner double bonds
\@tfor\member:=#1\do{%
\if\member r%no endcyclic bonds
\else \if\member a%
      \put(76,-42){\line(3,-4){110}}%       % double bond 1 to 2
\else \if\member b%
      \put(200,-186){\line(3,1){343}}%      %             2 to 3
\else \if\member c%
      \put(603,-70){\line(3,-1){190}}%      %             3 to 4
\else \if\member d%
      \put(780,-141){\line(-3,4){110}}%     %             4 to 5
\else \if\member e%
      \put(661,6){\line(-3,-1){343}}%       %             5 to 6
\else \if\member f%
      \put(75,-50){\line(3,-1){170}}%       %             1 to 6
\fi\fi\fi\fi\fi\fi\fi}%
%%
\@forsemicol\member:=#2\do{\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\ifcase\@tmpa%0 omit
 \or \@chaira% subst. on 1
 \or \@chairb% subst. on 2
 \or \@chairc% subst. on 3
 \or \@chaird% subst. on 4
 \or \@chaire% subst. on 5
 \or \@chairf% subst. on 6
\fi %end of ifcase
}\end{picture}}%               %end of \chair macro
%
% *************************************
% * bicyclo[2.2.1]heptane derivatives *
% *  (flat, vertical type)            *
% *************************************
% The following numbering is adopted in this macro. 
%
%          1
%          * 
%     6  *   *  2
%       |  7  |
%       |     |
%     5  *   *  3
%          *
%          4 <===== the original point
%
%   \bicychepv[BONDLIST]{SUBSLIST}          
%
%     BONDLIST = 
%
%           none       :  cyclohexane
%           a          :  1,2-double bond
%           b          :  2,3-double bond
%           c          :  4,3-double bond
%           d          :  4,5-double bond
%           e          :  5,6-double bond
%           f          :  6,1-double bond
%           A          :  aromatic circle 
%           7          :  7,7-dimethyl
%
%     SUBSLIST: list of substituents (max 8 substitution positions)
%
%       for n = 1 to 6 
%
%           nD         :  exocyclic double bond at n-atom
%           n or nS    :  exocyclic single bond at n-atom
%           nA         :  alpha single bond at n-atom
%           nB         :  beta single bond at n-atom
%           nSA        :  alpha single bond at n-atom (boldface)
%           nSB        :  beta single bond at n-atom (dotted line)
%           nSa        :  alpha (not specified) single bond at n-atom
%           nSb        :  beta (not specifed) single bond at n-atom
%
%       e.g. 
%        
%        \bicychepv{1==Cl;2==F}
%        \bicychepv[c]{1==Cl;4==F;2==CH$_{3}$}
%        \bicychepv[eb]{1D==O;4SA==MeO;4SB==OMe;5W==Cl;6==Cl;7==Cl;8==Cl}
%
\def\bicychepv{\@ifnextchar[{\@bicychepv}{\@bicychepv[r]}}
\def\@bicychepv[#1]#2{%
 \begin{picture}(800,880)(-400,-240)
  \iforigpt \put(-400,-240){\circle*{50}}%
           \put(0,0){\circle{50}}% 
   \typeout{command `bicychepv' origin: (0,0) ---> (400,240)}
  \fi%
  \put(0,406){\line(-5,-3){171}}%       %bond 1-6
  \put(0,406){\line(5,-3){171}}%        %bond 1-2
  \put(0,0){\line(-5,3){171}}%          %bond 4-5
  \put(0,0){\line(5,3){171}}%           %bond 4-3
  \put(171,103){\line(0,1){200}}%       %bond 3-2
  \put(-171,103){\line(0,1){200}}%      %bond 5-6
{\thicklines%
  \put(0,0){\line(1,4){51}}%            %bond 4-7
  \put(0,406){\line(1,-4){51}}}%         %bond 1-7
\@tfor\member:=#1\do{%
\if\member r%no endcyclic double bonds
\else \if\member a%
  \put(6,364){\line(5,-3){126}}%        %double bond 1-2
\else \if\member b%
  \put(138,129){\line(0,1){148}}%       %double bond 3-2
\else \if\member c%
  \put(6,42){\line(5,3){126}}%          %double bond 4-3
\else \if\member d%
  \put(-6,42){\line(-5,3){126}}%        %double bond 4-5
\else \if\member e%
  \put(-138,129){\line(0,1){148}}%      %double bond 5-6
\else \if\member f%
  \put(-6,364){\line(-5,-3){126}}%      %double bond 1-6
\else \if\member 7%
 {\thicklines%
  \put(51,204){\line(-1,0){70}}%        %7,7-dimethyl
  \put(51,204){\line(1,0){70}}}%      
\else \if\member A%aromatic circle 
  \put(0,203){\circle{240}}%            %circle
\fi\fi\fi\fi\fi\fi\fi\fi\fi}%
%%
\setsixringv{#2}{0}{0}{7}{0}
\end{picture}}               %end of \bicychepv macro
%
% *************************************
% * bicyclo[2.2.1]heptane derivatives *
% *  (flat, horizontal type)          *
% *************************************
% The following numbering is adopted in this macro. 
%
%                                2      3
%                                 -----
%                               *       *
%   the original point ===> 1 *     7     * 4
%          (0,0)                *       *
%                                 -----
%                                6      5
%
%   \bicycheph[BONDLIST]{SUBSLIST}          
%
%     BONDLIST = 
%
%           none       :  cyclohexane
%           a          :  1,2-double bond
%           b          :  2,3-double bond
%           c          :  4,3-double bond
%           d          :  4,5-double bond
%           e          :  5,6-double bond
%           f          :  6,1-double bond
%           A          :  aromatic circle 
%
%     SUBSLIST: list of substituents (max 8 substitution positions)
%
%       for n = 1 to 6 
%
%           nD         :  exocyclic double bond at n-atom
%           n or nS    :  exocyclic single bond at n-atom
%           nA         :  alpha single bond at n-atom
%           nB         :  beta single bond at n-atom
%           nSA        :  alpha single bond at n-atom (boldface)
%           nSB        :  beta single bond at n-atom (dotted line)
%           nSa        :  alpha (not specified) single bond at n-atom
%           nSb        :  beta (not specifed) single bond at n-atom
%
%       e.g. 
%        
%        \bicycheph{1==Cl;2==F}
%        \bicycheph[c]{1==Cl;4==F;2==CH$_{3}$}
%        \bicycheph[eb]{1D==O;4SA==MeO;4SB==OMe;5W==Cl;6==Cl;7==Cl;8==Cl}
%
\def\bicycheph{\@ifnextchar[{\@bicycheph}{\@bicycheph[r]}}
\def\@bicycheph[#1]#2{%
 \begin{picture}(880,800)(-240,-400)
  \iforigpt \put(-240,-400){\circle*{50}}%
           \put(0,0){\circle{50}}% 
   \typeout{command `bicycheph' origin: (0,0) ---> (240,400)}
  \fi%
  \put(0,0){\line(3,5){103}}           %bond 1-2
  \put(0,0){\line(3,-5){103}}          %bond 1-6
  \put(406,0){\line(-3,5){103}}        %bond 4-3
  \put(406,0){\line(-3,-5){103}}       %bond 4-3
  \put(103,171){\line(1,0){200}}       %bond 2-3
  \put(103,-171){\line(1,0){200}}      %bond 6-5
{\thicklines%
  \put(0,0){\line(4,1){203}}%            %bond 4-7
  \put(406,0){\line(-4,1){203}}}%         %bond 1-7
\@tfor\member:=#1\do{%
\if\member r%no endcyclic double bonds
\else \if\member a%
  \put(42,6){\line(3,5){78}}           %double bond 1-2
\else \if\member b%
  \put(129,138){\line(1,0){148}}       %double bond 2-3
\else \if\member c%
  \put(364,6){\line(-3,5){78}}         %double bond 4-3
\else \if\member d%
  \put(364,-6){\line(-3,-5){78}}       %double bond 4-5
\else \if\member e%
  \put(129,-138){\line(1,0){148}}      %double bond 6-5
\else \if\member f%
  \put(42,-6){\line(3,-5){78}}         %double bond 1-6
\else \if\member 7%
 {\thicklines%
  \put(204,51){\line(0,-1){70}}%        %7,7-dimethyl
  \put(204,51){\line(0,1){70}}}%      
\else \if\member A%aromatic circle 
  \put(203,0){\circle{240}}            %circle
\fi\fi\fi\fi\fi\fi\fi\fi\fi}
%%
\setsixringh{#2}{0}{0}{7}{0}
\end{picture}}               %end of \bicycheph macro
%
% ***********************************************
% * setting bonds and substituents for bornanes *
% * (bicycloe[2.2.1]heptane derivatives)        *
% ***********************************************
%%%%%%%%%%%%%%%
% subst. on 1 %
%%%%%%%%%%%%%%%
\def\@borna{%
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
          \put(318,247){\line(2,5){40}}%      % single bond 1
           \putratom{350}{350}{\@memberb}%    % right type
    \else\if\@tmpc a%(a) alpha
          \put(318,247){\line(2,5){40}}%      % single bond 1
           \putratom{350}{350}{\@memberb}%    % right type
    \else\if\@tmpc b%(b) beta
          \put(318,247){\line(2,5){40}}%      % single bond 1
          \putratom{350}{350}{\@memberb}%     % right type
    \fi\fi\fi%
   \else%
          \put(318,247){\line(2,5){40}}%      % single bond 1
           \putratom{350}{350}{\@memberb}     % right type
   \fi}%
%%%%%%%%%%%%%%%
% subst. on 2 %
%%%%%%%%%%%%%%%
\def\@bornb{%
 \begin{picture}(200,200)(0,0)
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
           \put(0,0){\line(5,2){160}}% 
           \putratom{170}{44}{\@memberb}%      % left type
    \else\if\@tmpc A%(A) alpha
           \putratom{140}{115}{\@memberb}%     % right type
           {%
           \thicklines%
           \put(0,0){\line(4,3){140}}%         % endo (a)
           }%
    \else\if\@tmpc B%(B) beta
           \putratom{150}{-86}{\@memberb}%     % right type
       \@ifundefined{dottedline}{%
           \put(0,0){\line(5,-2){140}}%        % exo (b)
           }{{\thicklines%
              \dottedline{20}(0,0)(140,-56)}}%
    \else\if\@tmpc a%(a) alpha
           \put(0,0){\line(5,-2){140}}%        % endo (a)
           \putratom{150}{-86}{\@memberb}%     % right type
    \else\if\@tmpc b%(b) beta
           \put(0,0){\line(4,3){140}}%         % exo (b)
           \putratom{140}{115}{\@memberb}%     % right type
    \fi\fi\fi\fi\fi%
   \else \if\@tmpb D%double bond
           \put(-10,-15){\line(5,2){160}}% 
           \put(-5,15){\line(5,2){160}}% 
           \putratom{170}{44}{\@memberb}%      % right type
   \else \if\@tmpb A%alpha single bond
           \putratom{170}{44}{\@memberb}%      % right type
           {%
           \thicklines%
           \put(0,0){\line(5,2){160}}% 
           }%
   \else \if\@tmpb B%beta single bond
           \putratom{170}{44}{\@memberb}%      % right type
       \@ifundefined{dottedline}{%
           \put(0,0){\line(5,2){160}}% 
           }{{\thicklines%
              \dottedline{20}(0,0)(160,64)}}%
   \else%
           \put(0,0){\line(5,2){160}}% 
           \putratom{170}{44}{\@memberb}%      % right type
   \fi\fi\fi\fi\end{picture}}%
%%%%%%%%%%%%%%%
% subst. on 3 %
%%%%%%%%%%%%%%%
\def\@bornc{%
 \begin{picture}(200,200)(0,0)
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
           \put(0,0){\line(5,-2){140}}%
           \putratom{150}{-86}{\@memberb}%    % right type
    \else\if\@tmpc A%(A) alpha
           \putratom{150}{26}{\@memberb}%     % right type
           {%
           \thicklines%
           \put(0,0){\line(5,2){140}}%        % endo (a)
           }%
    \else\if\@tmpc B%(B) beta
           \putratom{140}{-145}{\@memberb}%   % right type
       \@ifundefined{dottedline}{%
           \put(0,0){\line(4,-3){140}}%       % exo (b)
           }{{\thicklines%
              \dottedline{20}(0,0)(140,-105)}}%
    \else\if\@tmpc a%(a) alpha
           \put(0,0){\line(4,-3){140}}%       % endo (a)
           \putratom{140}{-145}{\@memberb}%   % right type
    \else\if\@tmpc b%(b) beta
           \put(0,0){\line(5,2){140}}%        % exo (b)
           \putratom{150}{26}{\@memberb}%     % right type
    \fi\fi\fi\fi\fi
   \else \if\@tmpb D%double bond
           \put(10,15){\line(5,-2){160}}% 
           \put(5,-15){\line(5,-2){160}}% 
           \putratom{170}{-124}{\@memberb}%   % right type
   \else \if\@tmpb A%alpha single bond
           \putratom{150}{-86}{\@memberb}%    % right type
           {%
           \thicklines%
           \put(0,0){\line(5,-2){140}}%       % endo (a)
           }%
   \else \if\@tmpb B%beta single bond
           \putratom{150}{-86}{\@memberb}%    % right type
       \@ifundefined{dottedline}{%
           \put(0,0){\line(5,-2){140}}%       % exo (b)
           }{{\thicklines%
              \dottedline{20}(0,0)(140,-56)}}%
   \else%
           \put(0,0){\line(5,2){160}}% 
           \putratom{170}{44}{\@memberb}%     % right type
   \fi\fi\fi\fi%
\end{picture}}%
%%%%%%%%%%%%%%%
% subst. on 4 %
%%%%%%%%%%%%%%%
\def\@bornd{%
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
          \put(237,47){\line(-2,-5){40}}%      % single bond 4
          \putlratom{167}{-140}{\@memberb}%    % left & right type
    \else\if\@tmpc a%(a) alpha
          \put(237,47){\line(-2,-5){40}}%      % single bond 4
          \putlratom{167}{-140}{\@memberb}%    % left & right type
    \else\if\@tmpc b%(b) beta
          \put(237,47){\line(-2,-5){40}}%      % single bond 4
          \putlratom{167}{-140}{\@memberb}%    % left & right type
    \fi\fi\fi%
   \else%
          \put(237,47){\line(-2,-5){40}}%      % single bond 4
          \putlratom{167}{-140}{\@memberb}%    % left & right type
   \fi}%
%%%%%%%%%%%%%%%
% subst. on 5 %
%%%%%%%%%%%%%%%
\def\@borne{%
 \begin{picture}(200,200)(0,0)
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
           \put(0,0){\line(-5,-2){140}}%
           \putlatom{-150}{-86}{\@memberb}%    % left type
    \else\if\@tmpc A%(A) alpha
           \putlatom{-150}{26}{\@memberb}%     % left type
           {%
           \thicklines%
           \put(0,0){\line(-5,2){140}}%        % endo (a)
           }%
    \else\if\@tmpc B%(B) beta
           \putlatom{-140}{-145}{\@memberb}%   % left type
       \@ifundefined{dottedline}{%
           \put(0,0){\line(-4,-3){140}}%       % exo (b)
           }{{\thicklines%
              \dottedline{20}(0,0)(-140,-105)}}%
    \else\if\@tmpc a%(a) alpha
           \put(0,0){\line(-4,-3){140}}%       % endo (a)
           \putlatom{-140}{-145}{\@memberb}%   % left type
    \else\if\@tmpc b%(b) beta
           \put(0,0){\line(-5,2){140}}%        % exo (b)
           \putlatom{-150}{26}{\@memberb}%     % left type
    \fi\fi\fi\fi\fi
   \else \if\@tmpb D%double bond
           \put(-10,15){\line(-5,-2){160}}% 
           \put(-5,-15){\line(-5,-2){160}}% 
           \putlatom{-170}{-124}{\@memberb}%   % left type
   \else \if\@tmpb A%alpha single bond
           \putlatom{-150}{-86}{\@memberb}%    % left type
           {%
           \thicklines%
           \put(0,0){\line(-5,-2){140}}%       % endo (a)
           }%
   \else \if\@tmpb B%beta single bond
           \putlatom{-150}{-86}{\@memberb}%    % left type
       \@ifundefined{dottedline}{%
           \put(0,0){\line(-5,-2){140}}%       % exo (b)
           }{{\thicklines%
              \dottedline{20}(0,0)(-140,-56)}}%
   \else%
           \put(0,0){\line(-5,2){160}}% 
           \putratom{-170}{44}{\@memberb}%     % left type
   \fi\fi\fi\fi%
\end{picture}}%
%%%%%%%%%%%%%%%
% subst. on 6 %
%%%%%%%%%%%%%%%
\def\@bornf{%
 \begin{picture}(200,200)(0,0)
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
           \put(0,0){\line(-5,2){160}}% 
           \putlatom{-170}{44}{\@memberb}%      % left type
    \else\if\@tmpc A%(A) alpha
           \putlatom{-140}{115}{\@memberb}%     % left type
           {%
           \thicklines%
           \put(0,0){\line(-4,3){140}}%         % endo (a)
           }%
    \else\if\@tmpc B%(B) beta
           \putlatom{-150}{-86}{\@memberb}%     % left type
       \@ifundefined{dottedline}{%
           \put(0,0){\line(-5,-2){140}}%        % exo (b)
           }{{\thicklines%
              \dottedline{20}(0,0)(-140,-56)}}%
    \else\if\@tmpc a%(a) alpha
           \put(0,0){\line(-5,-2){140}}%        % endo (a)
           \putlatom{-150}{-86}{\@memberb}%     % left type
    \else\if\@tmpc b%(b) beta
           \put(0,0){\line(-4,3){140}}%         % exo (b)
           \putlatom{-140}{115}{\@memberb}%     % left type
    \fi\fi\fi\fi\fi%
   \else \if\@tmpb D%double bond
           \put(10,-15){\line(-5,2){160}}% 
           \put(5,15){\line(-5,2){160}}% 
           \putlatom{-170}{44}{\@memberb}%      % left type
   \else \if\@tmpb A%alpha single bond
           \putlatom{-170}{44}{\@memberb}%      % left type
           {%
           \thicklines%
           \put(0,0){\line(-5,2){160}}% 
           }%
   \else \if\@tmpb B%beta single bond
           \putlatom{-170}{44}{\@memberb}%      % left type
       \@ifundefined{dottedline}{%
           \put(0,0){\line(-5,2){160}}% 
           }{{\thicklines%
              \dottedline{20}(0,0)(-160,64)}}%
   \else%
           \put(0,0){\line(-5,2){160}}% 
           \putlatom{-170}{44}{\@memberb}%      % left type
   \fi\fi\fi\fi\end{picture}}%
%%%%%%%%%%%%%%%
% subst. on 7 %
%%%%%%%%%%%%%%%
\def\@borng{%
 \begin{picture}(200,200)(0,0)
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
           \put(0,0){\line(0,1){160}}% 
           \putlratom{-40}{180}{\@memberb}%      % left & right type
    \else\if\@tmpc a%(a) left
           \put(0,0){\line(-4,3){140}}%          % left (a)
           \putlatom{-140}{115}{\@memberb}%      % left type
    \else\if\@tmpc b%(b) right
           \put(0,0){\line(4,3){140}}%           % right (b)
           \putratom{140}{115}{\@memberb}%       % right type
    \fi\fi\fi%\fi\fi%
   \else \if\@tmpb D%double bond
           \put(-10,0){\line(0,1){160}}% 
           \put(10,0){\line(0,1){160}}% 
           \putlratom{-40}{180}{\@memberb}%      % left & right type
   \else%
           \put(0,0){\line(0,1){160}}% 
           \putlratom{-40}{180}{\@memberb}%      % left & right type
   \fi\fi\end{picture}}%
%
% ***********************************************
% * bornane derivatives                         *
% * (bicycloe[2.2.1]heptane derivatives)        *
% ***********************************************
% The following numbering is adopted in this macro. 
%
%                7   g
%           f    / `
%            _  / - 1_ a
%     e    6  / h     - 2
%       *    /        *
%     5  -  4       * b
%        d     c` 3
%
%   \bornane[BONDLIST]{SUBSLIST}          
%
%     BONDLIST = 
%
%           none       :  cyclohexane
%           a          :  1,2-double bond
%           b          :  2,3-double bond
%           c          :  4,3-double bond
%           d          :  4,5-double bond
%           e          :  5,6-double bond
%           f          :  6,1-double bond
%           g          :  1,7-double bond
%           h          :  4,7-double bond
%
%
%     SUBSLIST: list of substituents (max 6 substitution positions)
%
%       for n = 1 to 6
%
%           nD         :  exocyclic double bond at n-atom
%           n or nS    :  exocyclic single bond at n-atom
%           nA         :  alpha single bond at n-atom
%           nB         :  beta single bond at n-atom
%           nSA        :  alpha single bond at n-atom (boldface)
%           nSB        :  beta single bond at n-atom (dotted line)
%           nSa        :  alpha single bond at n-atom
%           nSb        :  beta single bond at n-atom
% 
%       for n = 7 (bridge position)
%
%           nD         :  exocyclic double bond at 7-atom
%           n or nS    :  exocyclic single bond at 7-atom
%           nSa        :  left single bond at 7-atom
%           nSb        :  right single bond at 7-atom
%
%       e.g. 
%        
%        \bornane{1==N}{1==Cl;2==F}
%        \bornane[c]{1==N}{1==Cl;4==F;2==CH$_{3}$}
%        \bornane[eb]{1==N}{1D==O;4SA==MeO;4SB==OMe;5==Cl;6==Cl}
%
\def\bornane{\@ifnextchar[{\@bornane}{\@bornane[r]}}
\def\@bornane[#1]#2{%
 \begin{picture}(1400,1000)(-200,-240)
  \iforigpt \put(-200,-240){\circle*{50}}%
           \put(0,0){\circle{50}}% 
   \typeout{command `bornane' origin: (0,0) ---> (200,240)}
  \fi%
% skeletal bonds
 \thicklines%
  \put(0,0){\line(5,1){237}}%            % bond 5 to 4 (d)
  \put(237,47){\line(5,-2){225}}%        % bond 4 to 3 (c)
  \put(237,47){\line(0,1){400}}%         % front part of bridge (h)
 \thinlines%
  \put(462,-43){\line(2,5){80}}%         % bond 3 to 2 (b)
  \put(543,157){\line(-5,2){225}}%       % bond 2 to 1 (a)
  \put(318,247){\line(-5,-1){237}}%      % bond 1 to 6 (f)
  \put(80,200){\line(-2,-5){80}}%        % bond 6 to 5 (e)
  \put(318,247){\line(-2,5){80}}%        % back part of bridge (g)
% inner double bond
\@tfor\member:=#1\do{%
\if\member r%no endcyclic bonds
\else \if\member a%%%%
   \put(513,127){\line(-5,2){180}}%       % bond 2 to 1
\else \if\member b%%%%
   \put(446,-3){\line(2,5){60}}%          % bond 3 to 2
\else \if\member c%%%%
   \put(267,77){\line(5,-2){180}}%        % bond 4 to 3
\else \if\member d%%%%
   \put(40,42){\line(5,1){180}}%          % double bond 5 to 4
\else \if\member e%%%
   \put(100,180){\line(-2,-5){60}}%       % bond 6 to 5
\else \if\member f%
   \put(288,207){\line(-5,-1){180}}%      % bond 1 to 6
\else \if\member g%
  \put(288,260){\line(-2,5){40}}%         % back part of bridge (g)
\else \if\member h%
  \put(257,77){\line(0,1){290}}%          % front part of bridge (h)
\fi\fi\fi\fi\fi\fi\fi\fi\fi}%
%
\@forsemicol\member:=#2\do{\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\ifcase\@tmpa%0 omit
 \or \@borna% subst. on 1
 \or \put(543,157){\@bornb}% subst. on 2
 \or \put(462,-43){\@bornc}% subst. on 3
 \or \@bornd% subst. on 4
 \or \put(0,0){\@borne}% subst. on 5
 \or \put(80,200){\@bornf}% subst. on 6
 \or \put(237,440){\@borng}% subst. on 7
\fi %end of ifcase
}\end{picture}\iniatom\iniflag}     %end of \bornane macro
%
% *************************************************
% * For preparing adamantane derivatives          *
% *   with 4 substituents on bridgehead positions *
% *         (1, 3, 5 and 7)                       *
% *   with 12 substituents on bridge positions    *
% *         (2, 4, 6, 8, 9, 10)                   *
% *************************************************
%
%   \adamantane[BONDLIST]{SUBSLIST}          
%
%     BONDLIST: not effective
%
%     SUBSLIST: list of substituents (max 8 substitution positions)
%
%       for n = 1, 3, 5, and 7 (bridgeheads)
%
%           n or na    :  exocyclic single bond at n-atom
%
%       for n = 2, 4, 6, 8, 9, and 10 (bridges)
%
%           na         :  exocyclic single bond at n-atom (axial)
%           nb         :  exocyclic single bond at n-atom (equatorial)
%           nD         :  exocyclic double bond at n-atom (2 and 6)
%
%          For numbers larger than 9 (two digits), you should designate
%          the SUBSLIST as, e.g. 
%
%             {{11}a}==Cl;{{12}b}==H; ...
%
\def\adamantane{\@ifnextchar[{\@mantane}{\@damantane[Z]}}
\def\@damantane[#1]#2{%
%bonds for an adamantane skeleton
 \begin{picture}(1100,1300)(-550,-300)
  \iforigpt \put(-550,-300){\circle*{50}}%
           \put(0,0){\circle{50}}% 
   \typeout{command `adamantane' origin: (0,0) ---> (550,300)}
  \fi%
  \put(0,0){\line(-1,4){60}}%                      %bond 6-7
  \put(0,780){\line(2,-1){240}}%                   %bond 2-3
  \put(0,780){\line(-2,-1){240}}%                  %bond 2-1
  \put(-60,240){\line(-4,3){240}}%                 %bond 7-8
  \put(-300,420){\line(1,4){60}}%                  %bond 8-1
  \put(240,660){\line(-1,-4){60}}%                 %bond 3-10
  \put(-60,240){\line(4,3){240}}%                  %bond 10-7
{\thicklines%
  \put(300,420){\line(-1,4){60}}%                  %bond 4-3
  \put(-240,660){\line(1,-4){60}}%                 %bond 1-9
  \put(0,0){\line(1,4){60}}%                       %bond 6-5
  \put(60,240){\line(4,3){240}}%                   %bond 5-4
  \put(60,240){\line(-4,3){240}}%                  %bond 5-9
}%
%substituents
\@forsemicol\member:=#2\do{\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}\relax%
\ifcase\@tmpa%0 omit
%%%%%%%%%%%%%%%%
\or% subst. on 1
%%%%%%%%%%%%%%%%
   \put(-360,720){\hbox to0pt{\hss \@memberb}}%     %atom 1
 \if\@tmpb a%
   \put(-240,660){\line(-4,3){108}}%                %bond 1
  \else \ifx\@tmpb\empty%
   \put(-240,660){\line(-4,3){108}}%                %bond 1
 \fi\fi%
%%%%%%%%%%%%%%%%
\or% subst. on 2
%%%%%%%%%%%%%%%%
  \if\@tmpb a%
   \put(0,780){\line(1,4){26}}%                     %bond 2-ax
   \put(20,900){\hbox to0pt{\@memberb \hss}}%       %atom 2-ax
  \else \if\@tmpb b%
   \put(0,780){\line(-1,4){26}}%                    %bond 2-eq
   \put(-20,900){\hbox to0pt{\hss \@memberb}}%      %atom 2-eq
  \else \ifx\@tmpb\empty%
   \put(-42,910){\hbox to0pt{\hss \@memberb}}%      %atom 2
   \put(0,780){\line(0,1){108}}%                    %bond 2
  \else \if\@tmpb D%
   \putlratom{-42}{910}{\@memberb}%                 %atom 2
   \put(-12,780){\line(0,1){108}}%                  %double bond 2
   \put(12,780){\line(0,1){108}}%                   %double bond 2
 \fi\fi\fi\fi%
%%%%%%%%%%%%%%%%
\or% subst. on 3
%%%%%%%%%%%%%%%%
   \put(360,720){\hbox to0pt{\@memberb \hss}}%      %atom 3
  \if\@tmpb S%
   \put(240,660){\line(4,3){108}}%                  %bond 3
  \else \ifx\@tmpb\empty%
   \put(240,660){\line(4,3){108}}%                  %bond 3
 \fi\fi%
%%%%%%%%%%%%%%%%
\or% subst. on 4
%%%%%%%%%%%%%%%%
  \if\@tmpb a%
   \put(300,420){\line(4,-3){103}}%                 %bond 4-ax
   \put(420,310){\hbox to0pt{\@memberb \hss}}%      %atom 4-ax
  \else \if\@tmpb b%
   \put(300,420){\line(1,4){26}}%                   %bond 4-eq
   \put(300,540){\hbox to0pt{\@memberb \hss}}%      %atom 4-eq
  \else \ifx\@tmpb\empty%
   \put(300,420){\line(4,-3){103}}%                 %bond 4
   \put(420,310){\hbox to0pt{\@memberb \hss}}%      %atom 4
  \else \if\@tmpb D%
   \put(296,432){\line(5,-3){103}}%                 %double bond 4
   \put(292,408){\line(5,-3){103}}%                 %double bond 4
   \put(420,310){\hbox to0pt{\@memberb \hss}}%      %atom 4
  \fi\fi\fi\fi%
%%%%%%%%%%%%%%%%
\or% subst. on 5
%%%%%%%%%%%%%%%%
  \if\@tmpb S%
   \put(60,240){\line(1,-5){30}}%                   %bond 5
   \put(70,-20){\hbox to0pt{\@memberb  \hss}}%      %atom 5
  \else \ifx\@tmpb\empty%
   \put(60,240){\line(1,-5){30}}%                   %bond 5
   \put(70,-20){\hbox to0pt{\@memberb  \hss}}%      %atom 5
  \fi\fi%
%%%%%%%%%%%%%%%%
\or% subst. on 6
%%%%%%%%%%%%%%%%
  \if\@tmpb a%
   \put(0,0){\line(4,-3){103}}%                     %bond 6-ax
   \put(70,-180){\hbox to0pt{\@memberb \hss}}%      %atom 6-ax
  \else \if\@tmpb b%
   \put(0,0){\line(-4,-3){103}}%                    %bond 6-eq
   \put(-70,-180){\hbox to0pt{\hss \@memberb}}%     %atom 6-eq
  \else \ifx\@tmpb\empty%
   \put(0,0){\line(0,-1){108}}%                     %bond 6
   \put(-22,-202){\hbox to0pt{\hss \@memberb}}%     %atom 6
  \else \if\@tmpb D%
   \put(-12,0){\line(0,-1){108}}%                   %double bond 6
   \put(12,0){\line(0,-1){108}}%                    %double bond 6
   \putlratom{-42}{-202}{\@memberb}%                %atom 6
 \fi\fi\fi\fi
%%%%%%%%%%%%%%%%
\or% subst. on 7
%%%%%%%%%%%%%%%%
  \if\@tmpb S%
   \put(-60,240){\line(-1,-5){30}}%                 %bond 7
   \put(-70,-20){\hbox to0pt{\hss \@memberb}}%      %atom 7
  \else \ifx\@tmpb\empty%
   \put(-60,240){\line(-1,-5){30}}%                 %bond 7
   \put(-70,-20){\hbox to0pt{\hss \@memberb}}%      %atom 7-eq
  \fi\fi%
%%%%%%%%%%%%%%%%
\or% subst. on 8
%%%%%%%%%%%%%%%%
  \if\@tmpb a%
   \put(-300,420){\line(-4,-3){103}}%               %bond 8-ax
   \put(-420,310){\hbox to0pt{\hss \@memberb}}%     %atom 8-ax
  \else \if\@tmpb b%
   \put(-300,420){\line(-1,4){26}}%                 %bond 8-eq
   \put(-300,540){\hbox to0pt{\hss \@memberb}}%     %atom 8-eq
  \else \ifx\@tmpb\empty%
   \put(-300,420){\line(-4,-3){103}}%               %bond 8
   \put(-420,310){\hbox to0pt{\hss \@memberb}}%     %atom 8
  \else \if\@tmpb D%
   \put(-300,432){\line(-5,-3){103}}%               %double bond 8
   \put(-303,408){\line(-5,-3){103}}%               %double bond 8
   \put(-420,310){\hbox to0pt{\hss \@memberb}}%     %atom 8
  \fi\fi\fi\fi%
%%%%%%%%%%%%%%%%
\or% subst. on 9
%%%%%%%%%%%%%%%%
  \if\@tmpb a%
   \put(-180,420){\line(-4,-3){103}}%               %bond 9-ax
   \put(-240,250){\hbox to0pt{\hss \@memberb}}%     %atom 9-ax
  \else \if\@tmpb b%
   \put(-180,420){\line(1,4){26}}%                  %bond 9-eq
   \put(-180,540){\hbox to0pt{\@memberb \hss}}%     %atom 9-eq
  \else \ifx\@tmpb\empty%
   \put(-180,420){\line(-4,-3){103}}%               %bond 9
   \put(-300,250){\hbox to0pt{\hss \@memberb}}%     %atom 9
  \else \if\@tmpb D%
   \put(-183,432){\line(-5,-3){103}}%               %double bond 9
   \put(-180,408){\line(-5,-3){103}}%               %double bond 9
   \put(-300,250){\hbox to0pt{\hss \@memberb}}%     %atom 9
  \fi\fi\fi\fi%
%%%%%%%%%%%%%%%%
\or% subst. on 10
%%%%%%%%%%%%%%%%
  \if\@tmpb a%
  \put(180,420){\line(4,-3){103}}%                 %bond 10-ax
  \put(240,250){\hbox to0pt{\@memberb  \hss}}%     %atom 10-ax
  \else \if\@tmpb b%
  \put(180,420){\line(-1,4){26}}%                  %bond 10-eq
  \put(180,540){\hbox to0pt{\hss \@memberb}}%      %atom 10-eq
  \else \ifx\@tmpb\empty%
   \put(180,420){\line(4,-3){103}}%                %bond 10
   \put(240,250){\hbox to0pt{\@memberb \hss}}%     %atom 10
  \else \if\@tmpb D%
   \put(176,432){\line(5,-3){103}}%                %double bond 10
   \put(172,408){\line(5,-3){103}}%                %double bond 10
   \put(280,250){\hbox to0pt{\@memberb \hss}}%     %atom 10
  \fi\fi\fi\fi%
\fi}%the end of ifcase
\end{picture}}                          %end of \adamantane macro%

