% \iffalse meta-comment
%% File: methylen.dtx
%
%  Copyright 1998,2001,2002,2004,2005,2010,2013 by Shinsaku Fujita
%
%  This file is part of XyMTeX system.
%  -------------------------------------
%
% 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 methylen.dtx and methylen.ins
% and the derived file methylen.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
%  (old address)
%   Ashigara Research Laboratories, Fuji Photo Film Co., Ltd., 
%   Minami-Ashigara, Kanagawa-ken, 250-01, Japan.
%  (old address)
%   Department of Chemistry and Materials Technology, 
%   Kyoto Institute of Technology, \\
%   Matsugasaki, Sakyoku, Kyoto, 606 Japan
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{methylen}
% \def\versi@ndate{October 31, 1998}
% \def\versi@nno{ver1.02}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{methylen}
% \def\versi@ndate{December 25, 1998}
% \def\versi@nno{ver2.00}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{methylen}
% \def\versi@ndate{June 20, 2001}
% \def\versi@nno{ver2.01}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{methylen}
% \def\versi@ndate{April 30, 2002}
% \def\versi@nno{ver3.00}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{methylen}
% \def\versi@ndate{May 30, 2002}
% \def\versi@nno{ver4.00}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{methylen}
% \def\versi@ndate{August 30, 2004}
% \def\versi@nno{ver4.01}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{methylen}
% \def\versi@ndate{July 20, 2005}
% \def\versi@nno{ver4.03}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{methylen}
% \def\versi@ndate{October 01, 2010}
% \def\versi@nno{ver5.00}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{methylen}
% \def\versi@ndate{March 29, 2013}
% \def\versi@nno{ver5.01b}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{methylen}
% \def\versi@ndate{June 27, 2013}
% \def\versi@nno{ver5.01bbb}
\def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \fi
%
% \CheckSum{8103}
%% \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{v1.02}{1998/10/31}{first edition for LaTeX2e}
% \changes{v2.00}{1998/12/25}{enhanced edition for LaTeX2e}
% \changes{v2.01}{2001/06/20}{Size reduction and Clip information}
% \changes{v2.01}{2001/6/20}{Size reduction and clipping information}
% \changes{v3.00}{2002/4/30}{sfpicture environment, etc.}
% \changes{v4.00}{2002/05/30}{PostScript output and ShiftPicEnv}
% \changes{v4.01}{2004/08/30}{Minor additions}
% \changes{v4.03}{2005/07/20}{Wave bonds}
% \changes{v5.00}{2010/10/01}{For bond coloring and the LaTeX Project Public License}
% \changes{v5.01b}{2013/03/29}{bug fix for \cs{yltrimethyleneposition}}
% \changes{v5.01bb}{2013/06/22}{another bug fix for \cs{yltrimethyleneposition} etc.}
% \changes{v5.01bbb}{2013/06/27}{addition: Sd, Su, WU, WV, WA, WB etc. }
% \changes{v5.01}{2013/07/20}{bug fix}
% \fi
%
% \iffalse
%<*driver>
\NeedsTeXFormat{pLaTeX2e}
% \fi
\ProvidesFile{methylen.dtx}[2013/07/20 v5.01 XyMTeX{} package file]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{methylen.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{Methylene Chains by {\sffamily methylen.sty} 
(\fileversion) of \XyMTeX{}}
\author{Shinsaku Fujita \\ 
Shonan Institute of Chemoinformatics and Mathematical Chemistry, \\
Kaneko 479-7 Ooimachi, Ashigara-Kami-Gun, Kanagawa 250-0019 Japan
% % (old address)
% %Department of Chemistry and Materials Technology, \\
% %Kyoto Institute of Technology, \\
% %Matsugasaki, Sakyoku, Kyoto, 606-8585 Japan
}
\date{\filedate}
%
\begin{document}
   \maketitle
   \DocInput{methylen.dtx}
\end{document}
%</driver>
% \fi
%
% \section{Introduction}\label{methylen:intro}
%
% \subsection{Options for {\sffamily docstrip}}
%
% \DeleteShortVerb{\|}
% \begin{center}
% \begin{tabular}{|l|l|}
% \hline
% \emph{option} & \emph{function}\\ \hline
% methylen & methylen.sty \\
% driver & driver for this dtx file \\
% \hline
% \end{tabular}
% \end{center}
% \MakeShortVerb{\|}
%
% \subsection{Version Information}
%
%    \begin{macrocode}
%<*methylen>
\typeout{XyMTeX for Drawing Chemical Structural Formulas. Version 5.01}
\typeout{       -- Released July 20, 2013 by Shinsaku Fujita}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\j@urnalname{methylen}
\def\versi@ndate{July 20, 2013}
\def\versi@nno{ver5.01}
\def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\typeout{XyMTeX Macro File `\j@urnalname' (\versi@nno) <\versi@ndate>%
\space[\copyrighth@lder]}
%    \end{macrocode}
%
% \section{List of commands for methylen.sty}
%
% \begin{verbatim}
% **********************************
% * methylen.sty: list of commands * 
% **********************************
%
%  <Switches for drawing substituents and bonds>
%
%    \if@adoublebond     \if@bdoublebond
%    \if@Adoublebond     \if@adoublebond}
%    \reset@double
%    \if@linterchainsw   \if@rinterchainsw}
%    \reset@interchainsw
%
%  <Command for drawing substituents and bonds>
%
%   \@methsubsta      \@methsubstd   \@methsubstdL
%   \SKbondA          \SKbondB
%   \bondA            \bondAA
%   \bondB            \bondBB
%
%  <Basic commands for typesetting aliphatic chains>
%
%    \@@trimethylene 
%    \@@dimethylene 
%
%  <Commands for adjusting substitution sites>
%
%    \yltrimethyleneposition
%    \yldimethyleneposition
%
%   <Commands for drawing aliphatic chains>
%   
%    \trimethylene      \trimethylenei
%    \dimethylene       \dimethylenei
%    \tetramethylene    \tetramethylenei
%    \pentamethylene    \pentamethylenei
%    \hexamethylene     \hexamethylenei
%    \heptamethylene    \heptamethylenei
%    \octamethylene     octamethylenei 
%    \nonamethylene     \nonamethylenei
%    \decamethylene     \decamethylenei
%
% \end{verbatim}
%
% \section{Input of basic macros}
%
% To assure the compatibility to \LaTeX{}2.09 (the native mode), 
% the commands added by \LaTeXe{} have not been used in the resulting sty 
% files ({\sf polymers.sty} for the present case).  Hence, the combination 
% of |\input| and |\@ifundefined| is used to crossload sty 
% files ({\sf chemstr.sty} etc. for the present case) in place of the 
% |\RequirePackage| command of \LaTeXe{}. 
%
%    \begin{macrocode}
% *************************
% * input of basic macros *
% *************************
\@ifundefined{setsixringv}{\input chemstr.sty\relax}{}
\@ifundefined{Westbond}{\input aliphat.sty\relax}{}
\@ifundefined{bzdrv}{\input carom.sty\relax}{}
\@ifundefined{hbonde}{\input hetaromh.sty\relax}{}
\unitlength=0.1pt
%    \end{macrocode}
%
% \section{Setting Substituents}
% 
% Substitutions on each methylene of a polymethylene chain 
% is typeset by macros |\@methsubsta| etc. 
% The macro |\@methsubsta| is used to place substituents on an 
% upper-side methylene. A new bond modifier ``W'' is added to 
% typeset a terminal substituent. 
%
% \changes{v5.01}{2013/06/27}{Addition Su, Sd, WU, WA, WB}
%
% \begin{macro}{\@methsubsta}
%    \begin{macrocode}
\newif\if@wrongbdWa \@wrongbdWafalse
\newif\if@wrongbdWd \@wrongbdWdfalse
\newif\if@wrongbdWaL \@wrongbdWaLfalse
\newif\if@wrongbdWdL \@wrongbdWdLfalse
\def\@methsubsta{%
\if@aclip% %clipping
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \Put@Line(0,436)(0,1){110}%      % single bond at 1
           \putlratom{-31}{563}{\@memberb}%   % left or right type
    \else\if\@tmpc B%(B) beta
      \yl@xdiff=-36\relax
      \yl@ydiff=-27\relax
           {%
           \thicklines%
           \Put@Line(-18,436)(-3,5){60}%    % single bond at 1
           }%
           \putlatom{-42}{563}{\@memberb}%    % left type
    \else\if\@tmpc A%(A) alpha
      \yl@xdiff=37\relax
      \yl@ydiff=-27\relax
       \dotorline(18,436)(3,5){60}/(18,436)(72,526)%
       \putratom{41}{563}{\@memberb}%     % right type
    \else\if\@tmpc b%(b) beta
      \yl@xdiff=-36\relax
      \yl@ydiff=-27\relax
           \putlatom{-42}{563}{\@memberb}%    % left type
           \Put@Line(-18,436)(-3,5){60}%    % single bond at 1
    \else\if\@tmpc a%(a) alpha
      \yl@xdiff=37\relax
      \yl@ydiff=-27\relax
           \Put@Line(18,436)(3,5){60}%      % single bond at 1
           \putratom{41}{563}{\@memberb}%     % right type
%2023/06/27
   \else\if\@tmpc U% undefined
      \yl@xdiff=-36\relax
      \yl@ydiff=-27\relax
           {%
           \WaveBonds%
           \Put@Line(-18,436)(-3,5){60}%    % single bond at 1
           }%
           \putlatom{-42}{563}{\@memberb}%    % left type
   \else\if\@tmpc V% undefined
      \yl@xdiff=37\relax
      \yl@ydiff=-27\relax
           {%
           \WaveBonds%
           \Put@Line(18,436)(3,5){60}%    % wavy single bond at 1
           }%
           \putratom{41}{563}{\@memberb}%     % right type
    \else\if\@tmpc d%(d) alpha
      \yl@xdiff=-36\relax
      \yl@ydiff=-27\relax
       \dotorline(-18,436)(-3,5){60}/(-18,436)(-72,536)%
           \putlatom{-42}{563}{\@memberb}%    % left type
    \else\if\@tmpc u%(u) beta
      \yl@xdiff=37\relax
      \yl@ydiff=-27\relax
           {%
           \thicklines%
           \Put@Line(18,436)(3,5){60}%    % single bond at 1
           }%
       \putratom{41}{563}{\@memberb}%     % right type
%
    \fi\fi
    \fi\fi\fi\fi\fi\fi\fi%
   \else\if\@tmpb D%double bond
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \putlratom{-31}{563}{\@memberb}%   % left or right type
           \Put@Line(-12,436)(0,1){110}%    % double bond at 1
           \Put@Line(12,436)(0,1){110}%     % double bond at 1
   \else\if\@tmpb B%beta single bond
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \putlratom{-31}{563}{\@memberb}%   % left or right type
           {%
           \thicklines%
           \Put@Line(0,436)(0,1){110}%      % single bond at 1
           }%
   \else\if\@tmpb A%alpha single bond
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \putlratom{-31}{563}{\@memberb}%   % left or right type
       \dotorline(0,436)(0,1){110}/(0,436)(0,546)%
   \else\if\@tmpb U% undefined
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \putlratom{-31}{563}{\@memberb}%   % left or right type
           {%
           \WaveBonds%
           \Put@Line(0,436)(0,1){110}%      % single bond at 1
           }%
   \else\if\@tmpb W%beta single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=-10\relax
      \yl@ydiff=46\relax
      \if@wrongbdWa
        \XyMTeXWarning{Wrong Bond-Modifier (W)}%
      \fi
           \Put@Line(40,382)(5,-3){100}%      % single bond at 1
           \putratom{150}{276}{\@memberb}%   % left or right type
%2013/06/27
   \else\if\@tmpc U%beta undefined
      \yl@xdiff=-10\relax
      \yl@ydiff=46\relax
           {%
           \WaveBonds%
           \Put@Line(40,382)(5,-3){100}%      % single bond at 1
           }%
           \putratom{150}{276}{\@memberb}%   % left or right type
   \else\if\@tmpc B%beta
      \yl@xdiff=-10\relax
      \yl@ydiff=46\relax
           {%
           \thicklines%
           \Put@Line(40,382)(5,-3){100}%      % single bond at 1
           }%
           \putratom{150}{276}{\@memberb}%   % left or right type
   \else\if\@tmpc A%alpha
      \yl@xdiff=-10\relax
      \yl@ydiff=46\relax
          \dotorline(40,382)(5,-3){100}/(40,382)(140,322)%
           \putratom{150}{276}{\@memberb}%   % left or right type
%
   \fi\fi\fi\fi
   \else%
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \putlratom{-31}{563}{\@memberb}%   % left or right type
           \Put@Line(0,436)(0,1){110}%      % single bond at 1
   \fi\fi\fi\fi\fi\fi%
\else% % no clipping
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \Put@Line(0,406)(0,1){140}%      % single bond at 1
           \putlratom{-31}{563}{\@memberb}%   % left or right type
    \else\if\@tmpc B%(B) beta
      \yl@xdiff=-30\relax
      \yl@ydiff=-37\relax
           \putlatom{-42}{563}{\@memberb}%    % left type
           {%
           \thicklines%
           \Put@Line(0,406)(-3,5){72}%      % single bond at 1
           }%
    \else\if\@tmpc A%(A) alpha
      \yl@xdiff=31\relax
      \yl@ydiff=-37\relax
           \putratom{41}{563}{\@memberb}%     % right type
       \dotorline(0,406)(3,5){72}/(0,406)(72,526)%
    \else\if\@tmpc b%(b) beta
      \yl@xdiff=-30\relax
      \yl@ydiff=-37\relax
           \putlatom{-42}{563}{\@memberb}%    % left type
           \Put@Line(0,406)(-3,5){72}%      % single bond at 1
    \else\if\@tmpc a%(a) alpha
      \yl@xdiff=31\relax
      \yl@ydiff=-37\relax
           \putratom{41}{563}{\@memberb}%     % right type
           \Put@Line(0,406)(3,5){72}%       % single bond at 1
%2023/06/27
   \else\if\@tmpc U% undefined
      \yl@xdiff=-30\relax
      \yl@ydiff=-37\relax
           {%
           \WaveBonds%
           \Put@Line(0,406)(-3,5){72}%      % single bond at 1
           }%
           \putlatom{-42}{563}{\@memberb}%    % left type
   \else\if\@tmpc V% undefined
      \yl@xdiff=31\relax
      \yl@ydiff=-37\relax
           {%
           \WaveBonds%
           \Put@Line(0,406)(3,5){72}%    % wavy single bond at 1
           }%
           \putratom{41}{563}{\@memberb}%     % right type
    \else\if\@tmpc d%(d) alpha
      \yl@xdiff=-30\relax
      \yl@ydiff=-37\relax
        \dotorline(0,406)(-3,5){72}/(0,406)(-72,526)%
           \putlatom{-42}{563}{\@memberb}%    % left type
    \else\if\@tmpc u%(u) beta
      \yl@xdiff=31\relax
      \yl@ydiff=-37\relax
           {%
           \thicklines%
           \Put@Line(0,406)(3,5){72}%      % single bond at 1
           }%
           \putratom{41}{563}{\@memberb}%     % right type
%
    \fi\fi\fi\fi
    \fi\fi\fi\fi\fi%
   \else\if\@tmpb D%double bond
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \putlratom{-31}{563}{\@memberb}%   % left or right type
           \Put@Line(-12,406)(0,1){140}%    % double bond at 1
           \Put@Line(12,406)(0,1){140}%     % double bond at 1
   \else\if\@tmpb B%beta single bond
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \putlratom{-31}{563}{\@memberb}%   % left or right type
           {%
           \thicklines%
           \Put@Line(0,406)(0,1){140}%      % single bond at 1
           }%
   \else\if\@tmpb A%alpha single bond
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \putlratom{-31}{563}{\@memberb}%   % left or right type
       \dotorline(0,406)(0,1){140}/(0,406)(0,546)%
   \else\if\@tmpb U%undefined
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \putlratom{-31}{563}{\@memberb}%   % left or right type
           {%
           \WaveBonds%
           \Put@Line(0,406)(0,1){140}%      % single bond at 1
           }%
   \else\if\@tmpb W%beta single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=-10\relax
      \yl@ydiff=58\relax
      \if@wrongbdWa
        \XyMTeXWarning{Wrong Bond-Modifier (W)}%
      \fi
           \Put@Line(0,406)(5,-3){120}%      % single bond at 1
           \putratom{130}{276}{\@memberb}%   % left or right type
%2013/06/27
   \else\if\@tmpc U%beta undefined
      \yl@xdiff=-10\relax
      \yl@ydiff=58\relax
           {%
           \WaveBonds%
           \Put@Line(0,406)(5,-3){120}%      % single bond at 1
           }%
           \putratom{130}{276}{\@memberb}%   % left or right type
   \else\if\@tmpc B%beta
      \yl@xdiff=-10\relax
      \yl@ydiff=58\relax
           {%
           \thicklines%
           \Put@Line(0,406)(5,-3){120}%      % single bond at 1
           }%
           \putratom{130}{276}{\@memberb}%   % left or right type
   \else\if\@tmpc A%alpha
      \yl@xdiff=-10\relax
      \yl@ydiff=58\relax
          \dotorline(0,406)(5,-3){120}/(0,406)(120,334)%
           \putratom{130}{276}{\@memberb}%   % left or right type
%
   \fi\fi\fi\fi
   \else%
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \putlratom{-31}{563}{\@memberb}%   % left or right type
           \Put@Line(0,406)(0,1){140}%      % single bond at 1
   \fi\fi\fi\fi\fi\fi%
 \fi}%
%    \end{macrocode}
% \end{macro}
%
% The macro |\@methsubstd| is used to place substituents on a 
% down-side methylene. A new bond modifier ``W'' is added to 
% typeset a terminal substituent. 
%
% \changes{v5.01}{2013/06/27}{Addition Su, Sd, WU, WA, WB}
%
% \begin{macro}{\@methsubstd}
%    \begin{macrocode}
\def\@methsubstd{%
\if@clip %clipping
    \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
            \Put@Line(0,-30)(0,-1){110}%    % single bond at 4
    \else\if\@tmpc B%(B) beta
      \yl@xdiff=-36\relax
      \yl@ydiff=100\relax
           {%
           \thicklines%
           \Put@Line(-18,-30)(-3,-5){60}%   % single bond at 4
           }%
           \putlatom{-42}{-230}{\@memberb}%   % left type
    \else\if\@tmpc A%(A) alpha
      \yl@xdiff=37\relax
      \yl@ydiff=100\relax
       \dotorline(18,-30)(3,-5){60}/(18,-30)(72,-120)%
           \putratom{41}{-230}{\@memberb}%    % right type
    \else\if\@tmpc b%(b) beta
      \yl@xdiff=-36\relax
      \yl@ydiff=100\relax
           \putlatom{-42}{-230}{\@memberb}%   % left type
           \Put@Line(-18,-30)(-3,-5){60}%   % single bond at 4
    \else\if\@tmpc a%(a) alpha
      \yl@xdiff=37\relax
      \yl@ydiff=100\relax
           \putratom{41}{-230}{\@memberb}%    % right type
           \Put@Line(18,-30)(3,-5){60}%     % single bond at 4
%2023/06/27
   \else\if\@tmpc U% undefined
      \yl@xdiff=-36\relax
      \yl@ydiff=100\relax
           {%
           \WaveBonds%
           \Put@Line(-18,-30)(-3,-5){60}%   % single bond at 4
           }%
           \putlatom{-42}{-230}{\@memberb}%   % left type
   \else\if\@tmpc V% undefined
      \yl@xdiff=37\relax
      \yl@ydiff=100\relax
           {%
           \WaveBonds%
           \Put@Line(18,-30)(3,-5){60}%    % wavy single bond at 1
           }%
           \putratom{41}{-230}{\@memberb}%    % right type
    \else\if\@tmpc d%(d) alpha
      \yl@xdiff=-36\relax
      \yl@ydiff=100\relax
          \dotorline(-18,-30)(-3,-5){60}/(-18,-30)(-78,-130)%
           \putlatom{-42}{-230}{\@memberb}%   % left type
    \else\if\@tmpc u%(u) beta
      \yl@xdiff=37\relax
      \yl@ydiff=100\relax
           {%
           \thicklines%
           \Put@Line(18,-30)(3,-5){60}%   % single bond at 4
           }%
           \putratom{41}{-230}{\@memberb}%    % right type
%
    \fi\fi\fi\fi
    \fi\fi\fi\fi\fi%
   \else\if\@tmpb D%double bond
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
           \Put@Line(-12,-30)(0,-1){110}%   % double bond at 4
           \Put@Line(12,-30)(0,-1){110}%    % double bond at 4
   \else\if\@tmpb B%beta single bond
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
           {%
           \thicklines%
           \Put@Line(0,-30)(0,-1){110}%    % single bond at 4
           }%
   \else\if\@tmpb A%alpha single bond
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
       \dotorline(0,-30)(0,-1){110}/(0,-30)(0,-140)%
   \else\if\@tmpb U% undefined
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
           {%
           \WaveBonds%
           \Put@Line(0,-30)(0,-1){110}%    % single bond at 4
           }%
   \else\if\@tmpb W%beta single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=-10\relax
      \yl@ydiff=30\relax
           \putlratom{150}{54}{\@memberb}%  % left or right type
           \Put@Line(40,24)(5,3){100}%    % single bond at 4
      \if@wrongbdWd
        \XyMTeXWarning{Wrong Bond-Modifier (W)}%
      \fi
%2013/06/27
   \else\if\@tmpc U%beta undefined
      \yl@xdiff=-10\relax
      \yl@ydiff=30\relax
           {%
           \WaveBonds%
           \Put@Line(40,24)(5,3){100}%    % single bond at 4
           }%
           \putlratom{150}{54}{\@memberb}%  % left or right type
   \else\if\@tmpc B%beta
      \yl@xdiff=-10\relax
      \yl@ydiff=30\relax
           {%
           \thicklines%
           \Put@Line(40,24)(5,3){100}%    % single bond at 4
           }%
           \putlratom{150}{54}{\@memberb}%  % left or right type
   \else\if\@tmpc A%alpha
      \yl@xdiff=-10\relax
      \yl@ydiff=30\relax
          \dotorline(40,24)(5,3){100}/(40,24)(140,84)%
           \putlratom{150}{54}{\@memberb}%  % left or right type
%
   \fi\fi\fi\fi
   \else%
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
           \Put@Line(0,-30)(0,-1){110}%     % single bond at 4
   \fi\fi\fi\fi\fi\fi%
 \else% no clipping
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
            \Put@Line(0,0)(0,-1){140}%      % single bond at 4
    \else\if\@tmpc B%(B) beta
      \yl@xdiff=-30\relax
      \yl@ydiff=110\relax
           \putlatom{-42}{-230}{\@memberb}%   % left type
           {%
           \thicklines%
           \Put@Line(0,0)(-3,-5){72}%       % single bond at 4
           }%
    \else\if\@tmpc A%(A) alpha
      \yl@xdiff=31\relax
      \yl@ydiff=110\relax
           \putratom{41}{-230}{\@memberb}%    % right type
       \dotorline(0,0)(3,-5){72}/(0,0)(72,-120)%
    \else\if\@tmpc b%(b) beta
      \yl@xdiff=-30\relax
      \yl@ydiff=110\relax
           \putlatom{-42}{-230}{\@memberb}%   % left type
           \Put@Line(0,0)(-3,-5){72}%       % single bond at 4
    \else\if\@tmpc a%(a) alpha
      \yl@xdiff=31\relax
      \yl@ydiff=110\relax
           \putratom{41}{-230}{\@memberb}%    % right type
           \Put@Line(0,0)(3,-5){72}%        % single bond at 4
%2023/06/27
   \else\if\@tmpc U% undefined
      \yl@xdiff=-30\relax
      \yl@ydiff=110\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(-3,-5){72}%       % single bond at 4
           }%
           \putlatom{-42}{-230}{\@memberb}%   % left type
   \else\if\@tmpc V% undefined
      \yl@xdiff=31\relax
      \yl@ydiff=110\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(3,-5){72}%    % wavy single bond at 1
           }%
           \putratom{41}{-230}{\@memberb}%    % right type
    \else\if\@tmpc d%(d) alpha
      \yl@xdiff=-30\relax
      \yl@ydiff=110\relax
       \dotorline(0,0)(-3,-5){72}/(0,0)(-72,-120)%
           \putlatom{-42}{-230}{\@memberb}%   % left type
    \else\if\@tmpc u%(u) beta
      \yl@xdiff=31\relax
      \yl@ydiff=110\relax
           {%
           \thicklines%
           \Put@Line(0,0)(3,-5){72}%       % single bond at 4
           }%
           \putratom{41}{-230}{\@memberb}%    % right type
%
    \fi\fi\fi\fi
    \fi\fi\fi\fi\fi%
   \else\if\@tmpb D%double bond
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
           \Put@Line(-12,0)(0,-1){140}%     % double bond at 4
           \Put@Line(12,0)(0,-1){140}%      % double bond at 4
   \else\if\@tmpb B%beta single bond
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
           {%
           \thicklines%
           \Put@Line(0,0)(0,-1){140}%       % single bond at 4
           }%
   \else\if\@tmpb A%alpha single bond
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
       \dotorline(0,0)(0,-1){140}/(0,0)(0,-140)%
   \else\if\@tmpb U% undefined
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
           {%
           \WaveBonds%
           \Put@Line(0,0)(0,-1){140}%       % single bond at 4
           }%
   \else\if\@tmpb W%beta single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=-10\relax
      \yl@ydiff=30\relax
           \putlratom{150}{54}{\@memberb}%  % left or right type
           \Put@Line(0,0)(5,3){140}%    % single bond at 4
      \if@wrongbdWd
        \XyMTeXWarning{Wrong Bond-Modifier (W)}%
      \fi
%2013/06/27
   \else\if\@tmpc U%beta undefined
      \yl@xdiff=-10\relax
      \yl@ydiff=30\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(5,3){140}%    % single bond at 4
           }%
           \putlratom{150}{54}{\@memberb}%  % left or right type
   \else\if\@tmpc B%beta
      \yl@xdiff=-10\relax
      \yl@ydiff=30\relax
           {%
           \thicklines%
           \Put@Line(0,0)(5,3){140}%    % single bond at 4
           }%
           \putlratom{150}{54}{\@memberb}%  % left or right type
   \else\if\@tmpc A%alpha
      \yl@xdiff=-10\relax
      \yl@ydiff=30\relax
          \dotorline(0,0)(5,3){140}/(0,0)(140,84)%
           \putlratom{150}{54}{\@memberb}%  % left or right type
%
   \fi\fi\fi\fi
   \else%
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
           \Put@Line(0,0)(0,-1){140}%       % single bond at 4
   \fi\fi\fi\fi\fi\fi%
 \fi}%
%    \end{macrocode}
% \end{macro}
%
% The macro |\@methsubstdL| is used to place substituents on a 
% left-teminal down-side methylene. A new bond modifier ``W'' is 
% added to typeset a terminal substituent. 
% \changes{v5.01}{2013/06/27}{bug fix SU to SV, SV to SU. Addition Su, Sd, WU, WA, WB}
%
% \begin{macro}{\@methsubstdL}
%    \begin{macrocode}
\def\@methsubstdL{%
\if@clip %clipping
    \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
            \Put@Line(0,-30)(0,-1){110}%    % single bond at 4
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
    \else\if\@tmpc B%(B) beta
      \yl@xdiff=-36\relax
      \yl@ydiff=100\relax
           {%
           \thicklines%
           \Put@Line(-18,-30)(-3,-5){60}%   % single bond at 4
           }%
           \putlatom{-42}{-230}{\@memberb}%   % left type
    \else\if\@tmpc A%(A) alpha
      \yl@xdiff=37\relax
      \yl@ydiff=100\relax
       \dotorline(18,-30)(3,-5){60}/(18,-30)(72,-120)%
           \putratom{41}{-230}{\@memberb}%    % right type
    \else\if\@tmpc b%(b) beta
      \yl@xdiff=-36\relax
      \yl@ydiff=100\relax
           \Put@Line(-18,-30)(-3,-5){60}%   % single bond at 4
           \putlatom{-42}{-230}{\@memberb}%   % left type
    \else\if\@tmpc a%(a) alpha
      \yl@xdiff=37\relax
      \yl@ydiff=100\relax
           \Put@Line(18,-30)(3,-5){60}%     % single bond at 4
           \putratom{41}{-230}{\@memberb}%    % right type
    \else\if\@tmpc U%(U) beta undefined%bug fix 2013/06/27 V-->U
      \yl@xdiff=-36\relax
      \yl@ydiff=100\relax
           {%
           \WaveBonds%
           \Put@Line(-18,-30)(-3,-5){60}%   % single bond at 4
           }%
           \putlatom{-42}{-230}{\@memberb}%   % left type
    \else\if\@tmpc V%(V) alpha undefined%bug fix 2013/06/27 U-->V
      \yl@xdiff=37\relax
      \yl@ydiff=100\relax
           {%
           \WaveBonds%
           \Put@Line(18,-30)(3,-5){60}%     % single bond at 4
           }%
           \putratom{41}{-230}{\@memberb}%    % right type
%2013/06/27
    \else\if\@tmpc d%(d) alpha
      \yl@xdiff=-36\relax
      \yl@ydiff=100\relax
       \dotorline(-18,-30)(-3,-5){60}/(-18,-30)(-78,-130)%
          \putlatom{-42}{-230}{\@memberb}%   % left type
    \else\if\@tmpc u%(u) beta
      \yl@xdiff=37\relax
      \yl@ydiff=100\relax
           {%
           \thicklines%
           \Put@Line(18,-30)(3,-5){60}%   % single bond at 4
           }%
           \putratom{41}{-230}{\@memberb}%    % right type
%
    \fi\fi
    \fi\fi\fi\fi\fi\fi\fi%
   \else\if\@tmpb D%double bond
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \Put@Line(-12,-30)(0,-1){110}%   % double bond at 4
           \Put@Line(12,-30)(0,-1){110}%    % double bond at 4
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
   \else\if\@tmpb B%beta single bond
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           {%
           \thicklines%
           \Put@Line(0,-30)(0,-1){110}%    % single bond at 4
           }%
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
   \else\if\@tmpb A%alpha single bond
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
       \dotorline(0,-30)(0,-1){110}/(0,-30)(0,-140)%
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
   \else\if\@tmpb U% undefined
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           {%
           \WaveBonds%
           \Put@Line(0,-30)(0,-1){110}%    % single bond at 4
           }%
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
   \else\if\@tmpb W%beta single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=10\relax
      \yl@ydiff=30\relax
           \Put@Line(-40,24)(-5,3){100}%    % single bond at 4
           \putlatom{-150}{54}{\@memberb}%  % lefttype
      \if@wrongbdWdL
        \XyMTeXWarning{Wrong Bond-Modifier (W)}%
      \fi
%2013/06/27
   \else\if\@tmpc U%beta undefined
      \yl@xdiff=10\relax
      \yl@ydiff=30\relax
           {%
           \WaveBonds%
           \Put@Line(-40,24)(-5,3){100}%    % single bond at 4
           }%
           \putlatom{-150}{54}{\@memberb}%  % left type
   \else\if\@tmpc B%beta
      \yl@xdiff=10\relax
      \yl@ydiff=30\relax
           {%
           \thicklines%
           \Put@Line(-40,24)(-5,3){100}%    % single bond at 4
           }%
           \putlatom{-150}{54}{\@memberb}%  % left type
   \else\if\@tmpc A%alpha
      \yl@xdiff=10\relax
      \yl@ydiff=30\relax
          \dotorline(-40,24)(-5,3){100}/(-40,24)(-140,84)%
          \putlatom{-150}{54}{\@memberb}%  % left type
%
   \fi\fi\fi\fi
   \else%
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \Put@Line(0,-30)(0,-1){110}%     % single bond at 4
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
   \fi\fi\fi\fi\fi\fi%
\else% no clipping
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
            \Put@Line(0,0)(0,-1){140}%      % single bond at 4
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
    \else\if\@tmpc B%(B) beta
      \yl@xdiff=-30\relax
      \yl@ydiff=110\relax
           {%
           \thicklines%
           \Put@Line(0,0)(-3,-5){72}%       % single bond at 4
           }%
           \putlatom{-42}{-230}{\@memberb}%   % left type
    \else\if\@tmpc A%(A) alpha
      \yl@xdiff=31\relax
      \yl@ydiff=110\relax
       \dotorline(0,0)(3,-5){72}/(0,0)(72,-120)%
           \putratom{41}{-230}{\@memberb}%    % right type
    \else\if\@tmpc b%(b) beta
      \yl@xdiff=-30\relax
      \yl@ydiff=110\relax
           \Put@Line(0,0)(-3,-5){72}%       % single bond at 4
           \putlatom{-42}{-230}{\@memberb}%   % left type
    \else\if\@tmpc a%(a) alpha
      \yl@xdiff=31\relax
      \yl@ydiff=110\relax
           \Put@Line(0,0)(3,-5){72}%        % single bond at 4
           \putratom{41}{-230}{\@memberb}%    % right type
    \else\if\@tmpc U%(U) beta undefined%bug fix 2013/06/27 V-->U
      \yl@xdiff=-30\relax
      \yl@ydiff=110\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(-3,-5){72}%       % single bond at 4
           }%
           \putlatom{-42}{-230}{\@memberb}%   % left type
    \else\if\@tmpc V%(V) alpha undefined%bug fix 2013/06/27 U-->V
      \yl@xdiff=31\relax
      \yl@ydiff=110\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(3,-5){72}%        % single bond at 4
           }%
           \putratom{41}{-230}{\@memberb}%    % right type
%2013/06/27
    \else\if\@tmpc d%(d) alpha
      \yl@xdiff=-30\relax
      \yl@ydiff=110\relax
       \dotorline(0,0)(-3,-5){72}/(0,0)(-72,-120)%
           \putlatom{-42}{-230}{\@memberb}%   % left type
    \else\if\@tmpc u%(u) beta
      \yl@xdiff=31\relax
      \yl@ydiff=110\relax
           {%
           \thicklines%
           \Put@Line(0,0)(3,-5){72}%       % single bond at 4
           }%
           \putratom{41}{-230}{\@memberb}%    % right type
%
    \fi\fi
    \fi\fi\fi\fi\fi\fi\fi%
   \else\if\@tmpb D%double bond
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \Put@Line(-12,0)(0,-1){140}%     % double bond at 4
           \Put@Line(12,0)(0,-1){140}%      % double bond at 4
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
   \else\if\@tmpb B%beta single bond
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           {%
           \thicklines%
           \Put@Line(0,0)(0,-1){140}%       % single bond at 4
           }%
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
   \else\if\@tmpb A%alpha single bond
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
       \dotorline(0,0)(0,-1){140}/(0,0)(0,-140)%
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
   \else\if\@tmpb U%beta undefined
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(0,-1){140}%       % single bond at 4
           }%
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
   \else\if\@tmpb W%beta single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=10\relax
      \yl@ydiff=30\relax
           \Put@Line(0,0)(-5,3){140}%    % single bond at 4
           \putlatom{-150}{54}{\@memberb}%  % left type
      \if@wrongbdWdL
        \XyMTeXWarning{Wrong Bond-Modifier (W)}%
      \fi
%2013/06/27
   \else\if\@tmpc U%beta undefined
      \yl@xdiff=10\relax
      \yl@ydiff=30\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(-5,3){140}%    % single bond at 4
           }%
           \putlatom{-150}{54}{\@memberb}%  % left type
   \else\if\@tmpc B%beta
      \yl@xdiff=10\relax
      \yl@ydiff=30\relax
           {%
           \thicklines%
           \Put@Line(0,0)(-5,3){140}%    % single bond at 4
           }%
           \putlatom{-150}{54}{\@memberb}%  % left type
   \else\if\@tmpc A%alpha
      \yl@xdiff=10\relax
      \yl@ydiff=30\relax
          \dotorline(0,0)(-5,3){140}/(0,0)(-140,84)%
          \putlatom{-150}{54}{\@memberb}%  % left type
%
   \fi\fi\fi\fi
   \else%
      \yl@xdiff=31\relax
      \yl@ydiff=90\relax
           \Put@Line(0,0)(0,-1){140}%       % single bond at 4
           \putlratom{-31}{-230}{\@memberb}%  % left or right type
   \fi\fi\fi\fi\fi\fi%
 \fi}%end of \@methsubstdL
%    \end{macrocode}
% \end{macro}
%
% The macro |\@methsubstaL| is used to place substituents on a 
% left-teminal upper-side methylene. A new bond modifier ``W'' is 
% added to typeset a terminal substituent. 
% \changes{v5.01}{2013/06/27}{bug fix SU to SV, SV to SU. Addition Su, Sd, WU, WA, WB}
%
% \begin{macro}{\@methsubstaL}
%    \begin{macrocode}
\def\@methsubstaL{%
\if@aclip% %clipping
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \Put@Line(0,436)(0,1){110}%      % single bond at 1
           \putlratom{-31}{563}{\@memberb}%   % left or right type
    \else\if\@tmpc B%(B) beta
      \yl@xdiff=-36\relax
      \yl@ydiff=-27\relax
           {%
           \thicklines%
           \Put@Line(-18,436)(-3,5){60}%    % single bond at 1
           }%
           \putlatom{-42}{563}{\@memberb}%    % left type
    \else\if\@tmpc A%(A) alpha
      \yl@xdiff=37\relax
      \yl@ydiff=-27\relax
       \dotorline(18,436)(3,5){60}/(18,436)(72,526)%
           \putratom{41}{563}{\@memberb}%     % right type
    \else\if\@tmpc b%(b) beta
      \yl@xdiff=-36\relax
      \yl@ydiff=-27\relax
           \Put@Line(-18,436)(-3,5){60}%    % single bond at 1
           \putlatom{-42}{563}{\@memberb}%    % left type
    \else\if\@tmpc a%(a) alpha
      \yl@xdiff=37\relax
      \yl@ydiff=-27\relax
           \Put@Line(18,436)(3,5){60}%      % single bond at 1
           \putratom{41}{563}{\@memberb}%     % right type
    \else\if\@tmpc U%(U) beta undefined%bug fix 2013/06/27 V-->U
      \yl@xdiff=-36\relax
      \yl@ydiff=-27\relax
           {%
           \WaveBonds%
           \Put@Line(-18,436)(-3,5){60}%    % single bond at 1
           }%
           \putlatom{-42}{563}{\@memberb}%    % left type
    \else\if\@tmpc V%(V) alpha undefined%bug fix 2013/06/27 U-->V
      \yl@xdiff=37\relax
      \yl@ydiff=-27\relax
           {%
           \WaveBonds%
           \Put@Line(18,436)(3,5){60}%      % single bond at 1
           }%
           \putratom{41}{563}{\@memberb}%     % right type
%2013/06/27
    \else\if\@tmpc d%(d) alpha
      \yl@xdiff=-36\relax
      \yl@ydiff=-27\relax
       \dotorline(-18,436)(-3,5){60}/(-18,436)(-78,536)%
           \putlatom{-42}{563}{\@memberb}%    % left type
    \else\if\@tmpc u%(u) beta
      \yl@xdiff=37\relax
      \yl@ydiff=-27\relax
           {%
           \thicklines%
           \Put@Line(18,436)(3,5){60}%    % single bond at 1
           }%
           \putratom{41}{563}{\@memberb}%     % right type
%
    \fi\fi
    \fi\fi\fi\fi\fi\fi\fi%
   \else\if\@tmpb D%double bond
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \Put@Line(-12,436)(0,1){110}%    % double bond at 1
           \Put@Line(12,436)(0,1){110}%     % double bond at 1
           \putlratom{-31}{563}{\@memberb}%   % left or right type
   \else\if\@tmpb B%beta single bond
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           {%
           \thicklines%
           \Put@Line(0,436)(0,1){110}%      % single bond at 1
           }%
           \putlratom{-31}{563}{\@memberb}%   % left or right type
   \else\if\@tmpb A%alpha single bond
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
       \dotorline(0,436)(0,1){110}/(0,436)(0,546)%
           \putlratom{-31}{563}{\@memberb}%   % left or right type
   \else\if\@tmpb U%beta undefined
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           {%
           \WaveBonds%
           \Put@Line(0,436)(0,1){110}%      % single bond at 1
           }%
           \putlratom{-31}{563}{\@memberb}%   % left or right type
   \else\if\@tmpb W%beta single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=10\relax
      \yl@ydiff=46\relax
           \Put@Line(-40,382)(-5,-3){100}%      % single bond at 1
           \putlatom{-150}{276}{\@memberb}%   % left type
      \if@wrongbdWaL
        \XyMTeXWarning{Wrong Bond-Modifier (W)}%
      \fi
%2013/06/27
   \else\if\@tmpc U%undefined
      \yl@xdiff=10\relax
      \yl@ydiff=46\relax
           {%
           \WaveBonds%
           \Put@Line(-40,382)(-5,-3){100}%      % single bond at 1
           }%
           \putlatom{-150}{276}{\@memberb}%   % left type
   \else\if\@tmpc B%beta
      \yl@xdiff=10\relax
      \yl@ydiff=46\relax
           {%
           \thicklines%
           \Put@Line(-40,382)(-5,-3){100}%      % single bond at 1
           }%
           \putlatom{-150}{276}{\@memberb}%   % left type
   \else\if\@tmpc A%alpha
      \yl@xdiff=10\relax
      \yl@ydiff=46\relax
          \dotorline(-40,382)(-5,-3){100}/(-40,382)(-140,322)%
           \putlatom{-150}{276}{\@memberb}%   % left type
%
   \fi\fi\fi\fi
   \else%
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \Put@Line(0,436)(0,1){110}%      % single bond at 1
           \putlratom{-31}{563}{\@memberb}%   % left or right type
   \fi\fi\fi\fi\fi\fi%
\else% % no clipping
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \Put@Line(0,406)(0,1){140}%      % single bond at 1
           \putlratom{-31}{563}{\@memberb}%   % left or right type
    \else\if\@tmpc B%(B) beta
      \yl@xdiff=-30\relax
      \yl@ydiff=-37\relax
           {%
           \thicklines%
           \Put@Line(0,406)(-3,5){72}%      % single bond at 1
           }%
           \putlatom{-42}{563}{\@memberb}%    % left type
    \else\if\@tmpc A%(A) alpha
      \yl@xdiff=31\relax
      \yl@ydiff=-37\relax
       \dotorline(0,406)(3,5){72}/(0,406)(72,526)%
           \putratom{41}{563}{\@memberb}%     % right type
    \else\if\@tmpc b%(b) beta
      \yl@xdiff=-30\relax
      \yl@ydiff=-37\relax
           \Put@Line(0,406)(-3,5){72}%      % single bond at 1
           \putlatom{-42}{563}{\@memberb}%    % left type
    \else\if\@tmpc a%(a) alpha
      \yl@xdiff=31\relax
      \yl@ydiff=-37\relax
           \Put@Line(0,406)(3,5){72}%       % single bond at 1
           \putratom{41}{563}{\@memberb}%     % right type
    \else\if\@tmpc V%(V) beta undefined
      \yl@xdiff=-30\relax
      \yl@ydiff=-37\relax
           {%
           \WaveBonds%
           \Put@Line(0,406)(-3,5){72}%      % single bond at 1
           }%
           \putlatom{-42}{563}{\@memberb}%    % left type
    \else\if\@tmpc U%(U) alpha undefined
      \yl@xdiff=31\relax
      \yl@ydiff=-37\relax
           {%
           \WaveBonds%
           \Put@Line(0,406)(3,5){72}%       % single bond at 1
           }%
           \putratom{41}{563}{\@memberb}%     % right type
%2013/06/27
    \else\if\@tmpc d%(d) alpha
      \yl@xdiff=-30\relax
      \yl@ydiff=-37\relax
       \dotorline(0,406)(-3,5){72}/(0,406)(-72,526)%
           \putlatom{-42}{563}{\@memberb}%    % left type
    \else\if\@tmpc u%(u) beta
      \yl@xdiff=31\relax
      \yl@ydiff=-37\relax
           {%
           \thicklines%
           \Put@Line(0,406)(3,5){72}%      % single bond at 1
           }%
           \putratom{41}{563}{\@memberb}%     % right type
%
    \fi\fi
    \fi\fi\fi\fi\fi\fi\fi%
   \else\if\@tmpb D%double bond
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \Put@Line(-12,406)(0,1){140}%    % double bond at 1
           \Put@Line(12,406)(0,1){140}%     % double bond at 1
           \putlratom{-31}{563}{\@memberb}%   % left or right type
   \else\if\@tmpb B%beta single bond
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           {%
           \thicklines%
           \Put@Line(0,406)(0,1){140}%      % single bond at 1
           }%
           \putlratom{-31}{563}{\@memberb}%   % left or right type
   \else\if\@tmpb A%alpha single bond
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
       \dotorline(0,406)(0,1){140}/(0,406)(0,546)%
           \putlratom{-31}{563}{\@memberb}%   % left or right type
   \else\if\@tmpb U%beta undefined
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           {%
           \WaveBonds%
           \Put@Line(0,406)(0,1){140}%      % single bond at 1
           }%
           \putlratom{-31}{563}{\@memberb}%   % left or right type
   \else\if\@tmpb W%beta single bond
    \ifx\@tmpc\empty%
      \yl@xdiff=10\relax
      \yl@ydiff=58\relax
           \Put@Line(0,406)(-5,-3){120}%      % single bond at 1
           \putlatom{-130}{276}{\@memberb}%   % left type
      \if@wrongbdWaL
        \XyMTeXWarning{Wrong Bond-Modifier (W)}%
      \fi
%2013/06/27
   \else\if\@tmpc U%undefined
      \yl@xdiff=10\relax
      \yl@ydiff=58\relax
           {%
           \WaveBonds%
           \Put@Line(0,406)(-5,-3){120}%      % single bond at 1
           }%
           \putlatom{-130}{276}{\@memberb}%   % left type
   \else\if\@tmpc B%beta
      \yl@xdiff=10\relax
      \yl@ydiff=58\relax
           {%
           \thicklines%
           \Put@Line(0,406)(-5,-3){120}%      % single bond at 1
           }%
           \putlatom{-130}{276}{\@memberb}%   % left type
   \else\if\@tmpc A%alpha
      \yl@xdiff=10\relax
      \yl@ydiff=58\relax
          \dotorline(0,406)(-5,-3){120}/(0,406)(-120,334)%
           \putlatom{-130}{276}{\@memberb}%   % left type
%
   \fi\fi\fi\fi
   \else%
      \yl@xdiff=31\relax
      \yl@ydiff=-17\relax
           \Put@Line(0,406)(0,1){140}%      % single bond at 1
           \putlratom{-31}{563}{\@memberb}%   % left or right type
   \fi\fi\fi\fi\fi\fi%
 \fi}%
%    \end{macrocode}
% \end{macro}
%
% \section{Setting Bonds}
% \subsection{Outer Skeletal Bonds}
%
% The macros |\SKbondB| and |\SKbondA| are used to typeset 
% outer skeletal bonds of a methylene chain (|\..methylene|)
%
% \begin{macro}{\SKbondB}
%    \begin{macrocode}
\def\SKbondB{%
  \ifx\bbb\empty%
    \ifx\ccc\empty%
     \Put@Line(0,406)(5,-3){171}%        %bond 1-2
    \else%
     \Put@Line(0,406)(5,-3){136}%        %bond 1-2
    \fi%
   \else%
    \ifx\ccc\empty%
     \Put@Line(35,385)(5,-3){136}%       %bond 1-2
    \else%
     \Put@Line(35,385)(5,-3){100}%       %bond 1-2
    \fi%
   \fi}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\SKbondA}
%    \begin{macrocode}
\def\SKbondA{%
  \ifx\bbb\empty%
    \ifx\aaa\empty%
     \Put@Line(0,406)(-5,-3){171}%       %bond 1-6
    \else%
     \Put@Line(0,406)(-5,-3){136}%       %bond 1-6
    \fi%
   \else%
    \ifx\aaa\empty%
     \Put@Line(-35,385)(-5,-3){136}%     %bond 1-6
    \else%
     \Put@Line(-35,385)(-5,-3){100}%     %bond 1-6
    \fi%
   \fi}%
%    \end{macrocode}
% \end{macro}
%
% The macros |\SKbondBi| and |\SKbondAi| are used to typeset 
% outer skeletal bonds of a methylene chain (inverse type |\..methylenei|).
%
% \begin{macro}{\SKbondBi}
%    \begin{macrocode}
\def\SKbondBi{%
 \begin{sfpicture}(0,0)(0,0)
  \ifx\bbb\empty%
    \ifx\ccc\empty%
     \Put@Line(0,0)(5,3){171}%           %bond 4-3
    \else%
     \Put@Line(0,0)(5,3){136}%           %bond 4-3
    \fi%
  \else%
    \ifx\ccc\empty%
     \Put@Line(35,21)(5,3){138}%         %bond 4-3
    \else%
     \Put@Line(35,21)(5,3){100}%         %bond 4-3
    \fi%
  \fi\end{sfpicture}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\SKbondAi}
%    \begin{macrocode}
\def\SKbondAi{%
 \begin{sfpicture}(0,0)(0,0)
  \ifx\bbb\empty%
    \ifx\aaa\empty%
     \Put@Line(0,0)(-5,3){171}%          %bond 4-5
    \else%
     \Put@Line(0,0)(-5,3){136}%          %bond 4-5
    \fi%
  \else%
    \ifx\aaa\empty%
     \Put@Line(-35,21)(-5,3){138}%       %bond 4-5
    \else%
     \Put@Line(-35,21)(-5,3){100}%        %bond 4-5
    \fi%
  \fi\end{sfpicture}}%
%    \end{macrocode}
% \end{macro}
%
% \subsection{Inner Double Bonds}
% 
% The macros |\bondB| is used to place a line of 
% a double bond in the (5,-3) direction at the lower side 
% of an outer skeletal bond. 
%
% \begin{macro}{\bondB}
%    \begin{macrocode}
\def\bondB{%
  \ifx\bbb\empty%
   \ifx\ccc\empty%
    \Put@Line(6,364)(5,-3){126}%         %double bond 1-2
   \else%
    \Put@Line(6,364)(5,-3){100}%         %double bond 1-2
   \fi%
  \else%
   \ifx\ccc\empty%
    \Put@Line(35,340)(5,-3){100}%        %double bond 1-2
   \else%
    \Put@Line(35,352)(5,-3){100}%        %double bond 1-2
   \fi%                                    % line <1OO not available
  \fi%
 }%
%    \end{macrocode}
% \end{macro}
%
% The macros |\bondBB| is used to place a line of 
% a double bond in the (5,-3) direction at the upper side 
% of an outer skeletal bond. 
%
% \begin{macro}{\bondBB}
%    \begin{macrocode}
\def\bondBB{%
  \ifx\bbb\empty%
   \ifx\ccc\empty%
    \Put@Line(42,420)(5,-3){126}%         %double bond 1-2
   \else%
    \Put@Line(42,420)(5,-3){100}%         %double bond 1-2
   \fi%
  \else%
   \ifx\ccc\empty%
    \Put@Line(52,412)(5,-3){110}%        %double bond 1-2
   \else%
    \Put@Line(52,412)(5,-3){100}%        %double bond 1-2
   \fi%                                    % line <1OO not available
  \fi%
 }%
%    \end{macrocode}
% \end{macro}
%
% The macros |\bondA| is used to place a line of 
% a double bond in the (-5,-3) direction at the lower 
% side of an outer skeletal bond. 
%
% \begin{macro}{\bondA}
%    \begin{macrocode}
\def\bondA{%
  \ifx\bbb\empty%
   \ifx\aaa\empty%
    \Put@Line(-6,364)(-5,-3){126}%        %double bond 1-6
   \else%
    \Put@Line(-6,364)(-5,-3){100}%        %double bond 1-6
   \fi%
  \else%
   \ifx\aaa\empty%
    \Put@Line(-35,340)(-5,-3){100}%       %double bond 1-6
   \else%
    \Put@Line(-35,352)(-5,-3){100}%       %double bond 1-6
   \fi%                                     % line <1OO not available
  \fi%
}%
%    \end{macrocode}
% \end{macro}
%
% The macros |\bondAA| is used to place a line of 
% a double bond in the (-5,-3) direction at the upper side 
% of an outer skeletal bond. 
%
% \begin{macro}{\bondAA}
%    \begin{macrocode}
\def\bondAA{%
  \ifx\bbb\empty%
   \ifx\aaa\empty%
    \Put@Line(-42,420)(-5,-3){126}%        %double bond 1-6
   \else%
    \Put@Line(-42,420)(-5,-3){100}%        %double bond 1-6
   \fi%
  \else%
   \ifx\aaa\empty%
    \Put@Line(-52,412)(-5,-3){100}%       %double bond 1-6
   \else%
    \Put@Line(-52,412)(-5,-3){100}%       %double bond 1-6
   \fi%                                     % line <1OO not available
  \fi%
}%
%    \end{macrocode}
% \end{macro}
%
% The bond-setting commands with sufix ``i'' are used in the definitions 
% of commands such as |\...methylenei|. 
%
% The macros |\bondBi| is used to place a line of 
% a double bond in the (5,3) direction at the upper side 
% of an outer skeletal bond. 
%
% \begin{macro}{\bondBi}
%    \begin{macrocode}
 \def\bondBi{%
  \ifx\bbb\empty%
   \ifx\ccc\empty%
    \Put@Line(6,42)(5,3){126}%           %double bond 4-3
   \else% 
    \Put@Line(6,42)(5,3){100}%           %double bond 4-3
   \fi%
  \else%
   \ifx\ccc\empty%
    \Put@Line(35,66)(5,3){100}%          %double bond 4-3
   \else% 
    \Put@Line(35,60)(5,3){100}%          %double bond 4-3
   \fi%                                    % line <1OO not available
  \fi%
}%
%    \end{macrocode}
% \end{macro}
%
% The macros |\bondBBi| is used to place a line of 
% a double bond in the (5,3) direction at the lower 
% side of an outer skeletal bond. 
%
% \begin{macro}{\bondBBi}
%    \begin{macrocode}
 \def\bondBBi{%
  \ifx\bbb\empty%
   \ifx\ccc\empty%
%    \Put@Line(6,42)(5,3){126}%           %double bond 4-3
    \Put@Line(42,-14)(5,3){126}%        %double bond 1-6
   \else% 
%    \Put@Line(6,42)(5,3){100}%           %double bond 4-3
%    \Put@Line(42,-14)(5,3){100}%        %double bond 1-6
    \Put@Line(30,-14)(5,3){100}%        %double bond 1-6
   \fi%
  \else%
   \ifx\ccc\empty%
%    \Put@Line(35,66)(5,3){100}%          %double bond 4-3
%    \Put@Line(52,6)(5,3){100}%       %double bond 1-6
    \Put@Line(52,0)(5,3){100}%       %double bond 1-6
   \else% 
%    \Put@Line(35,60)(5,3){100}%          %double bond 4-3
    \Put@Line(52,0)(5,3){100}%        %double bond 4-5
   \fi%                                    % line <1OO not available
  \fi%
}%
%    \end{macrocode}
% \end{macro}
%
% The macros |\bondAi| is used to place a line of 
% a double bond in the (-5,3) direction at the upper 
% side of an outer skeletal bond. 

% \begin{macro}{\bondAi}
%    \begin{macrocode}
 \def\bondAi{%
  \ifx\bbb\empty%
   \ifx\aaa\empty%
    \Put@Line(-6,42)(-5,3){126}%         %double bond 4-5
   \else% 
    \Put@Line(-6,42)(-5,3){100}%         %double bond 4-5
   \fi%
  \else%
   \ifx\aaa\empty%
    \Put@Line(-35,66)(-5,3){100}%        %double bond 4-5
   \else% 
    \Put@Line(-35,60)(-5,3){100}%        %double bond 4-5
   \fi%                                    % line <1OO not available
  \fi%
 }%
%    \end{macrocode}
% \end{macro}
%
% The macros |\bondAAi| is used to place a line of 
% a double bond in the (-5,3) direction at the lower
% side of an outer skeletal bond. 
%
% \begin{macro}{\bondAAi}
%    \begin{macrocode}
 \def\bondAAi{%
  \ifx\bbb\empty%
   \ifx\aaa\empty%
%    \Put@Line(-6,42)(-5,3){126}%         %double bond 4-5
    \Put@Line(-42,-14)(-5,3){126}%        %double bond 1-6
   \else% 
%    \Put@Line(-6,42)(-5,3){100}%         %double bond 4-5
    \Put@Line(-42,-14)(-5,3){100}%        %double bond 1-6
   \fi%
  \else%
   \ifx\aaa\empty%
%    \Put@Line(-35,66)(-5,3){100}%        %double bond 4-5
    \Put@Line(-52,6)(-5,3){100}%       %double bond 1-6
   \else% 
%    \Put@Line(-35,60)(-5,3){100}%        %double bond 4-5
    \Put@Line(-52,0)(-5,3){100}%        %double bond 4-5
   \fi%                                    % line <1OO not available
  \fi%
 }%
%    \end{macrocode}
% \end{macro}
%
% \section{Switches}
%
% \begin{macro}{\if@adoublebond}
% \begin{macro}{\if@bdoublebond}
% \begin{macro}{\if@Adoublebond}
% \begin{macro}{\if@adoublebond}
% \begin{macro}{\reset@double}
%    \begin{macrocode}
\newif\if@adoublebond \@adoublebondfalse
\newif\if@bdoublebond \@bdoublebondfalse
\newif\if@Adoublebond \@Adoublebondfalse
\newif\if@Bdoublebond \@Bdoublebondfalse
\def\reset@double{%
\@adoublebondfalse\@bdoublebondfalse
\@Adoublebondfalse\@Bdoublebondfalse}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\if@linterchainsw}
% \begin{macro}{\if@rinterchainsw}
% \begin{macro}{\reset@interchainsw}
%    \begin{macrocode}
\newif\if@linterchainsw \@linterchainswfalse
\newif\if@rinterchainsw \@rinterchainswfalse
\def\reset@interchainsw{\@linterchainswfalse\@rinterchainswfalse}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \section{Trimethylene}
% \subsection{Normal direction}
%
% A trimethylene (or propane) and its hetera analogs can be typeset 
% by the command |\trimethylene|, which is mainly based on 
% two inner commands: |\yltrimethyleneposition| for adjusting a 
% substitution site and |\@@trimethylene| for 
% placing hetero atoms, double bonds, and substituents.
%
% \begin{macro}{\@@trimethylene}
% \begin{verbatim}
% \@@trimethylene{ATOMLIST}{BONDLIST}{TERMswitch}{Adjust}
%
%    <TERMswitch>
%      0:  all positions 
%      1:  positions bbb and ccc 
%      2:  positions aaa and bbb 
%
%       bbb
%        2
%     a /  `  b
%     1      3
%    aaa     ccc
%
%    <Adjust>
%      a positive or negative integer to adjust locant numbers
% \end{verbatim}
%
% \changes{v5.00}{2010/10/01}{For bond coloring}
%    \begin{macrocode}
\def\@@trimethylene#1#2#3#4{%
\leavevmode
\iniatom\iniflag%initialize
\test@vrtx@trimethy{#1}{#4}%
%\test@vertix@sixv{#1}{a}{b}{c}{@}{@}{@}%
\begin{sfpicture}(450,480)(0,0)%
% %%%%%%%%%%%%%%%%%%
% % outer skeleton %
% %%%%%%%%%%%%%%%%%%
  \Put@Direct(171,-303){\SKbondB}% bond between 1 and 2
  \Put@Direct(171,-303){\SKbondA}% bond between 1 and 6
% %%%%%%%%%%%%%%%%%%%%%
% % inner double bond %
% %%%%%%%%%%%%%%%%%%%%%
\if@adoublebond\relax\Put@Direct(171,-303){\bondA}\fi
\if@bdoublebond\relax\Put@Direct(171,-303){\bondB}\fi
\if@Adoublebond\relax\Put@Direct(171,-303){\bondAA}\fi
\if@Bdoublebond\relax\Put@Direct(171,-303){\bondBB}\fi
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting hetero atoms %
% %%%%%%%%%%%%%%%%%%%%%%%%
\test@termcnt=#3\relax
%\set@hetatom@methyl{#1}{0}{0}{4}{0}%
\set@hetatom@methyl{#1}{#4}{0}{4}{0}%
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting substituents %
% %%%%%%%%%%%%%%%%%%%%%%%%
\@forsemicol\member:=#2\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#4\relax
\ifx\@memberb\@yl\else
\ifcase\@tmpaa%0 omit
\or
 \ifcase#3
   \setBScolor{\if@aclip \@cliptrue \else \@clipfalse\fi
   \Put@Direct(0,0){\@methsubstdL}}%
  \or\relax
  \or
   \setBScolor{\if@aclip \@cliptrue \else \@clipfalse\fi
   \Put@Direct(0,0){\@methsubstdL}}%
 \fi
\or
\setBScolor{\if@bclip \@acliptrue \else \@aclipfalse\fi
  \Put@Direct(171,-303){\@methsubsta}}%
\or
 \ifcase#3
  \setBScolor{\if@cclip \@cliptrue\else \@clipfalse\fi
  \Put@Direct(342,0){\@methsubstd}}%
 \or
  \setBScolor{\if@cclip \@cliptrue\else \@clipfalse\fi
  \Put@Direct(342,0){\@methsubstd}}%
 \or\relax
 \fi
\fi%end of ifcase
\fi\fi
}%
\end{sfpicture}}% end of \@@trimethylene
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\test@vrtx@trimethy}
% \changes{v2.00}{1998/12/21}{New command: \cs{test@vrtx@trimethy}}
%    \begin{macrocode}
\def\test@vrtx@trimethy#1#2{%
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\twoch@r\@membera{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#2\relax
\ifcase\@tmpaa%
 \or \if\@tmpb s\relax \xdef\aaa{}\else\if\@tmpb h\relax
     \xdef\aaa{@}\else\xdef\aaa{@}\fi\fi
 \or \if\@tmpb s\relax \xdef\bbb{}\else\if\@tmpb h\relax
     \xdef\bbb{@}\else\xdef\bbb{@}\fi\fi
 \or \if\@tmpb s\relax \xdef\ccc{}\else\if\@tmpb h\relax
     \xdef\ccc{@}\else\xdef\ccc{@}\fi\fi
\fi\fi}}
%    \end{macrocode}
% \end{macro}
%
% The |\yltrimethyleneposition| is used to adjust 
% substitution sites for the command |\@@trimethylene|. 
% \changes{v5.01}{2013/06/22}{bug fix}
%
% \begin{macro}{\yltrimethyleneposition}
% \begin{verbatim}
% \yltrimethylene{ATOMLIST}{BONDLIST}{TERMswitch}{Adjust}
%
%    <TERMswitch>
%      0:  all positions 
%      1:  positions bbb and ccc 
%      2:  positions aaa and bbb 
%
%       bbb
%        2
%     a /  `  b
%     1      3
%    aaa     ccc
%
%    <Adjust>
%      a positive or negative integer to adjust locant numbers
% \end{verbatim}
%
% \changes{v5.01}{2013/03/29}{bug fix on a terminal position}
% \changes{v5.01}{2013/07/20}{bug fix}
%    \begin{macrocode}%
\def\yltrimethyleneposition#1#2#3#4{%
\iniatom\iniflag%initialize2013/06/22
\reset@@yl%%2013/07/20bug fix
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\twoch@r\@membera{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#4\relax
\if\@tmpb s\else%2013/06/22added for bug fix
\ifcase\@tmpaa%
 \or \def\aaa{@}%\def\aaa{\@memberb}%
 \or \def\bbb{@}%\def\bbb{\@memberb}%
 \or \def\ccc{@}%\def\ccc{\@memberb}%
\fi\fi
\fi
}%
\@@ylswfalse%%%\@reset@ylsw
\@forsemicol\member:=#2\do{\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#4\relax
\ifx\@memberb\@yl\relax\@@ylswtrue\else\@@ylswfalse\fi
\if@@ylsw
\ifcase\@tmpaa%0 omit
\or
 \ifcase#3
   \ifx\aaa\empty
    \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
   \else
    \if@linterchainsw%interchain position
     \gdef\@ylii{0}\gdef\@yli{40}\global\@ylswtrue% subst. on 1
    \else% terminal position
%     \gdef\@ylii{40}\gdef\@yli{-24}\global\@ylswtrue% subst. on 1
     \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 1%bug fix 2013/03/29
    \fi
   \fi
  \or\relax
  \or
   \ifx\aaa\empty
    \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
   \else
    \if@linterchainsw%interchain position
     \gdef\@ylii{0}\gdef\@yli{40}\global\@ylswtrue% subst. on 1
    \else% terminal position
     \gdef\@ylii{40}\gdef\@yli{-24}\global\@ylswtrue% subst. on 1
    \fi
   \fi
 \fi
\or
   \ifx\bbb\empty
    \gdef\@ylii{-171}\gdef\@yli{-103}\global\@ylswtrue% subst. on 2
   \else
    \gdef\@ylii{-171}\gdef\@yli{-133}\global\@ylswtrue% subst. on 2
   \fi
\or
 \ifcase#3
   \ifx\ccc\empty
    \gdef\@ylii{-342}\gdef\@yli{0}\global\@ylswtrue% subst. on 3
   \else
    \if@rinterchainsw%interchain position
     \gdef\@ylii{-342}\gdef\@yli{40}\global\@ylswtrue% subst. on 3
    \else
     \gdef\@ylii{-382}\gdef\@yli{-24}\global\@ylswtrue% subst. on 3
    \fi
   \fi
 \or
   \ifx\ccc\empty
    \gdef\@ylii{-342}\gdef\@yli{0}\global\@ylswtrue% subst. on 3
   \else
    \if@rinterchainsw%interchain position
     \gdef\@ylii{-342}\gdef\@yli{40}\global\@ylswtrue% subst. on 3
    \else
     \gdef\@ylii{-382}\gdef\@yli{-24}\global\@ylswtrue% subst. on 3
    \fi
   \fi
 \or\relax
 \fi
\fi%end of ifcase
\fi}}% end of \yltrimethyleneposition
%    \end{macrocode}
% \end{macro}
%
% The counter |\test@termcnt|, which is equal to 
% the argument \#3 of command |\@@trimethylene|, 
% is used for testing a terminal point. 
%
% \begin{macro}{\test@termcnt}
% \changes{v2.00}{1998/12/21}{New command: \cs{test@termcnt}}
%    \begin{macrocode}
\newcount\test@termcnt
%    \end{macrocode}
% \end{macro}
%
% The |\set@hetatom@methyl| is used to set a hetero atom 
% at each vertex in the command |\@@trimethylene|. 
%
% \begin{macro}{\set@hetatom@methyl}
% \changes{v2.00}{1998/12/20}{New command: \cs{set@hetatom@methyl}}
%    \begin{macrocode}
\def\set@hetatom@methyl#1#2#3#4#5{%
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
%\expandafter\twoch@r\@membera{}%
\expandafter\twoCH@R\@membera//%
\ifnum#5 < 0\relax%
\@tmpaa=-\@tmpa\relax \advance\@tmpaa by#2\relax%
\else\@tmpaa=\@tmpa\relax \advance\@tmpaa by#2\relax \fi
\ifnum\@tmpaa >#3\relax%
\ifnum\@tmpaa <#4\relax%
\ifcase\@tmpaa%
\or%position 1 <--- position 6 of set@hetatom@sixv
 \ifnum\test@termcnt=1\else%not terminal point (left)
  \if\@tmpb h\relax%
     \@acliptrue%
     \putlatom{0}{30}{\@memberb}%  % right type
   \else\if\@tmpb s\relax%
     \@aclipfalse%
%     \putlatom{-4}{0}{\@memberb}%  % right type
     \putlatom{0}{0}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@acliptrue%
     \putlatom{36}{-23}{\@memberb}% % left type
   \fi\fi\fi
  \fi
\or%position 2 <--- position 1 of set@hetatom@sixv
  \if\@tmpb h\relax%
     \@bcliptrue%
     \putratom{171}{53}{\@memberb}%  % right type
   \else\if\@tmpb s\relax%
     \@bclipfalse%
     \putratom{171}{103}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@bcliptrue%
%     \putratom{140}{53}{\@memberb}%  % right type
     \putratom{140}{65}{\@memberb}%  % right type
   \fi\fi\fi
\or%position 3 <--- position 2 of set@hetatom@sixv
 \ifnum\test@termcnt=2\else%not terminal point (right)
  \if\@tmpb h\relax
     \@ccliptrue%
%     \putratom{320}{30}{\@memberb}%  % right type
     \putratom{330}{30}{\@memberb}%  % right type
   \else\if\@tmpb s\relax
     \@cclipfalse%
     \putratom{346}{0}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@ccliptrue%
     \putratom{306}{-23}{\@memberb}%  % right type
   \fi\fi\fi
  \fi
\fi% end of ifcase
\fi\fi\fi}}% end of the macro \set@hetatom@methyl
%    \end{macrocode}
% \end{macro}
%
% The macro |\trimethylene| has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
%
% \begin{macro}{\trimethylene}
% \begin{macro}{\@trimethylene}
%
% \begin{verbatim}
%
%       bbb
%        2
%     a /  ` b  (or uppercase letters)
%      /    `
%     1      3
%    aaa    ccc
% \end{verbatim}
%
%
% \begin{verbatim}
% \trimethylene[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character a, A, b, or B
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at a lower-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at a upper-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc.  
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
%           b          :  2,3-double bond 
%           B          :  1,2-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 3 atoms)
%
%       for n = 1 to 3
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 to 3 
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 3)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \trimethylene{1==N}{1==Cl;2==F}
%        \trimethylene[b]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The definition of |\trimethylene| uses a picture environment and 
% consists of the following unit processes: 
% \begin{enumerate}
% \item adjusting substitution site by 
%       |\yltrimethyleneposition|
% \item treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents by |\@@trimethylene|. 
% \end{enumerate}
%
% \changes{v3.01}{2002/4/30}{Replaced by \cs{ShiftPicEnv}}
%
%    \begin{macrocode}
\def\trimethylene{%
\@ifnextchar[{\@trimethylene[@}{\@trimethylene[]}}
\def\@trimethylene[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
\reset@interchainsw%
\yltrimethyleneposition{#2}{#3}{0}{0}%
\begin{ShiftPicEnv}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(450,480)(-50,-180){trimethylene}%2002/4/30 by S. Fujita
(50,180)%
\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member b\relax 
\@bdoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
\else\if\member B\relax 
\@Bdoublebondtrue%
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@trimeth%
\fi\fi\fi\fi}%
\@wrongbdWatrue%
\@wrongbdWdfalse%
   \Put@Direct(0,0){\@@trimethylene{#2}{#3}{0}{0}}%
%
%for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy 
\else\if\member b\relax%dummy  
\else\if\member A\relax%dummy  
\else\if\member B\relax%dummy  
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@trimeth%
\fi\fi\fi\fi}}%
\end{ShiftPicEnv}%
}% end of \trimethylene \@trimethylene 
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The inner command |\set@fusion@trimeth| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@trimeth}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@trimeth}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@trimeth{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if\@@tmpa a\relax%
        \putlratom{0}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{a}%
      \else\if\@@tmpa A\relax%
        \putlratom{171}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{A}%
      \else\if\@@tmpa b\relax%
        \putlratom{171}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{b}%
      \else\if\@@tmpa B\relax%
        \putlratom{342}{0}{\@@tmpb}%    % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{B}%
   \fi\fi\fi\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@trimeth
%    \end{macrocode}
% \end{macro}
%
% \subsection{Inverse direction}
%
% A trimethylene (or propane) and its hetera analogs can be typeset 
% by the command |\trimethylenei|, which is mainly based on 
% two inner commands: |\yltrimethyleneiposition| for adjusting a 
% substitution site and |\@@trimethylenei| for 
% placing hetero atoms, double bonds, and substituents.
%
% \begin{macro}{\@@trimethylenei}
% \begin{verbatim}
% \@@trimethylenei{ATOMLIST}{BONDLIST}{TERMswitch}{Adjust}
%
%    <TERMswitch>
%      0:  all positions 
%      1:  positions bbb and ccc 
%      2:  positions aaa and bbb 
%
%    aaa      ccc
%     1       3
%     a `    / b
%        `  / 
%        2
%       bbb
%
%    <Adjust>
%      a positive or negative integer to adjust locant numbers
% \end{verbatim}
%
% \changes{v5.00}{2010/10/01}{For bond coloring}
%    \begin{macrocode}
\def\@@trimethylenei#1#2#3#4{%
\leavevmode
\iniatom\iniflag%initialize
\test@vrtx@trimethy{#1}{#4}%
%\test@vertix@sixv{#1}{a}{b}{c}{@}{@}{@}%
\begin{sfpicture}(450,480)(0,0)
% %%%%%%%%%%%%%%%%%%
% % outer skeleton %
% %%%%%%%%%%%%%%%%%%
  \Put@Direct(171,0){\SKbondAi}% bond between 1 and 2
  \Put@Direct(171,0){\SKbondBi}% bond between 2 and 3
% %%%%%%%%%%%%%%%%%%%%%
% % inner double bond %
% %%%%%%%%%%%%%%%%%%%%%
\if@adoublebond\relax\Put@Direct(171,0){\bondAi}\fi
\if@bdoublebond\relax\Put@Direct(171,0){\bondBi}\fi
\if@Adoublebond\relax\Put@Direct(171,0){\bondAAi}\fi
\if@Bdoublebond\relax\Put@Direct(171,0){\bondBBi}\fi
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting hetero atoms %
% %%%%%%%%%%%%%%%%%%%%%%%%
\test@termcnt=#3\relax
%\set@hetatom@methyli{#1}{0}{0}{4}{0}%
\set@hetatom@methyli{#1}{#4}{0}{4}{0}%
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting substituents %
% %%%%%%%%%%%%%%%%%%%%%%%%
\@forsemicol\member:=#2\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#4\relax
\ifx\@memberb\@yl\else
\ifcase\@tmpaa%0 omit
\or
 \ifcase#3
   \setBScolor{\Put@Direct(0,-303){\@methsubstaL}}%
  \or\relax
  \or
   \setBScolor{\Put@Direct(0,-303){\@methsubstaL}}%
 \fi
\or
\setBScolor{\if@bclip \@cliptrue \else \@clipfalse\fi
  \Put@Direct(171,0){\@methsubstd}}%
\or
 \ifcase#3
  \setBScolor{\if@cclip \@acliptrue\else \@aclipfalse\fi
  \Put@Direct(342,-303){\@methsubsta}}%
 \or
  \setBScolor{\if@cclip \@acliptrue\else \@aclipfalse\fi
  \Put@Direct(342,-303){\@methsubsta}}%
 \or\relax
 \fi
\fi%end of ifcase
\fi\fi
}%
\end{sfpicture}}% end of \@@trimethylenei
%    \end{macrocode}
% \end{macro}
%
% The |\yltrimethyleneiposition| is used to adjust 
% substitution sites. 
% \changes{v5.01}{2013/06/22}{bug fix}
% \changes{v5.01}{2013/07/20}{bug fix}
%
% \begin{macro}{\yltrimethyleneiposition}
% \begin{verbatim}
% \yltrimethylenei{ATOMLIST}{BONDLIST}{TERMswitch}{Adjust}
%
%    <TERMswitch>
%      0:  all positions 
%      1:  positions bbb and ccc 
%      2:  positions aaa and bbb 
%
%    aaa      ccc
%     1       3
%     a `    / b
%        `  / 
%        2
%       bbb
%
%    <Adjust>
%      a positive or negative integer to adjust locant numbers
% \end{verbatim}
%
%    \begin{macrocode}%
\def\yltrimethyleneiposition#1#2#3#4{%
\iniatom\iniflag%initialize2013/06/22
\reset@@yl%%2013/07/20bug fix
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
%\expandafter\twoch@r\@membera{}%
\expandafter\twoCH@R\@membera//%
\@tmpaa=\@tmpa \advance\@tmpaa by#4\relax
\if\@tmpb s\else%2013/06/22added for bug fix
\ifcase\@tmpaa%
 \or \def\aaa{@}%\def\aaa{\@memberb}%
 \or \def\bbb{@}%\def\bbb{\@memberb}%
 \or \def\ccc{@}%\def\ccc{\@memberb}%
\fi\fi
\fi
}%
\@@ylswfalse%%%\@reset@ylsw
\@forsemicol\member:=#2\do{\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#4\relax
\ifx\@memberb\@yl\relax\@@ylswtrue\else\@@ylswfalse\fi
\if@@ylsw
\ifcase\@tmpaa%0 omit
\or%%%%%%position 1
 \ifcase#3
   \ifx\aaa\empty
%%    \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
    \gdef\@ylii{0}\gdef\@yli{-103}\global\@ylswtrue% subst. on 1
   \else
    \if@linterchainsw%interchain position
%     \gdef\@ylii{0}\gdef\@yli{40}\global\@ylswtrue% subst. on 1
     \gdef\@ylii{0}\gdef\@yli{-133}\global\@ylswtrue% subst. on 1
    \else% terminal position
%%     \gdef\@ylii{40}\gdef\@yli{-24}\global\@ylswtrue% subst. on 1
     \gdef\@ylii{40}\gdef\@yli{-79}\global\@ylswtrue% subst. on 1
    \fi
   \fi
  \or\relax
  \or
   \ifx\aaa\empty
%%    \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
    \gdef\@ylii{0}\gdef\@yli{-103}\global\@ylswtrue% subst. on 1
   \else
    \if@linterchainsw%interchain position
     \gdef\@ylii{0}\gdef\@yli{-133}\global\@ylswtrue% subst. on 1
%     \gdef\@ylii{0}\gdef\@yli{40}\global\@ylswtrue% subst. on 1
    \else% terminal position
%%     \gdef\@ylii{40}\gdef\@yli{-24}\global\@ylswtrue% subst. on 1
     \gdef\@ylii{40}\gdef\@yli{-79}\global\@ylswtrue% subst. on 1
    \fi
   \fi
 \fi
\or%%%%%%%%position 2
   \ifx\bbb\empty
%%    \gdef\@ylii{-171}\gdef\@yli{-103}\global\@ylswtrue% subst. on 2
    \gdef\@ylii{-171}\gdef\@yli{0}\global\@ylswtrue% subst. on 2
   \else
%%    \gdef\@ylii{-171}\gdef\@yli{-133}\global\@ylswtrue% subst. on 2
    \gdef\@ylii{-171}\gdef\@yli{50}\global\@ylswtrue% subst. on 2
   \fi
\or%%%%%%%%position 3
 \ifcase#3
   \ifx\ccc\empty
%%    \gdef\@ylii{-342}\gdef\@yli{0}\global\@ylswtrue% subst. on 3
    \gdef\@ylii{-342}\gdef\@yli{-103}\global\@ylswtrue% subst. on 3
   \else
    \if@rinterchainsw%interchain position
%%     \gdef\@ylii{-342}\gdef\@yli{40}\global\@ylswtrue% subst. on 3
     \gdef\@ylii{-342}\gdef\@yli{-133}\global\@ylswtrue% subst. on 3
    \else
%%     \gdef\@ylii{-382}\gdef\@yli{-24}\global\@ylswtrue% subst. on 3
     \gdef\@ylii{-382}\gdef\@yli{-79}\global\@ylswtrue% subst. on 3
    \fi
   \fi
 \or
   \ifx\ccc\empty
%    \gdef\@ylii{-342}\gdef\@yli{0}\global\@ylswtrue% subst. on 3
    \gdef\@ylii{-342}\gdef\@yli{-103}\global\@ylswtrue% subst. on 3
   \else
    \if@rinterchainsw%interchain position
%     \gdef\@ylii{-342}\gdef\@yli{40}\global\@ylswtrue% subst. on 3
     \gdef\@ylii{-342}\gdef\@yli{-133}\global\@ylswtrue% subst. on 3
    \else
%     \gdef\@ylii{-382}\gdef\@yli{-24}\global\@ylswtrue% subst. on 3
     \gdef\@ylii{-382}\gdef\@yli{-79}\global\@ylswtrue% subst. on 3
    \fi
   \fi
 \or\relax
 \fi
\fi%end of ifcase
\fi}}% end of \yltrimethyleneiposition
%    \end{macrocode}
% \end{macro}
%
% The |\set@hetatom@methyli| is used to set a hetero atom 
% at each vertex in the command |\@@trimethylenei|. 
%
% \begin{macro}{\set@hetatom@methyli}
% \changes{v2.00}{1998/12/20}{New command: \cs{set@hetatom@methyli}}
%    \begin{macrocode}
\def\set@hetatom@methyli#1#2#3#4#5{%
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\twoch@r\@membera{}%
\ifnum#5 < 0\relax%
\@tmpaa=-\@tmpa\relax \advance\@tmpaa by#2\relax%
\else\@tmpaa=\@tmpa\relax \advance\@tmpaa by#2\relax \fi
\ifnum\@tmpaa >#3\relax%
\ifnum\@tmpaa <#4\relax%
\ifcase\@tmpaa%
\or%position 1 <-- \set@hetatom@sixv position 5
 \ifnum\test@termcnt=1\else%not terminal point (left)
  \if\@tmpb h\relax
     \@acliptrue%
     \putlatom{0}{70}{\@memberb}%  % right type
   \else\if\@tmpb s\relax
     \@aclipfalse%
     \putlatom{0}{103}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@acliptrue%
     \putlatom{36}{65}{\@memberb}%  % left type
   \fi\fi\fi
 \fi
\or%position 2 <-- \set@hetatom@sixv position 4
  \if\@tmpb h\relax
     \@bcliptrue%
     \putratom{171}{50}{\@memberb}%  % right type
   \else\if\@tmpb s\relax
     \@bclipfalse%
     \putratom{171}{0}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@bcliptrue%
%     \putratom{140}{-10}{\@memberb}%  % right type
     \putratom{140}{-23}{\@memberb}%  % right type
   \fi\fi\fi
\or%position 3 <-- \set@hetatom@sixv position 3
 \ifnum\test@termcnt=2\else%not terminal point (right)
  \if\@tmpb h\relax
     \@ccliptrue%
     \putratom{342}{70}{\@memberb}%  % right type
   \else\if\@tmpb s\relax
     \@cclipfalse%
     \putratom{342}{103}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@ccliptrue%
     \putratom{306}{65}{\@memberb}%   % right type
   \fi\fi\fi
  \fi
\fi% end of ifcase
\fi\fi\fi}}% end of the macro \set@hetatom@methyli
%    \end{macrocode}
% \end{macro}
%
% The macro |\trimethylenei| has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
%
% \begin{macro}{\trimethylenei}
% \begin{macro}{\@trimethylenei}
%
% \begin{verbatim}
%    aaa      ccc
%     1       3
%     a `    / b (or uppercase letters)
%        `  / 
%        2
%       bbb
% \end{verbatim}
%
%
% \begin{verbatim}
% \trimethylenei[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character a, A, b, or B
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at a upper-side of an outer skeletal bond, 
% while a uppercase letter typesets a double bond at a lower-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc.  
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
%           b          :  2,3-double bond 
%           B          :  1,2-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 3 atoms)
%
%       for n = 1 to 3
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 to 3 
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 3)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \trimethylenei{1==N}{1==Cl;2==F}
%        \trimethylenei[b]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The definition of |\trimethylene| uses a picture environment and 
% consists of the following unit processes: 
% \begin{enumerate}
% \item adjusting substitution site by 
%       |\yltrimethyleneiposition|
% \item treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents by |\@@trimethylenei|. 
% \end{enumerate}
%
%    \begin{macrocode}
\def\trimethylenei{%
\@ifnextchar[{\@trimethylenei[@}{\@trimethylenei[]}}
\def\@trimethylenei[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
\reset@interchainsw%
\yltrimethyleneiposition{#2}{#3}{0}{0}%
\begin{ShiftPicEnv}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(450,480)(-50,-180){trimethylenei}%2002/4/30 by S. Fujita
(50,180)%
\reset@double%
%\@adoublebondfalse
%\@bdoublebondfalse
%\@Adoublebondfalse
%\@Bdoublebondfalse
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member b\relax 
\@bdoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
\else\if\member B\relax 
\@Bdoublebondtrue
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@trimethi
\fi\fi\fi\fi}%
\@wrongbdWafalse
\@wrongbdWdtrue
   \Put@Direct(0,0){\@@trimethylenei{#2}{#3}{0}{0}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy 
\else\if\member b\relax%dummy  
\else\if\member A\relax%dummy  
\else\if\member B\relax%dummy  
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@trimethi
\fi\fi\fi\fi}}%
\end{ShiftPicEnv}%
}% end of \trimethylenei
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The inner command |\set@fusion@trimethi| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@trimethi}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@trimethi}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@trimethi{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if\@@tmpa a\relax%
        \putlratom{0}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{a}%
      \else\if\@@tmpa A\relax%
        \putlratom{171}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{A}%
      \else\if\@@tmpa b\relax%
        \putlratom{171}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{b}%
      \else\if\@@tmpa B\relax%
        \putlratom{342}{103}{\@@tmpb}%    % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{B}%
   \fi\fi\fi\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@trimethi
%    \end{macrocode}
% \end{macro}
%
% \section{Dimethylene}
% \subsection{Normal direction}
%
% A dimethylene (or ethane) and its hetera analogs can be typeset 
% by the command |\dimethylene|, which is mainly based on 
% two inner commands: |\yldimethyleneposition| for adjusting a 
% substitution site and |\@@dimethylene| for 
% placing hetero atoms, double bonds, and substituents.
%
% \begin{macro}{\@@dimethylene}
% \begin{verbatim}
% \@@dimethylene{ATOMLIST}{BONDLIST}{TERMswitch}{Adjust}
%
%    <TERMswitch>
%      0:  all positions 
%      1:  position bbb 
%      2:  position aaa
%
%       bbb
%        2
%     a /
%     1
%    aaa
%
%    <Adjust>
%      a positive or negative integer to adjust locant numbers
% \end{verbatim}
%
% \changes{v5.00}{2010/10/01}{For bond coloring}
%    \begin{macrocode}
\def\@@dimethylene#1#2#3#4{%
\leavevmode
\iniatom\iniflag%initialize
\test@vrtx@dimethy{#1}{#4}%
%\test@vertix@sixv{#1}{a}{b}{@}{@}{@}{@}%
\begin{sfpicture}(250,480)(0,0)%
% %%%%%%%%%%%%%%%%%%
% % outer skeleton %
% %%%%%%%%%%%%%%%%%%
  \Put@Direct(171,-303){\SKbondA}% bond between 1 and 2
% %%%%%%%%%%%%%%%%%%%%%
% % inner double bond %
% %%%%%%%%%%%%%%%%%%%%%
\if@adoublebond
 \Put@Direct(171,-303){\bondA}%upper side double bond
\else\if@Adoublebond
 \Put@Direct(171,-303){\bondAA}%lower side double bond
\fi\fi%
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting hetero atoms %
% %%%%%%%%%%%%%%%%%%%%%%%%
\test@termcnt=#3\relax
%\set@hetatom@methyl{#1}{0}{0}{3}{0}%
\set@hetatom@methyl{#1}{#4}{0}{3}{0}%
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting substituents %
% %%%%%%%%%%%%%%%%%%%%%%%%
\@forsemicol\member:=#2\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#4\relax
\ifx\@memberb\@yl\else
\ifcase\@tmpaa%0 omit
\or
 \ifcase#3
   \setBScolor{\if@aclip \@cliptrue \else \@clipfalse\fi
   \Put@Direct(0,0){\@methsubstdL}}%
  \or\relax
  \or
   \setBScolor{\if@aclip \@cliptrue \else \@clipfalse\fi
   \Put@Direct(0,0){\@methsubstdL}}%
 \fi
\or
 \ifcase#3
  \setBScolor{\if@bclip \@acliptrue \else \@aclipfalse\fi
   \Put@Direct(171,-303){\@methsubsta}}%
 \or
  \setBScolor{\if@bclip \@acliptrue \else \@aclipfalse\fi
   \Put@Direct(171,-303){\@methsubsta}}%
 \or\relax
 \fi
\fi%end of ifcase
\fi\fi%
}%
\end{sfpicture}}% end of \@@dimethylene
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\test@vrtx@dimethy}
% \changes{v2.00}{1998/12/21}{New command: \cs{test@vrtx@dimethy}}
%    \begin{macrocode}
\def\test@vrtx@dimethy#1#2{%
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\twoch@r\@membera{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#2\relax
\ifcase\@tmpaa%
 \or \if\@tmpb s\relax \xdef\aaa{}\else\if\@tmpb h\relax
     \xdef\aaa{@}\else\xdef\aaa{@}\fi\fi
 \or \if\@tmpb s\relax \xdef\bbb{}\else\if\@tmpb h\relax
     \xdef\bbb{@}\else\xdef\bbb{@}\fi\fi
\fi\fi}}
%    \end{macrocode}
% \end{macro}
%
% The |\yldimethyleneposition| is used to adjust 
% substitution sites. 
% \changes{v5.01}{2013/06/22}{bug fix}
%
% \begin{macro}{\yldimethyleneposition}
% \begin{verbatim}
% \yldimethylene{ATOMLIST}{BONDLIST}{TERMswitch}{Adjust}
%
%    <TERMswitch>
%      0:  all positions 
%      1:  position bbb
%      2:  position aaa
%
%       bbb
%        2
%     a /
%     1 
%    aaa
%
%    <Adjust>
%      a positive or negative integer to adjust locant numbers
% \end{verbatim}
%
% \changes{v5.01}{2013/07/20}{Bug fix}
%
%    \begin{macrocode}%
\def\yldimethyleneposition#1#2#3#4{%
\iniatom\iniflag%initialize2013/06/22
\reset@@yl%%2013/07/20bug fix
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\twoch@r\@membera{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#4\relax
\if\@tmpb s\else%2013/06/22added for bug fix
\ifcase\@tmpaa%
 \or \def\aaa{@}%\def\aaa{\@memberb}%2013/06/22
 \or \def\bbb{@}%\def\bbb{\@memberb}%2013/06/22
\fi\fi
\fi
}%
\@@ylswfalse%%%\@reset@ylsw
\@forsemicol\member:=#2\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#4\relax
\ifx\@memberb\@yl\relax\@@ylswtrue\else\@@ylswfalse\fi
\if@@ylsw
\ifcase\@tmpaa%0 omit
\or
 \ifcase#3
   \ifx\aaa\empty
%    \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
    \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
   \else
    \if@linterchainsw%interchain position
     \gdef\@ylii{0}\gdef\@yli{40}\global\@ylswtrue% subst. on 1
    \else%terminal position
     \gdef\@ylii{40}\gdef\@yli{-24}\global\@ylswtrue% subst. on 1
    \fi
   \fi
  \or\relax
  \or
   \ifx\aaa\empty
    \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
   \else
    \if@linterchainsw%interchain position
     \gdef\@ylii{0}\gdef\@yli{40}\global\@ylswtrue% subst. on 1
    \else%terminal position
     \gdef\@ylii{40}\gdef\@yli{-24}\global\@ylswtrue% subst. on 1
    \fi
   \fi
 \fi
\or
 \ifcase#3 
   \ifx\bbb\empty
    \gdef\@ylii{-171}\gdef\@yli{-103}\global\@ylswtrue% subst. on 2
   \else
    \if@rinterchainsw%interchain position
     \gdef\@ylii{-171}\gdef\@yli{-133}\global\@ylswtrue% subst. on 2
    \else%terminal position
     \gdef\@ylii{-211}\gdef\@yli{-93}\global\@ylswtrue% subst. on 2
    \fi
   \fi
  \or
   \ifx\bbb\empty
    \gdef\@ylii{-171}\gdef\@yli{-103}\global\@ylswtrue% subst. on 2
   \else
    \if@rinterchainsw%interchain position
     \gdef\@ylii{-171}\gdef\@yli{-133}\global\@ylswtrue% subst. on 2
    \else%terminal position
     \gdef\@ylii{-211}\gdef\@yli{-93}\global\@ylswtrue% subst. on 2
    \fi
   \fi
  \or \relax
  \fi
\fi%end of ifcase
\fi\fi}}% end of \yldimethyleneposition
%    \end{macrocode}
% \end{macro}
%
%
% The macro |\dimethylene| has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
%
% \begin{macro}{\dimethylene}
% \begin{macro}{\@dimethylene}
% \begin{verbatim}
%
%       bbb
%        2
%     a /      (or uppercase letters)
%      /
%     1
%    aaa 
% \end{verbatim}
%
%
% \begin{verbatim}
% \dimethylene[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character a or A, 
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at a lower-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at a upper-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc. ) 
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 2 atoms)
%
%       for n = 1 and 2
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 and 2
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 2)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \dimethylene{1==N}{1==Cl;2==F}
%        \dimethylene[a]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The definition of |\dimethylene| uses a picture environment and 
% consists of the following unit processes: 
% \begin{enumerate}
% \item adjusting substitution site by 
%       |\yldimethyleneposition|
% \item treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents by |\@@dimethylene|. 
% \end{enumerate}
%
%    \begin{macrocode}
\def\dimethylene{%
\@ifnextchar[{\@dimethylene[@}{\@dimethylene[]}}
\def\@dimethylene[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
\reset@interchainsw%
\yldimethyleneposition{#2}{#3}{0}{0}%
\begin{ShiftPicEnv}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(250,480)(-50,-180){dimethylene}%2002/4/30 by S. Fujita
(50,180)%
\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@dimeth
\fi\fi}%
\@wrongbdWafalse
\@wrongbdWdfalse
   \Put@Direct(0,0){\@@dimethylene{#2}{#3}{0}{0}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy
\else\if\member A\relax%dummy 
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@dimeth
\fi\fi}}%
\end{ShiftPicEnv}%
}% end of \dimethylene
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The inner command |\set@fusion@dimeth| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@dimeth}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@dimeth}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@dimeth{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if\@@tmpa a\relax%
        \putlratom{0}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{a}%
 \else\if\@@tmpa A\relax%
        \putlratom{171}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{A}%
 \fi\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@dimeth
%    \end{macrocode}
% \end{macro}
%
% \subsection{Inverse direction}
%
% A dimethylene (or ethane) and its hetera analogs (of inverse direction) 
% can be typeset by the command |\dimethylenei|, which is mainly based on 
% two inner commands: |\yldimethyleneiposition| for adjusting a 
% substitution site and |\@@dimethylenei| for 
% placing hetero atoms, double bonds, and substituents.
%
% \begin{macro}{\@@dimethylenei}
% \begin{verbatim}
% \@@dimethylenei{ATOMLIST}{BONDLIST}{TERMswitch}{Adjust}
%
%    <TERMswitch>
%      0:  all positions 
%      1:  position bbb  
%      2:  positions aaa
%
%    aaa
%     1
%     a `
%        `
%          2
%         bbb
%
%    <Adjust>
%      a positive or negative integer to adjust locant numbers
% \end{verbatim}
%
% \changes{v5.00}{2010/10/01}{For bond coloring}
%    \begin{macrocode}
\def\@@dimethylenei#1#2#3#4{%
\leavevmode
\iniatom\iniflag%initialize
\test@vrtx@dimethy{#1}{#4}%
%\test@vertix@sixv{#1}{a}{b}{@}{@}{@}{@}%
\begin{sfpicture}(250,480)(0,0)%
% %%%%%%%%%%%%%%%%%%
% % outer skeleton %
% %%%%%%%%%%%%%%%%%%
  \Put@Direct(171,0){\SKbondAi}% bond between 1 and 2
% %%%%%%%%%%%%%%%%%%%%%
% % inner double bond %
% %%%%%%%%%%%%%%%%%%%%%
\if@adoublebond
 \Put@Direct(171,0){\bondAi}%upper side double bond
\else\if@Adoublebond
 \Put@Direct(171,0){\bondAAi}%lower side double bond
\fi\fi%
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting hetero atoms %
% %%%%%%%%%%%%%%%%%%%%%%%%
\test@termcnt=#3\relax
%\set@hetatom@methyli{#1}{0}{0}{3}{0}%
\set@hetatom@methyli{#1}{#4}{0}{3}{0}%
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting substituents %
% %%%%%%%%%%%%%%%%%%%%%%%%
\@forsemicol\member:=#2\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#4\relax
\ifx\@memberb\@yl\else
\ifcase\@tmpaa%0 omit
\or
 \ifcase#3
   \setBScolor{\Put@Direct(0,-303){\@methsubstaL}}%
  \or\relax
  \or
   \setBScolor{\Put@Direct(0,-303){\@methsubstaL}}%
 \fi
\or
 \ifcase#3
  \setBScolor{\if@bclip \@cliptrue \else \@clipfalse\fi
   \Put@Direct(171,0){\@methsubstd}}%
 \or
  \setBScolor{\if@bclip \@cliptrue \else \@clipfalse\fi
   \Put@Direct(171,0){\@methsubstd}}%
 \or\relax
 \fi
\fi%end of ifcase
\fi\fi%
}%
\end{sfpicture}}% end of \@@dimethylenei
%    \end{macrocode}
% \end{macro}
%
% The |\yldimethyleneiposition| is used to adjust 
% substitution sites. 
% \changes{v5.01}{2013/06/22}{bug fix}
% \changes{v5.01}{2013/07/20}{bug fix}
%
% \begin{macro}{\yldimethyleneiposition}
% \begin{verbatim}
% \yldimethylenei{ATOMLIST}{BONDLIST}{TERMswitch}{Adjust}
%
%    <TERMswitch>
%      0:  all positions 
%      1:  position bbb
%      2:  position aaa
%
%    aaa
%     1
%     a `
%        `
%          2
%         bbb
%
%    <Adjust>
%      a positive or negative integer to adjust locant numbers
% \end{verbatim}
%
%    \begin{macrocode}%
\def\yldimethyleneiposition#1#2#3#4{%
\iniatom\iniflag%initialize2013/06/22
\reset@@yl%%2013/07/20bug fix
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\twoch@r\@membera{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#4\relax
\if\@tmpb s\else%2013/06/22added for bug fix
\ifcase\@tmpaa%
 \or \def\aaa{@}%\def\aaa{\@memberb}%2013/06/22
 \or \def\bbb{@}%\def\bbb{\@memberb}%2013/06/22
\fi\fi
\fi
}%
\@@ylswfalse%%%\@reset@ylsw
\@forsemicol\member:=#2\do{\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\@tmpaa=\@tmpa \advance\@tmpaa by#4\relax
\ifx\@memberb\@yl\relax\@@ylswtrue\else\@@ylswfalse\fi
\if@@ylsw
\ifcase\@tmpaa%0 omit
\or%%%%%%%%position 1
 \ifcase#3
   \ifx\aaa\empty
%    \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
    \gdef\@ylii{0}\gdef\@yli{-103}\global\@ylswtrue% subst. on 1
   \else
    \if@linterchainsw%interchain position
%     \gdef\@ylii{0}\gdef\@yli{40}\global\@ylswtrue% subst. on 1
     \gdef\@ylii{0}\gdef\@yli{-133}\global\@ylswtrue% subst. on 1
    \else%terminal position
%     \gdef\@ylii{40}\gdef\@yli{-24}\global\@ylswtrue% subst. on 1
     \gdef\@ylii{40}\gdef\@yli{-79}\global\@ylswtrue% subst. on 1
    \fi
   \fi
  \or\relax
  \or
   \ifx\aaa\empty
%    \gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
    \gdef\@ylii{0}\gdef\@yli{-103}\global\@ylswtrue% subst. on 1
   \else
    \if@linterchainsw%interchain position
%     \gdef\@ylii{0}\gdef\@yli{40}\global\@ylswtrue% subst. on 1
     \gdef\@ylii{0}\gdef\@yli{-133}\global\@ylswtrue% subst. on 1
    \else%terminal position
%     \gdef\@ylii{40}\gdef\@yli{-24}\global\@ylswtrue% subst. on 1
     \gdef\@ylii{40}\gdef\@yli{-79}\global\@ylswtrue% subst. on 1
    \fi
   \fi
 \fi
\or%%%%%%%%position 2
 \ifcase#3 
   \ifx\bbb\empty
%    \gdef\@ylii{-171}\gdef\@yli{-103}\global\@ylswtrue% subst. on 2
    \gdef\@ylii{-171}\gdef\@yli{0}\global\@ylswtrue% subst. on 2
   \else
    \if@rinterchainsw%interchain position
%     \gdef\@ylii{-171}\gdef\@yli{-133}\global\@ylswtrue% subst. on 2
     \gdef\@ylii{-171}\gdef\@yli{33}\global\@ylswtrue% subst. on 2
    \else%terminal position
 %    \gdef\@ylii{-211}\gdef\@yli{-93}\global\@ylswtrue% subst. on 2
     \gdef\@ylii{-211}\gdef\@yli{-10}\global\@ylswtrue% subst. on 2
    \fi
   \fi
  \or
   \ifx\bbb\empty
%    \gdef\@ylii{-171}\gdef\@yli{-103}\global\@ylswtrue% subst. on 2
    \gdef\@ylii{-171}\gdef\@yli{0}\global\@ylswtrue% subst. on 2
   \else
    \if@rinterchainsw%interchain position
%     \gdef\@ylii{-171}\gdef\@yli{-133}\global\@ylswtrue% subst. on 2
     \gdef\@ylii{-171}\gdef\@yli{33}\global\@ylswtrue% subst. on 2
    \else%terminal position
%     \gdef\@ylii{-211}\gdef\@yli{-93}\global\@ylswtrue% subst. on 2
     \gdef\@ylii{-211}\gdef\@yli{-10}\global\@ylswtrue% subst. on 2
    \fi
   \fi
  \or \relax
  \fi
\fi%end of ifcase
\fi}}% end of \yldimethyleneiposition
%    \end{macrocode}
% \end{macro}
%
% The macro |\dimethylenei| has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
%
% \begin{macro}{\dimethylenei}
% \begin{macro}{\@dimethylenei}
% \begin{verbatim}
%
%    aaa
%     1
%     a `   (or uppercase letter)
%        `
%          2
%         bbb
% \end{verbatim}
%
% \begin{verbatim}
% \dimethylenei[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character a or A, 
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at a upper-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at a lower-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc. ) 
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 2 atoms)
%
%       for n = 1 and 2
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 and 2
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 2)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \dimethylenei{1==N}{1==Cl;2==F}
%        \dimethylenei[a]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The definition of |\dimethylenei| uses a picture environment and 
% consists of the following unit processes: 
% \begin{enumerate}
% \item adjusting substitution site by 
%       |\yldimethyleneposition|
% \item treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents by |\@@dimethylene|. 
% \end{enumerate}
%
%    \begin{macrocode}
\def\dimethylenei{%
\@ifnextchar[{\@dimethylenei[@}{\@dimethylenei[]}}
\def\@dimethylenei[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
\reset@interchainsw%
\yldimethyleneiposition{#2}{#3}{0}{0}%
\begin{ShiftPicEnv}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(250,480)(-50,-180){dimethylenei}%2002/4/30 by S. Fujita
(50,180)%
\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@dimethi
\fi\fi}%
\@wrongbdWafalse
\@wrongbdWdfalse
   \Put@Direct(0,0){\@@dimethylenei{#2}{#3}{0}{0}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy 
\else\if\member A\relax%dummy 
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@dimethi
\fi\fi}}%
\end{ShiftPicEnv}%
}% end of \dimethylenei
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The inner command |\set@fusion@dimethi| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@dimethi}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@dimethi}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@dimethi{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if\@@tmpa a\relax%
        \putlratom{0}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{a}%
   \else\if\@@tmpa A\relax%
        \putlratom{171}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{A}%
\fi\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@dimethi
%    \end{macrocode}
% \end{macro}
%
% \section{Tetramethylenes}
% \subsection{Normal direction}
%
% The macro |\tetramethylene| has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
%
% \begin{macro}{\tetramethylene}
% \begin{macro}{\@tetramethylene}
%
% \begin{verbatim}
%
%       bbb     ddd
%        2       4
%     a /  ` b  / c (or uppercase letters)
%      /    `  /
%     1      3
%    aaa    ccc
% \end{verbatim}
%
% \begin{verbatim}
% \tetramethylene[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character selected from 
% a to c (or A to C), 
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at a lower-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at a upper-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc.)  
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
%           b          :  2,3-double bond 
%           B          :  2,3-double bond in an opposite side
%           c          :  3,4-double bond 
%           C          :  3,4-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 4 atoms)
%
%       for n = 1 to 4
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 to 4
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 4)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \tetramethylene{1==N}{1==Cl;2==F}
%        \tetramethylene[b]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The definition of |\tetramethylene| uses a picture environment and 
% is based on |\@@trimethylene| and |\@@dimethylene|, each of which
% is consist of the following unit processes: 
% \begin{enumerate}
% \item adjusting substitution site by 
%       |\yltrimethyleneposition| or 
%       |\yldimethyleneposition|
% \item treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents by |\@@trimethylene|or |\@@dimethylene|. 
% \end{enumerate}
%
%    \begin{macrocode}
\def\tetramethylene{%
\@ifnextchar[{\@tetramethylene[@}{\@tetramethylene[]}}
\def\@tetramethylene[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
{\@linterchainswfalse%
\@rinterchainswtrue%
\yltrimethyleneposition{#2}{#3}{0}{0}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{0}\def\@@yli{0}\fi
\else
{\@rinterchainswfalse%
\@linterchainswtrue%
\yldimethyleneposition{#2}{#3}{1}{-2}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-342}\def\@@yli{0}\fi\fi
\fi
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(900,480)(-200,-180){tetramethylene}%2002/4/30 by S. Fujita
(200,180)%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member b\relax 
\@bdoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
\else\if\member B\relax 
\@Bdoublebondtrue
%\else\if\member c\relax%dummy
%\else\if\member C\relax%dummy
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@tetrameth
%\fi\fi
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(0,0){\@@trimethylene{#2}{#3}{0}{0}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member c\relax 
\@adoublebondtrue
\else\if\member C\relax 
\@Adoublebondtrue
\fi\fi}%
\@wrongbdWafalse
\@wrongbdWdtrue
\Put@Direct(342,0){\@@dimethylene{#2}{#3}{1}{-2}}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy 
\else\if\member b\relax%dummy 
\else\if\member A\relax%dummy 
\else\if\member B\relax%dummy 
\else\if\member c\relax%dummy
\else\if\member C\relax%dummy
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@tetrameth
\fi\fi
\fi\fi\fi\fi}}%
\end{ShiftPicEnvB}%
}% end of \tetramethylene
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The inner command |\set@fusion@tetrameth| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@tetrameth}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@tetrameth}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@tetrameth{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if\@@tmpa a\relax%
        \putlratom{0}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{a}%
      \else\if\@@tmpa A\relax%
        \putlratom{171}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{A}%
      \else\if\@@tmpa b\relax%
        \putlratom{171}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{b}%
      \else\if\@@tmpa B\relax%
        \putlratom{342}{0}{\@@tmpb}%    % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{B}%
      \else\if\@@tmpa c\relax%
        \putlratom{342}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{c}%
      \else\if\@@tmpa C\relax%
        \putlratom{513}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{C}%
   \fi\fi
   \fi\fi\fi\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@tetrameth
%    \end{macrocode}
% \end{macro}
%
% \subsection{Inverse direction}
%
% The macro |\tetramethylenei| has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
%
% \begin{macro}{\tetramethylenei}
% \begin{macro}{\@tetramethylenei}
%
% \begin{verbatim}
%
%  aaa      ccc
%    1       3
%   a `   b /  ` c  (or uppercase letters)
%       `  /    `
%        2        4
%       bbb       ddd
% \end{verbatim}
%
% \begin{verbatim}
% \tetramethylenei[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character selected from 
% a to c (or A to C), 
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at a lower-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at a upper-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc.)  
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
%           b          :  2,3-double bond 
%           B          :  2,3-double bond in an opposite side
%           c          :  3,4-double bond 
%           C          :  3,4-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 4 atoms)
%
%       for n = 1 to 4
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 to 4
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 4)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \tetramethylenei{1==N}{1==Cl;2==F}
%        \tetramethylenei[b]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The definition of |\tetramethylenei| uses a picture environment and 
% is based on |\@@trimethylenei| and |\@@dimethylenei|, each of which
% is consist of the following unit processes: 
% \begin{enumerate}
% \item adjusting substitution site by 
%       |\yltrimethylenieposition| or 
%       |\yldimethyleneiposition|
% \item treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents by |\@@trimethylenei| or |\@@dimethylenei|. 
% \end{enumerate}
%
%    \begin{macrocode}
\def\tetramethylenei{%
\@ifnextchar[{\@tetramethylenei[@}{\@tetramethylenei[]}}
\def\@tetramethylenei[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
{\@linterchainswfalse%
\@rinterchainswtrue%
\yltrimethyleneiposition{#2}{#3}{0}{0}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{0}\def\@@yli{0}\fi
\else
{\@rinterchainswfalse%
\@linterchainswtrue%
\yldimethyleneiposition{#2}{#3}{1}{-2}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-342}\def\@@yli{0}\fi\fi
\fi
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(900,480)(-200,-180){tetramethylenei}%2002/4/30 by S. Fujita
(200,180)%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member b\relax 
\@bdoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
\else\if\member B\relax 
\@Bdoublebondtrue
%\else\if\member c\relax%dummy
%\else\if\member C\relax%dummy
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@tetramethi
%\fi\fi
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(0,0){\@@trimethylenei{#2}{#3}{0}{0}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member c\relax 
\@adoublebondtrue
\else\if\member C\relax 
\@Adoublebondtrue
\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdfalse
\Put@Direct(342,0){\@@dimethylenei{#2}{#3}{1}{-2}}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\else\if\member b\relax 
\else\if\member A\relax 
\else\if\member B\relax 
\else\if\member c\relax%dummy
\else\if\member C\relax%dummy
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@tetramethi
\fi\fi
\fi\fi\fi\fi}}%
\end{ShiftPicEnvB}%
}%end of \tetramethylenei
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The inner command |\set@fusion@tetramethi| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@tetramethi}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@tetramethi}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@tetramethi{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if\@@tmpa a\relax%
        \putlratom{0}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{a}%
      \else\if\@@tmpa A\relax%
        \putlratom{171}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{A}%
      \else\if\@@tmpa b\relax%
        \putlratom{171}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{b}%
      \else\if\@@tmpa B\relax%
        \putlratom{342}{103}{\@@tmpb}%    % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{B}%
      \else\if\@@tmpa c\relax%
        \putlratom{342}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{c}%
      \else\if\@@tmpa C\relax%
        \putlratom{513}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{C}%
   \fi\fi
   \fi\fi\fi\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@tetramethi
%    \end{macrocode}
% \end{macro}
%
% \subsection{Cisoid types}
%
% The macros |\tetramethylenecup| and |\tetramethylenecap| are 
% used to draw tetramethylenes of cisoid types. 
%
% \begin{verbatim}
%  Cup:
%    aaa           ddd
%     1           4
%      `         /
%     a `       / c (or uppercase letters)
%        2------3   
%       bbb  b  ccc
%
%  Cap:
%       bbb  b  ccc
%        2------3   
%     a /       ` c (or uppercase letters)
%      /         `
%     1           4
%    aaa           ddd
% \end{verbatim}
%
% The macros have two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
% \begin{verbatim}
% \tetramethylenecup[BONDLIST]{ATOMLIST}{SUBSLIST}
% \tetramethylenecap[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character selected from 
% a to c (or A to C), 
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at a lower-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at a upper-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc.)  
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
%           b          :  2,3-double bond 
%           B          :  2,3-double bond in an opposite side
%           c          :  3,4-double bond 
%           C          :  3,4-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 4 atoms)
%
%       for n = 1 to 4
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 to 4
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 4)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \tetramethylenecup{1==N}{1==Cl;2==F}
%        \tetramethylenecap[b]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% \begin{macro}{\tetramethylenecup}
% \begin{macro}{\@tetramethylenecup}
%    \begin{macrocode}
\def\tetramethylenecup{%
\@ifnextchar[{\@tetramethylenecup[@}{\@tetramethylenecup[]}}
\def\@tetramethylenecup[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
{\@linterchainswfalse%
\@rinterchainswtrue%
\yldimethyleneiposition{#2}{#3}{0}{0}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{0}\def\@@yli{0}\fi
\else
{\@rinterchainswfalse%
\@linterchainswtrue%
\yldimethyleneposition{#2}{#3}{0}{-2}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-371}\def\@@yli{0}\fi\fi
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(900,480)(-200,-180){tetramethylenecup}%2002/4/30 by S. Fujita
(200,180)%
%bond a and atoms 1 and 2
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
%\else\if\member b\relax%dummy
%\else\if\member B\relax%dummy
%\else\if\member c\relax%dummy
%\else\if\member C\relax%dummy
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@tetracup% for all bonds
%\fi\fi\fi\fi
\fi\fi}%
\@wrongbdWafalse
\@wrongbdWdtrue
\Put@Direct(0,0){\@@dimethylenei{#2}{#3}{0}{0}}}%
%bond b
{\@forsemicol\member:=#2\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\twoch@r\@membera{}%
\ifcase\@tmpa%
 \or \relax%
 \or \if\@tmpb s\relax\else\if\@tmpb h\relax
     \xdef\fff{@}\xdef\bbb{@}\else
     \xdef\fff{@}\xdef\bbb{@}\fi\fi
 \or \if\@tmpb s\relax\else\if\@tmpb h\relax
     \xdef\eee{@}\xdef\ccc{@}\else
     \xdef\eee{@}\xdef\ccc{@}\fi\fi
\fi\fi}%
\Put@Direct(68,171){\hskbonde}%
\reset@double%
\@tfor\member:=#1\do{%
 \if\member b\relax 
 \@bdoublebondtrue
 \Put@Direct(68,171){\hbonde}%
 \else\if\member B\relax 
 \@bdoublebondtrue
 \Put@Direct(68,-171){\hbondb}%
 \fi\fi}}%
%bond c and atoms 3 and 4
{\reset@double%
\@tfor\member:=#1\do{%
\if\member c\relax 
\@adoublebondtrue
\else\if\member C\relax 
\@Adoublebondtrue
\else\if\member d\relax 
\@bdoublebondtrue
\else\if\member D\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
 \@wrongbdWafalse
 \@wrongbdWdLtrue
\Put@Direct(371,0){\@@dimethylene{#2}{#3}{0}{-2}}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy 
\else\if\member A\relax%dummy 
\else\if\member b\relax%dummy
\else\if\member B\relax%dummy
\else\if\member c\relax%dummy
\else\if\member C\relax%dummy
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@tetracup% for all bonds
\fi\fi\fi\fi
\fi\fi}}%
\end{ShiftPicEnvB}%
}% end of \tetramethylenecup
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The inner command |\set@fusion@tetracup| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@tetracup}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@tetracup}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@tetracup{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if\@@tmpa a\relax%
        \putlratom{0}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{a}%
      \else\if\@@tmpa A\relax%
        \putlratom{171}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{A}%
      \else\if\@@tmpa b\relax%
        \putlratom{171}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{-200}{0}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{b}%
      \else\if\@@tmpa B\relax%
        \putlratom{371}{0}{\@@tmpb}%    % bond fused
        \FuseWarning{200}{0}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{B}%
      \else\if\@@tmpa c\relax%
        \putlratom{371}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{c}%
      \else\if\@@tmpa C\relax%
        \putlratom{542}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{C}%
   \fi\fi
   \fi\fi\fi\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@tetracup
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tetramethylenecap}
% \begin{macro}{\@tetramethylenecap}
%    \begin{macrocode}
\def\tetramethylenecap{%
\@ifnextchar[{\@tetramethylenecap[@}{\@tetramethylenecap[]}}
\def\@tetramethylenecap[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
{\@linterchainswfalse%
\@rinterchainswtrue%
\yldimethyleneposition{#2}{#3}{0}{0}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{0}\def\@@yli{0}\fi
\else
{\@rinterchainswfalse%
\@linterchainswtrue%
\yldimethyleneiposition{#2}{#3}{0}{-2}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-371}\def\@@yli{0}\fi\fi
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(900,480)(-200,-180){tetramethylenecap}%2002/4/30 by S. Fujita
(200,180)%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
%\else\if\member b\relax%dummy
%\else\if\member B\relax%dummy
%\else\if\member c\relax%dummy
%\else\if\member C\relax%dummy
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@tetracap% for all bonds
%\fi\fi\fi\fi
\fi\fi}%
\@wrongbdWatrue
\Put@Direct(0,0){\@@dimethylene{#2}{#3}{0}{0}}}%
{\@forsemicol\member:=#2\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\twoch@r\@membera{}%
\ifcase\@tmpa%
 \or \relax%
 \or \if\@tmpb s\relax\else\if\@tmpb h\relax
     \xdef\fff{@}\xdef\bbb{@}\else
     \xdef\fff{@}\xdef\bbb{@}\fi\fi
 \or \if\@tmpb s\relax\else\if\@tmpb h\relax
     \xdef\eee{@}\xdef\ccc{@}\else
     \xdef\eee{@}\xdef\ccc{@}\fi\fi
\fi\fi}%
\Put@Direct(68,-68){\hskbondb}%
\reset@double%
\@tfor\member:=#1\do{%
 \if\member b\relax 
 \@bdoublebondtrue
 \Put@Direct(68,-68){\hbondb}%
 \else\if\member B\relax 
 \@bdoublebondtrue
 \Put@Direct(68,274){\hbonde}%
 \fi\fi}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member c\relax 
\@adoublebondtrue
\else\if\member C\relax 
\@Adoublebondtrue
\else\if\member d\relax 
\@bdoublebondtrue
\else\if\member D\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
 \@wrongbdWaLtrue
\Put@Direct(371,0){\@@dimethylenei{#2}{#3}{0}{-2}}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy 
\else\if\member A\relax%dummy 
\else\if\member b\relax%dummy
\else\if\member B\relax%dummy
\else\if\member c\relax%dummy
\else\if\member C\relax%dummy
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@tetracap% for all bonds
\fi\fi\fi\fi
\fi\fi}}%
\end{ShiftPicEnvB}%
}% end of \tetramethylenecap
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The inner command |\set@fusion@tetracap| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@tetracap}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@tetracap}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@tetracap{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if\@@tmpa a\relax%
        \putlratom{0}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{a}%
      \else\if\@@tmpa A\relax%
        \putlratom{171}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{A}%
      \else\if\@@tmpa b\relax%
        \putlratom{171}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{-200}{0}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{b}%
      \else\if\@@tmpa B\relax%
        \putlratom{371}{103}{\@@tmpb}%    % bond fused
        \FuseWarning{200}{0}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{B}%
      \else\if\@@tmpa c\relax%
        \putlratom{371}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{c}%
      \else\if\@@tmpa C\relax%
        \putlratom{542}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{C}%
   \fi\fi
   \fi\fi\fi\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@tetracap
%    \end{macrocode}
% \end{macro}
%
% \section{Pentamethylene}
% \subsection{Normal direction}
%
% The macro |\pentamethylene| has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
%
% \begin{macro}{\pentamethylene}
% \begin{macro}{\@pentamethylene}
%
% \begin{verbatim}
%
%       bbb     ddd
%        2       4
%     a /  ` b  / c` d (or uppercase letters)
%      /    `  /    `
%     1      3        5
%    aaa    ccc
% \end{verbatim}
%
%
% \begin{verbatim}
% \pentamethylene[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character selected from 
% a to d (or A to D), 
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at a lower-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at a upper-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc.)  
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
%           b          :  2,3-double bond 
%           B          :  2,3-double bond in an opposite side
%           c          :  3,4-double bond 
%           C          :  3,4-double bond in an opposite side
%           d          :  4,5-double bond 
%           D          :  4,5-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 5 atoms)
%
%       for n = 1 to 5
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 to 5
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 5)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \pentamethylene{1==N}{1==Cl;2==F}
%        \pentamethylene[b]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The definition of |\pentamethylene| uses a picture environment and 
% is based on two |\@@trimethylene| commands, each of which
% is consist of the following unit processes: 
% \begin{enumerate}
% \item adjusting substitution site by 
%       |\yltrimethyleneposition| 
% \item treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents by |\@@trimethylene|. 
% \end{enumerate}
%
%    \begin{macrocode}
\def\pentamethylene{%
\@ifnextchar[{\@pentamethylene[@}{\@pentamethylene[]}}
\def\@pentamethylene[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
{\@linterchainswfalse%
\@rinterchainswtrue%
\yltrimethyleneposition{#2}{#3}{0}{0}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{0}\def\@@yli{0}\fi
\else
{\@rinterchainswfalse%
\@linterchainswtrue%
\yltrimethyleneposition{#2}{#3}{1}{-2}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-342}\def\@@yli{0}\fi\fi
\fi
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(1100,480)(-200,-180){pentamethylene}%2002/4/30 by S. Fujita
(200,180)%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member b\relax 
\@bdoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
\else\if\member B\relax 
\@Bdoublebondtrue
%\else\if\member c\relax%dummy
%\else\if\member C\relax%dummy
%\else\if\member d\relax%dummy
%\else\if\member D\relax%dummy
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@pentameth% for all bonds
%\fi\fi\fi\fi
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(0,0){\@@trimethylene{#2}{#3}{0}{0}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member c\relax 
\@adoublebondtrue
\else\if\member d\relax 
\@bdoublebondtrue
\else\if\member C\relax 
\@Adoublebondtrue
\else\if\member D\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdfalse
\Put@Direct(342,0){\@@trimethylene{#2}{#3}{1}{-2}}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy 
\else\if\member b\relax%dummy 
\else\if\member A\relax%dummy 
\else\if\member B\relax%dummy 
\else\if\member c\relax%dummy
\else\if\member C\relax%dummy
\else\if\member d\relax%dummy
\else\if\member D\relax%dummy
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@pentameth% for all bonds
\fi\fi\fi\fi
\fi\fi\fi\fi}}%
\end{ShiftPicEnvB}%
}% end of \pentamethylene
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The inner command |\set@fusion@pentameth| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@pentameth}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@pentameth}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@pentameth{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if\@@tmpa a\relax%
        \putlratom{0}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{a}%
      \else\if\@@tmpa A\relax%
        \putlratom{171}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{A}%
      \else\if\@@tmpa b\relax%
        \putlratom{171}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{b}%
      \else\if\@@tmpa B\relax%
        \putlratom{342}{0}{\@@tmpb}%    % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{B}%
      \else\if\@@tmpa c\relax%
        \putlratom{342}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{c}%
      \else\if\@@tmpa C\relax%
        \putlratom{513}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{C}%
      \else\if\@@tmpa d\relax%
        \putlratom{513}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{d}%
      \else\if\@@tmpa D\relax%
        \putlratom{684}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{D}%
   \fi\fi\fi\fi
   \fi\fi\fi\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@pentameth
%    \end{macrocode}
% \end{macro}
%
% \subsection{Inverse direction}
%
% The macro |\pentamethylenei| has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
%
% \begin{macro}{\pentamethylenei}
% \begin{macro}{\@pentamethylenei}
%
% \begin{verbatim}
%
%             (aaa)
%  aaa      ccc      eee (ccc)
%    1       3        5
%   a `   b /  ` c   / d
%       `  /    `   /
%        2        4
%       bbb       ddd (bbb)
% \end{verbatim}
%
% \begin{verbatim}
% \pentamethylenei[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character selected from 
% a to d (or A to D), 
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at the upper-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at the lower-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc.)  
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
%           b          :  2,3-double bond 
%           B          :  2,3-double bond in an opposite side
%           c          :  3,4-double bond 
%           C          :  3,4-double bond in an opposite side
%           d          :  4,5-double bond 
%           D          :  4,5-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 5 atoms)
%
%       for n = 1 to 5
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 to 5
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 5)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \pentamethylenei{1==N}{1==Cl;2==F}
%        \pentamethylenei[b]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The definition of |\pentamethylenei| uses a picture environment and 
% is based on two |\@@trimethylenei| commands, each of which
% is consist of the following unit processes: 
% \begin{enumerate}
% \item adjusting substitution site by 
%       |\yltrimethyleneiposition| 
% \item treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents by |\@@trimethylenei|. 
% \end{enumerate}
%
%    \begin{macrocode}
\def\pentamethylenei{%
\@ifnextchar[{\@pentamethylenei[@}{\@pentamethylenei[]}}
\def\@pentamethylenei[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
{\@linterchainswfalse%
\@rinterchainswtrue%
\yltrimethyleneiposition{#2}{#3}{0}{0}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{0}\def\@@yli{0}\fi
\else
{\@rinterchainswfalse%
\@linterchainswtrue%
\yltrimethyleneiposition{#2}{#3}{1}{-2}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-342}\def\@@yli{0}\fi\fi
\fi
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(1100,480)(-200,-180){pentamethylenei}%2002/4/30 by S. Fujita
(200,180)%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member b\relax 
\@bdoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
\else\if\member B\relax 
\@Bdoublebondtrue
%\else\if\member c\relax%dummy
%\else\if\member C\relax%dummy
%\else\if\member d\relax%dummy
%\else\if\member D\relax%dummy
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@pentamethi% for all bonds
%\fi\fi\fi\fi
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(0,0){\@@trimethylenei{#2}{#3}{0}{0}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member c\relax 
\@adoublebondtrue
\else\if\member d\relax 
\@bdoublebondtrue
\else\if\member C\relax 
\@Adoublebondtrue
\else\if\member D\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\@wrongbdWafalse
\@wrongbdWdtrue
\Put@Direct(342,0){\@@trimethylenei{#2}{#3}{1}{-2}}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy
\else\if\member b\relax%dummy
\else\if\member A\relax%dummy
\else\if\member B\relax%dummy
\else\if\member c\relax%dummy
\else\if\member C\relax%dummy
\else\if\member d\relax%dummy
\else\if\member D\relax%dummy
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@pentamethi% for all bonds
\fi\fi\fi\fi
\fi\fi\fi\fi}}%
\end{ShiftPicEnvB}%
}% end of \pentamethylenei
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The inner command |\set@fusion@pentamethi| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@pentamethi}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@pentamethi}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@pentamethi{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if\@@tmpa a\relax%
        \putlratom{0}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{a}%
      \else\if\@@tmpa A\relax%
        \putlratom{171}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{A}%
      \else\if\@@tmpa b\relax%
        \putlratom{171}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{b}%
      \else\if\@@tmpa B\relax%
        \putlratom{342}{103}{\@@tmpb}%    % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{B}%
      \else\if\@@tmpa c\relax%
        \putlratom{342}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{c}%
      \else\if\@@tmpa C\relax%
        \putlratom{513}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{C}%
      \else\if\@@tmpa d\relax%
        \putlratom{513}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{d}%
      \else\if\@@tmpa D\relax%
        \putlratom{684}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{D}%
   \fi\fi\fi\fi
   \fi\fi\fi\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@pentamethi
%    \end{macrocode}
% \end{macro}
%
% \section{Switches for Selecting Normal and Inverse Directions}
%
% The switch |\@normorinvsw| is used to select normal or 
% inverse direction in the definition of commands for drawing 
% hexametylenes and higher homologs. The value of this switch is 
% false for normal direction and true for inverse direction. 
%
% \begin{macro}{\if@normorinvsw}
%    \begin{macrocode}
\newif\if@normorinvsw \@normorinvswfalse
%    \end{macrocode}
% \end{macro}
%
% The macro |\set@normaldirection| assigns active commands to 
% temporary commands in the definition of a command for drawing 
% hexametylenes or higher homologs of normal direction. 
% \begin{macro}{\set@normaldirection}
%    \begin{macrocode}
\def\set@normaldirection{%
\@normorinvswfalse
\let\@yltrinormorinv=\yltrimethyleneposition
\let\@yldinormorinv=\yldimethyleneposition
\let\@@trinormorinv=\@@trimethylene
\let\@@dinormorinv=\@@dimethylene}
%    \end{macrocode}
% \end{macro}
%
% The macro |\set@inversedirection| assigns active commands to 
% temporary commands in the definition of a command for drawing 
% hexametylenes or higher homologs of inverse direction. 
% \begin{macro}{\set@inversedirection}
%    \begin{macrocode}
\def\set@inversedirection{%
\@normorinvswtrue
\let\@yltrinormorinv=\yltrimethyleneiposition
\let\@yldinormorinv=\yldimethyleneiposition
\let\@@trinormorinv=\@@trimethylenei
\let\@@dinormorinv=\@@dimethylenei}
%    \end{macrocode}
% \end{macro}
%
% \section{Hexamethylenes of normal and inverse direction}
%
% Hexamethylene and hetera derivatives are typeset with the commands
% |\hexamethylene| and |\hexamethylenei|. The former macro 
% is to draw hexamethylenes of normal direction, while the latter 
% is to draw ones of inverse directions. 
%
% \begin{verbatim}
%  Normal direction:
%
%              (bbb)     ((bbb))
%       bbb     ddd      fff
%        2       4        6
%     a /  ` b  / c` d   / e
%      /    `  /    `   /
%     1      3        5
%    aaa    ccc      eee
%           (aaa)    (ccc)
%                    ((aaa))
%
%  Inverse direction:
%
%             (aaa)
%  aaa      ccc      eee (ccc) ((aaa))
%    1       3        5
%   a `   b /  ` c   / d ` e
%       `  /    `   /     `
%        2        4         6
%       bbb       ddd (bbb) fff((bbb))
% \end{verbatim}
%
% The macros  have  two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
%
% \begin{verbatim}
% \hexamethylene[BONDLIST]{ATOMLIST}{SUBSLIST}
% \hexamethylenei[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character selected from 
% a to e (or A to E), 
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at the upper-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at the lower-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc.)  
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
%           b          :  2,3-double bond 
%           B          :  2,3-double bond in an opposite side
%           c          :  3,4-double bond 
%           C          :  3,4-double bond in an opposite side
%           d          :  4,5-double bond 
%           D          :  4,5-double bond in an opposite side
%           e          :  5,6-double bond 
%           E          :  5,6-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 6 atoms)
%
%       for n = 1 to 6
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 6)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \hexamethylene{1==N}{1==Cl;2==F}
%        \hexamethylenei[b]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The macros |\hexamethylene| and |\hexamethylenei| are 
% based on a common inner macro |\@hexamethylene|, 
% the definition of which uses a picture environment. 
%
% \begin{macro}{\hexamethylene}
%    \begin{macrocode}
\def\hexamethylene{%
\@ifnextchar[{\set@normaldirection\@hexamethylene[@}{%
\set@normaldirection\@hexamethylene[]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\hexamethylenei}
%    \begin{macrocode}
\def\hexamethylenei{%
\@ifnextchar[{\set@inversedirection\@hexamethylene[@}{%
\set@inversedirection\@hexamethylene[]}}
%    \end{macrocode}
% \end{macro}
%
% Inner temporary commands such as |\@@trinormorinv| and 
% |\@@dinormorinv| in the common |\@hexamethylene| macro 
% are replaced by active commands such as |\@@trimethylene| and 
% |\@@dimethylene|. They carry out the following unit processes.  
% \begin{enumerate}
% \item Adjusting substitution site:  
%    |\yltrimethyleneposition| 
%       or |\yldimethyleneposition| for normal direction; 
%    |\yltrimethyleneiposition| 
%       or |\yldimethyleneiposition| for inverse direction. 
% \item Treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents:  
%        |\@@trimethylene| 
%           or |\@@dimethylene| for normal direction; 
%        |\@@trimethylenei| 
%           or |\@@dimethylenei| for normal direction. 
% \end{enumerate}
%
% \begin{macro}{\@hexamethylene}
%    \begin{macrocode}
\def\@hexamethylene[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
{\@linterchainswfalse%
\@rinterchainswtrue%
\@yltrinormorinv{#2}{#3}{0}{0}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{0}\def\@@yli{0}\fi
\else
{\@rinterchainswtrue%
\@linterchainswtrue%
\@yltrinormorinv{#2}{#3}{1}{-2}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-342}\def\@@yli{0}\fi
\else
{\@rinterchainswfalse%
\@linterchainswtrue%
\@yldinormorinv{#2}{#3}{1}{-4}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-684}\def\@@yli{0}\fi\fi
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(1100,480)(-200,-180){hexamethylene}%2002/4/30 by S. Fujita
(200,180)%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member b\relax 
\@bdoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
\else\if\member B\relax 
\@Bdoublebondtrue
%\else\if\member c\relax%dummy
%\else\if\member C\relax%dummy
%\else\if\member d\relax%dummy
%\else\if\member D\relax%dummy
%\else\if\member e\relax%dummy
%\else\if\member E\relax%dummy
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@hexameth% for all bonds
%\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(0,0){\@@trinormorinv{#2}{#3}{0}{0}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member c\relax 
\@adoublebondtrue
\else\if\member d\relax 
\@bdoublebondtrue
\else\if\member C\relax 
\@Adoublebondtrue
\else\if\member D\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(342,0){\@@trinormorinv{#2}{#3}{1}{-2}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member e\relax 
\@adoublebondtrue
\else\if\member E\relax 
\@Adoublebondtrue
\fi\fi}%
\if@normorinvsw% inverse
 \@wrongbdWatrue
 \@wrongbdWdfalse
\else% normal
 \@wrongbdWafalse
 \@wrongbdWdtrue
\fi
\Put@Direct(684,0){\@@dinormorinv{#2}{#3}{1}{-4}}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy
\else\if\member b\relax%dummy
\else\if\member A\relax%dummy
\else\if\member B\relax%dummy
\else\if\member c\relax%dummy
\else\if\member C\relax%dummy
\else\if\member d\relax%dummy
\else\if\member D\relax%dummy
\else\if\member e\relax%dummy
\else\if\member E\relax%dummy
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@hexameth% for all bonds
\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi}}%
\end{ShiftPicEnvB}%
}% end of \@hexamethylene
%    \end{macrocode}
% \end{macro}
%
% The inner command |\set@fusion@hexameth| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@hexameth}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@hexameth}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@hexameth{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if@normorinvsw
  \if\@@tmpa e\relax%
        \putlratom{684}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{e}%
      \else\if\@@tmpa E\relax%
        \putlratom{855}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{E}%
      \else
        \set@fusion@pentamethi
  \fi\fi
\else
  \if\@@tmpa e\relax%
        \putlratom{684}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{e}%
      \else\if\@@tmpa E\relax%
        \putlratom{855}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{E}%
      \else
        \set@fusion@pentameth
  \fi\fi
\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@hexameth
%    \end{macrocode}
% \end{macro}
%
% \section{Heptamethylenes of normal and inverse direction}
%
% Heptamethylene and hetera derivatives are typeset with the commands
% |\heptamethylene| and |\heptamethylenei|. The former macro 
% is to draw heptamethylenes of normal direction, while the latter 
% is to draw ones of inverse directions. 
%
% \begin{verbatim}
%  Normal direction:
%
%              (bbb)     ((bbb))
%       bbb     ddd      fff
%        2       4        6
%     a /  ` b  / c` d   / e ` f
%      /    `  /    `   /     `
%     1      3        5        7
%    aaa    ccc      eee       gggg
%           (aaa)    (ccc)     ((ccc))
%                    ((aaa))
%
%  Inverse direction:
%
%             (aaa)       ((aaa)) ((ccc))
%  aaa      ccc      eee (ccc)    ggg
%    1       3        5           7
%   a `   b /  ` c   / d ` e     /f
%       `  /    `   /     `    /
%        2        4         6
%       bbb       ddd (bbb) fff((bbb))
%             (aaa)
% \end{verbatim}
%
% The macros have two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
% \begin{verbatim}
% \heptamethylene[BONDLIST]{ATOMLIST}{SUBSLIST}
% \heptamethylenei[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character selected from 
% a to f (or A to F), 
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at the upper-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at the lower-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc.)  
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
%           b          :  2,3-double bond 
%           B          :  2,3-double bond in an opposite side
%           c          :  3,4-double bond 
%           C          :  3,4-double bond in an opposite side
%           d          :  4,5-double bond 
%           D          :  4,5-double bond in an opposite side
%           e          :  5,6-double bond 
%           E          :  5,6-double bond in an opposite side
%           f          :  6,7-double bond 
%           F          :  6,7-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 7 atoms)
%
%       for n = 1 to 7
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 to 7
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 7)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \heptamethylene{1==N}{1==Cl;2==F}
%        \heptamethylenei[b]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The macros |\heptamethylene| and |\heptamethylenei| are 
% based on a common inner macro |\@heptamethylene|, 
% the definition of which uses a picture environment. 
%
% \begin{macro}{\heptamethylene}
%    \begin{macrocode}
\def\heptamethylene{%
\@ifnextchar[{\set@normaldirection\@heptamethylene[@}{%
\set@normaldirection\@heptamethylene[]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\heptamethylenei}
%    \begin{macrocode}
\def\heptamethylenei{%
\@ifnextchar[{\set@inversedirection\@heptamethylene[@}{%
\set@inversedirection\@heptamethylene[]}}
%    \end{macrocode}
% \end{macro}
%
% Inner temporary commands such as |\@@trinormorinv| and 
% |\@@dinormorinv| in the common |\@heptamethylene| macro 
% are replaced by active commands such as |\@@trimethylene| and 
% |\@@dimethylene|. They carry out the following unit processes.  
% \begin{enumerate}
% \item Adjusting substitution site:  
%    |\yltrimethyleneposition| 
%       or |\yldimethyleneposition| for normal direction; 
%    |\yltrimethyleneiposition| 
%       or |\yldimethyleneiposition| for inverse direction. 
% \item Treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents:  
%        |\@@trimethylene| 
%           or |\@@dimethylene| for normal direction; 
%        |\@@trimethylenei| 
%           or |\@@dimethylenei| for normal direction. 
% \end{enumerate}
%
% \begin{macro}{\@heptamethylene}
%    \begin{macrocode}
\def\@heptamethylene[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
{\@linterchainswfalse%
\@rinterchainswtrue%
\@yltrinormorinv{#2}{#3}{0}{0}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{0}\def\@@yli{0}\fi
\else
{\@rinterchainswtrue%
\@linterchainswtrue%
\@yltrinormorinv{#2}{#3}{1}{-2}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-342}\def\@@yli{0}\fi
\else
{\@rinterchainswfalse%
\@linterchainswtrue%
\@yltrinormorinv{#2}{#3}{1}{-4}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-684}\def\@@yli{0}\fi\fi
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(1450,480)(-200,-180){heptamethylene}%2002/4/30 by S. Fujita
(200,180)%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member b\relax 
\@bdoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
\else\if\member B\relax 
\@Bdoublebondtrue
%\else\if\member c\relax%dummy
%\else\if\member C\relax%dummy
%\else\if\member d\relax%dummy
%\else\if\member D\relax%dummy
%\else\if\member e\relax%dummy
%\else\if\member E\relax%dummy
%\else\if\member f\relax%dummy
%\else\if\member F\relax%dummy
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@heptameth% for all bonds
%\fi\fi\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(0,0){\@@trinormorinv{#2}{#3}{0}{0}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member c\relax 
\@adoublebondtrue
\else\if\member d\relax 
\@bdoublebondtrue
\else\if\member C\relax 
\@Adoublebondtrue
\else\if\member D\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(342,0){\@@trinormorinv{#2}{#3}{1}{-2}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member e\relax 
\@adoublebondtrue
\else\if\member E\relax 
\@Adoublebondtrue
\else\if\member f\relax 
\@bdoublebondtrue
\else\if\member F\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\if@normorinvsw% inverse
\@wrongbdWafalse
\@wrongbdWdtrue
\else%normal
\@wrongbdWatrue
\@wrongbdWdfalse
\fi
\Put@Direct(684,0){\@@trinormorinv{#2}{#3}{1}{-4}}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy
\else\if\member b\relax%dummy
\else\if\member A\relax%dummy
\else\if\member B\relax%dummy
\else\if\member c\relax%dummy
\else\if\member C\relax%dummy
\else\if\member d\relax%dummy
\else\if\member D\relax%dummy
\else\if\member e\relax%dummy
\else\if\member E\relax%dummy
\else\if\member f\relax%dummy
\else\if\member F\relax%dummy
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@heptameth% for all bonds
\fi\fi\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi}}%
\end{ShiftPicEnvB}%
}% end of \@heptamethylene
%    \end{macrocode}
% \end{macro}
%
% The inner command |\set@fusion@heptameth| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@heptameth}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@heptameth}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@heptameth{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if@normorinvsw
  \if\@@tmpa e\relax%
        \putlratom{684}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{e}%
      \else\if\@@tmpa E\relax%
        \putlratom{855}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{E}%
      \else\if\@@tmpa f\relax%
        \putlratom{855}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{f}%
      \else\if\@@tmpa F\relax%
        \putlratom{1027}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{F}%
      \else
        \set@fusion@pentamethi
  \fi\fi\fi\fi
\else
  \if\@@tmpa e\relax%
        \putlratom{684}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{e}%
      \else\if\@@tmpa E\relax%
        \putlratom{855}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{E}%
      \else\if\@@tmpa f\relax%
        \putlratom{855}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{f}%
      \else\if\@@tmpa F\relax%
        \putlratom{1027}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{F}%
      \else
        \set@fusion@pentameth
  \fi\fi\fi\fi
\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@heptameth
%    \end{macrocode}
% \end{macro}
%
% \section{Octamethylenes of normal and inverse directions}
%
% Octamethylene and hetera derivatives are typeset with the commands 
% |\octamethylene| and |\octamethylenei|. The former macro 
% is to draw octamethylenes of normal direction, while the latter 
% is to draw ones of inverse directions. 
%
% \begin{verbatim}
%  Normal direction:
%
%              (bbb)     ((bbb))  (((bbb)))
%       bbb     ddd      fff      hhh
%        2       4        6       8
%     a /  ` b  / c` d   / e ` f /g
%      /    `  /    `   /     ` /
%     1      3        5        7
%    aaa    ccc      eee       gggg
%           (aaa)    (ccc)     ((ccc))
%                    ((aaa))   (((aaa)))
%
%  Inverse direction:
%                                 (((aaa)))
%             (aaa)       ((aaa)) ((ccc))
%  aaa      ccc      eee (ccc)    ggg
%    1       3        5           7
%   a `   b /  ` c   / d ` e     /f `  g
%       `  /    `   /     `    /      `
%        2        4         6          8
%       bbb       ddd     fff          hhh
%                 (bbb)   ((bbb))       (((bbb)))
% \end{verbatim}
%
% The macros has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
% \begin{verbatim}
% \octamethylene[BONDLIST]{ATOMLIST}{SUBSLIST}
% \octamethylenei[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character selected from 
% a to g (or A to G), 
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at the upper-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at the lower-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc.)  
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
%           b          :  2,3-double bond 
%           B          :  2,3-double bond in an opposite side
%           c          :  3,4-double bond 
%           C          :  3,4-double bond in an opposite side
%           d          :  4,5-double bond 
%           D          :  4,5-double bond in an opposite side
%           e          :  5,6-double bond 
%           E          :  5,6-double bond in an opposite side
%           f          :  6,7-double bond 
%           F          :  6,7-double bond in an opposite side
%           g          :  7,8-double bond 
%           G          :  7,8-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 8 atoms)
%
%       for n = 1 to 8
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 to 8
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 8)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \octamethylene{1==N}{1==Cl;2==F}
%        \octamethylenei[b]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The macros |\octamethylene| and |\octamethylenei| are 
% based on a common inner macro |\@octamethylene|, 
% the definition of which uses a picture environment. 
%
% \begin{macro}{\octamethylene}
%    \begin{macrocode}
\def\octamethylene{%
\@ifnextchar[{\set@normaldirection\@octamethylene[@}{%
\set@normaldirection\@octamethylene[]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\octamethylenei}
%    \begin{macrocode}
\def\octamethylenei{%
\@ifnextchar[{\set@inversedirection\@octamethylene[@}{%
\set@inversedirection\@octamethylene[]}}
%    \end{macrocode}
% \end{macro}
%
% Inner temporary commands such as |\@@trinormorinv| and 
% |\@@dinormorinv| in the common |\@octamethylene| macro 
% are replaced by active commands such as |\@@trimethylene| and 
% |\@@dimethylene|. They carry out the following unit processes.  
% \begin{enumerate}
% \item Adjusting substitution site:  
%    |\yltrimethyleneposition| 
%       or |\yldimethyleneposition| for normal direction; 
%    |\yltrimethyleneiposition| 
%       or |\yldimethyleneiposition| for inverse direction. 
% \item Treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents:  
%        |\@@trimethylene| 
%           or |\@@dimethylene| for normal direction; 
%        |\@@trimethylenei| 
%           or |\@@dimethylenei| for normal direction. 
% \end{enumerate}
%
% \begin{macro}{\@octamethylene}
%    \begin{macrocode}
\def\@octamethylene[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
{\@linterchainswfalse%
\@rinterchainswtrue%
\@yltrinormorinv{#2}{#3}{0}{0}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{0}\def\@@yli{0}\fi
\else
{\@rinterchainswtrue%
\@linterchainswtrue%
\@yltrinormorinv{#2}{#3}{1}{-2}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-342}\def\@@yli{0}\fi
\else
{\@rinterchainswtrue%
\@linterchainswtrue%
\@yltrinormorinv{#2}{#3}{1}{-4}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-684}\def\@@yli{0}\fi
\else
{\@rinterchainswfalse%
\@linterchainswtrue%
\@yldinormorinv{#2}{#3}{1}{-6}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-1026}\def\@@yli{0}\fi\fi
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(1620,480)(-200,-180){octamethylene}%2002/4/30 by S. Fujita
(200,180)%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member b\relax 
\@bdoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
\else\if\member B\relax 
\@Bdoublebondtrue
%\else\if\member c\relax%dummy
%\else\if\member C\relax%dummy
%\else\if\member d\relax%dummy
%\else\if\member D\relax%dummy
%\else\if\member e\relax%dummy
%\else\if\member E\relax%dummy
%\else\if\member f\relax%dummy
%\else\if\member F\relax%dummy
%\else\if\member g\relax%dummy
%\else\if\member G\relax%dummy
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@octameth% for all bonds
%\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(0,0){\@@trinormorinv{#2}{#3}{0}{0}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member c\relax 
\@adoublebondtrue
\else\if\member d\relax 
\@bdoublebondtrue
\else\if\member C\relax 
\@Adoublebondtrue
\else\if\member D\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(342,0){\@@trinormorinv{#2}{#3}{1}{-2}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member e\relax 
\@adoublebondtrue
\else\if\member E\relax 
\@Adoublebondtrue
\else\if\member f\relax 
\@bdoublebondtrue
\else\if\member F\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(684,0){\@@trinormorinv{#2}{#3}{1}{-4}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member g\relax 
\@adoublebondtrue
\else\if\member G\relax 
\@Adoublebondtrue
\fi\fi}%
\if@normorinvsw% inverse
\@wrongbdWatrue
\@wrongbdWdfalse
\else% normal
\@wrongbdWafalse
\@wrongbdWdtrue
\fi
\Put@Direct(1026,0){\@@dinormorinv{#2}{#3}{1}{-6}}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy
\else\if\member b\relax%dummy
\else\if\member A\relax%dummy
\else\if\member B\relax%dummy
\else\if\member c\relax%dummy
\else\if\member C\relax%dummy
\else\if\member d\relax%dummy
\else\if\member D\relax%dummy
\else\if\member e\relax%dummy
\else\if\member E\relax%dummy
\else\if\member f\relax%dummy
\else\if\member F\relax%dummy
\else\if\member g\relax%dummy
\else\if\member G\relax%dummy
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@octameth% for all bonds
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi}}%
\end{ShiftPicEnvB}%
}% end of \@octamethylene
%    \end{macrocode}
% \end{macro}
%
% The inner command |\set@fusion@octameth| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@octameth}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@octameth}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@octameth{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if@normorinvsw
  \if\@@tmpa e\relax%
        \putlratom{684}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{e}%
      \else\if\@@tmpa E\relax%
        \putlratom{855}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{E}%
      \else\if\@@tmpa f\relax%
        \putlratom{855}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{f}%
      \else\if\@@tmpa F\relax%
        \putlratom{1027}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{F}%
      \else\if\@@tmpa g\relax%
        \putlratom{1027}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{g}%
      \else\if\@@tmpa G\relax%
        \putlratom{1198}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{G}%
      \else
        \set@fusion@pentamethi
  \fi\fi\fi\fi\fi\fi
\else
  \if\@@tmpa e\relax%
        \putlratom{684}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{e}%
      \else\if\@@tmpa E\relax%
        \putlratom{855}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{E}%
      \else\if\@@tmpa f\relax%
        \putlratom{855}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{f}%
      \else\if\@@tmpa F\relax%
        \putlratom{1027}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{F}%
      \else\if\@@tmpa g\relax%
        \putlratom{1027}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{g}%
      \else\if\@@tmpa G\relax%
        \putlratom{1198}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{G}%
      \else
        \set@fusion@pentameth
  \fi\fi\fi\fi\fi\fi
\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@octameth
%    \end{macrocode}
% \end{macro}
%
% \section{Nonamethylenes of normal and inverse direction}
%
% Nonamethylene and hetera derivatives are typeset with the commands 
% |\nonamethylene| and |\nonamethylenei|. The former macro 
% is to draw nonamethylenes of normal direction, while the latter 
% is to draw ones of inverse directions. 
%
% \begin{verbatim}
%  Normal direction:
%
%              (bbb)     ((bbb))  (((bbb)))
%       bbb     ddd      fff      hhh
%        2       4        6       8 
%     a /  ` b  / c` d   / e ` f /g` h
%      /    `  /    `   /     ` /    `
%     1      3        5        7       9
%    aaa    ccc      eee       gggg    (((ccc)))
%           (aaa)    (ccc)     ((ccc))
%                    ((aaa))   (((aaa)))
%
%  Inverse direction:
%                                 (((aaa)))
%             (aaa)       ((aaa)) ((ccc))
%  aaa      ccc      eee (ccc)    ggg     (((ccc)))
%    1       3        5           7        9
%   a `   b /  ` c   / d ` e     /f `  g  / h
%       `  /    `   /     `    /      `  /
%        2        4         6          8
%       bbb       ddd     fff          hhh
%                 (bbb)   ((bbb))       (((bbb)))
%             (aaa)       ((aaa)) ((ccc))
% \end{verbatim}
%
% The macros have two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
%
% \begin{verbatim}
% \nonamethylene[BONDLIST]{ATOMLIST}{SUBSLIST}
% \nonamethylenei[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character selected from 
% a to h (or A to H), 
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at the upper-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at the lower-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc.)  
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
%           b          :  2,3-double bond 
%           B          :  2,3-double bond in an opposite side
%           c          :  3,4-double bond 
%           C          :  3,4-double bond in an opposite side
%           d          :  4,5-double bond 
%           D          :  4,5-double bond in an opposite side
%           e          :  5,6-double bond 
%           E          :  5,6-double bond in an opposite side
%           f          :  6,7-double bond 
%           F          :  6,7-double bond in an opposite side
%           g          :  7,8-double bond 
%           G          :  7,8-double bond in an opposite side
%           h          :  8,9-double bond 
%           H          :  8,9-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 9 atoms)
%
%       for n = 1 to 9
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 to 9
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 9)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \nonamethylene{1==N}{1==Cl;2==F}
%        \nonamethylenei[b]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The macros |\nonamethylene| and |\nonamethylenei| are 
% based on a common inner macro |\@nonamethylene|, 
% the definition of which uses a picture environment. 
%
% \begin{macro}{\nonamethylene}
%    \begin{macrocode}
\def\nonamethylene{%
\@ifnextchar[{\set@normaldirection\@nonamethylene[@}{%
\set@normaldirection\@nonamethylene[]}}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\nonamethylenei}
%    \begin{macrocode}
\def\nonamethylenei{%
\@ifnextchar[{\set@inversedirection\@nonamethylene[@}{%
\set@inversedirection\@nonamethylene[]}}
%    \end{macrocode}
% \end{macro}
%
% Inner temporary commands such as |\@@trinormorinv| and 
% |\@@dinormorinv| in the common |\@nonamethylene| macro 
% are replaced by active commands such as |\@@trimethylene| and 
% |\@@dimethylene|. They carry out the following unit processes.  
% \begin{enumerate}
% \item Adjusting substitution site:  
%    |\yltrimethyleneposition| 
%       or |\yldimethyleneposition| for normal direction; 
%    |\yltrimethyleneiposition| 
%       or |\yldimethyleneiposition| for inverse direction. 
% \item Treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents:  
%        |\@@trimethylene| 
%           or |\@@dimethylene| for normal direction; 
%        |\@@trimethylenei| 
%           or |\@@dimethylenei| for normal direction. 
% \end{enumerate}
%
% \begin{macro}{\@nonamethylene}
%    \begin{macrocode}
\def\@nonamethylene[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
{\@linterchainswfalse%
\@rinterchainswtrue%
\@yltrinormorinv{#2}{#3}{0}{0}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{0}\def\@@yli{0}\fi
\else
{\@rinterchainswtrue%
\@linterchainswtrue%
\@yltrinormorinv{#2}{#3}{1}{-2}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-342}\def\@@yli{0}\fi
\else
{\@rinterchainswtrue%
\@linterchainswtrue%
\@yltrinormorinv{#2}{#3}{1}{-4}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-684}\def\@@yli{0}\fi
\else
{\@rinterchainswfalse%
\@linterchainswtrue%
\@yltrinormorinv{#2}{#3}{1}{-6}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-1026}\def\@@yli{0}\fi\fi
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(1790,480)(-200,-180){nonamethylene}%2002/4/30 by S. Fujita
(200,180)%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member b\relax 
\@bdoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
\else\if\member B\relax 
\@Bdoublebondtrue
%\else\if\member c\relax%dummy
%\else\if\member C\relax%dummy
%\else\if\member d\relax%dummy
%\else\if\member D\relax%dummy
%\else\if\member e\relax%dummy
%\else\if\member E\relax%dummy
%\else\if\member f\relax%dummy
%\else\if\member F\relax%dummy
%\else\if\member g\relax%dummy
%\else\if\member G\relax%dummy
%\else\if\member h\relax%dummy
%\else\if\member H\relax%dummy
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@nonameth% for all bonds
%\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(0,0){\@@trinormorinv{#2}{#3}{0}{0}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member c\relax 
\@adoublebondtrue
\else\if\member d\relax 
\@bdoublebondtrue
\else\if\member C\relax 
\@Adoublebondtrue
\else\if\member D\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(342,0){\@@trinormorinv{#2}{#3}{1}{-2}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member e\relax 
\@adoublebondtrue
\else\if\member E\relax 
\@Adoublebondtrue
\else\if\member f\relax 
\@bdoublebondtrue
\else\if\member F\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(684,0){\@@trinormorinv{#2}{#3}{1}{-4}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member g\relax 
\@adoublebondtrue
\else\if\member G\relax 
\@Adoublebondtrue
\else\if\member h\relax 
\@bdoublebondtrue
\else\if\member H\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\if@normorinvsw% inverse
\@wrongbdWafalse
\@wrongbdWdtrue
\else% normal
\@wrongbdWatrue
\@wrongbdWdfalse
\fi
\Put@Direct(1026,0){\@@trinormorinv{#2}{#3}{1}{-6}}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy
\else\if\member b\relax%dummy
\else\if\member A\relax%dummy
\else\if\member B\relax%dummy
\else\if\member c\relax%dummy
\else\if\member C\relax%dummy
\else\if\member d\relax%dummy
\else\if\member D\relax%dummy
\else\if\member e\relax%dummy
\else\if\member E\relax%dummy
\else\if\member f\relax%dummy
\else\if\member F\relax%dummy
\else\if\member g\relax%dummy
\else\if\member G\relax%dummy
\else\if\member h\relax%dummy
\else\if\member H\relax%dummy
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@nonameth% for all bonds
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi}}%
\end{ShiftPicEnvB}%
}% end of \@nonamethylene
%    \end{macrocode}
% \end{macro}
%
% The inner command |\set@fusion@nonameth| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@nonameth}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@nonameth}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@nonameth{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if@normorinvsw
 \if\@@tmpa h\relax%
        \putlratom{1198}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{h}%
      \else\if\@@tmpa H\relax%
        \putlratom{1369}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{H}%
      \else
        \set@fusion@octameth
  \fi\fi
\else
 \if\@@tmpa h\relax%
        \putlratom{1198}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{h}%
      \else\if\@@tmpa H\relax%
        \putlratom{1369}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{H}%
      \else
        \set@fusion@octameth
  \fi\fi
\fi
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@nonameth
%    \end{macrocode}
% \end{macro}
%
% \section{Decamethylenes of normal and inverse directions}
%
% Decamethylene and hetera derivatives are typeset with the commands 
% |\decamethylene| and |\decamethylenei|. The former macro 
% is to draw decamethylenes of normal direction, while the latter 
% is to draw ones of inverse directions. 
%
% \begin{verbatim}
%  Normal direction:
%
%              (bbb)     ((bbb))  (((bbb)))
%       bbb     ddd      fff      hhh     <bbb>
%        2       4        6       8      10
%     a /  ` b  / c` d   / e ` f /g ` h   / i
%      /    `  /    `   /     ` /    `   /
%     1      3        5        7       9
%    aaa    ccc      eee       gggg    (((ccc)))
%           (aaa)    (ccc)     ((ccc))   <aaa>
%                    ((aaa))   (((aaa)))
%
%  Inverse direction:
%                                 (((aaa)))
%             (aaa)       ((aaa)) ((ccc))  <aaa>
%  aaa      ccc      eee (ccc)    ggg     (((ccc)))
%    1       3        5           7        9
%   a `   b /  ` c   / d ` e     /f `  g  / h ` i
%       `  /    `   /     `    /      `  /     `
%        2        4         6          8         10
%       bbb       ddd     fff          hhh       <bbb>
%                 (bbb)   ((bbb))       (((bbb)))
% \end{verbatim}
%
% The macros have two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
% \begin{verbatim}
% \decamethylene[BONDLIST]{ATOMLIST}{SUBSLIST}
% \decamethylenei[BONDLIST]{ATOMLIST}{SUBSLIST}
% \end{verbatim}
%
% The |BONDLIST| argument contains one character selected from 
% a to i (or A to I), 
% each of which indicates the presence of an inner (endcyclic) double 
% bond on the corresponding position.  A lowercase letter is used 
% to typeset a double bond at the upper-side of an outer skeletal bond, 
% while an uppercase letter typesets a double bond at the lower-side of 
% an outer skeletal bond.  
% (Note that the option `A' represents an aromatic circle in 
% commands |\sixheterov| etc.)  
%
% \begin{verbatim}
%     BONDLIST = 
%
%           [] or none :  no double bond
%           a          :  1,2-double bond
%           A          :  1,2-double bond in an opposite side
%           b          :  2,3-double bond 
%           B          :  2,3-double bond in an opposite side
%           c          :  3,4-double bond 
%           C          :  3,4-double bond in an opposite side
%           d          :  4,5-double bond 
%           D          :  4,5-double bond in an opposite side
%           e          :  5,6-double bond 
%           E          :  5,6-double bond in an opposite side
%           f          :  6,7-double bond 
%           F          :  6,7-double bond in an opposite side
%           g          :  7,8-double bond 
%           G          :  7,8-double bond in an opposite side
%           h          :  8,9-double bond 
%           H          :  8,9-double bond in an opposite side
%           i          :  9,10-double bond 
%           I          :  9,10-double bond in an opposite side
% \end{verbatim}
%
% The |ATOMLIST| argument contains one or more heteroatom descriptors 
% which are separated from each other by a semicolon.  Each heteroatom 
% descriptor consists of a locant number and a heteroatom, 
% where these are separated with a double equality symbol. 
%
% \begin{verbatim}
%
%     ATOMLIST: list of heteroatoms (max 10 atoms)
%
%       for n = 1 to 10
%
%           n==?    : Hetero atom, e.g. N, O, etc. at n-position, 
%                        e.g. 1==N for N at 1-position
% \end{verbatim}
%
% The |SUBSLIST| argument contains one or more substitution descriptors 
% which are separated from each other by a semicolon.  Each substitution 
% descriptor has a locant number with a bond modifier and a substituent, 
% where these are separated with a double equality symbol. 
% \begin{verbatim}
%
%     SUBSLIST: list of substituents
%
%       for n = 1 to 10
%
%           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 specified) single bond at n-atom
%           nW         :  terminal single bond (n=1 or 10)
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \decamethylene{1==N}{1==Cl;2==F}
%        \decamethylenei[b]{1==N}{1==Cl;4==F;2==CH$_{3}$}
% \end{verbatim}
%
% The macros |\decamethylene| and |\decamethylenei| are 
% based on a common inner macro |\@decamethylene|, 
% the definition of which uses a picture environment. 
% \begin{macro}{\decamethylene}
%    \begin{macrocode}
\def\decamethylene{%
\@ifnextchar[{\set@normaldirection\@decamethylene[@}{%
\set@normaldirection\@decamethylene[]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\decamethylenei}
%    \begin{macrocode}
\def\decamethylenei{%
\@ifnextchar[{\set@inversedirection\@decamethylene[@}{%
\set@inversedirection\@decamethylene[]}}
%    \end{macrocode}
% \end{macro}
%
% Inner temporary commands such as |\@@trinormorinv| and 
% |\@@dinormorinv| in the common |\@decamethylene| macro 
% are replaced by active commands such as |\@@trimethylene| and 
% |\@@dimethylene|. They carry out the following unit processes.  
% \begin{enumerate}
% \item Adjusting substitution site:  
%    |\yltrimethyleneposition| 
%       or |\yldimethyleneposition| for normal direction; 
%    |\yltrimethyleneiposition| 
%       or |\yldimethyleneiposition| for inverse direction. 
% \item Treating atom list, 
%       placing outer skeletons, inner double bonds, 
%       setting hetero atoms, and 
%       placing substituents:  
%        |\@@trimethylene| 
%           or |\@@dimethylene| for normal direction; 
%        |\@@trimethylenei| 
%           or |\@@dimethylenei| for normal direction. 
% \end{enumerate}
%
% \begin{macro}{\@decamethylene}
%    \begin{macrocode}
\def\@decamethylene[#1]#2#3{%
\iniflag\iniatom%
\@reset@ylsw%
{\@linterchainswfalse%
\@rinterchainswtrue%
\@yltrinormorinv{#2}{#3}{0}{0}}%
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{0}\def\@@yli{0}\fi
\else
{\@rinterchainswtrue%
\@linterchainswtrue%
\@yltrinormorinv{#2}{#3}{1}{-2}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-342}\def\@@yli{0}\fi
\else
{\@rinterchainswtrue%
\@linterchainswtrue%
\@yltrinormorinv{#2}{#3}{1}{-4}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-684}\def\@@yli{0}\fi
\else
{\@rinterchainswtrue%
\@linterchainswtrue%
\@yltrinormorinv{#2}{#3}{1}{-6}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-1026}\def\@@yli{0}\fi
\else
{\@rinterchainswfalse%
\@linterchainswtrue%
\@yldinormorinv{#2}{#3}{1}{-8}}%
\fi
\if@ylsw \ifx\@@ylii\empty
\def\@@ylii{-1368}\def\@@yli{0}\fi\fi
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(1960,480)(-200,-180){decamethylene}%2002/4/30 by S. Fujita
(200,180)%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax 
\@adoublebondtrue
\else\if\member b\relax 
\@bdoublebondtrue
\else\if\member A\relax 
\@Adoublebondtrue
\else\if\member B\relax 
\@Bdoublebondtrue
%\else\if\member c\relax%dummy
%\else\if\member C\relax%dummy
%\else\if\member d\relax%dummy
%\else\if\member D\relax%dummy
%\else\if\member e\relax%dummy
%\else\if\member E\relax%dummy
%\else\if\member f\relax%dummy
%\else\if\member F\relax%dummy
%\else\if\member g\relax%dummy
%\else\if\member G\relax%dummy
%\else\if\member h\relax%dummy
%\else\if\member H\relax%dummy
%\else\if\member i\relax%dummy
%\else\if\member I\relax%dummy
%\else
%  \expandafter\twoCH@@R\member//%
%    \set@fusion@decameth% for all bonds
%\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(0,0){\@@trinormorinv{#2}{#3}{0}{0}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member c\relax 
\@adoublebondtrue
\else\if\member d\relax 
\@bdoublebondtrue
\else\if\member C\relax 
\@Adoublebondtrue
\else\if\member D\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(342,0){\@@trinormorinv{#2}{#3}{1}{-2}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member e\relax 
\@adoublebondtrue
\else\if\member E\relax 
\@Adoublebondtrue
\else\if\member f\relax 
\@bdoublebondtrue
\else\if\member F\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(684,0){\@@trinormorinv{#2}{#3}{1}{-4}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member g\relax 
\@adoublebondtrue
\else\if\member G\relax 
\@Adoublebondtrue
\else\if\member h\relax 
\@bdoublebondtrue
\else\if\member H\relax 
\@Bdoublebondtrue
\fi\fi\fi\fi}%
\@wrongbdWatrue
\@wrongbdWdtrue
\Put@Direct(1026,0){\@@trinormorinv{#2}{#3}{1}{-6}}}%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member i\relax 
\@adoublebondtrue
\else\if\member I\relax 
\@Adoublebondtrue
\fi\fi}%
\if@normorinvsw% inverse
\@wrongbdWatrue
\@wrongbdWdfalse
\else% normal
\@wrongbdWafalse
\@wrongbdWdtrue
\fi
\Put@Direct(1368,0){\@@dinormorinv{#2}{#3}{1}{-8}}}%
%
%originally for fused rings
%shifted for coloring skeletal bond 2010/10/01
%
{\reset@double%
\@tfor\member:=#1\do{%
\if\member a\relax%dummy
\else\if\member b\relax%dummy
\else\if\member A\relax%dummy
\else\if\member B\relax%dummy
\else\if\member c\relax%dummy
\else\if\member C\relax%dummy
\else\if\member d\relax%dummy
\else\if\member D\relax%dummy
\else\if\member e\relax%dummy
\else\if\member E\relax%dummy
\else\if\member f\relax%dummy
\else\if\member F\relax%dummy
\else\if\member g\relax%dummy
\else\if\member G\relax%dummy
\else\if\member h\relax%dummy
\else\if\member H\relax%dummy
\else\if\member i\relax%dummy
\else\if\member I\relax%dummy
\else
  \expandafter\twoCH@@R\member//%
    \set@fusion@decameth% for all bonds
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi}}%
\end{ShiftPicEnvB}%
}% end \@decamethylene
%    \end{macrocode}
% \end{macro}
%
% The inner command |\set@fusion@decameth| is used for typesetting 
% a fused ring at each bond represented by |\@@tmpa|.  Warnings 
% concerning mismatched ring-fusions are based on the command 
% |\FuseWarning|. 
%
% \begin{macro}{\set@fusion@decameth}
% \changes{v2.00}{1998/12/21}{New command: \cs{set@fusion@decameth}}
% \changes{v5.00}{2010/10/01}{\cs{FuseWarning} recovered for bond coloring}
%    \begin{macrocode}
\def\set@fusion@decameth{%
% %%%%%%%%%%%%%%%%%%%%%
% % inner bond fusion %
% %%%%%%%%%%%%%%%%%%%%%
\if@normorinvsw
 \if\@@tmpa h\relax%
        \putlratom{1198}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{h}%
      \else\if\@@tmpa H\relax%
        \putlratom{1369}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{H}%
      \else\if\@@tmpa i\relax%
        \putlratom{1369}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{i}%
      \else\if\@@tmpa I\relax%
        \putlratom{1540}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{I}%
      \else
        \set@fusion@octameth
  \fi\fi\fi\fi
\else
 \if\@@tmpa h\relax%
        \putlratom{1198}{103}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{h}%
      \else\if\@@tmpa H\relax%
        \putlratom{1369}{0}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{H}%
      \else\if\@@tmpa i\relax%
        \putlratom{1369}{0}{\@@tmpb}%     % bond fused
        \FuseWarning{-171}{-103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{i}%
      \else\if\@@tmpa I\relax%
        \putlratom{1540}{103}{\@@tmpb}%       % bond fused
        \FuseWarning{171}{103}%
          {\fuseAx}{\fuseAy}{\fuseBx}{\fuseBy}{I}%
      \else
        \set@fusion@octameth
  \fi\fi\fi\fi
\fi%
\global\let\FuseWarning=\FuseW@rning%added 2010/10/01
}% end of the macro \set@fusion@decameth
%</methylen>
%    \end{macrocode}
% \end{macro}
%
% \Finale
%
\endinput
