# 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.

## Sizing expression examples

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

Input Result
+=20Increase value by 20.
-=20Decrease value by 20.
*2Double size.
/2Divide by a 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.
Sq(w)Scales based on the square of other input value. Example entered into Height box to set height as the square of the width.
Sqrt(w)Scales based on the square root of other input value. Example entered into Height box to set height as the square root of 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, Pi, PI, πFor Pi
phi, Phi, PHI, gr, 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
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-Page variables

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

## Advanced mathematical expressions

For general use throughout the user interface.

Input Variable
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
Min(a, b, ...)Smaller of values
Max(a, b, ...)Larger of values
Mid(a, b)Average of a and b
Average(a, b, ...)Average of arguments
Lerp(a, b, f)Linear interpolation (a + (b - a) f)
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
Round(n)Round to integer
Roundup(b), ceil(n)Round up to integer
Rounddown(b), floor(n)Round down to integer
Truncate(n)Truncate n places after decimal point.
Noise(seed / x, y)Generate 1D noise either from a seed or based on X/Y input.
Noise2(seed / x, y)Generate 2D noise either from a seed or based on X/Y input.
Noise3(seed / x, y)Generate 3D noise either from a seed or based on X/Y input.
Noise4(seed / x, y)Generate 4D noise either from a seed or based on X/Y input.