If I find/replace in a document searching for ordinary printable characters, like replacing ‘House’ with ‘HOUSE’, then it all goes as it should, but if I find/replace for ‘House’ with ‘HOUSE’ (using alt-enter as the keystroke for ), then the find/replace works, except that the font in the replaced text is changed from the editor font (Palatino Linotype, in my case) to Courier. Because I want to do such a find/replace with hundreds of occurrences in the project, this is a serious problem for me.
Am I doing something wrong, or is this a bug? I am running Scrivener 2.3.1 with OS X Mountain Lion. Many thanks for any help.
PS: Btw, Scrivener in general is absolutely brilliant. I used to use Writeway Pro on a PC. I thought a lot of it and switched rather reluctantly when I swapped my PC for a Mac (no Writeway for Mac). One of the best moves I’ve made.
I don’t think this is actually a bug, but rather an unfortunate conflict between how two different systems work:
- The formatting system is not picky about what character setting attributes get attached to. In most cases, they are attached to the letters within a sentence; the spot where italics begins and the spot where it stops. Since it isn’t picky, however, character attributes can be attached to any character at all—even a newline.
- The search and replace engine is effectively ignorant of formatting. If changes are made across formatting boundaries, spreading can occur. The reason for this is that if a formatting “start” marker is wiped out by a search and replace, then it is moved after the replacement value.
For example if you took the word ‘neighbourhood’ and did a find and replace for ‘bour’ to ‘bor’, you would end up with ‘neighborhood’. See how the italic start marker was in the middle of the replacement request? That means it was wiped out by the letters ‘bor’, and the formatting engine recovers from this syntax error (of not having a start marker) by generating an italic start marker to the nearest safest point—after the replacement value.
So that is what is happening. When you type this out, the “end Courier” marker ended up getting attached to the newline character. Your global replacement request includes that character, so it is forced to move the “end courier” marker to the end of the replacement string, causing the entire word to become Courier.
I can’t off of the top of my head think of a good way to solve this particular issue for you. Hopefully “HOUSE” as opposed to “House” is something that only appears after a newline, but I suspect it isn’t since you included that. Oh, one potential thing: is the Courier intentional, or stray formatting? If it is stray and you want to clean things up (before or after replace, it doesn’t matter), you can use
Documents/Convert/Formatting to Default Text Style to make the text uniform and clean out all of the junk formatting while keeping the parts that are important. Try the command on a test duplicate of a document if you are unsure.
P.S. Glad to hear it the transition has gone smoothly and you’re satisfied with the big adjustment!
Thanks for that really helpful reply, AmberV. That makes things clear. I always like to see a reason for problem.
Yes, I’m glad to say that in this case the Courier font is stray formatting. I was never quite sure what ‘Documents/Convert/Formatting to Default Text Style’ did, and it sounded terribly dangerous. But, having checked in Preferences that my default text style was set the Palatino Linotype font, it tried it on a copied document and it worked – the replaced Courier snapped back to Palatino Linotype. Furthermore, it retained italics, which the dialogue box hinted might not be the case.
OK, now I have to run my find/replaces in approaching a hundred documents in the project. As far as I can see, the only way to do this is if with cmd-F document by document, or am I missing something here? If this has to be done, then so be it. Your tip has still saved me untold hours of work checking for and tidying up and stray font-change inserts.
Oh! I’ve just discovered Edit/Find/Project Replace, so I can do all my find/replaces in one go across the whole project. Very quick! And then I can tidy up with Documents/Convert/Formatting to Default Text Style to restore to the default font.
Ah, yes I thought you were already using that tool, otherwise I would have mentioned it specifically. And do note also that the format conversion tool can be run on large selections of documents at once (which is why we have it in the Documents menu rather than the Format menu).
The reason why the warning is worded that way is that not all fonts have typographic variants. If you were to convert your document to a font like Lucida Grande, for instance, you would lose italics.