Your question is not well formatted by I suppose that you’d like to get something like that:
Entries in the index are “formatted” by paragraph styles Index n where n is the level (1 for primary entries, 2 for secondarry, …).
If I correctly interpret your question, you’d like that the key would align on the left margin and the page number(s) on the right margin, with overflow lines in case of really “popular” keys also aligned right.
Consider that an index paragraph contains two “objects”: the short title (key) and a long paragraph content (page numbers). It is easy to request right alignment for the numbers so that they always tend to “flee” from the title. However, setting this alignment also makes the title right align on the next tab stop, which is not a desired effect. As it is not possible to have two different alignments in a single paragraph, we need to break the paragraph alignment rule at a specific location. This can’t efficiently be done with a single tab as in the default entry formatting. We’ll then use two.
First step: index entry layout
- Right-click on the index and
Edit Index
.
- Select the relevant entry level (2 in my case)
- Add another tab
T
after (or before) the existing tab with .
as fill character
Your settings should look like:
Second step: update paragraph style(s)
The changes is the index entry definition must taken into account in the associated paragraph style. Right-click on Index 2 (in my case; you may have another level number or several) in the style side pane (F11
) and Modify
.
-
in Indents & spacing
tab, create a negative indent so that 1) the key “outstands” away from the page numbers, 2) the page numbers are offset to the right on lines 2 and following
-
Set Before text to 3cm
-
Set First line to -3cm
Important remark: This combination of First line (negative value) and Before text automatically creates an implicit tabulation stop at Before text. This the heart of the trick.
In my case, I set Before text to 3.5 cm because it is a level 2 and I want these entries a bit offset to the right so that we see immediately the difference between levels 1 and 2.
-
In Alignment
tab, check Right
-
In Tabs
tab, create a tab stop at the paragraph right margin (8cm in my case) with Type Right and Fill character as a dotted line (strictly speaking, this is not necessary because it is already done in the index entry descriptor, but make sure). Push New
.
Don’t forget to push the OK
button to save your changes.
Right-click in the index and Update index
. Your index look now like what’s displayed in the red oval.
The blue oval demonstrates a limitation of my settings. There, the key is very long and is not entirely contained in the “outdent” between First line and Before text. The first tab creates the leading line to the margin and the second one forces the page numbers to a second line. This can be corrected by tuning Before text (and adjusting back First line).
However, don’t try to suppress all these “anomalies” because you risk to end up with too narrow a page number paragraph. Adjust the distance so that you have not too many anomalies and you’ll be fine.
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!