% \iffalse meta-comment
%% File: xymtx-ps.dtx
%
%  Copyright 2002,2004,2005,2009,2013 by Shinsaku Fujita
%
%  This file is part of XyMTeX system.
%  -------------------------------------
%
% This file is a successor to:
%
% xymtx-ps.sty
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \typeout{XyMTeX for Drawing Chemical Structural Formulas. Version 4.00}
% \typeout{       -- Released May 30, 2002 by Shinsaku Fujita}
% Copyright (C) 2002 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. 
%
% The following book deals with an application of TeX/LaTeX to 
% preparation of manuscripts of chemical fields:
%  (1)  Shinsaku Fujita, ``LaTeX for Chemists and Biochemists'' 
%    Tokyo Kagaku Dozin, Tokyo (1993) [in Japanese]. 
%  (2)  Shinsaku Fujita, ``XyMTeX. Typesetting Chemical Structural
%    Formulas'' Addison-Wesley, New York (1997).  
%
% Copying of this file is authorized only if either
%  (1) you make absolutely no changes to your copy, including name and 
%     directory name; or
%  (2) if you do make changes, 
%     (a) you name it something other than the names included in the 
%         ``xymtex'' directory and 
%     (b) you are requested to leave this notice intact.
% This restriction ensures that all standard styles are identical.
%
% Please report any bugs, comments, suggestions, etc. to:
%   Shinsaku Fujita, 
%   Department of Chemistry and Materials Technology, 
%   Kyoto Institute of Technology, 
%   Matsugasaki, Sakyoku, Kyoto, 606-8585 Japan
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{xymtx-ps}
% \def\versi@ndate{May 30, 2002}
% \def\versi@nno{ver1.00}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{xymtx-ps}
% \def\versi@ndate{May 30, 2002}
% \def\versi@nno{ver1.00}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{xymtx-ps}
% \def\versi@ndate{August 30, 2004}
% \def\versi@nno{ver4.01}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{xymtx-ps}
% \def\versi@ndate{December 20, 2004}
% \def\versi@nno{ver4.02}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{xymtx-ps}
% \def\versi@ndate{June 20, 2005}
% \def\versi@nno{ver4.03}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{xymtx-ps}
% \def\versi@ndate{August 02, 2005}
% \def\versi@nno{ver4.03a}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{xymtx-ps}
% \def\versi@ndate{June 15, 2009}
% \def\versi@nno{ver4.04a}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{xymtx-ps}
% \def\versi@ndate{November 05, 2009}
% \def\versi@nno{ver4.05}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{xymtx-ps}
% \def\versi@ndate{February 24, 2011}
% \def\versi@nno{ver5.01b}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{xymtx-ps}
% \def\versi@ndate{May 27, 2013}
% \def\versi@nno{ver5.01bb}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \def\j@urnalname{xymtx-ps}
% \def\versi@ndate{June 21, 2013}
% \def\versi@nno{ver5.01bbb}
% \def\copyrighth@lder{SF} % Shinsaku Fujita
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \fi
%
% \CheckSum{1000}
%% \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.00}{2002/05/30}{first edition for LaTeX2e}
% \changes{v4.01}{2004/08/30}{Adjust for XyMTeX version 4.01}
% \changes{v4.02}{2004/12/20}{Wedged bonds for stereochemistry}
% \changes{v4.03}{2005/06/20}{Wave bonds for stereochemistry}
% \changes{v4.03a}{2005/08/02}{Bug fix for the compatibility with 
% \changes{v4.04a}{2009/06/15}{Bug fix for \cs{\Put@@@Direct}} 
% \changes{v4.05}{2009/11/05}{Bug fix for \cs{\Put@@@Direct}; pLaTeXe vs. LaTeXe} 
% \changes{v5.01b}{2011/02/24}{Coloring bonds and atoms} 
% \changes{v5.01bb}{2013/05/27}{\cs{WedgeAsSubstX} etc.} 
% \changes{v5.01bbb}{2013/06/21}{\cs{WavyAsSubst} etc.} 
% \changes{v5.01}{2013/08/16}{\cs{BackGroundBond} etc.} 
% \fi
%
% \iffalse
%<*driver>
\NeedsTeXFormat{pLaTeX2e}
% \fi
\ProvidesFile{xymtx-ps.dtx}[2013/08/16 v5.01 xymtx-ps package file]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{xymtx-ps.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{Chemistry Conventions by {\sffamily xymtx-ps.sty} 
(\fileversion) of \XyMTeX{}}
\author{Shinsaku Fujita \\ 
Shonan Institute of Chemoinformatics Mathematical Chemistry, \\
Kaneko 479-7 Ooimachi, Ashigara-Kami-Gun, 
Kanagawa-Ken, 258-0019 Japan 
% Department of Chemistry and Materials Technology, \\
% Kyoto Institute of Technology, \\
% Matsugasaki, Sakyoku, Kyoto, 606-8585 Japan
}
\date{\filedate}
%
\begin{document}
   \maketitle
   \DocInput{xymtx-ps.dtx}
\end{document}
%</driver>
% \fi
%
% \section{Introduction}\label{xymtx-ps:intro}
%
% \subsection{Options for {\sffamily docstrip}}
%
% \DeleteShortVerb{\|}
% \begin{center}
% \begin{tabular}{|l|l|}
% \hline
% \emph{option} & \emph{function}\\ \hline
% xymtxps & xymtx-ps.sty \\
% driver & driver for this dtx file \\
% \hline
% \end{tabular}
% \end{center}
% \MakeShortVerb{\|}
%
% \subsection{Version Information}
%
%    \begin{macrocode}
%<*xymtxps>
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\j@urnalname{xymtx-ps}
\def\versi@ndate{August 16, 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{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 ccycle.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{}. 
% The global setting of unit by |\psset| has caused imcompatibility 
% with the prosper package and so has been changed into a local setting. 
% \changes{v4.03a}{2005/08/02}{Bug fix for the compatibility with 
%  the prosper package}
%
%    \begin{macrocode}
% *************************
% * input of basic macros *
% *************************
\@ifundefined{setsixringv}{\input chemstr.sty\relax}{}
\RequirePackage{chemstr}%added 2010/10/01
\RequirePackage{pstricks}
\RequirePackage{pst-coil}
\unitlength=0.1pt
%%\psset{xunit=\the\unitlength,yunit=\the\unitlength}%delete August 2, 2005
%    \end{macrocode}
%
%    \begin{macrocode}
\newif\if@thicklinesw \@thicklineswfalse
\def\Thick@Lines{\@thicklineswtrue}%redefinition
\def\Thin@Lines{\@thicklineswfalse}%redefinition
\def\thickLineWidth{1.6pt}
\def\thinLineWidth{0.4pt}
%    \end{macrocode}
%
% The macro |\Put@@@Line| can draw dashed bonds or wedged bonds for supporting 
% stereochemistry. Two switches are available as follows: 
%
% \begin{macro}{changedashtowedge}
% \begin{macro}{changewedgetodash}
% \changes{v4.02}{2004/12/20}{Switch for wedged bonds}
%    \begin{macrocode}
\newif\if@wedgesw \@wedgeswtrue
\newif\if@hasheddashsw \@hasheddashswtrue
\def\wedgehasheddash{\@wedgeswtrue\@hasheddashswtrue}
\def\wedgehashedwedge{\@wedgeswtrue\@hasheddashswfalse}
\def\dashhasheddash{\@wedgeswfalse\@hasheddashswtrue}
\@ifundefined{ifmolfront}{\newif\ifmolfront \molfrontfalse}{}
\@ifundefined{if@skbondlist}{\newif\if@skbondlist \@skbondlistfalse}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{Put@@@Line}
% \changes{v4.02}{2004/12/20}{Wedged bonds for stereochemistry}
% \changes{v4.03}{2005/07/20}{Switch for wave bonds}
% \changes{v5.01}{2011/02/24}{Coloring atoms and bonds}
%    \begin{macrocode}
%\newcount\@tempcntXa \newcount\@tempcntYa \newcount\@tempcntz%deleted 2010/10/01
%\newcount\@tempcntXb \newcount\@tempcntYb \newcount\@tempcntzz%deleted 2010/10/01
%\newcount\@tempcntXc \newcount\@tempcntYc \newcount\@tempcntzzz%deleted 2010/10/01
\long\gdef\Put@@@Line(#1,#2)(#3,#4)#5{%
\begingroup
\SlopetoXY(#1,#2)(#3,#4){#5}%%replaced (code from chemstr.sty)
\if@thicklinesw
\if@wedgesw
\ifmolfront%bold dash bond for skeletal bond for pyranose etc.
\psline[unit=\unitlength,%
%linecolor=\psbondsubstcolor,%added 2011/02/24
linewidth=\thickLineWidth](#1,#2)(\the\@tempcntXa,\the\@tempcntYa)%
\else
\if@skbondlist%bold dash bond skeletal bond for general cases
\psline[unit=\unitlength,%
%linecolor=\psbondsubstcolor,%added 2011/02/24
linewidth=\thickLineWidth](#1,#2)(\the\@tempcntXa,\the\@tempcntYa)%
\else%wedged bond
\stereo@wedgedimension(#3,#4){10}%
\pspolygon*[unit=\unitlength%
%,linecolor=\psbondsubstcolor,%added 2011/02/24
](#1,#2)%
(\the\@tempcntXb,\the\@tempcntYb)(\the\@tempcntXc,\the\@tempcntYc)
\fi\fi
\else
\psline[unit=\unitlength,%
%linecolor=\psbondsubstcolor,%added 2011/02/24
linewidth=\thickLineWidth](#1,#2)(\the\@tempcntXa,\the\@tempcntYa)%
\fi
\else
\ifwavebond
\pszigzag[unit=\unitlength,%
%linecolor=\psbondsubstcolor,%added 2011/02/24
coilheight=1,coilwidth=.13cm,linewidth=\thinLineWidth,linearc=5,%
coilarm=0]{-}(\the\@tempcntXa,\the\@tempcntYa)(#1,#2)%
\else
\psline[unit=\unitlength,%
%linecolor=\psbondsubstcolor,%added 2011/02/24
linewidth=\thinLineWidth](#1,#2)(\the\@tempcntXa,\the\@tempcntYa)%
\fi
\fi
\@tempcntXa=0\relax \@tempcntYa=0\relax
\endgroup}%end of Put@@@Line
%    \end{macrocode}
% \end{macro}
%
% The macro |\stereo@wedgedimension| calculates the coordinates of three positions 
% for drawing a wedged bond, which is drawn by the |\pspolygon| command of the PSTricks package. 
%
% \begin{macro}{stereo@wedgedimension}
% \changes{v4.02}{2004/12/20}{Wedged bonds for stereochemistry}
%    \begin{macrocode}
\newif\if@wedgeadjust
\def\stereo@wedgedimension(#1,#2)#3{%
\@tempcntXb=0\relax
\@tempcntYb=0\relax
\@tempcntXc=0\relax
\@tempcntYc=0\relax
%%
\@wedgeadjustfalse
\ifnum#1<0 \@tempcntzz=-#1\else\@tempcntzz=#1\fi
\ifnum#2<0 \@tempcntzzz=-#2\else\@tempcntzzz=#2\fi
\ifnum#1=0\else 
\multiply\@tempcntzzz by10\relax \divide\@tempcntzzz by\@tempcntzz\fi%% (3/5)x10=6
\ifnum\@tempcntzzz>7\relax\else\@wedgeadjusttrue\fi  
%%one point of wedge
\ifnum#1=0\relax
\@tempcntXb=#3 \advance\@tempcntXb by8\relax
\@tempcntYb=0\relax
\else
\ifnum#2=0\relax
\@tempcntXb=0\relax
\@tempcntYb=#3 \advance\@tempcntYb by8\relax
\else
\@tempcntXb=#3\relax
\@tempcntYb=-#3\relax
\if@wedgeadjust
\advance\@tempcntXb by8\relax
\advance\@tempcntYb by-8\relax
\fi
\multiply\@tempcntXb by#2\relax\multiply\@tempcntXb by10\relax
\divide\@tempcntXb by#1\relax\divide\@tempcntXb by10\relax\fi\fi
\advance\@tempcntXb by\@tempcntXa\relax
\advance\@tempcntYb by\@tempcntYa\relax
%%other point of wedge
\ifnum#1=0\relax
\@tempcntXc=-#3 \advance\@tempcntXc by-8\relax
\@tempcntYc=0\relax
\else
\ifnum#2=0\relax
\@tempcntXc=0\relax
\@tempcntYc=-#3 \advance\@tempcntYc by-8\relax
\else
\@tempcntXc=-#3\relax
\@tempcntYc=#3\relax
\if@wedgeadjust
\advance\@tempcntXc by-6\relax
\advance\@tempcntYc by6\relax
\fi
\multiply\@tempcntXc by#2\relax\multiply\@tempcntXc by10\relax
\divide\@tempcntXc by#1\relax\divide\@tempcntXc by10\relax\fi\fi
\advance\@tempcntXc by\@tempcntXa\relax
\advance\@tempcntYc by\@tempcntYa\relax
}%%end of \stereo@wedgedimension
%    \end{macrocode}
% \end{macro}
%
% The optional argument [Bl] of |\Put@@@Direct| is corrected 
% to be [bl]. This effect appears in the use of tbook.cls etc. 
% \changes{v4.04a}{2009/06/15}{Bug fix for tategumi}
% \changes{v4.05}{2009/11/05}{Bug fix for tategumi and yokogumi; 
% pLaTeXe vs. LaTeXe}
% \changes{v5.01}{2011/02/24}{Coloring atoms and bonds}
%
% \begin{macro}{Put@@@Direct}
%    \begin{macrocode}
% \def\Put@@@Direct(#1,#2)#3{\begingroup\psset{unit=\unitlength}%
% \rput[Bl]{0}(#1,#2){#3}\endgroup}%2009/06/15 2009/11/05bugfix as follows
\@ifundefined{iftdir}{\newif\iftdir \tdirfalse}{}%pLaTeXe vs. LaTeXe
\def\Put@@@Direct(#1,#2)#3{\begingroup\psset{unit=\unitlength}%
\iftdir
\rput[bl]{0}(#1,#2){#3}\else\rput[Bl]{0}(#1,#2){#3}\fi
\endgroup}
\def\Put@@@oCircle(#1,#2)#3{%
   \begingroup \@tempcntz=#3 \divide\@tempcntz by2\relax
   \pscircle[linewidth=.4pt,unit=\unitlength](#1,#2){\@tempcntz}\endgroup}
\def\Put@@@sCircle(#1,#2)#3{%
   \begingroup \@tempcntz=#3 \divide\@tempcntz by2\relax
   \pscircle[linewidth=2pt,unit=\unitlength](#1,#2){\@tempcntz}\endgroup}
%    \end{macrocode}
% \end{macro}
%
% Dotted lines by the old macro |\d@@t@rline| are changed into hashed dash bonds 
% in the new macro |\d@@t@rline| (|\@wedgeswfalse|). If |\@wedgeswtrue| is 
% declared (default), the new macro draws a hashed wedged bonds.  
% 
% \begin{macro}{d@@t@rline}
% \changes{v4.02}{2004/12/20}{Hashed wedged bonds for stereochemistry}
%    \begin{macrocode}
\def\d@@t@rline(#1,#2)(#3,#4)#5/(#6,#7)(#8,#9){%
\if@hasheddashsw
  \@ifundefined{psline}{%
   \XyMTeXWarning{A dottedline is replaced by a solid line.}%
    \Put@Line(#1,#2)(#3,#4){#5}%
     }{{\thicklines%
        \hasheddashbond(#1,#2)(#3,#4){#5}/(#6,#7)(#8,#9)}}%
\else
\if@skbondlist%hashed dash bond skeletal bond for general cases
  \@ifundefined{psline}{%
   \XyMTeXWarning{A dottedline is replaced by a solid line.}%
    \Put@Line(#1,#2)(#3,#4){#5}%
     }{{\thicklines%
        \hasheddashbond(#1,#2)(#3,#4){#5}/(#6,#7)(#8,#9)}}%
\else
  \hashedwedgebond(#1,#2)(#3,#4){#5}/(#6,#7)(#8,#9)%
\fi\fi
}%end of \d@@t@rline
%    \end{macrocode}
% \end{macro}
%
% The inner macro |\hasheddashbond| works in the macro |\d@@t@rline| for 
% drawing a hased dash bond. 
%
% \begin{macro}{hasheddashbond}
% \changes{v4.02}{2004/12/20}{Hashed dash bonds for stereochemistry}
% \changes{v5.01}{2011/02/24}{Coloring atoms and bonds}
%    \begin{macrocode}
\def\hasheddashbond(#1,#2)(#3,#4)#5/(#6,#7)(#8,#9){%
\begingroup
\@tempcntzz=12\relax
\@tempcntzzz=-30\relax%almost no shortening
\bond@shorten(#1,#2)(#3,#4){#5}/(#6,#7)(#8,#9)%
\ifdim\unitlength>0.08pt
\psline[unit=\unitlength,%
%linecolor=\psbondsubstcolor,%added 2011/02/24
linewidth=\thickLineWidth,linestyle=dashed,dash=1pt 1.2pt]%
(\the\@tempcntXb,\the\@tempcntYb)(\the\@tempcntXc,\the\@tempcntYc)%
\else
\psline[unit=\unitlength,%
%linecolor=\psbondsubstcolor,%added 2011/02/24
linewidth=\thickLineWidth,linestyle=dashed,dash=1pt 1.2pt]%
(\the\@tempcntXb,\the\@tempcntYb)(\the\@tempcntXc,\the\@tempcntYc)%
\fi
\endgroup}
%    \end{macrocode}
% \end{macro}
%
% The inner macro |\hashedwedgebond| works in the macro |\d@@t@rline| for 
% drawing a hashed wedged bond. 
%
% \begin{macro}{hashedwedgebond}
% \changes{v4.02}{2004/12/20}{Hashed wedged bonds for stereochemistry}
% \changes{v5.01}{2011/02/24}{Coloring atoms and bonds}
%    \begin{macrocode}
\def\hashedwedgebond(#1,#2)(#3,#4)#5/(#6,#7)(#8,#9){%
\begingroup
\@tempcntXa=#8\relax
\@tempcntYa=#9\relax
\stereo@wedgedimension(#3,#4){10}%
\pspolygon*[unit=\unitlength%
%,linecolor=\psbondsubstcolor%added 2011/02/24
](#1,#2)(\the\@tempcntXb,\the\@tempcntYb)(\the\@tempcntXc,\the\@tempcntYc)%
\@tempcntzz=5\relax
\@tempcntzzz=-12\relax
\bond@shorten(#1,#2)(#3,#4){#5}/(#6,#7)(#8,#9)%
\ifdim\unitlength>0.08pt
\psline[unit=\unitlength,%
linewidth=3.8pt,linestyle=dashed,dash=0.8pt 1pt,linecolor=white]%
(\the\@tempcntXb,\the\@tempcntYb)(\the\@tempcntXc,\the\@tempcntYc)%
\else
\psline[unit=\unitlength,%
linewidth=3pt,linestyle=dashed,dash=0.6pt 0.8pt,linecolor=white]%
(\the\@tempcntXb,\the\@tempcntYb)(\the\@tempcntXc,\the\@tempcntYc)%
\fi
\endgroup
}%%end of \hashedwedgebond
%    \end{macrocode}
% \end{macro}
%
% The inner macro |\bond@shorten| works in the macros |\hasheddashbond| and |\hashedwedgebond| for 
% shortening the resulting hashed bonds. This macro calculates the coordinates of the staring 
% point and the end point. 
%
% \begin{macro}{bond@shorten}
% \changes{v4.02}{2004/12/20}{Hashed forms for dash and wedged bonds}
%    \begin{macrocode}
\def\bond@shorten(#1,#2)(#3,#4)#5/(#6,#7)(#8,#9){%
\@tempcntXb=#8\relax
\@tempcntYb=#9\relax
\advance\@tempcntXb by-#6\relax \divide\@tempcntXb by\@tempcntzz\relax
\advance\@tempcntYb by-#7\relax \divide\@tempcntYb by\@tempcntzz\relax
\advance\@tempcntXb by#6\relax
\advance\@tempcntYb by#7\relax
\@tempcntXc=#8\relax
\@tempcntYc=#9\relax
\advance\@tempcntXc by-#6\relax \divide\@tempcntXc by\@tempcntzzz\relax
\advance\@tempcntYc by-#7\relax \divide\@tempcntYc by\@tempcntzzz\relax
\advance\@tempcntXc by#8\relax
\advance\@tempcntYc by#9\relax
}%%end of \bondshorten
%    \end{macrocode}
% \end{macro}
%
% Skeletal bold bonds can be changed into wedges, where 
% |\WedgeAsSubst| is described in an ATOMLIST as a kind of 
% spiro substituent. 
% 
% \begin{macro}{WedgeAsSubst}
% \changes{v4.02}{2004/12/20}{Wedged skeletal bonds}
%    \begin{macrocode}
\def\WedgeAsSubstPS(#1,#2)(#3,#4)#5{%
\begingroup
\@thicklineswtrue \@wedgeswtrue
\molfrontfalse \@skbondlistfalse
\Put@@@Line(#1,#2)(#3,#4){#5}%
\endgroup}
\let\WedgeAsSubst=\WedgeAsSubstPS%for compatibility to PDF mode
%    \end{macrocode}
% \end{macro}
%
% The macro |\stereo@wedgedimensionX| has a starting point, 
% an endpoint, and the width of a wedge as its arguments. 
% Compare this command with |\stereo@wedgedimension|, which has 
% a starting point, a slope, and the width of a wedge 
% as its arguments. 
%
% \begin{macro}{stereo@wedgedimensionX}
% \changes{v5.01}{2013/05/27}{dimension of wedge}
%    \begin{macrocode}
\def\stereo@wedgedimensionX(#1,#2)(#3,#4){%
\@ifnextchar[{\stereo@@wedgedimensionX(#1,#2)(#3,#4)}%
{\stereo@@wedgedimensionX(#1,#2)(#3,#4)[10]}}
\def\stereo@@wedgedimensionX(#1,#2)(#3,#4)[#5]{%
\@tempcnta=-#1\relax
\advance\@tempcnta by#3\relax
%%\typeout{KKK:\the\@tempcnta}%
\@tempcntb=-#2\relax
\advance\@tempcntb by#4\relax
%%%\typeout{LLL:\the\@tempcntb}%
\stereo@wedgedimension(\the\@tempcnta,\the\@tempcntb){#5}%
%%%\typeout{MMM; (\the\@tempcntXb,\the\@tempcntYb)(\the\@tempcntXc,\the\@tempcntYc)}
\advance\@tempcntXb by#3\relax
\advance\@tempcntYb by#4\relax
\advance\@tempcntXc by#3\relax
\advance\@tempcntYc by#4\relax}
%    \end{macrocode}
% \end{macro}
%
% The macro |\WedgeAsSubstX| has a starting point, 
% an endpoint, and the width of a wedge as its arguments. 
% Compare this command with |\WedgeAsSubst|, which has 
% a starting point, a slope, and the width of a wedge 
% as its arguments. 
%
% \begin{macro}{WedgeAsSubstX}
% \changes{v5.01}{2013/05/27}{Wedged skeletal bonds}
%    \begin{macrocode}
\def\WedgeAsSubstXPS(#1,#2)(#3,#4){%
\@ifnextchar[{\Wedge@AsSubstXPS(#1,#2)(#3,#4)}%
{\Wedge@AsSubstXPS(#1,#2)(#3,#4)[10]}}%
\def\Wedge@AsSubstXPS(#1,#2)(#3,#4)[#5]{%
\begingroup
\stereo@wedgedimensionX(#1,#2)(#3,#4)[#5]%
\pspolygon*[unit=\unitlength](#1,#2)%
(\the\@tempcntXb,\the\@tempcntYb)(\the\@tempcntXc,\the\@tempcntYc)%
\endgroup}
\let\WedgeAsSubstX=\WedgeAsSubstXPS%for compatibility to PDF mode
%    \end{macrocode}
% \end{macro}
%
% Skeletal hashed dash bonds can be changed into hashed wedges, where 
% |\HashWedgeAsSubst| is described in an ATOMLIST as a kind of 
% spiro substituent. 
%
% \begin{macro}{HashWedgeAsSubst}
% \changes{v4.02}{2004/12/20}{Hashed Wedged skeletal bonds}
% \changes{v5.01}{2011/02/24}{Coloring atoms and bonds}
%    \begin{macrocode}
\def\HashWedgeAsSubstPS(#1,#2)(#3,#4)#5{%
\begingroup
\@thicklineswtrue \@wedgeswtrue
\molfrontfalse \@skbondlistfalse
\Put@@@Line(#1,#2)(#3,#4){#5}%
%%x-coordinate
\@tempcntXa=0\relax
\ifnum#3>0\relax \@tempcntXa=#5\relax
\advance\@tempcntXa by-10\relax
\else\ifnum#3<0\relax\@tempcntXa=-#5\relax\fi\fi
\advance\@tempcntXa by#1\relax
%%y-coordinate
\@tempcntYa=#5\relax
\advance\@tempcntYa by-10\relax
\ifnum#3=0\relax\else
\multiply\@tempcntYa by#4\relax\multiply\@tempcntYa by10\relax
\divide\@tempcntYa by#3\relax\divide\@tempcntYa by10\relax\fi
\ifnum\@tempcntYa<0\relax
\ifnum#4>0\relax\@tempcntYa=-\@tempcntYa\fi
\else
\ifnum\@tempcntYa>0\relax
\ifnum#4<0\relax\@tempcntYa=-\@tempcntYa\fi\fi
\fi
\advance\@tempcntYa by#2\relax
\ifdim\unitlength>0.08pt
\psline[unit=\unitlength,%
linewidth=5pt,linestyle=dashed,dash=0.8pt 1pt,linecolor=white]%
%%(\the\@tempcntXb,\the\@tempcntYb)(\the\@tempcntXc,\the\@tempcntYc)%
(#1,#2)(\the\@tempcntXa,\the\@tempcntYa)%
\else
\psline[unit=\unitlength,%
linewidth=3pt,linestyle=dashed,dash=0.6pt 0.8pt,linecolor=white]%
%%(\the\@tempcntXb,\the\@tempcntYb)(\the\@tempcntXc,\the\@tempcntYc)%
(#1,#2)(\the\@tempcntXa,\the\@tempcntYa)%
\fi
\endgroup
}%%end of \HashWedgeAsSubstPS
\let\HashWedgeAsSubst=\HashWedgeAsSubstPS%for compatibility to PDF mode
%    \end{macrocode}
% \end{macro}
%
% The macro |\HashWedgeAsSubstX| has a starting point, 
% an endpoint, and the width of a wedge as its arguments. 
% Compare this command with |\HashWedgeAsSubst|, which has 
% a starting point, a slope, and the width of a wedge 
% as its arguments. 
%
% \begin{macro}{HashWedgeAsSubstX}
% \changes{v5.01}{2013/05/27}{Hashed Wedged skeletal bonds}
%    \begin{macrocode}
\def\HashWedgeAsSubstXPS(#1,#2)(#3,#4){%
\@ifnextchar[{
\HashWedge@sSubstXPS(#1,#2)(#3,#4)}%
{\HashWedge@sSubstXPS(#1,#2)(#3,#4)[10]}}
\def\HashWedge@sSubstXPS(#1,#2)(#3,#4)[#5]{%
\begingroup
\Wedge@AsSubstXPS(#1,#2)(#3,#4)[#5]%
\ifdim\unitlength>0.08pt
\@tempdima=#5\unitlength \multiply\@tempdima by3\relax
\advance\@tempdima by1pt%adjustment
\psline[unit=\unitlength,%
linewidth=\@tempdima,%
linestyle=dashed,dash=0.8pt 1pt,linecolor=white]%
(#1,#2)(#3,#4)%
\else
\@tempdima=#5\unitlength \multiply\@tempdima by3
\psline[unit=\unitlength,%
linewidth=\@tempdima,%
linestyle=dashed,dash=0.6pt 0.8pt,linecolor=white]%
(#1,#2)(#3,#4)%
\fi
\endgroup
}%%end of \HashWedgeAsSubstXPS
\let\HashWedgeAsSubstX=\HashWedgeAsSubstXPS%for compatibility to PDF mode
%    \end{macrocode}
% \end{macro}
%
% Skeletal bold bonds can be changed into wavy bonds, where 
% |\WavyAsSubst| is described in an ATOMLIST as a kind of 
% spiro substituent. 
% 
% \begin{macro}{\WavyAsSubst}
% \changes{v5.01}{2004/06/21}{For PDF mode: Wavy skeletal bonds}
%    \begin{macrocode}
\def\WavyAsSubstPS(#1,#2)(#3,#4)#5{%
\begingroup
\wavebondtrue
\Put@@@Line(#1,#2)(#3,#4){#5}%
\endgroup}
\let\WavyAsSubst=\WavyAsSubstPS%for compatibility to PDF mode
%    \end{macrocode}
% \end{macro}
%
% The macro |\WavyAsSubstX| has a starting point, 
% an endpoint, and the width of a wedge as its arguments. 
% Compare this command with |\WavyAsSubst|, which has 
% a starting point, a slope, and the width of a wedge 
% as its arguments. 
%
% \begin{macro}{WedgeAsSubstX}
% \changes{v5.01}{2013/06/21}{For PDF mode: Checked OK}
%    \begin{macrocode}
\def\WavyAsSubstXPS(#1,#2)(#3,#4){%
\pszigzag[unit=\unitlength,%
%linecolor=\psbondsubstcolor,%added 2011/02/24
coilheight=1,coilwidth=.13cm,linewidth=\thinLineWidth,linearc=5,%
coilarm=0]{-}(#3,#4)(#1,#2)%
}
\let\WavyAsSubstX=\WavyAsSubstXPS%for compatibility to PDF mode
%    \end{macrocode}
% \end{macro}
%
% The macro |\PUT@@@bondLINE| is used to draw a bond line. 
% This macro relies on the pstricks package. 
%
% \begin{macro}{\PUT@@@bondLINE}
% \begin{macro}{\PutPSLine}
% \changes{v5.00}{2010/10/01}{For compatibility to PDF mode: macro for 
% drawing a straight-line bond after adjusting its joint position}
% \changes{v5.01}{2011/02/24}{Coloring atoms and bonds}
%    \begin{macrocode}
\def\PUT@@@bondLINE(#1,#2)(#3,#4)#5{%
\begingroup
\psline[unit=\unitlength,%
%linecolor=\psbondsubstcolor,%added 2011/02/24
linewidth=#5](#1,#2)(#3,#4)%
\endgroup
}
\let\PutPSLine=\PUT@@@bondLINE%for user's use
\let\PutBondLine=\PUT@@@bondLINE%for compatibility to PDF
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The macro |\PUT@@@dashedLINE| is used to draw a dashed bond line, 
% which usually links two non-adjacent atoms of a cyclic compound. 
% This macro relies on the pstrick package. 
%
% \begin{macro}{\PUT@@@dashedLINE}
% \begin{macro}{\PutPSdashed}
% \begin{macro}{\PutDashedBond}
% \changes{v5.00}{2010/10/01}{For PS mode}
% \changes{v5.01}{2011/02/24}{Coloring atoms and bonds}
%    \begin{macrocode}
\def\PUT@@@dashedLINE(#1,#2)(#3,#4)#5{%
\begingroup
\ifdim\unitlength>0.08pt
\psline[unit=\unitlength,%
%linecolor=\psbondsubstcolor,%added 2011/02/24
linewidth=#5,linestyle=dashed,dash=1pt 1.2pt]%
(#1,#2)(#3,#4)%
\else
\psline[unit=\unitlength,%
%linecolor=\psbondsubstcolor,%added 2011/02/24
linewidth=#5,linestyle=dashed,dash=0.8pt 1pt]%
(#1,#2)(#3,#4)%
\fi
\endgroup
}
\let\PutPSdashed=\PUT@@@dashedLINE%for user's use
\let\PutDashedBond=\PUT@@@dashedLINE%for compatibility to PDF mode
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% The command \cs{downnobond} is redefined for pstricks.
% \begin{macro}{\upnobond}
% \begin{macro}{\downnobond}
%    \begin{macrocode}
%\def\upnobond#1#2{%nochange
%\hbox{\hbox to0.72em{\hss#1\hss}\kern-0.72em\raise2.2ex\hbox{#2}}}
\def\downnobond#1#2{%
\hbox{\smash{\hbox to0.72em{\hss#1\hss}\kern-0.72em\lower2.2ex\hbox{#2}}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% The macro |\putRoundArrowPS| throws its main task to its inner 
% macro |\putRound@rrowPS|, which treats an optional argument 
% for specifying the direction of an arrow head. 
% The macro |\putRoundArrow| is defined as a user command to
% assure the compatibility to the PostScript mode. 
%
% \begin{macro}{\putRoundArrowPS}
% \begin{macro}{\putRound@rrowPS}
% \begin{macro}{\putRoundArrow}
% \changes{v5.00}{2010/10/01}{For PS mode}
% \changes{v5.01}{2011/02/24}{Coloring atoms and bonds}
%    \begin{macrocode}
\def\putRoundArrowPS{%
\@ifnextchar[{\putRound@rrowPS}{\putRound@rrowPS[->]}}
\def\putRound@rrowPS[#1]#2{%
\pscurve[unit=\unitlength,%
%linecolor=\psbondsubstcolor,%added 2011/02/24
linewidth=0.4pt]{#1}#2}
\let\putRoundArrow=\putRoundArrowPS%for the compatibility to PDF mode
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\red etc.}
% \changes{v5.00}{2010/10/01}{Colors for PS mode}
%    \begin{macrocode}
\def\red{\color{red}\psset{linecolor=red}}
\def\blue{\color{blue}\psset{linecolor=blue}}
\def\green{\color{green}\psset{linecolor=green}}
\def\black{\color{black}\psset{linecolor=black}}
\def\cyan{\color{cyan}\psset{linecolor=cyan}}
\def\yellow{\color{yellow}\psset{linecolor=yellow}}
\def\magenta{\color{magenta}\psset{linecolor=magenta}}
\def\white{\color{white}\psset{linecolor=white}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xymcolor}
% \begin{macro}{\redx etc.}
% These macros are defined to avoid \texttt{**Warning** color stack underflow} 
% during processing by the dvipdfmx converter. 
% \changes{v5.00}{2010/10/01}{Added: Colors for TeX/LaTeX mode}
% \changes{v5.01}{2011/02/24}{Coloring atoms and bonds}
%    \begin{macrocode}
\def\xymcolor#1#2{\mbox{\color{#1}\psset{linecolor=#1}#2}}
%defined in the bondcolor packag
%\def\redx#1{\xymcolor{red}{#1}}
%\def\bluex#1{\xymcolor{blue}{#1}}
%\def\greenx#1{\xymcolor{green}{#1}}
%\def\blackx#1{\xymcolor{black}{#1}}
%\def\cyanx#1{\xymcolor{cyan}{#1}}
%\def\yellowx#1{\xymcolor{yellow}{#1}}
%\def\magentax#1{\xymcolor{magenta}{#1}}
%\def\whitex#1{\xymcolor{white}{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\Color@@@Line}
% \changes{v5.00}{2010/10/01}{For coloring skeletal bond in PS mode}
% \changes{v5.01}{2011/02/24}{Coloring atoms and bonds}
% The last argument (\#7) specifies a line color. 
% This command is used in the definition of |\replaceSKbond| 
% of the \textsf{bondcolor} package by putting \verb/#7=white/. 
% \begin{macro}{\Color@Line}
%    \begin{macrocode}
\def\Color@@@Line{%
\@ifnextchar[{\C@lor@@@Line}{\C@lor@@@Line[0.4pt]}}
\def\C@lor@@@Line[#1](#2,#3)(#4,#5)#6#7{%
\begingroup
\SlopetoXY(#2,#3)(#4,#5){#6}%common to \Put@@@Line command
\psline[unit=\unitlength,%
linewidth=#1,linecolor=#7]
(#2,#3)(\the\@tempcntXa,\the\@tempcntYa)%
\@tempcntXa=0\relax \@tempcntYa=0\relax
\endgroup}%end of \Color@@@Line
\let\Color@Line=\Color@@@Line%for compatibility to PDF mode
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\BackGroundColor}
% \changes{v5.01}{2013/08/16}{For coloring skeletal bond in PS mode}
% This macro is redefined for the PostSript mode. 
%    \begin{macrocode}
\def\BackGroundColor{%
\definecolor{TempColor}{cmyk}{0,0,0,0}%
\psset{linecolor=TempColor}}
%    \end{macrocode}
% \end{macro}
%
% The command |\changeunitlength| is redefined for using pstricks. 
% \begin{macro}{\changeunitlength}
%    \begin{macrocode}
\newif\ifsizereduction\sizereductionfalse
\def\@@changeunitlength#1{\unitlength=#1\relax
%%\psset{unit=\unitlength}%delete August 02, 2005
\ifdim\unitlength<0.1pt \sizereductiontrue
\ifdim\unitlength<0.062pt \let\substfontsize=\tiny \else
\ifdim\unitlength<0.072pt \let\substfontsize=\scriptsize \else
\ifdim\unitlength<0.082pt \let\substfontsize=\footnotesize
\fi\fi\fi
\else \let\substfontsize=\normalsize\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{setxymtxps}
% \changes{v4.02}{2004/12/20}{Added: a switch for wedged bonds}
%    \begin{macrocode}
\def\setxymtxps{%
\@ifnextchar[{\@setxymtxps}{\@setxymtxps[0.1pt]}}
\def\@setxymtxps[#1]{%
\PSmodetrue
\let\sfpicture=\picture
\let\endsfpicture=\endpicture
\let\thicklines=\Thick@Lines
\let\thinlines=\Thin@Lines
\let\Put@Line=\Put@@@Line
\let\Color@Line=\Color@@@Line%for compatibility to PDF mode
\let\Put@Direct=\Put@@@Direct
\let\Put@oCircle=\Put@@@oCircle
\let\Put@sCircle=\Put@@@sCircle
\let\dotorline=\d@@t@rline
\let\WedgeAsSubst=\WedgeAsSubstPS%for compatibility to PDF mode
\let\HashWedgeAsSubst=\HashWedgeAsSubstPS%for compatibility to PDF mode
\let\PutBondLine=\PUT@@@bondLINE%for compatibility to PDF
\let\PutDashedBond=\PUT@@@dashedLINE%for compatibility to PDF mode
\let\putRoundArrow=\putRoundArrowPS%for the compatibility to PDF mode
\let\changeunitlength=\@@changeunitlength
\changeunitlength{#1}%
\wedgehasheddash%
}
\setxymtxps
%</xymtxps>
%    \end{macrocode}
% \end{macro}
%
% \Finale
%
\endinput
