%% 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/>.

\documentstyle[12pt,a4,pmgraph]{article}

\title{{\sc pmgraph.sty}: some useful macros which extends
the \LaTeX{} environment {\tt picture}\\[0.5\baselineskip]
\Large Version 1.0}

\author{
\begin{minipage}{0.4\textwidth}
\begin{center} A.S.Berdnikov\\{\tt berd{\sl @}ianin.spb.su} \end{center}
\end{minipage}
\hfill
\begin{minipage}{0.4\textwidth}
\begin{center} O.A.Grineva\\{\tt olga{\sl @}ianin.spb.su} \end{center}
\end{minipage}
}

\date{}

\def\PiC{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC\spacefactor1000 }
\font\manual=logo10 at 12pt
\def\MF{{\manual META}\-{\manual FONT}\spacefactor1000 }
\def\AW{Addison\kern.1em-\penalty 0pt \hskip 0pt Wesley}
\def\CandT{{\sl Computers \& Typesetting}}
\def\TUB{{\sl TUGboat\/}}

\newcommand{\bs}{\char '134 }  % char \
\newcommand{\lb}{\char '173 }  % char {
\newcommand{\rb}{\char '175 }  % char }
\makeatletter
\def\hackersmile{\@ifnextchar[{\@hackersmile}{\@hackersmile[10]}}
\def\@hackersmile[#1]{\hbox{%
   \unitlength=1pt\relax
   \unitlength=#1\unitlength
   \divide\unitlength by 10\relax
   \thicklines
   \raise -3\unitlength \hbox{%
   \begin{picture}(12,12)(-6,-6)
   \put(0,0){\circle{10}}
   \put(-2,1.75){\circle*{1}}
   \put(2,1.75){\circle*{1}}
   \thicklines
   \put(-2.75,3){\line(1,0){1.5}}
   \put(2.75,3){\line(-1,0){1.5}}
   \put(0,-1){\line(0,1){3}}
   \put(-2.5,-2.5){\line(1,0){5}}
   \put(-2.5,-2.5){\line(0,1){1}}
   \put(2.5,-2.5){\line(0,1){1}}
   \end{picture}%
}}}
\makeatother

\newcommand{\pmg}{{\sc pmgraph}}
\newcommand{\pmgs}{{\sc pmgraph.sty}}

\begin{document}
\maketitle


The original \TeX/\LaTeX{} possibilities to create
pictures are relatively poor, and there are
many extensions ({\tt epic/eepic}, {\tt pictex}, {\tt drawtex},
{\tt xypic}, {\tt mfpic}, etc.) which were created to extend
its possibilities to a higher level. The macro \pmgs{}
({\em  poor-man-graphics}) which are
described here are not so general as the ones cited
above. They manupulate with the pseudo-graphical
fonts which are used by generic \LaTeX{} without additional
extensions --- mainly because the variations of
\PiC\TeX{}, \MF{} and new graphical font
themes are already realized by other authors
and on sufficiently higher level.
To some extend the purpose of our work was to see
how far it is possible to move in the development of new
useful graphical primitives for \LaTeX{} {\em without}
the investment of the external graphical tools.

The style file \pmgs{} includes the following features:
\begin{itemize}
\item
the vectors with a set of slopes which is
as general as the line slopes implemented in \LaTeX;
\item
the vectors with an arrow at the beginning,
at the middle or at the end of vector with various orientations
of the arrow;
\item
the circles and circular arcs with nearly arbitrary diameter
using magnified {\tt circle} and {\tt circlew} \LaTeX{} fonts;
\item
the 1/4 circular arcs correctly positioned
at the centrum or at the corner;
\item
extended set of frames which include various
corner style and the optional multiple frame shadows
with a variety of styles;
\item
tools which enable the user to extend the variety of
frame styles and the shadow styles as far as his/her
fantasy allows it;
\item
automatic calculation of the picture size in terms
of the current text width --- including the {\tt picture}
inserted inside list environments.
\end{itemize}
Even not very complicated, these macros appears to
be useful in our work, and it seems that they can be
useful for other \TeX-users too.

\section*{Vectors}

The number of angles for inclined lines which can be used
in \LaTeX{} is limited to great extend, but the number of
angles for  {\em vectors} is limited even more.
The variety of vectors can be extended if instead of the
{\em strictly} inclined arrows at the end of the inclined
line the arrow with the {\em approximate} inclination is added.
Corresponding changes are incorporated in \pmg{} where
the relation between strict inclinations and approximate
inclinations are shown in Table~\ref{Tab1}. The corrections require
the modifications of the internal \LaTeX{} commands
{\tt\bs{}@svector}, {\tt\bs{}@getlarrow}, {\tt\bs{}@getrarrow}
and the command {\tt\bs{}vector} itself. As a result the command
{\tt\bs{}vector} starts to draw the vectors for all inclinations
valid for \LaTeX{} lines as it is shown on Fig.~\ref{FigA}.
The vectors are not so ideal as it is required by \TeX{} standards,
but the results are acceptable for all inclinations except $(6,1)$.

\begin{figure}
\centerline{%
\hfill
\begin{Picture}[23](600,600)
\put(300,300){\vector(1,0){300}}
\put(300,300){\vector(-1,0){300}}
\put(300,300){\vector(0,1){300}}
\put(300,300){\vector(0,-1){300}}
\put(300,300){\vector(1,1){300}}
\put(300,300){\vector(1,2){150}}
\put(300,300){\vector(1,3){100}}
\put(300,300){\vector(1,4){75}}
\put(300,300){\line(1,5){60}}
\put(300,300){\line(1,6){50}}
\put(300,300){\vector(2,1){300}}
\put(300,300){\vector(2,3){200}}
\put(300,300){\line(2,5){120}}
\put(300,300){\vector(3,1){300}}
\put(300,300){\vector(3,2){300}}
\put(300,300){\vector(3,4){225}}
\put(300,300){\line(3,5){180}}
\put(300,300){\vector(4,1){300}}
\put(300,300){\vector(4,3){300}}
\put(300,300){\line(4,5){240}}
\put(300,300){\line(5,1){300}}
\put(300,300){\line(5,2){300}}
\put(300,300){\line(5,3){300}}
\put(300,300){\line(5,4){300}}
\put(300,300){\line(5,6){250}}
\put(300,300){\line(6,1){300}}
\put(300,300){\line(6,5){300}}
\put(300,300){\vector(1,-1){300}}
\put(300,300){\vector(1,-2){150}}
\put(300,300){\vector(1,-3){100}}
\put(300,300){\vector(1,-4){75}}
\put(300,300){\line(1,-5){60}}
\put(300,300){\line(1,-6){50}}
\put(300,300){\vector(2,-1){300}}
\put(300,300){\vector(2,-3){200}}
\put(300,300){\line(2,-5){120}}
\put(300,300){\vector(3,-1){300}}
\put(300,300){\vector(3,-2){300}}
\put(300,300){\vector(3,-4){225}}
\put(300,300){\line(3,-5){180}}
\put(300,300){\vector(4,-1){300}}
\put(300,300){\vector(4,-3){300}}
\put(300,300){\line(4,-5){240}}
\put(300,300){\line(5,-1){300}}
\put(300,300){\line(5,-2){300}}
\put(300,300){\line(5,-3){300}}
\put(300,300){\line(5,-4){300}}
\put(300,300){\line(5,-6){250}}
\put(300,300){\line(6,-1){300}}
\put(300,300){\line(6,-5){300}}
\put(300,300){\vector(-1,1){300}}
\put(300,300){\vector(-1,2){150}}
\put(300,300){\vector(-1,3){100}}
\put(300,300){\vector(-1,4){75}}
\put(300,300){\line(-1,5){60}}
\put(300,300){\line(-1,6){50}}
\put(300,300){\vector(-2,1){300}}
\put(300,300){\vector(-2,3){200}}
\put(300,300){\line(-2,5){120}}
\put(300,300){\vector(-3,1){300}}
\put(300,300){\vector(-3,2){300}}
\put(300,300){\vector(-3,4){225}}
\put(300,300){\line(-3,5){180}}
\put(300,300){\vector(-4,1){300}}
\put(300,300){\vector(-4,3){300}}
\put(300,300){\line(-4,5){240}}
\put(300,300){\line(-5,1){300}}
\put(300,300){\line(-5,2){300}}
\put(300,300){\line(-5,3){300}}
\put(300,300){\line(-5,4){300}}
\put(300,300){\line(-5,6){250}}
\put(300,300){\line(-6,1){300}}
\put(300,300){\line(-6,5){300}}
\put(300,300){\vector(-1,-1){300}}
\put(300,300){\vector(-1,-2){150}}
\put(300,300){\vector(-1,-3){100}}
\put(300,300){\vector(-1,-4){75}}
\put(300,300){\line(-1,-5){60}}
\put(300,300){\line(-1,-6){50}}
\put(300,300){\vector(-2,-1){300}}
\put(300,300){\vector(-2,-3){200}}
\put(300,300){\line(-2,-5){120}}
\put(300,300){\vector(-3,-1){300}}
\put(300,300){\vector(-3,-2){300}}
\put(300,300){\vector(-3,-4){225}}
\put(300,300){\line(-3,-5){180}}
\put(300,300){\vector(-4,-1){300}}
\put(300,300){\vector(-4,-3){300}}
\put(300,300){\line(-4,-5){240}}
\put(300,300){\line(-5,-1){300}}
\put(300,300){\line(-5,-2){300}}
\put(300,300){\line(-5,-3){300}}
\put(300,300){\line(-5,-4){300}}
\put(300,300){\line(-5,-6){250}}
\put(300,300){\line(-6,-1){300}}
\put(300,300){\line(-6,-5){300}}
\end{Picture}
\hfill
\begin{Picture}[23](600,600)
\put(300,300){\vector(1,0){300}}
\put(300,300){\vector(-1,0){300}}
\put(300,300){\vector(0,1){300}}
\put(300,300){\vector(0,-1){300}}
\put(300,300){\vector(1,1){300}}
\put(300,300){\vector(1,2){150}}
\put(300,300){\vector(1,3){100}}
\put(300,300){\vector(1,4){75}}
\put(300,300){\vector(1,5){60}}
\put(300,300){\vector(1,6){50}}
\put(300,300){\vector(2,1){300}}
\put(300,300){\vector(2,3){200}}
\put(300,300){\vector(2,5){120}}
\put(300,300){\vector(3,1){300}}
\put(300,300){\vector(3,2){300}}
\put(300,300){\vector(3,4){225}}
\put(300,300){\vector(3,5){180}}
\put(300,300){\vector(4,1){300}}
\put(300,300){\vector(4,3){300}}
\put(300,300){\vector(4,5){240}}
\put(300,300){\vector(5,1){300}}
\put(300,300){\vector(5,2){300}}
\put(300,300){\vector(5,3){300}}
\put(300,300){\vector(5,4){300}}
\put(300,300){\vector(5,6){250}}
\put(300,300){\vector(6,1){300}}
\put(300,300){\vector(6,5){300}}
\put(300,300){\vector(1,-1){300}}
\put(300,300){\vector(1,-2){150}}
\put(300,300){\vector(1,-3){100}}
\put(300,300){\vector(1,-4){75}}
\put(300,300){\vector(1,-5){60}}
\put(300,300){\vector(1,-6){50}}
\put(300,300){\vector(2,-1){300}}
\put(300,300){\vector(2,-3){200}}
\put(300,300){\vector(2,-5){120}}
\put(300,300){\vector(3,-1){300}}
\put(300,300){\vector(3,-2){300}}
\put(300,300){\vector(3,-4){225}}
\put(300,300){\vector(3,-5){180}}
\put(300,300){\vector(4,-1){300}}
\put(300,300){\vector(4,-3){300}}
\put(300,300){\vector(4,-5){240}}
\put(300,300){\vector(5,-1){300}}
\put(300,300){\vector(5,-2){300}}
\put(300,300){\vector(5,-3){300}}
\put(300,300){\vector(5,-4){300}}
\put(300,300){\vector(5,-6){250}}
\put(300,300){\vector(6,-1){300}}
\put(300,300){\vector(6,-5){300}}
\put(300,300){\vector(-1,1){300}}
\put(300,300){\vector(-1,2){150}}
\put(300,300){\vector(-1,3){100}}
\put(300,300){\vector(-1,4){75}}
\put(300,300){\vector(-1,5){60}}
\put(300,300){\vector(-1,6){50}}
\put(300,300){\vector(-2,1){300}}
\put(300,300){\vector(-2,3){200}}
\put(300,300){\vector(-2,5){120}}
\put(300,300){\vector(-3,1){300}}
\put(300,300){\vector(-3,2){300}}
\put(300,300){\vector(-3,4){225}}
\put(300,300){\vector(-3,5){180}}
\put(300,300){\vector(-4,1){300}}
\put(300,300){\vector(-4,3){300}}
\put(300,300){\vector(-4,5){240}}
\put(300,300){\vector(-5,1){300}}
\put(300,300){\vector(-5,2){300}}
\put(300,300){\vector(-5,3){300}}
\put(300,300){\vector(-5,4){300}}
\put(300,300){\vector(-5,6){250}}
\put(300,300){\vector(-6,1){300}}
\put(300,300){\vector(-6,5){300}}
\put(300,300){\vector(-1,-1){300}}
\put(300,300){\vector(-1,-2){150}}
\put(300,300){\vector(-1,-3){100}}
\put(300,300){\vector(-1,-4){75}}
\put(300,300){\vector(-1,-5){60}}
\put(300,300){\vector(-1,-6){50}}
\put(300,300){\vector(-2,-1){300}}
\put(300,300){\vector(-2,-3){200}}
\put(300,300){\vector(-2,-5){120}}
\put(300,300){\vector(-3,-1){300}}
\put(300,300){\vector(-3,-2){300}}
\put(300,300){\vector(-3,-4){225}}
\put(300,300){\vector(-3,-5){180}}
\put(300,300){\vector(-4,-1){300}}
\put(300,300){\vector(-4,-3){300}}
\put(300,300){\vector(-4,-5){240}}
\put(300,300){\vector(-5,-1){300}}
\put(300,300){\vector(-5,-2){300}}
\put(300,300){\vector(-5,-3){300}}
\put(300,300){\vector(-5,-4){300}}
\put(300,300){\vector(-5,-6){250}}
\put(300,300){\vector(-6,-1){300}}
\put(300,300){\vector(-6,-5){300}}
\end{Picture}
\hfill
}
\caption{\LaTeX{} and \pmg{} vectors\label{FigA}}
\end{figure}

\begin{table}
\begin{center}
\begin{tabular}{||c|c||c|c||c|c||}
\hline
$(1,1)$ & $(1,1)$  &  $(4,1)$ & $(4,1)$  &  $(5,3)$ & $(3,2)$ \\
\hline
$(2,1)$ & $(2,1)$  &  $(4,3)$ & $(4,3)$  &  $(5,4)$ & $(4,3)$ \\
\hline
$(3,1)$ & $(3,1)$  &  $(5,1)$ & $(4,1)$  &  $(6,1)$ & $(4,1)$ \\
\hline
$(3,2)$ & $(3,2)$  &  $(5,2)$ & $(3,1)$  &  $(6,5)$ & $(4,3)$ \\
\hline
\end{tabular}
\end{center}
\caption{Relation between line slopes
and approximate vector slopes\label{Tab1}}
\end{table}

\LaTeX{} allows to put an arrow just at the end of the vector.
The command \verb?\Vector? enables to put
along the vector {\em arbitrary} arrows with different orientation
(see Fig.~\ref{TwoVec}). The predefined arrow styles
assign a letter to each position and orientation
of the arrow along the {\tt Vector}.

\begin{figure}
\centerline{\fbox{\begin{Picture}[50](300,40)
\put(20,5){\Vector[bme](1,0){100}}
\put(20,30){\Vector[BME](1,0){100}}
\put(170,5){\Vector[xZmM](1,0){100}}
\put(170,30){\Vector[XzmM](1,0){100}}
\end{Picture}}}
\caption{Multi-arrow vectors\label{TwoVec}}
\end{figure}

The arrows shown on Fig.~\ref{TwoVec} are drawn by the commands
\begin{quote}
\begin{verbatim}
\begin{picture}(300,40)
\put(20,5){\Vector[bme](1,0){100}}
\put(20,30){\Vector[BME](1,0){100}}
\put(170,5){\Vector[xmMZ](1,0){100}}
\put(170,30){\Vector[XmMz](1,0){100}}
. . . . . . . .
\end{verbatim}
\end{quote}

Letter {\tt e} corresponds to normally oriented arrow
at the end of vector, {\tt E} --- to reverse oriented arrow,
{\tt b} and {\tt B} --- to (normally and reverse oriented) arrows at the
beginning of the vector, {\tt m} and {\tt M} --- to the arrows
at the middle, etc.
The list of letters as the optional parameter produces
the set of arrows along the {\tt Vector}.
It is possible to create user-defined styles of arrows using the commands
\verb?\VectorStyle? and \verb?\VectorShiftStyle? (where the parameters
in square brackets are {\em obligatory}, not {\em optional}):
\begin{itemize}
\item[] {\tt\bs{}VectorStyle[{\em style-char}]\{{\em shift-char}\}\{{\em position}\}\{{\em orientation}\}}
\begin{itemize}
\item {\em style-char} is the character which is assigned to vector style;
\item {\em shift-char} is the character which defines the relative shift
      of the arrow with respect to {\em position} --- see command
      {\tt\bs{VectorShiftStyle}} below;
\item {\em position} is the real value which defines the relative position
      of the arrow along the vector (0.0 means starting point of the vector,
      1.0 means end point of the vector) which usually is in a range
      $0..1$ but can be greater 1 or less 0 as well;
\item {\em orientation} is the character which defines the orientation
      of the arrow with respect to the standard direction of the vecrtor:
      {\tt b} means {\em backward} direction, {\tt f} (or any other
      character) means forward direction.
\end{itemize}
\item[] {\tt\bs{}VectorShiftStyle[{\em style-char}]\{{\em shift}\}}
\begin{itemize}
\item {\em style-char} is the character which is assigned to vector-shift-style;
\item {\em shift} is the relative shift in {\tt pt} of the arrow along
      the arrow direction with respect to the positioning point
      (it is necessary to note that the length of the arrow body in \LaTeX{}
      is equal to {\tt 4pt}).
\end{itemize}
\end{itemize}
Examples:
\begin{itemize}
\item standard {\em vector-shift-styles}:
\begin{description}
\item[\quad{\tt\bs{}VectorShiftStyle[e]\{0pt\}}]
    --- style `{\tt e}' means that
    the end of the arrow is positioned strictly at the point,
    specified by the parameter {\em position};
\item[\quad{\tt\bs{}VectorShiftStyle[b]\{4pt\}}]
    --- style `{\tt b}' means that
    the backside of the arrow is positioned at the point,
    specified by the parameter {\em position};
\item[\quad{\tt\bs{}VectorShiftStyle[m]\{3pt\}}]
    --- style `{\tt m}' means that
    the middle of the arrow body is positioned at the point,
    specified by the parameter {\em position};
\item[\quad{\tt\bs{}VectorShiftStyle[E]\{-2pt\}}]
    --- style `{\tt E}' means that
    the end of the arrow is positioned a little bit before
    (i.e., by {\tt 2pt}) the point,
    specified by the parameter {\em position};
\item[\quad{\tt\bs{}VectorShiftStyle[B]\{6pt\}}]
    --- style `{\tt B}' means that
    the backside of the arrow is positioned a little bit after
    (i.e., by {\tt 2pt}) the point,
    specified by the parameter {\em position}.
\end{description}
\item standard {\em vector-styles}:
\begin{description}
\item[\quad{\tt\bs{}VectorStyle[e]\{e\}\{1.0\}\{f\}}]
    --- style `{\tt e}' means that
    the end of the arrow is positioned at the end of the vector,
    and its orientation is along the vector orientation;
\item[\quad{\tt\bs{}VectorStyle[E]\{b\}\{1.0\}\{b\}}]
    --- style `{\tt E}' means that
    the backside of the arrow is positioned at the end of the vector,
    and its orientation is rotated by $180^{\circ}$ with
    respect to the vector orientation;
\item[\quad{\tt\bs{}VectorStyle[b]\{b\}\{0.0\}\{f\}}]
    --- style `{\tt b}' means that
    the backside of the arrow is positioned at the beginning of the vector,
    and its orientation is along the vector orientation;
\item[\quad{\tt\bs{}VectorStyle[B]\{e\}\{0.0\}\{b\}}]
    --- style `{\tt B}' means that
    the end of the arrow is positioned at the beginning of the vector,
    and its orientation is rotated by $180^{\circ}$ with
    respect to the vector orientation;
\item[\quad{\tt\bs{}VectorStyle[m]\{m\}\{0.0\}\{f\}}]
    --- style `{\tt m}' means that
    the middle of the arrow body is positioned at the middle of the vector,
    and its orientation is along the vector orientation;
\item[\quad{\tt\bs{}VectorStyle[M]\{m\}\{0.0\}\{b\}}]
    --- style `{\tt M}' means that
    the middle of the arrow body is positioned at the middle of the vector,
    and its orientation is rotated by $180^{\circ}$ with
    respect to the vector orientation;
\item[\quad{\tt\bs{}VectorStyle[x]\{E\}\{1.0\}\{f\}}]
    --- style `{\tt x}' means that
    the end of the arrow is positioned a little bit before
    the end of the vector,
    and its orientation is along the vector orientation;
\item[\quad{\tt\bs{}VectorStyle[X]\{B\}\{1.0\}\{b\}}]
    --- style `{\tt X}' means that
    the backside of the arrow is positioned a little bit before
    the end of the vector,
    and its orientation is rotated by $180^{\circ}$ with
    respect to the vector orientation;
\item[\quad{\tt\bs{}VectorStyle[z]\{B\}\{0.0\}\{f\}}]
    --- style `{\tt z}' means that
    the backside of the arrow is positioned a little bit after
    the beginning of the vector,
    and its orientation is along the vector orientation;
\item[\quad{\tt\bs{}VectorStyle[Z]\{E\}\{0.0\}\{b\}}]
    --- style `{\tt Z}' means that
    the end of the arrow body is positioned a little bit after
    the beginning of the vector,
    and its orientation is rotated by $180^{\circ}$ with
    respect to the vector orientation.
\end{description}
\end{itemize}

\section*{Circles}

The range of the diameters for circles and disks
(black circular blobs) available in \LaTeX{} is very restricted.
It can be enlarged by using the magnified pseudo-graphical \LaTeX{} fonts
if the User does not have something better at his/her disposal
like {\tt curves.sty}, \PiC\TeX{} or MF\PiC.
The disadvantage of this method is that the width
of the lines is magnified too which is inconsistent
with the rigorous \TeX{} accuracy requirements,
but for {\em poor man graphics} these circles
can be satisfactory.

The scaling of circular fonts is performed by the commands
\begin{quote}
{\tt\bs{}scaledcircle\lb{\em factor}\rb}
\\
{\tt\bs{}magcircle\lb{\em magstep}\rb}
\end{quote}
which are indentical to \TeX{} commands
\begin{quote}
{\tt\bs{}font ... scaled {\em factor}}
\\
{\tt\bs{}font ... scaled \bs{}magstep {\em magstep}}
\end{quote}
The valid {\em magstep} values are {\tt 0}, {\tt h},
{\tt 1}, {\tt 2}, {\tt 3}, {\tt 4}, {\tt 5}.
The values {\em factor}=1000 and {\em magstep}=0
correspond to {\em one-to-one} magnification.
The circle magnification
like other \TeX{} commands returns to its
previous value outside the group inside which it was changed.

\begin{figure}
\def\myframe#1{\begin{picture}(0,0)
    \put(0,#1){\line(1,0){#1}}
    \put(0,#1){\line(-1,0){#1}}
    \put(0,-#1){\line(1,0){#1}}
    \put(0,-#1){\line(-1,0){#1}}%
    \put(#1,0){\line(0,1){#1}}%
    \put(#1,0){\line(0,-1){#1}}%
    \put(-#1,0){\line(0,1){#1}}%
    \put(-#1,0){\line(0,-1){#1}}%
    \end{picture}}
\begin{center}
\begin{Picture}[50](200,100)(-100,-50)
\unitlength=1pt
\put(-50,0){\thicklines\circle{80}}
\put(-50,0){\myframe{40}}
\put(50,0){\scaledcircle{2000}\circle{80}}
\put(50,0){\myframe{40}}
\end{Picture}
\end{center}
\caption{Magnified circles\label{Fig1}}
\end{figure}

To calculate properly the circle character code
after the magnification it was necessary to redefine
some internal \LaTeX{} commands like
{\tt\bs{}@getcirc} and {\tt\bs{}@circ}. To reflect
in magnified fonts the changes of the line thickness,
the commands {\tt\bs{}thinlines} and {\tt\bs{}thicklines}
are corrected also.

The example on Fig.~\ref{Fig1} is produced by
\begin{quote}
\begin{verbatim}
\setlength{\unitlength}{1pt}
\begin{picture}(200,100)(-100,-50)
\put(-50,0){\thicklines\circle{80}}
\put(-50,0){\squareframe{40}}
\magcircle{4}
\put(50,0){\thinlines\circle{80}}
\put(50,0){\squareframe{40}}
\end{picture}
\end{verbatim}
\end{quote}
where {\tt\bs{}squareframe} is the user-defined command which draws
the square with the specified side and the centrum at (0,0).
It shows how the usage of the magnified circles enables to overcome
the upper limit 40pt of the diameter of the \LaTeX{} cirles.
It is necessary to note that
the thickness of the {\tt\bs{}thinline} circles
after magnification with
{\tt\bs{}magcircle\lb{}4\rb}
corresponds approximately to the thickness
of the ordinary {\tt\bs{}thickline} circles
($\hbox{\tt\bs{}magstep4}\approx2000$).

\bigskip

\begin{figure}
\begin{center}
\begin{Picture}[50](200,60)(-100,-30)
\put(-60,10){\thicklines\tlcircle{50}}
\put(-60,10){\circle*{1}}
\put(-60,10){\line(-1,0){25}}
\put(-60,10){\line(0,1){25}}
\put(-60,-10){\thicklines\blcircle{50}}
\put(-60,-10){\circle*{1}}
\put(-60,-10){\line(-1,0){25}}
\put(-60,-10){\line(0,-1){25}}
\put(-40,10){\thicklines\trcircle{50}}
\put(-40,10){\circle*{1}}
\put(-40,10){\line(1,0){25}}
\put(-40,10){\line(0,1){25}}
\put(-40,-10){\thicklines\brcircle{50}}
\put(-40,-10){\circle*{1}}
\put(-40,-10){\line(1,0){25}}
\put(-40,-10){\line(0,-1){25}}
\put(40,10){\thicklines\BRcircle{50}}
\put(40,10){\circle*{1}}
\put(40,10){\line(-1,0){25}}
\put(40,10){\line(0,1){25}}
\put(40,-10){\thicklines\TRcircle{50}}
\put(40,-10){\circle*{1}}
\put(40,-10){\line(-1,0){25}}
\put(40,-10){\line(0,-1){25}}
\put(60,10){\thicklines\BLcircle{50}}
\put(60,10){\circle*{1}}
\put(60,10){\line(1,0){25}}
\put(60,10){\line(0,1){25}}
\put(60,-10){\thicklines\TLcircle{50}}
\put(60,-10){\circle*{1}}
\put(60,-10){\line(1,0){25}}
\put(60,-10){\line(0,-1){25}}
\end{Picture}
\end{center}
\caption{$90^{\circ}$ circular segments\label{Fig2}}
\end{figure}

Additional macro enable to
draw $90^{\circ}$ qu\-a\-ters of the circles explicitly without
tricky refinement of the parameters of the command {\tt\bs{}oval}:
\begin{quote}
{\tt\bs{}trcircle\lb{\em diam}\rb} $\longrightarrow$ {\tt\bs{}oval[tr]...}
\\
{\tt\bs{}brcircle\lb{\em diam}\rb} $\longrightarrow$ {\tt\bs{}oval[br]...}
\\
{\tt\bs{}tlcircle\lb{\em diam}\rb} $\longrightarrow$ {\tt\bs{}oval[tl]...}
\\
{\tt\bs{}blcircle\lb{\em diam}\rb} $\longrightarrow$ {\tt\bs{}oval[bl]...}
\end{quote}
The centrum of the circular arc is positioned strictly at the
point which is the argument of the corresponding {\tt\bs{}put}.
The commands {\tt\bs{}TRcircle}, {\tt\bs{}BRcircle}, {\tt\bs{}TLcircle},
{\tt\bs{}BLcircle} draw the $90^{\circ}$ circular quaters
with the reference point positioned at the corner
instead of the centrum.
Similarly, the commands
\begin{itemize}
\item[] {\tt\bs{}tlsector}, {\tt\bs{}TLsector},
{\tt\bs{}blsector}, {\tt\bs{}BLsector}, \dots
\end{itemize}
draw circular segments together with horizontal
and vertical radii. The proper positioning of the
circular segments requires special precausions
since it is necessary to take into account the
line thickness and the specific alignment of the
circular elements inside the character boxes.

The example on Fig~\ref{Fig2}
shows the usage of these commands:
\begin{quote}
\begin{verbatim}
\begin{picture}(200,60)(-100,-30)
\put(-60,10){\thicklines\tlcircle{50}}
\put(-60,10){\circle*{1}}
\put(-60,10){\line(-1,0){25}}
\put(-60,10){\line(0,1){25}}
\put(40,10){\thicklines\BRcircle{50}}
\put(40,10){\circle*{1}}
\put(40,10){\line(-1,0){25}}
\put(40,10){\line(0,1){25}}
... ... ...
\end{verbatim}
\end{quote}
The actual diameter of the circular segment
is adjusted like it is done with the circles.
The commands {\tt\bs{}scaledcircle} and {\tt\bs{}magcircle}
affect the thickness and the diameter of these circular segments also.


\section*{Frames}

\def\DiskCorner{8pt}
\def\RoundCorner{6pt}
\def\LineCorner{10pt}
\def\RectCorner{3pt}

\framesep{-2pt}
\shadowsep{1pt}
\shadowsize{8pt}
\shadowshrink{1}

The set of frames which are available in \LaTeX{} is
enhanced in \pmg{} --- except solid and dashed rectangular frames
it is possible to draw double and tripple frames in a variety
of styles (Fig.~\ref{ThrFr}). The commands
\verb?\frameBox?, \verb?\ovalBox?, \verb?\octalBox?,
\verb?\astroBox?, \verb?\parquetBox? have the same structure
as the command \verb?\framebox?, but they draw the
corresponding fancy frames:
\begin{quote}
\begin{verbatim}
\put(0,0){\ovalBox(100,50){oval}}
\put(70,0){\astroBox(100,50){astro}}
. . . . . . . . . . . . .
\end{verbatim}
\end{quote}
The ordinary solid frame is drawn by \verb?\frameBox?,
the double and triple frames are drawn by \verb?\frameBoX?
and \verb?\frameBOX?, respectively. Similar commands exist for
double and triple fancy frames.
The User can prepare the personal macro commands to draw frame corners
and extend the variety of fancy frames up to the limit of his/her fantasy.

\begin{figure}
\centerline{\begin{Picture}[50](2000,800)
\put(100,0){\parquetBox(500,300){parquet}}
\put(100,500){\octalBox(500,300){octal}}
\put(700,0){\ovalBoX(500,300){oval}}
\put(700,500){\astroBoX(500,300){astro}}
\put(1300,0){\dashBOX{10}(500,300){dash}}
\put(1300,500){\frameBOX(500,300){frame}}
\end{Picture}}
\caption{Examples of frame styles\label{ThrFr}}
\end{figure}

\begin{figure}
\centerline{\begin{Picture}[50](600,100)(-30,0)
\thicklines
\rombboxstyle(2,1,1pt)
\put(20,20){\rombBox[z](50,50){Box}}
\put(220,20){\rombBoX[z](50,50){BoX}}
\put(440,20){\rombBOX[z](50,50){BOX}}
\end{Picture}}
\caption{Romb-style frames\label{RombFram}}
\end{figure}

\begin{figure}
\centerline{\begin{Picture}[50](800,200)(-130,0)
\put(-100,20){\frameBox(100,100){}}
\put(220,20){\frameBox(100,100){}}
\put(540,20){\frameBox(100,100){}}
\thicklines
\rombboxstyle(2,1,1pt)
\put(-100,20){\rombBox[x](100,100){\tt x}}
\put(220,20){\rombBox[y](100,100){\tt y}}
\put(540,20){\rombBox[z](100,100){\tt z}}
\end{Picture}}
\caption{Alignment of romb boxes\label{FigRR}}
\end{figure}

More exotic variant of a frame can be created using
the commands {\tt\bs{}rombBox}, {\tt\bs{}rombBoX}
or {\tt\bs{}rombBOX} as it is shown on Fig.~\ref{RombFram}.
The style (i.e., inclination of the romb sides)
and the distance between multiple rombs
are set by the command {\tt\bs{}rombboxstyle}
\begin{description}
\item[\quad{\tt\bs{}rombboxstyle($\Delta x$,$\Delta y$,{\em len})}]
   --- defines the inclination for the romb boxes and for the
       corners of the {tt octal} frames and shadows.
       Parameters $\Delta x$, $\Delta y$ specifies the inclination,
       and the parameter {\em len} --- the length of the inclined
       corners (for {\tt octal} frames and shadows only) in a style
       similar to the command
       {\tt\bs{}line($\Delta x$,$\Delta y$)\{{\em len}\}}.
\end{description}
with the default settings as
\begin{center}
{\tt\bs{}rombboxstyle(2,1,2pt)}
\end{center}
The alignment of the romb around the box specified
for these commands can be varied using
additional optional parameter(see Fig.~\ref{FigRR}. The full format of the
{\tt rombbox} commands is:
\begin{itemize}
\item[]
    {\tt\bs{}rombBox[{\em char}]($\Delta X$,$\Delta Y$)\{{\em text}\}}
\end{itemize}
where
        {\em char} -is one-character parameter which
        defines the alignment of the romb frame with respect to
        rectangle $(\Delta X,\Delta Y)$:
        {\tt x} (default value) means that the $x$-axis coinsides with the
        $x$-axis of the rectangle,
        {\tt y} means that the $y$-axis coinsides with the
        $y$-axis of the rectangle,
        {\tt z} means that the corners of the rectangle are at the
        sides of the romb frame.

\begin{figure}
\begin{center}
\begin{Picture}[50](2000,1100)(0,-500)
\put(0,50){\frameBox[r](500,200){r}}
\put(0,400){\frameBox[R](500,200){R}}
\put(700,50){\frameBox[p](500,200){p}}
\put(700,400){\frameBox[P](500,200){P}}
\put(1400,50){\frameBox[o](500,200){o}}
\put(1400,400){\frameBox[O](500,200){O}}
\shadowsize{12pt}
\put(100,-400){\frameBox[A](800,300){A}}
\put(1100,-400){\frameBox[L](800,300){L}}
\end{Picture}
\end{center}
\caption{Examples of shadows\label{TypShad}}
\end{figure}

\begin{figure}
\begin{center}
\begin{Picture}[35](2000,1500)
\shadowcorner{B}
\put(0,0){\frameBoX[oPRpAORr](1000,500){Shadows}}
\end{Picture}
\end{center}
\caption{Multiple shadows\label{TypShad2}}
\end{figure}

Each rectangular box has the optional parameter which enable to specify
the ``shadows'' around this box. Each shadow style has a special letter,
and the list of letters as the optional parameter draws a list of shadows.
The standard shodow types are shown on Fig.~\ref{TypShad}.
It is possible to draw several shadows of different types
and around arbitrary corner of the frame as it is shown
on Fig.~\ref{TypShad2}:
\begin{quote}
\begin{verbatim}
\unitlength=10pt
\begin{picture}(20,15)
\shadowcorner{B}
\put(0,0){\frameBoX[oPR...](10,5){...}}
\end{picture}
\end{verbatim}
\end{quote}
The parameter of the shadows --- thickness, corner size,
additional shift, etc., --- can be varied
by the following User commands:
\begin{description}
\item[\quad{\tt\bs{}framesep\{{\em dist}\}}]
    --- set the distance between double and triple
    frames. It can be negative as well as positive.
    Default value: {\tt\framesep\{2pt\}}.
\item[\quad{\tt\bs{}shadowsep\{{\em dist}\}}]
    --- set the gap distance between the frame and the shadow
    or between multiple shadows.
    Default value: {\tt\shadowsep\{1pt\}}.
\item[\quad{\tt\bs{}shadowsize\{{\em dist}\}}]
    --- set the depth of the shadow.
    Default value: {\tt\shadowsize\{5pt\}}.
\item[\quad{\tt\bs{}shadowshrink\{{\em factor}\}}]
    --- set the contraction factor for the subsequent shadows.
    Default value: {\tt\shadowshrink\{1\}}.
\item[\quad{\tt\bs{}shadowcorner\{{\em char}\}}]
    --- set the corner for the shadows.
    Valid values: {\tt A}, {\tt B}, {\tt C}, {\tt D}.
    Default value: {\tt\bs{}shadowcorner\{A\}}.
\item[\quad{\tt\bs{}RoundCorner\{{\em radius}\}}]
    --- set the {\em radius} for the circular arcs
    at the corners of oval frames and shadows with rounded corners.
    Default value: {\tt\RoundCorner\{5pt\}}.
\item[\quad{\tt\bs{}DiskCorner\{{\em diam}\}}]
    --- set the {\em diameter} for the bulbs
    at the corners of black shadows with rounded corners.
    Default value: {\tt\DiskCorner\{5pt\}}.
\item[\quad{\tt\bs{}LineCorner\{{\em len}\}}]
    --- set the {\em length} for the inclined corners
    of octal frames and shadows.
    Default value: {\tt\LineCorner\{10pt\}}.
\item[\quad{\tt\bs{}RectCorner\{{\em size}\}}]
    --- set the {\em size} for the parquette corners
    of octal frames and shadows.
    Default value: {\tt\RectCorner\{5pt\}}.
\end{description}


\section*{Rombs}

Special command enable to draw rombs (see Fig.~\ref{FigRomb}):
\begin{itemize}
\item[] {\tt \bs{}put({\em x})({\em y})
         \{\bs{}romb[{\em pos}]($\Delta x$,$\Delta y$)\{{\em len}\}\}}
\end{itemize}
where:
\begin{itemize}
\item[] $(x,y)$ --- position of the romb inside {\tt picture};\\
        {\em pos} --- one-character option which shows the alignment of romb
        with respect to $(x,y)$: {\tt r} means right corner,
        {\tt l} means left corner; {\tt c} means center (default);\\
        $(\Delta x,\Delta y)$ and {\em len} are the parameters which
        define the inclination and the length of the romb side
        (similarly to {\tt\bs{}line}).
\end{itemize}

\begin{figure}
\centerline{\begin{Picture}[75](800,200)(-30,-100)
\thicklines
\put(20,20){\romb[c](2,1){90}}
\put(20,20){\circle*{10}}
\put(20,-60){\makebox(0,0){\tt c}}
\put(220,20){\romb[l](2,1){90}}
\put(220,20){\circle*{10}}
\put(220,-60){\makebox(0,0){\tt l}}
\put(640,20){\romb[r](2,1){90}}
\put(640,20){\circle*{10}}
\put(640,-60){\makebox(0,0){\tt r}}
\end{Picture}}
\caption{Alignment of rombes\label{FigRomb}}
\end{figure}

\section*{Automatically scaled pictures}

The idea of the macros which are responsible for these functions
is to calculate the {\tt \bs{}unitlength} va\-lue in terms of the
{\em relative fraction} of the page width instead of explicit
specifying its value in points, centimeters, inches, etc.

The command {\tt\bs{}pictureunit[{\em percent}]\lb{\em x-size}\rb}
selects the value of the variable {\tt\bs{}unitlength} so that the picture
which is {\em x-size} units in width occupies {\em percent}
width of the paper.
The environment {\tt Picture} combines the automatic calculation of
the {\tt\bs{}unitlength} with the {\tt\bs{}begin\lb{}picture\rb} --
{\tt\bs{}end\lb{}picture\rb}.
By default {\em percent}=100 is used which corresponds to 90\%
of the paper width. The default {\em percent} value can be redefined
by the command
\begin{center}
   {\tt\bs{}def\bs{}defaultpercent\lb{\em percent}\rb}.
\end{center}

Examples:
\begin{center}
\begin{tabular}{l}
   {\tt\bs{}pictureunit[75]\lb{}120\rb}\\
   {\tt\bs{}begin\lb{}picture\rb(120,80)}\\
   \dots\\
   {\tt\bs{}end\lb{}picture\rb}\\
   \phantom{.}\\
   {\tt\bs{}begin\lb{}Picture\rb[75](120,80)}\\
   \dots\\
   {\tt\bs{}end\lb{}Picture\rb}
\end{tabular}
\end{center}

These macros are inspired by {\tt fullpict.sty} by Bruce Shawyer.
Carefull examination of the file {\tt fullpict.sty}
shows some bugs/warnings which require correction:
\begin{itemize}
\item
each automatic scaling of {\tt \bs{}unitlength}
allocates a new counter;
\item
automatic scaling uses {\tt\bs{}textwidth}
as the reference width which results to improper functioning
inside list and {\tt minipage} environments;
\item
the environments {\tt fullpicture}, {\tt halfpicture}
and {\tt scalepicture} are centered internally
with {\tt\bs{}begin\lb{}center\rb} --- {\tt\bs{}end\lb{}center\rb}
which prevents the proper positioning of the picture in most cases.
\end{itemize}
The \pmgs{} macros calculates the dimension
{\tt\bs{}unitlength}
using the value {\tt\bs{}hsize}, and as a result
it works corectly also for {\tt twocolumn} mode,
inside the {\em list} environments
{\tt itemize}, {\tt enumerate}, etc.
(for example, all the figures in this paper
are drawn using the environment {\tt Picture}).
The automatic centering and repeatedly allocation
of the registers are corrected as well.

\section*{Acknowledgements}

The authors are grateful to Dr.\ Kees van der Laan
for the possibility to present the results of our research
at the EURO\TeX'95 (Aarnhem, Netherland).

One of the authors (A.S.Berdnikov) would like to express his warmest
thanks to Dr.\ A.Compagner from the Delft University of Technology
who spent a lot of his time and efforts trying to transform two naive
students from Russia (namely, him and his co-worker Sergey Turtia)
into serious scientists.

This research was partially supported by a grant
from the Dutch Organization for Scientific Research
(NWO grant No 07--30--007).

\end{document}








