Grep styles with No Break

Learn / Forums / General InDesign Topics / Grep styles with No Break

Viewing 3 reply threads
  • Author
    Posts
    • #55754

      I have to deal with lists of names in the form 'Smith A, Jones B, Williams C'. The text is set in fairly narrow columns, and I want to try and avoid the text breaking between the surname and the inital. I set up a character style to apply No Break, and created a grep style in the paragraph style to apply this character style to text matching the following:

      ul+ u+>

      It almost works. The trouble is that sometimes the text refuses to break at the comma between two names where the surname is quite long. I end up with lines like

      Guzman J,

      Esmail R, Karjalainen K, Malmivaara A, Irvin E,

      Bombardier C.

      when I see no reason why I shouldn't be getting

      Guzman J, Esmail R, Karjalainen K,

      Malmivaara A, Irvin E, Bombardier C.

      This seems more likely to happen where there are more long words immediately following, so I suspect it's something to do with the paragraph composer trying to fill the column width on most lines, even if that means leaving some drastically short. Any ideas on how I can fix this behaviour?

    • #55758

      It is rather odd. You are sure there are no other codes involved? (Soft line breaks, or non-breaking spaces, to name a few that could cause this.)

      I suspect it's something to do with the paragraph composer trying to fill the column width on most lines, even if that means leaving some drastically short.

      Nope — well, fairly sure of a “nope”. As I understand the paragraph composer, on your strange 3-liner it ought to settle for at least 2 fairly equal lines, followed by whatever remains. The “balance ragged lines” option forces the behavior you propose, but it's highly inappropriate for list of names (if only because it might decide to put each name on a line of its own, just because there is one long name in the list).

      Theoretically, you ought the exact same behavior if you replace space-not-after-a-comma with a non-breaking space. Your GREP style method is superior since it doesn't need anything else; but can you try and see if it yields the same result on that paragraph?

      (Footnote: it might also work to switch to the Single-line composer. Perhaps the very intelligent Paragraph Composer does get confused by this …)

    • #55780

      You were right, changing to the single-line composer fixed it. (So did changing the spaces to fixed spaces, but that's less flexible, as you pointed out.)

      Thanks so much!

    • #111000
      Andy Cook
      Member

      I need to apply no break to names – ONLY if they are followed by a comma …

      • #111017
        David Blatner
        Keymaster

        Andy, names are tricky… GREP can only find very clear patterns. It doesn’t know about things like “names.” For example, the word “Cook” could, of course, be a name or a word. So GREP probably can’t tell what a name is.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
>