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?
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.
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.
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?
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).
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:
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:
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:
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.
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.