Expressions for field input

Instead of adding absolute values into input fields, you can add expressions. These allow you create new values based on percentages, mathematical symbols, and another field's value.

When adding an expression into a field, the following colors may appear, providing feedback on the validity of the expression:

Sizing expression examples

Use throughout the user interface but typically:

*Individual objects in multiple selections will be sized based on their own values, not those of other objects.

Input Result
+=20Increase value by 20.
-=20Decrease value by 20.
*2Double size.
/2Divide in half.
50%, *0.5Decrease by half.
120%, *1.220% bigger.

Relational expression examples

Use when resizing a document or transforming an object via the Transform panel.

Input Result
w+20Scales based on addition of other input value. Example entered into Height box to set height as width plus 20 pixels.
w-20Scales based on subtraction of other input value. Example entered into Height box to set height as width minus 20 pixels.
2*wScaling based on a multiple of other input value. Example is entered into Height box to set height to double the width.
w/2Scaling based on a division of other input value. Example entered into Height box to set height to half the width.
w^3Scales based on a power of other input value. Example entered into Height box to set height as the width to the power of three.
12pt / xSets the text's x-height to 12pt.

Mathematical constants

For general use throughout the user interface.

Input Constant
pi, πFor Pi
phi, gr, φFor golden ratio
root2, rad, rtFor Pythagoras’s constant
eEuler’s constant

Transform variables

Use when moving, scaling, rotating or shearing objects via the Transform panel.

Input Variable
xposition, xX position
yposition, yY position
width, wWidth
height, hHeight
rotation, rRotation
shear, sShear

Document variables

Use when setting dimensions using the New Document or Document Setup dialogs.

Input Variable
spreadwidth, wDocument width
spreadheight, hDocument height
marginleft, lLeft document margin
marginright, rRight document margin
margintop, tTop document margin
margin, bBottom document margin

Typographical variables

Use when setting the size of text.

Input Variable
xheight, xX-height
ascent, aAscent
capheight, cCap height

Transform panel variables

Use when sizing and positioning content using the Transform panel in relation to the document (i.e. page spread).

spreadwidth, sprw, swThe width of the current spread
spreadheight, sprh, shThe height of the current spread
spreadleft, sprl, slThe position of the left edge of the current spread
spreadright, sprr, srThe position of the right edge of the current spread
spreadtop, sprt, stThe position of the top edge of the current spread
spreadbottom, sprb, sbThe position of the bottom edge of the current spread
marginsizeleft, mgnszl, mslThe size of the left margin on the current spread
marginsizeright, mgnszr, msrThe size of the right margin on the current spread
marginsizetop, mgnszt, mstThe size of the top margin on the current spread
marginsizebottom, mgnszb, msbThe size of the bottom margin on the current spread
marginleft, mgnl, mlThe position of the left margin on the current spread
marginright, mgnr, mrThe position of the right margin on the current spread
margintop, mgnt, mtThe position of the top margin on the current spread
marginbottom, mgnb, mbThe position of the bottom margin on the current spread
designareawidth, areawidth, awThe space between the left and right margins on the current spread
designareaheight, areaheight, ahThe space between the top and bottom margins on the current spread

Advanced mathematical expressions

For general use throughout the user interface.

Function/Usage Notes
abs(x)Absolute value
idiv(x,y)Results in the integer (whole number) of x divided by y (no rounding is applied)
irem(x,y)Results in the remainder of x divided by y
sin(a)Sine
asin(a)Inverse Sine
cos(a)Cosine
acos(a)Inverse Cosine
tan(a)Tangent
atan(a)Inverse Tangent
atan2(a, b)Arctangent
average(a, b, ...)Average of arguments
clamp(a, lo, hi)a if it is between lo and hi, otherwise lo or hi
clampmin(n, min)clamp values below minimum
clampmax(n, max)clamp values above maximum
copysign(t, t sign)
dim(t x, t y)
fma(t a, t b, t c) Computes (a*b) + c
fmod(t, t)
fraction(t)
lerp(a, b, f)Linear interpolation (a + (b - a) f)
min(a, b, ...)Smaller of values
max(a, b, ...)Larger of values
mid(a, b)Average of a and b
noise(seed / x, y)Generate 1D noise either from a seed or based on X/Y input.
round(n)Round to integer
roundup(b), ceil(n)Round up to integer
rounddown(b), floor(n)Round down to integer
trunc(t) Shorthand for truncate
truncate(n)Truncate n places after decimal point.
whole(t)

SEE ALSO: