In a table of contents, how to set the page number off to the right of justified entry text?


I have a table of contents in two columns. Some entries are long enough for 2 or more lines. What I want is each entry justified so that the text does not approach the page numbers which are aligned on the right.

I have played around in Edit Index a lot, and I think it isn’t possible. Is there a way to justify ToC entries into a block between two indents, beside the numbers which are off to the right?


This is effectively not possible because it requires a tab stop outside the paragraph indents. When the Tab for the page number is met, Writer notes that there are no more tabs between the indents and forces a line break to reach the next available tab.

However if you accept to format your TOC in an uncommon way, it is possible to achieve an equivalent to you goal:

left page number in TOC

I have sent the page number at left instead of the usual right. This presentation requires tweaking both the Contents n paragraph styles and the Entries Structure in the TOC configuration dialogue.

  • Contents n paragraph styles

    Create an indent Before text wide enough for the largest page number and chapter number. Set First line indent to the negative of this width.

  • TOC entries structure

    • Change the structure to LS # T E# T E LE (instead of the preset LS E# E T # LE)
    • Uncheck the Tab position relative to Paragraph Style indent
    • Position the first T where the chapter number should appear and assign a fill character to it
    • Position the second T at the Before text indent of the paragraph style for this level; clear the fill character

If it is not clear that the first number is the page number, you can assign it a distinctive character style or a prefix before it. I did both in the following variant:

page number variant in TOC

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!