What is the `it` in show rules exactly?

A useful way to explore what things are is to use the repr() function. For instance:

#show math.equation.where(block: false): it => repr(it)

$1+2=3$

Results in:

equation(
  block: false,
  numbering: none,
  number-align: end + horizon,
  supplement: [Equation],
  body: sequence([1], [+], [2], [=], [3]),
)

So in this case you can see that it is an equation, and you could access some of its properties within your function, or use those properties as part of a filter (the .where in the first part of the show rule).

I’d like to note also that the name it is not required, it’s just a common choice (though I’m not sure why). The following all produce identical results:

#show math.equation.where(block: false): a-name-other-than-it => repr(a-name-other-than-it)
#show math.equation.where(block: false): it => repr(it)
#show math.equation.where(block: false): repr

In the third case no name is given, but that’s ok because when the show rule is applied to the equation, it is looking for a function to pass what it finds to. In this case the show rule finds/matches an equation, then that equation is passed directly to repr which accepts a single piece of content as a valid way to call the function.

Edit:
The tooltips that the web app (and Tinymist) provide are also very helpful. Hovering my mouse over the it shows the same info that repr does:

3 Likes