Overview | The picture Environment | The pstricks Package | ||
LaTeX Graphics | The picture Environment | LaTeX Graphics |
Contents
|
|
Basics |
|
Line segments | Source file |
The line command has two arguments:
The picture illustrates all 25 possible slope values in the first quadrant. The length is relative to unitlength. The length argument is the vertical coordinate in the case of a vertical line segment, the horizontal coordinate in all other cases. Because of the restrictions to direction vectors, drawing line segments usually necessitates an extensive search for suitable points. In many cases, drawing the desired line segments may not be possible without the use of additional packages, such as eepic, or pstricks. |
|
Circles | Source file |
The argument of the circle command is relative to unitlength
and determines the diameter (not the radius). The original picture environment
only admits diameters up to approximately 14mm, and even below this limit, not all diameters are possible.
The circle*
command produces disks (filled circles).
As for drawing larger circles, see the section about circles and ellipses. |
|
Arrows | Source file |
For arrows, the components of the direction vector are even more restricted than for line segments, namely
to the integers
Components also have to be coprime (no common divisor except 1). Notice the effect of the \thicklines
command on the arrows pointing to the upper left.
|
|
The multiput and
| Source file |
The \multiput command has 4 arguments: the starting point, the translation vector, the number of
objects, and the object to be drawn. The \linethickness{ length} command applies to horizontal
and vertical line segments, but neither to oblique line segments, nor to circles. It does, however, apply to
quadratic Bézier curves!
|
|
Ovals, thinlines, thicklines | Source file |
Line thickness can be controlled by two kinds of commands: \linethickness{ length}
on the one hand, thinlines and thicklines on the other. While
\linethickness{0.075mm} applies only to horizontal and vertical lines (and quadratic Bézier curves),
\thinlines and \thicklines apply to oblique line segments as well as to curves such as
circles or ovals.
|
|
Text, formulas, colors | Source file |
The color package allows the use of
and of picture environments.
Predefined colors of the color package are: black, white, red, green, blue, yellow, cyan, and magenta. As the current example shows, the definecolor command allows for the definition of arbitrary further colors in terms either of the gray, or the rgb color model. (LATEX also supports a third color model, cymk). As this example shows, the colorbox and the fcolorbox commands are not compatible with latex2html, which produced this text. |
|
Quadratic Bézier curves | Source file |
As this example illustrates, splitting up a circle into four quadratic Bézier curves is not
satisfactory. For a better solution, see the section about quadratic Bézier curves.
The example again shows the effect of the linethickness command on horizontal or vertical lines, and of the thinlines and thicklines commands on oblique line segments. It also shows that both kinds of commands affect quadratic Bézier curves, each command overriding all previous ones. |
|
Let denote the end points, and the respective slopes, of a quadratic Bézier curve. The intermediate control point is then given by the equations |
|
(1) | |
The Java program qbezier.java (see PDF Version) started with the line
|
|
Marking angles | Source file |
In the current picture, arcs are approximated by quadratic Bézier curves. | |
In order to get the control points of an arc of radius marking the angle , one has to
|
|
Line thickness again:
| Source file |
As can be seen from this picture, the command linethickness{length} applies to horizontal and vertical lines as well as to Bézier curves, but not to circles, or oblique line segments. Ovals are a combination of horizontal and vertical lines, and arcs. | |
Line thickness again:
| Source file |
As the comparison of the lower half of the picture with the upper half shows, the thinlines and the thicklines commands apply to all line segments and curves, but the effect cannot said to be very striking. | |
Multiple use of
| Source file |
A partial picture can be declared and defined by the commands
\unitlength .
An object defined with the savebox command (such as |
|
Applications | |
Falling mass | Source file |
Simultaneousness | Source file |
Moving light clock | Source file |
Rotation of axes | Source file |
Rapidity | Source file |
Each symmetric half of the tanh curve is approximated by a quadratic
Bézier curve. See (1) for details.
|
|
Clocks in gravitational field | Source file |
Line of simultaneousness | Source file |
The inserts in the input file drawing the angle markings are produced, according to Marking angles with the Java program arc.java (see PDF Version). | |
Isotropic spherical waves | Source file |
Additional Examples of Bézier Curves |
|
Catenary | Source file |
The right half of the curve ends in the point , the slope there having the value . Using equation (1) in the section Quadratic Bézier curves, we can calculate the intermediate control points. They turn out to be and . Or, using the Java program qbezier.java described there (see PDF Version), we can generate the qbezier command lines and insert them into the LATEX file. The red crosses indicate points of the real catenary. The error is barely noticeable, being less than one percent. | |
Forces on the catenary | Source file |
Catenaries of
| Source file |
From the equation
of the catenary, it is seen that all catenaries can be obtained by scaling the curve with factor . A catenary of length having its vertex in the origin and ending in the point satisfies (see http://www.vsmp.ch, Bulletin nr. 87) the equations |
|
From these equations, for we get:
Using equation (1) in the section Quadratic Bézier curves, we can calculate the intermediate control points. Or we can, by using the Java program qbezier.java described there (see PDF Version), produce the qbezier command lines and insert them into the LATEX file. |
|
Circles and ellipses | Source file |
The circle () was built from 8 arcs, each of 45 degrees, and each approximated by a quadratic Bézier curve. Circles and ellipses can then be obtained by rotating, scaling and translating. | |
Thus, the building block of all the circles and ellipses is the quadratic Bézier curve determined by
the control points
|
|
|
(2) |
45 degrees arc
The quadratic Bézier curve with control points (2)
is given by the equation
From this, we get:
| |
(3) | |
The error amounts to approximately 0.3 percent. From (3), we further conclude that for . Letting , we can see the symmetry with respect to : The Java program bezierellipsen.java (see PDF Version) generates a file, ellipse.tex, which can be pasted into a picture environment. Running the program with
|
|
Enhancing the picture Environment with Packages epic and eepicThe packages epic and eepic enhance the picture environment. They are extensively described in GOOSSENS, MITTELBACH, SAMARIN[1].Two applications of epic: matrixput and putfile |
|
matrixput |
Source file |
The \matrixput command is the natural generalization of the \multiput command to two dimensions.
As this example shows, not all the pixels always make it into the final picture. |
|
putfile |
Source file |
The slash in the command \putfile{data/datafile1} may have to be replaced by the backslash on a Windows
system.
The two files datafile1 and datafile2 contain one coordinate pair on each line.
|
|
datafile1, for example, contains the lines 10 10 20 20 30 20 35 21 50 15 55 16 52 17 60 16 |
|
Line segments and circles
|
Source file |
With the use of the eepic package, line segments of any slope (defined by two integers), and circles of any radius can be drawn within the picture environment. | |
Bibliography
|