LingWord

A collection of Word 2000 macros

for linguists (mostly)

Susanna Cumming, November 2000

This template contains a toolbar and several macros for Word 2000. For a discussion of some of the motivation for these macros, and instructions on carrying out these procedures manually, see my “Word for Linguists” site:

http://www.linguistics.ucsb.edu/faculty/cumming/WordforLinguists/Index.htm

Especially relevant are the sections on templates, styles, customization, typography, numbering and cross-referencing, and interlinear examples.

Installation

You can use LingWord.dot “as is” by making it a global template. Put it in your Word templates directory, and then go to Tools | Templates and Add-ins | Add... and select it. You’ll see it in the “Global templates and add-ins” list. Make sure the checkbox by it is checked to make the macros available to all your documents.

Alternatively, copy the toolbar and whatever macros you want to another template (for instance, “Normal.dot”). If you copy the toolbar, make sure you copy the macros too – they aren’t attached! See the Word help topic “About Templates” for instructions.

You need to enable macros in Word to access the macros in this template. Under Tools | Macro | Security, set your security level to “medium” or “low”.

StyleArea

This macro shows and hides the style area (where paragraph styles are displayed) at the left side of the screen. To adjust the width of the style area, drag the vertical bar.

AdjustSpace (4 macros)

Four macros that let you adjust the space before and after a paragraph in small increments.

Less space after: reduces the space after the paragraph by six points

More space after: increases the space after the paragraph by six points

Less space before: reduces the space before the paragraph by six points

More space before: increases the space before the paragraph by six points

ToggleQuotes

This macro toggles the Autoformat settings (under Tools | Autocorrect) for quotes and dashes (called “symbol characters”), and changes all the quotes and dashes already in the document to the new settings. If Smart Quotes is on, and you run the macro:

Smart Quotes and Symbol Characters will be turned off

All quotes in the document will be replaced by straight quotes

All em and en dashes will be replaced by double or single hyphens

If Smart Quotes is off:

Smart Quotes and Symbol Characters will be turned on

All quotes in the document will be replaced by curly quotes

Double hyphens will be replaced by em dashes, and single hyphens surrounded by spaces will be replaced by en dashes

ExampleNumber

This is a very simple macro that inserts an example number (SEQ EX field) at the cursor, surrounded by paretheses and followed by a tab, and then updates all fields in the document (so the number that shows is the correct one). You’ll need to edit the macro if you want to change the punctuation or remove the tab.

TableExample

This macro aligns and formats interlinearly glossed examples with two or more gloss lines using Word tables. It can work on a single example on one line, a block of multiline examples, or a long example spanning several lines.

Features

Accomodates a single-line example, a block of single-line examples, or a multi-line example. Any of these can be formatted in one step.

Supports any number of gloss lines.

Optionally, “cleans up” your example by removing extra tabs and spaces. It’s advisable to do this if you’re reformatting examples which were previously aligned with tabs or spaces.

Makes your example into a table with “autofit” enabled, so you can edit the example and the columns will resize to fit their content.

If the example would be adjacent to another table, inserts a blank line to prevent the two tables from merging.

Applies paragraph formatting: the example text line is formatted with the “Ex1” style, and the gloss lines are formatted with the “Ex2” style. If these styles don’t exist in your document, they will be created for you; you can then modify them to suit your needs.

Optionally, inserts a fixed-width column at the left that you can use for an example number, speaker labels, arrows etc.

Optionally, generates an automatic example number (using a SEQ field), adds punctuation that you specify (e.g. parentheses) before and after the number, and applies another paragraph format (“ExNum”) to the number. It also updates the new field and all fields in your document.

In the case of a multi-line example or an example block, the number can be applied to only the first example line or to all example lines. The latter is useful when you have several one-line examples in a row, or you want line numbers on a long example.

Optionally, creates a bookmark containing the example number and its punctuation. The bookmark is automatically named from the text of the first example line. This makes it easy to cross-reference your examples in the text.

Instructions

The macro makes a few assumptions about how your example is set up. To use the macro:

1.	Type your example, separating words by single spaces. Don’t add a number yet. You can put a blank line between example lines, or leave it out; one will be added for you.

You can have one or more interlinear gloss lines and one or more example lines. The following example has one gloss line and two example lines (this macro does nothing with the free gloss):

ini sebuah contoh

this one:CL example

yang agak panjang

that rather long

‘This is a rather long example’

2.	If there are different numbers of words in the example line and the gloss line (for instance, nonverbal material such as speaker labels, laughter or pauses that you don’t want to gloss), type a tilde (~) corresponding to the word in the other line that you want to skip. The tildes won’t appear in the final example. (If you need to use the tilde character in the text of your examples, you can substitute any character or string of characters by setting the “empty cell string” property.) For instance,

ini @@ sebuah .. contoh

this ~ one:CL ~ example

becomes

(1)	ini	@@	sebuah	..	contoh
this
one:CL
example
3.	If there is one example line, place the cursor anywhere on the last line. Otherwise (a multi-line example or a block of examples), select all the lines you want to align (not including the free gloss).

4.	You may want to save your document here. Since a macro corresponds to a series of Word commands, it isn't easy to undo with Ctrl-Z!

5.	Then run the macro: click the toolbar button, or choose Tools | Macro | Macros, selecting “TableExample” from the list, and clicking “Run”). You will see a dialog with a number of options for how you want the example to be formatted:

Choose the settings you want and click “OK”. If you choose the default options (as above), you will see a result like the following. (This bitmap represents the way the example looks if Table | Show Gridlines is on so you can see the cells.)

The number is actually a field surrounded by a bookmark. If Tools | Options | View | Field Codes and Bookmarks were checked, it would look like this: [({ SEQ EX \* MERGEFORMAT })]. The bookmark identifier generated for this example is “ini_sebuah_contoh”. If “Number all lines” were checked, there would be a bookmarked number on the second example line as well.

Options

Here’s an explanation of the choices in the options dialog:

Remove tabs and extra spaces? Check if your example might contain whitespace that you don’t want to give rise to empty cells.

Gloss lines: type an integer corresponding to the number of gloss lines for each example line. This is usually 1 (as in the above example), but could be more.

Empty cell string: a character or string of characters you use as a placeholder for a cell that should end up empty (because it has no corresponding word on the other line). This should be something that never occurs in your examples, since all instances of this string will be deleted during example processing.

Spacing around words: two fractional numbers that correspond to the amount of space (in inches) you want to leave between the edges of the words and the right and left edges of the cell.

Left column width: the width of the number column. A fractional number (inches). Type “0” if you don’t want a left column.

Add number? Check if you want an example number. The remaining options are available only if you check this box.

Number all lines? Check this if you want all lines to be numbered. If it’s unchecked, only the first will be numbered.

Auto bookmark? Check this if you want to automatically generate a bookmark for the example number(s). This is useful for cross-referencing your examples. The bookmark name will be constructed from the text of the example, modified to form a legal bookmark identifier (shortened to 40 characters; non-alphabetic characters will be removed or replaced by underscores; a number will be appended if there’s already a bookmark with the same name).

Pre- and Post-Number: Type a punctuation mark to go before or after the number. Leave these blank if you don’t want punctuation.

Sequence identifier: the identifier that will be used in the SEQ field to keep track of this number sequence. You might want to change this for each example if you are using the SEQ numbers for line numbering in an example as opposed to for example numbers.

Other aspects of example appearance, such as vertical spacing, fonts etc. should be adjusted by changing the format of the paragraph styles Ex1, Ex2 and ExNum.

The macro will remember your settings in the dialog in a single Word session. However, if you want to change the defaults in a way that persists across sessions, you will need to edit the dialog in the Visual Basic editor. This isn’t difficult, but be careful not to delete controls or alter the code associated with them.

With this template file open (so you have access to its macros), choose Tools | Macro | Visual Basic Editor.

In the “Project” pane on the top left of the editor window, find “Project (LingWord)”. Under that heading find “Forms”, and under “Forms”, double-click on “ExampleFormatDlg”. You will see the dialog open in design mode.

To change the default value of a field in the dialog, click the field once. Then look at the “Properties” pane on the bottom left of the window. Find the property called “Text” (for edit fields) or “Value” (for checkboxes). Change the value to your preference.

If you like, while you’re at it, feel free to change or remove the “skin” (background) on the dialog. Click the form background to select the form and click the ellipsis button (...) by the “Picture” property. You can choose any bitmap you like (or no bitmap at all). You may also want to change the “bitmap” property for the “Number Properties” frame while you’re at it.

The TableExample macro

Susanna Cumming

2000-11-13