< Previous Chapter | Next Chapter >

257 Chapter 10. Advanced Editing

In this chapter, you’ll learn…

In Chapter 4 we covered the basic aspects of editing text, like formatting characters and paragraphs, copying and pasting, and using headers and footers. For anyone doing a great deal of word processing, though—especially working on books and other long documents—Nisus Writer has tons of additional tools to save you time and energy and keep your documents consistent. We’ll begin with a discussion of named rulers and defined styles; which allow you to save and re-use formatting attributes easily. We’ll also explore Nisus Writer’s system of ten editable clipboards for amazing control of copying and pasting. Then, 258 we’ll look at Publish & Subscribe for linking elements from different documents, and autonumbering and cross-referencing for linking elements within a document. Finally, we’ll see how Nisus Writer can take much of the tedium out of creating indexes and tables of contents.

Defining Rulers and Styles

It’s often important to keep the style of various parts of your document consistent. For example, all headings of a certain level should look the same, all indented quotes should be indented by the same amount, and so on. In Nisus Writer, you can make your settings once, give them names, and then apply them throughout your document with a single menu command. The process is different depending on whether you’re naming paragraph attributes (rulers) or character attributes (styles), but since they go together, we’ll discuss both procedures here.

Using Named Rulers

As you’ll recall from Chapter 4, a ruler is a collection of paragraph-formatting attributes like tabs, justification, and line and paragraph spacing—that is, everything that’s set on the Text Bar. Rulers govern the shapes of paragraphs. (The coincidental mnemonic device here is the statement “Rulers govern.” Think about it.) While you can set ruler attributes for each paragraph separately, as we have seen before, you can also re-use rulers by giving them a name.

Naming Rulers

Naming rulers is very easy. With your insertion point somewhere in a paragraph with formatting you’d like to re-use, type a name in the Ruler Name box on the Text Bar (ruler names, by the way, are not case-sensitive), and press Enter or Return. Done. The name you just entered will now 259 appear in the Ruler Name menu (see Figure 10.1), and you can apply this to any paragraph in your document simply by placing your insertion point in the paragraph and choosing the name from this menu. (An alternate way of naming a ruler, the appeal of which somehow escapes me, is to choose Name Ruler from the Ruler Name menu, type in a name, and click the Name button.) The name of the ruler governing the paragraph containing the insertion point is displayed in the Ruler Name box.

Figure 10.1. The Ruler Name pop-up menu.

If you type a name for a ruler into the Ruler Name box, and press Command while pressing Return or Enter, not only will you name the ruler, but you’ll also apply that named ruler to all paragraphs in your document that have exactly the same formatting as the current paragraph! So if you’ve been working with just a few unnamed rulers, copying and pasting them all over your document, you can quickly name them all using this little trick.

Displaying Rulers

To see exactly where your rulers have been inserted, and which paragraphs use named rulers, click the Display Rulers button () on the Horizontal Button Bar. Ruler icons will appear in the margin to the left of your text (Figure 10.2). Named rulers are represented by an icon with a line through it (), while unnamed rulers are represented by a blank ruler icon (). The best way to think of these icons is that they contain the formatting information for the paragraph that follows them. This formatting will apply to all subsequent paragraphs, too, until the next occurrence of a ruler. In other words, not every paragraph will have a ruler icon in front of it, but every paragraph will be governed by some ruler—the next one up.

Figure 10.2. Document view with paragraph rulers visible.

Cutting, Copying, and Pasting Rulers

Rulers can be cut, copied, and pasted like any other text (though you can’t drag and drop a ruler icon). Click a ruler icon once to select it, then choose Copy or Cut. When pasting a ruler, first place your insertion point to the left of the first character in a paragraph. If your insertion point is inside 260 a paragraph when you paste a ruler, a return will be inserted before the ruler. To replace one ruler with another, copy a ruler, select the ruler you want to replace, and paste.

If you delete a ruler icon, the paragraph it goes with will take on the formatting of the paragraph above it, since every paragraph must be governed by some ruler. One way of deleting a ruler icon is simply to select it and press the Delete key. But you can also delete a ruler icon by positioning your insertion point at the beginning of the paragraph and pressing Delete—i.e., backspacing over it. If you do not have your rulers displayed, though, and you press Delete at the beginning of a paragraph with its own ruler, Nisus Writer will beep twice, turn on your ruler display, and display an alert warning you that you’re about to delete a ruler, which may alter the format of your text. The reason for this is to prevent you from accidentally deleting a ruler you didn’t know was there (since you couldn’t see it), screwing up your formatting. Experienced users invariably find this alert very annoying! So unless you rarely change paragraph formatting, it’s a good idea just to leave your rulers displayed all the time.

To make sure your paragraph rulers are displayed whenever you open a new document, turn the ruler display on in your Nisus New File stationery (see Chapter 9).

261 Changing Named Rulers

When you change the formatting of a paragraph governed by an unnamed ruler, only that paragraph changes, even if the following paragraph doesn’t have its own ruler. This happens because Nisus Writer automatically inserts a protective ruler in front of the next paragraph—a copy of the ruler that was previously governing it. However, things are a bit different with named rulers. Any time you make a change to a paragraph governed by a named ruler, the change is applied to every paragraph in your document that uses that ruler. Because the change happens to all paragraphs that use the ruler, no protective ruler will be inserted before the following paragraph, even if it doesn’t have its own ruler. On the other hand, if you apply a named ruler to a paragraph by choosing it from the Ruler Name menu, and the next paragraph doesn’t have its own ruler, Nisus Writer will insert a protective ruler to keep it from being changed too.

Renaming, Deleting, and Finding Named Rulers

To change the name of a named ruler, choose Name Ruler… from the Ruler Name menu, then choose the ruler you want to rename from the pop-up menu in the Name Ruler dialog box (Figure 10.3). Type in a new name, and click Rename. You might have suspected that you could change a ruler’s name by highlighting the name in the Ruler Name box, making the change, and pressing Return. But noooo…doing that adds another ruler with the new name. The Name Ruler dialog box is also the only way to delete named rulers—choose the ruler name, then click Delete. To unname a ruler (keep the same formatting for a paragraph but take away the name), select the ruler name in the Ruler Name box and press Delete.

Figure 10.3. The Name Ruler dialog box.

The Name Ruler dialog box also lets you locate the next occurrence of any ruler in your document. To do this, select the ruler name you want to find and click Find. Nisus Writer will jump to, and highlight, the next instance of that ruler. (A shortcut to finding a named ruler is to press the Shift key while choosing the ruler name from the Ruler Name pop-down menu on the Text Bar.)

262 Importing Named Rulers

There is no simple way to copy a bunch of named rulers from one document to another. However, if you copy text that includes named ruler icons from one document and paste it into another, the ruler names will be copied as well, and will appear in the new document’s Ruler Name menu. (Of course, you can also copy and paste just the ruler icon itself, if you wish). If you paste a named ruler into a document that already has a ruler by the same name, the ruler will take on the attributes defined in the document into which you’re pasting. If you copy a style from one document to another (see below), and the style has an attached ruler, the ruler will also be copied into your new document. However, it may not appear on the Ruler Name menu until you actually apply the style to a paragraph. By the way, this works even if you copy only a small piece of styled text that doesn’t include a ruler icon!

Moving Paragraphs with Rulers

As we saw in Chapter 4, when you cut, copy, or drag one or more entire paragraphs, the ruler governing the first paragraph will not be copied if it is the very first thing in the selection. The reason for this is that the ruler governing a paragraph is actually “attached to” the return character at the end of the preceding paragraph. Since this is the arrangement, we need to be careful when selecting entire paragraph(s) to include that preceding return character if we also want the ruler to be copied. Figure 10.4 shows the proper region to select. When pasting (or dropping) the selection, 263 be sure to place your insertion point just before the return character that ends the paragraph before the location where you want the text to go.

Figure 10.4.When cutting, copying, or dragging an entire paragraph, always select the return character at the end of the previous paragraph, but not the return character at the end of the current paragraph, to be sure that the paragraph formatting is copied as well.

Unfortunately, even careful selection of text doesn’t solve all of our problems. Consider the situation shown in Figure 10.5. We have two paragraphs (A and B), each with their own ruler, followed by three paragraphs (C, D, and E) with another ruler. Since there is no ruler immediately preceding D or E, they pick up their formatting attributes from the ruler preceding paragraph C. This is fine, until you decide to move paragraph D or E. No matter how you do it, when the paragraph arrives in its new location it will take on the formatting of the paragraph above it, rather than keeping its existing formatting. Why? Because paragraph formatting is stored only in the ruler icons, and there was no icon to select along with the paragraph you moved! (And no, you can’t noncontiguously select text and a ruler—drats.) This can be a problem because in most cases, when you move an entire paragraph, you want it to retain its formatting.

264

Figure 10.5. A no-win situation: no matter how you move paragraphs D or E, they won’t take their formatting with them, because there is no ruler icon immediately preceding them.

When you encounter a situation like this, it is best to copy the icon of the governing ruler and paste a copy of it in front of the paragraph before moving it. Then, select a range that goes from the preceding return character to the end of the paragraph you want to copy (as above), and cut, copy, or drag and drop. This extra procedure is not needed if each paragraph has its own ruler, but if you type a series of paragraphs without changing the format, only the first one will have its own ruler unless you explicitly insert a copy for the others.

Using Defined Styles

We have already seen how you can change the appearance of the characters in your document by using the Font, Size, and Style menus. Defined styles are a way of applying any number of these attributes with a single command, rather than applying many commands sequentially. In addition, defined styles can include named rulers as one of their attributes, meaning you can change the appearance of every character in a paragraph with a single command. This combination of styles and rulers is what most other word processing applications call “styles.”

The Define Styles Dialog Box

Defined styles are created and edited in the Define Styles dialog box (Figure 10.6), which is displayed when you 265 choose Define Styles… from the Style menu. When you first open this dialog box, the font, size, and style settings will reflect what is in effect at the current insertion point or selection. You can keep those settings or modify them in any way you wish, then type in a name for the style and click Set. When you click Done to dismiss the dialog box, your newly created style will appear at the bottom of the Style menu, and you can apply it to text just as you would any other style. Let’s look at each of the options in the Define Styles dialog box in a bit more detail.

Figure 10.6. The Define Styles dialog box.

The Style Name

The name of the currently selected style appears in the Style Name box. (If you are creating a new style, the name will be shown as “Untitled.”) The pop-up menu to the right of the Style Name box lists all the defined styles. To edit an existing style, choose its name from this menu. Or, to create a new style, choose New from the pop-up menu. When you choose New, the dialog box reverts to its default settings (Geneva 12 Black; Remove Existing Menu Styles checked; all other options unchecked). To rename an existing style, choose the style name from the pop-up menu, type in a new name for it, and click Set. (Note that this is different from 266 the way rulers are renamed!) Style names, like ruler names, are not case-sensitive. You can, if you wish, give a ruler and a style exactly the same name (though this might cause you some confusion if you ever refer to one of them in a macro or a keyboard shortcut).

Determining Which Attributes are Affected

Below the Style Name box you’ll find controls for setting the font, size, color, and character style(s) you want to use. Only the attributes that are checked will be used when you apply the style. If a given attribute is not checked, the text you apply the style to will retain its previous setting for that attribute. Checking a particular attribute means that when you apply the style, that attribute will be turned “on”—that is, it will be exactly as though you had chosen it from one of the menus. But unchecking a style does not necessarily mean it will be turned off—rather, it will simply be ignored. So these check boxes are not “on/off” switches, but rather “on/never mind” switches. For example, if you have Font checked, then applying the style will change the font to whatever is selected on the Font pop-up menu. If Font is unchecked, then applying the style will not affect the font of the selection at all. Likewise, if you have Bold checked, then all the text you apply this style to will become bold. If you want the text to which you apply the style to keep its current setting for Bold, whatever that may be, then leave Bold unchecked.

Setting Character Attributes

To create your style, then, check the box(es) of your choice. If you want your style to use a particular font or color, make the appropriate choice from the Font or Color pop-up menus. To use a particular size, choose it from the Size pop-up menu or, if the size you want isn’t on the menu, type a number from 2 to 255 in the Size box. To apply tracking as part of the style, check the Tracking box and enter a positive or negative number of points in the box. (The “proportional to font size” tracking option is not available as part of a style definition.)

267 You do not actually have to have any boxes checked at all in your style definition. Even if your style has no attributes at all, the style name will still be associated with the text to which you apply it. “Dummy” styles like these can be useful for marking text so that it can easily be located by a Find/Replace or a macro. And you can always go back and add attributes later, which all the text in that style will take on.

In addition to character styles, you’ll also notice a Format pop-up menu (Figure 10.7), which allows you to add several of the attributes found on the Format submenu of the Style menu. This pop-up also includes the commands Hyphenate, to turn on hyphenation for the text in your style, and Index and Contents, which automatically mark all text in the style for the index and the table of contents, respectively. When you choose something from the Format pop-up menu, it will have a check next to it. You can choose any or all of these attributes, or choose None if you don’t want any of the Format attributes to apply. To turn off a setting on this menu, choose it a second time.

Figure 10.7. The Format pop-up menu in the Define Styles dialog box.

Be careful when using the Index feature in a style. Normally, only single words and short phrases are indexed, but when Index is part of a style definition, the entire range of text that uses the style will be indexed as a single entry—it doesn’t index every word individually! Using Index in your style is most useful when the style will be used for special terms like technical or foreign-language words.

Style Interaction

Two very important features of the Define Styles dialog box are the Remove Existing Menu Styles and Remove Existing Defined Styles checkboxes. These determine how existing styles will be treated when your new style is applied. First, let’s suppose both boxes are unchecked. In this case, your style is completely “additive”: the attributes of your style will be added to whatever styles are currently used by the selection to which you apply it. The existing attribute(s) will only be changed if there is a conflict. However, if the original text 268 is bold and your style definition has Bold unchecked, then it will remain bold when you apply the style. And if your style contains any other attributes, like Underline, they will be added to the existing styles of your text.

However, it may be that you want to start from scratch, so that the only styles used for a selection are the ones in your style definition. To do this, check Remove Existing Menu Styles. This has the same effect as choosing Plain Text from the Style menu before applying your new style attributes. This checkbox has no effect on color, however—to change the color when you apply a style, you must explicitly check the Color box and choose the color name from the pop-up menu. Remove Existing Menu Styles only changes attributes that were applied manually. It does not affect attributes that are part of another defined style. To remove existing defined styles as well, check the Remove Existing Defined Styles box. When this box is checked, the style becomes exclusive rather than additive—applying this style will deselect any previously applied styles. However, you can add another style on top of this one, as long as the second style does not also have Remove Existing Defined Styles checked.

Duplicating and Removing Styles

If you’d like to create a new style with most or all of the attributes of an existing style, you can save time by choosing the existing style from the Style Name pop-up menu and clicking Duplicate. A new, untitled style will be created with the same attributes as your previous style. This does not “link” the styles in any way; changes made to one will be completely independent of changes made to the other. (But see “Dynamically Linked Styles” below.) To remove a defined style from your Style menu, choose the style name in the Define Styles dialog box and click the Remove button. A dialog box will appear asking if you want to remove all attributes of the style from the text in your document. If you click Yes, then all the attributes that were added to your text by that particular style will be removed. Unlike the way rulers work, you can’t remove a style without removing the attributes it applied to your text. However, removing a style does not affect the ruler that the text uses.

If you open the Define Styles dialog box and don’t make any changes, you may instinctively try to click Cancel, only to find it dimmed! Don’t worry. Clicking Done will simply dismiss the dialog box if you haven’t changed any settings.

269 Combining Styles and Rulers

So far, all the style attributes we’ve discussed apply to individual characters. It is also possible to make a style apply to an entire paragraph at a time. (This is the only type of “style” most other word processors have.) To do this, check the Make Paragraph Ruler box. With this box checked, the attributes you selected will apply to every character in the selected paragraph. Beneath the Make Paragraph Ruler command is the Ruler Name pop-up menu. If this choice is set to None, then even though the style applies to the entire paragraph, the paragraph formatting itself will not be changed. If you want to assign a particular named ruler to the paragraph in addition to changing its character formatting, choose the ruler name from this menu. In this way, you can, with a single menu command, change both the character and paragraph formatting of an entire paragraph. Style definitions that include a named ruler are said to have an “attached” ruler.

While you can add the attributes of a named ruler to a style, you cannot create a new ruler from within the Define Styles dialog box. So if you set the attributes of a style and then realize you want to attach an as-yet-unnamed ruler to it, you’ll have to close the dialog box, name your ruler, then go back and edit the style to reflect the new name. The moral of the story: for best results, name your rulers before defining your styles!

If you think styles with attached rulers are a pretty neat idea, you’ll really like the final style option: Style of Next ¶. Let’s say you have a style called Heading, and you know that the next paragraph after any heading will be in a style called Body. When you define the Heading style, choose the style name Body from the Style of Next ¶ pop-up menu. (This assumes that you’ve already defined the Body style, of course!) Now, any time you are at the end of a paragraph that’s in the Heading style and press Return, the next paragraph will automatically have the style Body applied to it. This saves you the bother of manually applying styles as you type if your use of styles follows a fairly regular pattern. If you want the next paragraph to use the same style as the current one, choose Same; if you want the next paragraph to have no style at all, choose None. While this is a very useful feature, there are a couple of subtleties of which you should be aware:

One final thought on styles with attached rulers. If you apply a paragraph style to a paragraph, you can still change the ruler manually any time you want. The ruler assignment specified in the Define Styles dialog box only applies when the style is first chosen. If you manually change the ruler used for a paragraph, that will not affect the style definition in any way. Likewise, you can manually change the character formatting of a paragraph after applying a style without affecting the style definition (or other paragraphs already using the style). However, changes to paragraph formatting in a paragraph governed by a named ruler—whether or not it’s part of a style—will immediately be reflected in all other paragraphs using that named ruler.

Editing Existing Defined Styles

Once you’ve defined a style, you can make changes to the style definition at any time by opening the Define Styles dialog box and choosing the style’s name from the pop-up menu at the top. After changing any settings, click Set to update the style definition, then click Done to close the dialog box. Changes to defined styles apply retroactively: when you change a style definition, all the text in your document that has that style applied will update automatically to reflect the changes. This means that you can very quickly make sweeping formatting changes to a long document, merely by altering a style definition.

If you press the Option key while choosing a defined style from the Style menu, the Define Styles dialog box will open with that style already selected. This can make it a little more convenient to edit your styles.

271 Working with Defined Styles

Once you have defined your styles, their names will appear at the bottom of the Style menu. You can apply a defined style to your text just as you would any other style. Since defined styles are combinations of character attributes, you can apply them to selections as small as a single character without affecting the rest of the paragraph. However, if a defined style has the attribute Make Paragraph Ruler checked (indicated by a “¶” next to the name on the style menu), then choosing the style will apply it to the entire paragraph(s) in which the current selection or insertion point is located. And if the style has a ruler name associated with it, that ruler will also be applied to the paragraph(s) when the style is chosen.

Defined styles can be stored in a stationery document, even if it contains no text. You can create blank stationery documents with predefined styles (and rulers) to make document creation simpler and avoid the hassle of copying styles from another document.

Importing Styles

There is no single command that lets you copy all of the defined styles from one document to another, but there are two ways of achieving this effect. Both require that you have the original document (the one with the defined styles you want to copy) and the new document (the one into which you want to copy the styles) open at the same time. The first technique is simply to copy some text to which the style has been applied and paste it into your new document. The defined styles will be copied to the Style menu of the new document, and will stay there even if the text is later deleted. The second technique depends on an interesting feature of the Style menu: if you have multiple documents open that contain defined styles, each document’s styles will be listed on the Style menu (grouped by document with the document name listed first (e.g., Letter:Header1). With your new document in the foreground, you can simply choose the name of a style from another open document, and it will be added to your current document’s Style menu. When you copy styles in this manner, you do not actually have to apply the style to any text; simply choosing the style name, even if there is no selection, is adequate—though if you then immediately start typing at that point, your text will use whatever style(s) you imported.

It is important to remember that both windows must be open at the same time for either kind of style copying to work. If you copy text with a defined style, close the document from which it came, and then paste the text into a new document, the text will retain its character formatting but the style definition itself will not be copied into the new document.

272 If you paste text in a defined style into a document (including a macro or glossary window) that already uses a style by the same name but with different attributes, the Style Conflict dialog box (Figure 10.8) will appear. The options are pretty self-explanatory—click one of the radio buttons to indicate how the conflict is to be handled.

Figure 10.8. The Style Conflict dialog box. Appears when you paste text in a defined style into a document that already uses a style by that name.

Ruler/Style Problems and Solutions

There are a couple of instances in which Nisus Writer’s unique way of dealing with rulers and styles causes problems. One problem has to do with defined styles, whether or not they have an attached ruler. Unlike some other word processors, Nisus Writer does not allow you to link styles together in such a way that making a change to one style updates that attribute in all the linked styles. This means that if you need to make a change in a series of related styles, you must change each one individually. The other problem comes from the fact that rulers aren’t “part of” the paragraph(s) they govern, but rather are special markers that come before the paragraph. This has some important implications for moving paragraphs around. There are ways around both of these problems, however, which we will look at here.

Dynamically Linked Styles

As you know, when you’re defining styles, you can click the Duplicate button to copy all the attributes of one style into a new style. So in a trivial sense, one style can be “based on” 273 another. However, unlike Microsoft Word’s styles, Nisus Writer styles do not retain a link to the styles they are based on, meaning that any changes you make to a style will affect only that individual style. A system that allows one style to build on another is referred to as hierarchical styles, and a system in which these styles can automatically update to reflect changes in the original style is said to have dynamic inheritance. So Nisus Writer has hierarchical styles, but not dynamic inheritance—which is unfortunate, because this makes it harder to keep your styles consistent.

Mel Martinez, a long-time Nisus user who also helped to edit this book, came up with a brilliant strategy for simulating hierarchical styles with dynamic inheritance in Nisus Writer. It’s a little strange, but it does work—beautifully—and for anyone needing to update a series of styles regularly, this system can be a real lifesaver. The trick is to apply your styles using macros. You define styles as usual, but always apply them using macros; a “child” style macro will first apply a “parent” style and then its own attributes. This technique is explained in more detail in Chapter 15.

I have included a set of “Style” macros, template files, and instructions for using them on the enclosed CD-ROM.

Beyond Cut & Paste: Clipboard Magic

While virtually all applications will let you cut, copy and paste text and graphics using the standard Macintosh clipboard, Nisus Writer goes far beyond that. For one thing, Nisus Writer offers not just one, but ten clipboards, each of which is fully editable. (We’ll see just what this implies in a moment.) In addition, you have a whole series of special Cut and Copy commands that let you work magic that would be impossible in an ordinary word processor. Let’s look at these unique clipboard functions and what they can do for you.

Appending and Swapping

Have you ever wished you could copy something and then—without erasing what’s already on the clipboard—add something to it? With Nisus Writer this is easy, using the Append Copy command. When you hold down the Shift key, 274 the Copy command on the Edit menu becomes Append Copy. Choosing this command copies the current selection to the clipboard, immediately following whatever’s already there. Similarly, pressing Shift and choosing Append Cut (where Cut normally is) will add to what’s on the clipboard, but also remove the text from your document. After doing one or more rounds of Append Copy or Append Cut, you can paste as usual and the entire contents of the clipboard will be inserted into your document.

Be aware that Append Copy and Append Cut do not add any spaces, tabs, or returns between the items you place on the clipboard. So if you copy, say, several words in a row to the clipboard, you will have to separate them manually later to make them readable.

Nisus Writer has an even spiffier clipboard trick up its sleeve—Swap Paste. Let’s say you’ve copied something, and you want to replace a certain portion of text with what’s on your clipboard. But you don’t want to lose that text either—you want to copy it back to the clipboard, so that you can move it somewhere else. Ordinarily, it would take several steps to do all of this, but in Nisus Writer, you can do it with just one. Start with some text on your clipboard. Then highlight another (contiguous) portion of text in your document and choose Swap Paste. The contents of the clipboard and the selected text will be swapped. Very nice, wouldn’t you say?

Copy to Find/Replace

Another handy pair of clipboard shortcuts is Copy to Find and Copy to Replace, which appear on the Edit menu where Copy usually is when you press Option and Shift-Option, respectively. These commands place the selected text directly into the Find or Replace box of the Find/Replace dialog box. So if you want to search for the next occurrence of a certain piece of text, you don’t have to copy, then open the Find/Replace dialog box, then paste—you can do it all in one step. And (as a special bonus), Copy to Find and Copy to Replace do their thing without touching your clipboard!

You can actually do a Find/Replace without ever opening the Find/Replace dialog box. First, select the text you want to look for and choose Copy to Find. Then press the Shift key and choose Find Next from the Tools menu (at the top, where Find/Replace normally is). The next occurrence of that item in your text will be highlighted. Other combinations of modifier keys will turn the Find/Replace command into Find All, Replace, Replace then Find, Replace in Selection, and Replace All. See Chapter 11 for the complete scoop.

Editing on the Clipboards

In most applications, what you copy or cut to the clipboard can’t be changed before you paste it. However, in keeping with its non-modal, “do-anything-anywhere” approach, Nisus Writer’s Show Clipboard command displays a standard, fully editable window (see Figure 10.9). After copying or cutting 275 text, you can display this window and make any changes you like before pasting it back into your document (or another document).

Figure 10.9. Nisus Writer’s fully editable clipboard window, which is displayed when you choose Show Clipboard from the Edit menu.

Since the clipboard window is a standard Nisus Writer window, you can do all the editing tasks you normally do—change fonts, sizes, and styles, use the thesaurus, check spelling, do a Find/Replace, run macros, and so on. You can even edit graphics or use the Sound Bar controls on the clipboard. There are a few minor limitations, though. First, many of the commands on the Insert menu don’t work on the clipboard—you can’t insert a footnote, equation, or movie, for example. You can’t use the Word Count command on the clipboard (but you can use my Count Words in Selection macro!), nor can you add a PowerTalk mailer to the clipboard window. And you can’t split the clipboard window horizontally or vertically. But I think you’ll agree that these are relatively trivial limitations.

You can also display the clipboard window by double-clicking the Clipboard menu button () on the Horizontal Button Bar.

Why would you want to edit text on the clipboard? Here’s one idea. When you’re revising a document, trying to come up with the best way of saying something, it’s nice to be able to compare the original with the revision. So just copy the portion you want to revise, display the clipboard, and position the windows so that you can see both the original and edited text at the same time. When you’re finished making changes, just switch to the original window and paste.

Using Multiple Clipboards

Nisus Writer is the only word processor that offers ten separate clipboards, meaning you can keep ten completely different 276 things in memory at a time, each one ready for nearly instant pasting—and each fully editable. The clipboards, numbered 0–9, are listed on the Clipboard menu that is displayed either when you click and hold the Clipboard menu button () on the Horizontal Button Bar, or when you choose Set Clipboard from the Edit menu. Clipboard 0 is active by default; to switch to a different clipboard, choose its number from one of the Clipboard menus. The currently active clipboard will have a check next to it on these menus, and its number will be displayed both on the Clipboard menu button and next to the Set Clipboard menu command. An X on the clipboard icon () indicates that there’s something on that clipboard; a blank icon () means that clipboard is empty.

When a given clipboard is active, every cut, copy, and paste operation uses that clipboard, leaving the others untouched. When you switch from Nisus Writer to another application (or the Finder), the contents of the current clipboard will be transferred to that application’s (single) clipboard. Likewise, when you switch into Nisus Writer, whatever was on your other application’s clipboard will be placed on the currently active Nisus Writer clipboard.

If you accumulate a lot of large selections on your clipboards, you may find that your available memory shrinks undesirably. You can remedy the situation by clearing the contents of the clipboards. You can do this manually by selecting the contents of each clipboard and pressing Delete. Or, to clear all the clipboards at once automatically, press the Option key and choose Clear Clipboards… from the Edit menu (where Show Clipboard normally is). You will be alerted that this action is not undoable.

A Nisus Writer user E-mailed me to say that multiple clipboards were great, but it’s a real pain to keep switching clipboards when you’re going through a document and collecting lots of notes, each of which you want to be on a separate clipboard. He suggested that Nisus Software implement an auto-rotating clipboards option, so that when you copy something, the program automatically switches to the next clipboard. I thought this was a great idea, so I wrote a macro that does just that. It’s included on the enclosed CD-ROM.

If you switch clipboards a lot, don’t forget that you can assign each clipboard a keyboard shortcut (see Chapter 9). You might try assigning them to, say, Control-F1 through Control-F0 on an extended keyboard, or Command-Control-1 through Command-Control-0 on a standard keyboard.

You can actually copy text from one clipboard directly to another without first pasting it in your document. The catch is that you have to use a macro command to do it. You can either create a new macro for this purpose (see Chapter 12 for details) or type the text into your document, then select it and choose Execute Selection from the Macros submenu of the Tools menu. The syntax is Copy "X" '\CY' where X is the number of the clipboard you’re copying to and Y is the number of the clipboard you’re copying from. 277 So to get something from clipboard 0 to clipboard 4, you’d use the command Copy "4" '\C0'.

Publish & Subscribe

When Apple’s System 7 debuted in 1991, one of the flashiest innovations it offered was a standardized way for documents from different applications to share data dynamically, known as Publish & Subscribe. The concept is simple, elegant, and very powerful, but even today, very few people make use of it. In fact, I think it is one of the Mac’s best-kept secrets, and Nisus Writer has the most thorough implementation of Publish & Subscribe I’ve ever seen. In the next few pages we’ll explore Publish & Subscribe and look at some of the cool ways it can be used.

You might wonder why you’d want applications to share data dynamically. After all, we already have copy and paste, import and export. What’s the big deal? To use the paradigm example, suppose you have made a chart in your spreadsheet program, and you want to include it in a report which you created in your word processor. If you copy and paste the chart, and then your data changes, you’ll have to repeat the procedure to get an up-to-date copy of the chart in your report. But if you use Publish & Subscribe, then any changes you make to your chart will automatically be reflected in the copy of the chart in your report. In addition to keeping parts of different documents updated, Publish & Subscribe can be great for workgroups in which a number of people are cooperating over a network to produce a single document.

The way Publish & Subscribe works this magic is as follows. First, you select the text, graphic, or other part of a document you want to share. Then you “publish” it—you make it available for public access. The information you publish is stored in a special file called an edition file. Next, you go to the document in which you want a copy of the information stored, and subscribe—create a link—to the edition file you just created. A copy will appear in your new document. When 278 the original (the Publisher) changes, the edition file changes, and since the Subscriber is always watching the edition file, the changes will appear in the new document automatically. With that general background, let’s look at the way Nisus Writer implements this powerful feature.

Creating a Publisher

The commands you’ll use in Nisus Writer for Publish & Subscribe are all found on the Publish & Subscribe submenu of the Edit menu (Figure 10.10). Nisus Writer can publish any contiguous selection on the text layer (including character graphics, as long as at least one text character is also selected). To publish information, first select it, then choose Create Publisher…. The dialog box shown in Figure 10.11 will appear. In the upper left corner is a preview of the selected area. First, choose a name for your edition file and decide where you’d like it to be stored. Then choose either Plain Text or Styled Text from the Publish Type pop-up menu to specify whether or not font, size, style, and color information will be included in the edition file. Check Automatically Update Publisher Information to update the edition file automatically every time you save the file (recommended!). When you have set all of your options, click Publish to save the edition file.

Figure 10.10. The Publish & Subscribe submenu of the Edit menu.

279

Figure 10.11. The Create Publisher dialog box.

For some reason, Nisus Writer cannot publish objects on the graphics layer. It can publish anything on the text layer, however—including character graphics—as long as at least one character of the selection is text (which could even be a space or tab). Nisus Writer can subscribe to graphics on the graphics layer, however.

After publishing a region of text, a gray box will appear around it (see Figure 10.12) whenever the insertion point is somewhere in that range. This serves as a reminder that making changes to the text will also affect any other documents that may have subscribed to it; it also shows you exactly where the boundaries of the region lie. If you would prefer not to see these marks in your document, choose Display Borders from the Publish & Subscribe menu to turn off that option.

Figure 10.12. A publisher is surrounded by a gray box whenever the insertion point is in the published region of text.

Publish Options

The Publish Options dialog box (Figure 10.13) is displayed when you select a publisher in your document and choose Publish/Subscribe Options… from the Publish & Subscribe menu. This gives you information about the publisher’s name and location (the pop-up menu at the top) and when it was last updated. You can also switch between manual and automatic updating, force an immediate update (by clicking Send Edition Now), change the Subscription Type (Plain Text or Styled Text), or break the link to the edition file altogether (using the Cancel Publisher button).

Figure 10.13. Publish options.

When you publish as Styled Text, keep in mind that not all applications support styled text in editions they subscribe to, so this may or may not produce the desired effect if the subscriber is an application other than Nisus Writer.

280 Subscribing

While Nisus Writer’s publishing options are pretty straightforward, the really interesting part of the process is subscribing. To subscribe to a previously published edition file, choose Subscribe To… from the Publish & Subscribe menu. If you are on the text layer, you can subscribe to any type of edition file (text or graphic); if you’re on the graphics layer, you can only subscribe to a graphic (and, since Nisus Writer graphics can’t be published, this means that the graphic must originate in another application). The Subscribe dialog box (Figure 10.14) shows the options available for fine-tuning your subscription. Keep in mind that what you subscribe to can be on any local or network volume that can be mounted on your desktop.

Figure 10.14. The Subscribe dialog box.

As in the Publish dialog box, you can locate the edition file of your choice with standard file controls, and you’ll see a preview of the selected edition file in the upper left corner. The other options available will depend on which application creat-281ed the edition file. Figure 10.14 shows the options available when the publisher was a Nisus Writer document. First, choose the Subscription Type, which will be either Plain Text or Styled Text for text editions, or PICT for a graphics edition. If you choose Styled Text and the publisher was a Nisus Writer document, you can choose either to include or “filter out” any of the individual style attributes—Graphics (meaning character graphics), Rulers, Font, Size, Style, or Color. Check Add Surrounding Style to make the subscriber take on the style attributes of the surrounding text, in addition to whatever attributes it originally had. And check Automatically Update Subscriber Information to show changes in the edition as soon as they are made and avoid having to update manually. When all of your options are set, click Subscribe to place the subscriber in your document.

To make a style change to a portion of a subscriber, press the Option key while dragging to make a selection, then apply the style(s) of you choice.

Working with Subscribers

Once you’ve subscribed to an edition file, it will appear in your document as a standard range of text—it will flow with the rest of your text if it’s on the text layer and, depending on the options you set when subscribing, will take on the style of the surrounding text. You cannot edit the text (or graphics) in a subscriber, but you can make changes to a subscriber as a whole, like changing its font, size, style, or color, or adjusting paragraph formatting. As with publishers, subscribers are surrounded with a gray box whenever they are selected; to turn off this indicator, choose Display Borders from the Publish & Subscribe menu. If your subscriber is a graphic, you can crop or resize it, but you can’t rotate it, even if it is on the graphics layer.

282 Subscribe Options

When you select a subscriber and choose Publish/Subscribe Options from the Publish & Subscribe menu, the dialog box shown in Figure 10.15 appears. This is similar to the Publish Options dialog box we saw earlier, but with a few important differences. Instead of a Send Edition Now button, you can click Get Edition Now to force an immediate update of the subscriber. The options at the bottom of the dialog box mirror the ones in the Subscribe dialog box, and allow you to make changes to the subscription type. You can also click Open Publisher to open the document the edition file came from in its creator application (provided the original file is still available).

Figure 10.15. The Subscribe Options dialog box.

Other Publish & Subscribe Commands

Additional commands on the Publish & Subscribe menu give you even more flexibility in dealing with publishers and subscribers.

Numbering and Variables

There are a lot of numbers in your documents that are subject to change from time to time. On the one hand you have things like the page number, which changes on every page. On the other hand, you may have things like chapter numbers or figure numbers that change at irregular locations in your text. And then of course, you may want to make reference to the date or time, which are constantly changing. Nisus Writer includes a robust system of variables to make it easy to deal with all the kinds of numbers that change. Nisus Writer can keep track of many separate variables, each of which may appear multiple times in your document, perhaps with a different value each time. Nisus Writer recognizes three different types of variables: page numbers (of which there are actually three kinds), autonumbers, and variable stamps. (Technically speaking, cross-references are 284 a fourth type of variable, but we’ll talk about those a bit later.) Autonumbers identify document parts like chapters and tables; variable stamps are the date, time, and document name—things that appear as “stamps” to identify your document.

All three kinds of variables can be inserted with a single menu command (either from the Insert menu or its Numbering or Variable Stamp submenus). And all three update instantly as your document changes. However, they do have some distinctive features.

Numbering Pages

The first, and perhaps most important, kind of variable is the page number. This is a special variable which ordinarily starts at 1 and is incremented by one every page. Page numbers are most frequently found in headers or footers, since those areas repeat automatically on every page, but there is no reason you can’t put a page number directly into your text, as in “This is page 895 of my letter, and boy are my fingers getting tired!” To insert the current page number into your document, choose Page Number from the Insert menu.

Last and Next Page Numbers

In some kinds of documents (like faxes), it is customary to indicate on each page not only the current page number but the total number of pages, as in “This is page 3 of 7.” For this reason, Nisus Writer offers a special variable that keeps track of the last page number in your document, whatever that may be. To use this variable, choose Last Page Number from the Insert menu. There are also some situations in which you need to state what the next page number is—for example, a statement like “Continued on page 14.” So there’s also a “Next Page Number” variable, which is always equal to the current page number plus one. To insert the “Next Page Number” variable, hold down the Shift key while choosing Page Number from the Insert menu (for some reason, this variable doesn’t have its own menu command, and the menu doesn’t change to reflect this choice when you press the Shift key, but it is there).

285 Formatted Page Breaks

You may want to restart page numbering at some point in your document. For example, you might have “front matter” (title page, table of contents, etc.) numbered with lowercase Roman numerals like i–vii, after which you want the main body of your text to start on page 1. To restart page numbering, you use a special character called a formatted page break. This is just like an ordinary page break character, except that it also resets the page number variable. To insert a formatted page break, press the Shift key and choose Format Page Break… from the Insert menu (where Page Break normally is). The Page Number Format dialog box (Figure 10.16) will appear. You can enter the new starting page number (normally 1, but you can start at any number you like) and a number to increment by (again, usually one, but you could have your pages numbered by twos or threes, etc.). You can also change the format (Arabic numbers, Roman numerals, etc.) using the Unit pop-up menu. Click OK to place the formatted page break in your document or No Format to place a regular page break. Formatted page breaks show up as double-headed arrows () when you have Space, Tab, & ¶ turned on.

Figure 10.16. The Page Number Format dialog box.

Numbering Document Parts

In addition to pages, there may be large subdivisions of your document that need to be numbered sequentially—chapters, sections, subsections, etc. You may also need to number specific document elements like tables, equations, or figures, or even individual paragraphs. Nisus Writer autonumbers 286 can be used for any of these purposes and more. Autonumber commands appear on the Numbering submenu of the Insert menu (Figure 10.17). When you choose a command from this menu, a number of the chosen type will be inserted into your document. For instance, when you choose New Chapter, “Chapter 1” will be inserted. When you choose New Chapter again later in your document, “Chapter 2” will be used, and so on. The behavior of the other commands on the menu is the same. As you work with autonumbers for chapters, sections, and so forth, keep in mind that these are still just variables—a “chapter” has no other significance in Nisus Writer than the location where a particular kind of variable is inserted.

Figure 10.17. The Numbering submenu of the Insert menu, showing the commands for entering and editing autonumbers.

Nisus Writer only counts the elements you tell it to. So if you only want to number certain graphics, for example, you can do so without worrying that other graphics you insert will mess up your count.

287 By default, Nisus Writer treats the major document subdivisions as a hierarchy: Chapters include sections, which include subsections, which include sub-subsections. The significance of this is that sections are numbered sequentially within a chapter, but when you start a new chapter, the section numbering sequence starts over at 1. Restarting section numbers, in turn, causes subsections and sub-subsections to restart their numbering sequences. If this is not the behavior you want, however, you can easily change it using the Define Numbers dialog box (see below).

In addition to document divisions, the menu lists Table #, Equation #, Figure #, and Custom A through Custom F. These variables are inserted and used the same way, but are not preset to be part of a hierarchy—their respective numbering sequences will continue throughout your document. The “Custom” choices are simply spare variables you can use for any numbering purpose—graphics, examples, paragraphs, items in a list, or anything else you want.

If you hold down the Shift key while selecting the Numbering menu, the commands all change to show the word “Current” before them (see Figure 10.18). This allows you to refer to the immediately preceding instance of an autonumber without having to mark and cross-reference it. For example, if you have just inserted a new chapter, which happens to be “Chapter 3,” choosing Current Chapter from the Numbering menu will insert “Chapter 3” into your text again. This allows you to easily say things like “We’re about ready to wrap up Chapter 10…” that will change if the chapter number changes. You could also use the “Current” commands to accomplish what you’ve seen numerous times in this book—a reference to a particular figure by number in the text, followed shortly thereafter by the same figure number as part of the caption. The first instance would be inserted using Figure #, and the second using Current Figure #.

288

Figure 10.18. The Numbering submenu of the Insert menu as it appears when the Shift key is pressed. (Note that you must be holding the Shift key down before you select the menu; changes on submenus do not appear dynamically when modifier keys are pressed.)

Setting Numbering Options

Not only do you have quite a few autonumbers to choose from, you also have a lot of flexibility in defining how those numbers will appear in your text. To change the settings for any of the autonumbers, choose Define Numbers… from the Numbering menu. You’ll see the Define Numbers dialog box (Figure 10.19). To set the attributes for an autonumber, choose its name from the pop-up menu at the top of this dialog box. As before, the Unit, Start at, and Increment controls let you specify which numbering style to use, what number to start with, and what multiple to use, respectively. The Restart on New pop-up menu allows you to restart the numbering of an autonumber every time some other autonumber is inserted. For example, you may want figures to be numbered from 1 in every section, or paragraphs to be renumbered on every page.

289

Figure 10.19. The Define Numbers dialog box.

If you double-click any autonumber in the text of your document, the Define Numbers dialog box will appear with that autonumbering definition selected. This makes it easy to edit a particular definition quickly.

At the bottom of this dialog box, the “Structure” section lets you lay out the appearance of the autonumber in your text. For instance, you might want figure numbers to be shown as “Figure 10.8,” etc., as they are in this book—where the first number indicates the chapter and the number after the period indicates the figure number within that chapter. (Refer to Figure 10.20.) In the first text box, type the text, if any, that you want to appear at the beginning of the expression. Then choose an autonumber from the first pop-up to put a number after that text. Continue building your expression this way, alternating text with autonumbers as needed. To give you an idea of the possibilities, you could construct expressions like any of the following: “Figure 9.12-3”; “(see example 8-C)”; “Plaza A, Building 3, Level II, Corridor 12-F, Room 113.” As you build an expression, a generic sample of how it will look is displayed next to the word “Example.”

Figure 10.20. The Define Numbers dialog box, showing the definition for an autonumber of the form “Figure 10.8.”

290 There are just a few peculiarities about the Define Numbers dialog box you should know about:

Variable Stamps

The final category of variables is variable stamps. To enter the current date into your document, choose Date from the Variable Stamp submenu of the Insert menu; to insert the time, choose Time. These variables are not dynamic in the same way that autonumbers are—that is, they won’t change continuously as the date or time changes. Instead, they give a record of what the time or date was when they were inserted. This is why they are known as “stamps.” However, 291 if you wish to update these variables manually, there are two ways to do so. First, you could choose Update Time & Date from the Variable Stamp menu; this will set all time and date variables in your document to the current time/date. Or, when printing, you can check the Time & Date box next to Before Printing Update, to ensure that the printed copy is stamped with the time or date it was printed. If you really want your dates to update every time you open your document, you can add the line Update Time & Date to your InitOpen macro (see Chapter 12).

The format used to represent the date in your document is set in the Date Format dialog box (Figure 10.21), which is displayed when you choose Date Format from the Variable Stamp submenu. At the top of the dialog box, the “Date Form” choices let you choose how the elements of the date are displayed. The “Date Order” choices determine whether the month is listed before the date, as is standard in the U.S., or vice-versa, as is common in Europe. Changing this setting also changes the appearance of the sample dates in the top portion of the dialog box. If none of the options shown is suitable, then select Use Date & Time Control Panel. This setting will cause Nisus Writer to use whatever format is set in the Date & Time Control Panel, which is included with your MacOS software. Nearly any permutation of the date can be set in this manner.

Figure 10.21. The Date Format dialog box.

292 The final variable on the Variable Stamp submenu is Document Name. Choose this to enter the current name of the document. Like the other stamps, this variable will not update automatically if you save the document under a new name. However, if the document name changes, choosing Update Time & Date will update this variable as well.

Marking and Cross-Referencing

A frustrating fact about working with long documents is that it’s very easy to get lost. You may spend a lot of time just scrolling around, trying to find a particular section. This problem also afflicts your readers; they may flip all through your document trying to find that phrase or figure you referred to in your text. Since there’s no “Find” command for printed books, this can be very tedious! Accordingly, Nisus Writer has a set of marking and cross-referencing features to help both you and your readers get around your document more easily.

The first step is to create an electronic “bookmark” (sometimes called a marker)—which is nothing more than a name for a given piece of text. All your bookmarks for a document appear on the Jump To submenu of the Tools menu, and by choosing a bookmark’s name from this menu, you can instantly jump to that point in your document. Bookmarks are also the key to cross-referencing within your text. For instance, you might like to say something like “See Figure 8 on page 25,” even though the figure may move to a different page or get a new number. If the figure number has been marked, you can easily insert a dynamically updating reference to it somewhere else in your text.

Marking Text

To create a new bookmark, select one or more characters (or character graphics) on the text layer and choose Mark… from 293 the Tools menu. The Marker Name dialog box (Figure 10.22) will display the first three words of your selection, but you can type in any name you wish for the marker. Then click Set to save the marker. You can also choose Mark… to display this dialog box even if nothing is selected. When you do this, the insertion point itself will be marked.

Whenever the Marker Name dialog box is showing, the Jump To submenu is also active (with each marker name preceded by the document name, even if only one document is open). You can choose a marker to enter it in the dialog box, then click Delete to delete the marker. (A quicker way to delete a marker is to press the Option key while choosing the marker name from the Jump To submenu.) Markers are also deleted automatically if the marked text is deleted from the document. Unfortunately, there is no way to rename a marker; you must delete it and create a new one. If you type a new name in for an existing marker and click Set, the new name will be added to the menu, but it will not actually mark any text! You can have as many overlapping markers as you wish. You can even mark the same piece of text multiple times, giving it a new name each time.

Figure 10.22. The Marker Name dialog box.

The Jump To Submenu

The name of every marker you assign will appear, in alphabetical order, on the Jump To submenu of the Tools menu below the Index Reference command. If you choose a marker name from this menu, you will immediately jump to that point in your document, and the marked text will be highlighted. If you press the Shift key while selecting a marker from this menu, everything between your current insertion point and the marker will be selected.

294 If you want to jump to a bookmark from a macro, simply place the marker’s name on a line by itself in your macro. It will be treated like any other menu command—that is, exactly as if you had chosen it from a menu. For even greater ease of navigation, consider assigning keyboard shortcuts to your most frequently accessed bookmarks.

Cross-References

While markers alone are very useful for navigating your document while you write and edit it, where they really shine is in their ability to facilitate cross-referencing. A cross-reference is simply a piece of text that refers to some other part of your document. Cross-references are dynamically linked, so if the location or content of the thing you’ve referenced changes, the cross-reference will change as well.

To insert a cross-reference in your text, choose Cross Reference… from the Tools menu. You’ll see something like the dialog box shown in Figure 10.23. On the left is a scrolling, alphabetical list of all the bookmarks in your document. On the right under “Display as:” are a series of options for the type of cross-reference to be used. First, choose a bookmark to reference. Then choose one of the options on the right. If you want to insert the page number on which the marked text occurs, click Page #. Click Line # to insert the line number the marked text begins on, counting from the beginning of the document, or Page Line # to use the line number counting from the top of the page. Paragraph # inserts the paragraph number, counting from the top of the page, in which the marked text begins. (Any portion of a paragraph is counted as a paragraph, but a return character on a line by itself does not count as a paragraph.)

Figure 10.23. The Cross-Reference dialog box.

You cannot insert a cross-reference into a footnote, endnote, header or footer. But see Chapter 15 for a workaround using Publish & Subscribe.

295 The most interesting option, though, is Marked Text or Graphic. When this option is checked, a copy of the actual text that was marked (not the bookmark name!) will be placed at the insertion point. It will retain its original style unless you check Use Surrounding Style, in which case it will take on the attributes of the surrounding text. If the marked text changes, all you need to do is choose Update X-reference and the cross-reference will update too. This way, you can refer not only to the location of text elsewhere in your document, but also its content.

The real beauty of the Marked Text or Graphic option, though, lies in its ability to keep track of variables that have been marked. For example, let’s say you use Nisus Writer’s autonumbering feature (see below) to number figures. After you insert a figure number, select the number and mark it (giving it some easy-to-remember name). Elsewhere in your document, insert a cross-reference to it, selecting the Marked Text or Graphic option. Now, if your figure number changes, not only will the number in the caption update automatically, but so will the references to it in your text! By inserting another cross-reference to the same variable, but this time choosing the Page # option, you can construct complex dynamic references such as the one we mentioned earlier: “See Figure 8 on page 25.”

While you can only mark and cross-reference items on the text layer, you are not limited to text—any character graphic, equation, or table can also be cross-referenced.

Creating Indexes and Tables of Contents

The final task in writing a book is generally creating an index, and it is a notoriously time-consuming, labor-intensive task. Unless you want a concordance—a brute-force listing of every word in your document—you’ll have to expend considerable energy deciding what needs to go in the index and how it should be listed. Luckily, Nisus Writer has a bunch of tools to make this task as simple and straightforward as possible. While tables of contents may not be as complex as indexes, 296 the same techniques used to work with indexes can be used for contents as well.

Indexes

The basic strategy for creating an index in Nisus Writer is as follows. First, highlight a word you want to appear in the index. Then, use the Mark for Index command on the Index submenu of the Tools menu to apply a special, invisible “style” to the word. Repeat this procedure for every occurrence of every word you want in the index. When you’re finished with your document, choose Create Index from the Index submenu, and Nisus Writer will create a new document listing all the words you marked, alphabetically, along with the page(s) on which they occur.

While the last step—actually building the index—is accomplished with a single menu command, the process of marking hundreds or even thousands of words manually is no picnic. That’s where Nisus Writer’s advanced indexing tools come in. These tools also allow you to create multilevel index entries, to index one term as something else, and to give “See Also…” instructions. You can also automate much of your indexing using Nisus Writer’s Find/Replace and defined styles.

Index and Index As…

The simplest way to put a word in your index is to select it and choose Mark for Index from the Index submenu of the Tools menu. It will appear in the index in exactly the form that was marked (including capitalization, etc.). Words you’ve marked for the index will appear in your text with a gray box around them (). If at any time you want to un-index a word (i.e., prevent it from being included in the index), select it and choose Unmark Index from the Index submenu. You cannot mark any given piece of text for multiple index entries; overlapping index marks are concatenated. In other words, in the phrase “sesame seed applicator,” you couldn’t mark both “sesame seed” and “seed” for the index, and if you marked “sesame seed” and “seed applica-297tor” separately, you would only have a single entry in your index for “sesame seed applicator.” (However, you can achieve this effect using Index As…; see below.)

Sometimes you may want to index one term as another term. For instance, you may mention several Macintosh models in your document, but not want to distinguish them in the index—you want any Mac at all to be indexed as “Macintosh.” To do this, select a term (perhaps “Quadra”) and choose Index As… from the Index menu. The Index As dialog box (Figure 10.24) will appear. In the Index As: box, type the word(s) you want to appear in the index (“Macintosh” in this case). You can optionally check one of the boxes to apply bold or italic style to the indexed term and/or the page number in the index when it is built. If you want this entry to refer the reader to additional topics of interest, type another term in the See Also: box. Click OK when you’re done.

Figure 10.24. The Index As dialog box. Use this to index one term as something else, or to give “See Also” instructions.

Words that are marked using Index As… will appear in your text with a dotted box () surrounding them. Unlike the Mark for Index command, Index As… does allow you to have overlapping references, as long as each new reference contains at least one unique character. To go back to our previous example, if you marked “seed” using Index As…, you could then also mark “sesame seed” separately. Likewise, you could mark “sesame seed” and then “seed applicator” separately. However, if you marked “sesame seed” first, you would not be able to mark a subset of that expression (“seed”) later. If you want to change what a term is indexed 298 as, select it and choose Index As… again. Make any changes you like, then click OK (or, to unmark the term, click Remove.) A more direct way to unmark a word or phrase that has been indexed using Index As… is to select it and choose Remove Index As from the Index submenu.

If you want one particular word to be indexed two different ways, keep in mind that you can use both Mark for Index and Index As… on the same exact piece of text to make a word appear under two different topics. If even that isn’t enough, consider using Index As… on a nearby word (or even a space character—just something you know will definitely be on the same page) to add multiple entries to the index.

Multilevel Indexing

A multilevel indexing scheme, sometimes referred to as subindexing or a hierarchical index, is one in which any indexed topic may have subtopics listed in an indented “outline” fashion beneath it. For example:

computers
Macintosh, 14–22
software, 14–18
graphics, 15
word processors, 14, 17
hardware, 19–22

You can create multilevel indexes in Nisus Writer, too—without any manual cutting and pasting—but the technique is far from obvious.

To mark a term as a “subentry,” select it and choose Index As…. In the Index As: box, type in the name of the primary entry, followed by a backslash (\), followed by the subentry (no spaces). Repeat this procedure to go “down” multiple levels. For example, to make “Macintosh” a subentry under “computers,” you would type computers\Macintosh; to make finer distinctions, you could type something like computers\Macintosh\software\word processors\Nisus Writer. Repeat this for each term you want to index. When your index is created, the terms will be indexed as shown in the example above.

A good rule of thumb when marking terms for an index—especially when using subindexing—is always to use lowercase entries (except in the case of names), relying on Index As… if necessary to create a lowercase entry for a capitalized word. This process can be simplified greatly by indexing using Find/Replace (see below). In the Index (Replace) box, put the lowercase version of the word, and turn Ignore Case off. Then make one indexing pass with the capitalized version of the word in the Find box, and a second pass with the lowercase version in the Find box.

Building the Index

Once you’ve marked all the terms in your document that you want to index, choose Create Index… from the Index submenu. The dialog box shown in Figure 10.25 will appear, allowing you to set the initial formatting attributes for your 299 index. Under “Page Number Position:”, choose how you would like the page number to appear after each index entry. None means there will be no page number at all. Following Entry means that immediately after the indexed term will be a space and the page number; (Following Entry) is the same but puts the number in parentheses. If you choose Right Justified, a tab character will be inserted after each index entry and a right-aligned tab stop placed at the right line wrap position so that the numbers are right justified; Right Justified with Leader simply adds a period leader to this tab stop.

Figure 10.25. The Create Index dialog box.

Under “Format”, check Blank Line Between Sections to put an extra return after each letter’s listings (A–Z). To include the letters themselves at the top of each section, check Label Sections (and optionally add Bold and/or Italic to the letters’ styles). Check Insert Comma After Entry to add a comma immediately after each indexed term (though before the page number and tab character, if any). And to make your index a multi-column document, enter the desired number of columns in the Number of Columns: box.

The final choice in this dialog box is Link References (Hypertext). This option would have been a very cool idea if it worked, but it doesn’t quite. The way it’s supposed to work is this. Make an index. Let’s say that in your index the word “computer” appears on 20 different pages. Select one of those page numbers, then choose Index Reference from the Jump To submenu of the Tools menu. Nisus Writer will instantly jump to the instance of the word “computer” that appears on page 20, and this works even with words that were indexed as something else. This is very neat, but tragically, it stops working the moment you make a change—any change—to either your main document or your index document. Which means that for all practical purposes, this option is useless, and you should probably pretend it doesn’t exist.

When you have set all the options as you wish, click OK. Nisus Writer will create a new document containing an alphabetical listing of all the marked terms in your document. This index document can then be edited just like any 300 other Nisus Writer document, and even copied and pasted into your original document, if you wish. Remember, though, that the index is a static document—if the text in your original document changes or moves onto different pages, you will have to re-create the index to reflect the changes. For this reason, creating the index should normally be the last step in writing your document.

By default, your index is created using 12-point Geneva type. While you can easily change any attributes of your index after you’ve made it, you may want to set default characteristics for your indexes to save you the effort. To do this, open a new file and set all the formatting attributes the way you want them to be (just as you did when creating your Nisus New File stationery). Save this file as a stationery document in the same folder as your Nisus Writer application (or in the Nisus Writer Tools folder), giving it the name Nisus Index Stationery. This stationery and its associated attributes will then be used automatically for all new indexes.

The number of columns used in your Nisus Index Stationery document will override the number you enter in the Make Index dialog box.

Indexing Using a Word List

If you want to index every occurrence of every word in your document (or almost every word), Nisus Writer offers a very 301 easy way to do this. It can automatically create a list of all the words in your document, and then, using that list, index the entire document. Here’s how it works. First, choose Create Word List from the Index submenu. Nisus Writer will build a list of all the words in your document and place it in a new document, one word per line. (This process is sometimes very time-consuming, so be patient.) Each word will appear only once in the word list, no matter how many times it’s used in your document. You will in most cases want to edit this list to remove things you don’t want in the index (a, the, did, was, etc.). When you have arrived at a final list, choose Mark Using Word List from the Index submenu. Nisus Writer will mark each occurrence of each word on the list for the index. Then, you can create and edit your index as usual.

When using the Mark Using Word List command, keep in mind that both documents must already be open, and that the Word List itself must be the front window.

Indexing with Find/Replace

The Find/Replace dialog box (see Chapter 11 for more details) can also be used to index words and phrases in your document. To do this, first choose Find/Replace from the Tools menu, and choose Index from the pop-up menu that normally says Replace. Type the word(s) you want to index into the Find box. In the Replace box, type in what you want the word(s) to be indexed as. (Note: Don’t leave the Replace box empty; if you do, this technique will have no effect.) If you want, say, “Macintosh” to be indexed as “computer,” type Macintosh into the Find box and computer into the Replace box. Or, if you want words to be indexed as themselves, just type the same thing in both boxes. Click Index to find and index just the next occurrence of the word, or Index All to mark every occurrence of that word in your document for the index.

Tables of Contents

Tables of contents work almost exactly the same way as indexes do. The difference is that entries in a table of contents appear in the order in which they occurred in your document, rather than in alphabetical order. To mark a word 302 for the table of contents, select it and choose Mark for Contents from the Contents submenu of the Tools menu. Unlike index references, there’s no “Contents As” command; whatever you mark for the table of contents will appear exactly as you marked it. To unmark something you’ve earlier marked for contents, select it and choose Unmark Contents from the Contents submenu. After all your terms have been marked, choose Create Contents… to build a new document containing all of the marked text. The Create Contents dialog box (Figure 10.26) will give you formatting options similar to, but not as extensive as, those used for indexes. Click one of the radio buttons under “Page Number Position” to choose how the page number will be shown (see above under “Creating an Index” for details), and enter the number of columns for your table of contents document. When you click OK, Nisus Writer will create a new document containing all the marked text.

Figure 10.26. The Create Contents dialog box.

You can also create dynamic tables of contents within a document using Nisus Writer’s cross-referencing feature. Details can be found in Chapter 15.

Using Styles for Indexes and Contents

If you consistently use defined styles to format the various parts of your document, you may find that the job of creating indexes and tables of contents just got a lot easier. As 303 we saw earlier when discussing defined styles, the Format pop-up menu in the Define Style dialog box has both an Index choice and a Table of Contents choice. If Table of Contents is selected in one of your styles, then everything in that style will automatically be marked for the table of contents. Thus, if you use a defined style for the headings in your documents and you want them all to be in the table of contents, you don’t need to mark anything manually at all. Likewise, if Index is one of a style’s characteristics, every string of text marked in that style will be included in the index. Be careful, though, only to use this attribute in styles that apply to single words or short phrases unless you want whole sentences and paragraphs in your index!

See Chapter 15 for a tip on how to make multiple indexes for a single document using defined styles.

Summary

As you’ve just seen, there’s a lot more to Nisus Writer’s editing capabilities than first meets the eye. And I hope you’ve also seen that with a little bit of careful planning and the willingness to learn how to use these new features, you can save yourself tons of editing time and effort, while at the same time giving your documents a more polished, consistent look. Now that you’ve mastered rulers, styles, clipboards, autonumbering, and all the other things we’ve discussed here, you may feel there’s nothing left to learn. In fact, we’ve only just begun to explore Nisus Writer’s advanced features. We turn next to the legendary PowerFind Find/Replace, and then to automation features including glossaries and macros.

Copyright © 1995, 1996, 1999 by Joe Kissell

< Previous Chapter | Next Chapter >