5 Replies Latest reply on Feb 24, 2013 4:24 AM by Peter Spier

    Replace three blank lines with one smaller one

    tim-p

      Hi

       

      I have an Indesign document which is populated from a database. A lot of the data imports with four paragraph breaks between lines (i.e. three empty lines).

       

      I can easily substitute ⩑P⩑P⩑P⩑P with ⩑P⩑P which reduces the spacing between actual lines to one blank line, but what I really want to do is make the remaining blank line smaller, as though it were a paragraph style with space after. I can't use para styles as this messes up the import and character styles, which I do use, don't allow for space after.

       

      Is there any way using find and replace to automate this, please?

       

      Thanks in advance for any help.

        • 1. Re: Replace three blank lines with one smaller one
          Willi Adelberger Most Valuable Participant

          You should not use blank paragraphes at all. To use multiple returns (your case) and multiple normal spaces (not special ones) in a row are a typographicaly a no-go.

          Set up a paragraph style with space before and after.

          To remove you can use find and replace there is a preset in the GREP section to remove trailing spaces which will clean up your file after import from other applications.

          • 2. Re: Replace three blank lines with one smaller one
            [Jongware] Most Valuable Participant

            tim-p wrote:

             

            I have an Indesign document which is populated from a database. A lot of the data imports with four paragraph breaks between lines (i.e. three empty lines).

             

            I can easily substitute ⩑P⩑P⩑P⩑P with ⩑P⩑P which reduces the spacing between actual lines to one blank line, but what I really want to do is make the remaining blank line smaller, as though it were a paragraph style with space after.

             

            It's tricky to use the regular find-and-change with paragraph returns, because it may mess up paragraph styles; and in your case, you want some of the attributes the blank line to change, but the 'other' paragraph return is going to end up tacked on to the end of your last paragraph, so that should not change anything.

             

            You can use a GREP find-and-change instead, which circumvents the Accidental Change Syndrome ... by not finding that "previous return"!

            Search for this:

             

            (?<=\r)\r{3}

             

            and replace with this:

             

            \r

             

            This will replace three hard returns in a row (and also preceded by at least one) with a single hard return. To make this blank line smaller, you can change its Leading value in the Change To Formatting (so first find out what value you want it to be). This new leading is also applied to just the single new hard return, not to the hard return at the end of the previous line.

             

            tim-p wrote: ... ⩑P⩑P⩑P⩑P ...

             

            That made me scratch my noodle for a while. "Logical-Not with Dot Above"? Those are usually a plain '^'

            • 3. Re: Replace three blank lines with one smaller one
              tim-p Level 1

              Many thanks Jongware for your helpful post. Apologies for confusing you with the math character - I couldn't find any way of putting the character I wanted into the browser box!

               

              Your solution works brilliantly - thanks.

               

              Willi - thanks for your post. I completely agree with you about the typographical no-no. My problem is that all my copy is flowing from a client's own database, which is done that way. So there's no point in me moaning about it, I just have to fix it for print purposes.

              • 4. Re: Replace three blank lines with one smaller one
                Peter Spier Most Valuable Participant (Moderator)

                You COULD fix it properly by first searching for \r(?=\r{3}) and adding the space after to that, then searching for (?<=\r)\r{3} and replacing with nothing, I think. If you prefer space before, you could could search for (?<=\r{4}) before removing the three blank paragraphs.

                • 5. Re: Replace three blank lines with one smaller one
                  Peter Spier Most Valuable Participant (Moderator)

                  Sorry left off the . in the second expression. that should have been search for (?<=\r{4}). to find the find the first cahtacter of the paragraph following the three blank lines (the fourth return is the one on the non-blank paragraph before the three blanks) and add the space before.