Overview | The picture Environment | The pstricks Package
LaTeX Graphics The pspicture Environment LaTeX Graphics



Contents




Unlike epic and eepic, the pstricks package brings with it its own environment, pspicture, with drawing commands different from those of the picture environment. A detailed description can be found in GOOSSENS, RAHTZ, MITTELBACH[2].

Remark. pdflatex cannot deal directly with commands of the pstricks package. The pictures in Section 3 were generated with the commands
latex \(\vert\) dvips \(\vert\) ps2pdf
and subsequently converted into png pictures. These were then imported with the \includegraphics command.



Line Segments and Circles

Regular polygon

Source file
This example illustrates how line segments of arbitrary slopes can be drawn within the pspicture environment. The command \psset{unit=3cm} sets the length unit to 3cm. (The pstricks default is 1cm.) The arguments (0, 0) and (2, 2) of \begin{pspicture} determine the upper left corner and the lower right corner of the picture. Line width ist set by
\psset{linewidth=1pt}

for the periphery, and by

\psset{linewidth=.1pt}

for the diagonals.

The points \(P_i\quad(i=0,\,\dots,\,16)\) are determined by

\begin{displaymath}
\left\{\begin{array}{rcl}
x_i & = &\displaystyle 1+\cos\le...
... 1+\sin\left(i\cdot\frac{2\pi}{17}\right).
\end{array}\right.
\end{displaymath}


Triangle

Source file
This example illustrates that pstricks allows the drawing of circles with arbitrary radii. The * after {pspicture} causes the picture to be clipped to the frame determined by (420, 420). The upper left corner not being mentioned, it defaults to (0, 0).

In the picture, a triangle is drawn with the inscribed and the circumscribed circle (solid), the three adjacent circles (dashed), and the nine point (Feuerbach) circle (dotted).


Loops and calculations

Source file
As this example shows, with the calc and the ifthen packages, LATEX assumes the capability of running through loops, taking decisions, and doing calculations. The * after {pspicture} causes the picture to be clipped to the frame determined by (100, 100). The upper left corner not being mentioned, it defaults to (0, 0).

A remark about latex2html

Unlike the latex command, the latex2html command expects all \psset commands to be placed within the pspicture environment. Otherwise, \psset is considered unknown. Thus the arguments of the \begin{pspicture} command always have to be given in the default unit, which is 1cm.



More Applications

The following examples are taken from GOOSSENS, RAHTZ, MITTELBACH[2], with slight variations. They are intended to give some hints as to the versatility of the pstricks package, and the related packages,

pstcol, pst-grad, pst-text, pst-node, pst-tree.

While the latex2html command is capable of processing pstricks commands, it cannot process pstcol, pst-grad, pst-text, pst-node, or pst-tree commands. Thus, we get the following overview:

  latex latex2html pdflatex
epic + + +
eepic + + -
pstricks + + -
pstcol,... + - -

Tribox

Source file

Curved text

Source file

Logo

Source file

Knots

Source file

Family tree

Source file



Bibliography

1
M. Goossens, F. Mittelbach, A. Samarin The LATEX Companion

2
M. Goossens, S. Rahtz, F. Mittelbach The LATEX Graphics Companion

3
John D. Hobby, User's Manual, http://cm.bell-labs.com/who/hobby/

4
Alan Hoenig, TeX Unbound, OXFORD UNIVERSITY PRESS, 1998, ISBN 0-19-509685-1

5
Donald E. Knuth. The METAFONTbook. ADDISON-WESLEY, 1992, ISBN 0-201-13445-4 und ISBN 0-201-13444-6 (soft)

6
Leslie Lampert. LATEX - A Document Preparation System. ADDISON-WESLEY, 1994 (13th Printing November 2001), ISBN 0201529831

7
Helmut Kopka. LATEX - Eine Einführung. ADDISON-WESLEY, 1992, ISBN 3-89319-434-7

8
Helmut Kopka. LATEX - Erweiterungsmöglichkeiten. ADDISON-WESLEY, 1992, ISBN 3-89319-356-1

9
Keith Reckdahl, Using Imported Graphics in LaTeX2e,
ftp://ftp.dante.de/tex-archive/info/epslatex.ps,
ftp://ftp.dante.de/tex-archive/info/epslatex.pdf