9 Replies Latest reply on Dec 4, 2012 11:38 PM by oldcompositor

    Way to search italic spaces not flanked by italic?

    oldcompositor

      Hi all!

       

      I'm trying to eliminate (un-italicize) spurious italicized word spaces -- those that are not preceded and followed by italic characters. (The book contains more than 12,000 italic word spaces in all, so going through them manually is not reasonable.) Is there a way to search these?

       

      -oldcompositor

        • 1. Re: Way to search italic spaces not flanked by italic?
          Eugene Tyson Adobe Community Professional & MVP

          Do you really need to unitalicise these? What difference does it make to the flow of the text?

           

          I'm not following the logic you want to search by - can you give an example?

          • 2. Re: Way to search italic spaces not flanked by italic?
            oldcompositor Level 1

            Thanks for the reply, Eugene.

             

            I want to do the change because italic word space in the font I'm using are narrower than regular ones. Also because pair kerning works only within the same font - and I would like these things to be logical.

             

            I think I figured it out on my own, using common sense and ordinary plus GREP searches. If you're curious (and I was correct), I can post details later.

             

            -oldcompositor

            • 3. Re: Way to search italic spaces not flanked by italic?
              Peter Spier Most Valuable Participant (Moderator)

              While I agree with Eugene, I've been thinking about this and I believe it is doable (sort of) in several steps.

               

              The first step is to identify the ones you want to keep italic and mark them:

               

              Find (?<=[\u\l\d[:punct:]]) (?=[\u\l\d[:punct:]])  (that's a space between the look-behind and look-ahead expressions, which are checking for uppercase, lowercase, digit or punctuation) and set the find formatting to italic. Set the change formatting to make the character color some color you aren't using for text. I used red in my test.

               

              Now you need to find all spaces that are italic, but not red, and change them to the regular font, so you want to change the find to just the space character, and add Black as the character color to the find format (which will ignore the spaces you just marked red). Set the change formatting to on the font to Regular (or Roman, or whatever the correct name is).

               

              Finally, you need to go back and find red spaces and change the color back to black or whatever color they should be.

               

              I hope you can see that this is pretty limited. It will destroy your bold or bold italic spaces in strings that are bold or bold italic, it can only handle one color of type at a time and it won't work with multiple fonts that have different names for the normal font style, nor does it (as the query is set up) find anything but spacebar spaces. You can do similar searches for bold, bold italic, condensed, extendeded... (and you get the idea) font styles before converting, and you can substitute \s for the space bar in the query if you want to pick up other spaces and tabs, but it also picks up paragraph breaks and forced line breaks, which might not be desirable. By the time you finish with this, it might be just as easy to find italic spaces one at a time and decide if they need to be changed.

              • 4. Re: Way to search italic spaces not flanked by italic?
                oldcompositor Level 1

                Thanks, Peter!

                 

                The logic and the steps I used were basically the same as yours -- except that in step 1, I converted those spaces that needed to remain italic to ¤ symbols (which the book did not contain). And the GREP search I used here was just: FIND (.)( )(.) combined with Italic formatting, REPLACE WITH $1¤$3. Do you see a problem with this approach?

                • 5. Re: Way to search italic spaces not flanked by italic?
                  Peter Spier Most Valuable Participant (Moderator)

                  Only that . reperesents any character, including the various white space and break characters and I'm not sure you want to find those. Also, should one of those be a paragraph break I believe you run the risk of changing the style (that came up earlier this week with removing multiple returns) so the look-ahead and look-behind are somewhat safer. The advantage to using a color change instead of a symbol is that if for some reason you don't change the symbol back into a space you don't risk chaning the text flow and it will still output as a space. Colored spaces don't generate ink on a plate (though they might add a plat you could ignore in some cases).

                  • 6. Re: Way to search italic spaces not flanked by italic?
                    oldcompositor Level 1

                    Thanks again, Peter! I really need to learn about look-ahead and look-behind. Anyway, I have to check that my less sophisticated method didn't indeed do something odd...

                    • 7. Re: Way to search italic spaces not flanked by italic?
                      Peter Spier Most Valuable Participant (Moderator)

                      I'm curious to hear what some of the other real GREP experts have to say....

                      • 8. Re: Way to search italic spaces not flanked by italic?
                        [Jongware] Most Valuable Participant

                        oldcompositor wrote:

                         

                        I'm trying to eliminate (un-italicize) spurious italicized word spaces -- those that are not preceded and followed by italic characters.

                         

                        Now that is what separates the men from the .. what, old compositors? Yup, like you I also thoroughly dislike spurious formatting, such as bolded or italicized or even superscripted space. It messes up the overall spacing, and if you happen to type something "before" an italicized word your new text will also be cursive.

                         

                        With this GREP you can search for "nothing" (i.e., "no italic text") followed by a space:

                         

                        (?s)(?<!.)\s

                         

                        and this one for the right hand side, for an italic space followed by "nothing" (again, meaning "no italic text"):

                         

                        (?s)\s(?!.)

                         

                        In both cases you must make sure to have "Italic" in the Find Format field.

                         

                        It's possible to put both queries into a single operation:

                         

                         

                        (?s)(?<!.)\s|\s(?!.)

                        but be advised, at times InDesign seems to prefer the easy road with slightly more complicated expressions like these, and skip over occurrences which it really should have found. I think Peter happened across this once with one of my chained OR expressions.

                        1 person found this helpful
                        • 9. Re: Way to search italic spaces not flanked by italic?
                          oldcompositor Level 1

                          Jongware, your single-step solution certainly seems the easiest one. I tried both your and Peter's method: yours unitalicized 9413 spaces; Peter's, 9406. I decided to go with Peter's method because it seemed less risky (and easier to understand) -- and not worry about the difference of 7 spaces.

                           

                          Thanks again to both of you! I certainly learned a lot and still saved some time.