28.03.2013 Views

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

\frame{pic elem}<br />

13.1. The picture environment 299<br />

is used instead. The placement coordinate of the \put comm<strong>and</strong> then<br />

refers <strong>to</strong> the lower left corner as usual.<br />

W<br />

\put(0.0,0.5){\frame{TEXT}}<br />

TEXT<br />

O<br />

R<br />

\put(1.5,0.0){\frame{\shortstack{W\\O\\R\\D}}}<br />

D<br />

The contents of the \frame comm<strong>and</strong> can be any of the previous<br />

picture elements, <strong>and</strong> need not be merely text. However, in many cases<br />

the output comes out wrong.<br />

✛✘<br />

\put(0,0){\frame{\vec<strong>to</strong>r(1,1){1.0}}}<br />

\put(2,0){\frame{\circle{1.0}}} ✒<br />

✚✙<br />

The first example produces the correct result, while the second has<br />

failed. In such cases, one can try putting the picture object inside a<br />

\makebox of suitable size <strong>and</strong> positioning as argument for the \frame<br />

comm<strong>and</strong>. However, it would then make more sense <strong>to</strong> use the \framebox<br />

comm<strong>and</strong> itself in place of \frame{\makebox...}.<br />

Curved lines<br />

Curved lines may be drawn in the picture environment with the comm<strong>and</strong>s<br />

\qbezier[num](x1,y1)(x2,y2)(x3,y3)<br />

which draw a quadratic Bézier curve from point (x1, y1) <strong>to</strong> (x3, y3) with<br />

(x2, y2) as the extra Bézier point. The curve is actually drawn as num + 1<br />

dots. The number of points num is an optional argument; if it is omitted,<br />

its value will be calculated <strong>to</strong> produce a solid-looking line.<br />

The meaning of the extra point can<br />

be illustrated with the example at<br />

(20,20)<br />

the right. The input is<br />

\begin{picture}(40,20)<br />

\qbezier(0,0)(20,20)(40,10)<br />

\end{picture} ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣<br />

♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣ ♣<br />

(40,10)<br />

(0,0) <br />

The curve is drawn from (0,0) <strong>to</strong> (40,10) such that the tangents at the<br />

endpoints (the dotted lines) intersect at the extra Bézier point (20,20).<br />

Another way of stating this is that, as one moves from the first <strong>to</strong> the<br />

third point, one begins by heading directly <strong>to</strong>wards the second point, <strong>and</strong><br />

on arrival at the destination, one is moving directly away from that second<br />

point again. The dotted lines in the above example, which are not drawn<br />

by the \bezier functions, illustrate this.<br />

A dotted curve may be drawn by specifying the number of points num;<br />

some experimentation may be required <strong>to</strong> get just the right effect.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!