How to apply units to variables or expressions?

Something simple, but how does one apply units to a variable? As an example, I can give the angle:

let angle = 0.5rad

However, what if one needs to calculate the angle one is working with, as in the below examples:

let test = (5 - 2)rad

and

let test = (calc.pi)rad

These returns the error " Error: Expected semicolon or line break." Of course, this can apply to other units, like length of a page.

Sorry if this is somewhere obvious in the documentation.

You can do whatever arithmetic you need with integers or floats and then multiply 1rad. E.g.,

#let test = (5 - 2) * 1rad
3 Likes