is now part of CreativePro.com!

Remove Multiple Returns and Replace with Space Between Paragraphs

20

You know how people love typing extra returns between paragraphs in a story to insert extra space between paragraphs? They obviously don’t know about Space Before or Space After, which is the proper way of handling inter-paragraph spacing. So how can you remove all those returns?

The easiest way is to open the Find/Change dialog box and choose “Multiple Return to Single Return” from the Query pop-up menu. That switches to the GREP tab and types in a bunch of grep code for you. When you click Change All, it removes all the extra spaces — whether there were 2 or 20 returns in a row.

But what if you really did want space between each paragraph? Can you replace the returns with a little “space before/after”? Sure! After choosing from the query pop-up menu, click in the Change Format area at the bottom of the find/change dialog box. (If you don’t see that, click More Options.) Then assign some Space After in the Change Formats dialog box. Or, far better: Apply a paragraph style that uses Space After.

multiplereturns

Now when you click OK and then click Change All, the returns will be replaced with a single return… and the paragraph before those returns will change to the new formatting (with space after).

Now, personally, I prefer using Space Before, but I know others who like Space After (like my co-author Ole Kvern). It’s just a different way of thinking. Anyone want to take a crack at the grep code required to modify this to use space before instead?

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, CreativePro Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at LinkedIn Learning (Lynda.com) are among the most watched InDesign training in the world.
You can find more about David at 63p.com

Follow on LinkedIn here
  • LuisRM says:

    This is perfect! Thanks for this tip. I have to edit multiple docs with extra paragraph markers and used to do a find change, but this makes it just that much more efficient.

  • Jongware says:

    Using ~b is an interesting approach. Let’s try a variety: Use this GREP

    (?<!~b)~b(?!~b)

    (replacing with a single space) to replace only single returns to a single space. Anything more than a single return will be left alone.

    [!] You have to absolutely make sure there are no spaces (or tabs, or anything) on the ’empty’ lines, though. If there are, well, then it’s not two returns-in-a-row and they will be replaced as well.

  • Eugene says:

    That GREP doesn’t always work for me, sometimes really bad things happen.

    So I usually go with the ^p^p and change to ^p in the normal text find and replace.

  • Jongware says:

    Eugene, that one is known to occasionally mess up paragraph style formatting, as it “touches” both paragraphs. (From memory — I didn’t test David’s version for this either.)

    On another subject: David’s little Space Before challenge!
    Ole (and his co-Space Before users) can use this:

    (?<=~b)~b+(.)

    replacing with

    $1

    and, of course, the required Space Before amount in the Change To format.

  • Eugene says:

    I can honestly say I’ve never had issues with doing the ^p^p and replacing with ^p.

    On occassion the GREP supplied with InDesign can remove all the breaks for some reason, or breaks where you want it to break, like column breaks and page breaks, if my memory serves me correctly. I could be wrong.

  • Scott says:

    What are the general arguments for using space before vs. space after?

  • Thank you, Theun, for that great grep replacement. That is awesome!

    However, Eugene, you are correct: It will remove things like column and page breaks. That can definitely be a problem if you need those. I’m not actually sure why those breaks are removed; the ~b character is supposed to be a carriage return, not a wildcard for line breaks. Hm. Perhaps a bug?

    Scott: I like using Space Before because I’m usually applying it to a heading, and it’s easier to apply it to the heading than to the paragraph before a heading. If you later have to edit the text (perhaps add another paragraph before the head) you have to re-apply paragraph styles. Annoying. If you just use Space Before on the heading, then it’s easier.

    But it really is ultimately just a preference for workflow.

  • Jerome says:

    I use the standard search/replace method like Eugene. I don’t have a problem with it changing paragraph styles since I usually do it when I import the text, along with a search/replace to remove double spaces between sentences.

    Paragraph space before/after: I tend to use space before because that is the way I have done it for years. It is also more useful for setting up space between different “levels” of heads in the text flow.

    For example an “A-Head” has 1p6 space before and a “B-Head” has 1P space before. A paragraph with a run-in head has 0p6 before, a standard paragraph has 0p4 space before, and a bulleted list has has 0p2 space before. If I were doing it with space after I would need multiple body text styles with a “followed by A-Head,” “Followed by B-Head,” etc. to do the same thing and if my heads changed or were added in I would have to remember to go back to the paragraph before and change it to the appropriate space.

    Now I could probably do the same thing with a combination of space before and after. This sets the main paragraph to have a 0p4 space after, so my A-Head would need a 1p2 space before and a 0p4 space after. However I think that this might be harder to manage and be more confusing to explain to a colleague that might have to work on the document or take over the project.

  • I needed this last week. Thanks, I’m sure I’ll need it again. :)

  • Steven says:

    This could easily be scripted, to add the leading + Space Before + Space After of removed paragraph to Space After of previous paragraph or Space Before of previous paragraph.

  • GregB says:

    Geez, how I hate double returns. I’ve been using find/change since it was mentioned previously, but this tips will make things so much easier.
    What about justifying a text box(es). I see a lot of double returns (I’m in a newspaper design dept.) to fill out the text boxes, but when making alterations, it oversets, so I have to go back and use the find/change to get rid of the extra returns. Keep the tips coming.

  • rhadin says:

    It isn’t clear to me when this is useful. I admit my experience is limited in the sense that I tend to work with the same publishers in the same workflow and on books only, which colors my perspective. But here’s why I don’t understand the application: I cleanup and style all of the books we do in MS Word before placing the text in ID.

    Do you receive rewrites to ID files where people have added extra returns to the already once set ID files?

    If not and you are talking about original manuscript that you receive in Word or similar format, isn’t it easier to do the cleanup in Word?

  • Eugene says:

    Well i could clean it up in Word first.

    But if there’s a mistake in the supplied file and I change the supplied file, then I’m culpable for the mistake, well it could be construed that way.

    I get the file in Word, I don’t even open it (well maybe to print it out so I have a copy to go off when laying out the text).

    Then I import to a blank file, remove all the stuff that’s not needed, like double spaces, double paragraph returns, multiple tabs etc. Then export that back to RTF. Then I import my version of the RTF into the layout.

    The reason for the above is to remove unused Word styles. It can be done from Word, but I don’t really want to open or change anything from a supplied file.

    I prefer working the text in InDesign anyway, i’m used to the Find and Replace and have multiple grep searches already in place to remove any bad typesetting things that people do, who aren’t professional and I’m fine with that. The first 15 minutes is spent tidying up their file. Always is.

  • Rick A says:

    I’ve also used ^p^p -> ^p since my early days of typesetting some 30 years ago. Have also used Space Before all these years. For some reason, it made more sense to me. Also do this in Powerpoint

    I’ll use a common Space After amount on bodies of text that have different styles with different Space Before amounts. That way if I need to add or lose some small amount of leading, I change the Space After in the base style instead of tweaking the different Space Befores

  • What is the difference if I search for \r or for ~b ?
    Is \r original regex and ~b is the InDesign internal version?

    Thanks jongware for your cool grep (?<!~b)~b(?!~b)
    Normally I need 3 passes for nearly the same result like your one line:
    1. \r\r replace with ###
    2. \r replace with one space
    3. ### replace with \r

  • rhadin says:

    Eugene, I, too, don’t like touching a supplied file so whjat I do is take the original author file (e.g., jones book1.doc) and save it to a new name, usually just adding .edit to the existing name (e.g., jonesbook1.edit.doc). This way I have the original file as supplied and a work version, which is the version I clean up.

    Part of my macro routine with the Word file is to clean up unneeded things like extra spaces and returns, and to remove unused styles. I also convert bulleted and numbered lists to fixed lists and whittle away at author used styles so that what I end up with is Normal, Italic, and Bold.

    I then save the .edit file and open my standard ID Word template and import the file. Now that it is in my ID template, I select all text and make it all BodyText and convert instances of italic and bold to the appropriate character style. I then edit and style the document.

    When done, I run a macro to remove all unused styles from the file and save it yet again. It is this version that I place into my ID template for the book. When I place it, I always use Place options so that I can map styles. This gives me an opportunity to redirect any stray Word style that still lingers, usually just Normal, but occasionally a stray character style.

    I have found this to be the most efficient route and one that lets me edit and typeset a 200-page book in a relatively short amount of time. I haven’t yet found a quicker method. I have tried exporting to RTF but that doesn’t solve my styles problem and I have found it quicker to actually apply styles in Word than in ID.

  • Jongware says:

    What is the difference if I search for \r or for ~b ?
    Is \r original regex and ~b is the InDesign internal version?

    Erm. Good question. I thought using ~b was brilliant because I thought, ‘well, David is using it, so it must be a better way of marking returns’. Turns out it’s what you get when inserting a “standard paragraph break” from the menu … It appears to do exactly the same as \r. (And, oddly, in regular text, you can insert ‘^b’ from the menu, which works the same as ‘^p’.)

  • Joe says:

    You say
    ‘the easiest way is to open the Find/Change dialog box and choose ?Multiple Return to Single Return? from the Query pop-up menu’
    Can you tell me where to find ?Multiple Return to Single Return? from the Query pop-up menu. I cant find it anywhere in the Find/change box

  • Chad Chelius says:

    Joe,
    You need to have InDesign CS3 at a minimum to see this option. Are you even seeing the Query pop-up menu? If you are in fact using CS3 but still aren’t seeing the pop-up menu or simply not seeing the Multiple return option in the Query pop-up menu, you may want to try resetting your preferences to see if that clears up the problem.

  • kiran kumar says:

    Needed a script which perform exactly the same specified functionality.

  • >