5

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:

Example of correct and incorrect entries

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.)

1
  • @Scott Sadly I don’t have Quark. I do have Affinity Publisher (and Designer), though I’ve never really actually used it and am not very familiar with it. Jan 19, 2021 at 21:40

3 Answers 3

5

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)

  • Alignment: Right

  • 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.

14
  • I suspect the justification in the first option might become a problem in some places, but the second, very ingenious, option looks promising! I should be able to do it without scripting, too: make sure Next Style in both paragraph styles links to the other one; replace tab with paragraph mark; select all and apply Subject style + apply next; copy the spacer object; find/change final paragraph mark in Subject style with clipboard contents + paragraph mark. Not as reusable as a script, but probably quicker. Jan 19, 2021 at 23:52
  • The second one also has the advantage that I can use the object style to control the space between the subject and the first page number, but tweaking the auto-adjust size options. Jan 19, 2021 at 23:54
  • 1
    I'm glad you like the idea! And hey, I never realized you could find/change to Clipboard Contents!!! 🤯😱✨ Just found it because you mentioned it. This will change my life. Thanks!
    – Wolff
    Jan 19, 2021 at 23:58
  • And yes, I didn't mention it, but I made the size part of the Object style to make it dynamic. (I'm adding part of your comment to the answer.)
    – Wolff
    Jan 20, 2021 at 0:01
  • 1
    @JanusBahsJacquet, OK I got a solution for the spacing. I've added it to the answer. Does this work for you?
    – Wolff
    Jan 20, 2021 at 18:15
2

One of the features in QuarkXpress I used to love was the option to use a "right indent tab" via Option/Alt-tab.

I thought for many years that InDesign lacked this feature, but it does not. This question actually made me go dig to see if there was something similar. I should have known InDesign had the feature, I was just unfamiliar with where it was located. InDesign merely uses the a different shortcut - Shift+Tab - for this feature (Type > insert Special Character > Other > Right Indent Tab)

What this does is force everything after the tab to the right side of the text frame. For multiple lines, merely input a soft-return/forced-line-break first, then the right-indent-tab (Shift+Return then Shift+Tab)

So one inputs:

Topic title [right-indent-tab] Page, page, page, page, page, page [soft-return]
[right-indent-tab] page, page, page, etc.

Result:

enter image description here

The Right-Indent-Tabs are also searchable. With this it's possible to add them after the fact by merely replacing some special character. Or, remove them if necessary.

enter image description here


If you wish to avoid the manual input of the returns, merely configure a secondary Paragraph Style for page number continuations with Next options to alternate styles.

9
  • This might in the end be the simplest way to do it. But it requires brute force though. The problem is that you need to manually add the soft returns and right indent tabs.
    – Wolff
    Jan 20, 2021 at 17:34
  • @Wolff possibly. But it's easier than anchoring a text wrap character 😀 With search... one could use paragraph styles with next options to avoid the soft-returns.
    – Scott
    Jan 20, 2021 at 17:35
  • Easier to understand, but not necessarily faster if you have many entries. With this method you have to go through all the entries manually. With my proposed method you can automatically insert the spacer objects all in one go like I explain in the end of my answer.
    – Wolff
    Jan 20, 2021 at 17:37
  • @Wolff I edited that comment :) All one needs is really a separate paragraph style for page continuations, then there's no need for the soft-returns, similar to your answer.
    – Scott
    Jan 20, 2021 at 17:39
  • 1
    @JanusBahsJacquet The thing with text and automation for me.. is that I don't really trust it always. Procedural automation is a must have. But for things like line feeds and wraps.. well, I guess I've been bitten enough. I completely get tight deadlines and budgetary considerations though. -- pick two... fast, good, cheap. :)
    – Scott
    Jan 20, 2021 at 23:20
0

Below, I have two text frames. I made up some sample text and typed it normally with the Right Justify paragraph style (see the yellow, almost circle in the screenshot.

The only thing I did different, was to hit tab after the Title text. This uses normal leading, (even though I used an extra return between title text for visibility).

Please note that I didn't change any styles in my sample, you can if you want to.

Also, the two text frames are the same text with the difference being that I resized the width of the second one.

enter image description here

3
  • As I said in the question, this works fine as long as either the subject text or the page numbers can be contained on just one line. Your version here is identical to the first version in the illustration in the question. This way fails if the subject text and the page numbers are both long enough to take up multiple lines, which they will do on many occasions in this index. Jan 20, 2021 at 15:25
  • So you want to have multiple lines of title text to be ragged right (left aligned), if there are no page numbers on the same line. If that is correct then I would follow @Wolff's answer.
    – nocturns2
    Jan 20, 2021 at 15:36
  • Yes; essentially, I always want the subject text to be ragged-right, and the page numbers to be ragged-left – including on the line where they meet (where both combined will of course equate to full-justify). Jan 20, 2021 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.