How do I change the space between items?

Hi,

I am working on slides using Touying and overall it works great! However, I am not able to control the spacing between sub-items in a list. As seen in the image below, the spacing between “Linked Lists” and and “Classes” is tighter than between “Classes” and “Methods”, and I would like it to be like in the first space (which is 1.2em).

I have set the list spacing in the document as follows:

#set list(
  spacing: 1.2em,
)

And then only used normal lists in the code. The code below is for the list in the image:

- Linked lists
  - Classes
  - Methods
  - Different variants
- Testing
  - Unit test
  - Setting up
  - Examples

I have looked at similar topics here at the forum, like this and this as well as this where the last one seems to be the same thing that I wonder, but is not answered (yet).

I have looked at the documentation for spacing for lists (and enum), but I have not seen or read anything that helps me understand how to change the sub-item spacing.

Anyone with an idea of what I should do or look at?

I am wondering if this is unintended behavior. Even a show rule on list.item has the same behavior:

#show list.item: it => {
  it
  v(0.2em)
}

- Linked lists
  - Classes
  - Methods
  - Different variants
- Testing
  - Unit test
  - Setting up
  - Examples

However, if you use the same show rule to set the color of the text, all items are affected. I think it might have to do with the structure of nested lists:

#repr[
- item1
    - subitem 1
    - subitem 2
]

// the above returns:

// sequence(
//   [ ],
//   item(
//     body: sequence(
//       [item1],
//       [ ],
//       item(body: [subitem 1]),
//       [ ],
//       item(body: [subitem 2]),
//     ),
//   ),
//   [ ],
// )

// maybe spacing is only applied after `item` object?

also:

// surprising behavior here:
#show list.item: it => {
  show [ ].func(): [SPACE IN LIST HERE]
  it
}

Might be worth submitting a bug report if you haven’t already. If you don’t, I’ll be happy to do it.

A hacky solution in the meantime would be something like this:

#set list(
  spacing: 2em
)

- Linked lists #v(0.6em)
  - Classes
  - Methods
  - Different variants
- Testing #v(0.6em)
  - Unit test
  - Setting up
  - Examples

Thanks a lot, Miles-1!

Good troubleshooting and I agree that it looks a little like unintended behaviour. I will file a bug report and be sure to include your name in it as well.

Also thanks for the hacky solution, I will see if I will use it or if a fix will be coming :-)

//Tobias

1 Like