Next: Label Commands, Previous: Locus Assignments [Contents][Index]

## 4 Drawing

### 4.1 Drawing Commands

A drawing command is either a single or a multiple drawing statement. A single drawing statement consists in the `draw` keyword followed by a drawable object and a possibly empty comma separated list of aspect parameters.

Example: `draw point(2, 3) red`

A multiple drawing statement consists in the `draw` keyword followed by a list of global aspect parameters and a list of drawable objects (with possibly local aspect parameters) delimited by `end`.

Example:

    draw blue
      A.B
      C.D dashed, black
      E.F dotted
    end

Local parameters override global ones.

#### Aspect parameters

Color

  `black` (default), `darkgray`, `gray`, `lightgray`, `white`, `red`, `green`, `blue`, `cyan`, `magenta`, `yellow`.

Scale factor

  A number greater than 0 (default: 1).

Point shape

  `dot` (default), `disc`, `box`, `plus`, `cross`.

Line style

  `full` (default), `dashed`, `dotted`.

Partition

  `entire` (default), `half`.

Direction

  `forth` (default), `back`.

Endings

  `none` (default), `arrow`, `arrows`.

Conics draw step

  An angular parameter (default: 3°) setting the current drawing step (with respect of the parametric representation).

Font

  `font(s)` where s is a string containing the font description.

#### Font description

With `eukleides` the font description string has to follow the standard PostScript format, i.e. `"name-face-size"`.

Example: `"Helvetica-Bold-12"`

The default font is `"NewCenturySchlbk-Roman-10"`.

With `euktopst` the font description string should be a sequence of parameterless commands (without the leading backslash) appropriate to the TeX format in use, e.g. `"bf"` with plain TeX or `"sffamily\bfseries"` with LaTeX.

#### Single drawing statements

`draw A list`

  Draws point A, where list may contain color, scale and shape parameters.

`draw v O list`

  Draws vector v from point O, where list may contain color, scale and style parameters. The scale factor determines the line thickness.

`draw s list`

  Draws the open path corresponding to set s, where list may contain color, scale, style, direction and endings parameters.

`draw (s) list`

  Draws the polygon corresponding to set s, where list may contain color, scale, style, direction and endings parameters.

`draw [s] { color }`

  Fills the polygon corresponding to set s.

`draw [s] a list`

  Hatches the polygon corresponding to set s, where list may contain color and scale parameters. The angular parameter a determines the direction of the hatches. The scale factor determines the spacing of the hatches (default: 1.5 mm).

`draw l list`

  Draws line l where list may contain color, scale, style, partition and direction parameters. Using `half` yields the ray having same origin and direction than line l, using both `half` and `back` yields the ray with reverse direction.

`draw c list`

  Draws circle c where list may contain color, scale and style parameters.

`draw c a b list`

  Draws arc of circle c from polar angle a to polar angle b (with respect to the center of c) where list may contain color, scale, style, direction and endings parameters.

`draw [c] { color }`

  Fills circle c.

`draw [c] a list`

  Hatches circle c where list may contain color and scale parameters. The angular parameter a determines the direction of the hatches. The scale factor determines the spacing of the hatches (default: 1.5 mm).

`draw c list`

  Draws conic c where list may contain color, scale, style and step parameters.

`draw c a b list`

  Draws conic c from argument a to argument b (with respect to the parametric representation of c) where list may contain color, scale, style, direction, endings and step parameters.

`draw l A a list`

  Writes string l with respect to point A in direction a, where list may contain color, scale and font parameters. The scale factor determines the distance from the center of the string to the point.

`draw l s a list`

  Writes string l with respect to the middle of segment s in direction a, where list may contain color, scale and font parameters. The scale factor determines the distance from the center of the string to the middle of the segment (default: 3 mm).

#### Output setting commands

`scale z`

  Sets the value of the length unit. (Default: 1 cm.)

`box x, y, x', y' { , z }`
`frame x, y, x', y' { , z }`

  Sets the coordinates of the lower left and upper right corner of the drawing frame, with optional scale factor z. Default coordinates are (-2, -2) and (8, 6). With `eukleides` and `euktopst`, both commands yield the same result.

Next: Label Commands, Previous: Locus Assignments [Contents][Index]