Cleaning Up Text Imported Into InDesign (Part 1)
Written: 2012-04-11
Last modified: 2016-08-04
Introduction
A common problem when receiving text from other people is that it is often not as consistently formatted as you might like. Some common things that need to be fixed are:
- Removing double spaces after periods (full-stops).
- Removing extra spaces or tabs at the end of paragraphs.
- Removing blank/empty lines between paragraphs.
Fixing these items manually can become very time consuming, however it is possible to use the GREP option of InDesign’s Find/Change... feature to speed up this task.
Example
Here is an example paragraph as received from a client. Spaces are marked with a dot (·) and paragraph returns are marked with a paragraph symbol (¶).
¶
Do· you· ever· feel· overwhelmed· with· clutter?· · Do· you· find· yourself· without· time· to· run· errands· or· do· your· shopping?· · Then· we’re· the· perfect· solution!· ¶
· · ¶
Many· people· needlessly· spend· time,· money,· · and· energy· due· to· clutter.· · We· want· to· help· change· that.· · There· are· many· reasons· those· piles· stack· up.· · ¶
In addition to double spacing after periods (full-stops), the writer has liberally applied the space bar throughout the entire text.
Removing Multiple Spaces
In order to remove the multiple consecutive spaces, we can use a ‘regular expression’, which is a way of doing advanced searches. In order to use regular expressions for searching, we need to use the GREP tab of InDesign’s Find/Change… dialog box.
In the ‘Find what:’ field, enter: . (You should be able to copy and paste this expression into InDesign.) There should be two spaces before the plus symbol. This tells InDesign to search for any occurrence of two or more spaces.
In the ‘Change to:’ field, enter: . There is a single space in this field. This tells InDesign to replace the found text with a single space.
Note: This only finds multiple REGULAR spaces. If you use wish to also search for Em spaces, En spaces, Nonbreaking spaces, etc, you will need to expand the search criteria.
Only Remove Multiple Spaces Between Sentences
It may be desirable to only remove multiple spaces that occur between sentences (following a ‘.’, ‘!’, or ‘?’) and leave all other multiple spaces. We can do the following:
In the ‘Find what:’ field, enter There are two spaces between the right parenthesis and the plus symbol. This tells InDesign to search for a period, an exclamation mark or a question mark, followed by two or more spaces.
In the ‘Change to:’ field, enter: Note: There is a single space after the 1. This tells InDesign to replace the found text with a period/exclamation mark/question mark, followed by a single space.
Removing Excess Space at the End of Paragraphs
Removing spaces at the end of paragraphs can be performed by entering: in the ‘Find what:’ field and leaving the ‘Change to:’ field blank:
Removing Empty Paragraphs
Empty paragraphs can be removed with:
Find what: ,
Change to:
We can actually remove excess space at the end of paragraphs and remove empty
paragraphs all with one command:
Find what: ,
Change to:
Summary
Summarizing how to remove excess spacing from text in InDesign using the following Find/Change settings in ‘GREP’ mode:
Task | Find what: | Change to: |
---|---|---|
Remove all multiple spaces | ||
Only remove multiple spaces between sentences | ||
Remove excess spaces at the end of paragraphs | ||
Remove empty paragraphs | ||
Remove empty paragraphs and excess space at the end of paragraphs |
In Part 2, I explain how to write a script to automate these replacements.