4 Replies Latest reply on Dec 21, 2011 6:03 PM by winterm

    Rule that detects paragraph style change

    Cary Millsap

      I have a CS5 paragraph style called "Code", which needs Space After="0p0" if the following paragraph is also "Code", but it needs Space After="0p3" if the following paragraph is not "Code".

       

      Actually, I have several paragraph styles for which I need this behavior. Presently, I have two separate styles for each of these styles, for example, "Code" and "Code: Final Line". I could eliminate several paragraph styles and lots of manual labor if I could create a rule to do what I've described.

       

      I don't see how to do it with GREP Style, but that seems like the place where I should be able to do it.

       

      Is it possible? How?

        • 1. Re: Rule that detects paragraph style change
          BobLevine MVP & Adobe Community Professional

          You have done it the only way you can in InDesign.

           

           

           

          Bob

          • 2. Re: Rule that detects paragraph style change
            Joel Cherney Adobe Community Professional & MVP

            Consecutive Styles from in-tools.com sounds like it would do exactly what you want.

            • 3. Re: Rule that detects paragraph style change
              BobLevine MVP & Adobe Community Professional

              I’ll let Harbs comment but I don’t know if that’s going to do the trick.

               

               

               

              What we need is something like CSS adjacent selectors .

               

               

               

              Bob

              1 person found this helpful
              • 4. Re: Rule that detects paragraph style change
                winterm Level 4

                hi, Cary

                interesting case...

                No, grep doesn't look for styles, it just looks for text and applies styles…

                the only suggestion comes to mind so far, is a dirty workaround. Maybe it's worth dancing around, if your document is really too big for manual edits, and your text is not justified, but, let's say, aligned left.

                Then the goal is: merge all "Code" and "Code: Final Line" text to one paragraph.

                 

                1. In Text tab find hard returns formatted as "Code: Final Line", change them to some special character, surely not used in your "Code" text anywhere, and hard return, lets say:

                Find What: ^p Change To: +^p

                2. In Grep tab change all hard returns formatted as "Code" to soft returns, except those with your "special character" behind (plus sign in my example):

                Find What: (?<!\+)\r Change To: \n

                3. Finally, easy part - find/remove all occurencies of your 'special character' from your text. Former it was formatted as "Code: Final Line", now it's "Code". You can specify it in Find Format field. "Code: Final Line" is not used nowhere anymore.

                4. After all, you can apply desired Space After to your "Code" style.

                 

                And yeah, it's faster to do than to describe...

                Hope it helps if you didn't find better solution yet. If you did, please share

                1 person found this helpful