31
Outline Lines Polygons Curves PSTricks Evelyn Crofts week11 Evelyn Crofts PSTricks

PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

PSTricks

Evelyn Crofts

week11

Evelyn Crofts PSTricks

Page 2: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

LinesFormulasExamples

PolygonsFormulasExamples

CurvesBezier CurvesParabolasTwo More Curves

Evelyn Crofts PSTricks

Page 3: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

What is PSTricks?

Evelyn Crofts PSTricks

Page 4: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

What is PSTricks?

◮ A Package for making images.

Evelyn Crofts PSTricks

Page 5: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

What is PSTricks?

◮ A Package for making images.◮ Most useful for polygons, lines, etc. But it can get pretty

fancy.

Evelyn Crofts PSTricks

Page 6: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

What is PSTricks?

◮ A Package for making images.◮ Most useful for polygons, lines, etc. But it can get pretty

fancy.◮ As the name tries to tell you most forcefully, this needs to

compile into PS! TeXnicCenter also has a LaTeX ⇒ PS ⇒PDF compiler.

Evelyn Crofts PSTricks

Page 7: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

Lines\ psline[par]arrows(x0,y0)(x1,y1)(xn,yn)This draws a line through the list of coordinates. Someparameters are

Evelyn Crofts PSTricks

Page 8: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

Lines\ psline[par]arrows(x0,y0)(x1,y1)(xn,yn)This draws a line through the list of coordinates. Someparameters are

1. linewidth=(num)(units) (Default .8pt)

Evelyn Crofts PSTricks

Page 9: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

Lines\ psline[par]arrows(x0,y0)(x1,y1)(xn,yn)This draws a line through the list of coordinates. Someparameters are

1. linewidth=(num)(units) (Default .8pt)

2. linearc=(num) (Default 0)

Evelyn Crofts PSTricks

Page 10: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

Lines\ psline[par]arrows(x0,y0)(x1,y1)(xn,yn)This draws a line through the list of coordinates. Someparameters are

1. linewidth=(num)(units) (Default .8pt)

2. linearc=(num) (Default 0)

3. linecolor=(num)(units)

Evelyn Crofts PSTricks

Page 11: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

Lines\ psline[par]arrows(x0,y0)(x1,y1)(xn,yn)This draws a line through the list of coordinates. Someparameters are

1. linewidth=(num)(units) (Default .8pt)

2. linearc=(num) (Default 0)

3. linecolor=(num)(units)

4. showpoints=true/false

Evelyn Crofts PSTricks

Page 12: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

The following is defined by this command\psline[linewidth=2pt,linearc=.25]{->}(4,0)(0,-1)(2,-2)

Evelyn Crofts PSTricks

Page 13: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

(0,0) is set to be Latex’s current position. So, if you forget todouble space after your text, you will get an image that mayoverlap. For example\psline[linewidth=2pt,linearc=.25]{->}(1,0)(3,2)(2,0)

Evelyn Crofts PSTricks

Page 14: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

Another thing to look out for is that these graphics do not havea defined space in which they live. This means that text after agraphic will also overlap it unless you include a command tomove the text lower or to one side. You may use (for example)\vspace{1in} to add the space that the picture takes up.

Evelyn Crofts PSTricks

Page 15: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

Some more examples:\psline[linewidth=2pt,linecolor=blue]{-}(0,0)(.5,-1)(1,0)(1.5,-1)(2,0)

Evelyn Crofts PSTricks

Page 16: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

Some more examples:\psline[linewidth=2pt,linecolor=blue]{-}(0,0)(.5,-1)(1,0)(1.5,-1)(2,0)\psline[linewidth=.8pt,linearc=.1,linecolor=magenta]{<->}(5,0)(4.5,-1)(5.5,-1)(5.1,0)

Evelyn Crofts PSTricks

Page 17: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

Some more examples:\psline[linewidth=2pt,linecolor=blue]{-}(0,0)(.5,-1)(1,0)(1.5,-1)(2,0)\psline[linewidth=.8pt,linearc=.1,linecolor=magenta]{<->}(5,0)(4.5,-1)(5.5,-1)(5.1,0)

\psline[showpoints=true, linecolor=green]

{-}(8,0)(9,0)(10,-.5)(11,0)

b b

b

b

Evelyn Crofts PSTricks

Page 18: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

Polygons

Evelyn Crofts PSTricks

Page 19: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

Polygons are similar to lines, but the path is automaticallyclosed. The general form is\pspolygon[par](x0,y0)(x1,y1)(x2,y2)(xn,yn)Note that the line function really doesn’t like to be given aclosed path, which is why we must use this new command.

Evelyn Crofts PSTricks

Page 20: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

To draw circles, we use the command\pscircle*[par](x0,y0){radius}.The pamameters are the ones we have seen before, (x0,y0) isthe center, and radius refers to ... never mind.

Evelyn Crofts PSTricks

Page 21: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

\pspolygon[linewidth=1.5pt](0,2)(1,2) (Note thatif you only use two (nontrivial) points, pspolygon will add theorigin).

Evelyn Crofts PSTricks

Page 22: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

\pspolygon*[linearc=.2,linecolor=green](3,0)(3,2)(6,0)(6,2)

Evelyn Crofts PSTricks

Page 23: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

\pspolygon*[linearc=.3,linecolor=red](.6,1)(1,2)(2,1.5)(3,2)(3.4,1)(2,0)

Evelyn Crofts PSTricks

Page 24: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

FormulasExamples

\pscircle*[par](x0,y0){radius}

With these objects, it is easy to control their exact placementvia the coordinates.

Evelyn Crofts PSTricks

Page 25: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

Bezier CurvesParabolasTwo More Curves

Curves

b

b

b

b

b b b b

Evelyn Crofts PSTricks

Page 26: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

Bezier CurvesParabolasTwo More Curves

Bezier Curves“\psbezier draws a bezier curve with the four control points.The curve starts at the first coordinate, tangent to the lineconnecting to the second coordinate. It ends at the lastcoordinate, tangent to the line connecting to the thirdcoordinate. The second and third coordinates, in addition todetermining the tangency of the curve at the endpoints, alsopull the curve towards themselves.” For example:

b

b

b

Evelyn Crofts PSTricks

Page 27: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

Bezier CurvesParabolasTwo More Curves

The general form is\psbezier[par]{arrows}(x0,y0)(x1,y1)(x2,y2)(x3,y3)the parameters and arrow commands are the same as thosewe used for lines.

Evelyn Crofts PSTricks

Page 28: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

Bezier CurvesParabolasTwo More Curves

Parabolas\parabola*[par]{arrows}(x0,y0)(x1,y1)The first coordinate is a point through which the parabolapasses, and the second is its max or min. For example,\parabola{<->}(4,3)(2,0) forms a unique parabola.

b

b

b

b

b b b b

Evelyn Crofts PSTricks

Page 29: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

Bezier CurvesParabolasTwo More Curves

Two More CurvesThe following two functions creates a curve that goes throughthe points you give it.\pscurve*[par]{arrows}(x1,y1)(xn,yn)\psecurve*[par]{arrows}(x1,y1)(xn,yn)]The second one differs in that it does not extend the curve tothe endpoints (it just uses them to estimate the shape of thecurve through the other points). The e in the function name isrelated to this effect.

Evelyn Crofts PSTricks

Page 30: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

Bezier CurvesParabolasTwo More Curves

\pscurve[showpoints=true]{<->}(0,1.3)(0.7,1.8)(3.3,0.5)(4,1.6)(0.4,0.4)\psecurve[showpoints=true]{<->}(5,0)(5,1.3)(5.7,1.8)(8.3,0.5)(9,1.6)(5.4,0.4)(5,1)

b

b

b

b

b

b

Evelyn Crofts PSTricks

Page 31: PSTricks - Open Computing Facilitylatex/f09/homeworks/week6/beamer_… · Polygons Curves Formulas Examples Polygons are similar to lines, but the path is automatically closed. The

OutlineLines

PolygonsCurves

Bezier CurvesParabolasTwo More Curves

Many thanks to the PSTricks User’s Guide by Timothy VanZandt.If you would like to know more about PSTricks

RTFM!

http://download.tuxfamily.org/viettug/pstricks_user_guide_en-1.pdf

Evelyn Crofts PSTricks