How to arrange a numbered item list into two columns?

The #i.body\ adds the hackyness level (since it doesn’t visually separate multiple markup lines), so you should probably make it more descriptive:

#show grid: it => {
  show enum.item: item => context {
    [#cnt.display(enum.numbering) #item.body]
    linebreak()
    cnt.step()
  }
  it
  cnt.update(1) // reset
}

Here, a reader clearly sees that a linebreak() is used, which is a regular form of \ sugar syntax. Also, the i makes it look like an index, so naming it item further improves the readability. And the last point, is that in markup mode each code expression needs to be prefixed with #, which adds unnecessary visual noise, if it can be avoided. You can use the code mode first, and write a single markup line inside. This is usually results in a cleaner solution.

Note that since .step() is called inside context, the .display() call won’t be affected by it, so you can put them in any order.

I would personally also avoid the cnt name as well as move the number value to a variable:

#show grid: it => {
  let counter = counter("resume-enum-numbering")
  counter.update(1)
  show enum.item: item => context {
    let num = counter.display(enum.numbering)
    counter.step()
    [#num #item.body]
    linebreak()
  }
  it
  counter.update(1) // reset
}

Since the counter is used in just one place, you can move everything into a single place to keep it all together.

1 Like