Skip to content
Math Notes Documentation
Open Math Notes

Groups & totals

Math Notes aggregates in three related ways: the running total in the bottom bar, the aggregate keywords (sum, average, …) you write on a line, and named groups that show a subtotal in place.

The total bar#

The total bar under the editor aggregates every numeric result in the sheet. Its dropdown switches between total (sum), average and median.

Plain numbers fold into a single unit; a bare number is read in the first unit used for its dimension, so adding a larger unit later (1 day after some hours) adds to the total instead of reinterpreting the earlier numbers. Compatible units (such as cm and m) merge into the largest present for display; mixed dimensions fall back to the plain numeric sum, while mixing two currencies is an error — convert to one first.

Aggregate keywords#

sum, total, average and avg aggregate the lines above, up to a blank line. A blank line starts a new block, so you can keep several independent aggregates in one sheet.

10
20
sum
last line returns 30
4
8
average
last line returns 6
10
20
sum

1
2
sum
last line returns 3

The keywords can also take a tag: sum #food, or the shorthand #food on its own line (see Tags).

Groups#

Open a named group with a label on its own line (like Groceries:) and close it with end. The header shows the group's subtotal and the whole block is shaded. The inner lines still count in the bottom total.

Groceries:
  4.50
  3.20
  2.40
end
header shows 10.1

Groups work with units too, following the total's unit rule:

Trip:
  10 cm
  1 m
end
header shows 1.1 m

Blank lines inside a group are ignored, and sum/average inside a group total that group rather than the whole sheet.

Interaction with prev and tags#

A closed group leaves prev at the subtotal shown on its header, then continues from the end line. Tags still work across groups: a tagged row contributes its share to the tag no matter which group it sits in.

Mistakes#

  • A header with no end is just a label, and the lines after it are ordinary lines.
  • An end with no open header is reported as an error.
  • Groups do not nest: a second header inside an open group starts a new label.