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

qbezier.javaqbezier.class
bezierellipse.javabezierellipse.class
arc.javaarc.class

## Contents

There are two ways of providing LATEX documents with pictures:

1. by directly programming the pictures within LATEX,
2. by importing pictures.
We will keep in mind that ultimately, one of the following kinds of documents is to be produced:
• PS.
• PDF.
• HTML+PNG.
TEX itself comes along with a very powerful picture generator:
MetaPost is a variant of Donald Knuth's METAFONT. It produces mps files, which form a subset of the eps files (eps: «encapsulated PostScript»). «Encapsulated» means that these PostScript files have a frame preventing any disturbing interferences on import into PostScript or PDF documents.

Although programming pictures directly in LATEX is severely restricted, and often rather tiresome, there are still reasons for doing so. The documents thus produced are «small» with respect to bytes. There are no additional graphics files to be dragged along. Therefore, Sections 2.3 and 2.4 of this script present some «real life» graphics done within the original picture environment of LATEX.

# Programming pictures in LATEX

The picture environment allows programming pictures directly in LATEX. However, there are rather severe constraints, especially for the mathematician, as the slopes of line segments as well as the radii of circles are restricted to a narrow choice of values. On the other hand, the picture environment brings with it the qbezier («quadratic Bézier» curves) command. Many frequently used curves can be satisfactorily approximated by quadratic Bézier curves, although this may require some mathematical toil. If a programming language, such as Java, is used to generate qbezier blocks of LATEX input files, the picture environment becames quite powerful. Of course, the ideal language to produce qbezier blocks is APL. Detailed descriptions of the picture environment are presented, for example, in LAMPERT[6], or KOPKA[7].

The restrictions on line segments and circles can be overcome by the use of packages like epic and eepic (described, for instance, in GOOSSENS, MITTELBACH, SAMARIN[1]), or pstricks (described in detail in GOOSSENS, RAHTZ, MITTELBACH[2]).

While the former two packages just enhance the picture environment of LATEX, the pstricks package has its own environment for pictures, pspicture. The power of pstricks stems from the fact that this package makes extensive use of PostScript possibilities. Fig. 1 illustrates the possible use of the three packages for producing PDF, PS, and HTML+PNG.

Fig. 1: Producing PDF, PS, and HTML+PNG

Remarks

• In this document, latex2html means version 2002-1 (1.68). Older versions of latex2html may generate gif files instead of png files.
• If a LATEX input file uses the pstricks package, processing with latex2html requires the \psset commands to be written within the pspicture environments. Therefore, the arguments of the \begin{pspicture} command have to refer to the default unit of pstricks, which is 1cm.

# Import

There are several packages allowing the import of pictures in LATEX. The package most broadly recommended today (2002) is graphicx. The use of other packages is not considered advisable any more, as they have some drawbacks, and are not developped any further.

The graphicx package is loaded with the command

• \usepackage{graphicx}
(which has to be located in the preamble). graphicx is an extension of graphics. Moreover, while graphics sticks to the original TEX conventions concerning arguments, graphicx allows optional arguments according to the more transparent key=value scheme. Pictures can be imported with the command
• \includegraphics[key=value,...,key=value]{beispiel.eps}.
The optional arguments give rise to a rich choice of options with respect, for example, to scaling and rotating. RECKDAHL[9] contains an excellent exposition of the capabilities of graphicx. Using graphicx, one can routinely import pictures according to the following scheme:

Fig. 2: Import of pictures with graphicx

Remarks

1. pdflatex: The import of mps files requires the command \DeclareGraphicsRule{*}{mps}{*}{} in the preamble of the LATEX file.
2. mps files being special eps files, they can be imported, according to Fig. 2, with the other programs: latex, dvips, latex2html.
3. On generation by MetaPost, mps files have names like example.1, example.2, example.3, .... These names may be used for the import in all described cases.
4. In some cases, extensions such as .eps or .png can be omitted. This may be convenient if the same LATEX file is processed to PDF as well as to HTML+PNG. For details, see RECKDAHL[9].

# Technicalities

This document was produced with SuSE Linux, Version 8.0, and the TEX and LATEX versions coming with it.

As for latex2html, the newer version 2002-1 (1.68) is preferrable, as the version included in SuSE 8.0 has some drawbacks. In order to get latex2html, go to http://www.latex2html.org.

## 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