% \iffalse meta-comment
%% File: hcycle.dtx
%
%  Copyright 1993,1996,1998,2001,2002,2004,2010,2013 by Shinsaku Fujita
%
%  This file is part of XyMTeX system.
%  -------------------------------------
%
% This file is a successor to:
%
% hcycle.sty
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \typeout{XyMTeX for Drawing Chemical Structural Formulas. Version 1.00}
% \typeout{       -- Released December 1, 1993 by Shinsaku Fujita}
% Copyright (C) 1993 by Shinsaku Fujita, all rights reserved.
%
% This file is a part of the macro package ``XyMTeX'' which has been 
% designed for typesetting chemical structural formulas.
%
% This file is to be contained in the ``xymtex'' directory which is 
% an input directory for TeX. It is a LaTeX optional style file and 
% should be used only within LaTeX, because several macros of the file 
% are based on LaTeX commands. 
%
% For the review of XyMTeX, see
%  (1)  Shinsaku Fujita, ``Typesetting structural formulas with the text
%    formatter TeX/LaTeX'', Computers and Chemistry, in press.    
% The following book deals with an application of TeX/LaTeX to 
% preparation of manuscripts of chemical fields:
%  (2)  Shinsaku Fujita, ``LaTeX for Chemists and Biochemists'' 
%    Tokyo Kagaku Dozin, Tokyo (1993) [in Japanese].  
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'. 
% The Current Maintainer of this work is Shinsaku Fujita.
%
% This work consists of the files hcycle.dtx and hcycle.ins
% and the derived file hcycle.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{hcycle}
% \def\versi@ndate{December 01, 1993}
% \def\versi@nno{ver1.00}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{hcycle}
% \def\versi@ndate{August 16, 1996}
% \def\versi@nno{ver1.01}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{hcycle}
% \def\versi@ndate{October 31, 1998}
% \def\versi@nno{ver1.02}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{hcycle}
% \def\versi@ndate{December 25, 1998}
% \def\versi@nno{ver2.00}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{hcycle}
% \def\versi@ndate{June 20, 2001}
% \def\versi@nno{ver2.01}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{hcycle}
% \def\versi@ndate{April 30, 2002}
% \def\versi@nno{ver3.00}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{hcycle}
% \def\versi@ndate{May 30, 2002}
% \def\versi@nno{ver4.00}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{hcycle}
% \def\versi@ndate{August 30, 2004}
% \def\versi@nno{ver4.01}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{hcycle}
% \def\versi@ndate{October 01, 2010}
% \def\versi@nno{ver5.00}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{hcycle}
% \def\versi@ndate{March 31, 2013}
% \def\versi@nno{ver5.01b}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \fi
%
% \CheckSum{3807}
%% \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.01}{1996/06/26}{first edition for LaTeX2e}
% \changes{v1.02}{1998/10/31}{revised edition for LaTeX2e}
% \changes{v2.00}{1998/12/25}{enhanced edition for LaTeX2e}
% \changes{v2.01}{2001/6/20}{Command for Sugars} (private version)
% \changes{v3.00}{2002/4/30}{Command for Sugars}
% \changes{v4.00}{2002/05/30}{PostScript output and ShiftPicEnv}
% \changes{v4.01}{2004/08/30}{Minor additions}
% \changes{v5.00}{2010/10/01}{bond coloring and the LaTeX Project Public License}
% \changes{v5.01b}{2013/03/30}{Improvement of this documentation}
% \changes{v5.01bb}{2013/03/31}{\cs{pyranosew} etc. added}
% \changes{v5.01}{2013/06/25}{\cs{sixsugarhw} etc. added. Wavy bonds added}
% \fi
%
% \iffalse
%<*driver>
\NeedsTeXFormat{pLaTeX2e}
% \fi
\ProvidesFile{hcycle.dtx}[2013/06/25 v5.01 XyMTeX{} package file]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{hcycle.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{Further Hetrocycles by {\sffamily hcycle.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
% %% (old address)
% %% Ashigara Research Laboratories, 
% %% Fuji Photo Film Co., Ltd., \\ 
% %% Minami-Ashigara, Kanagawa, 250-01 Japan
}
\date{\filedate}
%
\begin{document}
   \maketitle
   \DocInput{hcycle.dtx}
\end{document}
%</driver>
% \fi
%
% \section{Introduction}\label{hcycle:intro}
%
% \subsection{Options for {\sffamily docstrip}}
%
% \DeleteShortVerb{\|}
% \begin{center}
% \begin{tabular}{|l|l|}
% \hline
% \emph{option} & \emph{function}\\ \hline
% hcycle & hcycle.sty \\
% driver & driver for this dtx file \\
% \hline
% \end{tabular}
% \end{center}
% \MakeShortVerb{\|}
%
% \subsection{Version Information}
%
%    \begin{macrocode}
%<*hcycle>
\typeout{XyMTeX for Drawing Chemical Structural Formulas. Version 5.01}
\typeout{       -- Released June 25, 2013 by Shinsaku Fujita}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\j@urnalname{hcycle}
\def\versi@ndate{June 25, 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 hcycle.sty}
%
% \begin{verbatim}
% ********************************
% * hcycle.sty: list of commands *
% ********************************
%
% <Convention for bond-setting>
%
%     \@pyrana
%     \@pyranb
%     \@pyranbb
%     \@pyranbB
%     \@pyranbC
%     \@pyranc
%
% <Pyranose and Furanose>
%
%  construction: 
%     \pyranose                 \@pyranose
%     \Pyranose                 \@Pyranose
%     \furanose                 \@furanose
%     \Furanose                 \@Furanose
%
%     \pyranosew                \@pyranosew
%     \Pyranosew                \@Pyranosew
%     \furanosew                \@furanosew
%     \Furanosew                \@Furanosew
%
%   adjustment: 
%     \ylpyranoseposition
%     \ylfuranoseposition
%
% <Six-membered Sugars>
%   large dimension: 
%    (construction)
%     \SixSugarh \@Six@Sugarh \@Six@@Sugarh \@SixSugarh
%
%    (adjustment)
%     \ylSixSugarhposition     \test@vrtx@SixSugarh
%     \set@skel@Sugarhbond     \set@hetatom@Sugarh
%
%    (bond)
%     \Sugarhskbonda   \Sugarhskbondc   \Sugarhskbondd
%     \Sugarhskbondb   \Sugarhskbonde   \Sugarhskbondf
%
%     \Sugarhbonda     \Sugarhbondf      \Sugarhbondc
%     \Sugarhbondd     \Sugarhbonde      \Sugarhbondb
%
%   normal dimension: 
%    (construction)
%     \sixsugarh \@six@sugarh \@six@@sugarh \@sixsugarh
%     \sixsugarhw \@six@sugarhw 
%
%    (adjustment)
%     \set@skel@sugarhbond     \set@hetatom@sugarh
%
%    (bond)
%     \sugarhskbonda   \sugarhskbondc   \sugarhskbondd
%     \sugarhskbondb   \sugarhskbonde   \sugarhskbondf
%
%     \sugarhbonda     \sugarhbondf      \sugarhbondc
%     \sugarhbondd     \sugarhbonde      \sugarhbondb
%
% <Five-membered Sugars>
%
%   large dimension: 
%    (construction)
%     \FiveSugarh \@Five@Sugarh \@Five@@Sugarh \@FiveSugarh
%
%    (adjustment)
%     \ylFiveSugarhposition
%     \set@hteatom@FiveSugarh
%
%    (bond)
%     \fSugarhskbondd   \fSugarhskbonde   
%
%     \fSugarhbondd     \fSugarhbonde
%
%   normal dimension: 
%    (construction)
%     \fivesugarh \@five@sugarh \@five@@sugarh \@fivesugarh
%     \fivesugarhw \@five@sugarhw 
%
%    (adjustment)
%     \ylfiveSugarhposition
%     \set@hteatom@fivesugarh
%
%    (bond)
%     \fsugarhskbondd   \fsugarhskbonde   
%
%     \fsugarhbondd     \fsugarhbonde
%
% <Applications>
%     \cyclitol          \@cyclitol
%     \Cyclitol          \@Cyclitol
%
%
% \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 hcycle.sty} for the present case).  Hence, the combination 
% of |\input| and |\@ifundefined| is used to crossload sty 
% files ({\sf chemstr.sty} for the present case) in place of the 
% |\RequirePackage| command of \LaTeXe{}. 
%
%    \begin{macrocode}
% *************************
% * input of basic macros *
% *************************
\@ifundefined{setsixringv}{\input chemstr.sty\relax}{}
\unitlength=0.1pt
%    \end{macrocode}
%
% \section{Pyranoses and Furanoses}
% \subsection{Macros for setting substituents}
% 
% Macros |\@pyrana| to |\@pyranc| are used to set substituents 
% on each position of a pyranose and furanose. Note that 
% comments (conerning locant numbers) on the end of each row have 
% lost the exact meaning, 
% since such a command moiety is used in many macros after copying. 
%
% \begin{macro}{\@pyrana}
% \begin{macro}{\@pyranb}
% \begin{macro}{\@pyranbb}
% \begin{macro}{\@pyranbB}
% \begin{macro}{\@pyranc}
% \begin{macro}{\@pyranbC}
% \changes{v1.02}{1998/10/31}{Adding \cs{yl@xdiff} and \cs{yl@ydiff}}
% \changes{v2.01}{2001/6/20}{Adding \cs{\@pyranbC}}
% \changes{v5.01}{2013/6/25}{Adding wavy bonds}
%    \begin{macrocode}
% **************************************************
% * setting substituents for pyranose and furanose *
% **************************************************
% %%%%%%%%%%%%%%%
% % subst. on 1 %
% %%%%%%%%%%%%%%%
\newif\if@clipping \@clippingfalse
\def\@pyrana{%
 \if@clipping%clipping
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
     \yl@xdiff=-10
     \yl@ydiff=30
           \Put@Line(45,0)(1,0){80}% single bond at 1
           \putratom{130}{-30}{\@memberb}% right type
    \else\if\@tmpc a%(a) alpha
     \yl@xdiff=32
     \yl@ydiff=72
           \Put@Line(0,-45)(0,-1){73}% single bond at 1 alpha (down)
           \putratom{-32}{-190}{\@memberb}% right type
    \else\if\@tmpc b%(e) beta
     \yl@xdiff=32
     \yl@ydiff=-12
           \Put@Line(0,45)(0,1){73}% single bond at 1 beta (up)
           \putratom{-32}{130}{\@memberb}% right type
    \else\if\@tmpc A% alpha
     \yl@xdiff=-10
     \yl@ydiff=60
           \Put@Line(25,-25)(1,-1){100}% single bond at 1
           \putratom{130}{-180}{\@memberb}% right type
    \else\if\@tmpc B% beta
     \yl@xdiff=-10
     \yl@ydiff=10
           \Put@Line(25,25)(1,1){100}% single bond at 1
           \putratom{130}{110}{\@memberb}% right type
    \fi\fi\fi\fi\fi%
   \else \if\@tmpb D%double bond
     \yl@xdiff=-10
     \yl@ydiff=30
           \Put@Line(30,-15)(1,0){90}% double bond at 1
           \Put@Line(30,15)(1,0){90}% double bond at 1
           \putratom{130}{-30}{\@memberb}% right type
%2013/06/25
    \else\if\@tmpb U%(U) alpha undefined
      \yl@xdiff=-10\relax
      \yl@ydiff=30\relax
           {%
           \WaveBonds%
           \Put@Line(25,0)(1,0){100}%      % wavy bond at 1
           }%
           \putratom{130}{-30}{\@memberb}% right type
%
     \else%
     \yl@xdiff=-10
     \yl@ydiff=30
           \Put@Line(45,0)(1,0){90}% single bond at 1
           \putratom{130}{-30}{\@memberb}% right type
   \fi
   \fi\fi
 \else
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
     \yl@xdiff=-10
     \yl@ydiff=30
           \Put@Line(0,0)(1,0){120}% single bond at 1
           \putratom{130}{-30}{\@memberb}% right type
    \else\if\@tmpc a%(a) alpha
     \yl@xdiff=32
     \yl@ydiff=72
           \Put@Line(0,0)(0,-1){118}% single bond at 1 alpha (down)
           \putratom{-32}{-190}{\@memberb}% right type
    \else\if\@tmpc b%(e) beta
     \yl@xdiff=32
     \yl@ydiff=-12
           \Put@Line(0,0)(0,1){118}% single bond at 1 beta (up)
           \putratom{-32}{130}{\@memberb}% right type
    \else\if\@tmpc A% alpha
     \yl@xdiff=-10
     \yl@ydiff=60
           \Put@Line(0,0)(1,-1){120}% single bond at 1
           \putratom{130}{-180}{\@memberb}% right type
    \else\if\@tmpc B% beta
     \yl@xdiff=-10
     \yl@ydiff=10
           \Put@Line(0,0)(1,1){120}% single bond at 1
           \putratom{130}{110}{\@memberb}% right type
    \fi\fi\fi\fi\fi%
   \else \if\@tmpb D%double bond
     \yl@xdiff=-10
     \yl@ydiff=30
           \Put@Line(0,-15)(1,0){120}% double bond at 1
           \Put@Line(0,15)(1,0){120}% double bond at 1
           \putratom{130}{-30}{\@memberb}% right type
%2013/06/25
    \else\if\@tmpb U%(U) alpha undefined
      \yl@xdiff=-10\relax
      \yl@ydiff=30\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(1,0){120}%      % wavy bond at 1
           }%
           \putratom{130}{-30}{\@memberb}% right type
%
     \else%
     \yl@xdiff=-10
     \yl@ydiff=30
           \Put@Line(0,0)(1,0){120}% single bond at 1
           \putratom{130}{-30}{\@memberb}% right type
   \fi\fi\fi
 \fi
}%
%    \end{macrocode}
%
% \changes{v1.02}{1998/10/25}{\cs{@pyranb} is divided into 
% \cs{@pyranb}, \cs{@pyranbb} and \cs{@pyranbB}}
% \changes{v1.02}{1998/10/31}{Adding \cs{yl@xdiff} and \cs{yl@ydiff}}
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%
% % subst. on 2,3,5 %
% %%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%
% % subst. on 2 %
% %%%%%%%%%%%%%%%
\def\@pyranb{%
 \if@clipping%clipping
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
     \yl@xdiff=-10
     \yl@ydiff=60
           \Put@Line(45,-45)(1,-1){100}% single bond at 2
           \putratom{130}{-180}{\@memberb}% right type
    \else\if\@tmpc a%(a) alpha
     \yl@xdiff=32
     \yl@ydiff=72
           \Put@Line(0,-45)(0,-1){73}% single bond alpha (down)
           \putlratom{-32}{-190}{\@memberb}% left & right type
    \else\if\@tmpc b%(b) beta
     \yl@xdiff=32
     \yl@ydiff=-12
           \Put@Line(0,45)(0,1){73}% single bond beta (up)
           \putlratom{-32}{130}{\@memberb}% left & right type
    \else\if\@tmpc A%(A) beta
     \yl@xdiff=10
     \yl@ydiff=40
           \Put@Line(40,-40)(1,-1){100}% single bond at 2
           \putratom{130}{-180}{\@memberb}% right type
    \else\if\@tmpc B%(B) beta
     \yl@xdiff=-10
     \yl@ydiff=40
           \Put@Line(-40,-40)(-1,-1){100}% single bond at 2
           \putlatom{-130}{-180}{\@memberb}% left type
    \fi\fi\fi\fi\fi%
   \else \if\@tmpb D%double bond: Added by SF 1998/10/25
     \yl@xdiff=-10
     \yl@ydiff=60
           \Put@Line(15,-45)(1,-1){100}% double bond at 2
           \Put@Line(45,-15)(1,-1){100}% double bond at 2
           \putratom{130}{-180}{\@memberb}% right type
%2013/06/25
    \else\if\@tmpb U%(U) alpha undefined
      \yl@xdiff=-10\relax
      \yl@ydiff=40\relax
           {%
           \WaveBonds%
           \Put@Line(40,-40)(1,-1){90}%      % wavy bond at 2
           }%
           \putratom{130}{-180}{\@memberb}% right type
%
     \else%
     \yl@xdiff=-10
     \yl@ydiff=10
           \Put@Line(45,45)(1,1){100}% single bond at 1
           \putratom{130}{110}{\@memberb}% left type
   \fi\fi\fi
 \else
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
     \yl@xdiff=-10
     \yl@ydiff=60
           \Put@Line(0,0)(1,-1){120}% single bond at 1
           \putratom{130}{-180}{\@memberb}% left type
    \else\if\@tmpc a%(a) alpha
     \yl@xdiff=32
     \yl@ydiff=72
           \Put@Line(0,0)(0,-1){118}% single bond alpha (down)
           \putlratom{-32}{-190}{\@memberb}% left & right type
    \else\if\@tmpc b%(b) beta
     \yl@xdiff=32
     \yl@ydiff=-12
           \Put@Line(0,0)(0,1){118}% single bond beta (up)
           \putlratom{-32}{130}{\@memberb}% left & right type
    \fi\fi\fi%\fi\fi%
   \else \if\@tmpb D%double bond: Added by SF 1998/10/25
     \yl@xdiff=-10
     \yl@ydiff=60
           \Put@Line(-15,-15)(1,-1){120}% double bond at 1
           \Put@Line(0,15)(1,-1){120}% double bond at 1
           \putratom{130}{-180}{\@memberb}% right type
%2013/06/25
    \else\if\@tmpb U%(U) alpha undefined
      \yl@xdiff=-10\relax
      \yl@ydiff=60\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(1,-1){120}%      % wavy bond at 2
           }%
           \putratom{130}{-180}{\@memberb}% right type
%
     \else%
     \yl@xdiff=-10
     \yl@ydiff=10
           \Put@Line(0,0)(1,1){120}% single bond at 1
           \putratom{130}{110}{\@memberb}% left type
   \fi\fi\fi
 \fi
}%
%    \end{macrocode}
%
% \changes{v1.02}{1998/10/31}{Adding \cs{yl@xdiff} and \cs{yl@ydiff}}
%    \begin{macrocode}
% %%%%%%%%%%%%%%%
% % subst. on 3 %
% %%%%%%%%%%%%%%%
\def\@pyranbb{%
 \if@clipping%clipping
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
     \yl@xdiff=-10
     \yl@ydiff=60
           \Put@Line(45,-45)(1,-1){100}% single bond at 3
           \putratom{130}{-180}{\@memberb}% right type
    \else\if\@tmpc a%(a) alpha
     \yl@xdiff=32
     \yl@ydiff=72
           \Put@Line(0,-45)(0,-1){73}% single bond alpha (down)
           \putlratom{-32}{-190}{\@memberb}% left & right type
    \else\if\@tmpc b%(b) beta
     \yl@xdiff=32
     \yl@ydiff=-12
           \Put@Line(0,45)(0,1){73}% single bond beta (up)
           \putlratom{-32}{130}{\@memberb}% left & right type
    \else\if\@tmpc A%(A) beta%
      \yl@xdiff=-10
      \yl@ydiff=60
           \Put@Line(45,-45)(1,-1){100}% single bond at 3
           \putratom{130}{-180}{\@memberb}% right type
    \else\if\@tmpc B%(B) beta
      \yl@xdiff=10
      \yl@ydiff=60
           \Put@Line(-45,-45)(-1,-1){100}% single bond at 3
           \putlatom{-130}{-180}{\@memberb}% left type
    \fi\fi\fi\fi\fi%
   \else \if\@tmpb D%double bond: Added by SF 1998/10/25
     \yl@xdiff=20
     \yl@ydiff=60
           \Put@Line(-15,-45)(-1,-1){100}% double bond at 3
           \Put@Line(-45,-15)(-1,-1){100}% double bond at 3
           \putlatom{-130}{-180}{\@memberb}%left type
%2013/06/25
    \else\if\@tmpb U%(U) alpha undefined
      \yl@xdiff=-10\relax
      \yl@ydiff=60\relax
           {%
           \WaveBonds%
           \Put@Line(-40,-40)(-1,-1){90}%      % wavy bond at 2
           }%
           \putlatom{-130}{-180}{\@memberb}% left type
%
     \else%
     \yl@xdiff=10
     \yl@ydiff=60
           \Put@Line(-45,-45)(-1,-1){100}% single bond at 1
           \putlatom{-130}{-180}{\@memberb}% left type
   \fi\fi\fi
 \else
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
     \yl@xdiff=-10
     \yl@ydiff=60
           \Put@Line(0,0)(1,-1){120}% single bond at 1
           \putratom{130}{-180}{\@memberb}% left type
    \else\if\@tmpc a%(a) alpha
     \yl@xdiff=32
     \yl@ydiff=72
           \Put@Line(0,0)(0,-1){118}% single bond alpha (down)
           \putlratom{-32}{-190}{\@memberb}% left & right type
    \else\if\@tmpc b%(b) beta
     \yl@xdiff=32
     \yl@ydiff=-12
           \Put@Line(0,0)(0,1){118}% single bond beta (up)
           \putlratom{-32}{130}{\@memberb}% left & right type
    \fi\fi\fi%\fi\fi%
   \else \if\@tmpb D%double bond: Added by SF 1998/10/25
     \yl@xdiff=20
     \yl@ydiff=60
           \Put@Line(15,-15)(-1,-1){120}% double bond at 1
           \Put@Line(0,15)(-1,-1){120}% double bond at 1
           \putlatom{-130}{-180}{\@memberb}%left type
%2013/06/25
    \else\if\@tmpb U%(U) alpha undefined
      \yl@xdiff=-10\relax
      \yl@ydiff=60\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(-1,-1){120}%      % wavy bond at 2
           }%
           \putlatom{-130}{-180}{\@memberb}% left type
%
     \else%
     \yl@xdiff=10
     \yl@ydiff=60
           \Put@Line(0,0)(-1,-1){120}% single bond at 1
           \putlatom{-130}{-180}{\@memberb}% left type
   \fi\fi\fi
 \fi
}%
%    \end{macrocode}
%
% \changes{v1.02}{1998/10/31}{Adding \cs{yl@xdiff} and \cs{yl@ydiff}}
%    \begin{macrocode}
% %%%%%%%%%%%%%%%
% % subst. on 5 %
% %%%%%%%%%%%%%%%
\def\@pyranbB{%
 \if@clipping%clipping
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
     \yl@xdiff=10
     \yl@ydiff=-60
           \Put@Line(-45,45)(-1,1){100}% single bond at 5
           \putlatom{-130}{130}{\@memberb}% left type
    \else\if\@tmpc a%(a) alpha
     \yl@xdiff=32
     \yl@ydiff=72
           \Put@Line(0,-45)(0,-1){73}% single bond alpha (down)
           \putlratom{-32}{-190}{\@memberb}% left & right type
    \else\if\@tmpc b%(b) beta
     \yl@xdiff=32
     \yl@ydiff=-12
           \Put@Line(0,45)(0,1){73}% single bond beta (up)
           \putlratom{-32}{130}{\@memberb}% left & right type
    \else\if\@tmpc A%(A) beta
     \yl@xdiff=10
     \yl@ydiff=-60
           \Put@Line(-45,45)(-1,1){100}% single bond at 5
           \putlatom{-130}{130}{\@memberb}% left type
    \else\if\@tmpc B%(B) beta
     \yl@xdiff=-10
     \yl@ydiff=60
           \Put@Line(45,45)(1,1){100}% single bond at 5
           \putratom{130}{130}{\@memberb}% left type
    \fi\fi\fi\fi\fi%
   \else \if\@tmpb D%double bond: Added by SF 1998/10/25
     \yl@xdiff=0
     \yl@ydiff=-20
           \Put@Line(-15,45)(-1,1){100}% double bond at 5
           \Put@Line(-45,15)(-1,1){100}% double bond at 5
           \putlatom{-120}{140}{\@memberb}%left type
%2013/06/25
    \else\if\@tmpb U%(U) alpha undefined
      \yl@xdiff=10\relax
      \yl@ydiff=-60\relax
           {%
           \WaveBonds%
           \Put@Line(-40,40)(-1,1){90}%      % wavy bond at 5
           }%
           \putlatom{-130}{130}{\@memberb}% left type
%
     \else%
     \yl@xdiff=10
     \yl@ydiff=-60
           \Put@Line(-45,45)(-1,1){100}% single bond at 5
           \putlatom{-130}{130}{\@memberb}% left type
   \fi\fi\fi
 \else
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
     \yl@xdiff=-10
     \yl@ydiff=60
           \Put@Line(0,0)(1,-1){120}% single bond at 5
           \putratom{130}{-180}{\@memberb}% left type
    \else\if\@tmpc a%(a) alpha
     \yl@xdiff=32
     \yl@ydiff=72
           \Put@Line(0,0)(0,-1){118}% single bond alpha (down)
           \putlratom{-32}{-190}{\@memberb}% left & right type
    \else\if\@tmpc b%(b) beta
     \yl@xdiff=32
     \yl@ydiff=-12
           \Put@Line(0,0)(0,1){118}% single bond beta (up)
           \putlratom{-32}{130}{\@memberb}% left & right type
    \fi\fi\fi%\fi\fi%
   \else \if\@tmpb D%double bond: Added by SF 1998/10/25
     \yl@xdiff=0
     \yl@ydiff=-20
           \Put@Line(15,15)(-1,1){120}% double bond at 5
           \Put@Line(0,-15)(-1,1){120}% double bond at 5
           \putlatom{-120}{140}{\@memberb}%left type
%2013/06/25
    \else\if\@tmpb U%(U) alpha undefined
      \yl@xdiff=10\relax
      \yl@ydiff=-60\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(-1,1){120}%      % wavy bond at 5
           }%
           \putlatom{-130}{130}{\@memberb}% left type
%
     \else%
     \yl@xdiff=10
     \yl@ydiff=-20
           \Put@Line(0,0)(-1,1){120}% single bond at 1
           \putlatom{-130}{140}{\@memberb}% left type
   \fi\fi\fi
 \fi
}%
%    \end{macrocode}
%
% \changes{v1.02}{1998/10/31}{Adding \cs{yl@xdiff} and \cs{yl@ydiff}}
%    \begin{macrocode}
% %%%%%%%%%%%%%%%
% % subst. on 4 %
% %%%%%%%%%%%%%%%
\def\@pyranc{%
 \if@clipping%clipping
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
     \yl@xdiff=10
     \yl@ydiff=30
           \Put@Line(-45,0)(-1,0){80}% single bond at 4
           \putlatom{-130}{-30}{\@memberb}% left type
    \else\if\@tmpc a%(a) alpha
     \yl@xdiff=-32
     \yl@ydiff=72
           \Put@Line(0,-45)(0,-1){80}% single bond at 4
           \putlatom{32}{-190}{\@memberb}% left type
    \else\if\@tmpc b%(e) beta
     \yl@xdiff=-32
     \yl@ydiff=-12
           \Put@Line(0,45)(0,1){80}% single bond at 4 beta (up)
           \putlatom{32}{130}{\@memberb}% left type
    \else\if\@tmpc A% alpha
     \yl@xdiff=10
     \yl@ydiff=60
           \Put@Line(-30,-30)(-1,-1){100}% single bond at 4
           \putlatom{-130}{-180}{\@memberb}% left type
    \else\if\@tmpc B% beta
     \yl@xdiff=10
     \yl@ydiff=10
           \Put@Line(-30,30)(-1,1){100}% single bond at 4
           \putlatom{-130}{110}{\@memberb}% left type
    \fi\fi\fi\fi\fi%
   \else \if\@tmpb D%double bond
     \yl@xdiff=10
     \yl@ydiff=30
           \Put@Line(-30,-15)(-1,0){100}% double bond at 4
           \Put@Line(-30,15)(-1,0){100}% double bond at 4
           \putlatom{-130}{-30}{\@memberb}% left type
%2013/06/25
    \else\if\@tmpb U%(U) alpha undefined
      \yl@xdiff=10\relax
      \yl@ydiff=30\relax
           {%
           \WaveBonds%
           \Put@Line(-30,0)(-1,0){100}%      % wavy bond at 4
           }%
           \putlatom{-130}{-30}{\@memberb}% left type
%
     \else%
     \yl@xdiff=10
     \yl@ydiff=30
           \Put@Line(-45,0)(-1,0){80}% single bond at 4
           \putlatom{-130}{-30}{\@memberb}% left type
   \fi\fi\fi
 \else
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
     \yl@xdiff=10
     \yl@ydiff=30
           \Put@Line(0,0)(-1,0){120}% single bond at 4
           \putlatom{-130}{-30}{\@memberb}% left type
    \else\if\@tmpc a%(a) alpha
     \yl@xdiff=-32
     \yl@ydiff=72
           \Put@Line(0,0)(0,-1){118}% single bond at 4 alpha (down)
           \putlatom{32}{-190}{\@memberb}% left type
    \else\if\@tmpc b%(e) beta
     \yl@xdiff=-32
     \yl@ydiff=-12
           \Put@Line(0,0)(0,1){118}% single bond at 4 beta (up)
           \putlatom{32}{130}{\@memberb}% left type
    \else\if\@tmpc A% alpha
     \yl@xdiff=10
     \yl@ydiff=60
           \Put@Line(0,0)(-1,-1){120}% single bond at 4
           \putlatom{-130}{-180}{\@memberb}% left type
    \else\if\@tmpc B% beta
     \yl@xdiff=10
     \yl@ydiff=10
           \Put@Line(0,0)(-1,1){120}% single bond at 4
           \putlatom{-130}{110}{\@memberb}% left type
    \fi\fi\fi\fi\fi%
   \else \if\@tmpb D%double bond
     \yl@xdiff=10
     \yl@ydiff=30
           \Put@Line(0,-15)(-1,0){120}% double bond at 4
           \Put@Line(0,15)(-1,0){120}% double bond at 4
           \putlatom{-130}{-30}{\@memberb}% left type
%2013/06/25
    \else\if\@tmpb U%(U) alpha undefined
      \yl@xdiff=10\relax
      \yl@ydiff=30\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(-1,0){120}%      % wavy bond at 4
           }%
           \putlatom{-130}{-30}{\@memberb}% left type
%
     \else%
     \yl@xdiff=10
     \yl@ydiff=30
           \Put@Line(0,0)(-1,0){120}% single bond at 4
           \putlatom{-130}{-30}{\@memberb}% left type
   \fi\fi\fi
 \fi
}%
%    \end{macrocode}
%
% \changes{v2.01}{2001/06/20}{New command for SixSugar}
%    \begin{macrocode}
% %%%%%%%%%%%%%%%
% % subst. on 6 %
% %%%%%%%%%%%%%%%
\def\@pyranbC{%
 \if@clipping%clipping
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
     \yl@xdiff=5
     \yl@ydiff=5
           \Put@Line(45,45)(1,1){100}% single bond at 6
           \putratom{130}{140}{\@memberb}% left type
    \else\if\@tmpc a%(a) alpha
     \yl@xdiff=32
     \yl@ydiff=72
           \Put@Line(0,-45)(0,-1){73}% single bond alpha (down)
           \putlratom{-32}{-190}{\@memberb}% left & right type
    \else\if\@tmpc b%(b) beta
     \yl@xdiff=32
     \yl@ydiff=-12
           \Put@Line(0,45)(0,1){73}% single bond beta (up)
           \putlratom{-32}{130}{\@memberb}% left & right type
    \else\if\@tmpc A%(A)
     \yl@xdiff=5
     \yl@ydiff=5
           \Put@Line(45,45)(1,1){100}% single bond at 6
           \putratom{130}{140}{\@memberb}% right type
    \else\if\@tmpc B%(B)
     \yl@xdiff=5
     \yl@ydiff=-15
           \Put@Line(-45,45)(-1,1){100}% single bond at 6
           \putlatom{-130}{140}{\@memberb}% left type
    \fi\fi\fi\fi\fi%
   \else \if\@tmpb D%double bond: Added by SF 1998/10/25
     \yl@xdiff=0
     \yl@ydiff=-20
           \Put@Line(45,15)(1,1){100}% double bond at 6
           \Put@Line(15,45)(1,1){100}% double bond at 6
           \putratom{130}{140}{\@memberb}%right type
%2013/06/25
    \else\if\@tmpb U%(U) alpha undefined
      \yl@xdiff=5\relax
      \yl@ydiff=5\relax
           {%
           \WaveBonds%
           \Put@Line(40,40)(1,1){90}%      % wavy bond at 6
           }%
           \putratom{130}{130}{\@memberb}% right type
%
     \else%
     \yl@xdiff=5
     \yl@ydiff=5
           \Put@Line(45,45)(1,1){100}% single bond at 6
           \putratom{130}{140}{\@memberb}% left type
   \fi\fi\fi
 \else
   \if\@tmpb S%single bond
    \ifx\@tmpc\empty%
     \yl@xdiff=-10
     \yl@ydiff=60
           \Put@Line(0,0)(1,-1){120}% single bond at 6
           \putratom{130}{-180}{\@memberb}% left type
    \else\if\@tmpc a%(a) alpha
     \yl@xdiff=32
     \yl@ydiff=72
           \Put@Line(0,0)(0,-1){118}% single bond alpha (down)
           \putlratom{-32}{-190}{\@memberb}% left & right type
    \else\if\@tmpc b%(b) beta
     \yl@xdiff=32
     \yl@ydiff=-12
           \Put@Line(0,0)(0,1){118}% single bond beta (up)
           \putlratom{-32}{130}{\@memberb}% left & right type
    \fi\fi\fi%\fi\fi%
   \else \if\@tmpb D%double bond: Added by SF 1998/10/25
     \yl@xdiff=0
     \yl@ydiff=-20
           \Put@Line(15,-15)(1,1){120}% double bond at 6
           \Put@Line(0,15)(1,1){120}% double bond at 6
           \putratom{130}{140}{\@memberb}%right type
%2013/06/25
    \else\if\@tmpb U%(U) alpha undefined
      \yl@xdiff=5\relax
      \yl@ydiff=5\relax
           {%
           \WaveBonds%
           \Put@Line(0,0)(1,1){120}%      % wavy bond at 6
           }%
           \putratom{130}{130}{\@memberb}% right type
%
          \else%
     \yl@xdiff=10
     \yl@ydiff=-20
           \Put@Line(0,0)(1,1){120}% single bond at 6
           \putratom{130}{140}{\@memberb}% right type
   \fi\fi\fi
 \fi
}%
%</hcycle>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsection{Pyranose derivatives}
%
% The standard skeleton of pyranose is selected 
% to have the following locant numbers. 
%
% \begin{verbatim}
% ***********************
% * pyranose derivative *
% ***********************
%
% The following numbering is adopted in this macro. 
%
%                                5  e  6
%                                 ----O
%                             d *       * f
%   the original point ===> 4 *           * 1
%          (0,0)                *       * a
%                             c   -----
%                                3  b   2
% \end{verbatim}
%
% The macro |\pyranose| has an argument |SUBSLIST| as well as an optional 
% argument |BONDLIST|.  
% \begin{verbatim}
%
%   \pyranose[BONDLIST]{SUBSLIST}          
%
% \end{verbatim}
%
% The |BONDLIST| argument contains one or more 
% characters selected from a to f, each of which indicates the presence of 
% an inner (endcyclic) double bond on the corresponding position. 
% \begin{verbatim}
%
%     BONDLIST = 
%
%           none       :  mother skeleton
%           a          :  1,2-double bond
%           b          :  2,3-double bond
%           c          :  4,3-double bond
%           d          :  4,5-double bond
%           e          :  5,6-double bond
%           f          :  6,1-double bond
%
% \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 (max 5 substitution positions)
%
%       for n = 1 to 5 
%
%           nD         :  exocyclic double bond at n-atom
%           n or nS    :  exocyclic single bond at n-atom
%           nSA        :  single bond (down) at n-atom (for n=1)
%           nSB        :  single bond (up) at n-atom (for n=1)
%           nSa        :  alpha single bond at n-atom
%           nSb        :  beta single bond at n-atom
%
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \pyranose{1Sb==Cl;2Sa==F}
%        \pyranose{1Sb==Cl;4Sa==F;2Sa==CH$_{3}$}
%        \pyranose[a]{3Sb==OAc;4Sb==\lmoiety{MeO};5Sb==CH$_{2}$OAc}
% \end{verbatim}
%
% The definition of |\@pyranose| uses a picture environment, in which 
% bonds are put directly, while subsituents are typset by using 
% the macros |\@pyrana| to |\@pyranc| described above.  
% \changes{v1.02}{1998/10/31}{Adding \cs{ylpyranoseposition}, \cs{if@ylsw},
% \cs{yl@shifti}, \cs{@ylii}, \cs{yl@shiftii}, \cs{@ylii}, 
% \cs{yl@xdiff} and \cs{yl@ydiff}}
%
% \changes{v2.01}{2001/06/20}{The definition has been changed: 
% the old \cs{pyranose} to \cs{pyranoseold}}
% \changes{v5.00}{2010/10/01}{For bond coloring}
% \begin{macro}{\pyranoseold}
% \begin{macro}{\@pyranoseold}
%    \begin{macrocode}
%<*hcycleold>
\def\pyranoseold{\@ifnextchar[{\@pyranoseold}{\@pyranoseold[r]}}
\def\@pyranoseold[#1]#2{%
\@reset@ylsw%
\ylpyranoseposition{#2}%
\def\@@ylii{0}\def\@@yli{0}%
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(880,800)(-240,-400){pyranose}%
(240,400)%2002/4/30 by S. Fujita
  \Put@Line(0,0)(3,5){120}%           %bond 4-5
  \Put@Line(120,200)(1,0){252}%       %bond 5-6
  \Put@Line(532,0)(-3,5){96}%         %bond 1-6
 {\thicklines%
  \Put@Line(0,0)(3,-5){120}%          %bond 4-3
  \Put@Line(412,-200)(3,5){120}%      %bond 2-1
  \Put@Line(120,-200)(1,0){292}}%     %bond 3-2
  \putratom{382}{160}{O}% left type
  %
\@tfor\member:=#1\do{%
\if\member r%no endcyclic double bonds
\else \if\member a%
  \Put@Line(400,-150)(3,5){90}%       %double bond 2-1
\else \if\member b%
  \Put@Line(150,-160)(1,0){232}%      %double bond 3-2
\else \if\member c%
  \Put@Line(50,-12)(3,-5){90}%        %double bond 4-3
\else \if\member d%
  \Put@Line(50,12)(3,5){90}%          %double bond 4-5
\else \if\member e%
  \Put@Line(150,160)(1,0){232}%       %double bond 5-6
\else \if\member f%
  \Put@Line(482,12)(-3,5){70}%        %double bond 1-6
\fi\fi\fi\fi\fi\fi\fi}%
%
\@forsemicol\member:=#2\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\ifx\@memberb\@yl\else
\ifcase\@tmpa%0 omit
 \or\setBScolor{\Put@Direct(532,0){%
  \if@clip \@clippingtrue \else \@clippingfalse\fi
  \@pyrana}}% subst. on 1
 \or\setBScolor{\Put@Direct(412,-200){%
  \if@eclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranb}}% subst. on 2
 \or\setBScolor{\Put@Direct(120,-200){%
  \if@fclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranbb}}% subst. on 3
 \or\setBScolor{\Put@Direct(0,0){%
  \if@aclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranc}}% subst. on 4
 \or\setBScolor{\Put@Direct(120,200){%
  \if@bclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranbB}}% subst. on 5
 \or\setBScolor{\Put@Direct(412,200){%
  \if@cclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranbC}}% subst. on 6%%added 2001/6/20
\fi %end of ifcase
\fi\fi%
}%
\end{ShiftPicEnvB}%
}%               %end of \pyranose macro
%</hcycleold>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{v2.01}{2001/06/20}{The new definition for \cs{pyranose}}
%
% \begin{macro}{\pyranose}
% \begin{macro}{\@pyranose}
%    \begin{macrocode}
%<*hcycle>
\def\pyranose{\@ifnextchar[{\@pyranose}{\@pyranose[]}}
\def\@pyranose[#1]#2{\sixsugarh[#1]{6==O}{#2}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The front skeletal bonds of a pyranose ring are typeset with a bold line and wedged lines. 
% \changes{v5.01}{2013/03/31}{added the definition for \cs{pyranosew}}
%
% \begin{macro}{\pyranosew}
% \begin{macro}{\@pyranosew}
%    \begin{macrocode}
\def\pyranosew{\@ifnextchar[{\@pyranosew}{\@pyranosew[]}}
\def\@pyranosew[#1]#2{%
\sixsugarh[#1]{6==O;1s==\WedgeAsSubst(0,0)(-3,-5){120};4s==\WedgeAsSubst(0,0)(3,-5){120};%
3s==\PutBondLine(-17,0)(307,0){2.8pt}}{#2}[abc]}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% Pyranose derivatives of slightly large dimension can be 
% drawn by the |\Pyranose| macro. 
%
% \changes{v2.01}{2001/06/20}{New command: \cs{Pyranose}}
%
% \begin{macro}{\Pyranose}
% \begin{macro}{\@Pyranose}
%    \begin{macrocode}
\def\Pyranose{\@ifnextchar[{\@Pyranose}{\@Pyranose[]}}
\def\@Pyranose[#1]#2{\SixSugarh[#1]{6==O}{#2}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The front skeletal bonds of a pyranose ring are typeset with a bold line and wedged lines. 
% This command cannot be used in |\TeX|/|\LaTeX| mode. The PostScript mode or the PDF mode 
% should be used. 
% \changes{v5.01}{2013/03/31}{added the definition for \cs{Pyranosew}}
%
% \begin{macro}{\Pyranosew}
% \begin{macro}{\@Pyranosew}
%    \begin{macrocode}
\def\Pyranosew{\@ifnextchar[{\@Pyranosew}{\@Pyranosew[]}}
\def\@Pyranosew[#1]#2{%
\SixSugarh[#1]{6==O;1s==\WedgeAsSubst(0,0)(-3,-5){153};4s==\WedgeAsSubst(0,0)(3,-5){153};%
3s==\PutBondLine(-17,0)(376,0){2.8pt}}{#2}[abc]}
%</hcycle>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Furanose derivatives}
%
% The standard skeleton of furanose is selected 
% to have the following locant numbers. 
%
% \begin{verbatim}
% ***********************
% * furanose derivative *
% ***********************
%
% The following numbering is adopted in this macro. 
%
%                                   5
%                                   O
%                             d  *     * e
%   the original point ===> 4 *           * 1
%          (0,0)                *       * a
%                             c   -----
%                                3  b   2
%
% \end{verbatim}
%
% The macro |\furanose| has an argument |SUBSLIST| as well as an optional 
% argument |BONDLIST|.  
% \begin{verbatim}
%   \furanose[BONDLIST]{SUBSLIST}          
% \end{verbatim}
%
% The |BONDLIST| argument contains one or more 
% characters selected from a to e, each of which indicates the presence of 
% an inner (endcyclic) double bond on the corresponding position. 
% \begin{verbatim}
%     BONDLIST = 
%
%           none       :  mother skeleton
%           a          :  1,2-double bond
%           b          :  2,3-double bond
%           c          :  4,3-double bond
%           d          :  4,5-double bond
%           e          :  5,6-double bond
% \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 (max 4 substitution positions)
%
%       for n = 1 to 4
%
%           nD         :  exocyclic double bond at n-atom
%           n or nS    :  exocyclic single bond at n-atom
%           nSA        :  single bond (down) at n-atom (for n=1)
%           nSB        :  single bond (up) at n-atom (for n=1)
%           nSa        :  alpha single bond at n-atom
%           nSb        :  beta single bond at n-atom
%\end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g. 
%        
%        \furanose{1Sa==Cl;2Sb==F}
%
% \end{verbatim}
%
% The definition of |\@furanose| uses a picture environment, in which 
% bonds are put directly, while subsituents are typset by using 
% the macros |\@pyrana| to |\@pyranc| described above.  
% \changes{v1.02}{1998/10/31}{Adding \cs{ylfuranoseposition}, \cs{if@ylsw},
% \cs{yl@shifti}, \cs{@ylii}, \cs{yl@shiftii}, \cs{@ylii}, 
% \cs{yl@xdiff} and \cs{yl@ydiff}}
% \changes{v5.00}{2010/10/01}{For bond coloring}
%
% \begin{macro}{\furanoseold}
% \begin{macro}{\@furanoseold}
%    \begin{macrocode}
%<*hcycleold>
\def\furanoseold{\@ifnextchar[{\@furanoseold}{\@furanoseold[r]}}
\def\@furanoseold[#1]#2{%
\@reset@ylsw%
\ylfuranoseposition{#2}%
\def\@@ylii{0}\def\@@yli{0}%
\begin{ShiftPicEnvB}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(880,800)(-240,-400){furanose}%
(240,400)%2002/4/30 by S. Fujita
   \Put@Line(0,0)(5,3){236}%          %bond 4-5
   \Put@Line(532,0)(-5,3){236}%       %bond 1-5
 {\thicklines%
  \Put@Line(0,0)(3,-5){120}%          %bond 4-3
  \Put@Line(412,-200)(3,5){120}%      %bond 2-1
  \Put@Line(120,-200)(1,0){292}}%     %bond 3-2
  \putratom{236}{130}{O}% left type
%
\@tfor\member:=#1\do{%
\if\member r%no endcyclic double bonds
\else \if\member a%
  \Put@Line(400,-150)(3,5){80}%       %double bond 2-1
\else \if\member b%
  \Put@Line(150,-160)(1,0){232}%      %double bond 3-2
\else \if\member c%
  \Put@Line(50,-12)(3,-5){80}%        %double bond 4-3
\else \if\member d%
  \Put@Line(50,0)(5,3){180}%          %double bond 4-5
\else \if\member e%
  \Put@Line(482,0)(-5,3){180}%        %double bond 1-5
\fi\fi\fi\fi\fi\fi}%
%
\@forsemicol\member:=#2\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\ifx\@memberb\@yl\else
\ifcase\@tmpa%0 omit
 \or\setBScolor{\Put@Direct(532,0){\@pyrana}}% subst. on 1
 \or\setBScolor{\Put@Direct(412,-200){\@pyranb}}% subst. on 2
 \or\setBScolor{\Put@Direct(120,-200){\@pyranbb}}% subst. on 3
 \or\setBScolor{\Put@Direct(0,0){\@pyranc}}% subst. on 4
\fi%end of ifcase
\fi\fi%
}%
\end{ShiftPicEnvB}%
}%               %end of \furanoseold macro
%</hcycleold>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{v2.01}{2001/06/20}{The new definition for \cs{furanose}}
% \begin{macro}{\furanose}
% \begin{macro}{\@furanose}
%    \begin{macrocode}
%<*hcycle>
\def\furanose{\@ifnextchar[{\@furanose}{\@furanose[]}}
\def\@furanose[#1]#2{\fivesugarh[#1]{5==O}{#2}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The front skeletal bonds of a pyranose ring are typeset with a bold line and wedged lines. 
% \changes{v5.01}{2013/03/31}{New command \cs{furanosew}}
% \begin{macro}{\furanosew}
% \begin{macro}{\@furanosew}
%    \begin{macrocode}
\def\furanosew{\@ifnextchar[{\@furanosew}{\@furanosew[]}}
\def\@furanosew[#1]#2{%
\fivesugarh[#1]{5==O;1s==\WedgeAsSubst(0,0)(-3,-5){120};%
4s==\WedgeAsSubst(0,0)(3,-5){120};%
3s==\PutBondLine(-17,0)(307,0){2.8pt}}{#2}[abc]}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% Furanose derivatives of slightly large dimension can be 
% drawn by the |\Furanose| macro. 
%
% \changes{v2.01}{2001/06/20}{New command: \cs{Furanose}}
%
% \begin{macro}{\Furanose}
% \begin{macro}{\@Furanose}
%    \begin{macrocode}
\def\Furanose{\@ifnextchar[{\@Furanose}{\@Furanose[]}}
\def\@Furanose[#1]#2{\FiveSugarh[#1]{5==O}{#2}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The front skeletal bonds of a pyranose ring are typeset with a bold line and wedged lines. 
% This command cannot be used in |\TeX|/|\LaTeX| mode. The PostScript mode or the PDF mode 
% should be used. 
% \changes{v5.01}{2013/03/31}{New command \cs{Furanosew}}
% \begin{macro}{\Furanosew}
% \begin{macro}{\@Furanosew}
%    \begin{macrocode}
\def\Furanosew{\@ifnextchar[{\@Furanosew}{\@Furanosew[]}}
\def\@Furanosew[#1]#2{%
\FiveSugarh[#1]{5==O;1s==\WedgeAsSubst(0,0)(-3,-5){153};%
4s==\WedgeAsSubst(0,0)(3,-5){153};%
3s==\PutBondLine(-17,0)(376,0){2.8pt}}{#2}[abc]}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \section{Six-Membered Sugar Derivatives of Large Dimension}
% \subsection{General Conventions}
%
% The standard skeleton of cyclitol is selected 
% to have the following locant numbers. 
%
% \begin{verbatim}
% ********************
% * Sugarh derivative *
% ********************
%
% The following numbering is adopted in this macro. 
%
%                                5  e  6
%                                 ----
%                             d *       * f
%   the original point ===> 4 *           * 1
%          (0,0)                *       * a
%                             c   -----
%                                3  b   2
% \end{verbatim}
%
%
% The macro |\SixSugarh| has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
% Two optional arguments |SKBONDLIST| and |OMIT| are added to 
% treat stereochemical information or other bond situations. 
%
% \begin{verbatim}
%   \SixSugarh(SKBONDLIST)[BONDLIST]{ATOMLIST}{SUBSLIST}[OMIT]
% \end{verbatim}
%
% The |SKBONDLIST| argument contains pairs of two alphabets in 
% parentheses, e.g. (\{bA\}\{fB\}).  Each pair contains a lowercase 
% character selected from bond specifiers `a' to `f' and a uppercase
% character `A' or `B'. 
%
% The |BONDLIST| argument contains one 
% character selected from a to f, each of which indicates the presence of 
% an inner (endcyclic) double bond on the corresponding position. 
% The option `$n+$' ($n=1$ to $6$) represents a plus charge on a hetero atom 
% at the $n$-position. 
%
% \begin{verbatim}
%  
%     BONDLIST = 
%           none or [] :  fully saturated form
%           a          :  1,2-double bond
%           b          :  2,3-double bond
%           c          :  4,3-double bond
%           d          :  4,5-double bond
%           e          :  5,6-double bond
%           f          :  6,1-double bond
%           {n+}       :  plus at the n-nitrogen atom (n = 1 to 4)
% \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 (max 6 substitution positions)
%
%       for n = 1 to 6 
%
%           nD         :  exocyclic double bond at n-atom
%           n or nS    :  exocyclic single bond at n-atom
%           nSA        :  single bond (down) at n-atom (for n=1)
%           nSB        :  single bond (up) at n-atom (for n=1)
%           nSa        :  alpha single bond at n-atom
%           nSb        :  beta single bond at n-atom
%
% \end{verbatim}
%
% The argument |OMIT| represents one or more bonds to be omitted. 
% The omitted edges may be regarded as both fused and non-fused 
% positions. 
%
% \begin{verbatim}
%     OMIT:  one or more bonds omitted (a, b, c, d, e, or f)
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g.
%        \SixSugarh{6==O}{1Sa==OH;2Sa==OH}
% \end{verbatim}
%
% The definition of |\SixSugarh| uses a picture environment and 
% consists of the same unit processes as shown in |\sixheteroh|: 
% \begin{enumerate}
% \item treatment of atom list, 
% \item placing outer skeletons, 
% \item placing inner double bonds, 
% \item setting hetero atoms, and 
% \item placing substituents dirctly 
%         (cf. |\setsixringh| for a |\sixheteroh|)
% \end{enumerate}
% \changes{v2.01}{2001/6/20}{Newly defined.}
% \changes{v5.00}{2010/10/01}{For bond coloring}
%
% \begin{macro}{\SixSugarh}
% \begin{macro}{\@Six@Sugarh}
% \begin{macro}{\@Six@@Sugarh}
% \begin{macro}{\@SixSugarh}
%    \begin{macrocode}
\def\SixSugarh{\@ifnextchar({\@Six@Sugarh(@}{\@Six@Sugarh(@)}}
\def\@Six@Sugarh(#1){\@ifnextchar[{\@Six@@Sugarh(#1)[@}%
{\@Six@@Sugarh(#1)[@]}}
\def\@Six@@Sugarh(#1)[#2]#3#4{\@ifnextchar[%
{\@SixSugarh(#1)[#2]{#3}{#4}[@}%
{\@SixSugarh(#1)[#2]{#3}{#4}[@]}}
\def\@SixSugarh(#1)[#2]#3#4[#5]{%
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%%%
% % treatment of atom list %
% %%%%%%%%%%%%%%%%%%%%%%%%%%
\iniatom\iniflag%initialize
\test@vrtx@SixSugarh{#3}%
%test for a hetero atom or a spiro substituent on a vertex
\@reset@ylsw%
\ylSixSugarhposition{#4}%shift values
\begin{ShiftPicEnv}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(880,800)(-240,-400){SixSugarh}%2002/4/30 by S. Fujita
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%
% % outer skeleton %
% %%%%%%%%%%%%%%%%%%
{\resetbdsw%
\@bond@@omit{#5}%%%|\@aaa| etc. are empty if they are omitted. 
\molfronttrue
\set@skel@Sugarhbond{#1}{a}{a}%
  %bond between 1 and 2 \@aaa -> \Sugarhskbonda etc
\set@skel@Sugarhbond{#1}{b}{b}%
 %bond between 2 and 3 \@bbb -> \Sugarhskbondb etc
\set@skel@Sugarhbond{#1}{c}{c}%
 %bond between 3 and 4 \@ccc -> \Sugarhskbondc etc
\molfrontfalse
\set@skel@Sugarhbond{#1}{d}{d}%
 %bond between 4 and 5 \@ddd -> \Sugarhskbondd etc
\set@skel@Sugarhbond{#1}{e}{e}%
 %bond between 5 and 6 \@eee -> \Sugarhskbonde etc
\set@skel@Sugarhbond{#1}{f}{f}%
 %bond between 6 and 1 \@fff -> \Sugarhskbondf etc
}%
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%
% % inner double bond %
% %%%%%%%%%%%%%%%%%%%%%
\@tfor\member:=#2\do{%
\if\member r\relax \Sugarhbondd \Sugarhbondf \Sugarhbondb%
\else \if\member l\relax \Sugarhbonda \Sugarhbondc \Sugarhbonde%
\else \if\member a\relax \Sugarhbonda%
\else \if\member b\relax \Sugarhbondb%
\else \if\member c\relax \Sugarhbondc%
\else \if\member d\relax \Sugarhbondd%
\else \if\member e\relax \Sugarhbonde%
\else \if\member f\relax \Sugarhbondf%
\else \if\member A% no action: %%left aromatic circle 
%  \Put@oCircle(203,0){240}%               %circle
% %%%%%%%%%%%%%%%%%%%%%%%%%
% % inner bond attachment %
% %%%%%%%%%%%%%%%%%%%%%%%%%
\else
  \expandafter\twoCH@@R\member//%
  \set@fusionadd@sixhi
  \ifx\@@tmpa\empty%
   \XyMTeXWarning{Fused function is unavailable for SixSugarh.}\fi
\fi\fi\fi\fi\fi\fi\fi\fi\fi}%
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting hetero atoms %
% %%%%%%%%%%%%%%%%%%%%%%%%
\iniatom\iniflag%initialize
\set@hetatom@Sugarh{#3}{-3}{0}{5}{1}%               %subst 4--6
\set@hetatom@Sugarh{#3}{3}{3}{7}{1}%              %subst 1 -- 3
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting substituents %
% %%%%%%%%%%%%%%%%%%%%%%%%
\@forsemicol\member:=#4\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\ifx\@memberb\@yl\else
\ifcase\@tmpa%0 omit
 \or\setBScolor{\Put@Direct(668,0){%
  \if@clip \@clippingtrue \else \@clippingfalse\fi
  \@pyrana}}% subst. on 1
 \or\setBScolor{\Put@Direct(513,-255){%
  \if@eclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranb}}% subst. on 2
 \or\setBScolor{\Put@Direct(153,-255){%
  \if@fclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranbb}}% subst. on 3
 \or\setBScolor{\Put@Direct(0,0){%
  \if@aclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranc}}% subst. on 4
 \or\setBScolor{\Put@Direct(153,255){%
  \if@bclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranbB}}% subst. on 5
 \or\setBScolor{\Put@Direct(513,255){%
  \if@cclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranbC}}% subst. on 6
\fi %end of ifcase
\fi\fi}%
\end{ShiftPicEnv}%
\iniatom\iniflag}%     %end of \SixSugarh macro
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% The macro |\test@vrtx@SixSugarh| is used to test the presence of 
% a hetero atom or a spiro substituent on a vertex of the 
% sixheteroh nucleus. 
%
% \begin{macro}{\test@vrtx@SixSugarh}
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
\def\test@vrtx@SixSugarh#1{%
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\twoch@r\@membera{}%
\ifcase\@tmpa%
 \or \if\@tmpb s\relax\def\aaa{}\else\def\aaa{@}\fi
 \or \if\@tmpb s\relax\def\bbb{}\else\def\bbb{@}\fi
 \or \if\@tmpb s\relax\def\ccc{}\else\def\ccc{@}\fi
 \or \if\@tmpb s\relax\def\ddd{}\else\def\ddd{@}\fi
 \or \if\@tmpb s\relax\def\eee{}\else\def\eee{@}\fi
 \or \if\@tmpb s\relax\def\fff{}\else\def\fff{@}\fi
\fi\fi}%
}% end of \test@vrtx@SixSugarh
%    \end{macrocode}
% \end{macro}
%
% The command |\ylSixSugarhposition| is to obtain the shift values 
% |\@ylii| and |\@yli| which are used for shifting the standard 
% point of a substituent. 
% \changes{v1.02}{1998/10/25}{New commands for setting substituents}
%
% \begin{macro}{\ylSixSugarhposition}
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
\def\ylSixSugarhposition#1{%
\@@ylswfalse%%%\@reset@ylsw
\@forsemicol\member:=#1\do{%
\if@@ylsw\else
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax
\expandafter\threech@r\@membera{}{}\relax
\ifx\@memberb\@yl\relax\@@ylswtrue\else\@@ylswfalse\fi
\if@@ylsw
\ifcase\@tmpa%0 omit
 \or\gdef\@ylii{-668}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
 \or\gdef\@ylii{-513}\gdef\@yli{255}\global\@ylswtrue% subst. on 2
 \or\gdef\@ylii{-153}\gdef\@yli{255}\global\@ylswtrue% subst. on 3
 \or\gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 4
 \or\gdef\@ylii{-153}\gdef\@yli{-255}\global\@ylswtrue% subst. on 5
 \or\gdef\@ylii{-513}\gdef\@yli{-255}\global\@ylswtrue% subst. on 6
\fi%end of ifcase
\fi\fi\fi}}%
%    \end{macrocode}
% \end{macro}
%
% \subsection{Skeletal bonds of Sugarhs}
%
% The macro |\set@skel@Sugarhbond| is used in |\SixSugarh| etc. 
% for setting skeletal bonds (outer bonds), when |\@aaa| etc. 
% (produced by |\csname|...|\endcsname|) are equal to `a' 
% etc. (given as \#2).  Thinline, thickline and dotted-line 
% skeletal bonds are available. 
%
% \begin{macro}{\set@skel@Sugarhbond}
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
\newif\ifmolfront \molfrontfalse
\newif\if@fivemembered \@fivememberedfalse
\def\set@skel@Sugarhbond#1#2#3{%
 \expandafter\if\csname @#2#2#2\endcsname #2\relax%OK
                               % \if\@aaa #2\relax%OK
  \@skbondlistfalse
  \@tfor\member:=#1\do{%
   \expandafter\twoCH@@R\member//%
    \if\@@tmpa #2\relax%
      \if\@@tmpb A\relax%
        \if@fivemembered
         \expandafter\csname fdothskbond#3\endcsname% \dothskbonda etc.
        \else
         \expandafter\csname dothskbond#3\endcsname% \dothskbonda etc.
        \fi
        \@skbondlisttrue
      \else\if\@@tmpb B\relax%
        {\thicklines 
         \if@fivemembered
          \expandafter\csname fSugarhskbond#3\endcsname% \dothskbonda etc.
         \else
          \expandafter\csname Sugarhskbond#3\endcsname% \hskbonda etc.
         \fi
        }%
        \@skbondlisttrue
      \fi\fi
     \fi%
    }%
   \if@skbondlist\else
    \ifmolfront
     {\thicklines 
       \if@fivemembered
         \expandafter\csname fSugarhskbond#3\endcsname% \dothskbonda etc.
       \else
         \expandafter\csname Sugarhskbond#3\endcsname% \hskbonda etc.
       \fi
     }%
    \else
     {\thinlines 
       \if@fivemembered
         \expandafter\csname fSugarhskbond#3\endcsname% \dothskbonda etc.
       \else
        \expandafter\csname Sugarhskbond#3\endcsname% \hskbonda etc.
       \fi
     }%
    \fi
   \fi%
  \else
    \expandafter\ifx\csname @#2#2#2\endcsname \empty\relax%
                                %    \ifx\@aaa\empty\relax
    \@tfor\member:=#1\do{%
     \expandafter\twoCH@@R\member//%
      \if\@@tmpa #2\relax%
       \XyMTeXWarning{Unavailable bond `#2' in SKBONDLIST}\fi
    }%
  \fi\fi
}% end of \set@skel@Sugarhbond
%    \end{macrocode}
% \end{macro}
% 
% The macros |\SixSugarh| uses inner macros for setting 
% skeletal bonds in accordance with the presence or the absence of 
% hetero atoms.  During the processes of such setting,  
% the inner macros |\Sugarhskbonda| to |\Sugarhskbondf| are used to set a bond 
% on each edge of a six- or five-membered ring. 
%
% \begin{verbatim}
% ************************************
% * setting skeletal bonds of Sugarhs *
% ************************************
% The following numbering is adopted in this macro. 
%
%                                   e
%                          (eee) 5      6  (fff)
%                            d    -----    c
%                               *       *
%   the original point ===> 4 * (ddd)     * 1  (aaa)
%          (0,0)                *       *  a
%                            c    -----
%                          (ccc) 3      2  (bbb)
%                                   b
% \end{verbatim}
%
% \begin{macro}{\Sugarhskbonda}
% The macro |\Sugarhskbonda| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\aaa| and |\bbb|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 1 and 2
\def\Sugarhskbonda{%
  \ifx\aaa\empty%
    \ifx\bbb\empty%
     \Put@Line(668,0)(-3,-5){153}%           %bond 1-2
    \else%
     \Put@Line(668,0)(-3,-5){120}%            %bond 1-2
    \fi%
   \else%
    \ifx\bbb\empty%
     \Put@Line(635,-55)(-3,-5){120}%          %bond 1-2
    \else%
     \Put@Line(635,-55)(-3,-5){93}%          %bond 1-2
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\Sugarhskbondf}
% The macro |\Sugarhskbonda| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\aaa| and |\fff|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 1 and 6
\def\Sugarhskbondf{%
  \ifx\aaa\empty%
    \ifx\fff\empty%
     \Put@Line(668,0)(-3,5){153}%           %bond 1-6
    \else%
     \Put@Line(668,0)(-3,5){120}%            %bond 1-6
    \fi%
   \else%
    \ifx\fff\empty%
     \Put@Line(635,55)(-3,5){120}%          %bond 1-6
    \else%
     \Put@Line(635,55)(-3,5){93}%          %bond 1-6
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\Sugarhskbondc}
% The macro |\Sugarhskbondc| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\ccc| and |\ddd|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 4 and 3
\def\Sugarhskbondc{%
  \ifx\ddd\empty%
    \ifx\ccc\empty%
     \Put@Line(0,0)(3,-5){153}%           %bond 4-3
    \else%
     \Put@Line(0,0)(3,-5){120}%            %bond 4-3
    \fi%
   \else%
    \ifx\ccc\empty%
     \Put@Line(33,-55)(3,-5){120}%          %bond 4-3
    \else%
     \Put@Line(33,-55)(3,-5){93}%          %bond 4-3
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\Sugarhskbondd}
% The macro |\Sugarhskbondc| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\ddd| and |\eee|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 4 and 5
\def\Sugarhskbondd{%
  \ifx\ddd\empty%
    \ifx\eee\empty%
     \Put@Line(0,0)(3,5){153}%           %bond 4-5
    \else%
     \Put@Line(0,0)(3,5){120}%            %bond 4-5
    \fi%
   \else%
    \ifx\eee\empty%
     \Put@Line(33,55)(3,5){120}%          %bond 4-5
    \else%
     \Put@Line(33,55)(3,5){93}%          %bond 4-5
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\Sugarhskbondb}
% The macro |\Sugarhskbondb| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\bbb| and |\ccc|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 3 and 2
\def\Sugarhskbondb{%
  \ifx\ccc\empty%
    \ifx\bbb\empty%
     \Put@Line(153,-255)(1,0){360}%           %bond 3-2
    \else%
     \Put@Line(153,-255)(1,0){314}%            %bond 3-2
    \fi%
   \else%
    \ifx\bbb\empty%
     \Put@Line(199,-255)(1,0){314}%          %bond 3-2
    \else%
     \Put@Line(199,-255)(1,0){278}%          %bond 3-2
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\Sugarhskbonde}
% The macro |\Sugarhskbonde| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\eee| and |\fff|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 5 and 6
\def\Sugarhskbonde{%
  \ifx\eee\empty%
    \ifx\fff\empty%
     \Put@Line(153,255)(1,0){360}%           %bond 5-6
    \else%
     \Put@Line(153,255)(1,0){314}%            %bond 5-6
    \fi%
   \else%
    \ifx\fff\empty%
     \Put@Line(199,255)(1,0){314}%          %bond 5-6
    \else%
     \Put@Line(199,255)(1,0){278}%          %bond 5-6
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 

%
% \subsection{Inner Double Bonds of Sugarhs}
%
% The macros |\SixSugarh| uses inner macros for setting 
% skeletal bonds in accordance with the presence or the absence of 
% hetero atoms.  During the processes of such setting,  
% the inner macros |\Sugarhbonda| to |\Sugarhbondf| are used to set a bond 
% on each edge of a six- or five-membered ring. 
%
% \begin{verbatim}
% ********************************************
% * setting skeletal bonds (horizontal type) *
% ********************************************
% The following numbering is adopted in this macro. 
%
%                                   e
%                          (eee) 5      6  (fff)
%                            d    -----    c
%                               *       *
%   the original point ===> 4 * (ddd)     * 1  (aaa)
%          (0,0)                *       *  a
%                            c    -----
%                          (ccc) 3      2  (bbb)
%                                   b
% \end{verbatim}
%
% \begin{macro}{\Sugarhbonda}
% The macro |\Sugarhbonda| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\aaa| and |\bbb|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 1 and 2
\def\Sugarhbonda{%
  \ifx\aaa\empty%
    \ifx\bbb\empty%
     \Put@Line(605,-22)(-3,-5){100}%           %bond 1-2
    \else%
     \Put@Line(604,-15)(-3,-5){93}%            %bond 1-2
    \fi%
   \else%
    \ifx\bbb\empty%
     \Put@Line(587,-52)(-3,-5){93}%          %bond 1-2
    \else%
     \Put@Line(593,-42)(-3,-5){93}%          %bond 1-2
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\Sugarhbondf}
% The macro |\Sugarhbonda| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\aaa| and |\fff|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 1 and 6
\def\Sugarhbondf{%
  \ifx\aaa\empty%
    \ifx\fff\empty%
     \Put@Line(605,22)(-3,5){100}%           %bond 1-6
    \else%
     \Put@Line(604,15)(-3,5){97}%            %bond 1-6
    \fi%
   \else%
    \ifx\fff\empty%
     \Put@Line(587,52)(-3,5){93}%          %bond 1-6
    \else%
     \Put@Line(593,42)(-3,5){93}%          %bond 1-6
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\Sugarhbondc}
% The macro |\Sugarhbondc| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\ccc| and |\ddd|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 4 and 3
\def\Sugarhbondc{%
  \ifx\ddd\empty%
    \ifx\ccc\empty%
     \Put@Line(63,-22)(3,-5){100}%           %bond 4-3
    \else%
     \Put@Line(64,-15)(3,-5){97}%            %bond 4-3
    \fi%
   \else%
    \ifx\ccc\empty%
     \Put@Line(81,-52)(3,-5){93}%          %bond 4-3
    \else%
     \Put@Line(75,-42)(3,-5){93}%          %bond 4-3
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\Sugarhbondd}
% The macro |\Sugarhbondc| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\ddd| and |\eee|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 4 and 5
\def\Sugarhbondd{%
  \ifx\ddd\empty%
    \ifx\eee\empty%
     \Put@Line(63,22)(3,5){100}%           %bond 4-5
    \else%
     \Put@Line(64,15)(3,5){97}%            %bond 4-5
    \fi%
   \else%
    \ifx\eee\empty%
     \Put@Line(81,52)(3,5){93}%          %bond 4-5
    \else%
     \Put@Line(75,42)(3,5){93}%          %bond 4-5
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\Sugarhbondb}
% The macro |\Sugarhbondb| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\aaa| and |\bbb|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 3 and 2
\def\Sugarhbondb{%
  \ifx\ccc\empty%
    \ifx\bbb\empty%
     \Put@Line(183,-205)(1,0){300}%           %bond 3-2
    \else%
     \Put@Line(183,-205)(1,0){275}%            %bond 3-2
    \fi%
   \else%
    \ifx\bbb\empty%
     \Put@Line(203,-205)(1,0){275}%          %bond 3-2
    \else%
     \Put@Line(198,-205)(1,0){270}%          %bond 3-2
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\Sugarhbonde}
% The macro |\Sugarhbonde| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\eee| and |\fff|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 5 and 6
\def\Sugarhbonde{%
  \ifx\eee\empty%
    \ifx\fff\empty%
     \Put@Line(183,205)(1,0){300}%           %bond 5-6
    \else%
     \Put@Line(183,205)(1,0){275}%            %bond 5-6
    \fi%
   \else%
    \ifx\fff\empty%
     \Put@Line(203,205)(1,0){275}%          %bond 5-6
    \else%
     \Put@Line(198,205)(1,0){270}%          %bond 5-6
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \subsection{Hetero Atoms on Sugarh Skeletons}
%
% The command |\set@hetatom@Sugarh| is to set a spiro group 
% (stored as |\@memberb|) 
% at a vertix designated by |\@tmpaa| (or originally by |\@tmpa|). 
% The atom modifier `s' designates that the spiro group contains 
% a carbon atom (a vertix) at a spiro position, while `h' 
% represents the presence of a hetero atom at a spiro position. 
% The absence of such atom modifiers shows the substitution 
% of a usual hetero atom.  The command |\set@hetatom@Sugarh| is 
% used in such commands as |\SixSugarh| for treating thier ATOMLISTs, 
% e.g. |1==N;1s==\SixSugarh{}{1==(yl)}|.  
%
% \begin{macro}{\set@hetatom@Sugarh}
% \changes{v2.01}{2001/6/20}{New command: \cs{set@hetatom@Sugarh}}
%    \begin{macrocode}
\def\set@hetatom@Sugarh#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
  \if\@tmpb h\relax
     \@acliptrue%
     \putlatom{60}{0}{\@memberb}%  % left type
   \else\if\@tmpb s\relax
     \@aclipfalse%
     \putlatom{0}{0}{\@memberb}%              % left type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@acliptrue%
     \putlatom{60}{-36}{\@memberb}%              % left type
   \fi\fi\fi
\or%position 2
  \if\@tmpb h\relax
     \@bcliptrue%
     \putlatom{185}{225}{\@memberb}%   % left type
   \else\if\@tmpb s\relax
     \@bclipfalse%
     \putlatom{153}{255}{\@memberb}%   % left type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@bcliptrue%
     \putlatom{185}{225}{\@memberb}%   % left type
   \fi\fi\fi
\or%position 3
  \if\@tmpb h\relax
     \@ccliptrue%
     \putratom{483}{225}{\@memberb}%  % right type
   \else\if\@tmpb s\relax
     \@cclipfalse%
     \putratom{513}{255}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@ccliptrue%
     \putratom{483}{225}{\@memberb}%  % right type
   \fi\fi\fi
\or%position 4
  \if\@tmpb h\relax
     \@cliptrue%
   \putratom{608}{0}{\@memberb}%  % right type
   \else\if\@tmpb s\relax
     \@clipfalse%
   \putratom{668}{0}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@cliptrue%
   \putratom{608}{-36}{\@memberb}%  % right type
   \fi\fi\fi
\or%position 5
  \if\@tmpb h\relax
     \@ecliptrue%
     \putratom{493}{-225}{\@memberb}%  % right type
   \else\if\@tmpb s\relax
     \@eclipfalse%
     \putratom{513}{-255}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@ecliptrue%
     \putratom{483}{-295}{\@memberb}%  % right type
   \fi\fi\fi
\or%position 6
  \if\@tmpb h\relax
     \@fcliptrue%
     \putlatom{175}{-215}{\@memberb}%  % left type
   \else\if\@tmpb s\relax
     \@fclipfalse%
     \putlatom{153}{-255}{\@memberb}%  % left type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@fcliptrue%
     \putlatom{185}{-295}{\@memberb}%  % left type
   \fi\fi\fi
\fi% end of ifcase
\fi\fi\fi}}% end of the macro \set@hetatom@Sugarh
%    \end{macrocode}
% \end{macro}
%
% \section{Six-Membered Sugar Derivatives of Normal Dimension}
% \subsection{General Conventions}
%
% The standard skeleton of cyclitol is selected 
% to have the following locant numbers. 
%
% \begin{verbatim}
% *********************
% * sugarh derivative *
% *********************
%
% The following numbering is adopted in this macro. 
%
%                                5  e  6
%                                 ----
%                             d *       * f
%   the original point ===> 4 *           * 1
%          (0,0)                *       * a
%                             c   -----
%                                3  b   2
% \end{verbatim}
%
%
% The macro |\sixsugarh| has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
% Two optional arguments |SKBONDLIST| and |OMIT| are added to 
% treat stereochemical information or other bond situations. 
%
% \begin{verbatim}
%   \sixsugarh(SKBONDLIST)[BONDLIST]{ATOMLIST}{SUBSLIST}[OMIT]
% \end{verbatim}
%
% The |SKBONDLIST| argument contains pairs of two alphabets in 
% parentheses, e.g. (\{bA\}\{fB\}).  Each pair contains a lowercase 
% character selected from bond specifiers `a' to `f' and a uppercase
% character `A' or `B'. 
%
% The |BONDLIST| argument contains one 
% character selected from a to f, each of which indicates the presence of 
% an inner (endcyclic) double bond on the corresponding position. 
% The option  `$n+$' ($n=1$ to $6$) represents a plus charge on a hetero atom 
% at the $n$-position. 
%
% \begin{verbatim}
%  
%     BONDLIST = 
%
%           none or [] :  fully saturated form
%           a          :  1,2-double bond
%           b          :  2,3-double bond
%           c          :  4,3-double bond
%           d          :  4,5-double bond
%           e          :  5,6-double bond
%           f          :  6,1-double bond
%           {n+}       :  not supproted (+ at the n-hetro atom, n = 1 to 6)
% \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 (max 6 substitution positions)
%
%       for n = 1 to 6
%
%           nD         :  exocyclic double bond at n-atom
%           n or nS    :  exocyclic single bond at n-atom
%           nSA        :  single bond (down) at n-atom (for n=1)
%           nSB        :  single bond (up) at n-atom (for n=1)
%           nSa        :  alpha single bond at n-atom
%           nSb        :  beta single bond at n-atom
%
% \end{verbatim}
%
% The argument |OMIT| represents one or more bonds to be omitted. 
% The omitted edges may be regarded as both fused and non-fused 
% positions. 
%
% \begin{verbatim}
%     OMIT:  one or more bonds omitted (a, b, c, d, e, or f)
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g.
%        \sixsugarh{6==O}{1Sa==OH;2Sa==OH}
% \end{verbatim}
%
% The definition of |\sixsugarh| uses a picture environment and 
% consists of the same unit processes as shown in |\sixheteroh|: 
% \begin{enumerate}
% \item treatment of atom list, 
% \item placing outer skeletons, 
% \item placing inner double bonds, 
% \item setting hetero atoms, and 
% \item placing substituents dirctly 
%         (cf. |\setsixringh| for a |\sixheteroh|)
% \end{enumerate}
% \changes{v2.01}{2001/6/20}{Newly defined.}
% \changes{v5.00}{2010/10/01}{For bond coloring}
%
% \begin{macro}{\sixsugarh}
% \begin{macro}{\@six@sugarh}
% \begin{macro}{\@six@@sugarh}
% \begin{macro}{\@sixsugarh}
%    \begin{macrocode}
\def\sixsugarh{\@ifnextchar({\@six@sugarh(@}{\@six@sugarh(@)}}
\def\@six@sugarh(#1){\@ifnextchar[{\@six@@sugarh(#1)[@}%
{\@six@@sugarh(#1)[@]}}
\def\@six@@sugarh(#1)[#2]#3#4{\@ifnextchar[%
{\@sixsugarh(#1)[#2]{#3}{#4}[@}%
{\@sixsugarh(#1)[#2]{#3}{#4}[@]}}
\def\@sixsugarh(#1)[#2]#3#4[#5]{%
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%%%
% % treatment of atom list %
% %%%%%%%%%%%%%%%%%%%%%%%%%%
\iniatom\iniflag%initialize
\test@vrtx@SixSugarh{#3}%
%test for a hetero atom or a spiro substituent on a vertex
\@reset@ylsw%
\ylpyranoseposition{#4}%shift values
\begin{ShiftPicEnv}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(880,800)(-240,-400){sixsugarh}%2002/4/30 by S. Fujita
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%
% % outer skeleton %
% %%%%%%%%%%%%%%%%%%
{\resetbdsw%
\@bond@@omit{#5}%%%|\@aaa| etc. are empty if they are omitted. 
\@fivememberedfalse%not five-membered ring
\molfronttrue%boldfaced lines (thicklines)
\set@skel@sugarhbond{#1}{a}{a}%
  %bond between 1 and 2 \@aaa -> \sugarhskbonda etc
\set@skel@sugarhbond{#1}{b}{b}%
 %bond between 2 and 3 \@bbb -> \sugarhskbondb etc
\set@skel@sugarhbond{#1}{c}{c}%
 %bond between 3 and 4 \@ccc -> \sugarhskbondc etc
\molfrontfalse%normal lines (thinelines)
\set@skel@sugarhbond{#1}{d}{d}%
 %bond between 4 and 5 \@ddd -> \sugarhskbondd etc
\set@skel@sugarhbond{#1}{e}{e}%
 %bond between 5 and 6 \@eee -> \sugarhskbonde etc
\set@skel@sugarhbond{#1}{f}{f}%
 %bond between 6 and 1 \@fff -> \sugarhskbondf etc
}%
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%
% % inner double bond %
% %%%%%%%%%%%%%%%%%%%%%
\@tfor\member:=#2\do{%
\if\member r\relax \sugarhbondd \sugarhbondf \sugarhbondb%
\else \if\member l\relax \sugarhbonda \sugarhbondc \sugarhbonde%
\else \if\member a\relax \sugarhbonda%
\else \if\member b\relax \sugarhbondb%
\else \if\member c\relax \sugarhbondc%
\else \if\member d\relax \sugarhbondd%
\else \if\member e\relax \sugarhbonde%
\else \if\member f\relax \sugarhbondf%
\else \if\member A% no action: %%left aromatic circle 
%  \Put@oCircle(203,0){240}%               %circle
% %%%%%%%%%%%%%%%%%%%%%%%%%
% % inner bond attachment %
% %%%%%%%%%%%%%%%%%%%%%%%%%
\else
  \expandafter\twoCH@@R\member//%
  \set@fusionadd@sixhi
  \ifx\@@tmpa\empty%
   \XyMTeXWarning{Fused function is unavailable for sixsugarh.}\fi
\fi\fi\fi\fi\fi\fi\fi\fi\fi}%
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting hetero atoms %
% %%%%%%%%%%%%%%%%%%%%%%%%
\iniatom\iniflag%initialize
\set@hetatom@sugarh{#3}{-3}{0}{5}{1}%               %subst 4--6
\set@hetatom@sugarh{#3}{3}{3}{7}{1}%              %subst 1 -- 3
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting substituents %
% %%%%%%%%%%%%%%%%%%%%%%%%
\@forsemicol\member:=#4\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\ifx\@memberb\@yl\else
\ifcase\@tmpa%0 omit
 \or\setBScolor{\Put@Direct(532,0){%
  \if@clip \@clippingtrue \else \@clippingfalse\fi
  \@pyrana}}% subst. on 1
 \or\setBScolor{\Put@Direct(412,-200){%
  \if@eclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranb}}% subst. on 2
 \or\setBScolor{\Put@Direct(120,-200){%
  \if@fclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranbb}}% subst. on 3
 \or\setBScolor{\Put@Direct(0,0){%
  \if@aclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranc}}% subst. on 4
 \or\setBScolor{\Put@Direct(120,200){%
  \if@bclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranbB}}% subst. on 5
 \or\setBScolor{\Put@Direct(412,200){%
  \if@cclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranbC}}% subst. on 6
\fi %end of ifcase
\fi\fi}%
\end{ShiftPicEnv}%
\iniatom\iniflag}%     %end of \sixsugarh macro
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% The command |\ylpyranoseposition| is to obtain the shift values 
% |\@ylii| and |\@yli| which are used for shifting the standard 
% point of a substituent. 
% \changes{v1.02}{1998/10/25}{New commands for setting substituents}
% \changes{v2.01}{2001/6/20}{Added for position 6}
%
% \begin{macro}{\ylpyranoseposition}
%    \begin{macrocode}
\def\ylpyranoseposition#1{%
\@@ylswfalse%%%\@reset@ylsw
\@forsemicol\member:=#1\do{%
\if@@ylsw\else
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax
\expandafter\threech@r\@membera{}{}\relax
\ifx\@memberb\@yl\relax\@@ylswtrue\else\@@ylswfalse\fi
\if@@ylsw
\ifcase\@tmpa%0 omit
 \or\gdef\@ylii{-532}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
 \or\gdef\@ylii{-412}\gdef\@yli{200}\global\@ylswtrue% subst. on 2
 \or\gdef\@ylii{-120}\gdef\@yli{200}\global\@ylswtrue% subst. on 3
 \or\gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 4
 \or\gdef\@ylii{-120}\gdef\@yli{-200}\global\@ylswtrue% subst. on 5
 \or\gdef\@ylii{-412}\gdef\@yli{-200}\global\@ylswtrue% subst. on 6
\fi%end of ifcase
\fi\fi\fi}}%
%    \end{macrocode}
% \end{macro}
%
% The front skeletal bonds of a pyranose ring are typeset with a bold line and wedged lines. 
% \changes{v5.01}{2013/06/25}{added the definition for \cs{sixsugarhw}}
%
% \begin{macro}{\sixsugarhw}
% \begin{macro}{\@sixsugarhw}
%    \begin{macrocode}
\def\sixsugarhw{\@ifnextchar[{\@sixsugarhw}{\@sixsugarhw[]}}
\def\@sixsugarhw[#1]#2#3{%
\sixsugarh[#1]{6==O;1s==\WedgeAsSubst(0,0)(-3,-5){120};%
4s==\WedgeAsSubst(0,0)(3,-5){120};%
3s==\PutBondLine(-17,0)(307,0){2.8pt};#2}{#3}[abc]}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Skeletal bonds of sugarhs}
%
% The macro |\set@skel@sugarhbond| is used in |\sixsugarh| etc. 
% for setting skeletal bonds (outer bonds), when |\@aaa| etc. 
% (produced by |\csname|...|\endcsname|) are equal to `a' 
% etc. (given as \#2).  Thinline, thickline and dotted-line 
% skeletal bonds are available. 
%
% \begin{macro}{\set@skel@sugarhbond}
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
\def\set@skel@sugarhbond#1#2#3{%
 \expandafter\if\csname @#2#2#2\endcsname #2\relax%OK
                               % \if\@aaa #2\relax%OK
  \@skbondlistfalse
  \@tfor\member:=#1\do{%
   \expandafter\twoCH@@R\member//%
    \if\@@tmpa #2\relax%
      \if\@@tmpb A\relax%
       \if@fivemembered
        \expandafter\csname fdothskbond#3\endcsname% \dothskbonda etc.
       \else
        \expandafter\csname dothskbond#3\endcsname% \dothskbonda etc.
       \fi
        \@skbondlisttrue
      \else\if\@@tmpb B\relax%
        {\thicklines 
        \if@fivemembered
         \expandafter\csname fsugarhskbond#3\endcsname% \hskbonda etc.
        \else
         \expandafter\csname sugarhskbond#3\endcsname% \hskbonda etc.
        \fi
        }%
        \@skbondlisttrue
      \fi\fi
     \fi%
    }%
   \if@skbondlist\else
    \ifmolfront
     {\thicklines 
      \if@fivemembered
        \expandafter\csname fsugarhskbond#3\endcsname% \hskbonda etc.
      \else
        \expandafter\csname sugarhskbond#3\endcsname% \hskbonda etc.
      \fi
     }%
    \else
     {\thinlines 
      \if@fivemembered
        \expandafter\csname fsugarhskbond#3\endcsname% \hskbonda etc
      \else
        \expandafter\csname sugarhskbond#3\endcsname% \hskbonda etc.
      \fi
     }%
    \fi
   \fi%
  \else
    \expandafter\ifx\csname @#2#2#2\endcsname \empty\relax%
                                %    \ifx\@aaa\empty\relax
    \@tfor\member:=#1\do{%
     \expandafter\twoCH@@R\member//%
      \if\@@tmpa #2\relax%
       \XyMTeXWarning{Unavailable bond `#2' in SKBONDLIST}\fi
    }%
  \fi\fi
}% end of \set@skel@sugarhbond
%    \end{macrocode}
% \end{macro}
% 
% The macros |\sixsugarh| uses inner macros for setting 
% skeletal bonds in accordance with the presence or the absence of 
% hetero atoms.  During the processes of such setting,  
% the inner macros |\sugarhskbonda| to |\sugarhskbondf| are used to set a bond 
% on each edge of a six- or five-membered ring. 
%
% \begin{verbatim}
% ************************************
% * setting skeletal bonds of sugarhs *
% ************************************
% The following numbering is adopted in this macro. 
%
%                                   e
%                          (eee) 5      6  (fff)
%                            d    -----    c
%                               *       *
%   the original point ===> 4 * (ddd)     * 1  (aaa)
%          (0,0)                *       *  a
%                            c    -----
%                          (ccc) 3      2  (bbb)
%                                   b
% \end{verbatim}
%
% \begin{macro}{\sugarhskbonda}
% The macro |\sugarhskbonda| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\aaa| and |\bbb|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 1 and 2
\def\sugarhskbonda{%
  \ifx\aaa\empty%
    \ifx\bbb\empty%
     \Put@Line(532,0)(-3,-5){120}%           %bond 1-2
    \else%
     \Put@Line(532,0)(-3,-5){96}%            %bond 1-2
    \fi%
   \else%
    \ifx\bbb\empty%
%     \Put@Line(635,-55)(-3,-5){120}%          %bond 1-2
     \Put@Line(511,-35)(-3,-5){96}%          %bond 1-2
    \else%
     \Put@Line(511,-35)(-3,-5){80}%          %bond 1-2
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\sugarhskbondf}
% The macro |\sugarhskbonda| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\aaa| and |\fff|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 1 and 6
\def\sugarhskbondf{%
  \ifx\aaa\empty%
    \ifx\fff\empty%
     \Put@Line(532,0)(-3,5){120}%           %bond 1-6
    \else%
     \Put@Line(532,0)(-3,5){96}%            %bond 1-6
    \fi%
   \else%
    \ifx\fff\empty%
     \Put@Line(511,35)(-3,5){96}%          %bond 1-6
    \else%
     \Put@Line(511,35)(-3,5){80}%          %bond 1-6
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\sugarhskbondc}
% The macro |\sugarhskbondc| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\ccc| and |\ddd|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 4 and 3
\def\sugarhskbondc{%
  \ifx\ddd\empty%
    \ifx\ccc\empty%
     \Put@Line(0,0)(3,-5){120}%           %bond 4-3
    \else%
     \Put@Line(0,0)(3,-5){96}%            %bond 4-3
    \fi%
   \else%
    \ifx\ccc\empty%
     \Put@Line(21,-35)(3,-5){96}%          %bond 4-3
    \else%
     \Put@Line(21,-35)(3,-5){80}%          %bond 4-3
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\sugarhskbondd}
% The macro |\sugarhskbondd| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\ddd| and |\eee|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 4 and 5
\def\sugarhskbondd{%
  \ifx\ddd\empty%
    \ifx\eee\empty%
     \Put@Line(0,0)(3,5){120}%           %bond 4-5
    \else%
     \Put@Line(0,0)(3,5){97}%            %bond 4-5
    \fi%
   \else%
    \ifx\eee\empty%
     \Put@Line(21,35)(3,5){97}%          %bond 4-5
    \else%
     \Put@Line(21,35)(3,5){80}%          %bond 4-5
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\sugarhskbondb}
% The macro |\sugarhskbondb| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\bbb| and |\ccc|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 3 and 2
\def\sugarhskbondb{%
  \ifx\ccc\empty%
    \ifx\bbb\empty%
     \Put@Line(120,-200)(1,0){292}%           %bond 3-2
    \else%
     \Put@Line(120,-200)(1,0){252}%            %bond 3-2
    \fi%
   \else%
    \ifx\bbb\empty%
     \Put@Line(160,-200)(1,0){252}%          %bond 3-2
    \else%
     \Put@Line(160,-200)(1,0){212}%          %bond 3-2
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\sugarhskbonde}
% The macro |\sugarhskbonde| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\eee| and |\fff|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 5 and 6
\def\sugarhskbonde{%
  \ifx\eee\empty%
    \ifx\fff\empty%
     \Put@Line(120,200)(1,0){292}%           %bond 5-6
    \else%
     \Put@Line(120,200)(1,0){252}%            %bond 5-6
    \fi%
   \else%
    \ifx\fff\empty%
     \Put@Line(160,200)(1,0){252}%          %bond 5-6
    \else%
     \Put@Line(160,200)(1,0){212}%          %bond 5-6
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \subsection{Hetero Atoms on sugarh Skeletons}
%
% The command |\set@hetatom@sugarh| is to set a spiro group 
% (stored as |\@memberb|) 
% at a vertix designated by |\@tmpaa| (or originally by |\@tmpa|). 
% The atom modifier `s' designates that the spiro group contains 
% a carbon atom (a vertix) at a spiro position, while `h' 
% represents the presence of a hetero atom at a spiro position. 
% The absence of such atom modifiers shows the substitution 
% of a usual hetero atom.  The command |\set@hetatom@sugarh| is 
% used in such commands as |\sixsugarh| for treating thier ATOMLISTs, 
% e.g. |1==N;1s==\sixsugarh{}{1==(yl)}|.  
%
% \begin{macro}{\set@hetatom@sugarh}
% \changes{v2.01}{2001/6/20}{New command: \cs{set@hetatom@sugarh}}
%    \begin{macrocode}
\def\set@hetatom@sugarh#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
  \if\@tmpb h\relax
     \@acliptrue%
     \putlatom{60}{0}{\@memberb}%  % left type
   \else\if\@tmpb s\relax
     \@aclipfalse%
     \putlatom{0}{0}{\@memberb}%              % left type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@acliptrue%
     \putlatom{60}{-36}{\@memberb}%              % left type
   \fi\fi\fi
\or%position 2
  \if\@tmpb h\relax
     \@bcliptrue%
     \putlatom{155}{180}{\@memberb}%   % left type
   \else\if\@tmpb s\relax
     \@bclipfalse%
     \putlatom{120}{200}{\@memberb}%   % left type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@bcliptrue%
     \putlatom{155}{180}{\@memberb}%   % left type
   \fi\fi\fi
\or%position 3
  \if\@tmpb h\relax
     \@ccliptrue%
     \putratom{382}{180}{\@memberb}%  % right type
   \else\if\@tmpb s\relax
     \@cclipfalse%
     \putratom{412}{200}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@ccliptrue%
     \putratom{382}{180}{\@memberb}%  % right type
   \fi\fi\fi
\or%position 4
  \if\@tmpb h\relax
     \@cliptrue%
   \putratom{472}{0}{\@memberb}%  % right type
   \else\if\@tmpb s\relax
     \@clipfalse%
   \putratom{532}{0}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@cliptrue%
   \putratom{472}{-36}{\@memberb}%  % right type
   \fi\fi\fi
\or%position 5
  \if\@tmpb h\relax
     \@ecliptrue%
     \putratom{382}{-240}{\@memberb}%  % right type
   \else\if\@tmpb s\relax
     \@eclipfalse%
     \putratom{412}{-200}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@ecliptrue%
     \putratom{382}{-240}{\@memberb}%  % right type
   \fi\fi\fi
\or%position 6
  \if\@tmpb h\relax
     \@fcliptrue%
     \putlatom{155}{-240}{\@memberb}%  % left type
   \else\if\@tmpb s\relax
     \@fclipfalse%
     \putlatom{120}{-200}{\@memberb}%  % left type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@fcliptrue%
     \putlatom{155}{-240}{\@memberb}%  % left type
   \fi\fi\fi
\fi% end of ifcase
\fi\fi\fi}}% end of the macro \set@hetatom@sugarh
%    \end{macrocode}
% \end{macro}
%
% \subsection{Inner Double Bonds of sugarhs}
%
% The macros |\sixsugarh| uses inner macros for setting 
% skeletal bonds in accordance with the presence or the absence of 
% hetero atoms.  During the processes of such setting,  
% the inner macros |\sugarhbonda| to |\sugarhbondf| are used to set a bond 
% on each edge of a six- or five-membered ring. 
%
% \begin{verbatim}
% ********************************************
% * setting skeletal bonds (horizontal type) *
% ********************************************
% The following numbering is adopted in this macro. 
%                                   e
%                          (eee) 5      6  (fff)
%                            d    -----    c
%                               *       *
%   the original point ===> 4 * (ddd)     * 1  (aaa)
%          (0,0)                *       *  a
%                            c    -----
%                          (ccc) 3      2  (bbb)
%                                   b
% \end{verbatim}
%
% \begin{macro}{\sugarhbonda}
% The macro |\sugarhbonda| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\aaa| and |\bbb|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 1 and 2
%\else \if\member a%
\def\sugarhbonda{%
  \ifx\aaa\empty%
    \ifx\bbb\empty%
     \Put@Line(482,-12)(-3,-5){90}%        %double bond 1-2
    \else%
     \Put@Line(482,-12)(-3,-5){80}%        %double bond 1-2
    \fi%
   \else%
    \ifx\bbb\empty%
     \Put@Line(394,-160)(3,5){70}%       %double bond 2-1
    \else%
     \Put@Line(394,-160)(3,5){70}%       %double bond 2-1
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\sugarhbondf}
% The macro |\sugarhbonda| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\aaa| and |\fff|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 1 and 6
\def\sugarhbondf{%
  \ifx\aaa\empty%
    \ifx\fff\empty%
     \Put@Line(482,12)(-3,5){90}%        %double bond 1-6
    \else%
     \Put@Line(482,12)(-3,5){80}%        %double bond 1-6
    \fi%
   \else%
    \ifx\fff\empty%
     \Put@Line(394,160)(3,-5){70}%       %double bond 6-1
    \else%
     \Put@Line(394,160)(3,-5){70}%       %double bond 6-1
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\sugarhbondc}
% The macro |\sugarhbondc| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\ccc| and |\ddd|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 4 and 3
\def\sugarhbondc{%
  \ifx\ddd\empty%
    \ifx\ccc\empty%
     \Put@Line(50,-12)(3,-5){90}%        %double bond 4-3
    \else%
     \Put@Line(50,-12)(3,-5){80}%        %double bond 4-3
    \fi%
   \else%
    \ifx\ccc\empty%
     \Put@Line(138,-160)(-3,5){70}%       %double bond 3-4
    \else%
     \Put@Line(138,-160)(-3,5){70}%       %double bond 3-4
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\sugarhbondd}
% The macro |\sugarhbondd| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\ddd| and |\eee|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 4 and 5
\def\sugarhbondd{%
  \ifx\ddd\empty%
    \ifx\eee\empty%
     \Put@Line(50,12)(3,5){90}%        %double bond 4-5
    \else%
     \Put@Line(50,12)(3,5){80}%        %double bond 4-5
    \fi%
   \else%
    \ifx\eee\empty%
     \Put@Line(138,160)(-3,-5){70}%       %double bond 5-4
    \else%
     \Put@Line(138,160)(-3,-5){70}%       %double bond 5-4
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\sugarhbondb}
% The macro |\sugarhbondb| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\aaa| and |\bbb|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 3 and 2
\def\sugarhbondb{%
  \ifx\ccc\empty%
    \ifx\bbb\empty%
     \Put@Line(150,-160)(1,0){232}%      %double bond 3-2
    \else%
     \Put@Line(160,-160)(1,0){217}%      %double bond 3-2
    \fi%
   \else%
    \ifx\bbb\empty%
     \Put@Line(170,-160)(1,0){217}%      %double bond 3-2
    \else%
     \Put@Line(170,-160)(1,0){197}%      %double bond 3-2
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 

% \begin{macro}{\sugarhbonde}
% The macro |\sugarhbonde| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\eee| and |\fff|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 5 and 6
\def\sugarhbonde{%
  \ifx\eee\empty%
    \ifx\fff\empty%
     \Put@Line(150,160)(1,0){232}%      %double bond 5-6
    \else%
     \Put@Line(160,160)(1,0){217}%      %double bond 5-6
    \fi%
   \else%
    \ifx\fff\empty%
     \Put@Line(170,160)(1,0){217}%      %double bond 5-6
    \else%
     \Put@Line(170,160)(1,0){197}%      %double bond 5-6
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \section{Cyclitol Derivaives}
%
% Cyclitol derivatives can be drawn by the |\cyclitol| macro. 
%
% \changes{v2.01}{2001/06/20}{New command: \cs{cyclitol}}
%
% \begin{macro}{\cyclitol}
% \begin{macro}{\@cyclitol}
%    \begin{macrocode}
\def\cyclitol{\@ifnextchar[{\@cyclitol}{\@cyclitol[]}}
\def\@cyclitol[#1]#2{\sixsugarh[#1]{}{#2}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% Cyclitol derivatives of slightly large dimension can be 
% drawn by the |\Cyclitol| macro. 
%
% \changes{v2.01}{2001/06/20}{New command: \cs{Cyclitol}}
%
% \begin{macro}{\Cyclitol}
% \begin{macro}{\@Cyclitol}
%    \begin{macrocode}
\def\Cyclitol{\@ifnextchar[{\@Cyclitol}{\@Cyclitol[]}}
\def\@Cyclitol[#1]#2{\SixSugarh[#1]{}{#2}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \section{Five-Membered Sugar Derivatives of Normal Dimension}
% \subsection{General Conventions}
%
% The standard skeleton of cyclitol is selected 
% to have the following locant numbers. 
%
% \begin{verbatim}
% **************************
% * five-sugarh derivative *
% **************************
%
% The following numbering is adopted in this macro. 
%
%                                   5
%                                   *
%                             d  *     * e
%   the original point ===> 4 *           * 1
%          (0,0)                *       * a
%                             c   -----
%                                3  b   2
%
% \end{verbatim}
%
% The macro |\fivesugarh| has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
% Two optional arguments |SKBONDLIST| and |OMIT| are added to 
% treat stereochemical information or other bond situations. 
%
% \begin{verbatim}
%   \fivesugarh(SKBONDLIST)[BONDLIST]{ATOMLIST}{SUBSLIST}[OMIT]
% \end{verbatim}
%
% The |SKBONDLIST| argument contains pairs of two alphabets in 
% parentheses, e.g. (\{bA\}\{fB\}).  Each pair contains a lowercase 
% character selected from bond specifiers `a' to `e' and a uppercase
% character `A' or `B'. 
%
% The |BONDLIST| argument contains one 
% character selected from a to f, each of which indicates the presence of 
% an inner (endcyclic) double bond on the corresponding position. 
% The option `$n+$' ($n=1$ to $5$) represents a plus charge on a hetero atom 
% at the $n$-position. 
%
% \begin{verbatim}
%  
%     BONDLIST = 
%
%           none or [] :  fully saturated form
%           a          :  1,2-double bond
%           b          :  2,3-double bond
%           c          :  4,3-double bond
%           d          :  4,5-double bond
%           e          :  5,1-double bond
%           {n+}       :  not supported (+ at the n-nitrogen atom, n = 1 to 4)
% \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 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 (max 5 substitution positions)
%
%       for n = 1 to 5 
%
%           nD         :  exocyclic double bond at n-atom
%           n or nS    :  exocyclic single bond at n-atom
%           nSA        :  single bond (down) at n-atom (for n=1)
%           nSB        :  single bond (up) at n-atom (for n=1)
%           nSa        :  alpha single bond at n-atom
%           nSb        :  beta single bond at n-atom
%
% \end{verbatim}
%
% The argument |OMIT| represents one or more bonds to be omitted. 
% The omitted edges may be regarded as both fused and non-fused 
% positions. 
%
% \begin{verbatim}
%     OMIT:  one or more bonds omitted (a, b, c, d, or e)
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g.
%        \fivesugarh{5==O}{1Sa==OH;2Sa==OH}
% \end{verbatim}
%
% The definition of |\fivesugarh| uses a picture environment and 
% consists of the same unit processes as shown in |\fiveheteroh|: 
% \begin{enumerate}
% \item treatment of atom list, 
% \item placing outer skeletons, 
% \item placing inner double bonds, 
% \item setting hetero atoms, and 
% \item placing substituents dirctly 
%         (cf. |\setsixringh| for a |\fiveheteroh|)
% \end{enumerate}
% \changes{v2.01}{2001/6/20}{Newly defined.}
% \changes{v5.01}{2001/6/25}{bug fix for position 5}
%
% \begin{macro}{\fivesugarh}
% \begin{macro}{\@five@sugarh}
% \begin{macro}{\@five@@sugarh}
% \begin{macro}{\@fivesugarh}
%    \begin{macrocode}
\def\fivesugarh{\@ifnextchar({\@five@sugarh(@}{\@five@sugarh(@)}}
\def\@five@sugarh(#1){\@ifnextchar[{\@five@@sugarh(#1)[@}%
{\@five@@sugarh(#1)[@]}}
\def\@five@@sugarh(#1)[#2]#3#4{\@ifnextchar[%
{\@fivesugarh(#1)[#2]{#3}{#4}[@}%
{\@fivesugarh(#1)[#2]{#3}{#4}[@]}}
\def\@fivesugarh(#1)[#2]#3#4[#5]{%
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%%%
% % treatment of atom list %
% %%%%%%%%%%%%%%%%%%%%%%%%%%
\iniatom\iniflag%initialize
\test@vrtx@SixSugarh{#3}%
%test for a hetero atom or a spiro substituent on a vertex
\@reset@ylsw%
\ylfuranoseposition{#4}%shift values
\begin{ShiftPicEnv}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(880,800)(-240,-400){fivesugarh}%2002/4/30 by S. Fujita
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%
% % outer skeleton %
% %%%%%%%%%%%%%%%%%%
{\resetbdsw%
\@bond@@omit{#5}%%%|\@aaa| etc. are empty if they are omitted. 
\@fivememberedfalse%common bonds to a six-membered ring
\molfronttrue%boldfaced lines (thicklines)
\set@skel@sugarhbond{#1}{a}{a}%
  %bond between 1 and 2 \@aaa -> \sugarhskbonda etc
\set@skel@sugarhbond{#1}{b}{b}%
 %bond between 2 and 3 \@bbb -> \sugarhskbondb etc
\set@skel@sugarhbond{#1}{c}{c}%
 %bond between 3 and 4 \@ccc -> \sugarhskbondc etc
\@fivememberedtrue%bonds for a five-membered ring
\molfrontfalse%normal lines (thinelines)
\set@skel@sugarhbond{#1}{d}{d}%
 %bond between 4 and 5 \@ddd -> \fsugarhskbondd etc
\set@skel@sugarhbond{#1}{e}{e}%
 %bond between 5 and 1 \@eee -> \fsugarhskbonde etc
}%
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%
% % inner double bond %
% %%%%%%%%%%%%%%%%%%%%%
\@tfor\member:=#2\do{%
\if\member r\relax %no action \sugarhbondd \sugarhbondf \sugarhbondb%
\else \if\member l\relax %no action \sugarhbonda \sugarhbondc \sugarhbonde%
\else \if\member a\relax \sugarhbonda%
\else \if\member b\relax \sugarhbondb%
\else \if\member c\relax \sugarhbondc%
\else \if\member d\relax \fsugarhbondd%
\else \if\member e\relax \fsugarhbonde%
\else \if\member A% no action: %%left aromatic circle 
%  \Put@oCircle(203,0){240}%               %circle
% %%%%%%%%%%%%%%%%%%%%%%%%%
% % inner bond attachment %
% %%%%%%%%%%%%%%%%%%%%%%%%%
\else%no action
%  \expandafter\twoCH@@R\member//%
%  \set@fusionadd@sixhi
%  \ifx\@@tmpa\empty%
%   \XyMTeXWarning{Fused function is unavailable for fivesugarh.}\fi
\fi\fi\fi\fi\fi\fi\fi\fi}%
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting hetero atoms %
% %%%%%%%%%%%%%%%%%%%%%%%%
\iniflag%initialize
\set@hetatom@sugarh{#3}{-3}{0}{2}{1}%       %subst 4
\set@hetatom@sugarh{#3}{3}{3}{7}{1}%        %subst 1 -- 3
\set@hteatom@fivesugarh{#3}%                %subsituent 5
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting substituents %
% %%%%%%%%%%%%%%%%%%%%%%%%
\@forsemicol\member:=#4\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\ifx\@memberb\@yl\else
\ifcase\@tmpa%0 omit
\or\setBScolor{\Put@Direct(532,0){%
  \if@clip \@clippingtrue \else \@clippingfalse\fi
  \@pyrana}}% subst. on 1
 \or\setBScolor{\Put@Direct(412,-200){%
  \if@eclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranb}}% subst. on 2
 \or\setBScolor{\Put@Direct(120,-200){%
  \if@fclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranbb}}% subst. on 3
 \or\setBScolor{\Put@Direct(0,0){%
  \if@aclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranc}}% subst. on 4
 \or\setBScolor{\Put@Direct(266,160){%
  %\if@bclip \@clippingtrue \else \@clippingfalse\fi
  %\@pyranbB}}% subst. on 5
  {\if@bclip \@acliptrue \put(0,-386){\@substa}%subst. on 5 bug fix 2013/06/25
    \else \@aclipfalse% subst. on 5 bug fix 2013/06/25
    \put(0,-406){\@substa}\fi}\@aclipfalse}}%%%\@pyranbB}}% subst. on 5 bug fix 2013/06/25
\fi %end of ifcase
\fi\fi}%
\end{ShiftPicEnv}%
\iniatom\iniflag}%     %end of \fivesugarh macro
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\resetflags}
%    \begin{macrocode}
% (undefined)
%    \end{macrocode}
% \end{macro}
%
% The front skeletal bonds of a furanose ring are typeset with a bold line and wedged lines. 
% \changes{v5.01}{2013/06/25}{added the definition for \cs{fivesugarhw}}
%
% \begin{macro}{\fivesugarhw}
% \begin{macro}{\@fivesugarhw}
%    \begin{macrocode}
\def\fivesugarhw{\@ifnextchar[{\@fivesugarhw}{\@fivesugarhw[]}}
\def\@fivesugarhw[#1]#2#3{%
\fivesugarh[#1]{5==O;1s==\WedgeAsSubst(0,0)(-3,-5){120};%
4s==\WedgeAsSubst(0,0)(3,-5){120};%
3s==\PutBondLine(-17,0)(307,0){2.8pt};#2}{#3}[abc]}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The command |\ylfuranoseposition| is to obtain the shift values 
% |\@ylii| and |\@yli| which are used for shifting the standard 
% point of a substituent. 
% \changes{v1.02}{1998/10/23}{New commands for setting substituents}
% \changes{v2.01}{2001/6/20}{Added for position 5}
%
% \begin{macro}{\ylfuranoseposition}
%    \begin{macrocode}
\def\ylfuranoseposition#1{%
\@@ylswfalse%%%\@reset@ylsw
\@forsemicol\member:=#1\do{%
\if@@ylsw\else
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax
\expandafter\threech@r\@membera{}{}\relax
\ifx\@memberb\@yl\relax\@@ylswtrue\else\@@ylswfalse\fi
\if@@ylsw
\ifcase\@tmpa%0 omit
 \or\gdef\@ylii{-532}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
 \or\gdef\@ylii{-412}\gdef\@yli{200}\global\@ylswtrue% subst. on 2
 \or\gdef\@ylii{-120}\gdef\@yli{200}\global\@ylswtrue% subst. on 3
 \or\gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 4
 \or\gdef\@ylii{-266}\gdef\@yli{-160}\global\@ylswtrue% subst. on 5
\fi%end of ifcase
\fi\fi\fi}}%
%    \end{macrocode}
% \end{macro}
%
% \subsection{Skeletal Bonds of fivesugarh}
%
% The macros |\fivesugarh| uses inner macros for setting 
% skeletal bonds in accordance with the presence or the absence of 
% hetero atoms.  During the processes of such setting,  
% the inner macros |\sugarhskbonda| to |\sugarhskbondc| 
% (common to |\sixsugarh|) as well as 
% |\fsugarhskbondd| to |\fsugarhskbonde| 
% to set a bond on each edge of a five-membered ring. 
%
% \begin{macro}{\fsugarhskbondd}
% The macro |\fsugarhskbondd| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\ddd| and |\eee|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
\def\fsugarhskbondd{%
  \ifx\ddd\empty%
    \ifx\eee\empty%
     \Put@Line(0,0)(5,3){266}%           %bond 4-5
    \else%
     \Put@Line(0,0)(5,3){231}%            %bond 4-5
    \fi%
   \else%
    \ifx\eee\empty%
     \Put@Line(35,21)(5,3){231}%          %bond 4-5
    \else%
     \Put@Line(35,21)(5,3){200}%          %bond 4-5
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\fsugarhskbonde}
% The macro |\fsugarhskbonde| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\eee| and |\aaa|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 5 and 1
\def\fsugarhskbonde{%
  \ifx\aaa\empty%
    \ifx\eee\empty%
     \Put@Line(532,0)(-5,3){266}%           %bond 5-1
    \else%
     \Put@Line(532,0)(-5,3){231}%            %bond 5-1
    \fi%
   \else%
    \ifx\eee\empty%
     \Put@Line(497,21)(-5,3){231}%          %bond 5-1
    \else%
     \Put@Line(497,21)(-5,3){200}%          %bond 5-1
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 

% \begin{macro}{\set@hteatom@fivesugarh}
% The macro |\set@hteatom@fivesugarh| put a hetero atom 
% on vertex no. 5 of |\fivesugarh|. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
\def\set@hteatom@fivesugarh#1{%
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else%
\expandafter\@m@mb@r\member;\relax%
\expandafter\twoCH@R\@membera//%
\@tmpaa=\@tmpa\relax
\ifnum\@tmpaa=5\relax
  \if\@tmpb h\relax
     \@bcliptrue%
     \putratom{236}{130}{\@memberb}%  % right type
   \else\if\@tmpb s\relax
     \@bclipfalse%
     \putratom{266}{160}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@bcliptrue%
     \putratom{236}{130}{\@memberb}% left type
   \fi\fi\fi
\fi% end of ifnum
\fi
}}% end of the macro \set@hetatom@fivesugarh
%    \end{macrocode}
% \end{macro} 
%
% \subsection{Inner Double Bonds of fivesugarh}
%
% The macros |\fivesugarh| uses inner macros for setting 
% skeletal bonds in accordance with the presence or the absence of 
% hetero atoms.  During the processes of such setting,  
% the inner macros |\fsugarhbonda| to |\sugarhbondc| 
% (common to |\sixsugarh|) as well as 
% |\fsugarhbondd| and |\sugarhbonde| are used to set a bond 
% on each edge of a five-membered ring. 
%
% \begin{macro}{\fsugarhbondd}
% The macro |\fsugarhbondd| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\ddd| and |\eee|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 4 and 5
\def\fsugarhbondd{%
  \ifx\ddd\empty%
    \ifx\eee\empty%
     \Put@Line(60,-10)(5,3){190}%        %double bond 4-5
    \else%
     \Put@Line(60,-10)(5,3){170}%        %double bond 4-5
    \fi%
   \else%
    \ifx\eee\empty%
     \Put@Line(80,6)(5,3){170}%       %double bond 5-4
    \else%
     \Put@Line(80,6)(5,3){160}%       %double bond 5-4
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\fsugarhbonde}
% The macro |\fsugarhbonde| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\aaa| and |\eee|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 5 and 1
\def\fsugarhbonde{%
  \ifx\aaa\empty%
    \ifx\eee\empty%
     \Put@Line(472,-10)(-5,3){190}%        %double bond 5-1
    \else%
     \Put@Line(472,-10)(-5,3){170}%        %double bond 5-1
    \fi%
   \else%
    \ifx\eee\empty%
     \Put@Line(452,6)(-5,3){170}%       %double bond 5-1
    \else%
     \Put@Line(452,6)(-5,3){160}%       %double bond 5-1
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \section{Five-Membered Sugar Derivatives of Large Dimension}
% \subsection{General Conventions}
%
% The standard skeleton of cyclitol is selected 
% to have the following locant numbers. 
%
% \begin{verbatim}
% ********************
% * Sugarh derivative *
% ********************
%
% The following numbering is adopted in this macro. 
%
%
%                                   5
%                                   *
%                             d  *     * e
%   the original point ===> 4 *           * 1
%          (0,0)                *       * a
%                             c   -----
%                                3  b   2
% \end{verbatim}
%
%
% The macro |\FiveSugarh| has two arguments |ATOMLIST| and |SUBSLIST| 
% as well as an optional argument |BONDLIST|.  
% Two optional arguments |SKBONDLIST| and |OMIT| are added to 
% treat stereochemical information or other bond situations. 
%
% \begin{verbatim}
%   \FiveSugarh(SKBONDLIST)[BONDLIST]{ATOMLIST}{SUBSLIST}[OMIT]
% \end{verbatim}
%
% The |SKBONDLIST| argument contains pairs of two alphabets in 
% parentheses, e.g. (\{bA\}\{fB\}).  Each pair contains a lowercase 
% character selected from bond specifiers `a' to `e' and a uppercase
% character `A' or `B'. 
%
% The |BONDLIST| argument contains one 
% character selected from a to f, each of which indicates the presence of 
% an inner (endcyclic) double bond on the corresponding position. 
% The option  `$n+$' ($n=1$ to $6$) represents a plus charge on a hetero atom 
% at the $n$-position. 
%
% \begin{verbatim}
%  
%     BONDLIST = 
%
%           none or [] :  fully saturated form
%           a          :  1,2-double bond
%           b          :  2,3-double bond
%           c          :  4,3-double bond
%           d          :  4,5-double bond
%           e          :  5,1-double bond
%           {n+}       :  not suported: plus at n-nitrogen atom (n = 1 to 5)
% \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 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 (max 5 substitution positions)
%
%       for n = 1 to 5 
%
%           nD         :  exocyclic double bond at n-atom
%           n or nS    :  exocyclic single bond at n-atom
%           nSA        :  single bond (down) at n-atom (for n=1)
%           nSB        :  single bond (up) at n-atom (for n=1)
%           nSa        :  alpha single bond at n-atom
%           nSb        :  beta single bond at n-atom
%
% \end{verbatim}
%
% The argument |OMIT| represents one or more bonds to be omitted. 
% The omitted edges may be regarded as both fused and non-fused 
% positions. 
%
% \begin{verbatim}
%     OMIT:  one or more bonds omitted (a, b, c, d, or e)
% \end{verbatim}
%
% Several examples are shown as follows.
% \begin{verbatim}
%       e.g.
%        \FiveSugarh{6==O}{1Sa==OH;2Sa==OH}
% \end{verbatim}
%
% The definition of |\FiveSugarh| uses a picture environment and 
% consists of the same unit processes as shown in |\sixheteroh|: 
% \begin{enumerate}
% \item treatment of atom list, 
% \item placing outer skeletons, 
% \item placing inner double bonds, 
% \item setting hetero atoms, and 
% \item placing substituents dirctly 
%         (cf. |\setsixringh| for a |\sixheteroh|)
% \end{enumerate}
% \changes{v2.01}{2001/6/20}{Newly defined.}
% \changes{v5.00}{2010/10/01}{For bond coloring}
%
% \begin{macro}{\FiveSugarh}
% \begin{macro}{\@Five@Sugarh}
% \begin{macro}{\@Five@@Sugarh}
% \begin{macro}{\@FiveSugarh}
%    \begin{macrocode}
\def\FiveSugarh{\@ifnextchar({\@Five@Sugarh(@}{\@Five@Sugarh(@)}}
\def\@Five@Sugarh(#1){\@ifnextchar[{\@Five@@Sugarh(#1)[@}%
{\@Five@@Sugarh(#1)[@]}}
\def\@Five@@Sugarh(#1)[#2]#3#4{\@ifnextchar[%
{\@FiveSugarh(#1)[#2]{#3}{#4}[@}%
{\@FiveSugarh(#1)[#2]{#3}{#4}[@]}}
\def\@FiveSugarh(#1)[#2]#3#4[#5]{%
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%%%
% % treatment of atom list %
% %%%%%%%%%%%%%%%%%%%%%%%%%%
\iniatom\iniflag%initialize
\test@vrtx@SixSugarh{#3}%common to six-membered ring
%test for a hetero atom or a spiro substituent on a vertex
\@reset@ylsw%
\ylFiveSugarhposition{#4}%shift values
\begin{ShiftPicEnv}(0,0)(-\yl@shiftii,-\yl@shifti)/%
(1100,800)(-240,-400){FiveSugarh}%2002/4/30 by S. Fujita
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%
% % outer skeleton %
% %%%%%%%%%%%%%%%%%%
{\resetbdsw%
\@bond@@omit{#5}%%%|\@aaa| etc. are empty if they are omitted. 
\molfronttrue
\@fivememberedfalse%common bonds to a six-membered ring
\set@skel@Sugarhbond{#1}{a}{a}%
  %bond between 1 and 2 \@aaa -> \Sugarhskbonda etc
\set@skel@Sugarhbond{#1}{b}{b}%
 %bond between 2 and 3 \@bbb -> \Sugarhskbondb etc
\set@skel@Sugarhbond{#1}{c}{c}%
 %bond between 3 and 4 \@ccc -> \Sugarhskbondc etc
\molfrontfalse
\@fivememberedtrue%only five-membered ring
\set@skel@Sugarhbond{#1}{d}{d}%
 %bond between 4 and 5 \@ddd -> \fSugarhskbondd etc
\set@skel@Sugarhbond{#1}{e}{e}%
 %bond between 5 and 1 \@eee -> \fSugarhskbonde etc
}%
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%
% % inner double bond %
% %%%%%%%%%%%%%%%%%%%%%
\@tfor\member:=#2\do{%
\if\member r\relax %%% no action \Sugarhbondd \Sugarhbondf \Sugarhbondb%
\else \if\member l\relax %% noaction \Sugarhbonda \Sugarhbondc \Sugarhbonde%
\else \if\member a\relax \Sugarhbonda%
\else \if\member b\relax \Sugarhbondb%
\else \if\member c\relax \Sugarhbondc%
\else \if\member d\relax \fSugarhbondd%
\else \if\member e\relax \fSugarhbonde%
\else \if\member A% no action: %%left aromatic circle 
%  \Put@oCircle(203,0){240}%               %circle
% %%%%%%%%%%%%%%%%%%%%%%%%%
% % inner bond attachment %
% %%%%%%%%%%%%%%%%%%%%%%%%%
%\else
%  \expandafter\twoCH@@R\member//%
%  \set@fusionadd@sixhi
%  \ifx\@@tmpa\empty%
%   \XyMTeXWarning{Fused function is unavailable for FiveSugarh.}\fi
\fi\fi\fi\fi\fi\fi\fi\fi}%
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting hetero atoms %
% %%%%%%%%%%%%%%%%%%%%%%%%
\iniatom\iniflag%initialize
\set@hetatom@Sugarh{#3}{-3}{0}{2}{1}%               %subst 4
\set@hetatom@Sugarh{#3}{3}{3}{7}{1}%              %subst 1 -- 3
\set@hteatom@FiveSugarh{#3}%                      %subst 5
%    \end{macrocode}
%
%    \begin{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%
% % setting substituents %
% %%%%%%%%%%%%%%%%%%%%%%%%
\@forsemicol\member:=#4\do{%
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax%
\expandafter\threech@r\@membera{}{}%
\ifx\@memberb\@yl\else
\ifcase\@tmpa%0 omit
 \or\setBScolor{\Put@Direct(668,0){%
  \if@clip \@clippingtrue \else \@clippingfalse\fi
  \@pyrana}}% subst. on 1
 \or\setBScolor{\Put@Direct(513,-255){%
  \if@eclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranb}}% subst. on 2
 \or\setBScolor{\Put@Direct(153,-255){%
  \if@fclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranbb}}% subst. on 3
 \or\setBScolor{\Put@Direct(0,0){%
  \if@aclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranc}}% subst. on 4
 \or\setBScolor{\Put@Direct(333,200){%
  \if@bclip \@clippingtrue \else \@clippingfalse\fi
  \@pyranbB}}% subst. on 5
\fi %end of ifcase
\fi\fi}%
\end{ShiftPicEnv}%
\iniatom\iniflag}%     %end of \FiveSugarh macro
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% The command |\ylFiveSugarhposition| is to obtain the shift values 
% |\@ylii| and |\@yli| which are used for shifting the standard 
% point of a substituent. 
% \changes{v1.02}{1998/10/25}{New commands for setting substituents}
%
% \begin{macro}{\ylFiveSugarhposition}
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
\def\ylFiveSugarhposition#1{%
\@@ylswfalse%%%\@reset@ylsw
\@forsemicol\member:=#1\do{%
\if@@ylsw\else
\ifx\member\empty\else
\expandafter\@m@mb@r\member;\relax
\expandafter\threech@r\@membera{}{}\relax
\ifx\@memberb\@yl\relax\@@ylswtrue\else\@@ylswfalse\fi
\if@@ylsw
\ifcase\@tmpa%0 omit
 \or\gdef\@ylii{-668}\gdef\@yli{0}\global\@ylswtrue% subst. on 1
 \or\gdef\@ylii{-513}\gdef\@yli{255}\global\@ylswtrue% subst. on 2
 \or\gdef\@ylii{-153}\gdef\@yli{255}\global\@ylswtrue% subst. on 3
 \or\gdef\@ylii{0}\gdef\@yli{0}\global\@ylswtrue% subst. on 4
 \or\gdef\@ylii{-333}\gdef\@yli{-200}\global\@ylswtrue% subst. on 5
\fi%end of ifcase
\fi\fi\fi}}%
%    \end{macrocode}
% \end{macro}
%
% \subsection{Skeletal Bonds of FiveSugarh}
%
% The macros |\FiveSugarh| uses inner macros for setting 
% skeletal bonds in accordance with the presence or the absence of 
% hetero atoms.  During the processes of such setting,  
% the inner macros |\sugarhskbonda| to |\sugarhskbondc| 
% (common to |\sixsugarh|) as well as 
% |\fSugarhskbondd| to |\fSugarhskbonde| 
% to set a bond on each edge of a five-membered ring. 
%
% \begin{macro}{\fSugarhskbondd}
% The macro |\fSugarhskbondd| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\ddd| and |\eee|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
\def\fSugarhskbondd{%
  \ifx\ddd\empty%
    \ifx\eee\empty%
     \Put@Line(0,0)(5,3){333}%           %bond 4-5
    \else%
     \Put@Line(0,0)(5,3){298}%            %bond 4-5
    \fi%
   \else%
    \ifx\eee\empty%
     \Put@Line(35,21)(5,3){298}%          %bond 4-5
    \else%
     \Put@Line(35,21)(5,3){263}%          %bond 4-5
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\fSugarhskbonde}
% The macro |\fSugarhskbonde| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\eee| and |\aaa|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 5 and 1
\def\fSugarhskbonde{%
  \ifx\aaa\empty%
    \ifx\eee\empty%
     \Put@Line(668,0)(-5,3){333}%           %bond 5-1
    \else%
     \Put@Line(668,0)(-5,3){298}%            %bond 5-1
    \fi%
   \else%
    \ifx\eee\empty%
     \Put@Line(633,21)(-5,3){298}%          %bond 5-1
    \else%
     \Put@Line(633,21)(-5,3){263}%          %bond 5-1
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 

% \begin{macro}{\set@hteatom@FiveSugarh}
% The macro |\set@hteatom@FiveSugarh| put a hetero atom 
% on vertex no. 5 of |\FiveSugarh|. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
\def\set@hteatom@FiveSugarh#1{%
\@forsemicol\member:=#1\do{%
\ifx\member\empty\else%
\expandafter\@m@mb@r\member;\relax%
\expandafter\twoCH@R\@membera//%
\@tmpaa=\@tmpa\relax
\ifnum\@tmpaa=5\relax
  \if\@tmpb h\relax
     \@bcliptrue%
     \putratom{303}{170}{\@memberb}%  % right type
   \else\if\@tmpb s\relax
     \@bclipfalse%
     \putratom{333}{200}{\@memberb}%  % right type
   \else\if\@tmpb a\relax%omit fused position
   \else
     \@bcliptrue%
     \putratom{303}{170}{\@memberb}% left type
   \fi\fi\fi
\fi% end of ifnum
\fi
}}% end of the macro \set@hetatom@FiveSugarh
%    \end{macrocode}
% \end{macro} 
%
% \subsection{Inner Double Bonds of FiveSugarh}
%
% The macros |\FiveSugarh| uses inner macros for setting 
% skeletal bonds in accordance with the presence or the absence of 
% hetero atoms.  During the processes of such setting,  
% the inner macros |\Sugarhbonda| to |\Sugarhbondc| 
% (common to |\SixSugarh|) as well as 
% |\fSugarhbondd| and |\fSugarhbonde| are used to set a bond 
% on each edge of a five-membered ring. 
%
% \begin{macro}{\fSugarhbondd}
% The macro |\fSugarhbondd| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\ddd| and |\eee|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 4 and 5
\def\fSugarhbondd{%
  \ifx\ddd\empty%
    \ifx\eee\empty%
     \Put@Line(60,-10)(5,3){257}%        %double bond 4-5
    \else%
     \Put@Line(60,-10)(5,3){237}%        %double bond 4-5
    \fi%
   \else%
    \ifx\eee\empty%
     \Put@Line(80,6)(5,3){237}%       %double bond 5-4
    \else%
     \Put@Line(80,6)(5,3){227}%       %double bond 5-4
    \fi\fi}%
%    \end{macrocode}
% \end{macro} 
%
% \begin{macro}{\fSugarhbonde}
% The macro |\fSugarhbonde| refers to the control sequences representing 
% atoms on both of the terminal vertices (|\aaa| and |\eee|) and 
% examine whether these are empty or not.  Thereby, 
% it decides the vertices to be truncated. 
%
% \changes{v2.01}{2001/6/20}{Newly defined.}
%    \begin{macrocode}
%bond between 5 and 1
\def\fSugarhbonde{%
  \ifx\aaa\empty%
    \ifx\eee\empty%
     \Put@Line(608,-10)(-5,3){257}%        %double bond 5-1
    \else%
     \Put@Line(608,-10)(-5,3){237}%        %double bond 5-1
    \fi%
   \else%
    \ifx\eee\empty%
     \Put@Line(588,6)(-5,3){237}%       %double bond 5-1
    \else%
     \Put@Line(588,6)(-5,3){227}%       %double bond 5-1
    \fi\fi}%
%</hcycle>
%    \end{macrocode}
% \end{macro} 
%
% \Finale
%
\endinput
%</hcycle>