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

Can GREP apply nested line styles?

Return to Member Forum

  • Author
    Posts
    • #61300
      Anonymous
      Inactive

      I am formatting a book in InDesign CS5.5. I would like to apply a character style to the first line of each chapter as well as to the first line of each chapter subsection. The yellow highlighted lines in the following two images indicate the lines in question.

      I have applied a paragraph style (named “body paragraph”) to the body text; another paragraph style (“chapter title”) to the title: and a third (“section break symbol”) to the ellipsis glyph that divides chapter subsections.

      I can create a modified body style (“body paragraph with nested line style”) in which I apply a character style (“yellow highlighter”) using the Nested Styles tab of the Paragraph Style Options dialog box. I would then go through the manuscript and manually apply this modified body style to the first paragraph of each chapter and chapter subsection.

      I would prefer to use GREP within the “body paragraph” style to automatically apply the “yellow highlighter” character style, but I am not sure that this is possible.

      Can GREP be used to select the first line of each chapter and chapter subsection?

      Also, can GREP use paragraph styles to locate text? The first line of each chapter is preceded by text with the “chapter title” paragraph style followed by a hard return, and the first line of each chapter subsection is preceded by an ellipsis with “section break symbol” paragraph style followed by a hard return. If GREP can locate paragraph styles, then a “Positive lookbehind” may work.

      Thank you for your help, and happy holidays!

    • #61302
      David Blatner
      Keymaster

      To apply a character style to a whole line, use a Line Style (it's underneath Nested Styles in the dialog box). See:

      https://creativepro.com/ind…..styles.php

    • #61307
      Anonymous
      Inactive

      Thank you for your input, David. Nested line styles can accomplish the desired results, but they would require a second paragraph style (“body paragraph with nested line style” in addition to “body paragraph”) and manual application to all relevant paragraphs.

      The question is, can GREP be used (as part of the “body paragraph” style) to automatically identify the relevant first paragraphs and apply the “yellow highlighter” character style.

      GREP experts, I'd like to hear your thoughts. Thank you.

    • #61308

      At times GREP sounds like the Ideal Magic solution, and indeed it can do a lot of stuff that's not possible with regular searching. However, in this case it cannot.

      A GREP style cannot apply a line style. It's oblivious to 'lines' in paragraphs. Use a Nested Line Style to do so. In addition, you want to apply a GREP style if the paragraph style before the current one is something else. You can only use a GREP style inside the current style, and it cannot look outside of its paragraph.

      You can use Find GREP to locate your first paragraphs. Look for this:

      (?<!r)^.

      and put your body paragraph style in the Find Format. It will locate the paragraphs where the previous hard return is “not found”, i.e., it's not found because it's not in the same formatting.

      In the Replace With field you cannot add a nested style, so you still have to create a duplicate paragraph style that sets your first line highlight.

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