Loading editor...

My Nova article - by Vinay

Press Preview, then click and drag your way through this page.


1. Clicking through a drawing

Code in a pygeomatic block runs without the reader seeing it. Name a few lines with with group(...) and they become a link your reader can click.

Reach the point by of units, then .


2. Controls your reader can move

A slider is just a number. Put it in a sentence with an f-string, and use gm.md to write that sentence.

Click to draw the circle:

Drag to resize the circle:

Anything built from r follows on its own:

whose side is . Changing also changes the side of this square.


3. More controls

3.1 Number

  • Draw the . Update n above and the point updates reactively.

3.2 Dropdown

  • Show .

3.3 Radio buttons

  • Show .

3.4 Text

  • Draw a with a fixed width. Updating the text updates the annotation reactively.

4. Text that appears on demand

with when(...) hides text until a condition is true. The condition is checked as your reader moves things, so there is nothing to click.

Small: the radius is under 4.


5. LaTeX formulas

Give a formula an id with a %id: line, then attach a number to a slot inside it. The formula updates whenever that number does.

5.1 Binding values to parameters

Drag the upper limit:

Watch the in the formula follow the slider. Or set it from here: ·

5.2 Highlighting rows of a matrix

You can also paint parts of a matrix, and move the painted part with a number:

Row to highlight:

5.3 Highlighting upper triangular entries

You can also highlight upper triangular entries of a matrix as shown below:

5.4 Sophisticated highlighting patterns

Conditions can do more than pick a row. M.rows() and M.cols() are the row and column number of each cell, so you can do arithmetic on them and join the results with & and |. Each cell is painted only where the condition holds.

The slider below sets how far from the diagonal a cell may sit. The two conditions are cols - rows <= band and rows - cols <= band, which together mean "no further than band steps either side of the diagonal":

Widen the band:

At 0 only the diagonal is painted; at 4 the whole matrix is.