Hypertext Help with LaTeX

Picture environment

 \begin{picture}(width,height)(x-offset,y-offset)
 ...
  picture commands
 ...
 \end{picture}

The picture environment allows you to create just about any kind of picture you want containing text, lines, arrows and circles. You tell LaTeX where to put things in the picture by specifying their coordinates. A coordinate is a number that may have a decimal point and a minus sign (-), for example, 5, 2.3, or -3.1416. A coordinate specifies a length in multiples of the unit length \unitlength, so if \unitlength has been set to 1cm, then the coordinate 2.54 specifies a length of 2.54 centimeters. You can change the value of \unitlength anywhere you want, using the \setlength command, but it should be set before the beginning of the picture environment since strange things may happen if you try changing it inside the picture environment.

A position is a pair of coordinates, such as (2.4,-5), specifying the point with x-coordinate = 2.4 and y-coordinate = -5. Coordinates are specified in the usual way with respect to an origin, which is normally at the lower-left corner of the picture. Note that when a position appears as an argument, it is not enclosed in braces; the parentheses serve to delimit the argument.

The picture environment has one mandatory argument, which specifies the size of the picture. The environment produces a rectangular box with width and height determined by this argument's two values.

The picture environment also has an optional position argument, following the size argument, that can change the origin. (Unlike ordinary optional arguments, this argument is not contained in square brackets.) The optional argument gives the coordinates of the point at the lower-left corner of the picture (thereby determining the origin). For example, if \unitlength has been set to 1mm, the command

 \begin{picture}(100,200)(10,20)

produces a picture of width 100 millimeters and height 200 millimeters, whose lower-left corner is the point (10,20) and whose upper-right corner is therefore the point (110,220). Typically one initially omits the optional argument, leaving the origin at the lower-left corner. If you then want to modify your picture by shifting everything, you just add the appropriate optional argument.

The environment's mandatory argument determines the nominal size of the picture. This need bear no relation to how large the picture really is; LaTeX will happily allow you to put things outside the picture, or even off the page. The picture's nominal size is used by TeX in determining how much room to leave for it.

Everything that appears in a picture is drawn by the \put command. The command

 \put (11.3,-.3){obj}

puts the object specified by obj in the picture, with its reference point at coordinates (11.3,-.3). The reference points for various objects will be described below.

The \put command creates an LR box. You can put anything in the text argument of the \put command that you'd put into the argument of an \mbox (or related) command. When you do this, the reference point will be the lower left corner of the box.

See also

Return to LaTeX Table of Contents


Revised 12 May 1995.