Text & typography
Build a table of contents
Generate a table of contents from paragraph styles, choose levels and leaders, and update it after editing.
A table of contents collects headings from your document and puts their page numbers in one text frame. It works from paragraph styles, so style the headings in the document before you generate the list. See paragraph and character styles if you have not created them yet.
Generate the list
Choose Insert → Table of contents. For each level, click the paragraph styles that should appear there under Include paragraphs styled with. Put chapter headings at the first level and smaller headings at later levels, and use Add level for more. Choose an Entry style for each level if you want a specific look, and leave Page # ticked to show page numbers. Then pick a Leader (Dots, Dots spaced, Line or None) for the gap between titles and page numbers. Tick Include title if the list should start with a heading such as Contents.
Click Generate to build the list. The dialog stays open, reports how many entries it found, and warns about any headings that sit outside a page and so have no page number. Check long headings and page breaks in the finished document. A heading appears once even if a source style is used in the document; do not assign the same source style to two TOC levels.
If the dialog says No paragraph styles yet, close it, style your headings first, and come back.
After moving pages or changing headings, update the list: right-click the TOC and choose Update table of contents, or reopen Insert → Table of contents, which opens on that list's saved settings with an Update button in place of Generate. Nothing refreshes by itself. Editing the generated lines by hand is temporary because an update builds them again from the source headings. For page numbers elsewhere, see page numbers and variables.