Correcting Misspelled Words

In our last episode, I provided a macro to make a list of misspelled words found in a document. You'll find the macro here:

http://lists.topica.com/lists/editorium/read/message.html?mid=1720027612

So you've got your list; now how do you use it?

The way *I* recently used it on a multivolume typesetting project was to automatically fix a bunch of archaic (along with just plain wrong) spellings. Here's what I did:

1. Sorted the misspelled words alphabetically.

2. Removed duplicates.

3. Put each word beside itself, separated by a pipe symbol, so the lines looked like this:

fulfil|fulfil

fulness|fulness

kanyon|kanyon

4. Corrected the spelling of the words on the right side of the list:

fulfil|fulfill

fulness|fullness

kanyon|canyon

5. Used the list with my MegaReplacer program to automatically replace the misspelled words on the left with the correctly spelled words on the right--in all the chapters of all the volumes. Whew! More on MegaReplacer here:

http://www.editorium.com/14843.htm

Of course, it would have been nice to have a macro that did steps 1 through 3 for me (sort misspelled words, remove duplicates, put each word beside itself). So I made one. And I'll share:

'THE MACRO STARTS HERE
Sub MakeCorrectionList()
'Define variables
Dim Para1$
Dim Para2$
Dim aPara
'Sort words alphabetically
Selection.WholeStory
Selection.Sort
'Delete duplicate words
Selection.WholeStory
For Each aPara In ActiveDocument.Paragraphs
Para2$ = aPara
If Para1$ = Para2$ Then
aPara.Range.Delete
Else
Para1$ = Para2$
End If
Next
'Duplicate list side by side
'with pipe symbol separating
Selection.WholeStory
Selection.ConvertToTable _
Separator:=wdSeparateByParagraphs
Selection.Copy
Selection.InsertColumnsRight
Selection.Paste
Selection.Tables(1).Select
Selection.Rows.ConvertToText _
Separator:="|", NestedTables:=True
'Add code indicating Match
'Case and Whole Word Only
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p"
.Replacement.Text = "+&^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute _
Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
End Sub
'THE MACRO ENDS HERE

If you don't know how to use such macros, you'll find instructions here:

http://lists.topica.com/lists/editorium/read/message.html?mid=1706922855

That last bit, "Add code indicating Match Case and Whole Word Only," is for use by MegaReplacer, and it will add +& at the end of each entry. In addition, at the bottom of the list, you'll get one final carriage return preceded by +&. You should delete that line before using the list with MegaReplacer.

You may find other uses for the macro as well--or at least pieces of it. For example, this part will delete duplicate paragraphs (i.e., single words on a line) in any list:

'THE MACRO STARTS HERE
Sub DeleteDuplicates()
'Delete duplicate words (i.e., paragraphs)
Dim Para1$
Dim Para2$
Dim aPara
For Each aPara In ActiveDocument.Paragraphs
Para2$ = aPara
If Para1$ = Para2$ Then
aPara.Range.Delete
Else
Para1$ = Para2$
End If
Next
End Sub
'THE MACRO ENDS HERE

And the following part will create a two-column table with the list of words in each column. You can then use the table as the basis for an index concordance. More here:

http://lists.topica.com/lists/editorium/read/message.html?mid=1716989880

http://lists.topica.com/lists/editorium/read/message.html?mid=1714146574

http://lists.topica.com/lists/editorium/read/message.html?mid=1717207977

http://lists.topica.com/lists/editorium/read/message.html?mid=1717249352

'THE MACRO STARTS HERE
'Sub MakeConcordanceTable()
'Duplicate list side by side in a table
Selection.WholeStory
Selection.ConvertToTable Separator:=wdSeparateByParagraphs
Selection.Copy
Selection.InsertColumnsRight
Selection.Paste
End Sub
'THE MACRO ENDS HERE

_________________________________________

READERS WRITE

Niquette Kelcher wrote:

I have a wildcard question for you that I haven't been able to figure out. I'd like to supply the answer to my students, who have been trying to figure it out with me.

If I have a manuscript with "Titles in Quotations Like This", how do I italicize the title AND get rid of the quotation marks at the same time? My incorrect approach is as follows -- it italicizes the text but doesn't get rid of the quotation marks. I feel I'm missing something obvious!

Find: "*" (use wildcards)

Replace: ^& (Ctrl + I)

Your help would surely be appreciated!

I responded:

You'll need to put the asterisk inside parentheses so it functions as a "group":

Find: "(*)" (use wildcards)

Then use the "Find What Expression" code as the replacement for the text found by the group:

Replace: 1 (Ctrl + I)

More information here:

http://lists.topica.com/lists/editorium/read/message.html?mid=1706365638

--------------------------------

Ed Millis wrote:

I write/edit technical report documents. I am not in charge of creating them; they are simply emailed to me or handed over on a CD, and I get to insert data and format to a fine finish. Either the document or the data can come in any format or mixture of styles, including web page and Excel file, and with or without automatic bullets, lists, and indents.

So the first thing I do is reformat everything to a Normal style, no automatic anything, and set my tabs. Then, as I go through the document, I apply formatting or style to create headings and table or figure labels.

The last thing I do with one of these reports (often up to 200 pages) is print out a low-resolution non-color copy so I can go over it with pen in hand to ensure all tables and figures are numbered correctly and correspond to their text mention, make sure every paragraph has the proper indent and reference (every (a) has a (b), and it's not (b) when it should be (2), and I didn't overlook any abbreviations.

Has anything crossed the desk of the Editorium that might make dealing with those last items a bit easier?

I responded:

No. But it's an interesting question. I'll look into it.

Not having been able to find an answer, I appeal to you, gentle reader. Do you have a solution for Ed?

Many thanks to Niquette and Ed.

_________________________________________

RESOURCES

Need an online style guide for easy reference? Try the Wikipedia Manual of Style:

http://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style

Need something more thorough? Try the Guide to Grammar and Style, by Jack Lynch at Rutgers:

http://andromeda.rutgers.edu/~jlynch/Writing/

Listing Misspelled Words

I've been working on a really big set of really big books that use odd, archaic spellings. Wanting to modernize those spellings, I decided to create a macro that would list every word that Microsoft Word sees as misspelled. You'll find the macro a little farther down, but before using it, you'll need to tell the macro where the misspellings are to be recorded. There are three options:

OPTION 1

List the errors at the end of your document.

OPTION 2

List the errors in a new document.

OPTION 3

List the errors in the document in the next window, such as a new, blank document you've already created.

You'll specify the number of your option in the following line in the macro:

myOption = 1

If you use option 3, you can use my MultiMacro program to run the macro on a whole folder full of documents, which will give you a nice, long list of misspellings at the end of your MultiMacro list (assuming your documents have misspellings). More information here:

http://www.editorium.com/14844.htm

Once you've got that list, you can use it to *automatically* fix the misspellings. How? Stay tuned; I'll reveal the secret (and give you another macro) next week.

And now, here's the macro:

'THE MACRO STARTS HERE
Sub ListSpellingErrors()
Dim myDoc As Document
Dim myErrorCount As Integer
Dim e As Integer
Dim myOption As Integer
'*****************
'CHOOSE ONE OF THE FOLLOWING
'THREE OPTIONS:
'OPTION 1
'List the errors at the end of
'your document.
'OPTION 2
'List the errors in a new
'document.
'OPTION 3
'List the errors in the document
'in the next window, such as a new,
'blank document you've already created,
'or a MultiMacro list.
'Specify the number of your option
'in the following line:
myOption = 1
'*****************
'Macro specifies the current document:
Set myDoc = ActiveDocument
'Macro tells Word the document hasn't
'already been spell-checked
'(whether it has or not):
myDoc.SpellingChecked = False
'But if you want Word to remember
'spell-checking you've already done,
'put an apostrophe in front
'of the command above, which turns
'off the command.
'Macro counts the number of errors
'in the document:
myErrorCount = myDoc.SpellingErrors.Count
If myOption = 1 Then
Selection.EndKey Unit:=wdStory
ElseIf myOption = 2 Then
Documents.Add
ElseIf myOption = 3 Then
If Windows.Count >= 2 Then
WordBasic.NextWindow
Else
MsgBox "Only one document open."
GoTo EndMacro
End If
End If
'Now type the misspellings into
'the specified location:
For e = 1 To myErrorCount
Selection.TypeText Text:=myDoc.SpellingErrors(e)
Selection.TypeParagraph
Next e
If myOption = 3 Then
WordBasic.NextWindow
End If
EndMacro:
End Sub
'THE MACRO ENDS HERE

If you don't know how to use such macros, you'll find instructions here:

http://lists.topica.com/lists/editorium/read/message.html?mid=1706922855

_________________________________________

READERS WRITE

Eric Fletcher wrote:

In your February 24 Editorium Update, you quoted Alan Shepard's note about images being messed up, and then a tip about printing without images. I am a big promoter of using only linked rather than embedded images. This not only keeps a Word document smaller but also leaves the source image unchanged. Moreover, if you have all linked images saved in a specific folder relative to the documents, you have the means to manage some otherwise complicated print issues.

For example, if I need to produce a publication for both screen viewing (or low-res print) and a high quality photosetter (offset press, for example), I prepare the images in the best quality for the latter and save them in a folder below where the Word documents are being saved (I use "art/highres"). I then copy the images "up" one level, and prepare the Word document with links to the named images within the "art" folder. This lets me print in the best quality possible for the photosetter, but can really bog down a lower resolution printer--and makes screen refresh irritating and unnecessarily slow.

So here's the trick: To prepare the lower-res version, I then use a batch function of an image editor to make copies of all of the high-res images in a more suitable resolution and save them to a different folder (I use "art/lowres") without changing their names. I then copy everything from this folder up into the "art" folder, replacing the high res versions. The links within the Word documents now point to lower-res versions of the same named images (i.e., a field like { INCLUDEPICTURE "art/c03f12migration.tif" d } will point to whatever image is named "c03f12migration.tif" in the "art" folder, so Word will use that image when the page is recalculated for display or printing).

Using the same approach, I could have the batch routine in my image editor alter the images to retain the dimensions but remove all content (turn lightness to 100% for example) and resave to a third folder ("art/nores" maybe?). Copying these images up to replace the ones in my target "art" folder would then result in a document linking to "empty" images--and since the sizes would be the same, any text flow would not be affected. (This would mimic the placeholder behaviour Word provides through the Options View dialog.)

Word can do a lot, but it was never designed to be an image processor.

Many thanks to Eric!

_________________________________________

RESOURCES

The fabulous (in my opinion) Wikipedia uses some excellent "misspelling" lists to maintain consistency. You, too, can use these lists, if you want to. They're available here:

http://en.wikipedia.org/wiki/Wikipedia:List_of_common_misspellings

The lists could be used (with a little tweaking) with my MegaReplacer program:

http://www.editorium.com/14843.htm

Wordperfect Weirdness Revisited

Back in January 2003 I published an article called "WordPerfect Weirdness," which featured a macro for converting "special" characters (dashes, quotation marks, and the like) in a file imported from WordPerfect to Word. You can read the article here:

http://lists.topica.com/lists/editorium/read/message.html?mid=1711839353

Unfortunately, the macro isn't reliable with more recent versions of Word, and I needed an updated version (some of those authors are still using WordPerfect). If you need one too, here it is (for PC or Macintosh; yes, it still has some WordBasic in it):

'THE MACRO STARTS HERE
Sub FixWPWeirdness()
' Courtesy of The Editorium (www.editorium.com)
Dim a
Dim i
Dim FalseChar$
Dim TrueChar$
Dim ThisChar
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
'Check for platform
a = InStr(WordBasic.[AppInfo$](1), "Macintosh")
For i = 1 To 6
'Set find and replace variables
Select Case i
Case 1
FalseChar$ = "C"
If a Then
TrueChar$ = Chr(209)
Else
TrueChar$ = Chr(151)
End If
Case 2
FalseChar$ = "B"
If a Then
TrueChar$ = Chr(208)
Else
TrueChar$ = Chr(150)
End If
Case 3
FalseChar$ = "A"
If a Then
TrueChar$ = Chr(210)
Else
TrueChar$ = Chr(147)
End If
Case 4
FalseChar$ = "@"
If a Then
TrueChar$ = Chr(211)
Else
TrueChar$ = Chr(148)
End If
Case 5
FalseChar$ = ">"
If a Then
TrueChar$ = Chr(212)
Else
TrueChar$ = Chr(145)
End If
Case 6
FalseChar$ = "="
If a Then
TrueChar$ = Chr(213)
Else
TrueChar$ = Chr(146)
End If
Case Else
End Select
'Find and replace characters
With Selection.Find
.Text = FalseChar$
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
While WordBasic.EditFindFound()
ThisChar = Asc(WordBasic.[Selection$]())
If ThisChar = 40 Then
WordBasic.EditClear
WordBasic.Insert TrueChar$
End If
Selection.Find.Execute
Wend
Next i
End Sub
'THE MACRO ENDS HERE

If you don't know how to use such macros, you'll find instructions here:

http://lists.topica.com/lists/editorium/read/message.html?mid=1706922855

For ease of use, you might want to attach the macro to a keyboard shortcut, as explained here:

http://lists.topica.com/lists/editorium/read/message.html?mid=1713088939

_________________________________________

READERS WRITE

The newsletter for February 9 featured an article called "Macros for Intuitively Reviewing Tracked Revisions":

http://lists.topica.com/lists/editorium/read/message.html?mid=1719923701

After reading the article, Hilary Powers wrote:

Regarding your tracking-review macros: I think they'd drive me crazy. Maybe I've been doing this too long, but my thought process runs purely to "keep this change" and "don't keep this change" without reference to whether the underlying text will thereby be restored or removed.

This probably works for me because I never, ever review each and every revision and decide upon its fate individually.

When I go through an edited manuscript after the author has indicated what should happen to it, I first move from one of the author's comments or adjustments to the next, eyeballing for the author's tracking color. In each case, I fix that part of the manuscript so it does what the author wants (which may or may not be precisely what the author asked for). In the process, I try to delete all the queries I've put into the text.

Then I simply approve all the changes remaining in the manuscript, holus bolus--after which I have a whole array of very quick scans to make sure that no queries escaped and nothing else bad happened as a result.

For me, that's intuitive.

Many thanks to Hilary.

_________________________________________

RESOURCES

The U.S. Department of Labor Bureau offers interesting occupational and salary information for writers and editors:

http://www.bls.gov/oco/print/ocos089.htm