GNU TeXmacsUser manualReferenceAboutEnglish
Graphics

The environment variables described in this section control the graphical primitives of TeXmacs. They fall into three groups: variables which determine the global layout of a graphics object (its size, coordinate frame and grids), variables which determine the style of the individual graphical objects (points, curves, text, etc.), and variables with a gr- prefix which are used by the graphics editor for newly created objects. The built-in default values are defined in

src/Typeset/Env/env_default.cpp

.

1.Global layout of graphics

gr-geometry\(:=\)
(size of the graphics)

The geometry of a graphics object, as a tuple <tuple|geometry|width|height> or <tuple|geometry|width|height|valign>. The width and height are lengths. The optional vertical alignment is one of center (default), top, bottom or axis and determines how the graphics is placed with respect to the surrounding baseline.

gr-frame\(:=\)
(coordinate frame)

The coordinate frame used for the points of the graphics, as a tuple <tuple|scale|unit|<tuple|x|y>>. The unit is the length of one unit of the user coordinates and x, y are the lengths which give the position of the origin. The length units gw and gh refer to the width and height of the graphics, as specified by gr-geometry, and gu to the length of one user unit. By default, the origin is at the center of the graphics and one unit corresponds to 1cm.

gr-grid\(:=\)
(visual grid)
gr-grid-aspect\(:=\)
(visual grid aspect)

The grid which is drawn in the background of the graphics. The empty string or <tuple|empty> means that no grid is drawn. Otherwise, the grid is one of

The gr-grid-aspect is a tuple of pairs <tuple|subdivision|color>, which specify the colors of the axes (subdivision axes) and of the grid lines for each number of subdivisions of the unit step.

gr-edit-grid\(:=\)
(editing grid)
gr-edit-grid-aspect\(:=\)
(editing grid aspect)

A second grid, with the same syntax as gr-grid and gr-grid-aspect, which is used by the graphics editor for snapping points when editing. It is not shown in the typeset document.

gr-auto-crop\(:=\)false
(automatic cropping)
gr-crop-padding\(:=\)1spc
(padding for automatic cropping)

When gr-auto-crop is true, the size of the graphics is not determined by gr-geometry, but by the bounding box of its graphical objects, enlarged by gr-crop-padding on each side.

gr-transformation
(3D transformation)

A \(4 \times 4\) matrix, given as a tuple of four row tuples, which is applied to three-dimensional objects (transform-3d, object-3d, triangle-3d and light-3d) before they are projected onto the plane of the graphics. The default is the identity matrix.

gr-mode\(:=\)line
(current editing mode)
gr-snap-distance\(:=\)10px
(snapping distance)

These variables are only used by the graphics editor. The gr-mode contains the current editing mode, usually as a tuple such as <tuple|edit|line>, <tuple|edit|text-at>, <tuple|group-edit|move> or <tuple|hand-edit|calligraphy> (a plain string m is interpreted as <tuple|edit|m>). The gr-snap-distance is the maximal distance at which the cursor snaps to grid points and to other objects.

2.Style of graphical objects

The following variables are usually set using a with tag around an individual graphical object. The graphics editor stores the properties of each object in this way.

gid\(:=\)default
(graphical identifier)
anim-id\(:=\)
(animation identifier)

The gid attaches an identifier to a graphical object. It is used for maintaining constraints between graphical objects: a point which carries an identifier may be referred to from elsewhere in the graphics. The anim-id identifies corresponding objects in the successive frames of an animation, so that they can be morphed into each other.

proviso\(:=\)true
(visibility condition)

When a graphical object is enclosed in a with tag which sets proviso to (an expression evaluating to) false, the object is not displayed.

magnify\(:=\)1
(magnification of graphical objects)

An additional magnification factor for graphical objects. When typesetting the objects of a graphics, the current magnification is multiplied by this factor, which affects for instance the size of text inside text-at objects.

opacity\(:=\)100%
(opacity)

The opacity of both the lines and the filling of graphical objects. The value is either a percentage like 50%, or a number between 0 and 1.

color\(:=\)black
(line color)
fill-color\(:=\)none
(fill color)

The color color is used for drawing points and curves; the value none means that no line is drawn. The fill-color is used for filling closed curves and the interior of points; the default value none means that no filling takes place. Both colors may also be patterns.

point-style\(:=\)disk
(point style)
point-size\(:=\)2.5ln
(point size)
point-border\(:=\)1ln
(border width of points)

The shape of points. Supported styles are disk, round (a circle, filled with the fill-color), square, diamond, triangle, star, plus, cross and none. The point-size and point-border determine the radius of the point and the width of its border.

line-width\(:=\)1ln
(line width)

The width of lines and curves.

line-portion\(:=\)1
(portion of the curve)

A number between 0 and 1, which specifies which initial portion of a curve is actually drawn. This is mainly useful in animations.

dash-style\(:=\)none
(dash style)
dash-style-unit\(:=\)5ln
(unit of dash motif)

The dash-style is either none (a plain line), a string of 0 and 1 characters like 11100, which specifies a periodic pattern of dashes, or one of the decorative motifs zigzag, wave, pulse, loops and meander. The dash-style-unit is the length of one character of the pattern or of one period of the motif. For motifs, it may also be a tuple <tuple|horizontal-unit|vertical-unit>, so as to control the amplitude separately.

arrow-begin\(:=\)none
(arrow at the beginning)
arrow-end\(:=\)none
(arrow at the end)
arrow-length\(:=\)5ln
(arrow length)
arrow-height\(:=\)5ln
(arrow height)

Arrow heads at the beginning and the end of curves. Built-in arrow heads are <, >, <|, |>, <<, >>, | and o; none or the empty string mean that no arrow is drawn. An arbitrary graphical object may also be given instead of a string. The arrow-length and arrow-height determine the size of the built-in arrow heads, along and across the curve.

line-join\(:=\)normal
(line junctions)
line-caps\(:=\)normal
(line caps)
line-effects\(:=\)none
(line effects)
fill-style\(:=\)plain
(fill style)

These variables are recognized as graphical attributes by the editor, but they are not interpreted by the current typesetter.

text-at-halign\(:=\)left
(horizontal alignment of text)
text-at-valign\(:=\)base
(vertical alignment of text)

The alignment of text-at and math-at objects with respect to their anchor point. The horizontal alignment is left, center or right. The vertical alignment is base (the baseline passes through the point), bottom, axis, center or top.

text-at-repulse\(:=\)off
(repulsive margin)
text-at-snapping\(:=\)1spc
(snapping margin)

When text-at-repulse is a length instead of off, the bounding box of a text object, enlarged by this length, becomes a “white zone” in which curves drawn afterwards are interrupted, so that labels remain readable. The text-at-snapping is the margin around text objects which is used for snapping and smart guides when editing.

doc-at-valign\(:=\)top
(vertical alignment of long text)
doc-at-width\(:=\)1par
(width of long text)
doc-at-hmode\(:=\)min
(width mode of long text)
doc-at-ppsep\(:=\)0fn
(paragraph separation in long text)
doc-at-border\(:=\)0ln
(border of long text)
doc-at-padding\(:=\)0spc
(padding of long text)

Layout of document-at objects, which contain multi-paragraph text. The doc-at-valign has the same possible values as text-at-valign, but defaults to top. The body is typeset inside a one-cell table (see the paragraph-box macro in

std-graphics.ts

), whose width and width mode (table-width and table-hmode) are given by doc-at-width and doc-at-hmode, whose borders and paddings are given by doc-at-border and doc-at-padding, and whose background is the fill-color. A non-empty doc-at-ppsep overrides par-par-sep inside the body.

pen-enhance\(:=\)gaussian
(smoothing of hand drawings)
pen-style\(:=\)default
(pen for calligraphy)

These variables control hand-drawn curves (penscript and calligraphy). The pen-enhance is the smoothing method: gaussian (or default), bezier, or any other value (like none) for no smoothing. It may also be a tuple <tuple|method|strength>, where the strength is a number between 0.2 and 5. For calligraphy, the pen-style may be a tuple <tuple|oval|ratio|angle>, which specifies an oval pen with the given aspect ratio and angle (in degrees); the width of the pen is the line-width.

3.Properties for new objects

gr-color\(:=\)default

gr-line-width\(:=\)default

…
(properties of new objects)

For each of the style variables gid, anim-id, proviso, magnify, opacity, color, fill-color, point-style, …, pen-style of the previous section, there is a corresponding variable with a gr- prefix (gr-color, gr-fill-color, gr-point-style, etc.). These variables are set on the graphics tag by the graphics editor and hold the properties which will be given to newly created objects. The value default means that no explicit value is attached to new objects, so that the value of the ordinary variable applies.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".