Debian Codegraph @

texmf-dist/doc/latex/pmgraph/pmgraph.tex

raw
1 %% The following copyright notice and licensing information was added
2 %% by Clea F. Rees on behalf of Alexander Berdnikov on 2008/11/03.
3 %%
4 %% Copyright 1996 Alexander Berdnikov, Olga Grineva
5 %%
6 %% This file is part of pmgraph.
7 %%
8 %% pmgraph is free software: you can redistribute it and/or modify
9 %% it under the terms of the GNU General Public License as published by
10 %% the Free Software Foundation, either version 3 of the License, or
11 %% (at your option) any later version.
12 %%
13 %% pmgraph is distributed in the hope that it will be useful,
14 %% but WITHOUT ANY WARRANTY; without even the implied warranty of
15 %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 %% See the GNU General Public License for more details.
17 %%
18 %% You should have received a copy of the GNU General Public License
19 %% along with pmgraph. If not, see <http://www.gnu.org/licenses/>.
20
21 \documentstyle[12pt,a4,pmgraph]{article}
22
23 \title{{\sc pmgraph.sty}: some useful macros which extends
24 the \LaTeX{} environment {\tt picture}\\[0.5\baselineskip]
25 \Large Version 1.0}
26
27 \author{
28 \begin{minipage}{0.4\textwidth}
29 \begin{center} A.S.Berdnikov\\{\tt berd{\sl @}ianin.spb.su} \end{center}
30 \end{minipage}
31 \hfill
32 \begin{minipage}{0.4\textwidth}
33 \begin{center} O.A.Grineva\\{\tt olga{\sl @}ianin.spb.su} \end{center}
34 \end{minipage}
35 }
36
37 \date{}
38
39 \def\PiC{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC\spacefactor1000 }
40 \font\manual=logo10 at 12pt
41 \def\MF{{\manual META}\-{\manual FONT}\spacefactor1000 }
42 \def\AW{Addison\kern.1em-\penalty 0pt \hskip 0pt Wesley}
43 \def\CandT{{\sl Computers \& Typesetting}}
44 \def\TUB{{\sl TUGboat\/}}
45
46 \newcommand{\bs}{\char '134 } % char \
47 \newcommand{\lb}{\char '173 } % char {
48 \newcommand{\rb}{\char '175 } % char }
49 \makeatletter
50 \def\hackersmile{\@ifnextchar[{\@hackersmile}{\@hackersmile[10]}}
51 \def\@hackersmile[#1]{\hbox{%
52 \unitlength=1pt\relax
53 \unitlength=#1\unitlength
54 \divide\unitlength by 10\relax
55 \thicklines
56 \raise -3\unitlength \hbox{%
57 \begin{picture}(12,12)(-6,-6)
58 \put(0,0){\circle{10}}
59 \put(-2,1.75){\circle*{1}}
60 \put(2,1.75){\circle*{1}}
61 \thicklines
62 \put(-2.75,3){\line(1,0){1.5}}
63 \put(2.75,3){\line(-1,0){1.5}}
64 \put(0,-1){\line(0,1){3}}
65 \put(-2.5,-2.5){\line(1,0){5}}
66 \put(-2.5,-2.5){\line(0,1){1}}
67 \put(2.5,-2.5){\line(0,1){1}}
68 \end{picture}%
69 }}}
70 \makeatother
71
72 \newcommand{\pmg}{{\sc pmgraph}}
73 \newcommand{\pmgs}{{\sc pmgraph.sty}}
74
75 \begin{document}
76 \maketitle
77
78
79 The original \TeX/\LaTeX{} possibilities to create
80 pictures are relatively poor, and there are
81 many extensions ({\tt epic/eepic}, {\tt pictex}, {\tt drawtex},
82 {\tt xypic}, {\tt mfpic}, etc.) which were created to extend
83 its possibilities to a higher level. The macro \pmgs{}
84 ({\em poor-man-graphics}) which are
85 described here are not so general as the ones cited
86 above. They manupulate with the pseudo-graphical
87 fonts which are used by generic \LaTeX{} without additional
88 extensions --- mainly because the variations of
89 \PiC\TeX{}, \MF{} and new graphical font
90 themes are already realized by other authors
91 and on sufficiently higher level.
92 To some extend the purpose of our work was to see
93 how far it is possible to move in the development of new
94 useful graphical primitives for \LaTeX{} {\em without}
95 the investment of the external graphical tools.
96
97 The style file \pmgs{} includes the following features:
98 \begin{itemize}
99 \item
100 the vectors with a set of slopes which is
101 as general as the line slopes implemented in \LaTeX;
102 \item
103 the vectors with an arrow at the beginning,
104 at the middle or at the end of vector with various orientations
105 of the arrow;
106 \item
107 the circles and circular arcs with nearly arbitrary diameter
108 using magnified {\tt circle} and {\tt circlew} \LaTeX{} fonts;
109 \item
110 the 1/4 circular arcs correctly positioned
111 at the centrum or at the corner;
112 \item
113 extended set of frames which include various
114 corner style and the optional multiple frame shadows
115 with a variety of styles;
116 \item
117 tools which enable the user to extend the variety of
118 frame styles and the shadow styles as far as his/her
119 fantasy allows it;
120 \item
121 automatic calculation of the picture size in terms
122 of the current text width --- including the {\tt picture}
123 inserted inside list environments.
124 \end{itemize}
125 Even not very complicated, these macros appears to
126 be useful in our work, and it seems that they can be
127 useful for other \TeX-users too.
128
129 \section*{Vectors}
130
131 The number of angles for inclined lines which can be used
132 in \LaTeX{} is limited to great extend, but the number of
133 angles for {\em vectors} is limited even more.
134 The variety of vectors can be extended if instead of the
135 {\em strictly} inclined arrows at the end of the inclined
136 line the arrow with the {\em approximate} inclination is added.
137 Corresponding changes are incorporated in \pmg{} where
138 the relation between strict inclinations and approximate
139 inclinations are shown in Table~\ref{Tab1}. The corrections require
140 the modifications of the internal \LaTeX{} commands
141 {\tt\bs{}@svector}, {\tt\bs{}@getlarrow}, {\tt\bs{}@getrarrow}
142 and the command {\tt\bs{}vector} itself. As a result the command
143 {\tt\bs{}vector} starts to draw the vectors for all inclinations
144 valid for \LaTeX{} lines as it is shown on Fig.~\ref{FigA}.
145 The vectors are not so ideal as it is required by \TeX{} standards,
146 but the results are acceptable for all inclinations except $(6,1)$.
147
148 \begin{figure}
149 \centerline{%
150 \hfill
151 \begin{Picture}[23](600,600)
152 \put(300,300){\vector(1,0){300}}
153 \put(300,300){\vector(-1,0){300}}
154 \put(300,300){\vector(0,1){300}}
155 \put(300,300){\vector(0,-1){300}}
156 \put(300,300){\vector(1,1){300}}
157 \put(300,300){\vector(1,2){150}}
158 \put(300,300){\vector(1,3){100}}
159 \put(300,300){\vector(1,4){75}}
160 \put(300,300){\line(1,5){60}}
161 \put(300,300){\line(1,6){50}}
162 \put(300,300){\vector(2,1){300}}
163 \put(300,300){\vector(2,3){200}}
164 \put(300,300){\line(2,5){120}}
165 \put(300,300){\vector(3,1){300}}
166 \put(300,300){\vector(3,2){300}}
167 \put(300,300){\vector(3,4){225}}
168 \put(300,300){\line(3,5){180}}
169 \put(300,300){\vector(4,1){300}}
170 \put(300,300){\vector(4,3){300}}
171 \put(300,300){\line(4,5){240}}
172 \put(300,300){\line(5,1){300}}
173 \put(300,300){\line(5,2){300}}
174 \put(300,300){\line(5,3){300}}
175 \put(300,300){\line(5,4){300}}
176 \put(300,300){\line(5,6){250}}
177 \put(300,300){\line(6,1){300}}
178 \put(300,300){\line(6,5){300}}
179 \put(300,300){\vector(1,-1){300}}
180 \put(300,300){\vector(1,-2){150}}
181 \put(300,300){\vector(1,-3){100}}
182 \put(300,300){\vector(1,-4){75}}
183 \put(300,300){\line(1,-5){60}}
184 \put(300,300){\line(1,-6){50}}
185 \put(300,300){\vector(2,-1){300}}
186 \put(300,300){\vector(2,-3){200}}
187 \put(300,300){\line(2,-5){120}}
188 \put(300,300){\vector(3,-1){300}}
189 \put(300,300){\vector(3,-2){300}}
190 \put(300,300){\vector(3,-4){225}}
191 \put(300,300){\line(3,-5){180}}
192 \put(300,300){\vector(4,-1){300}}
193 \put(300,300){\vector(4,-3){300}}
194 \put(300,300){\line(4,-5){240}}
195 \put(300,300){\line(5,-1){300}}
196 \put(300,300){\line(5,-2){300}}
197 \put(300,300){\line(5,-3){300}}
198 \put(300,300){\line(5,-4){300}}
199 \put(300,300){\line(5,-6){250}}
200 \put(300,300){\line(6,-1){300}}
201 \put(300,300){\line(6,-5){300}}
202 \put(300,300){\vector(-1,1){300}}
203 \put(300,300){\vector(-1,2){150}}
204 \put(300,300){\vector(-1,3){100}}
205 \put(300,300){\vector(-1,4){75}}
206 \put(300,300){\line(-1,5){60}}
207 \put(300,300){\line(-1,6){50}}
208 \put(300,300){\vector(-2,1){300}}
209 \put(300,300){\vector(-2,3){200}}
210 \put(300,300){\line(-2,5){120}}
211 \put(300,300){\vector(-3,1){300}}
212 \put(300,300){\vector(-3,2){300}}
213 \put(300,300){\vector(-3,4){225}}
214 \put(300,300){\line(-3,5){180}}
215 \put(300,300){\vector(-4,1){300}}
216 \put(300,300){\vector(-4,3){300}}
217 \put(300,300){\line(-4,5){240}}
218 \put(300,300){\line(-5,1){300}}
219 \put(300,300){\line(-5,2){300}}
220 \put(300,300){\line(-5,3){300}}
221 \put(300,300){\line(-5,4){300}}
222 \put(300,300){\line(-5,6){250}}
223 \put(300,300){\line(-6,1){300}}
224 \put(300,300){\line(-6,5){300}}
225 \put(300,300){\vector(-1,-1){300}}
226 \put(300,300){\vector(-1,-2){150}}
227 \put(300,300){\vector(-1,-3){100}}
228 \put(300,300){\vector(-1,-4){75}}
229 \put(300,300){\line(-1,-5){60}}
230 \put(300,300){\line(-1,-6){50}}
231 \put(300,300){\vector(-2,-1){300}}
232 \put(300,300){\vector(-2,-3){200}}
233 \put(300,300){\line(-2,-5){120}}
234 \put(300,300){\vector(-3,-1){300}}
235 \put(300,300){\vector(-3,-2){300}}
236 \put(300,300){\vector(-3,-4){225}}
237 \put(300,300){\line(-3,-5){180}}
238 \put(300,300){\vector(-4,-1){300}}
239 \put(300,300){\vector(-4,-3){300}}
240 \put(300,300){\line(-4,-5){240}}
241 \put(300,300){\line(-5,-1){300}}
242 \put(300,300){\line(-5,-2){300}}
243 \put(300,300){\line(-5,-3){300}}
244 \put(300,300){\line(-5,-4){300}}
245 \put(300,300){\line(-5,-6){250}}
246 \put(300,300){\line(-6,-1){300}}
247 \put(300,300){\line(-6,-5){300}}
248 \end{Picture}
249 \hfill
250 \begin{Picture}[23](600,600)
251 \put(300,300){\vector(1,0){300}}
252 \put(300,300){\vector(-1,0){300}}
253 \put(300,300){\vector(0,1){300}}
254 \put(300,300){\vector(0,-1){300}}
255 \put(300,300){\vector(1,1){300}}
256 \put(300,300){\vector(1,2){150}}
257 \put(300,300){\vector(1,3){100}}
258 \put(300,300){\vector(1,4){75}}
259 \put(300,300){\vector(1,5){60}}
260 \put(300,300){\vector(1,6){50}}
261 \put(300,300){\vector(2,1){300}}
262 \put(300,300){\vector(2,3){200}}
263 \put(300,300){\vector(2,5){120}}
264 \put(300,300){\vector(3,1){300}}
265 \put(300,300){\vector(3,2){300}}
266 \put(300,300){\vector(3,4){225}}
267 \put(300,300){\vector(3,5){180}}
268 \put(300,300){\vector(4,1){300}}
269 \put(300,300){\vector(4,3){300}}
270 \put(300,300){\vector(4,5){240}}
271 \put(300,300){\vector(5,1){300}}
272 \put(300,300){\vector(5,2){300}}
273 \put(300,300){\vector(5,3){300}}
274 \put(300,300){\vector(5,4){300}}
275 \put(300,300){\vector(5,6){250}}
276 \put(300,300){\vector(6,1){300}}
277 \put(300,300){\vector(6,5){300}}
278 \put(300,300){\vector(1,-1){300}}
279 \put(300,300){\vector(1,-2){150}}
280 \put(300,300){\vector(1,-3){100}}
281 \put(300,300){\vector(1,-4){75}}
282 \put(300,300){\vector(1,-5){60}}
283 \put(300,300){\vector(1,-6){50}}
284 \put(300,300){\vector(2,-1){300}}
285 \put(300,300){\vector(2,-3){200}}
286 \put(300,300){\vector(2,-5){120}}
287 \put(300,300){\vector(3,-1){300}}
288 \put(300,300){\vector(3,-2){300}}
289 \put(300,300){\vector(3,-4){225}}
290 \put(300,300){\vector(3,-5){180}}
291 \put(300,300){\vector(4,-1){300}}
292 \put(300,300){\vector(4,-3){300}}
293 \put(300,300){\vector(4,-5){240}}
294 \put(300,300){\vector(5,-1){300}}
295 \put(300,300){\vector(5,-2){300}}
296 \put(300,300){\vector(5,-3){300}}
297 \put(300,300){\vector(5,-4){300}}
298 \put(300,300){\vector(5,-6){250}}
299 \put(300,300){\vector(6,-1){300}}
300 \put(300,300){\vector(6,-5){300}}
301 \put(300,300){\vector(-1,1){300}}
302 \put(300,300){\vector(-1,2){150}}
303 \put(300,300){\vector(-1,3){100}}
304 \put(300,300){\vector(-1,4){75}}
305 \put(300,300){\vector(-1,5){60}}
306 \put(300,300){\vector(-1,6){50}}
307 \put(300,300){\vector(-2,1){300}}
308 \put(300,300){\vector(-2,3){200}}
309 \put(300,300){\vector(-2,5){120}}
310 \put(300,300){\vector(-3,1){300}}
311 \put(300,300){\vector(-3,2){300}}
312 \put(300,300){\vector(-3,4){225}}
313 \put(300,300){\vector(-3,5){180}}
314 \put(300,300){\vector(-4,1){300}}
315 \put(300,300){\vector(-4,3){300}}
316 \put(300,300){\vector(-4,5){240}}
317 \put(300,300){\vector(-5,1){300}}
318 \put(300,300){\vector(-5,2){300}}
319 \put(300,300){\vector(-5,3){300}}
320 \put(300,300){\vector(-5,4){300}}
321 \put(300,300){\vector(-5,6){250}}
322 \put(300,300){\vector(-6,1){300}}
323 \put(300,300){\vector(-6,5){300}}
324 \put(300,300){\vector(-1,-1){300}}
325 \put(300,300){\vector(-1,-2){150}}
326 \put(300,300){\vector(-1,-3){100}}
327 \put(300,300){\vector(-1,-4){75}}
328 \put(300,300){\vector(-1,-5){60}}
329 \put(300,300){\vector(-1,-6){50}}
330 \put(300,300){\vector(-2,-1){300}}
331 \put(300,300){\vector(-2,-3){200}}
332 \put(300,300){\vector(-2,-5){120}}
333 \put(300,300){\vector(-3,-1){300}}
334 \put(300,300){\vector(-3,-2){300}}
335 \put(300,300){\vector(-3,-4){225}}
336 \put(300,300){\vector(-3,-5){180}}
337 \put(300,300){\vector(-4,-1){300}}
338 \put(300,300){\vector(-4,-3){300}}
339 \put(300,300){\vector(-4,-5){240}}
340 \put(300,300){\vector(-5,-1){300}}
341 \put(300,300){\vector(-5,-2){300}}
342 \put(300,300){\vector(-5,-3){300}}
343 \put(300,300){\vector(-5,-4){300}}
344 \put(300,300){\vector(-5,-6){250}}
345 \put(300,300){\vector(-6,-1){300}}
346 \put(300,300){\vector(-6,-5){300}}
347 \end{Picture}
348 \hfill
349 }
350 \caption{\LaTeX{} and \pmg{} vectors\label{FigA}}
351 \end{figure}
352
353 \begin{table}
354 \begin{center}
355 \begin{tabular}{||c|c||c|c||c|c||}
356 \hline
357 $(1,1)$ & $(1,1)$ & $(4,1)$ & $(4,1)$ & $(5,3)$ & $(3,2)$ \\
358 \hline
359 $(2,1)$ & $(2,1)$ & $(4,3)$ & $(4,3)$ & $(5,4)$ & $(4,3)$ \\
360 \hline
361 $(3,1)$ & $(3,1)$ & $(5,1)$ & $(4,1)$ & $(6,1)$ & $(4,1)$ \\
362 \hline
363 $(3,2)$ & $(3,2)$ & $(5,2)$ & $(3,1)$ & $(6,5)$ & $(4,3)$ \\
364 \hline
365 \end{tabular}
366 \end{center}
367 \caption{Relation between line slopes
368 and approximate vector slopes\label{Tab1}}
369 \end{table}
370
371 \LaTeX{} allows to put an arrow just at the end of the vector.
372 The command \verb?\Vector? enables to put
373 along the vector {\em arbitrary} arrows with different orientation
374 (see Fig.~\ref{TwoVec}). The predefined arrow styles
375 assign a letter to each position and orientation
376 of the arrow along the {\tt Vector}.
377
378 \begin{figure}
379 \centerline{\fbox{\begin{Picture}[50](300,40)
380 \put(20,5){\Vector[bme](1,0){100}}
381 \put(20,30){\Vector[BME](1,0){100}}
382 \put(170,5){\Vector[xZmM](1,0){100}}
383 \put(170,30){\Vector[XzmM](1,0){100}}
384 \end{Picture}}}
385 \caption{Multi-arrow vectors\label{TwoVec}}
386 \end{figure}
387
388 The arrows shown on Fig.~\ref{TwoVec} are drawn by the commands
389 \begin{quote}
390 \begin{verbatim}
391 \begin{picture}(300,40)
392 \put(20,5){\Vector[bme](1,0){100}}
393 \put(20,30){\Vector[BME](1,0){100}}
394 \put(170,5){\Vector[xmMZ](1,0){100}}
395 \put(170,30){\Vector[XmMz](1,0){100}}
396 . . . . . . . .
397 \end{verbatim}
398 \end{quote}
399
400 Letter {\tt e} corresponds to normally oriented arrow
401 at the end of vector, {\tt E} --- to reverse oriented arrow,
402 {\tt b} and {\tt B} --- to (normally and reverse oriented) arrows at the
403 beginning of the vector, {\tt m} and {\tt M} --- to the arrows
404 at the middle, etc.
405 The list of letters as the optional parameter produces
406 the set of arrows along the {\tt Vector}.
407 It is possible to create user-defined styles of arrows using the commands
408 \verb?\VectorStyle? and \verb?\VectorShiftStyle? (where the parameters
409 in square brackets are {\em obligatory}, not {\em optional}):
410 \begin{itemize}
411 \item[] {\tt\bs{}VectorStyle[{\em style-char}]\{{\em shift-char}\}\{{\em position}\}\{{\em orientation}\}}
412 \begin{itemize}
413 \item {\em style-char} is the character which is assigned to vector style;
414 \item {\em shift-char} is the character which defines the relative shift
415 of the arrow with respect to {\em position} --- see command
416 {\tt\bs{VectorShiftStyle}} below;
417 \item {\em position} is the real value which defines the relative position
418 of the arrow along the vector (0.0 means starting point of the vector,
419 1.0 means end point of the vector) which usually is in a range
420 $0..1$ but can be greater 1 or less 0 as well;
421 \item {\em orientation} is the character which defines the orientation
422 of the arrow with respect to the standard direction of the vecrtor:
423 {\tt b} means {\em backward} direction, {\tt f} (or any other
424 character) means forward direction.
425 \end{itemize}
426 \item[] {\tt\bs{}VectorShiftStyle[{\em style-char}]\{{\em shift}\}}
427 \begin{itemize}
428 \item {\em style-char} is the character which is assigned to vector-shift-style;
429 \item {\em shift} is the relative shift in {\tt pt} of the arrow along
430 the arrow direction with respect to the positioning point
431 (it is necessary to note that the length of the arrow body in \LaTeX{}
432 is equal to {\tt 4pt}).
433 \end{itemize}
434 \end{itemize}
435 Examples:
436 \begin{itemize}
437 \item standard {\em vector-shift-styles}:
438 \begin{description}
439 \item[\quad{\tt\bs{}VectorShiftStyle[e]\{0pt\}}]
440 --- style `{\tt e}' means that
441 the end of the arrow is positioned strictly at the point,
442 specified by the parameter {\em position};
443 \item[\quad{\tt\bs{}VectorShiftStyle[b]\{4pt\}}]
444 --- style `{\tt b}' means that
445 the backside of the arrow is positioned at the point,
446 specified by the parameter {\em position};
447 \item[\quad{\tt\bs{}VectorShiftStyle[m]\{3pt\}}]
448 --- style `{\tt m}' means that
449 the middle of the arrow body is positioned at the point,
450 specified by the parameter {\em position};
451 \item[\quad{\tt\bs{}VectorShiftStyle[E]\{-2pt\}}]
452 --- style `{\tt E}' means that
453 the end of the arrow is positioned a little bit before
454 (i.e., by {\tt 2pt}) the point,
455 specified by the parameter {\em position};
456 \item[\quad{\tt\bs{}VectorShiftStyle[B]\{6pt\}}]
457 --- style `{\tt B}' means that
458 the backside of the arrow is positioned a little bit after
459 (i.e., by {\tt 2pt}) the point,
460 specified by the parameter {\em position}.
461 \end{description}
462 \item standard {\em vector-styles}:
463 \begin{description}
464 \item[\quad{\tt\bs{}VectorStyle[e]\{e\}\{1.0\}\{f\}}]
465 --- style `{\tt e}' means that
466 the end of the arrow is positioned at the end of the vector,
467 and its orientation is along the vector orientation;
468 \item[\quad{\tt\bs{}VectorStyle[E]\{b\}\{1.0\}\{b\}}]
469 --- style `{\tt E}' means that
470 the backside of the arrow is positioned at the end of the vector,
471 and its orientation is rotated by $180^{\circ}$ with
472 respect to the vector orientation;
473 \item[\quad{\tt\bs{}VectorStyle[b]\{b\}\{0.0\}\{f\}}]
474 --- style `{\tt b}' means that
475 the backside of the arrow is positioned at the beginning of the vector,
476 and its orientation is along the vector orientation;
477 \item[\quad{\tt\bs{}VectorStyle[B]\{e\}\{0.0\}\{b\}}]
478 --- style `{\tt B}' means that
479 the end of the arrow is positioned at the beginning of the vector,
480 and its orientation is rotated by $180^{\circ}$ with
481 respect to the vector orientation;
482 \item[\quad{\tt\bs{}VectorStyle[m]\{m\}\{0.0\}\{f\}}]
483 --- style `{\tt m}' means that
484 the middle of the arrow body is positioned at the middle of the vector,
485 and its orientation is along the vector orientation;
486 \item[\quad{\tt\bs{}VectorStyle[M]\{m\}\{0.0\}\{b\}}]
487 --- style `{\tt M}' means that
488 the middle of the arrow body is positioned at the middle of the vector,
489 and its orientation is rotated by $180^{\circ}$ with
490 respect to the vector orientation;
491 \item[\quad{\tt\bs{}VectorStyle[x]\{E\}\{1.0\}\{f\}}]
492 --- style `{\tt x}' means that
493 the end of the arrow is positioned a little bit before
494 the end of the vector,
495 and its orientation is along the vector orientation;
496 \item[\quad{\tt\bs{}VectorStyle[X]\{B\}\{1.0\}\{b\}}]
497 --- style `{\tt X}' means that
498 the backside of the arrow is positioned a little bit before
499 the end of the vector,
500 and its orientation is rotated by $180^{\circ}$ with
501 respect to the vector orientation;
502 \item[\quad{\tt\bs{}VectorStyle[z]\{B\}\{0.0\}\{f\}}]
503 --- style `{\tt z}' means that
504 the backside of the arrow is positioned a little bit after
505 the beginning of the vector,
506 and its orientation is along the vector orientation;
507 \item[\quad{\tt\bs{}VectorStyle[Z]\{E\}\{0.0\}\{b\}}]
508 --- style `{\tt Z}' means that
509 the end of the arrow body is positioned a little bit after
510 the beginning of the vector,
511 and its orientation is rotated by $180^{\circ}$ with
512 respect to the vector orientation.
513 \end{description}
514 \end{itemize}
515
516 \section*{Circles}
517
518 The range of the diameters for circles and disks
519 (black circular blobs) available in \LaTeX{} is very restricted.
520 It can be enlarged by using the magnified pseudo-graphical \LaTeX{} fonts
521 if the User does not have something better at his/her disposal
522 like {\tt curves.sty}, \PiC\TeX{} or MF\PiC.
523 The disadvantage of this method is that the width
524 of the lines is magnified too which is inconsistent
525 with the rigorous \TeX{} accuracy requirements,
526 but for {\em poor man graphics} these circles
527 can be satisfactory.
528
529 The scaling of circular fonts is performed by the commands
530 \begin{quote}
531 {\tt\bs{}scaledcircle\lb{\em factor}\rb}
532 \\
533 {\tt\bs{}magcircle\lb{\em magstep}\rb}
534 \end{quote}
535 which are indentical to \TeX{} commands
536 \begin{quote}
537 {\tt\bs{}font ... scaled {\em factor}}
538 \\
539 {\tt\bs{}font ... scaled \bs{}magstep {\em magstep}}
540 \end{quote}
541 The valid {\em magstep} values are {\tt 0}, {\tt h},
542 {\tt 1}, {\tt 2}, {\tt 3}, {\tt 4}, {\tt 5}.
543 The values {\em factor}=1000 and {\em magstep}=0
544 correspond to {\em one-to-one} magnification.
545 The circle magnification
546 like other \TeX{} commands returns to its
547 previous value outside the group inside which it was changed.
548
549 \begin{figure}
550 \def\myframe#1{\begin{picture}(0,0)
551 \put(0,#1){\line(1,0){#1}}
552 \put(0,#1){\line(-1,0){#1}}
553 \put(0,-#1){\line(1,0){#1}}
554 \put(0,-#1){\line(-1,0){#1}}%
555 \put(#1,0){\line(0,1){#1}}%
556 \put(#1,0){\line(0,-1){#1}}%
557 \put(-#1,0){\line(0,1){#1}}%
558 \put(-#1,0){\line(0,-1){#1}}%
559 \end{picture}}
560 \begin{center}
561 \begin{Picture}[50](200,100)(-100,-50)
562 \unitlength=1pt
563 \put(-50,0){\thicklines\circle{80}}
564 \put(-50,0){\myframe{40}}
565 \put(50,0){\scaledcircle{2000}\circle{80}}
566 \put(50,0){\myframe{40}}
567 \end{Picture}
568 \end{center}
569 \caption{Magnified circles\label{Fig1}}
570 \end{figure}
571
572 To calculate properly the circle character code
573 after the magnification it was necessary to redefine
574 some internal \LaTeX{} commands like
575 {\tt\bs{}@getcirc} and {\tt\bs{}@circ}. To reflect
576 in magnified fonts the changes of the line thickness,
577 the commands {\tt\bs{}thinlines} and {\tt\bs{}thicklines}
578 are corrected also.
579
580 The example on Fig.~\ref{Fig1} is produced by
581 \begin{quote}
582 \begin{verbatim}
583 \setlength{\unitlength}{1pt}
584 \begin{picture}(200,100)(-100,-50)
585 \put(-50,0){\thicklines\circle{80}}
586 \put(-50,0){\squareframe{40}}
587 \magcircle{4}
588 \put(50,0){\thinlines\circle{80}}
589 \put(50,0){\squareframe{40}}
590 \end{picture}
591 \end{verbatim}
592 \end{quote}
593 where {\tt\bs{}squareframe} is the user-defined command which draws
594 the square with the specified side and the centrum at (0,0).
595 It shows how the usage of the magnified circles enables to overcome
596 the upper limit 40pt of the diameter of the \LaTeX{} cirles.
597 It is necessary to note that
598 the thickness of the {\tt\bs{}thinline} circles
599 after magnification with
600 {\tt\bs{}magcircle\lb{}4\rb}
601 corresponds approximately to the thickness
602 of the ordinary {\tt\bs{}thickline} circles
603 ($\hbox{\tt\bs{}magstep4}\approx2000$).
604
605 \bigskip
606
607 \begin{figure}
608 \begin{center}
609 \begin{Picture}[50](200,60)(-100,-30)
610 \put(-60,10){\thicklines\tlcircle{50}}
611 \put(-60,10){\circle*{1}}
612 \put(-60,10){\line(-1,0){25}}
613 \put(-60,10){\line(0,1){25}}
614 \put(-60,-10){\thicklines\blcircle{50}}
615 \put(-60,-10){\circle*{1}}
616 \put(-60,-10){\line(-1,0){25}}
617 \put(-60,-10){\line(0,-1){25}}
618 \put(-40,10){\thicklines\trcircle{50}}
619 \put(-40,10){\circle*{1}}
620 \put(-40,10){\line(1,0){25}}
621 \put(-40,10){\line(0,1){25}}
622 \put(-40,-10){\thicklines\brcircle{50}}
623 \put(-40,-10){\circle*{1}}
624 \put(-40,-10){\line(1,0){25}}
625 \put(-40,-10){\line(0,-1){25}}
626 \put(40,10){\thicklines\BRcircle{50}}
627 \put(40,10){\circle*{1}}
628 \put(40,10){\line(-1,0){25}}
629 \put(40,10){\line(0,1){25}}
630 \put(40,-10){\thicklines\TRcircle{50}}
631 \put(40,-10){\circle*{1}}
632 \put(40,-10){\line(-1,0){25}}
633 \put(40,-10){\line(0,-1){25}}
634 \put(60,10){\thicklines\BLcircle{50}}
635 \put(60,10){\circle*{1}}
636 \put(60,10){\line(1,0){25}}
637 \put(60,10){\line(0,1){25}}
638 \put(60,-10){\thicklines\TLcircle{50}}
639 \put(60,-10){\circle*{1}}
640 \put(60,-10){\line(1,0){25}}
641 \put(60,-10){\line(0,-1){25}}
642 \end{Picture}
643 \end{center}
644 \caption{$90^{\circ}$ circular segments\label{Fig2}}
645 \end{figure}
646
647 Additional macro enable to
648 draw $90^{\circ}$ qu\-a\-ters of the circles explicitly without
649 tricky refinement of the parameters of the command {\tt\bs{}oval}:
650 \begin{quote}
651 {\tt\bs{}trcircle\lb{\em diam}\rb} $\longrightarrow$ {\tt\bs{}oval[tr]...}
652 \\
653 {\tt\bs{}brcircle\lb{\em diam}\rb} $\longrightarrow$ {\tt\bs{}oval[br]...}
654 \\
655 {\tt\bs{}tlcircle\lb{\em diam}\rb} $\longrightarrow$ {\tt\bs{}oval[tl]...}
656 \\
657 {\tt\bs{}blcircle\lb{\em diam}\rb} $\longrightarrow$ {\tt\bs{}oval[bl]...}
658 \end{quote}
659 The centrum of the circular arc is positioned strictly at the
660 point which is the argument of the corresponding {\tt\bs{}put}.
661 The commands {\tt\bs{}TRcircle}, {\tt\bs{}BRcircle}, {\tt\bs{}TLcircle},
662 {\tt\bs{}BLcircle} draw the $90^{\circ}$ circular quaters
663 with the reference point positioned at the corner
664 instead of the centrum.
665 Similarly, the commands
666 \begin{itemize}
667 \item[] {\tt\bs{}tlsector}, {\tt\bs{}TLsector},
668 {\tt\bs{}blsector}, {\tt\bs{}BLsector}, \dots
669 \end{itemize}
670 draw circular segments together with horizontal
671 and vertical radii. The proper positioning of the
672 circular segments requires special precausions
673 since it is necessary to take into account the
674 line thickness and the specific alignment of the
675 circular elements inside the character boxes.
676
677 The example on Fig~\ref{Fig2}
678 shows the usage of these commands:
679 \begin{quote}
680 \begin{verbatim}
681 \begin{picture}(200,60)(-100,-30)
682 \put(-60,10){\thicklines\tlcircle{50}}
683 \put(-60,10){\circle*{1}}
684 \put(-60,10){\line(-1,0){25}}
685 \put(-60,10){\line(0,1){25}}
686 \put(40,10){\thicklines\BRcircle{50}}
687 \put(40,10){\circle*{1}}
688 \put(40,10){\line(-1,0){25}}
689 \put(40,10){\line(0,1){25}}
690 ... ... ...
691 \end{verbatim}
692 \end{quote}
693 The actual diameter of the circular segment
694 is adjusted like it is done with the circles.
695 The commands {\tt\bs{}scaledcircle} and {\tt\bs{}magcircle}
696 affect the thickness and the diameter of these circular segments also.
697
698
699 \section*{Frames}
700
701 \def\DiskCorner{8pt}
702 \def\RoundCorner{6pt}
703 \def\LineCorner{10pt}
704 \def\RectCorner{3pt}
705
706 \framesep{-2pt}
707 \shadowsep{1pt}
708 \shadowsize{8pt}
709 \shadowshrink{1}
710
711 The set of frames which are available in \LaTeX{} is
712 enhanced in \pmg{} --- except solid and dashed rectangular frames
713 it is possible to draw double and tripple frames in a variety
714 of styles (Fig.~\ref{ThrFr}). The commands
715 \verb?\frameBox?, \verb?\ovalBox?, \verb?\octalBox?,
716 \verb?\astroBox?, \verb?\parquetBox? have the same structure
717 as the command \verb?\framebox?, but they draw the
718 corresponding fancy frames:
719 \begin{quote}
720 \begin{verbatim}
721 \put(0,0){\ovalBox(100,50){oval}}
722 \put(70,0){\astroBox(100,50){astro}}
723 . . . . . . . . . . . . .
724 \end{verbatim}
725 \end{quote}
726 The ordinary solid frame is drawn by \verb?\frameBox?,
727 the double and triple frames are drawn by \verb?\frameBoX?
728 and \verb?\frameBOX?, respectively. Similar commands exist for
729 double and triple fancy frames.
730 The User can prepare the personal macro commands to draw frame corners
731 and extend the variety of fancy frames up to the limit of his/her fantasy.
732
733 \begin{figure}
734 \centerline{\begin{Picture}[50](2000,800)
735 \put(100,0){\parquetBox(500,300){parquet}}
736 \put(100,500){\octalBox(500,300){octal}}
737 \put(700,0){\ovalBoX(500,300){oval}}
738 \put(700,500){\astroBoX(500,300){astro}}
739 \put(1300,0){\dashBOX{10}(500,300){dash}}
740 \put(1300,500){\frameBOX(500,300){frame}}
741 \end{Picture}}
742 \caption{Examples of frame styles\label{ThrFr}}
743 \end{figure}
744
745 \begin{figure}
746 \centerline{\begin{Picture}[50](600,100)(-30,0)
747 \thicklines
748 \rombboxstyle(2,1,1pt)
749 \put(20,20){\rombBox[z](50,50){Box}}
750 \put(220,20){\rombBoX[z](50,50){BoX}}
751 \put(440,20){\rombBOX[z](50,50){BOX}}
752 \end{Picture}}
753 \caption{Romb-style frames\label{RombFram}}
754 \end{figure}
755
756 \begin{figure}
757 \centerline{\begin{Picture}[50](800,200)(-130,0)
758 \put(-100,20){\frameBox(100,100){}}
759 \put(220,20){\frameBox(100,100){}}
760 \put(540,20){\frameBox(100,100){}}
761 \thicklines
762 \rombboxstyle(2,1,1pt)
763 \put(-100,20){\rombBox[x](100,100){\tt x}}
764 \put(220,20){\rombBox[y](100,100){\tt y}}
765 \put(540,20){\rombBox[z](100,100){\tt z}}
766 \end{Picture}}
767 \caption{Alignment of romb boxes\label{FigRR}}
768 \end{figure}
769
770 More exotic variant of a frame can be created using
771 the commands {\tt\bs{}rombBox}, {\tt\bs{}rombBoX}
772 or {\tt\bs{}rombBOX} as it is shown on Fig.~\ref{RombFram}.
773 The style (i.e., inclination of the romb sides)
774 and the distance between multiple rombs
775 are set by the command {\tt\bs{}rombboxstyle}
776 \begin{description}
777 \item[\quad{\tt\bs{}rombboxstyle($\Delta x$,$\Delta y$,{\em len})}]
778 --- defines the inclination for the romb boxes and for the
779 corners of the {tt octal} frames and shadows.
780 Parameters $\Delta x$, $\Delta y$ specifies the inclination,
781 and the parameter {\em len} --- the length of the inclined
782 corners (for {\tt octal} frames and shadows only) in a style
783 similar to the command
784 {\tt\bs{}line($\Delta x$,$\Delta y$)\{{\em len}\}}.
785 \end{description}
786 with the default settings as
787 \begin{center}
788 {\tt\bs{}rombboxstyle(2,1,2pt)}
789 \end{center}
790 The alignment of the romb around the box specified
791 for these commands can be varied using
792 additional optional parameter(see Fig.~\ref{FigRR}. The full format of the
793 {\tt rombbox} commands is:
794 \begin{itemize}
795 \item[]
796 {\tt\bs{}rombBox[{\em char}]($\Delta X$,$\Delta Y$)\{{\em text}\}}
797 \end{itemize}
798 where
799 {\em char} -is one-character parameter which
800 defines the alignment of the romb frame with respect to
801 rectangle $(\Delta X,\Delta Y)$:
802 {\tt x} (default value) means that the $x$-axis coinsides with the
803 $x$-axis of the rectangle,
804 {\tt y} means that the $y$-axis coinsides with the
805 $y$-axis of the rectangle,
806 {\tt z} means that the corners of the rectangle are at the
807 sides of the romb frame.
808
809 \begin{figure}
810 \begin{center}
811 \begin{Picture}[50](2000,1100)(0,-500)
812 \put(0,50){\frameBox[r](500,200){r}}
813 \put(0,400){\frameBox[R](500,200){R}}
814 \put(700,50){\frameBox[p](500,200){p}}
815 \put(700,400){\frameBox[P](500,200){P}}
816 \put(1400,50){\frameBox[o](500,200){o}}
817 \put(1400,400){\frameBox[O](500,200){O}}
818 \shadowsize{12pt}
819 \put(100,-400){\frameBox[A](800,300){A}}
820 \put(1100,-400){\frameBox[L](800,300){L}}
821 \end{Picture}
822 \end{center}
823 \caption{Examples of shadows\label{TypShad}}
824 \end{figure}
825
826 \begin{figure}
827 \begin{center}
828 \begin{Picture}[35](2000,1500)
829 \shadowcorner{B}
830 \put(0,0){\frameBoX[oPRpAORr](1000,500){Shadows}}
831 \end{Picture}
832 \end{center}
833 \caption{Multiple shadows\label{TypShad2}}
834 \end{figure}
835
836 Each rectangular box has the optional parameter which enable to specify
837 the ``shadows'' around this box. Each shadow style has a special letter,
838 and the list of letters as the optional parameter draws a list of shadows.
839 The standard shodow types are shown on Fig.~\ref{TypShad}.
840 It is possible to draw several shadows of different types
841 and around arbitrary corner of the frame as it is shown
842 on Fig.~\ref{TypShad2}:
843 \begin{quote}
844 \begin{verbatim}
845 \unitlength=10pt
846 \begin{picture}(20,15)
847 \shadowcorner{B}
848 \put(0,0){\frameBoX[oPR...](10,5){...}}
849 \end{picture}
850 \end{verbatim}
851 \end{quote}
852 The parameter of the shadows --- thickness, corner size,
853 additional shift, etc., --- can be varied
854 by the following User commands:
855 \begin{description}
856 \item[\quad{\tt\bs{}framesep\{{\em dist}\}}]
857 --- set the distance between double and triple
858 frames. It can be negative as well as positive.
859 Default value: {\tt\framesep\{2pt\}}.
860 \item[\quad{\tt\bs{}shadowsep\{{\em dist}\}}]
861 --- set the gap distance between the frame and the shadow
862 or between multiple shadows.
863 Default value: {\tt\shadowsep\{1pt\}}.
864 \item[\quad{\tt\bs{}shadowsize\{{\em dist}\}}]
865 --- set the depth of the shadow.
866 Default value: {\tt\shadowsize\{5pt\}}.
867 \item[\quad{\tt\bs{}shadowshrink\{{\em factor}\}}]
868 --- set the contraction factor for the subsequent shadows.
869 Default value: {\tt\shadowshrink\{1\}}.
870 \item[\quad{\tt\bs{}shadowcorner\{{\em char}\}}]
871 --- set the corner for the shadows.
872 Valid values: {\tt A}, {\tt B}, {\tt C}, {\tt D}.
873 Default value: {\tt\bs{}shadowcorner\{A\}}.
874 \item[\quad{\tt\bs{}RoundCorner\{{\em radius}\}}]
875 --- set the {\em radius} for the circular arcs
876 at the corners of oval frames and shadows with rounded corners.
877 Default value: {\tt\RoundCorner\{5pt\}}.
878 \item[\quad{\tt\bs{}DiskCorner\{{\em diam}\}}]
879 --- set the {\em diameter} for the bulbs
880 at the corners of black shadows with rounded corners.
881 Default value: {\tt\DiskCorner\{5pt\}}.
882 \item[\quad{\tt\bs{}LineCorner\{{\em len}\}}]
883 --- set the {\em length} for the inclined corners
884 of octal frames and shadows.
885 Default value: {\tt\LineCorner\{10pt\}}.
886 \item[\quad{\tt\bs{}RectCorner\{{\em size}\}}]
887 --- set the {\em size} for the parquette corners
888 of octal frames and shadows.
889 Default value: {\tt\RectCorner\{5pt\}}.
890 \end{description}
891
892
893 \section*{Rombs}
894
895 Special command enable to draw rombs (see Fig.~\ref{FigRomb}):
896 \begin{itemize}
897 \item[] {\tt \bs{}put({\em x})({\em y})
898 \{\bs{}romb[{\em pos}]($\Delta x$,$\Delta y$)\{{\em len}\}\}}
899 \end{itemize}
900 where:
901 \begin{itemize}
902 \item[] $(x,y)$ --- position of the romb inside {\tt picture};\\
903 {\em pos} --- one-character option which shows the alignment of romb
904 with respect to $(x,y)$: {\tt r} means right corner,
905 {\tt l} means left corner; {\tt c} means center (default);\\
906 $(\Delta x,\Delta y)$ and {\em len} are the parameters which
907 define the inclination and the length of the romb side
908 (similarly to {\tt\bs{}line}).
909 \end{itemize}
910
911 \begin{figure}
912 \centerline{\begin{Picture}[75](800,200)(-30,-100)
913 \thicklines
914 \put(20,20){\romb[c](2,1){90}}
915 \put(20,20){\circle*{10}}
916 \put(20,-60){\makebox(0,0){\tt c}}
917 \put(220,20){\romb[l](2,1){90}}
918 \put(220,20){\circle*{10}}
919 \put(220,-60){\makebox(0,0){\tt l}}
920 \put(640,20){\romb[r](2,1){90}}
921 \put(640,20){\circle*{10}}
922 \put(640,-60){\makebox(0,0){\tt r}}
923 \end{Picture}}
924 \caption{Alignment of rombes\label{FigRomb}}
925 \end{figure}
926
927 \section*{Automatically scaled pictures}
928
929 The idea of the macros which are responsible for these functions
930 is to calculate the {\tt \bs{}unitlength} va\-lue in terms of the
931 {\em relative fraction} of the page width instead of explicit
932 specifying its value in points, centimeters, inches, etc.
933
934 The command {\tt\bs{}pictureunit[{\em percent}]\lb{\em x-size}\rb}
935 selects the value of the variable {\tt\bs{}unitlength} so that the picture
936 which is {\em x-size} units in width occupies {\em percent}
937 width of the paper.
938 The environment {\tt Picture} combines the automatic calculation of
939 the {\tt\bs{}unitlength} with the {\tt\bs{}begin\lb{}picture\rb} --
940 {\tt\bs{}end\lb{}picture\rb}.
941 By default {\em percent}=100 is used which corresponds to 90\%
942 of the paper width. The default {\em percent} value can be redefined
943 by the command
944 \begin{center}
945 {\tt\bs{}def\bs{}defaultpercent\lb{\em percent}\rb}.
946 \end{center}
947
948 Examples:
949 \begin{center}
950 \begin{tabular}{l}
951 {\tt\bs{}pictureunit[75]\lb{}120\rb}\\
952 {\tt\bs{}begin\lb{}picture\rb(120,80)}\\
953 \dots\\
954 {\tt\bs{}end\lb{}picture\rb}\\
955 \phantom{.}\\
956 {\tt\bs{}begin\lb{}Picture\rb[75](120,80)}\\
957 \dots\\
958 {\tt\bs{}end\lb{}Picture\rb}
959 \end{tabular}
960 \end{center}
961
962 These macros are inspired by {\tt fullpict.sty} by Bruce Shawyer.
963 Carefull examination of the file {\tt fullpict.sty}
964 shows some bugs/warnings which require correction:
965 \begin{itemize}
966 \item
967 each automatic scaling of {\tt \bs{}unitlength}
968 allocates a new counter;
969 \item
970 automatic scaling uses {\tt\bs{}textwidth}
971 as the reference width which results to improper functioning
972 inside list and {\tt minipage} environments;
973 \item
974 the environments {\tt fullpicture}, {\tt halfpicture}
975 and {\tt scalepicture} are centered internally
976 with {\tt\bs{}begin\lb{}center\rb} --- {\tt\bs{}end\lb{}center\rb}
977 which prevents the proper positioning of the picture in most cases.
978 \end{itemize}
979 The \pmgs{} macros calculates the dimension
980 {\tt\bs{}unitlength}
981 using the value {\tt\bs{}hsize}, and as a result
982 it works corectly also for {\tt twocolumn} mode,
983 inside the {\em list} environments
984 {\tt itemize}, {\tt enumerate}, etc.
985 (for example, all the figures in this paper
986 are drawn using the environment {\tt Picture}).
987 The automatic centering and repeatedly allocation
988 of the registers are corrected as well.
989
990 \section*{Acknowledgements}
991
992 The authors are grateful to Dr.\ Kees van der Laan
993 for the possibility to present the results of our research
994 at the EURO\TeX'95 (Aarnhem, Netherland).
995
996 One of the authors (A.S.Berdnikov) would like to express his warmest
997 thanks to Dr.\ A.Compagner from the Delft University of Technology
998 who spent a lot of his time and efforts trying to transform two naive
999 students from Russia (namely, him and his co-worker Sergey Turtia)
1000 into serious scientists.
1001
1002 This research was partially supported by a grant
1003 from the Dutch Organization for Scientific Research
1004 (NWO grant No 07--30--007).
1005
1006 \end{document}
1007
1008
1009
1010
1011
1012
1013
1014