I’m typesetting an index for a book where the index subjects (the names/words/items themselves) should be left-aligned, but the page numbers referenced should be right-aligned – similar to what you’d commonly find in a table of contents.
- This is no problem if it’s just one line.
- It’s also no problem if the page numbers break on to the next line, as long as the subject is only one line: just right-align the whole paragraph, and the text before the tab automatically gets left-aligned.
- It’s also no problem if the subject breaks on to the next line, as long as the page numbers fit on one line: just left-align the text and insert a Right Indent Tab.
The problem arises when the subject and the page numbers are both too long to fit on one line. In such cases, the first two (or however many) lines, contain the subject, should be left-aligned; and the last two (or however many) lines, containing the page numbers, should be right-aligned. The ‘middle’ line (where subject and page numbers coexist) should have the tab to make it appear both left- and right-aligned. An illustration:
I can do it manually, by adding a Right Indent Tab before each line of page numbers, but that’s fairly cumbersome for a long index. And I can’t think of a way to achieve this without having to manually add stuff.
Is there some way to achieve this automatically?
(I don’t have Quark, as mentioned in Scott’s comment, but I do have Affinity Publisher and Designer, just on the off chance it’s easier to accomplish there.)
This isn’t easily achieved as far as I know. I have two possible solutions. One is easy, but doesn’t do exactly what you want. The other does exactly what you want, but is only semi-automatic.
Solution A: Use “Right Justify” Alignment
This one is straight-forward. Set the text’s Alignment to Right Justify and insert some white space character, for example an Em Space followed by a Right Indent Tab between the subject and the page numbers.
The white space character just makes sure that there will always be some space between the subject and the page numbers.
Obviously the downside is that you will have to live with justified text in all other lines than the line with the Right Indent Tab and the last line.
Solution B: Use Anchored Object with Text Wrap
This is a bit more tricky. You need separate Paragraph Styles for the subject and the page numbers. Additionally you need to make a spacer object with its own Object Style.
Subject Paragraph Style (in red)
- Alignment: Left
Page Number Paragraph Style (in Blue)
Leading: The general leading (here 15 pt)
Baseline Shift: The general leading (here 15 pt)
(Additional space between entries can be added using Space After, but the space can’t be less than the leading with this method. At least I can’t find a way right now.)
Set the subject and page numbers in separate paragraphs. The baseline shift makes the page numbers jump up in level with the subject, but the paragraphs overlap:
Draw a small rectangle. Assign an Object Style to it and paste in a copy at the end of each subject paragraph.
Spacer Object Style (in Green)
Size and Position Options > Size > Adjust: Height & Width
Size and Position Options > Size > Width: The minimum space you want between the subject and the page numbers (here 3 mm)
Size and Position Options > Size > Height: Something lower than the leading of the subject paragraph (here 3 mm)
Anchored Object Options > Position: Inline
Text Wrap & Other > Text Wrap > Type: Wrap around bounding box
Text Wrap & Other > Offset > Bottom: Whatever small amount that works (here 1 mm)
Text Wrap & Other > Wrap Options > Wrap To: Right Side
The rectangle should make sure that the subject and page numbers no longer overlap:
Without colors the result looks like this:
To apply this method
Make sure Next Style in both paragraph styles is set to the other one.
Use Find/Change to replace each Tab character with an End of Paragraph character.
Select all text and Apply “Subject Paragraph Style” then Next Style.
Copy the spacer object.
Use Find/Change to replace each End of Paragraph character in the Subject Paragraph Style with Clipboard Contents followed by an End of Paragraph character.
This could of course be scripted.
How to get less space after entries than the leading
As mentioned, the proposed method simple raises the page numbers one line, so there will be a gap below. This is fine if you want a whole line between each entry, but annoying if you want less. Here is a way to get better control of the space between entries.
Create a Character Style for the first line of the Subject Paragraph Style which simply sets the Leading to 0.
In the Subject Paragraph Style add a Nested Line Style which applies that new character style for 1 lines.
This way the space between entries disappear and can now be controlled as usually using Space Before on the Subject Paragraph Style (not Space After!).
Here the space between entries is set to 1 mm. The line affected by the new character style is colored orange:
The downside is that the whole text jumps up one line, but this can easily be countered by adding the leading to the First Baseline in the Text Frame Options of the text frame.
Source : Link , Question Author : Janus Bahs Jacquet , Answer Author : Wolff