Latex graphics

Published on March 2017 | Categories: Documents | Downloads: 46 | Comments: 0 | Views: 322
of 45
Download PDF   Embed   Report

Comments

Content

 

Graphics in LATEX 2ε [email protected] — Urs Oswald — http://www.ursoswald.ch 10th March 2003

Contents 1

2

Overview

1

The  picture  Environment of LATEX

3

1.1 Progra Programm mming ing pic pictur tures es in LATEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Technicalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1

Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Line segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.2 Circles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.3 Arrows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . linethickness s   command . . . . . . . . 2. 2.1. 1.44 The The  multiput  and the   linethicknes 2. 2.1. 1.55 Oval Ovals, s,  thinlines,  thicklines   . . . . . . . . . . . . . . . . . . 2.1.6 Text, formulas, colors . . . . . . . . . . . . . . . . . . . . . . . 2.1.7 Quadratic B´ezier curves . . . . . . . . . . . . . . . . . . . . . . 2.1.8 Marking angles . . . . . . . . . . . . . . . . . . . . . . . . . . . linethickness   command . . . . . . 2.1.9 2.1 .9 Line Line thic thickne kness ss agai again: n: the   linethickness 2.1.10 2.1. 10 Line thickness thickness again: again:  thinlines  and   thicklines   . . . . . . . 2.1.11 2.1. 11 Using the  qbezier   command to draw line segments . . . . . . 2. 2.1. 1.12 12 Mul ulttiple ple use use of pre prede defin fined ed par partial tial pict pictur ures es . . . . . . . . . . . . 2.2 Posit Position ioning ing picture   environments . . . . . . . . . . . . . . . . . . . . 2.2.1 Correcting pos positions . . . . . . . . . . . . . . . . . . . . . . . . 2.2.2 Side by side: te text and picture . . . . . . . . . . . . . . . . . . . 2.3 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 Falling mass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 Simultaneousness . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.3 Moving light clock . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.4 Rotation of axes . . . . . . . . . . . . . . . . . . . . . . . . . . 2. 2.3. 3.55 Ra Rapi pidi ditty in th thee Spe Special cial Th Theeory ory of Re Rela lati tivi vitty . . . . . . . . . . . 2.3.6 Cloc ock ks in gravitational field . . . . . . . . . . . . . . . . . . . . 2.3.7 Line of simultaneousness . . . . . . . . . . . . . . . . . . . . . . 2.3.8 Isotropic spherical waves . . . . . . . . . . . . . . . . . . . . . . 2. 2.44 Addi Additi tion onal al ex exam ampl ples es of qu quad adra rati ticc B´ezie e zierr curv curves es . . . . . . . . . . . . . 2.4.1 Catenary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.2 Forces on the catenary . . . . . . . . . . . . . . . . . . . . . . . 2.4.3 Catenaries of constant length . . . . . . . . . . . . . . . . . . . 2.4.4 Circles and ellipses . . . . . . . . . . . . . . . . . . . . . . . . . 2.5 Enhanc Enhancing ing the picture  environment with packages   epic  und  eepic   . 2.5.1 2.5 .1 Two Two appl applica icatio tions ns of   epic:  matrixput  and  putfile   . . . . . . . 2.5.2 2.5 .2 Line Line segmen segments ts an and d cir circle cless in th thee  eepic   package . . . . . . . . .

i

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 2 2

3 3 4 4 5 5 6 7 8 9 9 10 11 12 12 13 15 15 15 15 16 17 17 19 20 21 21 22 23 24 26 26 27

 

3

The  pspicture  Environment of the  pstricks   Package

3.1

3.2

4

Line segments and circles . . . . . . . 3.1.1 Regular polygon . . . . . . . . 3.1.2 Triangle . . . . . . . . . . . . . 3.1.3 Loo oop ps and calculations . . . . . 3. 3.1. 1.44 A rem remar ark k about about latex2html   . More applications . . . . . . . . . . . . 3.2.1 Tribox . . . . . . . . . . . . . . 3.2.2 Curved text . . . . . . . . . . . 3.2.3 Logo . . . . . . . . . . . . . . . 3.2.4 Knots . . . . . . . . . . . . . . 3.2.5 Family tree . . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

28

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

28 28 29 29 30 30 30 30 31 31 32

MetaPost

33

App endix

36

A qb ezier.java

36

B b ezierellipse.java

37

C arc.java

39

D Transform.mp

41

5

4.1 4.2

Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A source file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ii

33 35

 

1

Over erv view

There are two ways of providing LATEX documents with pictures: (1) by direct directly ly programming programming the pictures within within LATEX, (2) by importi importing ng pictures. pictures. We will keep in mind that ultimately, one of the following kinds of documents is to be produced:

•   PDF,

 

•   PS,

 

•   HTML+PNG.

TEX itself comes along with a very powerful picture generator:   MetaPost.



MetaPost  is a variant of Donald Knuth’s   METAFONT. It produces   mps  files, which form a subset of the eps  files (eps: “encapsula “encapsulated ted PostScr PostScript” ipt”). ). “Enca “Encapsula psulated” ted” 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 reasons for doing so. The documents documents thus produced are “small” “small” with respect to bytes. 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.

1. 1.1 1

Prog Program rammi ming ng pic pictu tures res in in LATEX

The  picture  environment allows programming pictures directly in LATEX. Howe Howeve ver, r, there there are rather rather severe constraints, especially for the mathematician, as the slopes of line segments as well as the radii of circles circles are res restri tricte cted d to a nar narro row w choic choicee of val values ues.. On the other other hand, the   picture   environment brings with it the  qbezier  (“quadratic B´eezier” zier” curves) command. Many frequently used curves can be satisfactorily approximated by quadratic B´eezier 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 becomes 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, Goossens, Mittelba Mittelbach, ch, 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  possibi  possibiliti lities. es. Fig. 1 illustrates illustrates the possible use of the three packages for producing   PDF,  PS , and  HTML+PNG. pdflatex

 

            TEX

PDF

  ps2pdf

latex

 DVI

epic eepi eepic c pstr pstricks icks

          



epic

dvips



epic eepi eepic c pstr pstricks icks

latex2html



epic eepi eepic c pstr pstricks icks

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

1

PS

HTML+PNG

 

Remarks

•  In this document,  latex2html   means means version 20022002-11 (1.6 (1.68). 8).

Older Older versions versions of   latex2html   may

generate  gif  files instead of   png  files.

•  If a L TEX input file uses the  pstricks  package, processing with  latex2html  requires the  \psset A

commands to be written   within   the  pspicture   enviro environmen nments. ts. Therefore, Therefore, the argumen arguments ts of the \begin{pspicture} command have to refer to the default unit of  pstricks, which which is 1 cm.

1. 1.2 2

Impo Import rt

There are several packages allowing the import of pictures in LATEX. The package package most broadly recomrecom graphicx mended today (2002) is . The use of other packages packages is not considered considered advisable 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. Moreo Moreove ver, r, while while graphics  sticks to the original TEX conventions concerning arguments,  graphicx  allows optional arguments according to the more transparent  key=value  scheme.   scheme. Pictures can be imported with the command ]{beispiel.eps}. •  \includegraphics[key =value , . . . ,key =value ]{beispiel.eps}.

The optional argument argumentss give give rise to a rich rich cho choice ice of opti options ons with respect, respect, for example, example, to scaling scaling and ro  graphicx. Using   graphicx, tating. RECKDAHL[9] contains an excellent exposition of the capabilities of  graphicx one can routinely import pictures according to the following scheme: pdflatex

 

  

 PDF

png png pdf pdf jpg jpg tif tif mps mps

  ps2pdf

        TEX

          

latex eps

dvips

 DVI



eps

latex2html



eps

PS

HTML+PNG

Fig. 2: Import of pictures with  graphicx Remarks

\DeclareGraphicsRule{*}{mps csRule{*}{mps}{*}{} }{*}{} (1)   pdflatex: The import of   mps  files requires the command   \DeclareGraphi A in the preamble of the L T X file. E (2)   mps files being special  eps  files, they can be imported, according to Fig. 2, with the other programs: latex,  dvips,  latex2html.

(3) On generat generation ion 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 cases,, extensions 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].

1.3

Tec echni hnical caliti ities es

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 www.latex2html.org l.org. 8.0 has some drawbacks. In order to get  latex2html, go to   www.latex2htm 2

 

The  picture   Environment of LATEX

2 2. 2.1 1

Basi Basics cs

A  picture  environment is created with one of the two commands

•  \begin{picture}(xdim,ydim ). . . \end{picture}, •  \begin{picture}(xdim,ydim ))((x  ,y  ). . . \end{picture}. 0

0

The numbers  xdim ,  ydim ,  x 0 , and  y 0  refer to  \unitlength, which can be reset any time (but not within a picture  environment) with a command such as   \setlength{\unitlength}{1 \setlength{\unitlength}{1.2cm} .2cm}. The default value of  \unitlength   iiss 1pt. 1pt. The The firs firstt pair, pair, (xdim,ydim ), ), effects the reservation, within the document, of  rectangula recta ngularr space for the picture. picture. The optiona optionall second second pair, (x 0 ,y 0 ), assigns arbitrary coordinates to the bottom left corner of the reserv reserved ed rectangl rectangle. e. If omitted omitted,, the second pair defaults to (0, 0), meaning that the coordinates in the drawing commands refer to the bottom left corner of the reserved rectangle. Most drawing commands have one of the two forms

•   \put(x,y )){{object }, ){ {n } }{ {object }, •   \multiput(x,y ))((∆x ,∆ ,∆y ) \circle*{0.25}. B´ where object  may be, i.g.,   \line(2, 3){1.75} or   \circle*{0.25} ezier ezier curves are an exception. ex ception. They are drawn with commands such as \qbezier(1.2, .2, 0.6) 0.6)(3.1, (3.1, 1.2) 1.2)(2.5 (2.5, , •   \qbezier(1 2.1.1 2.1 .1

3.4).

Li Line ne segme segment ntss

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Fig. 3: Line segments

 \

The line   comman command d has two two arg arguuments:

•  a direction vector, •   a length. The components of the direction vector have to be coprime (no common divisor except 1), and they are restricted to the integers

−6, −5, . . . , 5 ,  5,,  6.  6 .

\setlength{\unitlength}{6cm} \begin{picture}(1, \begin{pictur e}(1, 1) \put(0, \put (0, 0){\ 0){\line line(0, (0, 1){1 1){1}} }} \put(0, \put (0, 0){\ 0){\line line(1, (1, 0){1 0){1}} }} \put(0, \put (0, 0){\ 0){\line line(1, (1, 1){1 1){1}} }} \put(0, \put (0, 0){\ 0){\line line(1, (1, 2){. 2){.5}} 5}} \put(0, 0){\line(1, 3){.33333}} \put(0, \put (0, 0){\ 0){\line line(1, (1, 4){. 4){.25}} 25}} \put(0, \put (0, 0){\ 0){\line line(1, (1, 5){. 5){.2}} 2}} \put(0, 0){\line(1, 6){.16667}} \put(0, \put (0, 0){\ 0){\line line(2, (2, 1){1 1){1}} }} \put(0, 0){\line(2, 3){.6667}} \put(0, \put (0, 0){\ 0){\line line(2, (2, 5){. 5){.4}} 4}} \put(0, \put (0, 0){\ 0){\line line(3, (3, 1){1 1){1}} }} \put(0, \put (0, 0){\ 0){\line line(3, (3, 2){1 2){1}} }} \put(0, \put (0, 0){\ 0){\line line(3, (3, 4){. 4){.75}} 75}} \put(0, \put (0, 0){\ 0){\line line(3, (3, 5){. 5){.6}} 6}} \put(0, \put (0, 0){\ 0){\line line(4, (4, 1){1 1){1}} }} \put(0, \put (0, 0){\ 0){\line line(4, (4, 3){1 3){1}} }} \put(0, \put (0, 0){\ 0){\line line(4, (4, 5){. 5){.8}} 8}} \put(0, \put (0, 0){\ 0){\line line(5, (5, 1){1 1){1}} }} \put(0, \put (0, 0){\ 0){\line line(5, (5, 2){1 2){1}} }} \put(0, \put (0, 0){\ 0){\line line(5, (5, 3){1 3){1}} }} \put(0, \put (0, 0){\ 0){\line line(5, (5, 4){1 4){1}} }} \put(0, 0){\line(5, 6){.8333}} \put(0, \put (0, 0){\ 0){\line line(6, (6, 1){1 1){1}} }} \put(0, \put (0, 0){\ 0){\line line(6, (6, 5){1 5){1}} }} \end{picture}

3

 

 \

Fig. 3 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. 2.1.2 2.1 .2

Cir Circle cless

\setlength{\unitlength}{1mm} \begin{picture}(60, \begin{pictur e}(60, 40) \put(20, 30){\circle{1 30){\circle{1}} }}

                                       Fig. 4: Circles

 \

The The ar argu gume ment nt of the the circle   command man d is rel relati ative ve to unitlength   and determine deter miness the   diameter    (not the   radius ). The The origi origina nall   picture   environ-

 \

ment only admits diameters up to approxim pro ximate ately ly 14 mm, and even even belo below w this limit, not all diameters are possible. The circle  command produces disks (filled circles). As for drawing drawing larger larger circle circles, s, see Section 2.4.4 about circles and ellipses.

 \

2.1.3 2.1 .3



\put(20, \put(20, \put(20, \put(20, \put(20,

30){\circle{2 30){\circle{2}} }} 30){\circle{4 30){\circle{4}} }} 30){\circle{8 30){\circle{8}} }} 30){\circle{1 30){\circle{16}} 6}} 30){\circle{3 30){\circle{32}} 2}}

\put(40, \put(40, \put(40, \put(40, \put(40, \put(40, \put(40, \put(40, \put(40,

30){\circle{1 30){\circle{1}} }} 30){\circle{2 30){\circle{2}} }} 30){\circle{3 30){\circle{3}} }} 30){\circle{4 30){\circle{4}} }} 30){\circle{5 30){\circle{5}} }} 30){\circle{6 30){\circle{6}} }} 30){\circle{7 30){\circle{7}} }} 30){\circle{8 30){\circle{8}} }} 30){\circle{9 30){\circle{9}} }}

\put(40, \put(40, \put(40, \put(40, \put(40,

30){\circle{1 30){\circle{10}} 0}} 30){\circle{1 30){\circle{11}} 1}} 30){\circle{1 30){\circle{12}} 2}} 30){\circle{1 30){\circle{13}} 3}} 30){\circle{1 30){\circle{14}} 4}}

\put(15, 10){\circle*{ 10){\circle*{1}} 1}} \put(20, 10){\circle*{ 10){\circle*{2}} 2}} \put(25, 10){\circle*{ 10){\circle*{3}} 3}} \put(30, 10){\circle*{ 10){\circle*{4}} 4}} \put(35, 10){\circle*{ 10){\circle*{5}} 5}} \end{picture}

Ar Arro rows ws

                                                                                                                                                       Fig. 5: Arrows

\setlength{\unitlength}{1mm} \begin{picture}(60, \begin{pictur e}(60, 40) \put(30, 20){\vector(1, 0){30}} \put(30, 20){\vector(4, 1){20}} \put(30, 20){\vector(3, 1){25}} \put(30, 20){\vector(2, 1){30}} \put(30, 20){\vector(1, 2){10}} \thicklines \put(30, 20){\vector(-4, 1){30}} \put(30, 20){\vector(-1, 4){5}} \thinlines \put(30, 20){\vector(-1, -1){5}} \put(30, 20){\vector(-1, -4){5}} \end{picture}

4

 

For arrows, the components of the direction vector are even more restricted than for line segments, namely to the integers ,  3,,  4. 4, 3, . . . , 3  4 .

−  −

Components also have to be coprime (no common divisor except 1). Notice the effect of the  \thicklines command on the two arrows pointing to the upper left. 2.1. 2.1.4 4

Th The e   multiput   and the  linethickness   command

\setlength{\unitlength}{2mm} \begin{picture}(30, \begin{pictur e}(30, 20) \linethickness{0.075mm}

Fig. 6: The  multiput  and the linethickness command

\multiput \mul tiput(0, (0, 0)(0, 0)(1, 1){2 0){3 0){31}{\ 1}{\line line(0, (0, 0){3 1){2 1){20}} 0}} \mul \multiput tiput(0, (0, 1){21}{\ 1}{\line line(1, (1, 0){30}} 0}} \linethickness{0.15mm} \multiput \mul tiput(0, (0, 0)(5, 0){7 0){7}{\l }{\line( ine(0, 0, 1){2 1){20}} 0}} \multiput \mul tiput(0, (0, 0)(0, 5){5 5){5}{\l }{\line( ine(1, 1, 0){3 0){30}} 0}} \linethickness{0.3mm} \multiput \mul tiput(5, (5, 0)(10 0)(10, , 0){3 0){3}{\l }{\line(0 ine(0, , 1){2 1){20}} 0}} \multiput \mul tiput(0, (0, 5)(0, 10){ 10){2}{\ 2}{\line line(1, (1, 0){3 0){30}} 0}} \end{picture}

The  \multiput  command has 4 arguments: the starting point, the translation vector, the number of  \linethickness{ {length }  command applies to horizontal and objects, and the object to be drawn. The   \linethickness vertica ver ticall line segments segments,, but neither to oblique line segments, segments, nor to circles. circles. It does, howeve however, r, apply apply to quadrati quad raticc B´eezier zie r curves! cu rves! 2.1.5 2.1 .5

Ov Ovals als,,  thinlines,  thicklines

                                 Fig. 7: Ovals,  thinlines,  thicklines

   

\setlength{\unitlength}{1cm} \begin{picture}(6, \begin{pictur e}(6, 4) \linethickness{0.075mm} \multiput \mul tiput(0, (0, 0)(1, 0){7 0){7}{\l }{\line( ine(0, 0, 1){4 1){4}} }} \multiput \mul tiput(0, (0, 0)(0, 1){5 1){5}{\l }{\line( ine(1, 1, 0){6 0){6}} }} \thicklines \put(2, \put (2, 3){\ 3){\oval oval(3, (3, 1.8) 1.8)} } \thinlines \put(3, \put (3, 2){\ 2){\oval oval(3, (3, 1.8) 1.8)} } \thicklines \put(2, 1){\oval(3, 1.8)[tl]} \put(4, \put (4, 1){\ 1){\oval oval(3, (3, 1.8) 1.8)[b]} [b]} \put(4, \put (4, 3){\ 3){\oval oval(3, (3, 1.8) 1.8)[r]} [r]} \put(3, 1.5){\oval(1.8, 0.4)} \end{picture}

Line thickness can be controlled by two kinds of commands:   \linethickness{length }   on the one \linethickness{0.075mm} s{0.075mm}   applies only to hand, thinlines   and thicklines   on the the othe other. r. Whi While le   \linethicknes  \thinlines  \thicklines horizontal and vertical lines (and (an d quadr quadratic atic B´eezier zier cu curves), rves),  and  apply to oblique line segments as well as to curves such as circles or ovals.

 \

 \

5

 

2.1.6 2.1. 6

Text ext,, form formulas ulas,, co colors lors

The  color  package allows the usee of co us colo lors rs in insi side de an and d   picture outsidee of  picture outsid environments.

F   =

s(s

 

\setlength{\unitlength}{1cm} \begin{picture}(6, \begin{pictur e}(6, 8) \linethickness{0.075mm} \multiput \mul tiput(0, (0, 0)(6, 0){2 0){2}{\l }{\line( ine(0, 0, 1){8 1){8}} }} \multiput \mul tiput(0, (0, 0)(0, 8){2 8){2}{\l }{\line( ine(1, 1, 0){6 0){6}} }}

− a)()(ss − b)()(ss − c)

C   

        a                 B    b               c           a + b + c         s  := A 2

Fig. 8: Text, formulas, colors package age allo allows ws the the use use The   color   pack of colors inside and outside of  picture   environments.

Predefined colors of the color package are: are:   black,   white,   red,   green, blue,   yellow,   cyan, and   magenta. As th thee curr curren entt exam exampl plee show shows, s, the the definecolor command allows for the definition of arbitrary further colors in ter terms ms eit either her of the   gray, or the   rgb color color mo model  del . (LATEX also also suppo support rtss a third color model,  cymk).

\

\definecolor{hellgrau}{gray}{.8} \definecolor{dunkelblau}{r \definecolor{ dunkelblau}{rgb}{0, gb}{0, 0, .7} \definecolor{roetlich}{rgb \definecolor{ roetlich}{rgb}{1, }{1, .7, .7} \definecolor{dunkelmagenta \definecolor{ dunkelmagenta}{rgb}{.3, }{rgb}{.3, 0, .3}

\thicklines \color{dunkelmagenta} \put(1, \put (1, .5){ .5){\lin \line(2, e(2, 1){3 1){3}} }} \put(4, \put (4, 2){\ 2){\line line(-2, (-2, 1){2 1){2}} }} \put(2, \put (2, 3){\ 3){\line line(-2, (-2, -5){ -5){1}} 1}} \put(.7, .3){$A$} \put(4.05, 1.9){$B$} \put(1.7, 2.95){$C$} \put(3.1, 2.5){$a$} \put(1.3, 1.7){$b$} \put(2.5, 1.05){$c$} \color{dunkelblau} \put(0.3, 4){$F=\sqrt{ 4){$F=\sqrt{s(s-a)(s-b)(s s(s-a)(s-b)(s-c)}$} -c)}$} \put(3.5, 0.4){$\displ 0.4){$\displaystyle aystyle s:=\frac{a+b+c}{2}$} \put(0.5, 7.3){The {\textcolor{ {\textcolor{red}{\texttt{ red}{\texttt{% % color}}} color }}} pack package age allo allows ws the} \put(0.5, 6.7){use of \fcolorbox{dunkelblau}% {roetlich}{colors} {roetlich}{co lors} \colorbox% {hellgrau}{inside} {hellgrau}{i nside} and} \put(0.5, 6.1){\colorb 6.1){\colorbox{hellgrau}{ ox{hellgrau}{outside} outside} of \textcolor{re \textcolor{red}{\texttt{% d}{\texttt{% picture}}} \put(0.5, 5.6){environ 5.6){environments.} ments.} \end{picture}

6

 

2.1.7

Quadratic B B´ ´ ezier ezier curves curves

      

\setlength{\unitlength}{1cm} \begin{picture}(6, \begin{pictur e}(6, 4) \linethickness{0.075mm} \multiput \mul tiput(0, (0, 0)(1, 0){7 0){7}{\l }{\line( ine(0, 0, 1){4 1){4}} }} \multiput \mul tiput(0, (0, 0)(0, 1){5 1){5}{\l }{\line( ine(1, 1, 0){6 0){6}} }} \put(.5, .5){\circle*{ .5){\circle*{.1}} .1}} \put(1, 3){\circle*{ 3){\circle*{.1}} .1}} \put(3, 3.5){\circle 3.5){\circle*{.1}} *{.1}} \thicklines \put(.5, \put (.5, .5){ .5){\line \line(1, (1, 5){. 5){.5}} 5}}

                                                                                

 

 

 

\put \put(1, (1, 3){\ 3){\line (4, 1){2}} }} \qbezier( \qbe zier(.5, .5,line(4, .5)(1 .5)(1, , 1){2 3)(3 3)(3, , 3.5) \thinlines \put(2.5, 2){\circle*{ 2){\circle*{.1}} .1}} \put(5.5, .5){\circle* .5){\circle*{.1}} {.1}} \put(5, 3){\circle*{ 3){\circle*{.1}} .1}} \put(2.5, \put (2.5, 2){\ 2){\line line(2, (2, -1){ -1){3}} 3}} \put(5.5, .5){\line(-1, 5){.5}} \linethickness{1mm} \qbezier( \qbe zier(2.5, 2.5, 2)(5 2)(5.5, .5, .5)( .5)(5, 5, 3) \thinlines \qbezier( \qbe zier(4, 4, 2)(4 2)(4, , 3)(3 3)(3, , 3) \qbezier( \qbe zier(3, 3, 3)(2 3)(2, , 3)(2 3)(2, , 2) \qbezier( \qbe zier(2, 2, 2)(2 2)(2, , 1)(3 1)(3, , 1) \qbezier( \qbe zier(3, 3, 1)(4 1)(4, , 1)(4 1)(4, , 2)

Fig. 9: Quadratic B´ezier ezier curves cu rves As Fig. 9 illustrates, splitting up a circle into four fou r quadratic qu adratic B´eezier zier curves is no nott satisfact satis factory ory.. For a better solution, solution, see (2) in Section 2.4.4. Fi Fig. g. 9 agai again n sh shoows th thee effec effectt of  the linethickness command on horizon izonta tall or verti ertica call li line nes, s, and and of the the thinlines   and thicklines   commands on oblique line segments. It also shows that both kinds of commands affect quadratic B´ezier ezier curves, each ccomommand overriding all previous ones.

 \

\

 \

\end{picture}

respect pectiv ivee slo slopes, pes, of a denote ote the end poin points, ts, and  and   m1 , m2   the res Let   P 1   = (x1 , y1 ), P 2   = (x2 , y2 ) den  S  = x/y)) is then given by the equations quadraticc B´eezier quadrati zier curve. The intermediate intermedi ate control point p oint S   = (x/y

 

 − m x  − ( (yy  − y ) , m  − m y   =   y  + m (x − x ) (i  = 1, 2) 2)..

x =

  m2 x2

1

1

2

2

i

i

1

1

(1)

i

The Java program  qbezier  (see appendix for the source file  qbezier.java) started with the line

•   java java

qbezie qbezier r <x1 > <y1 > <m1 > <x2 > <y2 > <m2 >

writes a file  qbezier.tex  which can be pasted into a  picture  environment, whence it draws the desired curve.

7

 

2.1.8 2.1 .8

Ma Mark rkin ing g an angle gless

                                                                                                                                                                  Fig. 10: Marking angles In the current picture, arcs are approximated by quadratic B´ezier ezier curves. In order to get the control points of an arc of radius r radius  r marking  marking the angle   P 1 P 2 P 3 , one has to (1) tran translate slate and rotate rotate the angle angle in order to move the vertex to the origin and have the bisector point in th thee di dire rect ctio ion n of th thee   x   axis  T ), (transformation T  (transformation ),  P 2 P 1  and  P 2 P 3 (2) reduce th thee vectors vectors P   and P  to length r length  r,, (3) let the interm intermediate ediate control control point 2 P 2   be equal to ((x  +  y12 )/x1 , 0), ((x1  + y x1   and   y1   being the coordinates of point   P 1   after transformation T  and T  and reduction to length  r,  r , (4) appl apply y the transformati transformation on   T −1 to  P 1 ,  P 2 , and P  and  P 3 . points P  points

\setlength{\unitlength}{1cm} \begin{picture}(6, \begin{pictur e}(6, 4) \linethickness{0.075mm} \multiput \mul tiput(0, (0, 0)(1, 0){7 0){7}{\l }{\line( ine(0, 0, 1){4 1){4}} }} \multiput \mul tiput(0, (0, 0)(0, 1){5 1){5}{\l }{\line( ine(1, 1, 0){6 0){6}} }} \thicklines \put(0, \put (0, 0){\ 0){\line line(6, (6, 1){6 1){6}} }} \put(6, \put (6, 1){\ 1){\line line(-4, (-4, 3){4 3){4}} }} \put(2, \put (2, 4){\ 4){\line line(-1, (-1, -2){ -2){2}} 2}} % arc arc % P1=(2 P1=(2.0/4 .0) P2=(0 P2=(0.0/0 .0/0.0) .0) P3=(6 P3=(6.0/1 .0/1.0) .0) % r=1 r=1.2 .2.0/4.0) \qbezier(0.5367, \qbezier(0.53 67, 1.0733)(1.0 1.0733)(1.0832, 832, 0.8) (1.1837, 0.1973) % arc arc % P1=(0 P1=(0.0/0 .0/0.0) .0) P2=(6 P2=(6.0/1 .0/1.0) .0) P3=(2 P3=(2.0/4 .0/4.0) .0) % r=1 r=1.2 .2 \qbezier(4.8163, \qbezier(4.81 63, 0.8027)(4.7 0.8027)(4.7319, 319, 1.3092) (5.04, (5.0 4, 1.72) % arc arc % P1=(6 P1=(6.0/1 .0/1.0) .0) P2=(2 P2=(2.0/4 .0/4.0) .0) P3=(0 P3=(0.0/0 .0/0.0) .0) % r=1 r=1.2 .2 \qbezier(2.96, \qbezier(2.96 , 3.28)(2.3591, 2.4788) (1.4633, 2.9267) \put(0, \put (0, 0){\ 0){\line line(3, (3, 2){3 2){3}} }} \put(3, 2){\ \put(3, 2){\line line(3, (3, -1){ -1){3}} 3}} % arc arc % P1=(0 P1=(0.0/0 .0/0.0) .0) P2=(3 P2=(3.0/2 .0/2.0) .0) P3=(3 P3=(3.0/0 .0/0.0) .0) % r=0 r=0.8 .8 \qbezier(2.3344, \qbezier(2.33 44, 1.5562)(2.5 1.5562)(2.5719, 719, 1.2) (3.0, (3.0 , 1.2) % arc arc % P1=(3 P1=(3.0/0 .0/0.0) .0) P2=(3 P2=(3.0/2 .0/2.0) .0) P3=(6 P3=(6.0/1 .0/1.0) .0) % r=0 r=0.8 .8 \qbezier(3.0, 1.2)(3.5766, 1.2) (3.7589, 1.747) \end{picture}

If the Java program  arc  (see appendix for the source file  arc.java) is started with the command line java arc <x > •   java 1

<y1 > <x2 > <y2 > <x3 > <y3 > <r >,

it produces a file  arc.tex  which can be pasted into a  picture  environment, whence it draws the required arc.. As can be seen arc seen from from the above above inp input ut file, the obtu obtuse se angle is marke marked d in parts: parts: by consequ consequtiv tively ely marking the angles    (0, (0,  0)(3  0)(3,,  2)(3  2)(3,,  0) and    (3, (3,  0)(3  0)(3,,  2)(6  2)(6,,  1). The commands are:

•   java arc 2 4 0 0 6 1 1.2 •   java arc 0 0 6 1 2 4 1.2 •   java arc 6 1 2 4 0 0 1.2 •   java arc 0 0 3 2 3 0 0.8 •   java arc 3 0 3 2 6 1 0.8 8

 

2.1.9 2.1. 9

Lin Line e tthic hickne kness ss agai again: n: the  linethickness   command

                

\setlength{\unitlength}{1cm} \begin{picture}(6, \begin{pictur e}(6, 7.7) \multiput \mul tiput(0, (0, 0)(6, 0){2 0){2}{\l }{\line( ine(0, 0, 1){7 1){7.7}} .7}} \multiput \mul tiput(0, (0, 0)(0, 7.7) 7.7){2}{ {2}{\lin \line(1, e(1, 0){6 0){6}} }} \linethickness{.075mm} \put(0.5, \put (0.5, 3){\ 3){\line line(1, (1, 0){2 0){2}} }} \put(3, \put (3, 2){\ 2){\line line(2, (2, 1){2 1){2}} }} \put(5.5, 0.5){\line(0, 1){3}} \put(1, 1){\circle{1 1){\circle{1.3}} .3}}

                

\qbezier( \qbe zier(1, 1, 0.1) 0.1)(4.5 (4.5, , 1)(2 1)(2, , 2.5) \put(4.3, 1.3){\oval(1.6, 1.9)} \linethickness{1mm} \put(0.5, \put (0.5, 7){\ 7){\line line(1, (1, 0){2 0){2}} }} \put(3, \put (3, 6){\ 6){\line line(2, (2, 1){2 1){2}} }} \put(5.5, 4.5){\line(0, 1){3}} \put(1, 5){\circle{1 5){\circle{1.3}} .3}} \qbezier( \qbe zier(1, 1, 4.1) 4.1)(4.5 (4.5, , 5)(2 5)(2, , 6.5) \put(4.3, 5.3){\oval(1.6, 1.9)} \end{picture}

                          Fig. 11: Line thickness again: the linethickness command

 \

{

}

As can be seen from this picture, the command linethickness length   applies to horizontal and verti vertical cal lines as we well ll as to B´ eezier zier cur curve ves, s, but not to circle circles, s, or obliqu obliquee li line ne segmen segments. ts. Ovals Ovals are a combination of horizontal and vertical lines, and arcs. 2.1.10 2.1. 10

Lin Line e tthic hickne kness ss aga again: in:   thinlines   and  thicklines

                

\setlength{\unitlength}{1cm} \begin{picture}(6, \begin{pictur e}(6, 7.7) \multiput \mul tiput(0, (0, 0)(6, 0){2 0){2}{\l }{\line( ine(0, 0, 1){7 1){7.7}} .7}} \multiput \mul tiput(0, (0, 0)(0, 7.7) 7.7){2}{ {2}{\lin \line(1, e(1, 0){6 0){6}} }} \thinlines \put(0.5, \put (0.5, 3){\ 3){\line line(1, (1, 0){2 0){2}} }} \put(3, \put (3, 2){\ 2){\line line(2, (2, 1){2 1){2}} }} \put(5.5, 0.5){\line(0, 1){3}} \put(1, 1){\circle{1 1){\circle{1.3}} .3}}

               

\qbezier( \qbe zier(1, 1, 0.1) 0.1)(4.5 (4.5, , 1)(2 1)(2, , 2.5) \put(4.3, 1.3){\oval(1.6, 1.9)} \thicklines \put(0.5, \put (0.5, 7){\ 7){\line line(1, (1, 0){2 0){2}} }} \put(3, \put (3, 6){\ 6){\line line(2, (2, 1){2 1){2}} }} \put(5.5, 4.5){\line(0, 1){3}} \put(1, 5){\circle{1 5){\circle{1.3}} .3}} \qbezier( \qbe zier(1, 1, 4.1) 4.1)(4.5 (4.5, , 5)(2 5)(2, , 6.5) \put(4.3, 5.3){\oval(1.6, 1.9)} \end{picture}

                          Fig. 12: Line thickness again: thinlines and  thicklines

 \

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.

 \

9

 

2.1.11 2.1 .11

Usi Using ng the the  qbezier   command to draw line segments

\newcommand{\strecke}[2]{\ \newcommand{\ strecke}[2]{\qbezier(#1)(# qbezier(#1)(#1)(#2)} 1)(#2)} \setlength{\unitlength}{3cm} \begin{picture}(2,2)(-1,-1) \linethickness{.075mm} \multiput(-1,-1)(2,0){2}{\ \multiput(-1, -1)(2,0){2}{\line(0,1){2}} line(0,1){2}} \multiput(-1,-1)(0,2){2}{\ \multiput(-1, -1)(0,2){2}{\line(1,0){2}} line(1,0){2}} \linethickness{.3mm} \strecke{-0.8,-0.8}{0.8,-0.8} \strecke{0.8,-0.8}{-0.7,0.8}

Fig. 13: Using the  qbezier  command to draw line segments

\strecke{-0.7,0.8}{-0.8,-0.8} \linethickness{.075mm} \strecke{0.8,-0.8}{-0.7,0.8} \strecke{-0.7,0.8}{-0.8,-0.8} \strecke{0.8,-0.8}{-0.5,0.8} \strecke{-0.5,0.8}{-0.8,-0.8} \strecke{0.8,-0.8}{-0.3,0.8} \strecke{-0.3,0.8}{-0.8,-0.8} \strecke{0.8,-0.8}{-0.1,0.8} \strecke{-0.1,0.8}{-0.8,-0.8} \strecke{0.8,-0.8}{0.1,0.8} \strecke{0.1,0.8}{-0.8,-0.8} \strecke{0.8,-0.8}{0.3,0.8} \strecke{0.3,0.8}{-0.8,-0.8} \strecke{0.8,-0.8}{0.5,0.8} \strecke{0.5,0.8}{-0.8,-0.8} \strecke{0.8,-0.8}{0.7,0.8} \strecke{0.7,0.8}{-0.8,-0.8} \strecke{0.8,-0.8}{0.9,0.8} \strecke{0.9,0.8}{-0.8,-0.8} \end{picture}

\strecke{(0.8,-0.8)}{(0.3,0.8)} ,0.8)}  invokes the LATEX 2ε  command For example, the command   \strecke{(0.8,-0.8)}{(0.3

• \qbezier(0.8,qbezier(0.8,-0.8)(0.8,-0.8 0.8)(0.8,-0.8)(0.3,0.8) )(0.3,0.8), which cannot be replaced by a LATEX 2ε  \line  command as the direction vector ( 5,  16) would not be accepted. By this “abuse” of the  \qbezier  command, one of the two severe drawbacks of the original  picture \linethickness{ ss{thickness }  command applies to environmentt can b environmen bee comfortably circumvented. circumvented. As the   \linethickne



the  \qbezier  comman  command, d, line segm segment entss of arbitrar arbitrary y slope and thickness thickness can b bee drawn. drawn. What else would you want?

10

 

2.1.12 2.1. 12

Mult Multipl iple e use of prede predefine fined d parti partial al pict picture uress

         

\setlength{\unitlength}{.5mm} \begin{picture}(120, \begin{pictur e}(120, 168) \newsavebox{\foldera}% declaration \savebox{ \sav ebox{\fol \foldera dera}(40, }(40, 32)[l] 32)[l]{% {% defi definiti nition on \multiput \mul tiput(0, (0, 0)(0, 28){ 28){2}{\ 2}{\line line(1, (1, 0){4 0){40}} 0}} \multiput \mul tiput(0, (0, 0)(40 0)(40, , 0){2 0){2}{\l }{\line(0 ine(0, , 1){2 1){28}} 8}} \put(1, 28){\oval(2, 2)[tl]} \put(1, \put (1, 29){ 29){\lin \line(1, e(1, 0){5 0){5}} }} \put(9, 29){\oval(6, 6)[tl]} \put(9, \put (9, 32){ 32){\lin \line(1, e(1, 0){8 0){8}} }} \put(17, \put (17, 29){ 29){\oval \oval(6, (6, 6)[t 6)[tr]} r]} \put(20, 29){ \put(20, 29){\line \line(1, (1, 0){1 0){19}} 9}} \put(39, \put (39, 28){ 28){\oval \oval(2, (2, 2)[t 2)[tr]} r]}

          Fig. 14: Multiple use of predefined partial pictures

} \newsavebox{\folderb}% declaration \savebox{ \sav ebox{\fol \folderb derb}(40, }(40, 32)[l] 32)[l]{% {% defi definiti nition on \put(0, \put (0, 14){ 14){\lin \line(1, e(1, 0){8 0){8}} }} \put(8, 0){\usebox{\ 0){\usebox{\foldera}} foldera}} } \multiput(0, 0)(120, 0){2}{\line(0, 1){168}} \multiput(0, 0)(0, 168){2}{\li 168){2}{\line(1, ne(1, 0){120}} \put(34, 26){\line(0, 1){102}} \put(14, 128){\usebox{ 128){\usebox{\foldera}} \foldera}} \multiput(34, 86)(0, -37){3}{\usebox{\folderb} -37){3}{\usebox{\folderb}} } \end{picture}

A partial picture can be   declared   and   defined  by the commands

•   \newsavebox{name }   (declaration) •   \savebox{name }}((size ))[[position ]{ ]{content }

  (definition)

and then be arbitrarily often  used  by the command

•   \usebox{name }. The  name  argument   argument refers to a LATEX storage bin and therefore is of a command nature (which accounts for the backlashes in the current example).   size   is a numeric pair referring to the current value of  \unitlength. An object defined with the savebox  command (such as  \foldera  in the current example) can be used in the definition of another such element ( \folderb ).

 \

The  \oval  command was applied because the connecting segments are two short to be drawn with the   line  command.

11

 

2. 2.2 2

Pos osit itio ioni ning ng   picture   environments

2.2.1 2.2. 1

  

Cor Correc rectin ting g position positionss

                                                                     Fig. 15

\setlength{\unitlength}{1cm} \begin{picture}(6, \begin{pictur e}(6, 4) \linethickness{0.075mm} \multiput \mul tiput(0, (0, 0)(1, 0){7 0){7}{\l }{\line( ine(0, 0, 1){4 1){4}} }} \multiput \mul tiput(0, (0, 0)(0, 1){5 1){5}{\l }{\line( ine(1, 1, 0){6 0){6}} }} \color{red} \put(0, 0){\circle*{ 0){\circle*{.15}} .15}} \put(0, 0){\circle{. 0){\circle{.25}} 25}} \linethickness{0.2mm} \multiput \mul tiput(0, (0, 0)(0, 0)(6, 4){2 0){2 0){2}{\l }{\line( ine(0, 0, 0){6 1){4 1){4}} }} \mul \multiput tiput(0, (0, 4){2}{\l }{\line( ine(1, 1, 0){6}} }} \color{black} \put(.5, \put (.5, .5){ .5){\line \line(5, (5, 2){5 2){5}} }} \put(5.5, 2.5){\line(-4, 1){4}} \linethickness{.5mm} \qbezier( \qbe zier(.5, .5, .5)(5 .5)(5.5, .5, 2.5) 2.5)(1.5, (1.5, 3.5) \end{picture}

\linethickness  command also applies to quadratic B´ Fig. 15 again demonstrates that the   \linethickness eezier zier curves (while it does neither apply to a  \circle  nor to the arcs of an  \oval). \begin{picture}(6, (6, 4)  to We now change   \begin{picture}   \begin{picture}(6, \begin{picture}(6, 4)(-0.5, -1.25),



− −

thuss assigning thu assigning the coordinates coordinates ( 0.5, 1.25) to the bottom bottom lef leftt corner corner of the rectangl rectanglee res reserv erved ed by \begin{picture}(6, \begin{pictur e}(6, 4)   (draw (drawn n in red colo color). r). Suc Such h a rea reassi ssignm gnmen entt may may be very very conve convenie nient nt if you you do not want to change all the coordinates of a picture which is not optimally located at the outset.

                                                                      

  

Fig. 16

\setlength{\unitlength}{1cm} \begin{picture}(6, \begin{pictur e}(6, 4)(-0.5, -1.25) \linethickness{0.075mm} \multiput \mul tiput(0, (0, 0)(1, 0){7 0){7}{\l }{\line( ine(0, 0, 1){4 1){4}} }} \multiput \mul tiput(0, (0, 0)(0, 1){5 1){5}{\l }{\line( ine(1, 1, 0){6 0){6}} }} \color{red} \put(-0.5, -1.25){\circl -1.25){\circle*{.15}} e*{.15}} \put(-0.5, -1.25){\circl -1.25){\circle{.25}} e{.25}} \multiput(-0.5, \multiput(-0. 5, -1.25)(6, 0){2} {\line(0, {\lin e(0, 1){4 1){4}} }} \multiput(-0.5, \multiput(-0. 5, -1.25)(0, 4){2} {\line(1, {\lin e(1, 0){6 0){6}} }} \color{black} \linethickness{0.2mm} \multiput \mul tiput(0, (0, 0)(6, 0){2 0){2}{\l }{\line( ine(0, 0, 1){4 1){4}} }} \multiput \mul tiput(0, (0, 0)(0, 4){2 4){2}{\l }{\line( ine(1, 1, 0){6 0){6}} }} \put(.5, \put (.5, .5){ .5){\line \line(5, (5, 2){5 2){5}} }} \put(5.5, 2.5){\line(-4, 1){4}} \linethickness{.5mm} \qbezier( \qbe zier(.5, .5, .5)(5 .5)(5.5, .5, 2.5) 2.5)(1.5, (1.5, 3.5) \end{picture}

12

 

2.2.2 2.2 .2

Side Side b by y side: side: text text an and d pic pictu ture re

The strip between the horizontal lines:

                                                                                                                    Schiefe Ebene      fest im Labor   

Ein Beh¨ Behalter, ¨alter, mit Wasser asser tei teilw lweis eisee gef¨ ullt, ullt, gleitet glei tet reibungsfr reibungsfrei ei auf einer einer schi schiefen efen Ebene (sie (siehe he Ze Zeic ichn hnun ungg rec rechts). ts). Di Diee Wasse asserroberfl¨ache ache sei station¨ station¨ aarr (kein (keinee Wellen) ellen);; wie ¨ siehtt die Wasseroberfl¨ sieh asseroberfl¨ ache ache aus?   Aquivalenzprinzip. zprin zip. Sorgf¨ Sorgf¨aaltige ltige Argument Argumentation ation!! Disku Disku-tiere die Kr¨afte afte (1) paral parallel lel zur schiefen schiefen Ebene,

      

(2) norm normal al zur schiefen schiefen Ebene. is produced by the LATEX source: \begin{minipage}{7cm} Ein Beh\ Beh\"alt "alter, er, mit Wass Wasser er teil teilweis weise e gef\ gef\"ull "ullt, t, glei gleitet tet reibu reibungsf ngsfrei rei auf eine einer r schiefen schiefen Eben Ebene e (sieh (siehe e Zeic Zeichnung hnung rech rechts). ts). Die Wass Wasserob eroberfl erfl\"ac \"ache he sei sta\ sta\-tio -tio\-n\" \-n\"ar ar (kei (keine ne Well Wellen); en); wie sieh sieht t die Wass Wasserob eroberfl\ erfl\"ach "ache e aus? \"Aquivalenzprinzip. \"Aquivalenz prinzip. Sorgf\"altige Argumentation! Diskutiere die Kr\"afte \begin{enumerate} \item \ite m parallel parallel zur schi schiefen efen Ebene, \item \ite m normal normal zur schi schiefen efen Ebene. \end{enumerate} \end{minipage} \end{minipag e} \hfill \begin{minip \begin{minipage}{7cm} age}{7cm} \setlength{\unitlength}{1mm} \begin{picture}(70,45) \put(0,0){\line(1,0){70}} \put(0,0){\line(0,1){35}} \put(70,0){\line(-2,1){70}} \linethickness{.75mm} \multiput(10,30)(.1,.05){8 \multiput(10, 30)(.1,.05){8}{\line(1,2){ }{\line(1,2){8}} 8}} \multiput(30,20)(.1,.05){8 \multiput(30, 20)(.1,.05){8}{\line(1,2){ }{\line(1,2){8}} 8}} \multiput(10,30)(.05,.1){6 \multiput(10, 30)(.05,.1){6}{\line(2,-1) }{\line(2,-1){20}} {20}} \multiput(40,25)(.05,.1){6 \multiput(40, 25)(.05,.1){6}{\vector(2,}{\vector(2,-1){15}} 1){15}} \put(10,12){Schiefe \put(10,12){S chiefe Ebene} \put(10, \put (10,7){fe 7){fest st im Labor Labor} } \end{picture} \end{minipage}

The picture illustrates, by the way, how oblique line segments can be drawn with arbitrary thickness by the use of the  \multiput  command. Using a  minipage  for the left half allows an  enumerate  environment which would not be possible in  parbox a . \begin{picture}  has the effect of moving the picture up and down with A change of the argument of   \begin{picture} respect to the leftside text. If we change to

•   \begin{picture}(70, \begin{picture}(70, 30), the effect is again shown in the strip between the horizontal lines:

13

 

                                             (70, 30)                                                     Schiefe Ebene           fest im Labor         (0, 0)

 

Ein Beh¨ Behalter, ¨alter, mit Wasser asser tei teilw lweis eisee gef¨ ullt, ullt, gleitet glei tet reibungsfr reibungsfrei ei auf einer einer schi schiefen efen Ebene (sie (siehe he Ze Zeic ichn hnun ungg rec rechts). ts). Di Diee Wasse asserroberfl¨ache ache sei station¨ station¨ aarr (kein (keinee Wellen) ellen);; wie ¨ siehtt die Wasseroberfl¨ sieh asseroberfl¨ ache ache aus?   Aquivalenzprinzip. zprin zip. Sorgf¨ Sorgf¨aaltige ltige Argument Argumentation ation!! Disku Disku-tiere die Kr¨afte afte

 

(1) paral parallel lel zur schiefen schiefen Ebene, (2) norm normal al zur schiefen schiefen Ebene.

(70, 30) argument, not by The example proves that the space allocated to the picture is given by the   (70,

the real extension. If we change to   \begin{picture}(70, \begin{picture}(70, 60),



(70, 60): the picture is placed as if it had a size of   (70,

 

(70, 60) Ein Beh¨ Behalter, ¨alter, mit Wasser asser tei teilw lweis eisee gef¨ ullt, ullt, gleitet reibungsfr gleitet reibungsfrei ei auf einer einer schi schiefen efen Ebene (sie (siehe he Ze Zeic ichn hnun ungg rec rechts). ts). Di Diee Wasse asserroberfl¨ache ache sei station¨ station¨ aarr (kein (keinee Wellen) ellen);; wie ¨ siehtt die Wasseroberfl¨ sieh asseroberfl¨ ache ache aus?   Aquivalenzprinzip. zprin zip. Sorgf¨ Sorgf¨aaltige ltige Argument Argumentation ation!! Disku Disku-tiere die Kr¨afte afte (1) paral parallel lel zur schiefen schiefen Ebene, (2) norm normal al zur schiefen schiefen Ebene.

                                                                                                                   Schiefe Ebene           fest im Labor         (0, 0)

 

The two minipages are centered vertically.

14

 

2. 2.3 3

Appl Applic icat atio ions ns

In this section, some “real life” examples of illustrations drawn in a  picture  environment are shown. 2.3.1 2.3 .1

Fall allin ing g ma mass ss

  

A

Masse f¨allt allt aus Ruhelage

h

 

B

\put(30,25){Ruhelage} \put(0, 9){$B$} \put(5,10){\line(1,0){20}} \put(0,5){\line(1,0){40}} \multiput(1,5)(1,0){40}{\l \multiput(1,5 )(1,0){40}{\line(-2,-5){2} ine(-2,-5){2}} } \put(15,10){\line(0,1){20} \put(15,10){\ line(0,1){20}} } \put(16,19){$h \put(16,19){$h$} $} \end{picture}

                                                                                                                                                                                                                                                Fig. 17: Falling mass

2.3.2 2.3. 2

ctA

Sim Simulta ultaneo neousn usness ess

  E 1

 

E 2

                           

A

  A

  xA

A

Fig. 18: Simultaneousness

2.3.3 2.3 .3

\setlength{\unitlength}{1mm} \begin{picture}(60,30) \put(0,29){$A$} \put(0,29){$A $} \put(5,30){\line(1,0){20}} \put(5,30){\line(1,0){20}} \put(28,30){\circle*{2}} \put(28,30){\vector(0,-1){10}} \put(30,29){Masse \put(30,29){M asse f\"allt aus}

\setlength{\unitlength}{1mm} \begin{picture}(60,50) \put(0 ,15){\vector( ,15){\vector(1,0){53}} 1,0){53}} \put(54,14){$x_A$} \put( 8,10){\vecto 8,10){\vector(0,1){37}} r(0,1){37}} \put( 0,46){$ct_A$ 0,46){$ct_A$} } \multiput(13,9)(15,0){3}{\ \multiput(13, 9)(15,0){3}{\line(0,1){35} line(0,1){35}} } \put(11,5){$A’’$} \put(26,5){$A’$} \put(41,5){$A’’’$} \multiput(13,37)(30,0){2}{ \multiput(13, 37)(30,0){2}{\circle*{2}} \circle*{2}} \put(28,22){\circle*{2}} \put(28,22){\vector(1,1){14}} \put(15,39){$E_1$} \put(28,22){\vector(-1,1){14}} \put(45,39){$E_2$} \multiput(0,37)(4,0){13}{\ \multiput(0,3 7)(4,0){13}{\line(1,0){2}} line(1,0){2}} \end{picture}

Mo Movi ving ng llig ight ht clock clock

   

                 c · ∆t  ∆tL                            h  c           = c  = · ∆τ   ∆τ                  xL   

  

 ·

v  ∆t  ∆tL

Fig. 19: Moving light clock

15

 

\setlength{\unitlength}{1mm} \begin{picture}(96,38) \put(0,12){\vector(1,0){91}} \put(92,11){$x_L$} \put(6,10){$\underbrace{\ \put(6,10){$ \underbrace{\rule{4cm}{0cm rule{4cm}{0cm}}$} }}$} \put(26,5){\makebox(0,0){ \put(26,5){\ makebox(0,0){$v\cdot\Delta $v\cdot\Delta t_L$}} \multiput(1,12)(0,20){2}{ \multiput(1, 12)(0,20){2}{\line(1,0){10 \line(1,0){10}} }} \multiput(1,12)(10,0){2}{ \multiput(1, 12)(10,0){2}{\line(0,1){20 \line(0,1){20}} }} \multiput(41,12)(0,20){2} \multiput(41 ,12)(0,20){2}{\line(1,0){1 {\line(1,0){10}} 0}} \multiput(41,12)(10,0){2} \multiput(41 ,12)(10,0){2}{\line(0,1){2 {\line(0,1){20}} 0}} \multiput(6,12)(40,0){2}{ \multiput(6, 12)(40,0){2}{\circle*{2}} \circle*{2}} \put(46,32){\circle*{2}} \put(46,12){\line(0,1){20}} \put(6,12){\vector(2,1){39}} \put(18,25){$c\cdot\Delta \put(18,25){ $c\cdot\Delta t_L$} \put(46,32){\vector(2,-1){39}} \put(46,22){\line(2,-1){8}} \put(54.5,16){$h=c\cdot\D \put(54.5,16 ){$h=c\cdot\Delta\tau$} elta\tau$} \end{picture} 2.3.4 2.3 .4

Rot Rotat ation ion of axes axes

y

y

 

      P       yP                           x                  yP       xP                      x            x P            

Fig. 20: Rotation of axes

\setlength{\unitlength}{1mm} \begin{picture}(93,46) \put( 0,14){\vecto 0,14){\vector(1,0){60}} r(1,0){60}} \put(61,13){$x$} \put(20,4){\vector(0,1){37}} \put(19,43){$y$} \put(50,34){\circle*{2}} \put(52,35){$P$} \multiput(20,34)(4,0){8}{\ \multiput(20, 34)(4,0){8}{\line(1,0){2}} line(1,0){2}} \put(14.5,33.5){$y_P$} \multiput(50,14)(0,4){5}{\ \multiput(50, 14)(0,4){5}{\line(0,1){2}} line(0,1){2}} \put(48,11){$x_P$} \put( 2,8){\vector 2,8){\vector(3,1){56}} (3,1){56}} \put(59,26.5){$x’$} \multiput(50,34)(1.9,-5.7){2} {\line(1,-3){1.2}} \put(52,22){$x_P’$} \multiput(50,34)(-5.8,-1.933){6} {\line(-3,-1){3.6}} \put(12,21){$y_P’$} \put(22,8){\vector(-1,3){10.5}} \put(10,41){$y’$} \end{picture}

16

 

2.3.5 2.3. 5

Rap Rapidit idity y in the Spec Special ial The Theory ory of Re Relat lativit ivity y

\setlength{\unitlength}{1cm} \begin{picture}(6,4)(-2.5,-1.5) \put(-2.5,0){\vector(1,0){5}} \put(2.7,-0.1){$\chi$} \put(0,-1.5){\vector(0,1){3}} \multiput(-2.5,1)(0.4,0){13} {\line(1,0){0.2}} \multiput(-2.5,-1)(0.4,0){13} {\line(1,0){0.2}} \put(0.2,1.4) {$\beta=v/c=\tanh\chi$} \qbezier(0,0)(0.8853,0.885 \qbezier(0,0) (0.8853,0.8853)(2,0.9640) 3)(2,0.9640) \qbezier(0,0)(-0.8853,-0.8 \qbezier(0,0) (-0.8853,-0.8853)(-2,-0.96 853)(-2,-0.9640) 40) \put(-2.5,-1.5){\circle*{0.2}} \end{picture}

β  =  v/c =  =  v/c  = tanh χ

 

 χ

 

  Fig. 21: Rapidity Rapidity in the Specia Speciall Theory of Relativity  v  χ  := tanh−1 . Rapidity χ Rapidity c

The int interme ermediary diary control points of the two two B´ eezier zier curv curves es were calculated calculated with formulas formulas (1) in the section about quadratic B´eezier zier curves. The p positive ositive branch is determined by   P 1   = (0 (0,,  0),  0) , m1  = 1 and 2 P 2  = (2  m 2  = 1/ cosh 2. (2,,  tanh2),  tanh2), m \begin{picture} re}  command. This example points out the usefullness of the second argument of the   \begin{pictu The picture itself is defined in mathematically convenient coordinates, and the lower left corner is assigned the mathematical coordinates ( 2.5, 1.5) (black disk). If the second second argument argument were omitted, omitted, it would would default to (0, (0,  0); as a consequence, the origin of the graph would move to the center of the black disk.

−  −

2.3.6 2.3. 6

Cloc Clocks ks in gravit gravitatio ational nal field field

                                             3B       Explosion der 1. Uhr  →  →  3A  3 A                    ←  ∆τ   ∆ τ   = 2T  2 T Cs    Cs (lokale Uhr)                    Explosi osion on der 2. Uhr  ←  Expl                                             ← ∆τ   ∆ τ   =  T C Cs s (lokale Uhr)                     Start der 1. Uhr  →  →  2A  2 A             2B ←   Start der 2. Uhr                                   ∆τ   =  T Cs Cs  →                               1       

 

       

 



  hA

 

hB

Fig. 22: Clocks in gravitational field

17

h

 

\setlength{\unitlength}{1mm} \begin{picture}(120,100)(-8,0) \put(35,5){\vector(1,0){50}} \put(88,5){\makebox(0,0){$h$}} \put(40,2){\makebox(0,0){$h_A$}} \put(70,2){\makebox(0,0){$h_B$}} \multiput(40,5)(30,0){2}{\ \multiput(40, 5)(30,0){2}{\line(0,1){90} line(0,1){90}} } \multiput(40,5)(0,10){7}{\ \multiput(40, 5)(0,10){7}{\line(1,1){30} line(1,1){30}} } \multiput(40,35)(6,0){5}{\ \multiput(40, 35)(6,0){5}{\line(1,0){3}} line(1,0){3}} \multiput(40,65)(6,0){5}{\ \multiput(40, 65)(6,0){5}{\line(1,0){3}} line(1,0){3}} \multiput(40,5)(0,30){3}{\ \multiput(40, 5)(0,30){3}{\circle*{2}} circle*{2}} \multiput(70,35)(0,15){3}{ \multiput(70, 35)(0,15){3}{\circle*{2}} \circle*{2}} \multiput(40,35)(0,30){2}{ \multiput(40, 35)(0,30){2}{\line(1,-1){3 \line(1,-1){30}} 0}} \multiput(39.75,15)(.25,0){3}{\line(0,1 \multiput(39.75,15)(.25,0) {3}{\line(0,1){10}} ){10}} \multiput(39,15)(0,10){2}{ \multiput(39, 15)(0,10){2}{\line(1,0){2} \line(1,0){2}} } \multiput(69.75,55)(.25,0) \multiput(69. 75,55)(.25,0){3}{\line(0,1 {3}{\line(0,1){10}} ){10}} \multiput(69.75,40)(.25,0) \multiput(69. 75,40)(.25,0){3}{\line(0,1 {3}{\line(0,1){5}} ){5}} \multiput(69,35)(0,5){7}{\ \multiput(69, 35)(0,5){7}{\line(1,0){2}} line(1,0){2}} \put(97,60){\makebox(0,0){$ \left\}\rule[-4mm]{0mm}{8m \left\}\rule[ -4mm]{0mm}{8mm}\right.\lef m}\right.\leftarrow tarrow \Delta\ta \Del ta\tau u = 2T_{ 2T_{Cs}\m Cs}\mbox{ box{(lok (lokale ale Uhr) Uhr)} } $}} \put(98,50){\makebox(0,0){ \put(98,50){\ makebox(0,0){$\leftarrow$ $\leftarrow$ \emph{Explosion der 2. Uhr}}} \put(96,42.5){\makebox(0,0 \put(96,42.5) {\makebox(0,0){$\left\}\ru ){$\left\}\rule[-1.5mm]{0m le[-1.5mm]{0mm}{3mm}\right m}{3mm}\right. . \hskip1mm\leftarrow\Delta\ \hskip1mm\lef tarrow\Delta\tau tau = T_{Cs}\mbox{ T_{Cs}\mbox{(lokale (lokale Uhr)}$}} \put(25,20){\makebox(0,0){ \put(25,20){\ makebox(0,0){$\Delta\tau $\Delta\tau = T_{Cs}\right T_{Cs}\rightarrow arrow \left\{\rule[-4mm]{0mm}{8m \left\{\rule[ -4mm]{0mm}{8mm}\right.$}} m}\right.$}} %} \put(38,8){\makebox(0,0){1}} \put(17, \put (17,35){\ 35){\make makebox(0 box(0,0){ ,0){ \emp \emph{St h{Start art der 1. Uhr} $\ri $\righta ghtarrow rrow$ $ 2$A$} 2$A$}} } \put(13,65){\makebox(0,0) {\emph{Ex {\em ph{Explos plosion ion der 1. Uhr} $\ri $\righta ghtarrow rrow$ $ 3$A$ 3$A$}} }} \put(93,35){\makebox(0,0) { 2$B \le \lefta ftarro rrow$ w$ \em \emph{ ph{Sta Start rt der 2. Uhr Uhr}}} }}} \put(74,68){\makebox(0,0){$3B$}} \end{picture}

18

 

2.3.7 2.3. 7

Lin Line e of simult simultane aneous ousnes nesss

ctA  

                              α           α  = α  =  α E 3                                      Gerade der                            Gleichzeitigkeit          E 2                                                          α                                    xA                         E 

 

 

1

               B

             

 

B

A

               B 

Fig. 23: Line of simultaneousness

\setlength{\unitlength}{1mm} \begin{picture}(120,68) \put(0,28){\vector(1,0){1 \put(0,28){\ vector(1,0){115}} 15}} \put(116,27){ \put(116,27){$x_A$} $x_A$} \put(53,7){\vector(0,1){6 \put(53,7){\ vector(0,1){61}} 1}} \put(46,66){ \put(46,66){$ct_A$} $ct_A$} \put(2,27){\line(3,1){110}} \multiput(53,28)(-12,12){2}{\circle*{2} \multiput(53,28)(-12,12){ 2}{\circle*{2}} } \put(77,52){\circle*{2}} \put(53,28){\vector(-1,1) \put(53,28){ \vector(-1,1){11}} {11}} \put(53,28){ \put(53,28){\vector(1,1){ \vector(1,1){23}} 23}} \put(54,23){$E_1$} \put(54,23){ $E_1$} \put(35,41){$ \put(35,41){$E_2$} E_2$} \put(71,53){ \put(71,53){$E_3$} $E_3$} \put(28,2){$B’$} \put(28,2){$ B’$} \multiput(30, \multiput(30,7)(2,6){9}{\l 7)(2,6){9}{\line(1,3){1.5} ine(1,3){1.5}} } \put(44,2){$B$} \put(44,2){$ B$} \put(46,7){\l \put(46,7){\line(1,3){17.5 ine(1,3){17.5}} }} \put(51,2){$A$} \put(60,2){$B’’$} \put(60,2){$ B’’$} \multiput(62 \multiput(62,7)(2,6){9}{\ ,7)(2,6){9}{\line(1,3){1.5 line(1,3){1.5}} }} \put(83,54){\line(1,-1){5}} \put(89,48){Gerade \put(89,48){ Gerade der} \put(89,44){ \put(89,44){Gleichzeitigke Gleichzeitigkeit} it} \put(15,54){$\alpha=\alpha’$} \put(15,52){\line(1,0){10}} % arc P1 = (54. (54.0/ 0/31 31.0 .0) ) P2 = (53. (53.0/ 0/28 28.0 .0) ) P3 = (53 (53.0 .0/2 /29. 9.0) 0) r = 25.0 25.0 \qbezier(60.9057, \qbezier(60. 9057, 51.7171)(57. 51.7171)(57.0569, 0569, 53.0)(53.0, 53.0) % arc P1 = (54. (54.0/ 0/31 31.0 .0) ) P2 = (53. (53.0/ 0/28 28.0 .0) ) P3 = (53 (53.0 .0/2 /29. 9.0) 0) r = 26.0 26.0 \qbezier(61.2219, \qbezier(61. 2219, 52.6658)(57. 52.6658)(57.2192, 2192, 54.0)(53.0, 54.0) % arc arc P1 = (6. (6.0/ 0/28 28.0 .0) ) P2 = (5 (5.0 .0/2 /28. 8.0) 0) P3 = (8 (8.0 .0/2 /29. 9.0) 0) r = 20.0 20.0 \qbezier(25.0, \qbezier(25. 0, 28.0)(25.0, 31.2456)(23.9737, 34.3246) % arc arc P1 = (6. (6.0/ 0/28 28.0 .0) ) P2 = (5 (5.0 .0/2 /28. 8.0) 0) P3 = (8 (8.0 .0/2 /29. 9.0) 0) r = 21.0 21.0 \qbezier(26.0, \qbezier(26. 0, 28.0)(26.0, 31.4078)(24.9223, 34.6408) \put(58.000,56.500){\make \put(58.000, 56.500){\makebox(0,0){$\alp box(0,0){$\alpha$}} ha$}} \put(29.000,32.408){\make \put(29.000, 32.408){\makebox(0,0){$\alp box(0,0){$\alpha’$}} ha’$}} \end{picture}

The inserts in the input file drawing the angle markings are produced, according to Section 2.1.8, with the Java program  arc  (see appendix for the source file  arc.java).

19

 

2.3.8 2.3. 8

Isot Isotrop ropic ic spheri spherical cal wav waves es

       

\setlength{\unitlength}{1mm} \begin{picture}(50,55) % Ell Ellipse: u = 25 25. .0 v = 30 30. .0 % a = 20.0 b = 20.0 phi = 0.0 Grad \qbezier(45.0, \qbezier(45.0 , 30.0)(45.0, 38.2843) (39.1421, 44.1421) \qbezier(39.1421, \qbezier(39.1 421, 44.1421)(33. 44.1421)(33.2843, 2843, 50.0) (25.0, (25. 0, 50.0 50.0) ) \qbezier(25.0, \qbezier(25.0 , 50.0)(16.7157 50.0)(16.7157, , 50.0) (10.8579, 44.1421)

 

 



D



A

B



C

 

 

Fig. 24: Isotropic spherical waves

\qbezier(10.8579, 44.1421)(5.0 \qbezier(10.8579, 44.1421)(5.0, , 38.2843) (5.0, (5.0 , 30.0 30.0) ) \qbezier(5.0, 30.0)(5.0, 21.7157) (10.8579, 15.8579) \qbezier(10.8579, \qbezier(10.8 579, 15.8579)(16. 15.8579)(16.7157, 7157, 10.0) (25.0, (25. 0, 10.0 10.0) ) \qbezier(25.0, \qbezier(25.0 , 10.0)(33.2843 10.0)(33.2843, , 10.0) (39.1421, 15.8579) \qbezier(39.1421, \qbezier(39.1 421, 15.8579)(45. 15.8579)(45.0, 0, 21.7157) (45.0, (45. 0, 30.0 30.0) ) \multiput(5,30)(20,0){3}{\ \multiput(5,3 0)(20,0){3}{\circle*{2}} circle*{2}} \multiput(25,10)(0,40){2}{ \multiput(25, 10)(0,40){2}{\circle*{2}} \circle*{2}} \put(32,30){\circle*{2}} \put(29,30){\vector(1,0){7}} \put(10,30){\vector(-1,0){10}} \put(40,30){\vector(1,0){10}} \put(25,15){\vector(0,-1){10}} \put(25,45){\vector(0,1){10}} \put(1,25){$D$} \put(1,25){$D $} \put(23,25){$A$} \put(23,25){$A$} \put(30,25){$B$} \put(30,25){$ B$} \put(46,25) \put(46,25){$C$} {$C$} \end{picture}

The circle circ le is patched together from 8 qua quadratic dratic B´eezier zier cur curves, ves, each covering a 450 angle. The \qbezier lines can be generated with the command java •   java

bezier bezierell ellips ipse e 25 30 20 20.

bezierellipse.java .java. See the appendix for the source file   bezierellipse

20

 

2.4 2.4.1 2.4 .1

Additional Additional examples examples of quadratic quadratic B´ ezier ezier curves Ca Cate tena nary ry

y

 

x Fig. 25: Catenary In Fig. 25, each symmetric half of the  y = catenary y catenary  = cosh x 1 is approximated by a quadratic quadrati c B´ezier ezier curve. The right half of the curve ends in the point (2, (2,  2.  2 .762 7622), 2), the slope the there re having hav ing the value value   m   = 3.6269 269. Us Us-ing equation equation (1) in the section section abou aboutt quadratic quadr atic B´ ezier ezier curves, curves, we can calculate the intermediate control points. They Th ey turn turn out out to be (1. (1.2384 2384,,   0) 0) and and ( 1.2384 2384,,   0). 0). The red crosses indicate indicate points of the   real   catenary catenary.. The error is barely noticeable, being less than one percent.





\setlength{\unitlength}{1.3cm} \begin{picture}(4.3, \begin{pictur e}(4.3, 3.6)(-2, 0) \put(-2, 0){\vector(1, 0){4.4}} \put(2.45, -.05){$x$} \put(0, 0){\vector(0, 1){3.2}} \put(0, 3.35){\makebox(0, 0){$y$}} % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(2.0/2.7622) m2=3.6269 \qbezier( \qbe zier(0.0, 0.0, 0.0) 0.0)(1.2 (1.2384, 384, 0.0) 0.0)(2.0 (2.0, , 2.762 2.7622) 2) % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(-2.0/2.7622) m2=-3.6269 \qbezier(0.0, 0.0)(-1.2384, 0.0)(-2.0, 2.7622) \linethickness{.075mm} \multiput \mul tiput(-2, (-2, 0)(1 0)(1, , 0){5 0){5}{\l }{\line(0 ine(0, , 1){3 1){3}} }} \multiput \mul tiput(-2, (-2, 0)(0 0)(0, , 1){4 1){4}{\l }{\line(1 ine(1, , 0){4 0){4}} }} \color{red} \linethickness{.2mm} \put( \put ( .3, .127 .12763){ 63){\lin \line(1, e(1, 0){. 0){.4}} 4}} \put(.5, -.07237){\line(0, 1){.4}} \put(-.7, .12763){\line(1, 0){.4}} \put(-.5, -.07237){\line(0, 1){.4}} \put(. \pu t(.8, 8, .54308 .54308){\ ){\lin line(1 e(1, , 0 0){. ){.4}} 4}} \put(1 \pu t(1, , .34 .34308 308){\ ){\lin line(0 e(0, , 1 1){. ){.4}} 4}} \put(-1.2, \put(-1.2 , .543 .54308){ 08){\lin \line(1, e(1, 0){. 0){.4}} 4}} \put(\pu t(-1, 1, .34308 .34308){\ ){\lin line(0 e(0, , 1 1){. ){.4}} 4}} \put(1.3, \put (1.3, 1.35 1.35241){ 241){\lin \line(1, e(1, 0){. 0){.4}} 4}} \put(1.5, \put (1.5, 1.15 1.15241){ 241){\lin \line(0, e(0, 1){. 1){.4}} 4}} \put(-1.7, 1.35241){\line(1, 0){.4}} \put(-1.5 \put (-1.5, , 1.15 1.15241) 241){\li {\line(0 ne(0, , 1){.4}} \end{picture}

Using the Java program  qbezier  (see appendix for the source file  qbezier.java), we can generate the  qbezier  command lines of the input file with the command java qbez qbezie ier r •   java java qbez qbezie ier r •   java

0 0 0 2 2.76 2.7622 22 3.62 3.6269 69, 0 0 0 -2 2.76 2.7622 22 -3.6 -3.626 269 9

and insert them into the LAT X file. E

21

 

2.4.2 2.4. 2

Force orcess on the cat catena enary ry

\setlength{\unitlength}{3cm} \begin{picture}(1.75, \begin{pictur e}(1.75, 2.75)(0, -0.1) \put(0,0){\vector(1,0){1.75}} \put(1.85, -0.03){$x$} \put(0,0){\vector(0,1){2.75}} \put(0.07, 2.70){$y$} \thicklines \qbezier(0.399, \qbezier(0.39 9, 0.467)(0.797, 0.467)(0.797, 0.998) (1.118, (1.1 18, 1.96 1.962) 2) \thinlines

 y          V 2           H 

G

  H    V  1          x1

 

x2

 x

Fig. 26: Forces on the catenary As the picture originally was too close to the caption, “Fig. 26: Forces on the catenary”, it was pushed up somewhat (0, -0.1 -0.1) )  of  by the optional argument   (0, the  picture   environment.

\multiput(0.399, 0)(0, 0.1){3} \multiput(0.399, {\line(0,1){0.05}} \multiput(1.118, \multiput(1.1 18, 0)(0, 0.1){20} {\line(0,1){0.05}} \put(0.399, -0.08){\make -0.08){\makebox(0,0){$x_1 box(0,0){$x_1$}} $}} \put(1.118, -0.08){\make -0.08){\makebox(0,0){$x_2 box(0,0){$x_2$}} $}} \multiput(0.399, \multiput(0.3 99, 0.467)(0, -0.267){2} {\line(-1, 0){0.2}} \multiput(0.399, \multiput(0.3 99, 0.467)(-0.2 0.467)(-0.2, , 0){2} {\line(0, -1){0.267}} \put(0.399, 0.467){\vector(-1, 0){0.2}} \put(0.399, 0.467){\vector(0, -1){0.267}} \put(0.399, 0.467){\vector(-3, -4){0.2}} \put(0.32,0.55){\makebox(0,0){$H$}} \put(0.48, 0.33){\makebo 0.33){\makebox(0,0){$V_1$} x(0,0){$V_1$}} } \multiput(1.118, \multiput(1.1 18, 1.962)(0, 0.6){2} {\line(1,0){0.2}} \multiput(1.118, \multiput(1.1 18, 1.962)(0.2, 0){2} {\line(0,1){0.6}} \put(1.118, 1.962){\vect 1.962){\vector(1,0){0.2}} or(1,0){0.2}} \put(1.118, 1.962){\vect 1.962){\vector(0,1){0.6}} or(0,1){0.6}} \put(1.118, 1.962){\vect 1.962){\vector(1,3){0.2}} or(1,3){0.2}} \put(1.22, 1.87){\makebo 1.87){\makebox(0,0){$H$}} x(0,0){$H$}} \put(1.02, 2.22){\makebo 2.22){\makebox(0,0){$V_2$} x(0,0){$V_2$}} } \put(0.797, 1.195){\vect 1.195){\vector(0,-1){0.33 or(0,-1){0.333}} 3}} \put(0.777, 1.195){\line 1.195){\line(1,0){0.04}} (1,0){0.04}} \put(0.83,1.0){$G$} \end{picture}

22

 

2.4.3 2.4. 3

Cat Catena enarie riess of co const nstan antt len length gth

\setlength{\unitlength}{5cm} \begin{picture}(1.2, \begin{pictur e}(1.2, 1.3) \put(0, 0){\vector(1, 0){1.15}} \put(1.17, -.015){$x$} \put(0, 0){\vector(0, 1){1.15}} \put(0, 1.19){\makebox(0, 0){$y$}} % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(0.2998/0.905) m2=10.0 \qbezier(0.0,0.0)(0.2093,0 \qbezier(0.0, 0.0)(0.2093,0.0)(0.2998,0. .0)(0.2998,0.905) 905) % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0

y

  L

 

(u, v)

L

L

L

x

Fig. 27: Catenaries of constant length From the equation y  x  = cosh a a

 − 1

of the catenary, it is seen that all catenaries can be obtained by scaling the curve   y  = cosh x  1 with factor   a. A catenary of length L length L having  having its vertex in the origin and ending in the point (u, ( u, v)  www.vsmp.ch satisfies (see , Bulletin nr. 87) the equations

 −

  

√ L + a − a,  L + v   L −v , u =   ln L−v 2v 2

2

v   =

2

2

 u m   = sinh . a

From these equations, for L for  L =  = 1 we get: a

u

v

m

00..21 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2

00..42692958 0.5757 0.6589 0.7218 0.7703 0.8081 0.8381 0.8620 0.8814 0.8972 0.9102

05 00..891050 980 0.7440 0.6770 0.6180 0.5662 0.5207 0.4806 0.4454 0.4142 0.3866 0.3620

510 3.3333 2.5 2 1.6667 1.4286 1.25 1.1111 1 0.9091 0.8333

% P2=(0.4625/0.8198) m2=5.0 \qbezier(0.0,0.0)(0.2985,0 \qbezier(0.0, 0.0)(0.2985,0.0)(0.4625,0. .0)(0.4625,0.8198) 8198) % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(0.5757/0.744) m2=3.3333 \qbezier(0.0,0.0)(0.3525,0 \qbezier(0.0, 0.0)(0.3525,0.0)(0.5757,0. .0)(0.5757,0.744) 744) % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(0.6589/0.677) m2=2.5 \qbezier(0.0,0.0)(0.3881,0 \qbezier(0.0, 0.0)(0.3881,0.0)(0.6589,0. .0)(0.6589,0.677) 677) % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(0.7218/0.618) m2=2.0 \qbezier(0.0,0.0)(0.4128,0 \qbezier(0.0, 0.0)(0.4128,0.0)(0.7218,0. .0)(0.7218,0.618) 618) % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(0.7703/0.5662) m2=1.6667 \qbezier(0.0,0.0)(0.4306,0 \qbezier(0.0, 0.0)(0.4306,0.0)(0.7703,0. .0)(0.7703,0.5662) 5662) % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(0.8081/0.5207) m2=1.4286 \qbezier(0.0,0.0)(0.4436,0 \qbezier(0.0, 0.0)(0.4436,0.0)(0.8081,0. .0)(0.8081,0.5207) 5207) % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(0.8381/0.4806) m2=1.25 \qbezier(0.0,0.0)(0.4536,0 \qbezier(0.0, 0.0)(0.4536,0.0)(0.8381,0. .0)(0.8381,0.4806) 4806) % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(0.862/0.4454) m2=1.1111 \qbezier(0.0,0.0)(0.4611,0 \qbezier(0.0, 0.0)(0.4611,0.0)(0.862,0.4 .0)(0.862,0.4454) 454) % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(0.8814/0.4142) m2=1.0 \qbezier(0.0,0.0)(0.4672,0 \qbezier(0.0, 0.0)(0.4672,0.0)(0.8814,0. .0)(0.8814,0.4142) 4142) % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(0.8972/0.3866) m2=0.9091 \qbezier(0.0,0.0)(0.4719,0 \qbezier(0.0, 0.0)(0.4719,0.0)(0.8972,0. .0)(0.8972,0.3866) 3866) % qbezi qbezier er P1=( P1=(0.0/ 0.0/0.0) 0.0) m1=0 m1=0.0 .0 % P2=(0.9102/0.362) m2=0.8333 \qbezier(0.0,0.0)(0.4758,0 \qbezier(0.0, 0.0)(0.4758,0.0)(0.9102,0. .0)(0.9102,0.362) 362) \put(0.5757, 0.744){\circl 0.744){\circle*{.015}} e*{.015}} \put \put(0 (0.6 .6, , 0.74 0.74){ ){$( $(u, u,v) v)$} $} \put \put(0 (0.5 .5, , 0.05 0.05){ ){$L $L$} $} \put \put(0 (0.1 .18, 8, 0.45 0.45){ ){$L $L$} $} \put(1, -.02){\line(0, 1){.04}} \put(1, .06){\makebox(0, 0){$L$}} \put(-.02, 1){\line(1, 0){.04}} \put(.03, .98){$L$} \end{picture}

Using equation (1) in the section about quadratic B´eezier zier curves, we can calculate the intermediate intermediate control con trol point points. s. Or we can, by using the Jav Javaa program  qbezier  described there (see appendix for the

23

 

source file  qbezier.java), produce the  \qbezier  command lines and insert them into the LATEX file. 2.4.4 2.4 .4

Cir Circle cless an and d elli ellipse psess

\setlength{\unitlength}{1cm} \begin{picture}(6, \begin{pictur e}(6, 4) \linethickness{0.075mm} \multiput \mul tiput(0, (0, 0)(1, 0){7 0){7}{\l }{\line( ine(0, 0, 1){4 1){4}} }} \multiput \mul tiput(0, (0, 0)(0, 1){5 1){5}{\l }{\line( ine(1, 1, 0){6 0){6}} }} % El Elli lip pse: se: u=3 =3.0 .0 v=2.0 =2.0 a= a=1. 1.9 9 b=1. b=1.9 9 % phi=0.0 Grad \qbezier(4.9,2.0)(4.9,2.78 \qbezier(4.9, 2.0)(4.9,2.787)(4.3435,3.3 7)(4.3435,3.3435) 435) \qbezier(4.3435,3.3435)(3. \qbezier(4.34 35,3.3435)(3.787,3.9)(3.0, 787,3.9)(3.0,3.9) 3.9) \qbezier(3.0,3.9)(2.213,3.9)(1.6565,3.3 \qbezier(3.0,3.9)(2.213,3. 9)(1.6565,3.3435) 435) \qbezier(1.6565,3.3435)(1. \qbezier(1.65 65,3.3435)(1.1,2.787)(1.1, 1,2.787)(1.1,2.0) 2.0) \qbezier(1.1,2.0)(1.1,1.21 \qbezier(1.1, 2.0)(1.1,1.213)(1.6565,0.6 3)(1.6565,0.6565) 565) \qbezier(1.6565,0.6565)(2. \qbezier(1.65 65,0.6565)(2.213,0.1)(3.0, 213,0.1)(3.0,0.1) 0.1) \qbezier(3.0,0.1)(3.787,0. \qbezier(3.0, 0.1)(3.787,0.1)(4.3435,0.6 1)(4.3435,0.6565) 565) \qbezier(4.3435,0.6565)(4. \qbezier(4.34 35,0.6565)(4.9,1.213)(4.9, 9,1.213)(4.9,2.0) 2.0) % El Elli lip pse: se: u=3 =3.0 .0 v=2.0 =2.0 a= a=2. 2.8 8 b=0. b=0.9 9 % phi=0.0 Grad \qbezier(5.8,2.0)(5.8,2.37 \qbezier(5.8, 2.0)(5.8,2.3728)(4.9799,2. 28)(4.9799,2.6364) 6364) \qbezier(4.9799,2.6364)(4. \qbezier(4.97 99,2.6364)(4.1598,2.9)(3.0 1598,2.9)(3.0,2.9) ,2.9) \qbezier(3.0,2.9)(1.8402,2 \qbezier(3.0, 2.9)(1.8402,2.9)(1.0201,2. .9)(1.0201,2.6364) 6364) \qbezier(1.0201,2.6364)(0. \qbezier(1.02 01,2.6364)(0.2,2.3728)(0.2 2,2.3728)(0.2,2.0) ,2.0) \qbezier(0.2,2.0)(0.2,1.62 \qbezier(0.2, 2.0)(0.2,1.6272)(1.0201,1. 72)(1.0201,1.3636) 3636) \qbezier(1.0201,1.3636)(1. \qbezier(1.02 01,1.3636)(1.8402,1.1)(3.0 8402,1.1)(3.0,1.1) ,1.1) \qbezier(3.0,1.1)(4.1598,1 \qbezier(3.0, 1.1)(4.1598,1.1)(4.9799,1. .1)(4.9799,1.3636) 3636) \qbezier(4.9799,1.3636)(5. \qbezier(4.97 99,1.3636)(5.8,1.6272)(5.8 8,1.6272)(5.8,2.0) ,2.0) \thicklines % El Elli lip pse: se: u=3 =3.0 .0 v=2.0 =2.0 a= a=0. 0.9 9 b=1. b=1.7 7 % phi=30.0 Grad \qbezier(3.7794,2.45)(3.42 \qbezier(3.77 94,2.45)(3.4273,3.0598) 73,3.0598) (2.9501,3.3592) \qbezier(2.9501,3.3592)(2. \qbezier(2.95 01,3.3592)(2.4728,3.6586) 4728,3.6586) (2.15,3.4722) \qbezier(2.15,3.4722)(1.82 \qbezier(2.15 ,3.4722)(1.8272,3.2858) 72,3.2858) (1.8478,2.7228) \qbezier(1.8478,2.7228)(1. \qbezier(1.84 78,2.7228)(1.8685,2.1598) 8685,2.1598) (2.2206,1.55) \qbezier(2.2206,1.55)(2.57 \qbezier(2.22 06,1.55)(2.5727,0.9402) 27,0.9402)

Fig. 28: Circles and ellipses The circle (a (a  = b  =  b =  = 1.9) was built from 8 ar arcs cs,, ea each ch of 45 de degr gree ees, s, and and each each approxima appro ximated ted by a quadratic quadratic B´ ezier ezier curve. curv e. Circles Circles and ellipses ellipses can then be obtained by rotating, scaling and translating. Thus, the building block of all the ci circ rcle less an and d el elli lips pses es is the the quad quadra rati ticc B´eezier zier curve determined d etermined by the control points

  

P 1   = (1 (1//0) 0),,

 √ √  − √  

P 2   = (1  1), (1// 2  1), 1 1 P 3   = 2 2 2 2

(2) :

 √   √  

 

1 2

 

2

1 2

2

        √        (1/ (1/ 2 − 1)                    

  

(3.0499,0.6408) \qbezier(3.04 \qbezier(3.0499,0.6408)(3. 99,0.6408)(3.5272,0.3414) 5272,0.3414) (3.85,0.5278) \qbezier(3.85,0.5278)(4.17 \qbezier(3.85 ,0.5278)(4.1728,0.7142) 28,0.7142) (4.1522,1.2772) \qbezier(4.1522,1.2772)(4. \qbezier(4.15 22,1.2772)(4.1315,1.8402) 1315,1.8402) (3.7794,2.45) \end{picture}



(1/ (1/0) Fig. 29: 45 degrees arc

The quadratic B´eezier zier curve with control points (2) is given by the equation r(t) = (1

 − t)

2



1 + 2(1 0

√    √ √  

 − t)t

  1 + t2 2  1

 −

1 2

2

1 2

2

.

From this, we get: 2

||r(t)||

2 2

= 1 + (10

 − 7√ 2)(1 2)(1 − t) t ,

24

 

(3)

 

      − √   ≈      √   −  ≤  ≤  − − r

1 2

2

=

 1 4

26

 7 2

 1  1..003135 003135..

 || ||

The error amounts to approxima approximately tely 0.3 percen p ercent. t. From (3), we further conclude conclude that r(t)   >  1 for  1  s + 2 , we can see the symmetry with respect to t 0  < t <  1. Letting t Letting  t =  = s to  t =  =   21 :

||r(s)||

2

= 1 + (10

 7 2) s2

 1 4

2

1 2

 s

 1 2

.

bezierellipse.java e.java) generates a The Java program  bezierellipse  (see appendix for the source file   bezierellips file,  ellipse.tex, which can be pasted into a  picture  environment. Running the program with

•   java bezierell bezierellipse ipse <u >

<v > <a > <b > <phi >

 b,, and rotated by  < phi >  degrees. produces a file representing the ellipse with center (u/v (u/v)) and radii a radii  a und  und b Thus, the  \qbezier  lines in the present example can be produced by invoking

•   java java bezi bezier erel elli lips pse e java bezi bezier erel elli lips pse e •   java java bezier bezierell ellips ipse e •   java

3 2 1.9 1.9 1.9 1.9 0 3 2 2.8 2.8 0.9 0.9 0 3 2 0.9 1.7 30

25

 

2. 2.5 5

Enha Enhanc ncin ing g th the e   picture   environment with packages   epic   und   eepic

The packages   epic   and   eepic  enhance the   picture   environ environmen ment. t. They are extensiv extensively ely described in Goossens, Mittelbach, Samarin[1]. 2.5.1 2.5. 1

Tw Two o app applica lication tionss of   epic:   matrixput   and  putfile

\usepackage{epic}  in the preamble of the LATEX file. The two following examples require the command   \usepackage{epic} The  \matrixput  command

The  \matrixput  command is the natural generalization of the  \multiput  command to two dimensions.

       

       

   

   

Fig. 30

   

   

   

\setlength{\unitlength}{1mm} \begin{picture}(60, \begin{pictur e}(60, 30) \matrixpu \mat rixput(0, t(0, 0)(20 0)(20,0){ ,0){4}(0 4}(0,20){ ,20){2} 2} {\circle{2}} \matrixput(10,10)(20,0){3}(0,20){2} {\circle{2}} \matrixput(10, \matrixput(10 , 0)(20,0){3}(0 0)(20,0){3}(0,20){2} ,20){2} {\circle*{2}} \matrixput(0, 10)(20,0){4} 10)(20,0){4}(0,20){2} (0,20){2} {\circle*{2}} \matrixpu \mat rixput(1, t(1, 0)(10 0)(10,0){ ,0){6}(0 6}(0,10){ ,10){4} 4} {\line(1,0){8}} \matrixpu \mat rixput(0, t(0, 1)(10 1)(10,0){ ,0){7}(0 7}(0,10){ ,10){3} 3} {\line(0,1){8}} \end{picture}

The  \putfile  command

                                              Fig. 31

\setlength{\unitlength}{1mm} \begin{picture}(62, \begin{pictur e}(62, 40) \newsavebox{\punkt} \savebox{\punkt}(0, \savebox{\pun kt}(0, 0)[l]{% \put(0, 0){\circle*{ 0){\circle*{1}} 1}} \put(0, 0){\circle{2 0){\circle{2}} }} \multiput \mul tiput(-3, (-3, 0)(4 0)(4, , 0){2 0){2}{\l }{\line(1 ine(1, , 0){2 0){2}} }} \multiput \mul tiput(0, (0, -3)(0 -3)(0, , 4){2 4){2}{\l }{\line(0 ine(0, , 1){2 1){2}} }} } \multiput \mul tiput(0, (0, 0)(62 0)(62, , 0){2 0){2}{\l }{\line(0 ine(0, , 1){4 1){40}} 0}} \multiput \mul tiput(0, (0, 0)(0, 40){ 40){2}{\ 2}{\line line(1, (1, 0){6 0){62}} 2}} \putfile{data/datafile1}{\ \putfile{data /datafile1}{\circle{2}} circle{2}} \putfile{data/datafile2}{\ \putfile{data /datafile2}{\usebox{\punkt usebox{\punkt}} }} \end{picture}

\putfile{data/datafile1} may have to be replaced by the backslash on The slash in the command   \putfile{data/datafile1} a Windows system. The two files  datafile1  and  datafile2  contain one coordinate pair on each line:

26

 

datafile data file1: 1: 10 10 20 20 30 20 35 21 50 15 55 16 52 17 60 16

2.5.2 2.5. 2

| | | | | | | | | | | |

data datafile file2: 2: 5 5 10 15 15 18 17 35 21 28 33 7 41 20 47 37 51 9 53 29 57 4

Lin Line e seg segmen ments ts an and d cir circles cles in the the  eepic  package

\setlength{\unitlength}{1mm} \begin{picture}(60, \begin{pictur e}(60, 44) \multiput \mul tiput(0, (0, 0)(60 0)(60, , 0){2 0){2}{\l }{\line(0 ine(0, , 1){4 1){44}} 4}} \multiput \mul tiput(0, (0, 0)(0, 44){ 44){2}{\ 2}{\line line(1, (1, 0){6 0){60}} 0}} % requi requires res eepic \put(30, 22){\circle{4 22){\circle{40}} 0}} \put(30, 22){\circle{3 22){\circle{36}} 6}} ......................... ......................... \put(30, 22){\circle{8 22){\circle{8}} }} \put(30, 22){\circle{4 22){\circle{4}} }}

Fig. 32: Line segments and circles in the  eepic  package Thiss exampl Thi examplee requir requires es the comman command d usepackage eepic   in the preambl preamblee A of the L TEX 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.

\

{

}

Remark.   pdflatex   cannot cannot dea deall dire rect ctly ly with with co comm mman ands ds of the the   eepic

pack pac kage. age The picture picture was genera generated ted with the. commands

 |

 |

latex  dvips  ps2pdf

and subsequently converted into a   png picture. pict ure. This was then then imported with includegraphics  command. the   includegraphics

% integ dir direct ection ion vec vector tors s mus must t con consis sist t of % integers ers \put(30, 22){\line(30, 0){30}} \put(30, 22){\line(30, 1){30}} \put(30, 22){\line(30, 2){30}} .............................. .............................. \put(30, 22){\line(30, 20){30}} \put(30, 22){\line(30, 21){30}} \put(30, 22){\line(30, 22){30}} % dir direct ection ion vec vector tors s mus must t con consis sist t of % integ integers ers \put(30, 22){\line(-30, -0){30}} \put(30, 22){\line(-30, -1){30}} \put(30, 22){\line(-30, -2){30}} ................................ ................................. \put(30, 22){\line(-30, -20){30}} \put(30, 22){\line(-30, -21){30}} \put(30, 22){\line(-30, -22){30}} \end{picture}

27

 

3

The   pspicture   Environment of the   pstricks  Package

Unlike   epic   and   eepic, the   pstricks   package brings with it its own environment,   pspicture, with drawing commands different from those of the   picture   environ environmen ment. t. A detailed descripti description on can be found in  Goossens, Rahtz, Mittelbach[2]. Remark.   pdflatex   cannot deal directly with commands of the  pstricks   pack package. age. The pictures pictures in

Section 3 were generated with the commands

 |

 |

latex  dvips   ps2pdf

and subsequently converted into   png   pictures. pictures. These were were then imported with the  \includegraphics command.

3. 3.1 1 3.1.1 3.1 .1

Line Line seg segme men nts and and cir circl cles es Re Regu gular lar polyg polygon on

Fig. 33: Regular polygon This example illustrates how line segments of arbitrary slopes can be drawn with within in th thee   pspicture   environment. The command psset unit=3cm  sets

 \

{

}

the length length unit unit to 3 cm. (The pstricks defaultt is 1 cm.) defaul cm.) The argumen arguments ts (0 (0,, 0) and (2, (2, 2) of  begin pspicture  determine the upper left corner and the lower rightt corner of the picture. Line width righ ist set by

 \

{

}

\psset{linewidth=1pt} for the periphery, and by

\psset{linewidth=.1pt} for the diagonals.

\psset{unit=3cm} \begin{pspicture}(0, \begin{pspict ure}(0, 0)(2, 2) \psset{linewidth=1pt} \psline(2.0000,1.0000)(1.9 \psline(2.000 0,1.0000)(1.9325,1.3612) 325,1.3612) \psline(1.9325,1.3612)(1.7 \psline(1.932 5,1.3612)(1.7390,1.6737) 390,1.6737) \psline(1.7390,1.6737)(1.4 \psline(1.739 0,1.6737)(1.4457,1.8952) 457,1.8952) \psline(1.4457,1.8952)(1.0 \psline(1.445 7,1.8952)(1.0923,1.9957) 923,1.9957) \psline(1.0923,1.9957)(0.7 \psline(1.092 3,1.9957)(0.7263,1.9618) 263,1.9618) \psline(0.7263,1.9618)(0.3 \psline(0.726 3,1.9618)(0.3974,1.7980) 974,1.7980) \psline(0.3974,1.7980)(0.1 \psline(0.397 4,1.7980)(0.1498,1.5264) 498,1.5264) \psline(0.1498,1.5264)(0.0 \psline(0.149 8,1.5264)(0.0170,1.1837) 170,1.1837) \psline(0.0170,1.1837)(0.0 \psline(0.017 0,1.1837)(0.0170,0.8163) 170,0.8163) \psline(0.0170,0.8163)(0.1 \psline(0.017 0,0.8163)(0.1498,0.4736) 498,0.4736) \psline(0.1498,0.4736)(0.3 \psline(0.149 8,0.4736)(0.3974,0.2020) 974,0.2020) \psline(0.3974,0.2020)(0.7 \psline(0.397 4,0.2020)(0.7263,0.0382) 263,0.0382) \psline(0.7263,0.0382)(1.0 \psline(0.726 3,0.0382)(1.0923,0.0043) 923,0.0043) \psline(1.0923,0.0043)(1.4 \psline(1.092 3,0.0043)(1.4457,0.1048) 457,0.1048) \psline(1.4457,0.1048)(1.7 \psline(1.445 7,0.1048)(1.7390,0.3263) 390,0.3263) \psline(1.7390,0.3263)(1.9 \psline(1.739 0,0.3263)(1.9325,0.6388) 325,0.6388) \psline(1.9325,0.6388)(2.0 \psline(1.932 5,0.6388)(2.0000,1.0000) 000,1.0000) \psset{linewidth=.1pt} \psline(2.0000,1.0000)(1, \psline(2.000 0,1.0000)(1, 1) \psline(1.9325,1.3612)(1, \psline(1.932 5,1.3612)(1, 1) \psline(1.7390,1.6737)(1, \psline(1.739 0,1.6737)(1, 1) \psline(1.445 \psline(1.4457,1.8952)(1, 7,1.8952)(1, \psline(1.0923,1.9957)(1, \psline(1.092 3,1.9957)(1, \psline(0.7263,1.9618)(1, \psline(0.726 3,1.9618)(1, \psline(0.3974,1.7980)(1, \psline(0.397 4,1.7980)(1, \psline(0.1498,1.5264)(1, \psline(0.149 8,1.5264)(1, \psline(0.0170,1.1837)(1, \psline(0.017 0,1.1837)(1, \psline(0.0170,0.8163)(1, \psline(0.017 0,0.8163)(1, \psline(0.1498,0.4736)(1, \psline(0.149 8,0.4736)(1, \psline(0.3974,0.2020)(1, \psline(0.397 4,0.2020)(1, \psline(0.7263,0.0382)(1, \psline(0.726 3,0.0382)(1, \psline(1.0923,0.0043)(1, \psline(1.092 3,0.0043)(1, \psline(1.4457,0.1048)(1, \psline(1.445 7,0.1048)(1, \psline(1.7390,0.3263)(1, \psline(1.739 0,0.3263)(1, \psline(1.9325,0.6388)(1, \psline(1.932 5,0.6388)(1, \end{pspicture}

28

1) 1) 1) 1) 1) 1) 1) 1) 1) 1) 1) 1) 1) 1)

 

 P i   (i  = 0, . . . , 16) ,  16) are determined by The points points P 

3.1.2 3.1 .2

Tri rian angle gle

 

·  · 

π  2  2π , 17  2π  2 π . xi   = 1 + sin i 17

xi   = 1 + cos i

\psset{unit=.45pt} \begin{pspicture}*(420, \begin{pspict ure}*(420, 420) \psset{linewidth=.4pt} % Fra Frame me \pspolygo \psp olygon(0, n(0, 0)(4 0)(420, 20, 0)(4 0)(420, 20, 420) 420)(0, (0, 420) % Umk Umkrei reis s und Ink Inkrei reis s \pscircle(206, \pscircle(206 , 222){166.18} \pscircle(250, \pscircle(250 , 197){75.42} % Ankre Ankreise ise \pscircle[linestyle=dashed \pscircle[lin estyle=dashed](476, ](476, 135){157.68} \pscircle[linestyle=dashed \pscircle[lin estyle=dashed](-32, ](-32, -22){266.53} \pscircle[linestyle=dashed \pscircle[lin estyle=dashed](132, ](132, 579){315.92} % trian triangle gle \psset{linewidth=1pt} \pspolygo \psp olygon(43 n(43, , 253)( 253)(361, 361, 283) 283)(287 (287, , 77) % ninenine-poin points ts circ circle le (Feu (Feuerba erbach) ch) \pscircle[linestyle=dotted \pscircle[lin estyle=dotted](242, ](242, 195){83.09}

Fig. 34: Triangle

\end{pspicture}

 ∗

This example illustrates that  pstricks  allows the drawing of circles with arbitrary radii. The  after pspicture  causes the picture to be clipped to the frame determined by   (420, (420, 420). The upper upper lef leftt corner not being mentioned, it defaults to (0, (0, 0). In the picture, a triangle is drawn with the inscribed and the circumscribed circle (solid), the three adjacent circles (dashed), and the nine point (Feuerbach) circle (dotted).

{

}

3.1.3 3.1. 3

Loops and calcula calculatio tions ns

\newcounter{i} \setcounter{i \newcounter{i} \setcounter{i}{1} }{1} \newcounter{j} \newcounter{j } \setcounter{j \setcounter{j}{0} }{0} \newcounter{r} \newcounter{r } \setcounter{r \setcounter{r}{0} }{0} \usepackage{pstricks}

Fig. 35: Loops and calculations

\usepackage{ifthen} \usepackage{calc} \psset{unit=.66mm} \begin{document} \begin{pspicture}*(100, \begin{pspict ure}*(100, 100) \pspolygo \psp olygon(0, n(0, 0)(1 0)(100, 00, 0)(1 0)(100, 00, 100) 100)(0, (0, 100) \psset{linewidth=.1pt} \whiledo{\value{i}<25}{% \setcounter{j}{\value{i}*4} \setcounter{r}{\value{i}*3} \pscircle(\value{j},\value \pscircle(\va lue{j},\value{j}){\value{r} {j}){\value{r}} } \stepcounter{i} } \end{pspicture} \end{document}

29

 

As this example shows, with the   calc   and the   ifthen   packages, packages, LATEX assumes the capability of  running runni ng through loops, taking decisions, decisions, and doing calcu calculatio lations. ns. The  after pspicture  causes the (100, 100). The upper left corner not being mentioned, picture to be clipped to the frame determined by   (100, it defaults to (0, (0, 0).

 ∗

3.1.4 3.1 .4

 {

}

A rema remark rk about about  latex2html

Unlike the  latex  command, the  latex2html  command expects all  \psset  commands to be placed  within  the  pspicture   environment. environment. Otherwise,   \psset  is con consid sidere ered d unkno unknown. wn. Th Thus us the argumen arguments ts of the \begin{pspicture} comma  command nd always always have to be giv given en in the default default unit, which is 1 cm.

3. 3.2 2

More More ap appl plic icat atio ions ns

The following examples are taken from  Goossens, Rahtz, Mittelbach[2], with slight variations. They are intended to give some hints as to the versatility of the   pstricks  package, and the related packages, pstcol,  pst-grad,  pst-text,   pst-node,  pst-tree.

While the  latex2html   command is capable of processing   pstricks   commands, commands, it cannot cannot process process pstcol,  pst-grad,  pst-text,   pst-node, or  pst-tree  commands. Thus, we get the following overview: epic   eepic   pstricks   pstcol,...   3.2.1 3.2 .1

late latex x

late latex2 x2ht html ml

pdfl pdflat atex ex

+ + + +

+ + + -

+ -

Tri ribo box x

\usepackage{pstricks, \usepackage{p stricks, pstcol, pst-grad}

Fig. 36: Tribox

3.2.2 3.2 .2

\pstribox[shadow=true, fillstyle=gr \pstribox[shadow=true, fillstyle=gradient, adient, gradbegin=green, gradbegin=gr een, gradend=red] {\color{white}$\left(\begi {\color{white }$\left(\begin{array}{cc} n{array}{cc} \cos\varp \cos\ varphi hi & -\si -\sin\va n\varphi rphi \\ \sin\v \si n\varp arphi hi & \co \cos\v s\varp arphi hi \end{array}\right)$ }

Cu Curv rved ed text text

\usepackage{pstricks, \usepackage{p stricks, pstcol, pst-text}

Fig. 37: Curved text

\begin{pspicture}(-4, -3.2)(3, 0.2) \begin{pspicture}(-4, \pss \psset et{l {lin inec ecol olor or=w =whi hite te} } % hidd hidden en \pstextpath {\pscurve {\psc urve(-4, (-4, -2)( -2)(-2, -2, 0)(0 0)(0, , -3)( -3)(2, 2, -1)% (3, -2) -2)(5, (5, -3) -3)} } {\color{blue} % font color If you you want want to type type $(a+b)^n=\sum_{k=0}^n $(a+b)^n=\sum_ {k=0}^n {n\choose k} a^{n-k a^{ n-k}b^ }b^k$ k$ and let it fol follow low alo along ng a cur curvin ving g lin line e \ld \ldots ots} } \end{pspicture}

30

 

3.2. 3.2.3 3

Lo Logo go

\usepackage{pstricks, pstcol, pstc ol, pstpst-text text, , pst-g pst-grad} rad} \definecolor{pink}{rgb}{1, \definecolor{ pink}{rgb}{1, .75, .8} \begin{document} \begin{pspicture}(-3, \begin{pspict ure}(-3, -2.2)(3, 2.2) \psset{linestyle=none} \newcommand{\curly}[1]{{\f \newcommand{\ curly}[1]{{\fontfamily{pzc ontfamily{pzc}% }% \fontsize{17}{17}\itshape#1}} \pstextpath[c]{\psarcn(0, \pstextpath[c ]{\psarcn(0, 0){2}{180}{0} 0){2}{180}{0}} }

Fig. 38: Logo

3. 3.2. 2.4 4

{\curly{The Unseen University}} \pstextpath[c]{\psarc(0, \pstextpath[c ]{\psarc(0, 0){2}{180}{0 0){2}{180}{0}} }} {\curly{Ankh-Morpork,Discworld}} \pscircle[fillstyle=gradie \pscircle[fil lstyle=gradient, nt, gradangle=45 gradangle=45, , gradbegin=pink, gradbegin=pin k, gradend=yello gradend=yellow](0, w](0, 0){1.7} \rput[B](0, 0){{\Large\i 0){{\Large\itshape\bfseri tshape\bfseries es Rincewind Rince wind, , Arch Chan Chancell cellor or }} \end{pspicture} \end{document}

Kn Knot otss

\usepackage{pstricks, \usepackage{p stricks, pst-node}

Fig. 39: Knots

\psset{arrows=->, \psset{arrows =->, labelsep=3pt labelsep=3pt, , mnode=circle mnode=circle} } \begin{document} \begin{psmatrix}[rowsep=20 \begin{psmatr ix}[rowsep=20pt, pt, colsep=28pt] A & B \\ $\sqrt{\f $\sqr t{\frac{ rac{x+y}{ x+y}{z}}$ z}}$ & D \psset{linestyle=dotted} \ncline{1, 1}{1, 2}\naput{\em 2}\naput{\emph{firstly}} ph{firstly}} \ncline{1, 2}{2, 2}\naput{\em 2}\naput{\emph{next}} ph{next}} \ncline{2, 2}{2, 1}\naput{\em 1}\naput{\emph{then}} ph{then}} \ncline{2, 1}{1, 1}\naput{\em 1}\naput{\emph{last}} ph{last}} \nccurve[ncurv=2, linestyle lines tyle=soli =solid, d, angl angleA=9 eA=90]{1 0]{1, , 1}{2 1}{2, , 2} \end{psmatrix} \end{document}

31

 

3.2.5 3.2 .5

Fami amily ly tree tree

Fig. 40: Family tree

\usepackage{pstricks, pstcol, pst-node, pst-tree} \usepackage{pstricks, \renewcommand\psedge{\nccurve} \newcommand{\Female}[2][] \newcommand{ \Female}[2][]{{\psset{linec {{\psset{linecolor=lightgra olor=lightgray}\TR[#1]{\em y}\TR[#1]{\emph{#2}}}} ph{#2}}}} \newcommand{\Male}[2][]{{ \newcommand{ \Male}[2][]{{\psset{linecol \psset{linecolor=black}\TR[ or=black}\TR[#1]{#2}}} #1]{#2}}} \psset{nodesep=2pt, \psset{nodes ep=2pt, angleA=90, angleB=-90} \begin{document} \pstree[treemode=U]{\Femal \pstree[treem ode=U]{\Female{{\bfseries e{{\bfseries Matilde}}}{% \pstree{\Male{Sebastian}}{% \pstree{\Male[name=P]{Phil \pstree{\Male [name=P]{Philip}}{\Male{Fr ip}}{\Male{Frederick}\Fema ederick}\Female{Ethel}} le{Ethel}} \pstree{\Female[name=W]{Ma \pstree{\Fema le[name=W]{Mary}}{\Male{Li ry}}{\Male{Lionel}\Female{ onel}\Female{Agnes}}} Agnes}}} \pstree{\Female{Leonor}}{% \pstree{\Male[name=R]{Ra\’ \pstree{\Male [name=R]{Ra\’ul}}{\Male{Jo ul}}{\Male{Joaquim}\Female aquim}\Female{J\’ulia}} {J\’ulia}} \pstree{\Female[name=A]{Am \pstree{\Fema le[name=A]{Am\’elia}}{\Mal \’elia}}{\Male{\’Alvaro}\F e{\’Alvaro}\Female{Augusta} emale{Augusta}}}} }}} \psset{doubleline=true, \psset{double line=true, linestyle=dot linestyle=dotted} ted} \ncline{P}{W}\nbput{1940} \ncline{R}{A}\nbput{1954} \end{document}

32

 

4

Met eta aPost

MetaPost is a twin of Donald Knuth’s   METAFONT, which was written for the purpose of generating new fonts.   MetaPost  was derived from   METAFONT  by John D. Hobby, who writes about it: MetaPost  is a programming language much like Knuth’s   METAFONT  except that it outputs PostScript PostScri pt programs programs instead bitmaps. Borro Borrowed wed from   METAFONT  are the basic tools for creating and manipulating pictures. pictures. These include numbers, numbers, coordinate pairs, cubic splines, affine transformat transformations, ions, text stri strings, ngs, and b boolean oolean quantitie quantities. s. Additional Additional features features int integrat egrat-ing text and graphics and accessing special features of PostScript such as clipping, shading, and dashed lines. Another Another feature borrow borrowed ed from   METAFONT  is the ability to solve linear equations that are given implicitly, thus allowing many programs to be written in a largely declarative style. By building complex operations from simpler ones,  MetaPost  achieves both power and flexibility. MetaPost  is particularly well-suited to generating Fig.s for technical documents where some

aspects of a picture may be controlled by mathematical or geometrical constraints that are best expressed expressed symbolica symbolically lly.. In other wor words, ds,  MetaPost  is not meant to take the place of a freehand drawing tool or even an interactive graphics editor. A goo ood d way to start working with MetaPost  is by using  Hobby[3], whereas the comple complete te backgr backgroun ound d can be fou found nd in  Knuth[5].   Hoenig[4] and  Goossens, Raht Ra htz, z, Mit Mittel telba bach ch[2] [2] also also cont contai ain n many valuable examples. An online  tutorial  is   is found under  http:// www.ursoswald.ch.

4. 4.1 1

Exam Exampl ples es

The following examples are meant to suggest the versatility of   MetaPost.

Fig. 41: Sphere

Fig. 42: Regular polygons

33

 

Fig. 43: Fourier series

Fig. 44: Organization

34

 

Fig. 45: Spiral

4. 4.2 2

A sour source ce fil file e

The file  Transform.mp   (see appendix) can give a taste of   MetaPost   programmi programming. ng. It generates generates the two two pictures of Fig. 42. The section betw between een  beginfig(1)  and the subsequent  endfig;  defines the left picture, and the section between  beginfig(2)  and the second  endfig;  defines the picture on the right. On the command

•   mpost Transform mpost post Transform.mp),   MetaPost  generates two files,  Transform.1  and  Transform.2, which can be (or   m imported in a LATEX document with the commands \includegraphics{Transform.1} m.1}, •   \includegraphics{Transfor \includegraphics{Transform.2} m.2}. •   \includegraphics{Transfor

The LATEX file can be processed by both  latex   and  latex2html. If it is to be processe processed d by   pdflatex, the line \DeclareGraphicsRule{*}{mps}{*}{} ps}{*}{} •   \DeclareGraphicsRule{*}{m

must be entered in the preamble. Remark. On certain systems,  mp  is to be used instead of  mpost   mpost.

35

 

5

Appe pen ndix

A

qbe qbezi zier er.j .ja ava

import java.io.*; class cla ss qbe qbezie zier r { static void main(String[ static main(String[] ] args args) ) { if(arg if( args.l s.leng ength th != 6) { System.ou Syste m.out.pr t.println intln("Ge ("Gebrau brauch: ch: java qbezier x1 y1 m1 x2 y2 m2") m2"); ; return; } File outfile outfile = new File File("qb ("qbezie ezier.te r.tex"); x"); try try { double doubl e x1 = Double.p Double.parse arseDoubl Double(ar e(args[0 gs[0]); ]); double doubl e y1 = Double.p Double.parse arseDoubl Double(ar e(args[1 gs[1]); ]); double doubl e m1 = Double.p Double.parse arseDoubl Double(ar e(args[2 gs[2]); ]); double doubl e x2 = Double.p Double.parse arseDoubl Double(ar e(args[3 gs[3]); ]); double doubl e y2 = Double.p Double.parse arseDoubl Double(ar e(args[4 gs[4]); ]); double doubl e m2 = Double.p Double.parse arseDoubl Double(ar e(args[5 gs[5]); ]); if if(m (m1 1 == m2) { System.out.println("Keine System.out.pri ntln("Keine Auswertung mglich:"); System.ou Syste m.out.pri t.println ntln("m1 ("m1 und m2 msse mssen n vers verschie chieden den sein sein"); "); return; } String Strin g outstring outstring = "% qbez qbezier ier P1=( P1=("+x1 "+x1+"/" +"/"+y1+ +y1+") ") m1=" m1="+m1+ +m1+" " P2=(" P2=("+x2+ +x2+"/"+ "/"+y2+") y2+") m2=" m2="+m2; +m2; outstring outst ring += "\n\\qbez "\n\\qbezier" ier"; ; double doubl e x = (m2*x (m2*x2-m1 2-m1*x1+ *x1+y1-y2 y1-y2) ) / (m2(m2-m1); m1); double doubl e u = y1+m1 y1+m1*(x*(x-x1); x1); double doubl e v = y2+m2 y2+m2*(x*(x-x2); x2); double dou ble y = 0.5*(u 0.5*(u+v) +v); ; ou outs tstr trin ing g += "(" "(" + rund runde( e(x1 x1) ) + ", " + rund runde( e(y1 y1) ) + ") ")"; "; outs outstr trin ing g += "(" + rund runde( e(x) x) + ", " + rund runde( e(y) y) + ")"; ")"; ou outs tstr trin ing g += "(" "(" + rund runde( e(x2 x2) ) + ", " + rund runde( e(y2 y2) ) + ") ")"; "; FileWrite FileW riter r out = new File FileWrit Writer(o er(outfi utfile.ge le.getPat tPath(), h(), fals false); e); out.write(outstring); out.close(); } catch(NumberFormatExceptio catch(NumberF ormatException n e) { System.out.println("Eingab System.out.pr intln("Eingabe e nicht korrekt"); System.ou Syste m.out.pr t.println intln("Ko ("Korrek rrekte te Eing Eingabe: abe: x1 y1 m1 x2 y2 m2") m2"); ; } catch(IOE catc h(IOExcep xception tion e) { } } static String static String runde(do runde(double uble t) { Stri String ng s = "" ""; ; int T = (int)( (int)(Mat Math.r h.roun ound(1 d(1000 0000 0 * t)) t)); ; double dou ble d = T/1000 T/10000.0 0.0; ; s = Strin String.va g.valueOf lueOf(d); (d); return retu rn s; } }

36

 

B

bez bezie ierel relli lips pse.j e.ja ava

import java.io.*; class class /* * * * * * */

bezie bezierell rellipse ipse { 16.11.200 16.11.2002 2 Urs Oswal Oswald d osurs@ osurs@blue bluewin. win.ch ch erzeug erzeugt t Datei Datei "ellips "ellipse.t e.tex" ex" ueberschr ueberschreibt eibt allan allanfall falls s vorhande vorhandene ne Datei dieses Namen Namens s Ellipse Ellipse wird aus 8 quadrat quadratische ischen n Bezierku Bezierkurven rven zusam zusammeng mengeset esetzt zt Gebrau Gebrauch: ch: java java bez bezier ierell ellips ipse e [u [v [a [b [phi]] [phi]]]]] ]]]

static sta tic double double[] [] uvabp uvabp stat static ic doub double le[] [] xx stat static ic doub double le[] [] yy stat static ic doub double le sc45 sc45 static{ uvabp[0] = 0.0; uvabp[1] = 0.0; uvabp[2] = 1.0; uvabp[3] = 1.0; uvabp[4] = 0.0; }

= = = =

new new new new new .5f .5f

dou double ble[5] [5]; ; doub double le[1 [16] 6]; ; doub double le[1 [16] 6]; ; * Mat Math. h.sq sqrt rt(2 (2); ); // // // // // //

Einheitskreis u = 0 v = 0 a = 1 b = 1 phi = 0

static void main(String[ static main(String[] ] args args) ) { /* * args args[0 [0], ], ar args gs[1 [1]: ]: Mitt Mittel elpu punk nkt t (u, v) * args args[2 [2], ], args args[3 [3]: ]: Halb Halbac achs hsen en a, b * ar args[4]: Rotationswinkel phi in Grad * */ double[] doub le[] xy; for(int i=0;i<5;i++) // Aufgrund des Arguments aendern: if(args.length > i) // Mittelpunkt (u,v) uvabp[ uva bp[i] i] = Double. Double.par parseD seDoub ouble( le(arg args[i s[i]); ]); // Hal Halbac bachse hsen n a, b und Ro Rotat tation ion p String String st str r += st str r += st str r += st str r += st str r +=

str = "% " u = " " v = " " a = " " b = " " phi =

Ell Ellips ipse:" e:"; ; + uv uvab abp[ p[0] 0]; ; + uv uvab abp[ p[1] 1]; ; + uv uvab abp[ p[2] 2]; ; + uv uvab abp[ p[3] 3]; ; " + uv uvab abp[ p[4] 4] + " Gr Grad ad"; ";

uvabp[4] = Math.PI*uvabp[4]/180; xx[0] = 1; yy[0] = 0; xx[1] = 1; yy[1] = Math.sqrt(2) - 1;

// Rotationswinkel in Radian // P0 // P1

for(int i=1;i<8;i++) { double phi = i * Math.PI / 4; xy = rotate rotate(xx (xx[0] [0], , yy[ yy[0], 0], phi phi); ); xx[2*i xx[ 2*i] ] = xy[ xy[0]; 0]; yy[ yy[2*i 2*i] ] = xy[ xy[1]; 1]; xy = rotate rotate(xx (xx[1] [1], , yy[ yy[1], 1], phi phi); ); xx[2*i xx[ 2*i+1] +1] = xy[ xy[0]; 0]; yy[ yy[2*i 2*i+1] +1] = xy[ xy[1]; 1]; } for(int i=0;i<16;i++) { xx[i] = xx[i] * uvabp[2];

// Berechnung der Punkte P2,...,P15 // des Einheitskreises

yy[i] = yy[i] * uvabp[3];

// Streckung, Rotation, Verschiebung // x-Streckung // y-Streckung

37

 

xy = ro rota tate te(x (xx[ x[i i], yy[ y[i] i], , uv uva abp bp[4 [4]) ]); ; xx[i] = xy[0] + uvabp[0]; yy[i] = xy[1] + uvabp[1];

// Rot ota ati tion on // Translation (u, 0) // Translation (0, v)

} for(int i=0;i<15;i+=2) i=0;i<15;i+=2) str+="\n\\qbezier" +punkt +pu nkt(i) (i)+pu +punkt nkt(i+ (i+1)+ 1)+pun punkt( kt((i+ (i+2)% 2)%16) 16); ; // Anf Anfueg uegen en der 8 Zei Zeilen len File outfile outfile = new File File("el ("ellips lipse.te e.tex"); x"); try try { outfile.createNewFile(); // in "ellipse.tex" schreiben FileWrit File Writer er out = new FileWriter(ou FileWriter(outfile.getPath tfile.getPath(), (), false); out.write(str); out.close(); } catch(IOE catch (IOExcep xception tion e) { } } static dou static double ble[] [] rot rotate ate(do (doubl uble e x, dou double ble y, dou double ble phi phi) ) { /* * phi phi im Bo Boge genm nmas ass s */ double dou ble[] [] xy = new dou double ble[2] [2]; ; xy[0] xy[ 0] = x * Mat Math.c h.cos( os(phi phi) ) - y * Mat Math.s h.sin( in(phi phi); ); xy[1] xy[ 1] = x * Mat Math.s h.sin( in(phi phi) ) + y * Mat Math.c h.cos( os(phi phi); ); return retu rn xy; } static stat ic String String runde(do runde(double uble t) { Stri String ng s = "" ""; ; int T = (int)( (int)(Mat Math.r h.roun ound(1 d(1000 0000 0 * t)) t)); ; double dou ble d = T/1000 T/10000.0 0.0; ; s = Strin String.va g.valueOf lueOf(d); (d); return retu rn s; } static sta tic Str String ing pun punkt( kt(int int i) { String Stri ng s; s="(" s=" (" + runde( runde(xx[ xx[i]) i]) + ", " + run runde( de(yy[ yy[i]) i]) + ")" ")"; ; return retu rn s; } }

38

 

C

ar arc. c.ja jav va

import java.io.*; clas class s ar arc c { static stat ic double[] double[] xx; static stat ic double[] double[] yy; static stat ic double double r; static void main(String[ static main(String[] ] args args) ) { /* * Urs Oswald Oswald osurs@blu osurs@bluewin ewin.ch, .ch, 18. 18.11.2 11.2002 002 * Ei Ein nga gabe be: : x1 y1 x2 y2 x3 x3 y3 r * schrei schreibt bt arc.tex: arc.tex: LaTe LaTeX-D X-Date atei i fue fuer r Bog Bogen en * mit mit Radi Radius us r im Wink Winkel el P1-P P1-P22-P3 P3 (Sch (Schei eite tel: l: P2) P2) * ueberschr ueberschreibt eibt allfa allfaelli ellig g schon vorhand vorhandene ene Datei desse desselben lben Namen Namens s */ if(arg if( args.l s.leng ength th < 7) { System.ou Syste m.out.pr t.println intln("Sc ("Schrei hreibt bt arc. arc.tex tex fr Boge Bogen n mit Radi Radius us r im Wink Winkel el P1-P P1-P2-P3 2-P3"); "); System Sys tem.ou .out.p t.prin rintln tln("G ("Gebr ebrauc auch: h: jav java a arc x1 y1 x2 y2 x3 y3 r"); r"); return; } String Str ing out outstr string ing = ""; double dou ble a, rot rot; ; double[] doub le[] xy; xx = new double[4]; // P3: mittlerer (Kontroll-)Punkt yy = new double[4 double[4]; ]; xx[1] = Double.parseDouble(args[0]); yy[1] = Double.parseDouble(args[1 Double.parseDouble(args[1]); ]); xx[0] = Double.parseDouble(args[2]); yy[0] = Double.parseDouble(args[3 Double.parseDouble(args[3]); ]); xx[2] = Double.parseDouble(args[4]); yy[2] = Double.parseDouble(args[5 Double.parseDouble(args[5]); ]); r = Double.parseDouble(args[6]); outstr out string ing += "% arc\n" arc\n"; ; outstring outs tring += "% P1 = ("+x ("+xx[1] x[1]+"/" +"/"+yy[ +yy[1]+") 1]+")"; "; outstr out string ing += " P2 = ("+ ("+xx[ xx[0]+ 0]+"/" "/"+yy +yy[0] [0]+") +")"; "; outstr out string ing += " P3 = ("+ ("+xx[ xx[2]+ 2]+"/" "/"+yy +yy[2] [2]+") +")"; "; outstring + = " r = " + r ; xx[1] xx[ 1] = xx[1] xx[1] - xx[ xx[0]; 0]; yy[1 yy[1] ] = yy[ yy[1] 1] - yy[ yy[0]; 0]; xx[2 xx[2] ] = xx[2 xx[2] ] - xx[0 xx[0]; ]; yy[2 yy[2] ] = yy[2 yy[2] ] - yy[0 yy[0]; ]; a = Math. Math.sqr sqrt(x t(xx[1 x[1]*x ]*xx[1 x[1] ] + yy yy[1] [1]*yy *yy[1] [1]); ); xx[1 xx[1] ] = xx[1 xx[1] ] / a; yy[1] yy[1] = yy[1 yy[1] ] / a; a = Math. Math.sqr sqrt(x t(xx[2 x[2]*x ]*xx[2 x[2] ] + yy yy[2] [2]*yy *yy[2] [2]); ); xx[2 xx[2] ] = xx[2 xx[2] ] / a; yy[2] yy[2] = yy[2 yy[2] ] / a;

// P1 --> 1 // P2 --> 0 // P3 --> 2 // r

// Ver Versch schieb iebung ung des Sch Scheit eitels els // in den den Ursp Urspru rung ng // E Einh inheit eitsve svekto ktor r (x (xx[1 x[1], ], y yy[1 y[1]) ]) // E Einh inheit eitsve svekto ktor r (x (xx[2 x[2], ], y yy[2 y[2]) ])

rot = 0.5*( angle(xx[1], yy[1]) +angle(xx[2], yy[2]));

// rot: Neigungswinkel der // Winkelhalbierenden

xy = rotate(xx[1], yy[1], -rot); xx[1] = xy[0]; yy[1] = xy[1]; xy = rot rotate ate(xx (xx[2] [2], , yy[2] yy[2], , -rot) -rot); ; xx[2] xx[ 2] = xy[0]; xy[0]; yy[2] = xy[ xy[1]; 1]; xx[3] = 1 / xx[1]; yy[3] = 0; for(int for( int i=1; i=1;i<4; i<4;i++) i++) { xy = rotate(xx[i], yy[i], rot);

// Rotation: Ziel ist // Symmetrie zur x-Achse

// qbezier-Punktfolge: P1 P3 P2 // Zurueckrotieren

xx[i] = r * xy[0] + xx[0];

// Strecken und Zurueckschieben

39

 

yy yy[i [i] ] = r * xy[1 xy[1] ] + yy[0 yy[0]; ]; } outstring outs tring += "\n\\qbez "\n\\qbezier" ier" + punkt(1)+punkt(3)+punkt(2); File outfile = new File("arc.tex"); try{ FileWrite FileW riter r out = new File FileWrit Writer(o er(outfi utfile.g le.getPat etPath(), h(), fals false); e); out.write(outstring); out.close(); } catch(IOE catc h(IOExcep xception tion e) {

// Anfuegen der 3 Punkte // in Datei schreiben

// uebe uebersch rschreib reibt t allf allfaell aellig ig schon // bestehende Datei "arc.tex"

} } static sta tic dou double ble ang angle( le(dou double ble x, dou double ble y) { /* * Resu Result ltat at: : Ra Radi dian an, , 0 <= p phi hi < 2 2PI PI */ double dou ble phi = 0.0; 0.0; double dou ble a = Math.s Math.sqrt qrt(x* (x*x x + y*y y*y); ); x = x/a; y = y/a; phi = Math Math.aco .acos(x) s(x); ; if(y<0) phi = 2*Math.P 2*Math.PI-ph I-phi; i; return retu rn phi; } static dou static double ble[] [] rot rotate ate(do (doubl uble e x, dou double ble y, dou double ble phi phi) ) { /* * phi phi im Bo Boge genm nmas ass s */ double dou ble[] [] xy = new dou double ble[2] [2]; ; xy[0] xy[ 0] = x * Mat Math.c h.cos( os(phi phi) ) - y * Mat Math.s h.sin( in(phi phi); ); xy[1] xy[ 1] = x * Mat Math.s h.sin( in(phi phi) ) + y * Mat Math.c h.cos( os(phi phi); ); return retu rn xy; } static stat ic String String runde(do runde(double uble t) { Stri String ng s = "" ""; ; int T = (int)( (int)(Mat Math.r h.roun ound(1 d(1000 0000 0 * t)) t)); ; double dou ble d = T/1000 T/10000.0 0.0; ; s = Strin String.va g.valueOf lueOf(d); (d); return retu rn s; } static sta tic Str String ing pun punkt( kt(int int i) { String Stri ng s; s="(" s=" (" + runde( runde(xx[ xx[i]) i]) + ", " + run runde( de(yy[ yy[i]) i]) + ")" ")"; ; return retu rn s; } }

40

 

D

Tra rans nsfo form. rm.mp mp

u:=25; wi:=10; he:=8; hoehe:=he*u; breite:=wi*u;

% % % % %

25 = 25bp = 25 PostScript points = 30/72 in width in units u height in units u height width

R:=3.7; n:=17; phi:=360/(n*10); phi:=360/(n*5);

% maximum radius in units u % number of edges % rotation angle

def dra draw_p w_poin oint(e t(expr xpr P, col col) ) = unfill unfi ll fullcirc fullcircle le scal scaled ed 1.5m 1.5mm m shif shifted ted P withc withcolor olor white; draw dra w fullci fullcircl rcle e scaled scaled 1.5 1.5mm mm shi shifte fted d P wit withco hcolor lor co col; l; enddef; transform transf orm t, Rot, Rot, T; path pat h q, p[]; p[]; pair P[]; Rot:=identity rotated(360/ rotated(360/n); n);

% -------- Calculati Calculations ons in math mathemat ematical ical coor coordinat dinates es --------------------------------------------------------------P1=(.85, P1=( .85, 0); P2=(1, 0); P2=(1, P3=P1 P3=P 1 trans transform formed ed Rot; p0:=P1{1, 2}..{3, -1}P2--P3; for i=1 upto n-1: p[i]:=p[i-1] transformed Rot; endfor % % pat path h (n path path elemen elements) ts) % p17: p17:=p =p0 0 for for i=1 i=1 upto upto n-1: n-1: &p[i &p[i] ] endf endfor or ..cy ..cycl cle; e;

% % % %

p0: first path element get remaining path elements p[1],..., p[n-1] by rotating p0

% put put path path elem elemen ents ts toge togeth ther er

q:=((0, q:=( (0, 0)--( 0)--(1,0) 1,0)) ) rotat rotated ed phi; P4=p0 inter P4=p0 intersect sectionp ionpoint oint q; % -------- End of calc calculati ulations ons in math mathemat ematical ical coor coordina dinates tes ---------------------------------------------------

% % tran transform sform t maps mathematica mathematical l coord coordinat inates es on Meta MetaPost Post coordin coordinates ates % t:=ident t:=i dentity ity scal scaled ed (R*u) shif shifted ted .5(b .5(breit reite, e, hoeh hoehe); e);

beginfig(1) beginfig (1) % === ======= ======== ======== ========= ========= ===== = fig figure ure 1 ===== ========= ======== ========= ========= ======== ========= ======= == draw (0, 0)-0)--(bre (breite, ite, 0)-0)--(bre (breite, ite, hoeh hoehe)--( e)--(0, 0, hoeh hoehe)-e)--cycl cycle; e; T:=identity; fo for r i= i=0 0 upto upto 49 49: : p98:=p17 p98: =p17 transform transformed ed T tran transfor sformed med t; if i mod 2 = 0: fill p98;

41

 

else: unfill unfil l p98; fi draw p98; T:=T zscaled P4; endfor endf endfig ig; ; % ==== ====== ==== ==== ==== ==== ==== ==== ==== ==== == end end of figu figure re 1 ==== ====== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== === =

beginfig(2) beginfig (2) % === ======= ======== ======== ========= ========= ===== = fig figure ure 2 ===== ========= ======== ========= ========= ======== ========= ======= == % % Box (in math mathemat ematical ical coor coordina dinates) tes) % path kasten; kasten; kasten=(.65, -.15)--(1.15, -.15)--(1.15, .5)--(.65, .5)--cycle; z98=point z98= point 3.5 of kasten kasten tran transform sformed ed t; fill kasten kasten transfor transformed med t with withcolor color .9white; draw kasten transfor transformed med t; draw (0, 0)-0)--(bre (breite, ite, 0)-0)--(bre (breite, ite, hoeh hoehe)--( e)--(0, 0, hoeh hoehe)-e)--cycl cycle; e; draw draw draw draw dra w draw dra w

p17 tran transfor sformed med t; p17 zsc zscale aled d P4 transf transform ormed ed t wit withco hcolor lor red red; ; q rot rotate ated d -phi -phi tra transf nsform ormed ed t; q tra transf nsform ormed ed t wit withco hcolor lor red red; ;

pickup pick up pencircl pencircle e scale scaled d 2; draw dra w p0 transf transform ormed ed t; label.rt( label. rt(bte btex x $p_{99 $p_{99}$ }$ etex, etex, poi point nt 3 of p17 tra transf nsform ormed ed t); pickup pencircl pickup pencircle e scale scaled d .5; draw_poin draw _point((0 t((0,0) ,0) trans transform formed ed t, blac black); k); label.bot labe l.bot(bte (btex x (0,0) etex etex, , (0,0 (0,0) ) tran transfor sformed med t); draw_point((1 draw_poin t((1,0) ,0) trans transform formed ed t, blac black); k); label.bot labe l.bot(bte (btex x (1,0) etex etex, , (1,0 (1,0) ) tran transfor sformed med t); draw_point(P4 draw_poin t(P4 transfor transformed med t, red) red); ; label.urt labe l.urt(bte (btex x $P_4$ etex, P4 trans transform formed ed t); % % ren renew ew def defini initio tion n of transf transform orm t in ord order er === ====== ====== ====== === % to dra draw w the the en enla larg rged ed k kas aste ten n at t the he l lef eft t ==== ====== ==== ==== ==== == % t:=identi t:=i dentity ty scaled scaled (2.3 (2.3R*u) R*u) shift shifted ed (-.3 (-.35bre 5breiteite-1.8u 1.8u, , .5ho .5hoeheehe-.4u) .4u); ; kasten:=kaste kasten:=k asten n transform transformed ed t; fill kasten kasten withcolo withcolor r .9wh .9white; ite; draw kasten; kasten; z99=point z99= point 1.5 of kasten; kasten; draw p0 transformed t; draw draw p1 tran transf sfor orme med d t cuta cutaft fter er kast kasten en; ; draw p[n-1] p[n-1] transfor transformed med t cutb cutbefore efore kasten; draw draw p p0 0

zsca zscale led d P4 tran transf sfor orme med d t w wit ithc hcol olor or r red ed; ;

dr draw aw p1

zsca zscale led d P P4 4 tra trans nsfo form rmed ed t c cut utaf afte ter r

42

kast kasten en with withco colo lor r red red; ;

 

draw p[n-1] zscaled P4 tran transfor sformed med t cutb cutbefore efore kasten withcol withcolor or red; draw q rot draw rotate ated d -phi -phi tra transf nsform ormed ed t cut cutbef before ore kas kasten ten; ; draw dra w q tra transf nsform ormed ed t cut cutbef before ore kas kasten ten wit withco hcolor lor red red; ; pickup pick up pencircl pencircle e scale scaled d 2; draw p0 transf draw transform ormed ed t; label. lab el.rt( rt(bte btex x $p_{99 $p_{99}$ }$ etex, etex, poi point nt 3 of p17 tra transf nsform ormed ed t); pickup pick up pencircl pencircle e scale scaled d .5; draw_poin draw _point((1 t((1,0) ,0) trans transform formed ed t, blac black); k); label.bot labe l.bot(bte (btex x (1,0) etex etex, , (1,0 (1,0) ) tran transfor sformed med t); draw_point(P4 draw_poin t(P4 transfor transformed med t, red) red); ; label.urt labe l.urt(bte (btex x $P_4$ etex, P4 trans transform formed ed t); pickup pick up pencircl pencircle e scale scaled d 1; drawarrow z98--z99; pickup pick up pencircl pencircle e scale scaled d .5; draw_point(z98, draw_point(z9 8, black);

endf endfig ig; ;

% ==== ====== ==== ==== ==== ==== ==== ==== ==== ==== == end end of figu figure re 2 ==== ====== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== === =

end

References [1] M. Goossens, F. Mittelb Mittelbach ach,, A. Sama Samarin rin  The LAT E X Companion [2] M. Goossens, S. Rahtz, F. Mittelb Mittelbach ach The LAT E X Graphics Companion http://cm.bell-labs.com/wh l-labs.com/who/hobby/ o/hobby/ [3] John D. Hobby Hobby,,  User’s Manual ,   http://cm.bel

[4] Alan Hoen Hoenig, ig,   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] Lesli Lesliee Lampert. Lampert. LAT E X – A Document Preparation System . ADDISON-WESLEY, 1994 (13th Printing November 2001), ISBN 0201529831 [7] Helmut Kopka. Kopka.  LAT E X – Eine Einf¨ u uhrung  hrung . ADDISON-WESLEY, 1992, ISBN 3-89319-434-7 [8] Helmut Kopka. Kopka.  LAT E X – Erweiterungsm¨ oglichkeiten oglichkeiten. ADDISON-WESLEY, 1992, ISBN 3-89319-356-1 [9] Keit Keith h Reckdahl, Reckdahl,  Using Imported Graphics in LaTeX2e , ftp://ftp.dante.de/tex-archive/info/eps ftp://ftp.dante.de/tex-arc hive/info/epslatex.ps latex.ps, ftp://ftp.dante.de/tex-arc ftp://ftp.dan te.de/tex-archive/info/eps hive/info/epslatex.pdf latex.pdf

/home/osurs/latex/WBZ/pict atex/WBZ/picture2/picture2 ure2/picture2.tex .tex /home/osurs/l

43

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close