%% The following copyright notice and licensing information was added
%% by Clea F. Rees on behalf of Alexander Berdnikov on 2008/11/03.
%%
%% Copyright 1996 Alexander Berdnikov, Olga Grineva
%%
%% This file is part of pmgraph.
%% 
%% pmgraph is free software: you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation, either version 3 of the License, or
%% (at your option) any later version.
%% 
%% pmgraph is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
%% See the  GNU General Public License for more details.
%% 
%% You should have received a copy of the GNU General Public License
%% along with pmgraph.  If not, see <http://www.gnu.org/licenses/>.

\chardef\oldatcatcode=\catcode`@
\catcode`@=11

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% PMGRAPH.STY --- intermediate version %%
%% of poor-man-graphics style           %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
%  save old LaTeX macro
%

\let\ltx@thinlines=\thinlines
\let\ltx@thicklines=\thicklines
\let\ltx@@getcirc=\@getcirc
\let\ltx@@circ=\@circ
\let\ltx@vector=\vector
\let\ltx@@svector=\@svector
\let\ltx@@getlarrow=\@getlarrow
\let\ltx@@gerlarrow=\@getrarrow



\newif\ifflag@thicklines

\newdimen\@dimenA
\newdimen\@dimenB
\newdimen\@dimenC
\newdimen\@dimenD

% this is \put(x,y) where <x> and <y> are dimensions
\def\@@put#1#2#3{\@killglue\raise#2\hbox to\z@{\hskip #1 #3\hss}}

% dashed or solid vertical line
\def\vdashline#1{%
  \@setdashlength{#1}%
  \ifnum \@dashcnt>0
      \setbox\@dashbox\hbox{\vrule height \@dashdim
                                   width  \@wholewidth}%
      \@tempcnta=0
      \leavevmode
      \lower \@dashdim \hbox{\kern -\@halfwidth
         \vbox{\@whilenum \@tempcnta<\@dashcnt
               \do{\copy\@dashbox \vskip\@tempdimb \advance\@tempcnta by 1}%
      }}%
  \else
      \advance\@tempdima \@halfwidth
      \ifdim \@tempdima>0pt
         \leavevmode\kern -\@halfwidth
         \vrule width  \@wholewidth
                height \@tempdima
                depth  \@halfwidth \relax
      \fi
  \fi
}

% dashed or solid horizontal line
\def\hdashline#1{%
  \@setdashlength{#1}%
  \ifnum \@dashcnt>0
      \setbox\@dashbox\hbox{\vrule width  \@dashdim
                                   height \@halfwidth
                                   depth  \@halfwidth
                            \hskip \@tempdimb}%
      \@tempcnta=0
      \@whilenum \@tempcnta<\@dashcnt
          \do{\copy\@dashbox \advance\@tempcnta by 1}%
  \else
     \advance\@tempdima \@wholewidth
     \ifdim \@tempdima>0pt
        \leavevmode\kern -\@halfwidth
         \vrule width  \@tempdima
                height \@halfwidth
                depth  \@halfwidth \relax
     \fi
  \fi
}

% length of the line is in \@tempdima
% output : \@dashdim is the dash length,
%          \@tempdimb is the dash space
%          \@dashcnt is the number of dashes
\def\@setdashlength#1{%
    \@dashdim=#1\unitlength
    \@tempdimb=0.5\@tempdima \advance\@tempdimb by 0.5\@dashdim
    \@dashcnt=\@tempdimb \@tempcnta=\@dashdim
    \ifnum \@tempcnta>0
           \divide\@dashcnt by \@tempcnta
    \else
           \@dashcnt=0
    \fi
    \advance\@dashcnt by -1
    \ifnum \@dashcnt>0
         \@tempdimb=-\@dashdim \multiply\@tempdimb by \@dashcnt
         \advance\@tempdimb by \@tempdima \advance\@tempdimb by -\@dashdim
         \divide\@tempdimb by \@dashcnt
         \advance\@dashcnt by 1
    \else
         \@tempdimb=0pt\@dashcnt=0
    \fi
}


%%%
%%%  romb frame commands
%%%

\def\romb{\@ifnextchar[{\romb@}{\romb@[c]}}
\def\romb@[#1](#2,#3)#4{\csname romb@#1\endcsname(#2,#3){#4}}

\def\romb@r(#1,#2)#3{%
 \put(-#3,0){\romb@c(#1,#2){#3}}
}

\def\romb@l(#1,#2)#3{%
 \put(#3,0){\romb@c(#1,#2){#3}}
}

\def\romb@c(#1,#2)#3{%
 \put(-#3,0){\line(#1,#2){#3}}
 \put(-#3,0){\line(#1,-#2){#3}}
 \put(#3,0){\line(-#1,#2){#3}}
 \put(#3,0){\line(-#1,-#2){#3}}
}

\def\rombBox{\@ifnextchar[{\@rombBox}{\@rombBox[x]}}
\def\rombBoX{\@ifnextchar[{\@rombBoX}{\@rombBoX[x]}}
\def\rombBOX{\@ifnextchar[{\@rombBOX}{\@rombBOX[x]}}

\def\@rombBox[#1](#2,#3){%
  \leavevmode\hbox to\z@{\baselineskip \z@ \lineskip \z@
    \@HelpRomb{#2}{#3}{0}[#1]%
  }\@makepicbox(#2,#3)}

\def\@rombBoX[#1](#2,#3){%
  \leavevmode\hbox to\z@{\baselineskip \z@ \lineskip \z@
    \@HelpRomb{#2}{#3}{0}[#1]%
    \@HelpRomb{#2}{#3}{1}[#1]%
  }\@makepicbox(#2,#3)}

\def\@rombBOX[#1](#2,#3){%
  \leavevmode\hbox to\z@{\baselineskip \z@ \lineskip \z@
    \@HelpRomb{#2}{#3}{0}[#1]%
    \@HelpRomb{#2}{#3}{1}[#1]%
    \@HelpRomb{#2}{#3}{2}[#1]%
  }\@makepicbox(#2,#3)}

\def\@HelpRomb#1#2#3[#4]{\@makerombslope
    \@dimenA=\@RombL\relax \multiply\@dimenA by #3 \@dimenB=\@dimenA
    \multiply\@dimenA by \@xarg \multiply\@dimenB by \@yarg
    \@dimenC=-\@dimenA \@dimenD=\@dimenC
    \multiply\@dimenA by 2 \@dimenB=\@dimenA
    \advance\@dimenA #1\unitlength \advance\@dimenB #2\unitlength
    \if x#4 \@romblengthX
        \else \if y#4 \@romblengthY
           \else \if z#4 \@romblengthZ
              \else \@romblengthX
    \fi\fi\fi
    \@makeromb}

\def\@makerombslope{%
    \@xarg \@RombX\relax \@yarg \@RombY\relax
    \ifnum \@xarg<0 \@xarg -\@xarg \fi
    \ifnum \@yarg<0 \@yarg -\@yarg \fi
    \ifnum \@xarg=0 \xarg 2 \@yarg 1 \fi
    \ifnum \@yarg=0 \xarg 2 \@yarg 1 \fi
}

\def\@romblengthX{\@linelen=0.5\@dimenA}

\def\@romblengthY{\@linelen=0.5\@dimenB
  \divide\@linelen by \@yarg \multiply\@linelen by \@xarg}

\def\@romblengthZ{\@romblengthY \advance\@linelen by 0.5\@dimenA}

% it is supposed that \@xarg and \@yarg are set to slope values,
% and \@linelen is equal to the length of the romb side
\def\@makeromb{%
  \@makerombhlp \advance\@tempdima by -\@linelen
  \@@put{\@tempdima}{\@tempdimb}{\@sline}%
  \@yarg=-\@yarg
  \@makerombhlp \advance\@tempdima by -\@linelen
  \@@put{\@tempdima}{\@tempdimb}{\@sline}%
  \@xarg=-\@xarg
  \@makerombhlp \advance\@tempdima by \@linelen
  \@@put{\@tempdima}{\@tempdimb}{\@sline}%
  \@yarg=-\@yarg
  \@makerombhlp \advance\@tempdima by \@linelen
  \@@put{\@tempdima}{\@tempdimb}{\@sline}%
}

\def\@makerombhlp{\@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima 0.5\@dimenA \advance\@tempdimb 0.5\@dimenB}

\def\rombboxstyle(#1,#2,#3){\def\@RombX{#1}%
                            \def\@RombY{#2}%
                            \def\@RombL{#3}%
                            \ignorespaces}

%%%
%%%  rect frame commands
%%%

\def\frameBox{\@ifnextchar[{\@frameBox}{\@frameBox[]}}
\def\frameBoX{\@ifnextchar[{\@frameBoX}{\@frameBoX[]}}
\def\frameBOX{\@ifnextchar[{\@frameBOX}{\@frameBOX[]}}

\def\ovalBox{\@ifnextchar[{\@ovalBox}{\@ovalBox[]}}
\def\ovalBoX{\@ifnextchar[{\@ovalBoX}{\@ovalBoX[]}}
\def\ovalBOX{\@ifnextchar[{\@ovalBOX}{\@ovalBOX[]}}

\def\astroBox{\@ifnextchar[{\@astroBox}{\@astroBox[]}}
\def\astroBoX{\@ifnextchar[{\@astroBoX}{\@astroBoX[]}}
\def\astroBOX{\@ifnextchar[{\@astroBOX}{\@astroBOX[]}}

\def\parquetBox{\@ifnextchar[{\@parquetBox}{\@parquetBox[]}}
\def\parquetBoX{\@ifnextchar[{\@parquetBoX}{\@parquetBoX[]}}
\def\parquetBOX{\@ifnextchar[{\@parquetBOX}{\@parquetBOX[]}}

\def\octalBox{\@ifnextchar[{\@octalBox}{\@octalBox[]}}
\def\octalBoX{\@ifnextchar[{\@octalBoX}{\@octalBoX[]}}
\def\octalBOX{\@ifnextchar[{\@octalBOX}{\@octalBOX[]}}

\def\dashBox#1{\@ifnextchar[{\@dashBox{#1}}{\@dashBox{#1}[]}}
\def\dashBoX#1{\@ifnextchar[{\@dashBoX{#1}}{\@dashBoX{#1}[]}}
\def\dashBOX#1{\@ifnextchar[{\@dashBOX{#1}}{\@dashBOX{#1}[]}}

\def\userBox#1#2{\@ifnextchar[{\@userBox{#1}{#2}}{\@userBox{#1}{#2}[]}}
\def\userBoX#1#2{\@ifnextchar[{\@userBoX{#1}{#2}}{\@userBoX{#1}{#2}[]}}
\def\userBOX#1#2{\@ifnextchar[{\@userBOX{#1}{#2}}{\@userBOX{#1}{#2}[]}}

\def\@frameBox[#1](#2,#3){\@makeBox{#2}{#3}{#1}{0}{r}}
\def\@frameBoX[#1](#2,#3){\@makeBoX{#2}{#3}{#1}{0}{r}}
\def\@frameBOX[#1](#2,#3){\@makeBOX{#2}{#3}{#1}{0}{r}}

\def\@ovalBox[#1](#2,#3){\@makeBox{#2}{#3}{#1}{0}{O}}
\def\@ovalBoX[#1](#2,#3){\@makeBoX{#2}{#3}{#1}{0}{O}}
\def\@ovalBOX[#1](#2,#3){\@makeBOX{#2}{#3}{#1}{0}{O}}

\def\@astroBox[#1](#2,#3){\@makeBox{#2}{#3}{#1}{0}{A}}
\def\@astroBoX[#1](#2,#3){\@makeBoX{#2}{#3}{#1}{0}{A}}
\def\@astroBOX[#1](#2,#3){\@makeBOX{#2}{#3}{#1}{0}{A}}

\def\@parquetBox[#1](#2,#3){\@makeBox{#2}{#3}{#1}{0}{P}}
\def\@parquetBoX[#1](#2,#3){\@makeBoX{#2}{#3}{#1}{0}{P}}
\def\@parquetBOX[#1](#2,#3){\@makeBOX{#2}{#3}{#1}{0}{P}}

\def\@octalBox[#1](#2,#3){\@makeBox{#2}{#3}{#1}{0}{L}}
\def\@octalBoX[#1](#2,#3){\@makeBoX{#2}{#3}{#1}{0}{L}}
\def\@octalBOX[#1](#2,#3){\@makeBOX{#2}{#3}{#1}{0}{L}}

\def\@dashBox#1[#2](#3,#4){\@makeBox{#3}{#4}{#2}{#1}{r}}
\def\@dashBoX#1[#2](#3,#4){\@makeBoX{#3}{#4}{#2}{#1}{r}}
\def\@dashBOX#1[#2](#3,#4){\@makeBOX{#3}{#4}{#2}{#1}{r}}

\def\@userBox#1#2[#3](#4,#5){\@makeBox{#4}{#5}{#3}{#2}{#1}}
\def\@userBoX#1#2[#3](#4,#5){\@makeBoX{#4}{#5}{#3}{#2}{#1}}
\def\@userBOX#1#2[#3](#4,#5){\@makeBOX{#4}{#5}{#3}{#2}{#1}}

% #1 = x, #2 = y
% #3 = shadows
% #4 = dash line (real)
% #5 = frame style (,O,A,C,R,???)
%
\def\@makeBox#1#2#3#4#5{%
  \leavevmode\hbox to\z@{\baselineskip \z@ \lineskip \z@
     \@HelpFrame{#1}{#2}{0}{#3}{#4}{#5}%
  }\@makepicbox(#1,#2)}
%
\def\@makeBoX#1#2#3#4#5{%
  \leavevmode\hbox to\z@{\baselineskip \z@ \lineskip \z@
  \ifdim \framesepH>\z@
    \@HelpFrame{#1}{#2}{0}{}{#4}{#5}%
    \@HelpFrame{#1}{#2}{1}{#3}{#4}{#5}%
  \else
    \@HelpFrame{#1}{#2}{1}{}{#4}{#5}%
    \@HelpFrame{#1}{#2}{0}{#3}{#4}{#5}%
  \fi}\@makepicbox(#1,#2)}
%
\def\@makeBOX#1#2#3#4#5{%
  \leavevmode\hbox to\z@{\baselineskip \z@ \lineskip \z@
  \ifdim \framesepH>\z@
       \@HelpFrame{#1}{#2}{0}{}{#4}{#5}%
       \@HelpFrame{#1}{#2}{1}{}{#4}{#5}%
       \@HelpFrame{#1}{#2}{2}{#3}{#4}{#5}%
  \else
       \@HelpFrame{#1}{#2}{2}{}{#4}{#5}%
       \@HelpFrame{#1}{#2}{1}{}{#4}{#5}%
       \@HelpFrame{#1}{#2}{0}{#3}{#4}{#5}%
  \fi}\@makepicbox(#1,#2)}

\def\@warn@corner{\@warning{Unable to draw corner}}

% #1 = x, #2 = y
% #3 = multiple frame
% #4 = list of shadows
% #5 = dash/solid line (real)
% #6 = frame corner style (,O,A,C,R,???)
%
\def\@HelpFrame#1#2#3#4#5#6{%
    \@tempdima=\framesepH\relax \multiply\@tempdima by #3
    \@dimenA=\framesepXM\@tempdima \@dimenB=\framesepYM\@tempdima
    \@dimenC=-\@dimenA \@dimenD=-\@dimenB
    \advance\@dimenA by \framesepXP\@tempdima
    \advance\@dimenB by \framesepYP\@tempdima
    \advance\@dimenA #1\unitlength \advance\@dimenB #2\unitlength
    \advance\@dimenA by \frameexpandX\relax
    \advance\@dimenB by \frameexpandY\relax
    \@@makeframe{#5}{#6}%
    \advance\@dimenA by 2\@wholewidth \advance\@dimenB by 2\@wholewidth
    \advance\@dimenC by -\@wholewidth \advance\@dimenD by -\@wholewidth
    \@setshadowsize
    \@tfor \@tempa := #4 \do
       {\@negargtrue
        \ifdim \@dimenA>0pt \ifdim \@dimenB>0pt
           \csname @rectshadow@\@tempa\endcsname{#5}%
           \@updateshadowsize
           \@negargfalse
        \fi\fi
        \if@negarg \@warning{Shadow position is wrong}\fi
       }%
}

% in subsequent commands:
%  \@dimenA is x-size of the box,
%  \@dimenB is y-size of the box
%  \@dimenC is x-shift, \@dimenD is y-shift

%
%  standard corner
%
\def\@prepdummy{\@ovxx=0pt \@ovyy=0pt
                \@ovdx=0pt \@ovdy=0pt
                \@yyarg=0 \@negargtrue}

\def\@prepframe@R{\@prepdummy}
\def\tl@corner@R{}
\def\tr@corner@R{}
\def\bl@corner@R{}
\def\br@corner@R{}

%
%  Oval corners
%
\def\@prepframe@O{%
  \@tempdima=\RoundCorner\relax \@tempdima=2\@tempdima
  \@negargtrue
  \ifdim \@tempdima>\@dimenA \@negargfalse \fi
  \ifdim \@tempdima>\@dimenB \@negargfalse \fi
  \if@negarg
       \@getcirc\@tempdima \@yyarg=\@tempcnta
       \@ovxx=0.5\wd\@tempboxa \@ovyy=\@ovxx
       \@tempdima=0.5\ht\@tempboxa \advance\@tempdima by -0.5\dp\@tempboxa
       \@ovdx=\@halfwidth \advance\@ovdx by -\@tempdima \@ovdy=\@ovdx
  \else
       \@warn@corner
  \fi
}

\def\tl@corner@O{\@@TLcircle}
\def\tr@corner@O{\@@TRcircle}
\def\bl@corner@O{\@@BLcircle}
\def\br@corner@O{\@@BRcircle}

%
%  Astro corners
%
\def\@prepframe@A{\@prepframe@O}
\def\tl@corner@A{\@@brcircle}
\def\tr@corner@A{\@@blcircle}
\def\bl@corner@A{\@@trcircle}
\def\br@corner@A{\@@tlcircle}

%
%  Parquet corners
%
\def\@prepframe@P{\@negargtrue
  \@tempdima=\RectCorner\relax
  \ifdim \@tempdima>0.5\@dimenA \@negargfalse \fi
  \ifdim \@tempdima>0.5\@dimenB \@negargfalse \fi
  \if@negarg
       \@ovxx=\@tempdima \@ovyy=\@tempdima
       \@yyarg=0 \@ovdx=\@halfwidth \@ovdy=\@halfwidth
  \else
       \@warn@corner
  \fi
}
\def\tl@corner@P{%
    \@tempdima=\@ovyy
    \setbox\@tempboxa\hbox{\kern \@ovxx \raise -\@ovyy
                           \hbox{\vdashline{\@tempa}}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \@tempdima=\@ovxx
    \setbox\@tempboxa\hbox{\kern 0pt \raise -\@ovyy
                           \hbox{\hdashline{\@tempa}}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \setbox\@tempboxa\hbox{}%
}
\def\tr@corner@P{%
    \@tempdima=\@ovyy
    \setbox\@tempboxa\hbox{\kern -\@ovxx \raise -\@ovyy
                           \hbox{\vdashline{\@tempa}}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \@tempdima=\@ovxx
    \setbox\@tempboxa\hbox{\kern -\@ovxx \raise -\@ovyy
                           \hbox{\hdashline{\@tempa}}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \setbox\@tempboxa\hbox{}%
}
\def\bl@corner@P{%
    \@tempdima=\@ovyy
    \setbox\@tempboxa\hbox{\kern \@ovxx \raise 0pt
                           \hbox{\vdashline{\@tempa}}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \@tempdima=\@ovxx
    \setbox\@tempboxa\hbox{\kern 0pt \raise \@ovyy
                           \hbox{\hdashline{\@tempa}}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \setbox\@tempboxa\hbox{}%
}
\def\br@corner@P{%
    \@tempdima=\@ovyy
    \setbox\@tempboxa\hbox{\kern -\@ovxx \raise 0pt
                           \hbox{\vdashline{\@tempa}}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \@tempdima=\@ovxx
    \setbox\@tempboxa\hbox{\kern -\@ovxx \raise \@ovyy
                           \hbox{\hdashline{\@tempa}}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \setbox\@tempboxa\hbox{}%
}

%
%  Ordinary corners: init= \def\@prepframe@D{\@prepframe@P}
%
\def\tl@corner@D{%
    \@tempdima=\@ovyy
    \setbox\@tempboxa\hbox{\raise -\@ovyy
                           \hbox{\vdashline{\@tempa}}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \@tempdima=\@ovxx
    \setbox\@tempboxa\hbox{\hdashline{\@tempa}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \setbox\@tempboxa\hbox{}%
}
\def\tr@corner@D{%
    \@tempdima=\@ovyy
    \setbox\@tempboxa\hbox{\raise -\@ovyy
                           \hbox{\vdashline{\@tempa}}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \@tempdima=\@ovxx
    \setbox\@tempboxa\hbox{\kern -\@ovxx
                           \hbox{\hdashline{\@tempa}}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \setbox\@tempboxa\hbox{}%
}
\def\bl@corner@D{%
    \@tempdima=\@ovyy
    \setbox\@tempboxa\hbox{\vdashline{\@tempa}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \@tempdima=\@ovxx
    \setbox\@tempboxa\hbox{\hdashline{\@tempa}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \setbox\@tempboxa\hbox{}%
}
\def\br@corner@D{%
    \@tempdima=\@ovyy
    \setbox\@tempboxa\hbox{\vdashline{\@tempa}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \@tempdima=\@ovxx
    \setbox\@tempboxa\hbox{\kern -\@ovxx
                           \hbox{\hdashline{\@tempa}}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
    \setbox\@tempboxa\hbox{}%
}

%
%  Octal corners
%
\def\@prepframe@L{%
    \@negargtrue
    \ifnum \@RombX>0 \else \@negargfalse \fi
    \ifnum \@RombY>0 \else \@negargfalse \fi
    \if@negarg
         \ifnum \@RombX>\@RombY
                \@tempdima=\LineCorner\relax
                \@tempdimb=\@tempdima
                \multiply\@tempdimb by \@RombY
                \divide\@tempdimb by \@RombX
         \else
                \@tempdimb=\LineCorner\relax
                \@tempdima=\@tempdimb
                \multiply\@tempdima by \@RombX
                \divide\@tempdima by \@RombY
         \fi
         \ifdim \@tempdima>0.5\@dimenA \@negargfalse \fi
         \ifdim \@tempdimb>0.5\@dimenB \@negargfalse \fi
         \@ovxx=\@tempdima \@ovyy=\@tempdimb
         \ifnum \@RombX>\@RombY
             \ifdim \@ovxx<10pt \@negargfalse \fi
         \else
             \ifdim \@ovyy<10pt \@negargfalse \fi
         \fi
         \if@negarg
             \@ovxx=\@tempdima \@ovyy=\@tempdimb
             \@yyarg=0 \@ovdx=\@halfwidth \@ovdy=\@halfwidth
         \else
             \@warn@corner
         \fi
    \fi
}

\def\tl@corner@L{\@xarg=\@RombX \@yarg=\@RombY \@linelen=\@ovxx
    \hbox{\raise -\@ovyy \hbox{\@sline}}}
\def\tr@corner@L{\@xarg=-\@RombX \@yarg=\@RombY \@linelen=\@ovxx
    \hbox{\raise -\@ovyy \hbox{\@sline}}}
\def\bl@corner@L{\@xarg=\@RombX \@yarg=-\@RombY \@linelen=\@ovxx
    \hbox{\raise \@ovyy \hbox{\@sline}}}
\def\br@corner@L{\@xarg=-\@RombX \@yarg=-\@RombY \@linelen=\@ovxx
    \hbox{\raise \@ovyy \hbox{\@sline}}}

%
%  Black box corners
%
\def\@prepframe@b{\@prepframe@P\@ovdx=0pt\@ovdy=0pt}
\def\tl@corner@b{\@tempdima=\@ovxx \advance\@tempdima by \@halfwidth
                 \@tempdimb=\@ovyy \advance\@tempdimb by \@halfwidth
    \kern -\@halfwidth \raise -\@ovyy
       \hbox{\vrule height \@tempdimb depth 0pt width \@tempdima}}
\def\tr@corner@b{\@tempdima=\@ovxx \advance\@tempdima by \@halfwidth
                 \@tempdimb=\@ovyy \advance\@tempdimb by \@halfwidth
    \kern -\@ovxx \raise -\@ovyy
       \hbox{\vrule height \@tempdimb depth 0pt width \@tempdima}}
\def\bl@corner@b{\@tempdima=\@ovxx \advance\@tempdima by \@halfwidth
                 \@tempdimb=\@ovyy \advance\@tempdimb by \@halfwidth
    \kern -\@halfwidth \raise -\@halfwidth
       \hbox{\vrule height \@tempdimb depth 0pt width \@tempdima}}
\def\br@corner@b{\@tempdima=\@ovxx \advance\@tempdima by \@halfwidth
                 \@tempdimb=\@ovyy \advance\@tempdimb by \@halfwidth
    \kern -\@ovxx \raise -\@halfwidth
        \hbox{\vrule height \@tempdimb depth 0pt width \@tempdima}}

%
%  0.75 Black box corners
%
\def\@prepframe@c{\@prepframe@P}
\def\tl@corner@c{\tl@corner@P\tl@corner@cc}
\def\tr@corner@c{\tr@corner@P\tr@corner@cc}
\def\bl@corner@c{\bl@corner@P\bl@corner@cc}
\def\br@corner@c{\br@corner@P\br@corner@cc}

\def\tl@corner@cc{%
   \@tempdima=0.75\@ovxx \advance\@tempdima by \@halfwidth
   \@tempdimb=0.75\@ovyy \advance\@tempdimb by \@halfwidth
    \setbox\@tempboxa\hbox{\kern -\@halfwidth \raise -0.75\@ovyy
        \hbox{\vrule width \@tempdima depth 0pt height \@tempdimb}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
}
\def\tr@corner@cc{%
   \@tempdima=0.75\@ovxx \advance\@tempdima by \@halfwidth
   \@tempdimb=0.75\@ovyy \advance\@tempdimb by \@halfwidth
    \setbox\@tempboxa\hbox{\kern -0.75\@ovxx \raise -0.75\@ovyy
        \hbox{\vrule width \@tempdima depth 0pt height \@tempdimb}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
}
\def\bl@corner@cc{%
   \@tempdima=0.75\@ovxx \advance\@tempdima by \@halfwidth
   \@tempdimb=0.75\@ovyy \advance\@tempdimb by \@halfwidth
    \setbox\@tempboxa\hbox{\kern -\@halfwidth \raise -\@halfwidth
        \hbox{\vrule width \@tempdima height \@tempdimb depth 0pt}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
}
\def\br@corner@cc{%
   \@tempdima=0.75\@ovxx \advance\@tempdima by \@halfwidth
   \@tempdimb=0.75\@ovyy \advance\@tempdimb by \@halfwidth
    \setbox\@tempboxa\hbox{\kern -0.75\@ovxx \raise -\@halfwidth
        \hbox{\vrule width \@tempdima height \@tempdimb depth 0pt}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
}

%
%  0.5 centered black box corners
%
\def\@prepframe@d{\@prepframe@P}
\def\tl@corner@d{\tl@corner@P\tl@corner@D\tl@corner@dd}
\def\tr@corner@d{\tr@corner@P\tr@corner@D\tr@corner@dd}
\def\bl@corner@d{\bl@corner@P\bl@corner@D\bl@corner@dd}
\def\br@corner@d{\br@corner@P\br@corner@D\br@corner@dd}

\def\@prepframe@e{\@prepframe@P}
\def\tl@corner@e{\tl@corner@D\tl@corner@dd}
\def\tr@corner@e{\tr@corner@D\tr@corner@dd}
\def\bl@corner@e{\bl@corner@D\bl@corner@dd}
\def\br@corner@e{\br@corner@D\br@corner@dd}

\def\@prepframe@f{\@prepframe@P}
\def\tl@corner@f{\tl@corner@P\tl@corner@dd}
\def\tr@corner@f{\tr@corner@P\tr@corner@dd}
\def\bl@corner@f{\bl@corner@P\bl@corner@dd}
\def\br@corner@f{\br@corner@P\br@corner@dd}

\def\tl@corner@dd{%
    \@tempdima=0.25\@ovxx  \advance\@tempdima by 0.5\@halfwidth
    \@tempdimb=-0.75\@ovyy \advance\@tempdimb by -0.5\@halfwidth
    \setbox\@tempboxa\hbox{\kern \@tempdima \raise \@tempdimb
        \hbox{\vrule width 0.5\@ovxx depth 0pt height 0.5\@ovyy}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
}
\def\tr@corner@dd{%
    \@tempdima=-0.75\@ovxx \advance\@tempdima by -0.5\@halfwidth
    \@tempdimb=-0.75\@ovyy \advance\@tempdimb by -0.5\@halfwidth
    \setbox\@tempboxa\hbox{\kern \@tempdima \raise \@tempdimb
        \hbox{\vrule width 0.5\@ovxx depth 0pt height 0.5\@ovyy}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
}
\def\bl@corner@dd{%
    \@tempdima=0.25\@ovxx \advance\@tempdima by 0.5\@halfwidth
    \@tempdimb=0.25\@ovyy \advance\@tempdimb by 0.5\@halfwidth
    \setbox\@tempboxa\hbox{\kern \@tempdima \raise \@tempdimb
        \hbox{\vrule width 0.5\@ovxx height 0.5\@ovyy depth 0pt}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
}
\def\br@corner@dd{%
    \@tempdima=-0.75\@ovxx \advance\@tempdima by -0.5\@halfwidth
    \@tempdimb=0.25\@ovyy  \advance\@tempdimb by 0.5\@halfwidth
    \setbox\@tempboxa\hbox{\kern \@tempdima \raise \@tempdimb
        \hbox{\vrule width 0.5\@ovxx height 0.5\@ovyy depth 0pt}}%
    \wd\@tempboxa=0pt \copy\@tempboxa
}

%
%  circle blobs at the corners
%
\def\@prepframe@o{\@tempdima=\DiskCorner\relax
    \get@Disk\@tempdima
    \if@negarg
       \@yyarg=\@tempcnta \@ovxx=0.5\wd\@tempboxa
       \@ovyy=\@ovxx \@ovdx=\@halfwidth \@ovdy=\@ovdx
       \ifdim \@ovxx>0.25\@dimenA \@negargfalse \fi
       \ifdim \@ovxx>0.25\@dimenB \@negargfalse \fi
    \fi
    \if@negarg \else \@warn@corner \fi
}
\def\tl@corner@o{%
   \kern \@ovxx \raise -\@ovyy \hbox{\@circlefnt \char\@tempcnta}}
\def\tr@corner@o{%
   \kern -\@ovxx \raise -\@ovyy \hbox{\@circlefnt \char\@tempcnta}}
\def\bl@corner@o{%
   \kern \@ovxx \raise \@ovyy \hbox{\@circlefnt \char\@tempcnta}}
\def\br@corner@o{%
   \kern -\@ovxx \raise \@ovyy \hbox{\@circlefnt \char\@tempcnta}}

%%%
%%%  frame drawing routine
%%%

\def\@@makeframe#1#2{\@ovxx=0pt \@ovyy=0pt \@ovdx=0pt \@ovdy=0pt
  \@yyarg=0 \@negargfalse
  \csname @prepframe@#2\endcsname
  \if@negarg
     \def\@tempa{#1}%
     \@tempdima=\@dimenC \advance\@tempdima by -\@halfwidth
     \@tempdimb=\@dimenD \advance\@tempdimb by -\@halfwidth
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                    \csname bl@corner@#2\endcsname}%
     \@tempdima=\@dimenC \advance\@tempdima by \@halfwidth
                         \advance\@tempdima by \@dimenA
     \@tempdimb=\@dimenD \advance\@tempdimb by -\@halfwidth
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                    \csname br@corner@#2\endcsname}%
     \@tempdima=\@dimenC \advance\@tempdima by -\@halfwidth
     \@tempdimb=\@dimenD \advance\@tempdimb by \@halfwidth
                         \advance\@tempdimb by \@dimenB
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                    \csname tl@corner@#2\endcsname}%
     \@tempdima=\@dimenC \advance\@tempdima by \@halfwidth
                         \advance\@tempdima by \@dimenA
     \@tempdimb=\@dimenD \advance\@tempdimb by \@halfwidth
                         \advance\@tempdimb by \@dimenB
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                    \csname tr@corner@#2\endcsname}%
  \fi
  \@tempdima=\@dimenC \advance\@tempdima by -\@halfwidth
  \@tempdimb=\@dimenD \advance\@tempdimb by -\@halfwidth
                      \advance\@tempdimb by \@ovyy
                      \advance\@tempdimb by \@ovdy
  \@@put{\@tempdima}{\@tempdimb}{%
               \@tempdima=\@dimenB \advance\@tempdima by \@wholewidth
                                   \advance\@tempdima by -2\@ovyy
                                   \advance\@tempdima by -2\@ovdy
               \vdashline{#1}}%
  \@tempdima=\@dimenC \advance\@tempdima by \@halfwidth
                      \advance\@tempdima by \@dimenA
  \@tempdimb=\@dimenD \advance\@tempdimb by -\@halfwidth
                      \advance\@tempdimb by \@ovyy
                      \advance\@tempdimb by \@ovdy
  \@@put{\@tempdima}{\@tempdimb}{%
               \@tempdima=\@dimenB \advance\@tempdima by \@wholewidth
                                   \advance\@tempdima by -2\@ovyy
                                   \advance\@tempdima by -2\@ovdy
               \vdashline{#1}}%
  \@tempdima=\@dimenC \advance\@tempdima by -\@halfwidth
                      \advance\@tempdima by \@ovxx
                      \advance\@tempdima by \@ovdx
  \@tempdimb=\@dimenD \advance\@tempdimb by -\@halfwidth
  \@@put{\@tempdima}{\@tempdimb}{%
               \@tempdima=\@dimenA \advance\@tempdima by \@wholewidth
                                   \advance\@tempdima by -2\@ovxx
                                   \advance\@tempdima by -2\@ovdx
               \hdashline{#1}}%
  \@tempdima=\@dimenC \advance\@tempdima by -\@halfwidth
                      \advance\@tempdima by \@ovxx
                      \advance\@tempdima by \@ovdx
  \@tempdimb=\@dimenD \advance\@tempdimb by \@halfwidth
                      \advance\@tempdimb by \@dimenB
  \@@put{\@tempdima}{\@tempdimb}{%
               \@tempdima=\@dimenA \advance\@tempdima by \@wholewidth
                                   \advance\@tempdima by -2\@ovxx
                                   \advance\@tempdima by -2\@ovdx
               \hdashline{#1}}%
}


%%%
%%%  shadow drawing routines
%%%

%
%  draw shadow corner(s)
%

\def\@HelpshadowA#1#2{%
     \@tempdima=\@dimenC \@tempdimb=\@dimenD
     \advance\@tempdima by \@dimenA \advance\@tempdima by \@shadowsizeX
     \advance\@tempdimb by \@dimenB \advance\@tempdimb by -\@shadowstepY
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                          \csname tr@corner@#2\endcsname}%
     \@tempdima=\@dimenC \@tempdimb=\@dimenD
     \advance\@tempdima by \@dimenA \advance\@tempdima by \@shadowsizeX
     \advance\@tempdimb by -\@shadowsizeY
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                          \csname br@corner@#2\endcsname}%
     \@tempdima=\@dimenC  \@tempdimb=\@dimenD
     \advance\@tempdima by \@shadowstepX \advance\@tempdimb by -\@shadowsizeY
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                          \csname bl@corner@#2\endcsname}%
}

\def\@HelpshadowB#1#2{%
     \@tempdima=\@dimenC \@tempdimb=\@dimenD
     \advance\@tempdima by \@shadowstepX
     \advance\@tempdimb by \@dimenB \advance\@tempdimb by \@shadowsizeY
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                          \csname tl@corner@#2\endcsname}%
     \@tempdima=\@dimenC \@tempdimb=\@dimenD
     \advance\@tempdima by \@dimenA \advance\@tempdima by \@shadowsizeX
     \advance\@tempdimb by \@shadowstepY
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                          \csname br@corner@#2\endcsname}%
     \@tempdima=\@dimenC \@tempdimb=\@dimenD
     \advance\@tempdima by \@dimenA \advance\@tempdima by \@shadowsizeX
     \advance\@tempdimb by \@dimenB \advance\@tempdimb by \@shadowsizeY
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                          \csname tr@corner@#2\endcsname}%
}

\def\@HelpshadowC#1#2{%
     \@tempdima=\@dimenC \@tempdimb=\@dimenD
     \advance\@tempdima by -\@shadowsizeX
     \advance\@tempdimb by \@shadowstepY
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                          \csname bl@corner@#2\endcsname}%
     \@tempdima=\@dimenC \@tempdimb=\@dimenD
     \advance\@tempdima by \@dimenA \advance\@tempdima by -\@shadowstepX
     \advance\@tempdimb by \@dimenB \advance\@tempdimb by \@shadowsizeY
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                          \csname tr@corner@#2\endcsname}%
     \@tempdima=\@dimenC \@tempdimb=\@dimenD
     \advance\@tempdima by -\@shadowsizeX
     \advance\@tempdimb by \@dimenB \advance\@tempdimb by \@shadowsizeY
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                          \csname tl@corner@#2\endcsname}%
}

\def\@HelpshadowD#1#2{%
     \@tempdima=\@dimenC \@tempdimb=\@dimenD
     \advance\@tempdima by -\@shadowsizeX
     \advance\@tempdimb by -\@shadowsizeY
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                          \csname bl@corner@#2\endcsname}%
     \@tempdima=\@dimenC \@tempdimb=\@dimenD
     \advance\@tempdima by -\@shadowstepX \advance\@tempdima by \@dimenA
     \advance\@tempdimb by -\@shadowsizeY
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                          \csname br@corner@#2\endcsname}%
     \@tempdima=\@dimenC \@tempdimb=\@dimenD
     \advance\@tempdima by -\@shadowsizeX
     \advance\@tempdimb by -\@shadowstepY \advance\@tempdimb by \@dimenB
     \@@put{\@tempdima}{\@tempdimb}{\@tempcnta=\@yyarg
                          \csname tl@corner@#2\endcsname}%
}

%
%  draw line shadow frame
%

\def\@helpshadowA#1{%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by \@dimenA
    \advance\@tempdimb by \@dimenB \advance\@tempdimb by -\@shadowstepY
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@shadowsizeX
                                   \advance\@tempdima by -\@ovxx
                                   \advance\@tempdima by -\@ovdx
                                   \hdashline{#1}}%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by \@dimenA \advance\@tempdima by \@shadowsizeX
    \advance\@tempdimb by -\@shadowsizeY \advance\@tempdimb by \@ovyy
                                         \advance\@tempdimb by \@ovdy
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@dimenB
                                   \advance\@tempdima by \@shadowsizeY
                                   \advance\@tempdima by -\@shadowstepY
                                   \advance\@tempdima by -2\@ovyy
                                   \advance\@tempdima by -2\@ovdy
                                   \vdashline{#1}}%
    \@tempdima=\@dimenC  \@tempdimb=\@dimenD
    \advance\@tempdima by \@shadowstepX
    \advance\@tempdimb by -\@shadowsizeY \advance\@tempdimb by \@ovyy
                                         \advance\@tempdimb by \@ovdy
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@shadowsizeY
                                   \advance\@tempdima by -\@ovyy
                                   \advance\@tempdima by -\@ovdy
                                   \vdashline{#1}}%
    \@tempdima=\@dimenC  \@tempdimb=\@dimenD
    \advance\@tempdima by \@shadowstepX \advance\@tempdima by \@ovxx
                                        \advance\@tempdima by \@ovdx
    \advance\@tempdimb by -\@shadowsizeY
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@dimenA
                                   \advance\@tempdima by \@shadowsizeX
                                   \advance\@tempdima by -\@shadowstepX
                                   \advance\@tempdima by -2\@ovxx
                                   \advance\@tempdima by -2\@ovdx
                                   \hdashline{#1}}%
}

\def\@helpshadowB#1{%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by \@shadowstepX
    \advance\@tempdimb by \@dimenB
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@shadowsizeY
                                   \advance\@tempdima by -\@ovyy
                                   \advance\@tempdima by -\@ovdy
                                   \vdashline{#1}}%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by \@shadowstepX \advance\@tempdima by \@ovxx
                                        \advance\@tempdima by \@ovdx
    \advance\@tempdimb by \@dimenB \advance\@tempdimb by \@shadowsizeY
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@dimenA
                                   \advance\@tempdima by \@shadowsizeX
                                   \advance\@tempdima by -\@shadowstepX
                                   \advance\@tempdima by -2\@ovxx
                                   \advance\@tempdima by -2\@ovdx
                                   \hdashline{#1}}%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by \@dimenA
    \advance\@tempdimb by \@shadowstepY
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@shadowsizeX
                                   \advance\@tempdima by -\@ovxx
                                   \advance\@tempdima by -\@ovdx
                                   \hdashline{#1}}%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by \@dimenA \advance\@tempdima by \@shadowsizeX
    \advance\@tempdimb by \@shadowstepY \advance\@tempdimb by \@ovyy
                                        \advance\@tempdimb by \@ovdy
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@dimenB
                                   \advance\@tempdima by \@shadowsizeY
                                   \advance\@tempdima by -\@shadowstepY
                                   \advance\@tempdima by -2\@ovyy
                                   \advance\@tempdima by -2\@ovdy
                                   \vdashline{#1}}%
}

\def\@helpshadowC#1{%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by -\@shadowsizeX \advance\@tempdima by \@ovxx
                                         \advance\@tempdima by \@ovdx
    \advance\@tempdimb by \@shadowstepY
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@shadowsizeX
                                   \advance\@tempdima by -\@ovxx
                                   \advance\@tempdima by -\@ovdx
                                   \hdashline{#1}}%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by -\@shadowsizeX
    \advance\@tempdimb by \@shadowstepY \advance\@tempdimb by \@ovyy
                                        \advance\@tempdimb by \@ovdy
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@dimenB
                                   \advance\@tempdima by \@shadowsizeY
                                   \advance\@tempdima by -\@shadowstepY
                                   \advance\@tempdima by -2\@ovyy
                                   \advance\@tempdima by -2\@ovdy
                                   \vdashline{#1}}%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by \@dimenA \advance\@tempdima by -\@shadowstepX
    \advance\@tempdimb by \@dimenB
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@shadowsizeY
                                   \advance\@tempdima by -\@ovyy
                                   \advance\@tempdima by -\@ovdy
                                   \vdashline{#1}}%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by -\@shadowsizeX \advance\@tempdima by \@ovxx
                                         \advance\@tempdima by \@ovdx
    \advance\@tempdimb by \@dimenB \advance\@tempdimb by \@shadowsizeY
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@dimenA
                                   \advance\@tempdima by \@shadowsizeX
                                   \advance\@tempdima by -\@shadowstepX
                                   \advance\@tempdima by -2\@ovxx
                                   \advance\@tempdima by -2\@ovdx
                                   \hdashline{#1}}%
}

\def\@helpshadowD#1{%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by -\@shadowsizeX \advance\@tempdima by \@ovxx
                                         \advance\@tempdima by \@ovdx
    \advance\@tempdimb by -\@shadowsizeY
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@dimenA
                                   \advance\@tempdima by \@shadowsizeX
                                   \advance\@tempdima by -\@shadowstepX
                                   \advance\@tempdima by -2\@ovxx
                                   \advance\@tempdima by -2\@ovdx
                                   \hdashline{#1}}%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by -\@shadowstepX \advance\@tempdima by \@dimenA
    \advance\@tempdimb by -\@shadowsizeY \advance\@tempdimb by \@ovyy
                                         \advance\@tempdimb by \@ovdy
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@shadowsizeY
                                   \advance\@tempdima by -\@ovyy
                                   \advance\@tempdima by -\@ovdy
                                   \vdashline{#1}}%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by -\@shadowsizeX
    \advance\@tempdimb by -\@shadowsizeY \advance\@tempdimb by \@ovyy
                                         \advance\@tempdimb by \@ovdy
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@dimenB
                                   \advance\@tempdima by \@shadowsizeY
                                   \advance\@tempdima by -\@shadowstepY
                                   \advance\@tempdima by -2\@ovyy
                                   \advance\@tempdima by -2\@ovdy
                                   \vdashline{#1}}%
    \@tempdima=\@dimenC \@tempdimb=\@dimenD
    \advance\@tempdima by -\@shadowsizeX \advance\@tempdima by \@ovxx
                                         \advance\@tempdima by \@ovdx
    \advance\@tempdimb by -\@shadowstepY \advance\@tempdimb by \@dimenB
    \@@put{\@tempdima}{\@tempdimb}{\@tempdima=\@shadowsizeX
                                   \advance\@tempdima by -\@ovxx
                                   \advance\@tempdima by -\@ovdx
                                   \hdashline{#1}}%
}

%
%  draw solid shadow frame
%

\def\@helpShadowA#1{% #1 is ignored here
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by \@shadowstepX  \advance\@tempdima by \@ovxx
                                       \advance\@tempdima by \@ovdx
  \advance\@tempdimb by -\@shadowsizeY
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdima=\@dimenA \advance\@tempdima by \@shadowsizeX
                             \advance\@tempdima by -\@shadowstepX
                             \advance\@tempdima by -2\@ovxx
                             \advance\@tempdima by -2\@ovdx
         \@tempdimb=\@shadowsizeY
         \vrule height \@tempdimb width \@tempdima}%
%
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by \@shadowstepX
  \advance\@tempdimb by -\@shadowsizeY \advance\@tempdimb by \@ovyy
                                       \advance\@tempdimb by \@ovdy
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdima=\@dimenA \advance\@tempdima by \@shadowsizeX
                             \advance\@tempdima by -\@shadowstepX
         \@tempdimb=\@shadowsizeY \advance\@tempdimb by -\@ovyy
                                  \advance\@tempdimb by -\@ovdy
         \vrule height \@tempdimb width \@tempdima}%
%
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by \@dimenA
  \advance\@tempdimb by -\@shadowsizeY \advance\@tempdimb by \@ovyy
                                       \advance\@tempdimb by \@ovdy
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdimb=\@dimenB \advance\@tempdimb by \@shadowsizeY
                             \advance\@tempdimb by -\@shadowstepY
                             \advance\@tempdimb by -2\@ovyy
                             \advance\@tempdimb by -2\@ovdy
         \@tempdima=\@shadowsizeX
         \vrule height \@tempdimb width \@tempdima}%
%
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by \@dimenA
  \advance\@tempdimb by -\@shadowsizeY
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdimb=\@dimenB \advance\@tempdimb by \@shadowsizeY
                             \advance\@tempdimb by -\@shadowstepY
         \@tempdima=\@shadowsizeX \advance\@tempdima by -\@ovxx
                                  \advance\@tempdima by -\@ovdx
         \vrule height \@tempdimb width \@tempdima}%
}

\def\@helpShadowB#1{% #1 is ignored here
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by \@shadowstepX  \advance\@tempdima by \@ovxx
                                       \advance\@tempdima by \@ovdx
  \advance\@tempdimb by \@dimenB
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdima=\@dimenA \advance\@tempdima by \@shadowsizeX
                             \advance\@tempdima by -\@shadowstepX
                             \advance\@tempdima by -2\@ovxx
                             \advance\@tempdima by -2\@ovdx
         \@tempdimb=\@shadowsizeY
         \vrule height \@tempdimb width \@tempdima}%
%
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by \@shadowstepX
  \advance\@tempdimb by \@dimenB
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdima=\@dimenA \advance\@tempdima by \@shadowsizeX
                             \advance\@tempdima by -\@shadowstepX
         \@tempdimb=\@shadowsizeY \advance\@tempdimb by -\@ovyy
                                  \advance\@tempdimb by -\@ovdy
         \vrule height \@tempdimb width \@tempdima}%
%
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by \@dimenA
  \advance\@tempdimb by \@shadowstepY \advance\@tempdimb by \@ovyy
                                      \advance\@tempdimb by \@ovdy
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdimb=\@dimenB \advance\@tempdimb by \@shadowsizeY
                             \advance\@tempdimb by -\@shadowstepY
                             \advance\@tempdimb by -2\@ovyy
                             \advance\@tempdimb by -2\@ovdy
         \@tempdima=\@shadowsizeX
         \vrule height \@tempdimb width \@tempdima}%
%
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by \@dimenA
  \advance\@tempdimb by \@shadowstepY
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdimb=\@dimenB \advance\@tempdimb by \@shadowsizeY
                             \advance\@tempdimb by -\@shadowstepY
         \@tempdima=\@shadowsizeX \advance\@tempdima by -\@ovxx
                                  \advance\@tempdima by -\@ovdx
         \vrule height \@tempdimb width \@tempdima}%
}

\def\@helpShadowC#1{% #1 is ignored here
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by -\@shadowsizeX  \advance\@tempdima by \@ovxx
                                        \advance\@tempdima by \@ovdx
  \advance\@tempdimb by \@dimenB
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdima=\@dimenA \advance\@tempdima by \@shadowsizeX
                             \advance\@tempdima by -\@shadowstepX
                             \advance\@tempdima by -2\@ovxx
                             \advance\@tempdima by -2\@ovdx
         \@tempdimb=\@shadowsizeY
         \vrule height \@tempdimb width \@tempdima}%
%
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by -\@shadowsizeX
  \advance\@tempdimb by \@dimenB
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdima=\@dimenA \advance\@tempdima by \@shadowsizeX
                             \advance\@tempdima by -\@shadowstepX
         \@tempdimb=\@shadowsizeY \advance\@tempdimb by -\@ovyy
                                  \advance\@tempdimb by -\@ovdy
         \vrule height \@tempdimb width \@tempdima}%
%
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by -\@shadowsizeX
  \advance\@tempdimb by \@shadowstepY \advance\@tempdimb by \@ovyy
                                      \advance\@tempdimb by \@ovdy
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdimb=\@dimenB \advance\@tempdimb by \@shadowsizeY
                             \advance\@tempdimb by -\@shadowstepY
                             \advance\@tempdimb by -2\@ovyy
                             \advance\@tempdimb by -2\@ovdy
         \@tempdima=\@shadowsizeX
         \vrule height \@tempdimb width \@tempdima}%
%
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by -\@shadowsizeX \advance\@tempdima by \@ovxx
                                       \advance\@tempdima by \@ovdx
  \advance\@tempdimb by \@shadowstepY
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdimb=\@dimenB \advance\@tempdimb by \@shadowsizeY
                             \advance\@tempdimb by -\@shadowstepY
         \@tempdima=\@shadowsizeX \advance\@tempdima by -\@ovxx
                                  \advance\@tempdima by -\@ovdx
         \vrule height \@tempdimb width \@tempdima}%
}


\def\@helpShadowD#1{% #1 is ignored here
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by -\@shadowsizeX  \advance\@tempdima by \@ovxx
                                        \advance\@tempdima by \@ovdx
  \advance\@tempdimb by -\@shadowsizeY
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdima=\@dimenA \advance\@tempdima by \@shadowsizeX
                             \advance\@tempdima by -\@shadowstepX
                             \advance\@tempdima by -2\@ovxx
                             \advance\@tempdima by -2\@ovdx
         \@tempdimb=\@shadowsizeY
         \vrule height \@tempdimb width \@tempdima}%
%
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by -\@shadowsizeX
  \advance\@tempdimb by -\@shadowsizeY \advance\@tempdimb by \@ovyy
                                       \advance\@tempdimb by \@ovdy
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdima=\@dimenA \advance\@tempdima by \@shadowsizeX
                             \advance\@tempdima by -\@shadowstepX
         \@tempdimb=\@shadowsizeY \advance\@tempdimb by -\@ovyy
                                  \advance\@tempdimb by -\@ovdy
         \vrule height \@tempdimb width \@tempdima}%
%
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by -\@shadowsizeX
  \advance\@tempdimb by -\@shadowsizeY \advance\@tempdimb by \@ovyy
                                      \advance\@tempdimb by \@ovdy
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdimb=\@dimenB \advance\@tempdimb by \@shadowsizeY
                             \advance\@tempdimb by -\@shadowstepY
                             \advance\@tempdimb by -2\@ovyy
                             \advance\@tempdimb by -2\@ovdy
         \@tempdima=\@shadowsizeX
         \vrule height \@tempdimb width \@tempdima}%
%
  \@tempdima=\@dimenC \@tempdimb=\@dimenD
  \advance\@tempdima by -\@shadowsizeX \advance\@tempdima by \@ovxx
                                       \advance\@tempdima by \@ovdx
  \advance\@tempdimb by -\@shadowsizeY
  \@@put{\@tempdima}{\@tempdimb}{%
         \@tempdimb=\@dimenB \advance\@tempdimb by \@shadowsizeY
                             \advance\@tempdimb by -\@shadowstepY
         \@tempdima=\@shadowsizeX \advance\@tempdima by -\@ovxx
                                  \advance\@tempdima by -\@ovdx
         \vrule height \@tempdimb width \@tempdima}%
}

%
%  correct shadow position before drawing
%

\def\@Help@A{\advance\@dimenC  \shadowsepX\relax
             \advance\@dimenD -\shadowsepY\relax}
\def\@Help@B{\advance\@dimenC  \shadowsepX\relax
             \advance\@dimenD  \shadowsepY\relax}
\def\@Help@C{\advance\@dimenC -\shadowsepX\relax
             \advance\@dimenD  \shadowsepY\relax}
\def\@Help@D{\advance\@dimenC -\shadowsepX\relax
             \advance\@dimenD -\shadowsepY\relax}
%
%  correct shadow position after drawing
%

\def\@help@A{\advance\@dimenC  \shadowstepX\relax
             \advance\@dimenC  \@halfwidth
             \advance\@dimenD -\shadowstepY\relax
             \advance\@dimenD -\@halfwidth}
\def\@help@B{\advance\@dimenC  \shadowstepX\relax
             \advance\@dimenC  \@halfwidth
             \advance\@dimenD  \shadowstepY\relax
             \advance\@dimenD  \@halfwidth}
\def\@help@C{\advance\@dimenC -\shadowstepX\relax
             \advance\@dimenC -\@halfwidth
             \advance\@dimenD  \shadowstepY\relax
             \advance\@dimenD  \@halfwidth}
\def\@help@D{\advance\@dimenC -\shadowstepX\relax
             \advance\@dimenC -\@halfwidth
             \advance\@dimenD -\shadowstepY\relax
             \advance\@dimenD -\@halfwidth}

%%
%%  shadow types
%%

%
%   pure rectangle
%

\def\@rectshadow@R#1{%
    \csname @Help@\s@corn\endcsname
    \@prepdummy
    \csname @helpshadow\s@corn\endcsname{#1}%
    \csname @help@\s@corn\endcsname}

\def\@rectshadow@r#1{%
    \csname @Help@\s@corn\endcsname
    \@prepdummy
    \csname @helpShadow\s@corn\endcsname{#1}%
    \csname @help@\s@corn\endcsname}

%
%  parquet shadows
%

\def\@prepshadow@P{\@tempdima=\RectCorner\relax
    \ifdim \@tempdima>\@shadowsizeX\relax \@negargfalse \fi
    \ifdim \@tempdima>\@shadowsizeY\relax \@negargfalse \fi
    \@ovxx=\@tempdima \@ovyy=\@tempdima
    \@yyarg=0 \@ovdx=\@halfwidth \@ovdy=\@halfwidth
}

\def\@rectshadow@P#1{%
    \csname @Help@\s@corn\endcsname
    \@prepshadow@P
    \if@negarg
          \def\@tempa{#1}\csname @Helpshadow\s@corn\endcsname{#1}{P}%
    \else
         \@prepdummy
         \@warn@corner
    \fi
    \csname @helpshadow\s@corn\endcsname{#1}%
    \csname @help@\s@corn\endcsname}

\def\@rectshadow@p#1{%
    \csname @Help@\s@corn\endcsname
    \@prepshadow@P
    \if@negarg
    \else
         \@prepdummy
         \@warn@corner
    \fi
    \csname @helpShadow\s@corn\endcsname{#1}%
    \csname @help@\s@corn\endcsname}

\def\@rectshadow@B#1{%
    \csname @Help@\s@corn\endcsname
    \@prepshadow@P
    \if@negarg
          \def\@tempa{#1}\csname @Helpshadow\s@corn\endcsname{#1}{c}%
    \else
         \@prepdummy
         \@warn@corner
    \fi
    \csname @helpshadow\s@corn\endcsname{#1}%
    \csname @help@\s@corn\endcsname}

\def\@rectshadow@b#1{%
    \csname @Help@\s@corn\endcsname
    \@prepshadow@P
    \if@negarg
          \def\@tempa{#1}\csname @Helpshadow\s@corn\endcsname{#1}{cc}%
    \else
         \@prepdummy
         \@warn@corner
    \fi
    \csname @helpShadow\s@corn\endcsname{#1}%
    \csname @help@\s@corn\endcsname}

%
%  octal shadows
%

\def\@prepshadow@L{\@negargtrue
    \@ovxx=0pt \@ovyy=0pt \@ovdx=0pt \@ovdy=0pt
    \ifnum \@RombX>0 \else \@negargfalse \fi
    \ifnum \@RombY>0 \else \@negargfalse \fi
    \if@negarg
         \ifnum \@RombX>\@RombY
                \@tempdima=\LineCorner\relax
                \@tempdimb=\@tempdima
                \multiply\@tempdimb by \@RombY
                \divide\@tempdimb by \@RombX
         \else
                \@tempdimb=\LineCorner\relax
                \@tempdima=\@tempdimb
                \multiply\@tempdima by \@RombX
                \divide\@tempdima by \@RombY
         \fi
         \ifdim \@tempdima>\@shadowsizeX\relax \@negargfalse \fi
         \ifdim \@tempdimb>\@shadowsizeY\relax \@negargfalse \fi
         \@ovxx=\@tempdima \@ovyy=\@tempdimb
         \ifnum \@RombX>\@RombY
             \ifdim \@ovxx<10pt \@negargfalse \fi
         \else
             \ifdim \@ovyy<10pt \@negargfalse \fi
         \fi
         \if@negarg
             \@ovxx=\@tempdima \@ovyy=\@tempdimb
             \@yyarg=0 \@ovdx=\@halfwidth \@ovdy=\@halfwidth
         \fi
    \fi
}

\def\@rectshadow@L#1{%
    \csname @Help@\s@corn\endcsname
    \@prepshadow@L
    \if@negarg
          \csname @Helpshadow\s@corn\endcsname{#1}{L}%
    \else
          \@prepdummy
          \@warn@corner
    \fi
    \csname @helpshadow\s@corn\endcsname{#1}%
    \csname @help@\s@corn\endcsname}

%
%   oval shadows
%
\def\@prepshadow@O{\@negargtrue
    \@tempdima=\RoundCorner\relax
    \ifdim \@tempdima>\@shadowsizeX\relax \@negargfalse \fi
    \ifdim \@tempdima>\@shadowsizeY\relax \@negargfalse \fi
    \if@negarg \@tempdima=2\@tempdima \@getcirc\@tempdima \fi
    \if@negarg
         \@ovxx=0.5\wd\@tempboxa \@ovyy=\@ovxx \@yyarg=\@tempcnta
         \@tempdima=0.5\ht\@tempboxa
         \advance\@tempdima by -0.5\dp\@tempboxa
         \@ovdx=\@halfwidth \advance\@ovdx by -\@tempdima
         \@ovdy=\@ovdx
    \fi
}

\def\@rectshadow@O#1{%
    \csname @Help@\s@corn\endcsname
    \@prepshadow@O
    \if@negarg
         \csname @Helpshadow\s@corn\endcsname{#1}{O}%
    \else
         \@prepdummy
         \@warn@corner
    \fi
    \csname @helpshadow\s@corn\endcsname{#1}%
    \csname @help@\s@corn\endcsname}

\def\@prepshadow@o{%
    \@tempdima=\DiskCorner\relax
    \get@Disk\@tempdima
    \if@negarg
       \@yyarg=\@tempcnta \@ovxx=0.5\wd\@tempboxa
       \@ovyy=\@ovxx \@ovdx=\@halfwidth \@ovdy=\@ovdx
       \ifdim 2\@ovxx>\@shadowsizeX\relax \@negargfalse \fi
       \ifdim 2\@ovxx>\@shadowsizeY\relax \@negargfalse \fi
    \fi
}

\def\@rectshadow@o#1{%
    \csname @Help@\s@corn\endcsname
    \@prepshadow@o
    \if@negarg
          \csname @Helpshadow\s@corn\endcsname{#1}{o}%
    \else
         \@prepdummy
         \@warn@corner
    \fi
    \csname @helpShadow\s@corn\endcsname{#1}%
    \csname @help@\s@corn\endcsname}

%
%   astro shadows
%

\def\@prepshadow@A{\@negargtrue
    \@tempdima=\RoundCorner\relax
    \ifdim \@tempdima>\@shadowsizeX\relax \@negargfalse \fi
    \ifdim \@tempdima>\@shadowsizeY\relax \@negargfalse \fi
    \if@negarg \@tempdima=2\@tempdima \@getcirc\@tempdima \fi
    \if@negarg
         \@ovxx=0.5\wd\@tempboxa \@ovyy=\@ovxx \@yyarg=\@tempcnta
         \@tempdima=0.5\ht\@tempboxa
         \advance\@tempdima by -0.5\dp\@tempboxa
         \@ovdx=\@halfwidth \advance\@ovdx by -\@tempdima
         \@ovdy=\@ovdx
    \fi
}

\def\@rectshadow@A#1{%
    \csname @Help@\s@corn\endcsname
    \@prepshadow@A
    \if@negarg
         \csname @Helpshadow\s@corn\endcsname{#1}{A}%
    \else
         \@prepdummy
         \@warn@corner
    \fi
    \csname @helpshadow\s@corn\endcsname{#1}%
    \csname @help@\s@corn\endcsname}

%
%  set frame/corner parameters
%

\def\framesep#1{\def\framesepH{#1}%
                \def\framesepXM{1.0}\def\framesepYM{1.0}%
                \def\framesepXP{1.0}\def\framesepYP{1.0}%
                \frameexpand{0pt}%
                \ignorespaces}

\def\frameexpand#1{\def\frameexpandX{#1}%
                   \def\frameexpandY{#1}%
                   \ignorespaces}

\def\shadowsep#1{\def\shadowsepX{#1}%
                 \def\shadowsepY{#1}%
                 \ignorespaces}

\def\shadowsize#1{\def\shadowstepX{#1}\def\shadowstepY{#1}%
                  \def\shadowsizeX{#1}\def\shadowsizeY{#1}%
                  \shadowshrink{1.0}\shadowminsize{0pt}%
                  \ignorespaces}

\def\shadowminsize#1{\def\shadowminsizeX{#1}%
                     \def\shadowminsizeY{#1}%
                     \ignorespaces}

\def\shadowshrink#1{%
    \def\shadowshrinkstepX{#1}\def\shadowshrinkstepY{#1}%
    \def\shadowshrinksizeX{#1}\def\shadowshrinksizeY{#1}%
    \ignorespaces}

\def\shadowcorner#1{%
   \if A#1\relax \def\s@corn{A}%
       \else \if a#1\relax \def\s@corn{A}%
         \else \if B#1\relax \def\s@corn{B}%
           \else \if b#1\relax \def\s@corn{B}%
             \else \if C#1\relax \def\s@corn{C}%
               \else \if c#1\relax \def\s@corn{C}%
                 \else \if D#1\relax \def\s@corn{D}%
                   \else \if d#1\relax \def\s@corn{D}%
                 \else \@warning{Illegal shadow corner (#1)}%
   \fi\fi\fi\fi\fi\fi\fi\fi
   \ignorespaces}

\def\@setshadowsize{%
    \let\@shadowstepX=\shadowstepX
    \let\@shadowstepY=\shadowstepY
    \let\@shadowsizeX=\shadowsizeX
    \let\@shadowsizeY=\shadowsizeY
}

\def\@updateshadowsize{%
    \advance\@dimenA by \@shadowsizeX
    \advance\@dimenA by -\@shadowstepX
    \advance\@dimenB by \@shadowsizeY
    \advance\@dimenB by -\@shadowstepY
    \@shrink@size{\@shadowstepX}{\shadowshrinkstepX}%
    \@shrink@size{\@shadowstepY}{\shadowshrinkstepY}%
    \@shrink@size{\@shadowsizeX}{\shadowshrinksizeX}%
    \@shrink@size{\@shadowsizeY}{\shadowshrinksizeY}%
    \@tempdima=\@shadowstepX \advance\@tempdima by \shadowminsizeX
    \ifdim \@tempdima<\@dimenA \relax \else \@dimenA=0pt \fi
    \@tempdima=\@shadowstepY \advance\@tempdima by \shadowminsizeY
    \ifdim \@tempdima<\@dimenB \relax \else \@dimenB=0pt \fi
}

\def\@shrink@size#1#2{%
    \@tempdima=#1\relax
    \@tempdima=#2\@tempdima\relax
    \edef #1{\the\@tempdima}%
}

%%%%%%% !!!!!!!!!!!!!!!!!!!! %%%%%%%%%%%%%
%%%%%%% These are CIRC macro %%%%%%%%%%%%%
%%%%%%% !!!!!!!!!!!!!!!!!!!! %%%%%%%%%%%%%

\def\mcircle@scaled{1000}

\def\define@circlefnt{%
  \ifflag@thicklines
      \font\m@circlefnt=lcirclew10 scaled \mcircle@scaled
  \else
      \font\m@circlefnt=lcircle10  scaled \mcircle@scaled
  \fi
  \let\@circlefnt=\m@circlefnt \ignorespaces}


\def\magcircle#1{%
  \edef\mcircle@scaled{%
     \if 0#1 1000
       \else \if h#1 1095
           \else \if 1#1 1200
              \else \if 2#1 1440
                 \else \if 3#1 1728
                    \else \if 4#1 2074
                       \else \if 5#1 2488
                          \else 1000
     \fi\fi\fi\fi\fi\fi\fi
  }\define@circlefnt \ignorespaces}

\def\scaledcircle#1{%
  \def\mcircle@scaled{#1}%
  \ifnum #1>0 \def\mcircle@scaled{#1}%
        \else \def\mcircle@scaled{1000}%
  \fi
  \define@circlefnt \ignorespaces}

\def\circle@factor{%
   \ifdim \@tempdima>16.383pt
        \divide\@tempdima by \mcircle@scaled\relax
        \multiply\@tempdima by 1000
   \else
        \multiply\@tempdima by 1000
        \divide\@tempdima by \mcircle@scaled\relax
   \fi
}

%%%
%%%  These macro are from LaTeX with some corrections
%%%

% now set thin/thick flag and update circle scaled font
%
\def\thinlines{\flag@thicklinesfalse\define@circlefnt
  \let\@linefnt\tenln \let\@circlefnt\tencirc
  \@wholewidth\fontdimen8\tenln \@halfwidth .5\@wholewidth}

% now set thin/thick flag and update circle scaled font
%
\def\thicklines{\flag@thicklinestrue\define@circlefnt
  \let\@linefnt\tenlnw \let\@circlefnt\tencircw
  \@wholewidth\fontdimen8\tenlnw \@halfwidth .5\@wholewidth}

% calculate \@tempcnta = oval char code,
%           \@tempboxa = base char,
%           \@tempdima = diameter.
% it is corrected to scale circle font and to indicate
% diameter error: \@negarg = false if diameter is too small
%
\def\@getcirc#1{\@tempdima #1\relax \circle@factor
  \advance\@tempdima 2\p@ \@tempcnta\@tempdima
  \@tempdima 4\p@ \divide\@tempcnta\@tempdima
  \ifnum \@tempcnta >10\relax \@tempcnta 10\relax\fi
  \ifnum \@tempcnta >\z@ \advance\@tempcnta\m@ne \@negargtrue
    \else \@warning{Oval segment is too small}\@negargfalse \fi
  \multiply\@tempcnta 4\relax
  \setbox \@tempboxa \hbox{\@circlefnt \char \@tempcnta}%
  \@tempdima \wd \@tempboxa}

% this macro draws blobs and disks,
% it is corrected to scale circle font
%
\def\@circ#1#2{\get@circcode{#1}%
   \advance\@tempcnta #2\relax
   \@circlefnt \char\@tempcnta}


%%%
%%%  New circle macros
%%%

%  calculate \@tempcnta = blob/circle char code
\def\get@circcode#1{\@tempdima=#1\relax
    \circle@factor \@negargfalse
    \advance\@tempdima by 0.5pt
    \@tempcnta=\@tempdima \@tempdima=1pt
    \divide\@tempcnta by \@tempdima
    \ifnum \@tempcnta>15\relax \@tempcnta=15\relax \fi
    \ifnum \@tempcnta>0\relax \advance\@tempcnta by -1 \@negargtrue \fi
}

% it calculates \@tempcnta = blob char code
%               \@tempboxa = base char,
%               \@tempdima = diameter.
\def\get@Disk#1{\get@circcode{#1}%
    \advance\@tempcnta by 112
    \setbox\@tempboxa\hbox{\@circlefnt \char\@tempcnta}%
}


% it calculates \@tempcnta = circle char code
%               \@tempboxa = base char,
%               \@tempdima = diameter.
\def\get@Circle#1{\get@circcode{#1}%
    \advance\@tempcnta by 96
    \setbox\@tempboxa\hbox{\@circlefnt \char\@tempcnta}%
}

%
%  top right segment: \put(10,10){\trcircle{10}}
\def\trcircle#1{\@trcircle{#1\unitlength}}
\def\@trcircle#1{\@tempdima #1\relax \@getcirc\@tempdima \@@trcircle}
\def\@@trcircle{\sbox{\@tempboxa}{\hbox{\@circlefnt \char \@tempcnta}}%
              \@tempdima 0.5\wd \@tempboxa
              \@tempdimb 0.5\ht \@tempboxa
              \advance \@tempdimb -0.5\dp \@tempboxa
              \advance \@tempdima -\@tempdimb
              \hbox{\kern  \@tempdima
                    \lower -\@tempdima
                    \hbox{\usebox\@tempboxa}}%
              \sbox{\@tempboxa}{}%
              }
%
%  bottom right segment: \put(10,10){\brcircle{10}}
\def\brcircle#1{\@brcircle{#1\unitlength}}
\def\@brcircle#1{\@tempdima #1\relax \@getcirc\@tempdima \@@brcircle}
\def\@@brcircle{\advance\@tempcnta 1\relax
              \sbox{\@tempboxa}{\hbox{\@circlefnt \char \@tempcnta}}%
              \@tempdima 0.5\wd \@tempboxa
              \@tempdimb 0.5\ht \@tempboxa
              \advance \@tempdimb -0.5\dp \@tempboxa
              \advance \@tempdima -\@tempdimb
              \advance \@tempdimb 0.5\wd \@tempboxa
              \hbox{\kern  \@tempdima
                    \lower \@tempdimb
                    \hbox{\usebox\@tempboxa}}%
              \sbox{\@tempboxa}{}%
              }
%
%  bottom left segment: \put(10,10){\blcircle{10}}
\def\blcircle#1{\@blcircle{#1\unitlength}}
\def\@blcircle#1{\@tempdima #1\relax \@getcirc\@tempdima \@@blcircle}
\def\@@blcircle{\advance\@tempcnta 2\relax
              \sbox{\@tempboxa}{\hbox{\@circlefnt \char \@tempcnta}}%
              \@tempdima 0.5\wd \@tempboxa
              \@tempdimb 0.5\ht \@tempboxa
              \advance \@tempdimb -0.5\dp \@tempboxa
              \advance \@tempdimb \@tempdima
              \hbox{\kern  -\@tempdimb
                    \lower \@tempdimb
                    \hbox{\usebox\@tempboxa}}%
              \sbox{\@tempboxa}{}%
              }
%
%  top left segment: \put(10,10){\tlcircle{10}}
\def\tlcircle#1{\@tlcircle{#1\unitlength}}
\def\@tlcircle#1{\@tempdima #1\relax \@getcirc\@tempdima \@@tlcircle}
\def\@@tlcircle{\advance\@tempcnta 3\relax
              \sbox{\@tempboxa}{\hbox{\@circlefnt \char \@tempcnta}}%
              \@tempdima 0.5\wd \@tempboxa
              \@tempdimb 0.5\ht \@tempboxa
              \advance \@tempdimb -0.5\dp \@tempboxa
              \advance \@tempdimb \@tempdima
              \hbox{\kern  -\@tempdimb
                    \lower -\@tempdima
                    \hbox{\usebox\@tempboxa}}%
              \sbox{\@tempboxa}{}%
              }
%

\def\TRcircle#1{\@TRcircle{#1\unitlength}}
\def\@TRcircle#1{\@tempdima #1\relax \@getcirc\@tempdima \@@TRcircle}
\def\@@TRcircle{\sbox{\@tempboxa}{\hbox{\@circlefnt \char \@tempcnta}}%
         \@tempdimb 0.5\ht\@tempboxa \advance\@tempdimb -0.5\dp\@tempboxa
         \hbox{\kern  -\@tempdimb
               \raise -\@tempdimb
               \hbox{\usebox\@tempboxa}}%
         \sbox{\@tempboxa}{}%
}

\def\BRcircle#1{\@BRcircle{#1\unitlength}}
\def\@BRcircle#1{\@tempdima #1\relax \@getcirc\@tempdima \@@BRcircle}
\def\@@BRcircle{\advance\@tempcnta 1\relax
         \sbox{\@tempboxa}{\hbox{\@circlefnt \char \@tempcnta}}%
         \@tempdimb 0.5\ht\@tempboxa \advance\@tempdimb -0.5\dp\@tempboxa
         \hbox{\kern  -\@tempdimb
               \raise -\@tempdimb
               \hbox{\usebox\@tempboxa}}%
         \sbox{\@tempboxa}{}%
}

\def\BLcircle#1{\@BLcircle{#1\unitlength}}
\def\@BLcircle#1{\@tempdima #1\relax \@getcirc\@tempdima \@@BLcircle}
\def\@@BLcircle{\advance\@tempcnta 2\relax
         \sbox{\@tempboxa}{\hbox{\@circlefnt \char \@tempcnta}}%
         \@tempdimb 0.5\ht\@tempboxa \advance\@tempdimb -0.5\dp\@tempboxa
         \hbox{\kern  -\@tempdimb
               \raise -\@tempdimb
               \hbox{\usebox\@tempboxa}}%
         \sbox{\@tempboxa}{}%
}


\def\TLcircle#1{\@TLcircle{#1\unitlength}}
\def\@TLcircle#1{\@tempdima #1\relax \@getcirc\@tempdima \@@TLcircle}
\def\@@TLcircle{\advance\@tempcnta 3\relax
         \sbox{\@tempboxa}{\hbox{\@circlefnt \char \@tempcnta}}%
         \@tempdimb 0.5\ht\@tempboxa \advance\@tempdimb -0.5\dp\@tempboxa
         \hbox{\kern  -\@tempdimb
               \raise -\@tempdimb
               \hbox{\usebox\@tempboxa}}%
         \sbox{\@tempboxa}{}%
}

%%%%%%% !!!!!!!!!!!!!!!!!!!!!! %%%%%%%%%%%%%
%%%%%%% These are VECTOR macro %%%%%%%%%%%%%
%%%%%%% !!!!!!!!!!!!!!!!!!!!!! %%%%%%%%%%%%%


% parameters for vector arrows:
%    \if@negarg shows that the arrow is rotated by 180^{\circ}
%    \@tempb is the relative position of the point of alignment
%    \@tempa is the alignment style:
%       e - arrow
%       b - backside
%       m - middle
%       E - above arrow
%       B - before backside
\def\Vec@e{\def\@tempa{e}\def\@tempb{1.0}\@negargfalse}
\def\Vec@E{\def\@tempa{b}\def\@tempb{1.0}\@negargtrue}
\def\Vec@b{\def\@tempa{b}\def\@tempb{0.0}\@negargfalse}
\def\Vec@B{\def\@tempa{e}\def\@tempb{0.0}\@negargtrue}
\def\Vec@m{\def\@tempa{m}\def\@tempb{0.5}\@negargfalse}
\def\Vec@M{\def\@tempa{m}\def\@tempb{0.5}\@negargtrue}
\def\Vec@x{\def\@tempa{E}\def\@tempb{1.0}\@negargfalse}
\def\Vec@X{\def\@tempa{B}\def\@tempb{1.0}\@negargtrue}
\def\Vec@z{\def\@tempa{B}\def\@tempb{0.0}\@negargfalse}
\def\Vec@Z{\def\@tempa{E}\def\@tempb{0.0}\@negargtrue}

\def\VectorStyle[#1]#2#3#4{%
    \expandafter\edef\csname Vec@#1\endcsname{%
        \def\@tempa{#2}\def\@tempb{#3}%
        \if b#4 \@negargtrue \else \@negargfalse \fi
    }%
}

\def\@VecA@e{\@tempdimb 0pt}
\def\@VecA@b{\@tempdimb 4pt}
\def\@VecA@m{\@tempdimb 3pt}
\def\@VecA@E{\@tempdimb -2pt}
\def\@VecA@B{\@tempdimb 6pt}

\def\VectorShiftStyle[#1]#2{%
    \expandafter\edef\csname @VecA@#1\endcsname{\@tempdimb #2\relax}%
}

\def\Vector{\@ifnextchar[{\@Vector}{\@Vector[e]}}

\def\@Vector[#1](#2,#3)#4{%
    \@put{0pt}{0pt}{\line(#2,#3){#4}}%
    \@tfor\@tempa:=#1\do{%
           \def\@tempb{x} \csname Vec@\@tempa\endcsname
           \if\@tempb x\relax \else
%              % \@tempdima is the length factor,
              \ifnum #2=\z@ \@tempdima #4\unitlength
                     \else \ifnum #2<\z@ \@tempdima -#4\unitlength
                                  \else \@tempdima #4\unitlength \fi
                           \divide\@tempdima#2
              \fi
%              % \@tempb contains fraction (0 <= \@tempb <= 1),
              \@tempdima \@tempb\@tempdima\relax
%              % \@tempa is the alignment type -- set \@tempdimb = shift
              \@tempdimb 0pt\relax \csname @VecA@\@tempa\endcsname
%              % assign square root value to \@tempa
              \@VecSqrt{#2}{#3}%
%              % correct alignment shift
              \@tempdimb \@tempa\@tempdimb\relax
              \if@negarg \advance\@tempdima -\@tempdimb
                   \else \advance\@tempdima \@tempdimb \fi
%              % calculate final value
              \@tempdimb \@tempdima\relax
              \@tempdima #2\@tempdima\relax
              \@tempdimb #3\@tempdimb\relax
%              % get character
              \if@negarg \@xarg -#2\relax \@yarg -#3\relax
                 \else \@xarg #2\relax \@yarg #3\relax
              \fi
              \setbox\@linechar\hbox{\@linefnt
                   \ifnum \@xarg=0 \ifnum \@yarg>0 \char'66\relax
                                          \else \char'77\relax \fi
                   \else
                   \ifnum \@xarg<0 \@getlarrow(-\@xarg,-\@yarg)%
                          \else \@getrarrow(\@xarg,\@yarg)%
                   \fi\fi}%
%              % this is \put(x,y)
              \ifnum \@xarg>0 \advance\@tempdima -\wd\@linechar \fi
              \ifnum \@yarg>0 \advance\@tempdimb -\ht\@linechar \fi
              \@@put{\@tempdima}{\@tempdimb}{\box\@linechar}%
           \fi%
    }% enddo \@tfor
}

% assign square root value to \@tempa
\def\@VecSqrt#1#2{\@xarg #1\relax \@yarg #2\relax
 \ifnum\@xarg<0 \@xarg -\@xarg \fi
 \ifnum\@yarg<0 \@yarg -\@yarg \fi
 \ifnum\@xarg<\@yarg \@yyarg \@xarg \relax \@xarg \@yarg \relax
                     \@yarg \@yyarg \relax \fi
 \edef\@tempa{%
 \ifcase \@xarg     0.0
 \or \ifcase \@yarg 1.0
             \else  0.70710678
     \fi
 \or \ifcase \@yarg 1.0
             \or    0.44721360
             \else  0.35355339
     \fi
 \or \ifcase \@yarg 1.0
             \or    0.31622777
             \or    0.27735010
             \else  0.23570226
     \fi
 \or \ifcase \@yarg 1.0
             \or    0.24253563
             \or    0.22360680
             \or    0.20000000
             \else  0.17677670
     \fi
 \or \ifcase \@yarg 1.0
             \or    0.19611614
             \or    0.18569534
             \or    0.17149859
             \or    0.15617376
             \else  0.14142136
     \fi
 \or \ifcase \@yarg 1.0
             \or    0.16439899
             \or    0.15811388
             \or    0.14907120
             \or    0.13867505
             \or    0.12803688
             \else  0.11785113
     \fi
 \else 0.0
 \fi}%
}

%%%
%%% these are LaTeX macro which are corrected
%%% to suite our purposes
%%%

\def\vector(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax
\@tempcnta \ifnum\@xarg<\z@ -\@xarg\else\@xarg\fi
\ifnum\@tempcnta<7\relax  %% corr: 7 instead of 5
\@linelen #3\unitlength
\ifnum\@xarg =\z@ \@vvector
  \else \ifnum\@yarg =\z@ \@hvector \else \@svector\fi
\fi
\else\@badlinearg\fi}


\def\@svector{%      %% corr: \@sline is moved from this place
\@tempcnta\@yarg \ifnum\@tempcnta <\z@ \@tempcnta -\@tempcnta\fi
\ifnum\@tempcnta <7  %% corr: 7 instead of 5
  \@sline            %% corr: \@sline is moved to this place
%% original text was:
%  \hskip -\wd\@linechar
%  \@upordown\@clnht \hbox{\@linefnt  \if@negarg
%  \@getlarrow(\@xarg,\@yyarg)\else \@getrarrow(\@xarg,\@yyarg)\fi}%
%% corrected text:
  \if@negarg \hskip -\wd\@linechar \fi
  \ifnum \@yarg>\z@ \advance\@clnht \ht\@linechar \fi
  \setbox\@linechar\hbox{\@linefnt \if@negarg \@getlarrow(\@xarg,\@yyarg)%
                                        \else \@getrarrow(\@xarg,\@yyarg)%
                                   \fi}%
  \if@negarg \else \hskip -\wd\@linechar \fi
  \ifnum \@yarg>\z@ \advance\@clnht -\ht\@linechar \fi
  \@upordown\@clnht \copy\@linechar
\else\@badlinearg\fi}


%% calculate (\@tempcnta,\@tempcntb) as correct vector slopes
\def\@corrgetarrow#1#2{\@tempcnta #1\relax \@tempcntb #2\relax
\ifnum #2<\z@ \@tempcntb -\@tempcntb \fi
\ifcase \@tempcnta\relax % no action for x=0
   \or \ifnum \@tempcntb>4 \@tempcntb 4 \fi % action for x=1
   \or \ifnum \@tempcntb=5 \@tempcnta 1 \@tempcntb 3 \fi % action for x=2
   \or \ifnum \@tempcntb=5 \@tempcnta 2 \@tempcntb 3 \fi % action for x=3
   \or \ifnum \@tempcntb=5 \@tempcnta 3 \@tempcntb 4 \fi % action for x=4
   \or \ifcase \@tempcntb\relax % 5,0
               \or \@tempcnta 4% 5,1
               \or \@tempcnta 3 \@tempcntb 1 % 5,2
               \or \@tempcnta 3 \@tempcntb 2 % 5,3
               \or \@tempcnta 4 \@tempcntb 3 % 5,4
               \or \@tempcnta 1 \@tempcntb 1 % 5,5
               \or \@tempcnta 3 \@tempcntb 4 % 5,6
       \fi % action for x=5
   \or \ifnum \@tempcntb=1 \@tempcnta 4 \fi % 6,1
       \ifnum \@tempcntb=5 \@tempcnta 4 \@tempcntb 3 \fi % 6,5
       % action for x=6
\fi
\ifnum #2<\z@ \@tempcntb -\@tempcntb \fi
}

\def\@getlarrow(#1,#2){%% this macro is corrected
\@corrgetarrow{#1}{#2}%
\ifnum \@tempcntb=\z@ \@tempcnta'33
  \else \multiply\@tempcnta \sixt@@n
        \advance\@tempcnta -9
        \multiply\@tempcntb \tw@
        \ifnum \@tempcntb >\z@ \advance\@tempcnta \@tempcntb
           \else \advance\@tempcnta -\@tempcntb
                 \advance\@tempcnta 64
        \fi
\fi
\char\@tempcnta}

\def\@getrarrow(#1,#2){%% this macro is corrected
\@corrgetarrow{#1}{#2}%
\ifnum\@tempcntb <\z@ \@tempcntb -\@tempcntb\relax\fi
\ifcase \@tempcntb \@tempcnta'55
        \or \ifnum \@tempcnta<\thr@@ \multiply\@tempcnta 24
                                     \advance\@tempcnta -6
             \else \ifnum \@tempcnta=\thr@@ \@tempcnta 49
                   \else\@tempcnta 58 \fi
             \fi
        \or \ifnum \@tempcnta<\thr@@ \multiply\@tempcnta 24
                                     \advance\@tempcnta -\thr@@
             \else \@tempcnta 51 \fi
        \or \multiply\@tempcnta \sixt@@n
            \advance\@tempcnta -\tw@
      \else \multiply\@tempcnta \sixt@@n
            \advance\@tempcnta 7
\fi
\ifnum #2<\z@ \advance\@tempcnta 64 \fi
\char\@tempcnta}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%     The command \pictureunit[percent]{xsize}
%     selects the value of \unitlength so that the picture
%     which is xsize units in width occupies percent
%     width of the paper. By default percent=100 which
%     correspond to 90% of the total width of the paper.
%     \pictureunit calculates \unitlength corectly also for
%     twocolumn mode and inside itemize/enumerate/etc.
%
%     Example:
%       \pictureunit{75}
%       \begin{picture}(120,80)
%       .....
%
%     Default percentage value can be changed by
%        \renewcommand{\defaultpercent}{50}
%
%     Environment mcpicture combines \pictureunit and
%     \begin{picture}-\end{picture}.
%
%        \begin{Picture}(120,80)(-60,-40)
%        .......
%        \end{Picture}
%
%     Optional parameter can contain percent width value
%     which is used instead of \defaultpercent:
%
%        \begin{Picture}[50](120,80)(-60,-40)
%        .......
%        \end{Picture}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\pictureunit{\@ifnextchar[{\mc@scaleunit}{\mc@scaleunit[\defaultpercent]}}

\def\mc@scaleunit[#1]#2{\@tempdima=0.009\hsize
                        \@tempdima=#1\@tempdima
                        \@tempdimb=#2pt
                        \@divide{\@tempdima}{\@tempdimb}%
                                {\@tempdima}{\unitlength}%
                        \unitlength=\@tempdima}

\newenvironment{Picture}{}{}

\def\Picture{\@ifnextchar[{\mc@picture}{\mc@picture[\defaultpercent]}}

\def\mc@picture[#1](#2,#3){%
     \mc@scaleunit[#1]{#2}%
     \picture(#2,#3)}

\def\endPicture{\endpicture}


% *********************************************************************
% *** The following macros are taken from PiCTeX with minor changes ***
% *********************************************************************

% DIVISION  (Does long division of dimension registers)
% **   \@divide{DIVIDEND}{DIVISOR}{RESULT}{default}

% **  \@divide DIVIDEND [by] DIVISOR [to get] ANSWER
% **  Divides the dimension DIVIDEND by the dimension DIVISOR, placing the
% **  quotient in the dimension register ANSWER.  Values are understood to
% **  be in points.  E.g.  12.5pt/1.4pt=8.92857pt.
% **  Quotient is accurate to 1/65536pt=2**[-16]pt
% **  |DIVISOR| should be < 2048pt (about 28 inches).
\def\@divide#1#2#3#4{%
\ifdim #2=\z@ #3=#4\relax
\else
  \@dimenB=#1%                      **  dimB  holds current remainder (r)
  \@dimenC=#2%                      **  dimC  holds divisor (d)
  \@dimenD=\@dimenB%                **  dimD  holds quotient q=r/d for this
  \divide \@dimenD \@dimenC%        **    step, in units of scaled pts
  \@dimenA=\@dimenD%                **  dimA  eventually holds answer (a)
  \multiply\@dimenD \@dimenC%       **  r <-- r - dq
  \advance\@dimenB -\@dimenD%       **  First step complete. Have integer part
%                                   **  of a, and corresponding remainder.
  \@dimenD=\@dimenC%                **  Temporarily use dimD to hold |d|
    \ifdim\@dimenD<\z@ \@dimenD=-\@dimenD
  \fi
  \ifdim\@dimenD<64pt%              **  Branch on the magnitude of |d|
    \@divstep[256]\@divstep[256]%
  \else
% **  The following code handles divisors  d  with
% **    (1)  .88in =  64pt <= d <  256pt =  3.54in
% **    (2) 3.54in = 256pt <= d < 2048pt = 28.34in
% **  Anything bigger than that may result in an overflow condition.
     \ifdim\@dimenD<256pt
       \@divstep[64]\@divstep[32]\@divstep[32]%
     \else
       \@divstep[8]\@divstep[8]\@divstep[8]\@divstep[8]\@divstep[8]%
       \@dimenA=2\@dimenA
     \fi
% **  For our purposes, we should never even see case (2).
  \fi
  #3=\@dimenA
\fi\ignorespaces}


% **  The following macro does the real long division work.
\def\@divstep[#1]{%                 **  #1 = "B"
  \@dimenB=#1\@dimenB%              **  r <-- B*r
  \@dimenD=\@dimenB%                **  dimD  holds quotient q=r/d for this
    \divide \@dimenD by \@dimenC%   **    step, in units of scaled pts
  \@dimenA=#1\@dimenA%              **  a <-- B*a + q
    \advance\@dimenA by \@dimenD%
  \multiply\@dimenD by \@dimenC%    **  r <-- r - dq
    \advance\@dimenB by -\@dimenD}

% ************************************************
% ******** End of PiCTeX division macros *********
% ************************************************


%%%%%%% !!!!!!!!!!!!!!!!!! %%%%%%%%%%%%%
%%%%%%% Default style data %%%%%%%%%%%%%
%%%%%%% !!!!!!!!!!!!!!!!!! %%%%%%%%%%%%%

\def\defaultpercent{100}

\thinlines

\def\DiskCorner{5pt}
\def\RoundCorner{5pt}
\def\LineCorner{10pt}
\def\RectCorner{5pt}

\framesep{4pt}
\shadowsep{1pt}
\shadowsize{5pt}
\shadowshrink{1}

\shadowcorner{A}

\rombboxstyle(2,1,2pt)

%
%  save updated LaTeX macro
%


%
%  switch two modes
%

\let\grf@thinlines=\thinlines
\let\grf@thicklines=\thicklines
\let\grf@@getcirc=\@getcirc
\let\grf@@circ=\@circ
\let\grf@vector=\vector
\let\grf@@svector=\@svector
\let\grf@@getlarrow=\@getlarrow
\let\grf@@gerlarrow=\@getrarrow


\def\setlatexmacro{%
    \let\thinlines=\ltx@thinlines
    \let\thicklines=\ltx@thicklines
    \let\@getcirc=\ltx@@getcirc
    \let\@circ=\ltx@@circ
    \let\vector=\ltx@vector
    \let\@svector=\ltx@@svector
    \let\@getlarrow=\ltx@@getlarrow
    \let\@gerlarrow=\ltx@@getrarrow
    \ignorespaces
}

\def\settestmacro{%
    \let\thinlines=\grf@thinlines
    \let\thicklines=\grf@thicklines
    \let\@getcirc=\grf@@getcirc
    \let\@circ=\grf@@circ
    \let\vector=\grf@vector
    \let\@svector=\grf@@svector
    \let\@getlarrow=\grf@@getlarrow
    \let\@gerlarrow=\grf@@getrarrow
    \ignorespaces
}

%
\catcode`@=\oldatcatcode
%