next up previous contents index
Next: C++ Basics Up: Typography Previous: Markers   Contents   Index

Labels

A label is a typographical box. Since a LATEX box occupies a rectangle on the printed page, a single location is not enough information to position a label within a figure; an alignment point is needed in addition. By default, the alignment point of a text box is its reference point, the intersection of the left edge and the baseline, which is used by LATEX to position the box on the page:\begin{center}\vbox{\input{basepoint.eepic}
}\end{center} An alignment point may be shifted manually:

  label(P(3,2), P(2,-1), "$\\rho=\\sin \\theta$");
typesets the equation $ \rho=\sin\theta$ and places the resulting text box at Cartesian location $ (3,2)$, but shifted right by 2pt and down by 1pt. Note that C++ treats ``\\'' as a ``backslash control sequence'', so a double backslash is needed in the source to get a single backslash in the output. The general label commands are:
  label(P posn, P offset, <label text>);
  label(P posn, <label text>);
  label(P posn, P offset, <label text>, align);
The first command prints a label with its LATEX reference point at the Cartesian location posn, offset in true points (on the page) by the specified amount. Offsets of 2, 4, 6, 12, or 18 points work well with a 12-point font.

The second command prints the label text in a LATEX box centered at posn. While this is perhaps the most obvious way of placing a label, it may not be the correct method, since labels often mark a geometric object that should not be covered by the label.

In the third command, the align option may be one--or an appropriate pair--of t, b, r, or l (top, bottom, right, left), or c (center). As with offsets, these alignment options specify the position of the label relative to the Cartesian location $ p$, namely they work opposite to the way they work in LATEX. For example, the alignment option br puts the label below and to the right of $ p$.

\begin{center}\vbox{\input{alignment_lr.eepic}
}\end{center} \begin{center}\vbox{\input{alignment.eepic}
}\end{center}

Each label command has a corresponding ``mask'' version (masklabel) that draws an opaque white rectangle under the label text. Masking is useful when the text of a label sits in a cluttered part of the figure. An eepic file containing masklabels requires the pstcol package.

Labels can be rotated; the angle is set in current angle units with the command label_angle(theta). A rotation angle of 90 degrees prints labels suitable for a vertical axis. An eepic file containing rotated labels requires the rotating package.

When constructing and placing a label, keep in mind that


next up previous contents index
Next: C++ Basics Up: Typography Previous: Markers   Contents   Index
Andrew D. Hwang 2004-09-04