Need help creating a table of contents

I’m trying to create a table of contents with the outline() function, but each time I try doing this it says that “Entry does not have field ‘body’”. Does anyone know how to fix this?

Hi @Martin1, welcome to the typst forum! It would be helpful if you included a short example of how you used the outline function. Also, the documentation for that function explains the following:

At the most basic level, you can style the outline by setting properties on it and its entries. This way, you can customize the outline’s title, how outline entries are indented, and how the space between an entry’s text and its page number should be filled.
Richer customization is possible through configuration of the outline’s entries. The outline generates one entry for each outlined element.

This, along with other info on that page, indicates that outline creates entries, which is referred to in the error you quoted. Since entries are made from headers, I’m guessing that there is something wrong with one of your headers. Would love to see a short example that could reproduce the error you’re seeing!

Hey Miles, thank you so much for the quick response. I’ve attached a picture of how I employ it. I’ve tried adding an indentation and title, however the error still appears.

Could you attach a minimal reproducible example? The error does not seem to happen because of the outline itself, but rather because of an outline entry (e.g. something like a heading, which we can’t see from the screenshot) not having the body field

I fixed it! But thank you so much for your time.