is now part of CreativePro.com!

Controlling Line Breaks with Nested Styles

12

A customer came to me recently with an interesting InDesign problem. I only had a few minutes to help them. I thought I’d share my “hack” solution to their problem here in hopes that someone else can make use of it or learn something from it. Or, perhaps, someone can suggest a simpler, more elegant solution?

The problem:

The client had hundreds of pages of text that contained entries like this:

Screen-Shot-2015-04-14-at-6.45.10-AM.png

If a bold heading was long enough to wrap to a second line, they always wanted the break to occur after the first comma, as indicated by the magenta lines in the screenshot above. They didn’t want to fix each of these manually. The solution I came up with uses the “No break” attribute.

The solution

1. Create a character style named “No break” that has the No Break attribute enabled:

Screen-Shot-2015-04-14-at-6.48.27-AM-copy.png

2. Create a paragraph style for the headings with three nested styles as shown below:

Screen-Shot-2015-04-14-at-6.51.42-AM-copy.png

The first style applies the “No break” character style from the start of the paragraph through the first comma. Then no character style is applied through 1 space (allowing the line to break after that space), and then the “No break” character style is applied to the rest of the sentence. So the “No Break” attribute ends up getting applied to the entire sentence except for the space character that occurs after the first comma.

3. When the paragraph style is applied to the headings, this is the result:

Screen-Shot-2015-04-14-at-6.57.08-AM.png

If I add some additional text to the last heading, it also wraps after the comma-space, automatically:

Screen-Shot-2015-04-14-at-6.59.45-AM.png

This could have also been accomplished with a GREP style. But a thought a nested paragraph style was easier to explain quickly to the customer. I also created a second paragraph style for the headings that did NOT contain the nested styles, and instructed them to use this second style for “exceptions” when they wanted to control the line break manually.

Screen-Shot-2015-04-14-at-7.09.29-AM.png

Keith Gilbert is a design consultant, developer, educator, speaker, and author. His work has taken him throughout North America, Africa, Europe, and Asia. During his 35+ year career his clients have included Adobe, Apple, Target, Oracle, and the United Nations. He is the author of several popular titles for LinkedIn Learning, Adobe Press, and CreativePro. Find him at gilbertconsulting.com and on Twitter @gilbertconsult
  • Eugene Tyson says:

    Wonder if that would be cleaner with a

    None up to 1 ,
    No Break up to end of nested style

    ?

    Just curious :)

  • Justin says:

    Nice to see some AEC industry examples.

  • Jon Milburn says:

    Could you not make the whole entry a nested style by changing the hard return after the dollar amount to a forced line break?

    Hopefully the supplied text had an extra return after each entry so you can search and replace/automate this. Selecting all and applying a single style is better than styling each entry with two different styles.

    • In a situation like this, you don’t want to add any more complexity or additional steps to the client’s workflow than is absolutely necessary. For this situation, where the text has a very regular repeating structure, Next Style is the usual and much simpler way to go.

      • Yes, while this could have been done as Jon suggests with a soft return after the bold part, I prefer having separate paragraphs for a number of reasons. I would definitely take it a step further and use “Apply Next Style” as Alan suggests.

  • Jack Brannen says:

    Clever! I like posts like this.

  • I’d not have considered the no-break style as the first applied style, because of the “magic overset text” effect that No Break can cause if a line is too long for the frame. On the other hand, that would be impossible to miss, even in a hundred-page document! :)

    • Yes, I thought about just applying a style of “None” up through the first comma, but I assumed the customer would want to be alerted when the line needed to break early, before the comma. And the text being forced to go overset in that case would certainly alert them of that!

  • Justin says:

    If you frequently work with clients in the AEC industry whom store their project and resume details in Word or InDesign files, you might also want to suggest that they look into a database solution. For that industry, Cosential is a good option. It offers the ability to design InDesign and Word templates with variables. You can then query and organize the necessary details and export a fresh IDML file. Huge time saver.

    • Justin, thanks for the feedback on Cosential. The customer was using some sort of database in this case and exporting from it, but I wasn’t privy to the details. I get asked about AEC database solutions occasionally, so I’ll keep this in mind.

  • vickihnh says:

    Nice! Thanks for posting it.

  • Deb says:

    That is so clever. I use nested styles all the time, but this trick has never even crossed my mind. Thanks for sharing!

  • >