An American Editor

July 16, 2018

Book Indexes — Part 3: The ABCs of Alphabetizing

Ælfwine Mischler

The alphabetizing I learned in school so many years ago — all before PCs and the Internet, of course — was easy. Go by the first letters — Bincoln, Fincoln, Lincoln, Mincoln — and if they’re all the same, look at the second, then the third, etc. — Lankin, Lanky, Lenkin, Lincoln, Linkin. I rarely had to alphabetize anything outside of school assignments (I did not organize my spices alphabetically), but I had to understand alphabetization to find a word in a dictionary, a name in a phone book, a card in a library catalog, or a folder in a file cabinet. Hunting for an organization or business whose name was just initials or began with initials was sometimes tricky, but I soon learned that if I did not find something interspersed with other entries, I could look at the beginning of that letter.

As an indexer, I have to know the conventions of alphabetizing so I can enter terms in the software program, and like so many other things in editorial work, there are different standards to follow. There are two main systems of alphabetizing — word-by-word and letter-by-letter — with some variations within each system. If you are writing an index or hiring an indexer, you have to know which system the publisher uses. Occasionally an indexer might find, in the midst of a project, that switching to the other system would be better, but this must be cleared with the publisher.

Word by Word

In the word-by-word system, generally used in indexes in Great Britain, alphabetizing proceeds up to the first space and then starts over. According to New Hart’s Rules, 2nd ed., hyphens are treated as spaces except where the first element is a prefix, not a word on its own (p. 384). However, the Chicago Manual of Style, 17th ed., treats hyphenated compounds as one word (sec. 16.60).

Letter by Letter

Most US publishers prefer the letter-by-letter system, in which alphabetizing continues up to the first parenthesis or comma, ignoring spaces, hyphens, and other punctuation.

If you are writing your own index in a word processing program, it will use word-by-word sorting. Dedicated indexing software can use either system along with variations. The following table comparing these systems uses Microsoft Word and SKY Indexing Software with various settings. (The items in the table were chosen to demonstrate how the different systems handle spaces, hyphens, commas, and ampersands. Not all of them would appear in an index. The variations on Erie-Lackawanna, for example, would normally have another word, such as “Rail Road,” following them.)

 

Entries with Same First Word

In the first edition of New Hart’s Rules, names and terms beginning with the same word were ordered according to a hierarchy: people; places; subjects, concepts, and objects; titles of works. You may see this in older books, and it occasionally comes up in indexers’ discussions. However, the second edition of New Hart’s Rules recognizes that most people do not understand this hierarchy and that alphabetizing this way is more work for the indexer. The second edition (p. 385) recommends retaining the strict alphabetical order created by indexing software.

Numbers Following Names

Names and terms followed by numbers are not ordered strictly alphabetically. These could be rulers or popes, or numbered articles or laws, etc. An indexer with dedicated software can insert coding to force these to sort correctly. If you are writing your own index in a word processor, you will have to sort these manually.

When people of different statuses — saints, popes, rulers (perhaps of more than one country), nobles, commoners — share a name, these have to be sorted hierarchically. See New Hart’s Rules, 2nd ed., section 19.3.2, and Kate Mertes, “Classical and Medieval Names” in Indexing Names, edited by Noeline Bridge.

Numerals and Symbols at the Beginning of Entries

Entries that begin with numerals or symbols may be sorted at the top of the index, before the alphabetical sequence. This is preferred by the International and British Standard, and when there are many such entries in a work. Alternatively, they may be interspersed in alphabetical order as if the numeral or symbol were spelled out, and they may be also be double-posted if they appear at the top of the index.

However, in chemical compounds beginning with a prefix, Greek letter, or numeral, the prefix, Greek letter, or numeral is ignored in the sorting.

Greek letters prefixing chemical terms, star names, etc., are customarily spelled out, without a hyphen (New Hart’s Rules, 2nd ed., p. 389).

If you are writing your own index in a word processing program, you will have to manually sort entries with Greek letters or prefixes to be ignored, and entries beginning with numerals if you do not want them sorted at the top. Dedicated indexing programs can be coded to print but ignore items in sorting, or to sort numerals as if they were spelled out.

That’s Not All, Folks

This is just the beginning of alphabetizing issues that indexers face. While most of the actual alphabetizing is done by the software, indexers have to know many conventions regarding whether names are inverted; how particles in names are handled; how Saint, St., Ste. and Mc, Mac, Mc in surnames are alphabetized (styles vary on those); how to enter names of organizations, places, and geographical features. In addition to checking the books mentioned above, you can learn more about indexing best practices and indexing standards on the American Society for Indexing website and from the National Information Standards Organization.

Ælfwine Mischler is an American copyeditor and indexer in Cairo, Egypt, who has been the head copyeditor at a large Islamic website and a senior editor for an EFL textbook publisher. She often edits and indexes books on Islamic studies, Middle East studies, and Egyptology.

February 7, 2018

Lyonizing Word: Helping Authors Write

Jack Lyon

In my previous post, Lyonizing Word: Workflow for Writing, I suggested some tools that would help authors write without the problems that are almost inevitable when working in Microsoft Word. These include inconsistent and meaningless formatting, document corruption, fouled-up footnotes, incorrect AutoCorrect “corrections,” and so on. Unfortunately, most authors already use Word and aren’t likely to change. How can we, as editors, help them create Word documents that are well-structured and clean, thus reducing our own workload?

Word itself includes a feature that helps make this possible, although I doubt that many editors or authors are even aware of it: Restrict Editing. You’ll find this feature on Word’s Ribbon interface under the Review tab.

What does it do? It prevents authors from using arbitrary, meaningless formatting, applying various fonts in various sizes higgledy-piggledy all over the place as authors are wont to do. The only formatting they can do is with styles — and then only with the styles that you allow. You will like this. And your designer will like this. And your typesetter will like this.

At first, your authors will not like this. But once they understand how it works, they should find great relief in not having to design as well as write. All they have to do — all they can do — is apply a heading style to headings, a block quotation style to block quotations, and so on. They can get on with actually writing, rather than worrying about whether this heading should be bold and that one italic, whether poetry should use Garamond or Palatino. As technical writer Brendan Rowland notes in comment 153 on the blog Charlie’s Diary, “When you’ve worked with locked/protected docs in Word, you’ll never want to work any other way. Life becomes so much easier. No more user-created spaghetti formatting — this becomes a distant memory.”

Restricting Editing

Here’s how to set up a document that restricts editing in Microsoft Word:

  1. In Word, create a new document.
  2. Click the Review tab.
  3. Click the Restrict Editing icon (far right).
  4. Put a check in the box labeled “Limit formatting to a selection of styles.”
  5. Just below that, click Settings.
  6. Put a check in the new box labeled “Limit formatting to a selection of styles.”
  7. Put a check in the box next to each style that you want your authors to be able to use. For recommendations on what those styles might be, see my article “But What Styles?
  8. Under the Formatting heading, make sure the first box is unchecked and the last two are.
  9. Click the OK button.
  10. Now, in the task pane on the right, click the button labeled “Yes, Start Enforcing Protection.”
  11. To enforce protection, enter a password, confirm it, and click OK. The password doesn’t need to be long and complex; it just needs to be something your authors won’t guess and that you will remember. In fact, something as simple as your initials will do. After you’ve entered a password, your authors can’t turn off protection, so it really is protection.
  12. Save the document.
  13. Give the document to your authors, instructing them to write their masterpieces in that document and no other.

Creating Character Styles

There is a problem with this system, however, and it’s a serious one. When you restrict formatting to a selection of styles, Word no longer allows you to use directly applied formatting like italic and bold — styles only, so no CTRL + I for you! The only way around this is to use character styles (not paragraph styles) that are set to use italic, bold, or whatever you need. And here, in my opinion, is what you need:

• Italic.

• Superscript.

• Subscript.

• Strikethrough.

What, no bold? Not unless you’re working with an author whose field requires bold — some branches of math or medicine, perhaps. But for most authors, access to bold means they’ll try to use it to format headings when they should be using a heading style, such as Heading 2 or Heading 3.

What, no underline? Again, not unless you’re working with an author whose field requires it. Otherwise, some authors will use underlining when they should be using italic — a holdover from the days of the typewriter.

Now you need to add the character styles to your document. Here’s how:

  1. For the time being, stop enforcing protection on the document. Otherwise, you won’t be able to create a new style. You remember your password, right?
  2. Click the little arrow at the bottom right of Home > Styles to open the Styles task pane on the right.
  3. At the bottom of the task pane, click the little New Style icon on the bottom left.
  4. Give your style a name, such as Italic.
  5. In the box labeled “Style type,” click the dropdown arrow and select Character. This is key to making this work.
  6. Under Formatting, click the Italic button.
  7. Click the OK button.
  8. Repeat the process for any other character styles your authors will need.
  9. Again enforce protection for the document.

A side benefit to using character styles is that they can be imported into InDesign, where they can be set to use whatever formatting is needed — something that isn’t possible with directly applied formatting like italic or bold.

Creating Keyboard Shortcuts

So now the character styles are available, but only from the Styles task pane. Not very convenient; your authors are going to want their CTRL + I back. Here’s how to provide it:

  1. Under the File tab, click Options > Customize Ribbon.
  2. Click the button labeled “Keyboard shortcuts: Customize” on the bottom left.
  3. In the Categories box on the left, scroll to the bottom and select Styles.
  4. In the Styles box on the right, select the style you created earlier (such as Italic).
  5. Put your cursor in the box labeled “Press new shortcut key” and, well, press a new shortcut key. Let’s use CTRL + I for our italic character style.
  6. Click the dropdown arrow in the box labeled “Save changes in:” and select your document. Now your keyboard shortcut will be saved in the document rather than in your Normal template. Don’t skip this step!
  7. Click the Assign button on the lower left.
  8. Click the Close button on the lower right.
  9. Click the OK button.
  10. Save your document.
  11. Give the document to your authors.

Now when your authors select some text and press CTRL + I, the Italic character style will be applied, so they can work without using the mouse to select the Italic style in the Styles task pane. Easy, intuitive, perfect. Rinse and repeat, with the appropriate keyboard shortcuts, for your other character styles.

At this point, you may be wondering why I didn’t just create this document for you. Stay tuned; next time I will, with a few little extras to make your life easier. But if you ever need to do all of this yourself, now you know how.

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals, Wildcard Cookbook for Microsoft Word, and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

October 10, 2016

Lyonizing Word: Using Two-Part Buttons

by Jack Lyon

Nearly a year ago, I explained some secrets of Microsoft Word’s Ribbon interface (see Lyonizing Word: Secrets of the Ribbon), including two-part buttons like the one that activates FileCleaner in Editor’s ToolKit Plus 2014.

At first glance, this button looks ordinary, with a graphic icon at the top and a tiny arrow at the bottom:

filecleaner-button

Click the arrow, and you’ll get a dropdown list of FileCleaner’s features:

filecleaner-dropdown

What many people don’t realize, however, is that the FileCleaner button is a two-part button. If you hover your cursor over the button, you’ll see a horizontal line splitting the button in two:

filecleaner-split

The bottom half, with the arrow, works just as before. But the top part is a different matter. If you click it, you’ll get full access to all of FileCleaner’s batch cleanup options:

filecleaner-batch-options

Microsoft Word’s Ribbon interface includes quite a few two-part buttons, but if you don’t know about them, you may not be using Word as efficiently as you could. There’s no sure way to spot them without hovering your mouse pointer over them, although they always include a tiny black arrow (as do many one-part buttons). A good example is the Paste button on the Ribbon’s Home tab:

paste-button

If you hover your mouse pointer over that button, you’ll see that it has two parts:

paste-button-split

Click the part with the arrow, and you’ll have access to various paste options. Pretty neat!

So what other buttons have two parts? Here is the complete list, along with the default options you’ll see if you click each button’s arrow (as opposed to its icon). Please note that what you’ll see may vary depending on what’s going on in Word.

Home tab

Paste

paste-button-split

paste-options

Text Highlight Color

text-highlight-color

text-highlight-color-options

 

Font Color

font-color

font-color-options

Bullets

bullets

bullets-options

Numbering

numbering

numbering-options

Shading

shading

shading-options

Borders

borders

borders-options

Find

find

find-options

Styles

styles

styles-options

Insert

My Add-ins

my-add-ins

my-add-ins-options

Signature Line

signature-line

signature-line-options

Object

object

object-options

Equation

equation

equation-options

Design

Document Formatting

document-formatting

document-formatting-options

References

Next Footnote

next-footnote

next-footnote-options

Citations & Bibliography > Styles

citation-styles

citation-styles-options

Review

Comments > Delete

delete

delete-options

Tracking > Display for Review

display-for-review

display-for-review-options

Tracking > Reviewing Pane

reviewing-pane

reviewing-pane-options

Tracking > Track Changes

track-changes

track-changes-options

Changes > Accept

accept

accept-options

Changes > Reject

reject

reject-options

View

Macros > Macros

macros

macros-options

I believe that’s all of them, although there’s one that’s not on the Ribbon that you should be aware of — the Undo button, which you’ll see at the top left of your Word window:

undo

undo-options

Here, you can select items en masse and undo them. Is that useful? Maybe sometimes.

One thing you can say about Microsoft Word: It’s not lacking in features. If anything, it has more features than most people will ever use (see Lyonizing Word: The Right Tool for the Job). I hope this article will help you find some useful features that you may not currently be aware of.

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals, Wildcard Cookbook for Microsoft Word, and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

October 19, 2015

Lyonizing Word: Secrets of the Ribbon

by Jack Lyon

From the beginning, Microsoft Word used a standard menu interface that looked like this:

Word's Original Menu Interface

Word’s Original Menu Interface

Click a menu item, and you’d get a list of more items:

Original Menu Interface Submenus

Original Menu Interface Submenus

Keep clicking, and eventually you’d activate the feature you wanted to use. All of this was straightforward. Then came Microsoft Word 2007, with its “Ribbon” interface:

The Ribbon Interface

The Ribbon Interface

According to Microsoft, the idea was to bring Word’s “most popular commands to the forefront” rather than burying them under a series of menus. For users, this took considerable getting used to, but, mostly, it worked. Unfortunately (and a little ironically), a few of the Ribbon’s features are still less than obvious, which prevents some users from understanding the full power of the features available to them.

Feature 1: Split Buttons

Most of the buttons on the Ribbon interface are just that—buttons. For example, here’s what the NoteStripper button looks like in my Microsoft Word add-in Editor’s ToolKit Plus 2014:

Notestripper Split Button

Notestripper Split Button

If you click that button, either on the pencil-sharpener icon or on the little arrow underneath it, here’s what you’ll get:

The Notestripper Menu

The Notestripper Menu

But now consider the button for FileCleaner, also included with Editor’s ToolKit Plus 2014. At first glance, it looks like the same kind of button used for NoteStripper, with a graphic icon at the top and a tiny arrow at the bottom:

The FileCleaner Button

The FileCleaner Button

Click the arrow, and here’s what you’ll get:

The FileCleaner Menu

The FileCleaner Menu

What many people don’t realize, however, is that the FileCleaner button is a split button. If you hover your cursor over a split button you’ll see a horizontal line splitting the button in two:

Seeing the Split

Seeing the Split

The bottom half, with the arrow, works just as before. But the top part is a different matter. If you click it, you’ll get full access to all of FileCleaner’s batch cleanup options:

FileCleaner Dialog

FileCleaner Dialog

Unfortunately, many people don’t realize that these options exist, which means that they’re missing much of the program’s power. This isn’t my fault, by the way; it’s a result of the way Microsoft designed the Ribbon (although possibly I should use two FileCleaner buttons, one for individual items and one for batch options). At any rate, now that you understand the problem, you can do a bit of exploring, looking for buttons that offer more than at first appears.

Feature 2: Dialog Box Launchers

At the bottom right of many of the groups on the Ribbon is a tiny box with an arrow:

The Tiny Arrow

The Tiny Arrow

Some users overlook these arrows completely, missing some of Word’s most useful features. Microsoft calls these arrows “Dialog Box Launchers,” and if you click one of them, you’ll see more options related to its particular group. Usually these options appear in a dialog box (hence the name) but sometimes in a task pane. For example, if you click the launcher in the “Paragraph” group, you’ll get the dialog box for paragraph formatting:

Launch of the Paragraph Dialog

Launch of the Paragraph Dialog

If you’re now saying “So that’s where that went,” I’m glad I could be of help. Again, it’s worth the effort to systematically explore all of the features that are hidden under these “launchers.”

Feature 3: Contextual Menus

Some of the items on the Ribbon are contextual — that is, they don’t appear until you’re actually working with something for which they’re needed. Tables provide a good example. If your document includes a table, and your cursor is actually in that table, you’ll see the following menu on the Ribbon:

Table Tools

Table Tools

Click it, and you’ll get this:

Table Contextual Menu

Table Contextual Menu

Wow, lots of options! But if you didn’t know about contextual menus, you might miss them. Other contextual menus appear if you’re working with any of the following:

  • Headers or footers
  • Text boxes
  • Graphics
  • Clip art
  • Equations
  • Shapes
  • SmartArt
  • WordArt

There are probably other items that use contextual menus, but those are the most obvious ones that come to mind. Remember, contextual menus show up only when they’re needed, so keep an eye out for them; you’ll be glad you did.

Now that you know some of the secrets of the Ribbon, would you say that Microsoft succeeded in using it to bring Word’s “most popular commands to the forefront”? Or does the Ribbon actually hide more features than it reveals? Perhaps more important, do you like the Ribbon, and if so, how do you use it to work more effectively? What do you think?

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals, Wildcard Cookbook for Microsoft Word, and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

Looking for a Deal?

You can buy Editor’s Toolkit Plus 2014 in a package with EditTools and PerfectIt and at a special savings of $78 off the price if bought individually. To purchase the package at the special deal price, click Editor’s Toolkit Ultimate.

June 9, 2014

Lyonizing Word: Formatting with Macros

Formatting with Macros

by Jack Lyon

Most users of Microsoft Word format text by selecting a paragraph and then applying a font. More advanced users apply a style. Why? Because then if they need to change the formatting of, say, level-2 headings, they can simply modify the style rather than tediously selecting each heading and applying a different font. (If you’re reading this, you’re probably one of those advanced users.) But there is a way to handle formatting that is even more powerful.

Suppose that you’ve dutifully applied styles to the various parts of a document, but then your client asks you to change the font—everywhere in the document—from Times New Roman to Adobe Garamond. You could manually modify each style, but if there are dozens of styles in use, there is a better way. That way is a macro, like this one:

Sub SetFontInAllStyles()
Dim aStyle As Style
For Each aStyle In ActiveDocument.Styles

aStyle.Font.Name = “Adobe Garamond”

Next
End Sub

Well, that was easy. Let’s look at each line of the macro (excluding the first and last lines, which simply define the beginning and end of the macro).

Dim aStyle As Style

That line dimensions (defines) a variable, aStyle, as a style. (As with all variables, I just made up the name “aStyle.”) At one point as the macro runs, aStyle might represent the style Heading 1. At another point it might represent Heading 3. But it will always represent a style.

For Each aStyle In ActiveDocument.Styles

Here’s where things get interesting. That line tells the macro to cycle through each style (represented by aStyle) in all of the styles in the active document (the document in which your cursor is currently sitting).

aStyle.Font.Name = “Adobe Garamond”

That line tells Word to set the font for the style currently being represented by aStyle to be Adobe Garamond.

Next

That line tells Word to go to the next style in the document.

When you run the macro, it will cycle through each style in the document (For Each…Next) and set Adobe Garamond as the font used in that style.

But what if you want to change the font only in heading styles (Heading 1, Heading 2, and so on)? Try this:

Dim aStyle As Style
For Each aStyle In ActiveDocument.Styles

If InStr(aStyle.NameLocal, “Heading”) Then aStyle.Font.Name = “Adobe Garamond”

Next
End Sub

Here’s the line of interest:

If InStr(aStyle.NameLocal, “Heading”) Then aStyle.Font.Name = “Adobe Garamond”

The line uses a macro command we haven’t seen before, InStr, which checks to see if a specific string of text is used somewhere. In this case, it checks to see if the text “Heading” appears in the name (NameLocal) of the style currently represented by aStyle. If it does, then the name of the font used in that style is set to Adobe Garamond.

You could even specify the exact name of the style to be changed:

If aStyle.NameLocal = “Block Quote” Then aStyle.Font.Name = “Adobe Garamond”

And that should give you an idea of how to modify a bunch of styles, all at once (between “For Each” and “Next”), to use various fonts:

If aStyle.NameLocal = “Poem” Then aStyle.Font.Name = “Arial”

If aStyle.NameLocal = “Author” Then aStyle.Font.Name = “Apple Boy”

If aStyle.NameLocal = “Subtitle” Then aStyle.Font.Name = “Constantia”

Much more can be done to automate the formatting of text using macros. I hope this brief article will get you started.

How to Add Macro to Word & to the QAT

Here’s how to put this macro (or any other) into Microsoft Word so it will be available when you need it:

  1. Copy the text of the macro, starting with the first “Sub” and ending with the last “Sub.”
  2. Click the “View” tab on Microsoft Word’s ribbon.
  3. Click the “Macros” button.
  4. Type a name for the macro in the “Macro name” box — probably the name used after the first “Sub.” For this macro, that’s “CleanCellEndSpaces.”
  5. Click the “Create” button.
  6. Delete the “Sub [macro name]” and “End Sub” lines that Word created in the macro window. The macro window should now be completely empty (unless you already have other macros in there).
  7. Paste the macro text at the current insertion point.
  8. Click “File,” then “Close and Return to Microsoft Word.”

To actually use the macro:

  1. Place your cursor at the beginning of the document.
  2. Click the “View” tab on Microsoft Word’s ribbon.
  3. Click the “Macros” button.
  4. Click the name of your macro to select it.
  5. Click the “Run” button. (If you wanted to delete the macro, you could press the “Delete” button instead.)

Here’s how to put the macro on Word’s QAT (Quick Access Toolbar):

  1. Locate the QAT (it’s probably on the top left of your screen either above or below Word’s Ribbon interface).
  2. Right-click the QAT.
  3. Click “Customize Quick Access Toolbar.”
  4. Under “Choose commands from:” click the dropdown list and select “Macros.”
  5. Find and select your macro in the list on the left.
  6. Click the “Add” button to add it to the QAT.
  7. Click the “OK” button to finish.

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

May 5, 2014

Lyonizing Word: Removing Spaces at the End of Table Cells

Removing Spaces at the End of Table Cells

by Jack Lyon

Authors do funny things. Sometimes these things are inadvertent; sometimes they’re the result of trying to “prettify” documents for publication. In either case, editors have to clean up what the authors have done.

One such problem is spaces at the ends of table cells. A table cell should end with the text it contains. If there are spaces after that text, they can cause alignment (and other) problems if they’re allowed to persist into typesetting.

It should be a simple matter to clean up the extraneous spaces: Search for a space followed by an end-of-cell marker and replace with just an end-of-cell marker. But what magic code can we use to find or replace an end-of-cell marker? As it turns out, there isn’t one. But we can still get rid of those spaces with a macro. Here it is, with comments about what’s going on (text following a single quotation mark is a “comment”, which is also in green for clarity):

The Macro

Sub CleanCellEndSpaces()

‘Define variables (that is, containers for information)
Dim aTable As Table
Dim aCell As Cell
Dim aRow As Row
Dim aColumn As Column
Dim aRange As Range ‘That is, a specific area of the document
Dim aLen As Integer ‘That is, a number
Dim LastChar As String ‘That is, a string of characters (text)

Dim Tracking As Boolean ‘True or False
Tracking = ActiveDocument.TrackRevisions ‘Get setting of revision tracking
ActiveDocument.TrackRevisions = False ‘Turn off revision tracking

On Error Resume Next ‘In case of tables with “vertically merged” cells
‘Cycle through tables, rows, and cells

For Each aTable In ActiveDocument.Tables
For Each aRow In aTable.Rows
For Each aCell In aRow.Cells

CheckAgain:

Set aRange = aCell.Range ‘Set aRange variable to the contents of the current cell
aRange.End = aRange.End – 1 ‘Don’t include the end-of-cell marker
aLen = Len(aRange.Text) ‘Get the length of the cell’s text
aString = aRange.Text ‘Assign the text to a variable
LastChar = Right(aString, 1) ‘Get the last character of the text
If LastChar = ” ” Then ‘If the last character is a space

aRange.Text = Left(aRange.Text, aLen – 1) ‘Set the text to be itself minus the trailing space
GoTo CheckAgain ‘Go back and check for another space (there may be several)

End If
Next aCell
Next aRow
Next aTable

ActiveDocument.TrackRevisions = Tracking ‘Set revision tracking back to its original state

End Sub

The Explanation

Here’s how the macro works.

We start by “dimensioning” (defining) our variables, like this:

Dim aTable As Table

“aTable” is an arbitrary name; I just made it up. But that whole line tells Word that aTable will represent a table in our document. The other “Dim” statements follow suit, with “aCell” representing a table cell, “aRow” representing a table row, and so on.

These three lines deserve special attention:

Dim Tracking As Boolean
Tracking = ActiveDocument.TrackRevisions
ActiveDocument.TrackRevisions = False

Dimensioning the “Tracking” variable as Boolean tells Word that the variable will be either true or false; those are the only two values it can hold.

Next, we set “Tracking” to the value of ActiveDocument.TrackRevisions. If revision tracking is on, “Tracking” will be set to “True.” If revision tracking is off, “Tracking” will be set to “False.” We do that to remember the current setting for revision tracking, because the next line, “ActiveDocument.TrackRevisions = False” actually turns revision tracking off (we’ll reset it later). This is necessary because (1) tracking the deletion of those extraneous spaces isn’t needed, and (2) using revision tracking may send this macro into an endless loop as it keeps “finding” the character that it just deleted (but is still there as a tracked revision).

The next line —

On Error Resume Next

— needs to be there in case a table includes “merged” cells, which will cause an error when the macro runs. If that happens, the macro will skip to the next line, which means that tables with “merged” cells will be ignored. There may be a better way to deal with such tables, but I don’t know what it is.

After that line, things get really interesting:

For Each aTable In ActiveDocument.Tables

This tells Word to work on “Each” table in ActiveDocument.Tables. “What’s that?” you ask. Well, obviously “ActiveDocument” is the active document — the document that’s open in Word with our cursor moving around in it. (Other documents may be open but not active.) In the active document, there’s a collection of objects called “Tables” — which are, of course, the tables in the document.

And now, a brief digression: As far as macros are concerned, a Microsoft Word document is “simply” a collection of various objects, such as tables, headers, footers, footnotes, endnotes, paragraphs, words, and much, much more. All of these objects have certain “properties.” For example, a paragraph may have the property of FirstLineIndent set to “True” — in other words, its first line is indented. Objects can also contain other objects. For example, a table always contains at least one row and one column. So, in our macro, we have this:

For Each aRow In aTable.Rows

That tells Word to work on each row in the current table. Similarly, this —

For Each aCell In aRow.Cells

— tells Word to work on each cell in the current row.

Next, we’re going to set the range of text we want to use (that is, aRange) to be the current cell:

Set aRange = aCell.Range

Then we’ll reduce the end of that range by one character, so we don’t include the end-of-cell marker:

aRange.End = aRange.End – 1

And, using the Len command, we’ll find out the length (number of characters) included in the range’s text:

aLen = Len(aRange.Text)

Now let’s get that text by putting it into the variable called “aString”:

aString = aRange.Text

And we’ll use the Right command to find out the last character of the text string (that is, the first character on the right of the string):

LastChar = Right(aString, 1)

That looks a little complicated, but it’s actually fairly simple. Let’s say our text string is “Hi, Mom!” The “1” tells the Right command at which character to start counting (from the right of the string). In other words, LastChar is assigned the last character of the string, which in this case is an exclamation mark (“Hi, Mom!”).

But what if the last character is a space? That’s what we really we want to know. The next line will tell us if that’s the case:

If LastChar = ” ” Then

If the last character is a space, we need to get rid of it, which we can do like this:

aRange.Text = Left(aRange.Text, aLen – 1)

That line changes the text of our range to itself minus its last character (if the previous line identified its last character as a space). But what if there’s more than one space? We want to get rid of those spaces too! And that’s where the next line comes in:

GoTo CheckAgain

That sends the macro back to the “label” we’ve created at this line:

CheckAgain:

And the operation is repeated on the cell until no more spaces remain at the end of the cell.

All of the “Next” commands that follow repeat the whole operation for every cell in every row in every table of the active document. Powerful stuff!

Finally, the macro restores revision tracking to its original setting as stored in the “Tracking” variable:

ActiveDocument.TrackRevisions = Tracking

As they taught us in kindergarten, it’s good to clean up after yourself.

This article is a brief introduction to manipulating Word “objects” with macros. Future articles may explore more of those objects, along with their “properties” and “methods.” If that’s more than you want to know, you may still find the macros themselves to be useful.

How to Add Macro to Word & to the QAT

Here’s how to put this macro (or any other) into Microsoft Word so it will be available when you need it:

  1. Copy the text of the macro, starting with the first “Sub” and ending with the last “Sub.”
  2. Click the “View” tab on Microsoft Word’s ribbon.
  3. Click the “Macros” button.
  4. Type a name for the macro in the “Macro name” box — probably the name used after the first “Sub.” For this macro, that’s “CleanCellEndSpaces.”
  5. Click the “Create” button.
  6. Delete the “Sub [macro name]” and “End Sub” lines that Word created in the macro window. The macro window should now be completely empty (unless you already have other macros in there).
  7. Paste the macro text at the current insertion point.
  8. Click “File,” then “Close and Return to Microsoft Word.”

To actually use the macro:

  1. Place your cursor at the beginning of the document.
  2. Click the “View” tab on Microsoft Word’s ribbon.
  3. Click the “Macros” button.
  4. Click the name of your macro to select it.
  5. Click the “Run” button. (If you wanted to delete the macro, you could press the “Delete” button instead.)

Here’s how to put the macro on Word’s QAT (Quick Access Toolbar):

  1. Locate the QAT (it’s probably on the top left of your screen either above or below Word’s Ribbon interface).
  2. Right-click the QAT.
  3. Click “Customize Quick Access Toolbar.”
  4. Under “Choose commands from:” click the dropdown list and select “Macros.”
  5. Find and select your macro in the list on the left.
  6. Click the “Add” button to add it to the QAT.
  7. Click the “OK” button to finish.

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

March 6, 2013

When Editors and Authors Fail

There is at least one area of the manuscript process in which authors and editors equally fail: Their lack of mastery of the tools of their trade, especially Microsoft Word.

What brings this to mind are recent queries on several fora by editors and authors asking how to accomplish what I view as basic procedures in Word, as well as queries asking how to do something in Word for which they already own an add-in to Word, such as EditTools or Editor’s ToolKit Plus, that easily accomplishes the task. I would probably have ignored those fora queries were it not for a manuscript I was asked to look at which was a nightmare of formatting.

What is it about text boxes that attracts authors? What is that compels authors and editors to create yet another new style in a futile attempt to make the manuscript look visually like what they think it should look like as a typeset product? What is it about Word that seduces authors and editors into needing to try “features”? What is it about the tools we use that entices us to take the lazy way of learning how to use them?

Word is a great product except when it is the bane of my existence. I used to curse Microsoft every time I received a manuscript that was riddled with poor formatting choices and myriad styles — more styles than there are pickles in the universe, or so it seemed, and certainly more than needed — as part of the basic (Normal) template. Now I don’t curse Microsoft so much because I realize that it is us end users who succumb to the lure of Word’s “exotic” options who are the primary problem.

Have you ever wondered why Word isn’t flagging a word as misspelled when you think it should? Some basic possibilities that every Word user should know and should check before threatening to punch out their monitor are: Is spell check turned off for the document or for text to which a particular style is applied? Is the wrong language governing the manuscript? Yet, much too often neither the editor nor the author has checked these possibilities.

The problems begin with the author of the document. Every author should know how their manuscript is going to be processed. Is it going to be edited and then typeset in a program like InDesign? If yes, then why worry about “formatting” the manuscript to make it look like you want it to look when published? The reality is all that work will be for naught, and 99% of the time will be done wrong anyway.

If you are writing a manuscript that will be published in English, shouldn’t you make sure that English — not French or Spanish — is the language choice for the document? I am always amazed when I receive a manuscript  that is to be published in English and the language preference is French. Of course, the very first thing an editor should do is verify that the correct language module is being applied by Word and fix it if it is wrong — yet, I often receive for review a document that a client has had edited only to find that the wrong language module is applied.

And why text boxes? Of all the things that are wrong about Word, the text (and graphic) boxes are the absolute worst. Text boxes don’t stick in place; text boxes do not break over pages; if the text box is too big for the page or not big enough to display all of the text it holds, it gives no clue that there is hidden in-box text; text boxes obscure text and other text and graphic boxes — basically, text boxes are evil and not easy to get rid of. Need to box some text? Use a table cell. It works just as well and has none of the evil features of a text box.

More importantly for the author: If the author is paying the editor, the author will save money by not using text boxes because you can’t convert a text box to text like you can convert a table. To avoid the evils of text boxes, the editor has to find each text box, select the text, copy it, paste it outside the text box, then delete the text box — and hope that all of the text was copied.

I know it is called a text box by Microsoft; that doesn’t mean it should be used to put text in a box!

Consider the styles that you create. Is it really necessary to have 18 of the same style with the only difference being the amount the text is condensed or expanded (and why expand or condense the text?) or the fraction of an inch of spacing there is between lines (why not have equal spacing between all lines?). Of course, the editor should be cleaning out excess styles, but there are usually so many, we all give up and let it be someone else’s problem.

What is being missed from this picture is that if the manuscript is going to be professionally typeset, all of these efforts by the author and/or editor to “design” the manuscript and make sure that what is wanted on a page actually displays in Word on a single page are wasted. All will be ignored by the designer and the typesetter; they will use programs and tools appropriate to the design and composition function, such as InDesign, not Microsoft Word, which is a strong word processor but a very weak composition and design engine.

There is much more, but you have the idea. The real problem is that neither author nor editor has taken the time to master the basic tool of their trade. I know editors who use Word but do not even have a single dedicated reference book for the version of Word they are using. They prefer to stumble through, thinking that their role is limited and so they need limited features. Perhaps they do only need limited features, but they can never know if there is another feature that would make their job easier if they were aware of it in the absence of stumbling across it. (When I buy a new version of Word, I also buy several different manuals and spend a full day going through them and the new version.)

Authors use text boxes without thinking about the feature because they think to themselves “I want this material boxed” and so they use a text box — after all, why would it be called a text box if it wasn’t intended to be used to box text? Authors want text to be in columns so they use tabs (or worse, spaces) to try to align the material, when a table would be so much better. (Did they not ever notice that the text they have so beautifully aligned using tabs or spaces is no longer aligned when they change computers or fonts? Or that it often wraps and becomes confusing when moved to another computer?) Why not use the table feature? Usually authors tell me it is because they do not want lines (rules) around the material. OK, but tables do not have to have visible rules.

Authors and editors fail to create the best and least-expensive document to process because neither understands Word’s functions. If both took some time to master the basic tool of their trade, the author could save some money, and the editor could focus more on the editing and less on the peripheral matters that take up so much our time (and thus either raises the author’s cost or decreases the editor’s effective hourly rate and profit).

A lost point is that a feature’s name is not always indicative of what the feature is best used for. To know what feature to use, one must be knowledgable about the tool and all of its features. An editor should be asking, “Why do I need to ask in a forum how to change the language preference from French to English? Why don’t I know how to do this already?”

When it comes to formatting a Word document, less is infinitely better than more.

November 21, 2011

The Professional Editor: Working Effectively Online III — Mastering Word

Recall that Part I (The Professional Editor: Working Effectively Online I — The Books) of this series called for professional editors to master the tools of their trade, particularly Microsoft Word if they edit using Word. There are good reasons to do so.

A few weeks ago, I was working on a book chapter that ran 453 manuscript pages, 49 pages of which were reference citations. (Yes, the number is correct; one chapter in this project I am editing ran 453 manuscript pages. Most of the chapters run 30 to 50 manuscript pages, but several are 200+-page chapters.) The project was for a client who uses a custom template and part of my job is to apply the template to the manuscript, styling every paragraph plus applying particular styles to items that need special styling in addition to the basic paragraph style, such as applying a special “overstyle” to a word that should be in a san serif typeface.

I used the macros I had written (and mentioned in The Professional Editor: Working Effectively Online II — The Macros) to style the heads and then I had to manually style the text paragraphs as I couldn’t decipher a pattern that I could capture in a macro. It took a while to get the whole document styled and ready for editing (I like to do the master styling before I edit because that lets me determine, as I read the material, whether something needs to be styled differently), but I did finish — and because of the macros, I finished in much less time — and was prepared to begin editing.

That is when I realized I had made a mistake: I forgot to turn off Track Changes when I did the styling (I’ll prevent that from happening again by adding some code to my macros to turn Tracking off if it is on then, when the macro is done, turning it back on if it was on when the macro started). As all of us Word users know, that means a gazillion annoying balloon popups telling me when I had styled the text and the style I applied — there was no safe place for me to put my cursor! (Yes, I could have turned off show formatting in tracking, but the client wants to see certain formatting changes, so that was not a viable solution.)

It would have been an easy enough fix to just accept all changes in the document, except that I had already run my Never Spell Word and Journals macros and I did not want those changes accepted — I hadn’t edited the chapter yet and so I hadn’t approved the changes the macros made.

Here is where having some mastery of Word helps. What I needed was to have Word accept just the formatting changes and retain everything else. Because I have made an effort to learn something new about Word regularly, I knew how to solve my problem. The following steps are what I did in Word 2010 (I know this will work in Word 2007 and there should be a similar method in Word 2003 and in Mac versions of Word, but you will have to do your own exploring in those versions).

  1. I switched to the Review Tab and clicked on the tiny down arrowhead in Show Markup.
  2. I deselected everything but Formatting.
  3. I clicked on the tiny arrow in Accept and then clicked Accept all changes shown.
  4. I returned to the Show Markup dropdown and reselected everything I had deselected.

With this simple four-step process, I was able to solve my problem — only the formatting changes were accepted; all the rest of the changes that I had made using my macros remained for me to accept or reject.

This doesn’t seem like a big deal at first glance, but it was to me. If I couldn’t find a way to accept just the formatting changes, my choices would have been to (a) live with the annoyance (and I really do find it annoying) or (b) start over with the chapter and eat the time I had already spent styling this massive chapter (I charge a per-page rate, not an hourly rate, so I would have had to eat the time regardless, but even had I been charging an hourly rate I wouldn’t have charged the client — the fault was mine and it was for my convenience). Neither option was particularly welcome.

Perhaps you would have chosen to just live with the balloons. That’s okay as long as you know that there was an option to fix the problem quickly and easily. That is the essence of my clarion call to master the tools we use: knowing what our options are and not having a decision thrust upon us simply because we don’t know enough about how our tools work. Would you hire a carpenter who owned and used only a single saw blade because the carpenter didn’t know that different saw blades are used for different purposes and give different types of cuts?

We expect those we hire to perform services for us — whether they be a carpenter, a doctor, an auto mechanic, or some other tradesperson or professional — to have mastery of the tools of their profession so that they can give us knowledgeable advice. Shouldn’t we similarly be masters of the tools of our own profession?

I discussed the value of learning to write macros in The Professional Editor: Working Effectively Online II — The Macros. Absent mastery of Word, absent knowing what functions Word can perform and can’t perform, how can we learn to write macros to ease performance of those functions? A macro is merely a method to accomplish a task more quickly, efficiently, and uniformly; it is not a method to perform a function that otherwise cannot be done. Macros call upon the same commands that you do when using Word. Consequently, mastering Word, which is, for many editors, a fundamental tool, is a step toward conquering macros. Neither mastery of Word nor creation of macros lives in isolation of the other. They are interdependent and should provide an impetus for editors to master the tools they use.

(Although I focus on Word and VBA [Visual Basic for Applications] as the tools to master, I know that some of you use tools other than Word and its macro language. For example, your focus may well be InDesign or some other text program. But what applies to Word applies to the programs you use as well. The point is less learning to master Word than it is to master whatever tool you use. InDesign, as an example, also has a scripting language that can be learned and it has its own text editor, InCopy, that also warrants learning and mastering.)

Blog at WordPress.com.

%d bloggers like this: