How to automark special characters (Word 2003 and on)

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

How to automark special characters (Word 2003 and on)

Post by ChrisGreaves »

In Word 2003 Automark ignores word strings that are prefaced with characters such as the hash symbol(#)
I have not tried this in any later versions of Word, but MS rarely improves a feature IMHO.

Ignoring the web pages that claim Automark is absolutely useless (it isn't; it can be a very handy tool), has anyone found a way to AutoMark with leading, trailing, or embedded punctuation characters such as !@#$%^&*()_+?

(Note the clever way I did/did not include the question mark :evilgrin:)

I could write my own Automark I know, and may be reduced to doing that.
An expensive day out: Wallet and Grimace

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: How to automark special characters (Word 2003 and on)

Post by Rudi »

Try to perform a search-and-replace on the punctuation characters and replace them with a specific unique character. To restore the document, replace the specific characters again with the punctuation characters.
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: How to automark special characters (Word 2003 and on)

Post by ChrisGreaves »

Rudi wrote:Try to perform a search-and-replace on the punctuation characters ...
Thanks Rudi :cheers: ; this will work in specific circumstances (one user indexing Twitter stuff replaced "#" with "Z" and his luck held).
It can be implemented by replacing a punctuation character (in the example given "#") with an escape sequence "zxcvb" but two pitfalls arise:-
(1) Foreign languages are now being indexed and
(2) I worry that longer strings can skew page number references.

I am toying with a very clever scheme (well, it is me that's toying!) to recognize which special characters are being used in the Rules, eliminating them from my set of punctuation characters that define word-strings, building the concordance table for AutoMark as usual, then running the special-character strings through my own Automark.
It's not tricky, but my own AutoMark code will probably be a hundred times slower than the built-in code, so using my AutoMark code only on special-character strings is a compromise.

Before I start this I thought to ask if I have overlooked something about AutoMark.

Apparently not.
It is, after all, the product of Microsoft's imagination.
An expensive day out: Wallet and Grimace

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: How to automark special characters (Word 2003 and on)

Post by Rudi »

Personally, I'd wait for Paul Edstein (Macropod) or Jay Freedman to add some comments before doing anything excessive.
They always have some trick up their sleeves... :grin:
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
Jay Freedman
Microsoft MVP
Posts: 1313
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: How to automark special characters (Word 2003 and on)

Post by Jay Freedman »

If the number of special characters you need to work with is 10 or less, create a mapping of the special characters to the digits:
"1" = "!"
"2" = "@"
"3" = "#"
etc. The built-in AutoMark will recognize digits wherever they appear in words in the text. (By the way, as late as Word 2013 it won't recognize punctuation marks.)

First, replace any digits that appear in the original main document, with the same digits marked by some formatting (e.g., colored red) that can be found later. You need to protect them against the penultimate step of the procedure.

Next, do a replace-all of each special character with its corresponding digit, in both the main document and the left column of the concordance document. (The special characters may also appear in the right column, and if they do then they'll appear in the final index.) In the main document, these digits won't have any of the formatting used in the first step.

Then run the AutoMark.

Now do a replace-all of each digit without the formatting (e.g., color Automatic) with its corresponding special character to return the main document to its original text.

Finally, replace digits with extra formatting with themselves minus the formatting.

All this is fairly tedious, but easily programmed as a macro.