Controls from the expression
notatio draws a control for a variable without being told how. The free symbols of an expression each get a control, chosen from what is known about the symbol, and the same choice serves a Manipulate, a prose panel and a worksheet.
What decides a control
For each symbol, in order of precedence:
- The author's hint: a control tuple in
params({n, 1, 20},{b, Boolean}). - The engine's declared type or assumption:
integersteps by one,booleanis a checkbox,complexa 2D pad, and a bounded type such asinteger<1..>(what an assumptionn > 0leaves) gives the bounds. - A letter convention, where a host turns it on (worksheets do):
n,mandkare integers,zis complex. - A real slider from −10 to 10, widened only as far as a starting value needs.
A control-type hint (slider, stepper, knob) applies only when it suits the symbol's domain.
| Domain | Control |
|---|---|
| real, integer | slider |
| boolean | checkbox |
| string | input field |
| complex | 2D pad |
| finite list of values | setter bar (up to five), else popup menu |
bare symbols (Natural, Adic) | the same choices, binding the symbol itself |
| lattice point (Gaussian or Eisenstein integers) | integer 2D pad, binding Tuple(a, b) |
Manipulate without tuples
Manipulate(body) with no control tuples gives every free symbol of the body a control. A bare symbol after the body names just that one.
Only b is a control
source · editable
In params, {b, Boolean}, {s, String} and {z, Complex} are the non-numeric tuples. The lowering itself has no engine, so it writes real sliders. <notatio-manipulate> then refines the symbols named in its infer attribute against the engine's declarations: a symbol declared integer gets a whole-number slider, one declared boolean a checkbox.
Scope
Inference reads the declarations of the enclosing notebook or dynamic module. A declaration made in one notebook types the controls there and nowhere else.
Prose panels
A prose panel with Variables -> Automatic gives each hole in the sentence the control its type calls for: a whole-number knob for an integer, a toggler for a boolean, a 2D pad for a complex variable, an integer pad for a lattice point. A hole over bare-name choices binds the symbol, and a knob option on it scrubs through the names.
Worksheets
A worksheet takes integer-ness and bounds from a declared type or, with letter conventions (on in worksheets, off elsewhere), from the symbol's letter. A value-based range is unchanged, and n := 3 gets a whole-number slider.
From a signature
A head's typed signature and an example of it make controls too: this is the Try it panel on every symbol page. The record fields it reads are in Reference records.