Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Use GREP to avoid breaking hyphenated compounds

Return to Member Forum

  • Author
    Posts
    • #62123
      Matt Mayerchak
      Participant

      Hi,

      I use a 2-step GREP find/change to avoid hyphenating compunds (i.e. you don't want to split “greenish-blue water” so it reads “green-ish-blue water”

      Step 1 is to find all text that precedes a hyphen and apply “nobreak” but not to the hyphen – so I find all Word characters and/or apostrophes, with a positive lookahead for a hyphen:

      [w|’]+(?=-)

      Step 2 is to find all text after a hyphen that includes Word characters and/or apostrophe.

      (?<=-)[w|’]+

      This seems to work well enough – but I'm curious if other people do this & if so, how. Is there an easy way to make a wildcard to match all the Word characters and all punctuation except hyphens & dashes?

      This is the kind of thing that I wish would just be a button in Indesign's hyphenation settings . . .

    • #62147
      BradWalrod
      Participant

      Here are the two GREP styles (applying a “nobreak” character style to both) that I've been using for text paragraphs for a while:

      [lu]+(?=[—–-])

      (?<=[-–—])[lu]+

      (That's a hyphen, en dash, and em dash that it's looking for. I like how you've added the apostrophe, but I wouldn't have gussed that ID would hyphenate before or after one.)

      I suppose that instead of your [w|’] and my [-–—], we could consider [S], which would catch anything that's not a space.

      Brad

Viewing 1 reply thread
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads