4 Replies Latest reply: Jun 27, 2010 8:09 AM by Maria964 RSS

    White spaces & inline graphics

    Maria964 Community Member

      Hi,

       

      I am working in a book with hundreds of inline graphics that mimics text (eps files). The frame of the graphics is too loose so, what happens is that when we look at the printed text, between the real text and each graphic the normal space inserted by Indesign seems bigger than the spaces between the words.

                      I have two ways to solve this. First, cropping the left and right sides of the graphic or, second, replacing the spaces before and after each graphic with a “smaller space”, for example, a hair space.

                      The first solution is worse than the second because the software that generates the eps files is not very consistent: sometimes the bounding box is one or two points wide and other times is almost a perfect fit.

                      So, can anyone help how to make a search and replace of <<“normal space” “inline graphic” “normal space”>> to <<“hair space” “same inline graphic” “hair space”>>?

                      Or can anyone find out another solution for the problem?

                      I am running Indesign CS5 on Windows 7.

       

      Best regards and thank you in advance,

       

        • 1. Re: White spaces & inline graphics
          P Spier CommunityMVP

          I see none of the GREP wizards has come up with anything, so I've given it a shot.

           

          I first tried looking for an anchored object marker surrounded by spaces, written as \s(~a)\s which seemed to work as far as locating the inlines, but when I tried replacing that with ~<$1~< (thin space(found text1)thinspace) the inline itself disappeared, so it seems you don't want to find the inline as part of the search result, but instead split the search into two parts and find a space followed by an inline marker and a space preceded by one. In other words use look ahead and look behind. Look ahead and look behind don't return the anchored object itself, keeping it safe from change.

           

          The first expression would be \s(?=~a) and the second is (?<=~a)\s

          The change to is just ~< in both cases.

           

          You can replace the \s, which finds any white space, with a specific space or typed space if you like. The two searches can be chained together to run as one operation in a script. Peter Kahrel has one at http://www.kahrel.plus.com/indesign/chain_queries.html

          • 2. Re: White spaces & inline graphics
            Maria964 Community Member

            Hi, Peter

             

            This works great and is wonderful because I can include it in a grep style.

             

            My knowledge of grep is very poor but I know enough to use a OR in your expression so, if I use "\s(?=~a)|(?<=)\s", the grep search does the job inside the paragraphs and I don' have to do two searches.

             

            But a problem remains -- You can see it in this image:

             

            example.gif

            Can you help me?

             

            Thank you in advance,

             

            Maria

            • 3. Re: White spaces & inline graphics
              [Jongware] Community Member

              The "\s" wildcard picks up any whitespace character, including hard and soft returns.

               

              If you are sure you only used regular spaces, you can safely replace the "\s" in your expression with a space. If you may have used other kinds of space, such as the fixed width ones, you'll have to add them with an inclusion group: [ ~S~s]

              • 4. Re: White spaces & inline graphics
                Maria964 Community Member

                Thank you Peter and thank you Jongware.

                 

                Next week I am going to be much more productive. So I will have more spare time and I will use it to study Grep.

                 

                That is a promise!