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

Style the Second Last (and last) Paragraph with GREP

Return to Member Forum

  • Author
    Posts
    • #14341064
      Jonas Ericsson
      Participant

      Hi. I found this article when I was looking for a solution to a problem I have with auto styling for the second last paragraph and the last:

      Auto Style the Last (or First) Paragraph of an InDesign Story

      Does anybody know if there is a solution to it with grep?

      This is the problem:
      I have a quote, an attribution author and who that person is (the only text in the frame) and want a character style after the first paragraph and another c-style at the end. 3 paragraphs in total.

      This is the text at the beginning of the story, the quote
      Name Name (the first character style)
      Title (the second character style)

      Thanks
      Jonas

    • #14341306

      Do you mean:

      I have text frames! Some have just 3 paras I only want to style! [that excludes text frames with 1, 2, 4 or more paras!]

      (^/) The Jedi

    • #14341307
      Jonas Ericsson
      Participant

      Hi. I was perhaps vague in describing the problem.
      The Paragraph style I want to modify is used only for pull quotes and they are always in a separate frame. The quote itself as the first paragraph, the next para for the name of the person who “speaks” in the quote and then a para for who the person is. For example:
      Your eyes can deceive you. Don’t trust them.
      Obi-Wan Kenobi
      Jedi master

      Sometimes there is only para 1 and 2.

      I hope this describes the problem a little more clearly.

    • #14341308

      If 2 or 3 paras in these specific text frames, it seems to me simple to style (I would use para styles).

      My 3 para styles are: PS_1, PS_2 and PS_3.

      Regex 1:
      Find: \A.+\r(.+\r)?.+\z
      Replace by format: PS_2

      [This first regex will only catch text frames with 2 or 3 paras!]

      Regex 2:
      Find: \A.
      Find Format: PS_2
      Replace by format: PS_1

      Regex 3:
      Find: .\z
      Find Format: PS_2
      Replace by format: PS_3

      Of course, using a queries launcher, you just need 1 click!

      (^/)

      • #14341310
        Jonas Ericsson
        Participant

        Thanks @michel-allio-for-fridnge
        In this case there is no human involved that can do the clicking.
        The pages will be automated and the text needs to be styled with only one para style. If it where always only two paragraphs Davids trick would have solved my problem.
        If I can’t find a solution with grep or nested style/grep combo, I need to do some design changes for those pull qoutes.

        Thanks for your thoughts,

        Jonas

    • #14347924
      Harold Repass
      Participant

      Really like this article.

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