How to delete space at the start of every paragraph?

Learn / Forums / General InDesign Topics / How to delete space at the start of every paragraph?

Viewing 3 reply threads
  • Author
    Posts
    • #71767

      Hi there

      I wondered if you guys might be able to help? I have received a book to typeset from a client and each paragraph has a space before the text starts. See the following image: https://postimg.org/image/vnr80e751/

      I know it is slightly pedantic, but is there any way that i can remove all of these in the document? I thought about find/change but wasn’t sure how to do it?

      Any suggestions would be most appreciated.

      Thank you

    • #71769
      David Blatner
      Keymaster

      You could do a grep find/change and search for ^\s+?(.) and replace with $1
      That will delete one or more spaces at the beginning of any paragraph.

      • #71791

        Thank you David, I will try that. But do you have any links on how to go about that, or what greps are? I have seen it mentioned a lot but don’t really know what they are.

        Thanks and best wishes

      • #71795

        Andy,

        Go to the regular Find/Change panel and then click the GREP tab — not the usual “Text” tab. Make sure both Find and Change text fields are empty, and there is no formatting in either. Those work the same as it does as in the regular Text change.

        Type in the top (“Find”) field

        ^ +

        — mind the gap! That is a single space in-between. Leave the bottom “Change” field blank. Now hit “Find” and check if it finds and highlights the first occurrence of a space at the start of a paragraph. If it does, hit “Change all” and duck.

        The magic codes are

        ^ = Start of Paragraph. Sort of the same as “^p” in the regular Find/Change dialog, except that this is a *position* only, and it doesn’t ‘eat’ the paragraph return. Since it’s only a position and not an actual character, it also works when there is no Paragraph return ‘before’ the start of a paragraph.
        (imagine a single space here) = The literal text to find. GREP uses lots and lots of special characters as commands (the ^ above is one of them) but a space is just a space.
        + = The previous command, group, or character, and then repeated as much as possible.

        So this will look for *any* positive number of spaces at the start of a paragraph, be it 1 or 42 or any other number larger than 0. Replacing them with ‘nothing’ does exactly that: it deletes them.

        How is this different from David’s suggestion? (Sorry David!) He suggests

        ^\s+?

        where the ‘\s’ command stands for ‘any kind of space’. That can be useful because apart from a single regular space, this also includes tabs, hard (unbreakable) spaces, and even en and em spaces; but *also* the hard return and the soft return. The latter may unintended wreak havoc on your document, as two consecutive hard returns are *also* seen as “start of a paragraph” (right after the first hard return) followed by “white space” — the next hard return. The next hard returns — any number of them — will also disappear!

        Based on your image I understand there are only regular spaces at the start of paragraphs, and so my search expression is a bit safer.

        For more information: IDSecrets has a page full of links to resources on GREP: https://creativepro.com/resources/grep

      • #71815

        Thank you Mr Jong!

        That worked a treat!

        And thank you for your explanation and links, they are very useful!

        Best wishes

    • #71787

      Andy

      Did they give you a word file to import or was it already in InDesign?

      I find it much easier and problem-free to tweak the Word file before importing.

      • #71792

        Thanks dwayne. When I think about it, I was sent a pdf and I must have converted it to word. But I am half way through the iD document now and only just noticed, so it would be counter productive to go back to the original.

        But thanks again for your help, always appreciated.

        Best wishes

    • #80266

      Thank you for this!! I have a client who regularly uses spaces instead of tabs, and just worked on a doc from a different client with one space in front of almost every paragraph. I hope everyone knows you can save GREP queries. Hopefully they don’t go away with version updates!

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
>
Notice: We use cookies on our websites to give you a great online experience. If you keep browsing, we'll assume you're ok with this. For more information, see our privacy policy. By closing this banner, you agree to the use of cookies.I AGREENo