"Ads by Google" links provided by Google.com, which has sole control over all advertising content it displays on this site.

Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map

Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2008 by Barry MacDonnell. All Rights Reserved.

Page updated Apr 14, 2008

WordPerfect Tips
Main tips page | Browse tips

The Table of Contents and List features
To create an Index see here.
To create a Table of Authorities see
Corel's support database, Answer ID
753748 and
this post at WordPerfect Universe (which references CiteLink and FullAuthority).

How to create a Table of Contents (or List) in three easy steps

Before you can create a Table of Contents (TOC), the words or phrases you want included in the TOC must be marked with special format codes. Then WordPerfect can find them and arrange them in a TOC.

This can be done in the three easy steps outlined below, but please read on for some other things to consider since they could save you time in the long run.

WordPerfect's five standard paragraph Heading styles (Heading 1 through Heading 5 -- accessed via a drop list on the Text property bar, or via the Format, Styles menu) are already marked (internally) for inclusion in any TOC. They were created for you by Corel programmers and they already have the necessary codes in them.

So, for example, using the Heading 2 style on a word or short phrase will cause it to be automatically included in the TOC as a "level 2" entry when the TOC is defined and generated. This is very handy and a major reason to use these "shipping" styles (or custom versions of them) when you need to introduce sections of a document (e.g., Chapters, Sections, Appendices, etc.) with text headings.

Note: If you use only these five standard paragraph Heading styles, and you do not need other document items in the Table of Contents, you can skip Step 1 below. But you still need to perform Steps 2 and 3.

For other items (i.e., those not marked with a WordPerfect standard Heading style) that you want included in a TOC you can

(a) go through the document and mark each item manually as explained in Step 1 below ("Mark the entries")
...or...

(b) you can optionally create (or edit) your own custom style (see the column on the right ) and simply apply the special style to any text you want included in a TOC
...or...

(c) you can do both. Then simply follow Step 2 and Step 3 below.

  • Step 1: Mark the entries in your document that you want included in the TOC. To mark the entries manually:
    • Turn on Reveal Codes (View, Reveal Codes) so you can see what you are doing.
    • Select the text you want included as an item in the TOC (but not any format codes, unless you also want them in the TOC!).
    • Click Tools, Reference, Table of Contents, then click on the [Mark 1] button for a top-level entry, the [Mark 2] button for a second-level entry, etc.
    • Repeat the select-and-mark procedure as needed.
    • Tip: You can use small macros to automate this procedure. See Footnote 1 below.
  • Step 2: Define the TOC.
    • Place your cursor where you want the TOC to appear. You can create a blank page at the top (Ctrl+Enter will insert a hard page break), with a title ("Table of Contents" or similar). You might want to enter a couple of hard returns (with the Enter key) to provide a separation between the title and the TOC.
    • Choose Tools, Reference, Table of Contents (tab), and click the [Define] button. (If you cannot see a [Define] button in the Reference Tools dialog that should now be on screen, see Footnote 2 below.)
    • The Define Table of Contents dialog appears. Type the number of levels (or use the spinner arrows) you want in the TOC.
      • Optional:
      • You can Position the page numbering (i.e., the numbering format on the TOC page) relative to the text entries for each level using the fields adjacent to each Level's style. [The default is to use dot leaders with flush-right page numbers, but you can use other numbering positions -- or no numbering at all, in which case the TOC's text entries will be hyperlinked to the relevant pages.]
      • Use the custom [Page Numbering] button to change the numbering format for any one or more levels. (N.B.: The [Styles] button lets you change the TOC's text entry formatting for each TOC level; the [Page Numbering] button lets you change the TOC's page number formatting for each level.)
    • Click OK, and WordPerfect will insert a [Def Mark] code at the cursor location -- that is, where the TOC will be generated -- and a temporary text marker ("<<Table of Contents will generate here>>") bracketed by a pair of [Gen Txt] codes..
      • Tip: You can double-click the [Def Mark] code to bring up the Define Table of Contents dialog if you need to change things.
  • Step 3: Generate the TOC with the Generate button. In the next dialog, you are given two choices: Save Subdocuments and Build hyperlinks. The first is only useful if you are working in a Master document which has one or more subdocuments (for more on this topic see here), and the second is only useful if you have hypertext links in the document. Most often, you can just click OK.

See the Tips section below for more on editing and formatting the TOC, etc.

Lists

  • The above three-step method is essentially the same for creating a List of items with Tools, Reference, List.
    • Mark the List's entries (Step 1 above): You can select some text first, then click Tools, Reference, List and give the list a name in the Reference Tools dialog's List field (if the List has not yet been created or named), then -- with the dialog still on screen -- click on [Mark]. This puts a paired code around the selected text. Select other text as required, clicking [Mark] for each selection. (It the list already has been created, you can choose its name from the List field, then select the text and click [Mark].)
    • When you are done marking items, you need to Define the List (and Insert it where appropriate) and then Generate it, in much the same way you Define and Generate a Table of Contents (Steps 2 and 3 above).
    • Note that you can create several differently named lists in the List field, choosing different ones for different groups of document items to Mark for inclusion in those Lists.
    • You can also create a custom style that contains the required "mark for inclusion" codes inside the style: See the next column for an explanation of this method and how to use it with Lists. When you apply the style, it will automatically include the item in the List when you generate the List.

Tips

  • Editing the Table of Contents: Once you create a TOC ("generate" it) it can be edited and formatted just like any other block of text. (Be sure to back up your document before making such changes.) The TOC is ordinary (paragraph style) formatted text between the special [Def Mark][Gen Txt] ... [Gen Txt] codes. For example, you can select the entire TOC and set new paragraph spacing with Format, Paragraph, Format, Spacing between paragraphs. You can also remove any unwanted format attributes, line breaks, etc.
    • Note: Each time you regenerate a Table of Contents, WordPerfect replaces the existing TOC -- i.e., everything between the paired [Gen Txt] codes. Therefore, it might be best to refrain from adding or changing formatting to text inside (i.e., between) these paired TOC codes until the final draft of the document.
    • However, see Footnote 3 for more information and an example of how to format a TOC into two columns that survives multiple regenerations of the TOC during editing.
  • Unexpected formatting in the Table of Contents is typically caused by extraneous formatting codes that were included in the body text you selected and marked for the TOC. Use Reveal Codes to make precise selections (see Step 1 above), or apply standard or custom styles to body text that already have internal TOC markings (see the column on the right).
  • If you have lots of "non-style" (i.e., plain text) items to mark, you can record your TOC-marking steps to create a macro to mark them more quickly (once they have been selected) for a particular TOC level. Select an item, then use Tools, Macro, Record and click Tools, Reference, Table of Contents, then click [Mark 1] for a top-level entry, [Mark 2] for a second-level entry, etc. Stop recording with the stop button (  ) on the macro toolbar.
  • Hypertext: When WordPerfect generates a TOC, it creates hyperlinks around the page numbers in the TOC. (Hyperlinks become "active" if you enable Tools, Settings, Environment, Activate Hyperlinks.)
    • Tip: To make just the TOC headings -- the text entries in the TOC -- into hyperlinks: When you define the TOC (Tools, Reference, Table of Contents, Define) choose "No Numbering" for the Numbering Format for each level of the TOC. All TOC entries will become hyperlinked.

You might also be interested in creating an index for your document. See here.

[Page top]

How to "mark" a custom style for automatic inclusion in a Table of Contents (or List)

The column on the left describes how to mark ordinary text so that the text will appear in a Table of Contents (TOC), and also notes that several standard heading styles (Heading 1 ... Heading 5) included with WordPerfect mark their text in such a way that the text will be automatically included in a TOC.

But what about custom styles? How can they be set up to automatically include their text in a Table of Contents?

[For Lists, another Reference tool, and Outlines, which basically are specially numbered styles, see the notes under Step 4 below.]

For those who use styles to format document section and page headings, this is a common question, since these headings probably should be included in a TOC, and most people would want them to be included automatically once the style is applied to a heading's text.

For example, one WordPerfect user who was hunting for an answer to this question double-clicked on various standard Heading [Style] codes in Reveal Codes and saw a unique code inside each one (which turns out to be a special code that is used to include, or "mark," these Heading styles for inclusion in a TOC). This prompted the following exchange:

Q: "I notice that inside the Heading 1 through Heading 5 styles the appropriate [Mrk Txt T.O.C.] code is included. How can I create a new style and include this code? The 'Help' suggests that it is possible but the 'How to' doesn't address it."

A: "It's a little tricky, but simple. Here's how:"

  • Step 1. Either create a new Paragraph heading style or new Character style with Format, Styles, Create, or edit your existing style with Format, Styles, <stylename>, Edit.
  • Step 2. At the bottom of the Styles Editor dialog window that opens, be sure to check (i.e., enable) the box, "Show off codes."
    • Note: If you are creating a new style, the Contents field will be empty. You should enter the format codes in the Contents field that will be applied to any text when you apply the style to it. For example, if you want to create a new Character style that will apply bold, small caps formatting to selected body text, and then mark that text for inclusion in your Table of Contents, click on the Styles Editor's Format, Font menu and check (enable) the "Bold" and "Small caps" options, then click OK to return to the Styles Editor and its Contents field. You should see the new codes for [Bold] and [Sm Cap]. [For more information on styles, see here.]
  • Step 3. Now, in the Contents window of the Styles Editor, select the code labeled [Codes to the left are ON, codes to the right are OFF]. An easy way to do this is to put the cursor just in front of this code, hold down the <Shift> key, and press the <Right Arrow> key.
    • Note: For most typical heading styles, don't select any formatting (or numbering) codes unless you also want their formatting to be applied to those heading items in the Table of Contents, too.
  • Step 4. While this long [Codes to the left...] code is selected (a [Select> code appears just to the left of it), click Tools, Reference, Table of Contents from the Styles Editor menu. The Reference Tools dialog (or, in earlier versions, a Table of Contents bar) should appear. Choose one of the TOC levels (e.g., [Mark 1]) and click its button. Click on [Close] to go back to the Styles Editor. You should now see a pair of [Mrk Txt T.O.C.] codes appear around the "[Codes to the left...]" code.
    • Lists: If you are creating a WordPerfect List instead of a Table of Contents, the above procedure is essentially the same, but instead of Tools, Reference, Table of Contents in Step 4 you would use Tools, Reference, List from the Styles Editor menu. Choose the name of the List (or type one in the field if the field has no name yet), then click the [Mark] button. Click on [Close] to go back to the Styles Editor. You should now see a pair of [Mrk Txt List] codes appear around the "[Codes to the left...]" code. All custom styles with the same List name will appear in that List when it is Defined and Generated (see the column on the left for how to Define and Generate a Table of Contents; the process is essentially the same for Lists).
    • Outlines: You can use the above method to mark an Outline's levels, too, since they also contain embedded Paragraph styles. (Outlines can be created with Insert, Outline... or even more quickly with the automatic numbering method described here.) In this case you probably want to include the outline item's number in the TOC, so be sure to include the [Para Num] code inside the paired TOC codes, using the <Shift+RightArrow> method above.
  • Step 5. Close the TOC bar if it is open, and click OK to dismiss the Styles Editor. When you are ready to create the TOC, see the column on the left.

Optional

  • Want to reuse the new style? While editing the same document that contains the new paragraph Heading style that is now marked for the TOC, save (i.e., copy) the style to your default template so that it can be used in any new (blank) document based on the default template: Click Format, Styles, <select the style from the list>, Options, Copy, Default template, OK.
  • Want to create a hyperlink back to the Table of Contents, so that users can click on the custom style's text to return to the TOC? Here's how to create such a "reverse link":
    • First, be sure to create a bookmark at the top of the Table of Contents area. This is where WordPerfect will return to when the user clicks the custom style. Click on Tools, Bookmark, Create, and give the bookmark a name such as TOC. Be sure the bookmark is created outside (i.e., above or to the left of) the [DefMark][GenTxt]...[GenTxt] codes, so that it will not be accidentally deleted if you decide to regenerate the Table of Contents.
    • Then follow the steps above -- but instead of using Tools, Reference, Table of Contents in Step 4, use Tools, Hyperlink, and then click in the Bookmark drop list to select the bookmark name (e.g., TOC).
    • Tip: You can remove underlines from hyperlinks in the current document from the main WordPerfect menu: Click Format, Styles, and select Hypertext in the 'Available styles' list. (Note: If no Hypertext style is present in the document, the style name will not appear.) Then click Edit and delete the [Und] code in the Contents pane; then click OK. Note that this changes all hyperlink styles in the current document, even those that are used in cross references, and including the page numbers in the Table of Contents. (It's an all-or-nothing situation.)

Tips

  • You do not need to create a style in order to mark some text for inclusion in a TOC. As noted in Step 1 in the left column on this page, just select the text and click Tools, Reference, Tables of Contents, and then click the [Mark] button of choice. However, creating custom styles with the TOC-marking codes inside them (as described above) will let you apply other formatting to the text items at the same time you mark those items for inclusion in the TOC. For more on styles, see here.
  • Editing the Table of Contents: Once the TOC is generated (Step 3 in the left column), you can edit it -- it is ordinary text between the two special [Gen Txt] codes -- to remove any unwanted attributes, and remove any line breaks to "glue" the multiple-line entries into a single entry in the TOC. You can also format it differently by applying format codes to the entries. Be aware that these are superficial changes that will disappear if you re-generate the TOC: Everything between the paired [Gen Txt] codes will be deleted and replaced when you generate the TOC again. (For more permanent TOC formatting see the "Advanced topic" tip below.)
  • Multi-level TOC: You can create multi-level Table of Contents entries by choosing the appropriate TOC level (e.g., [Mark 2], [Mark 3], etc.) while using the method described above. You will need to create (or edit) several styles, one for each level.
  • Spacing: If you want to reduce the spacing between a Paragraph heading style (e.g., Heading 2 or MyHeadingStyle 5) and the following body text (i.e., the next paragraph), see here.
  • Speed up marking entries: If you have lots of "non-style" (i.e., plain text) items to mark for inclusion in the TOC, you can record your TOC-marking steps to create a macro to mark them more quickly (once they have been selected) for a particular TOC level. Select an item, then use Tools, Macro, Record and click Tools, Reference, Table of Contents, then click [Mark 1] for a top-level entry, [Mark 2] for a second-level entry, etc. Stop recording with the Stop button on the macro toolbar.
  • Advanced topic: In contrast to the formatting contained in standard or custom document Heading styles, the formatting of the TOC page itself is governed by up to five predefined TOC styles: TableOfCont1 ... TableOfCont5. These built-in styles apply to the TOC levels you have chosen to use in the Define Table of Contents dialog (Step 2, left column of this web page), and they apply only to the current document. However, they can be edited to change their format codes for the current document's TOC. (For a macro technique to do this, see Footnote 4.) The changes become effective in the document immediately, so you can do this either before or after a TOC has been generated in that document. Re-generating the same document's TOC will not effect their new formatting since the formatting is now contained inside the TOC page's style code(s).
  • Advanced topic: As noted above, you do not need to create a style in order to mark some text for inclusion in a TOC. You can simply select the text and click Tools, Reference, Tables of Contents, and then click the [Mark] button of choice. This procedure can be automated with macros. See Footnote 1.

For some basic information about styles, and several links to related pages about styles on this site, see here.

[Page top]


Footnote 1
[Intermediate to Advanced users]

[Tip: Macros such as those below can be copied into WordPerfect. See here for brief instructions.]

Here is a macro that can mark selected body text for inclusion in a Table of Contents. (Note that this doesn't mark a previously created custom paragraph style; see the method described at the top of the right-hand column above.) The macro marks the selected body text as a Level 1 entry in the TOC. Modify copies of the macro (as explained below) for others TOC Levels. The macros can then be assigned to a toolbar or keystroke combination as explained here.

// Macro code begins -

If(?BlockActive)
   MarkTableOfContents ()
   Sendkeys("{Alt+1}{Alt+c}")
Else
   Messagebox(;;"Select some text first")
Endif

// Macro code ends

Change the "1" in the SendKeys command to 2, 3, 4,or 5, as needed for the particular TOC Level desired.

[Not tested in Windows Vista. There are reports that Sendkeys() can be problematic in the new operating system.]

[Page top]

 

Footnote 2
[Intermediate to Advanced users]

If you cannot see a Define button in the Reference Tools dialog and you are using Windows XP, it might be because Reference Tools dialog has been “truncated.” There's a setting in Windows XP that might be causing the problem. Right-click on the Windows desktop, then click Properties (or click the Start menu, Settings, Control Panel, Display). Click the "Settings" tab, then click the "Advanced" button in the lower right-hand corner of that tab. Under DPI setting, make sure the drop-down displays "Normal size (96 DPI)" rather than "Large size (120 DPI)". [Click here for a screen shot of what the Reference Tools dialog should look like.]

Some users have reported they can increase the setting beyond 100% (96 DPI). For them, at 117% all buttons on the Reference Tools dialog's T.O.C. tab are present; at 118% the bottom buttons are missing because the dialog is truncated.

Note that in some situations increasing the DPI will make the numbers on your WP ruler invisible. This is a known issue.

If you still need to increase the size of dialog (and other Windows elements) text, here's a tip from Charles Rossiter (Corel C_Tech):

"Instead of changing the dpi, you can edit the display settings through Windows Start, Settings, Appearance tab, Advanced button. Click on item, and you get a list of about 20 items. Go through that list and increase every font size by 2 points (as a starter example).

If you increase the size of the characters that way, without changing the dpi, you will not lose the ruler measurements, nor disrupt the reference tools dialog."

[Page top]

 

Footnote 3
[All users]

While you can format the TOC after it has been generated, you might want some formatting to "stick" if you have to regenerate it several times. Regenerating the TOC will delete the existing TOC -- including any changes in format that you might have made. The trick is to either place the formatting code before the TOC codes, or select the entire TOC and its defining codes (as explained below) and then apply your formatting.

Example: Format the TOC into two columns.

If you want to format the TOC into columns, here's a way to do it that lets you regenerate the TOC without upsetting the column formatting.

1. Back up your document. Generate the TOC (Tools, Reference, Generate).

2. In Reveal Codes, place your cursor immediately to the left of the initial |[Def Mark][Gen Txt] codes at the beginning (top) of your TOC. (The cursor in your Reveal Codes is shown here as a red "|".)

(N.B.: Also check that no other paragraph format codes, such as [Para Spacing], are present. Sometimes these can mysteriously affect the TOC when regenerating it. So you should apply such formatting after creating the two-column format.)

3. Hold the Shift key down while you move down with the arrow or Page Down keys until you have selected everything in the TOC including the last [Gen Txt]| code. (Again, the cursor is shown here in red "|".)

4. Click Format, Columns, Balanced newspaper (if that's what you want), OK.

The TOC should now be in two columns, with headings and page numbers in the same column(s).

5. Save the document under a different name to back it up again (as a separate document), just in case there are problems with the next step.

6. Test things by making a change to a heading (or other marked TOC item) in the body text area of the document (e.g., edit a heading's text, or add a new heading, or delete an old one, or edit the heading [Para Style] to change the marked TOC level for that heading [as explained above, under "How to mark a custom style for automatic inclusion in a Table of Contents"]).

7. Then regenerate the TOC with Tools, Reference, Generate.

The TOC should remain in two columns, but the changes you just made should be visible.

Tip: Wait until the final draft to make any further format changes to the TOC (back up the document first, of course).

[Page top]

 

Footnote 4
[Intermediate to Advanced users]

[Tip: Macros such as those below can be copied into WordPerfect. See here for brief instructions.]

Here is a sample of a macro that can automatically change a single Table of Contents style -- the style that governs the format of the Table of Contents page itself, normally assigned with the Styles button on the Define Table of Contents dialog or toolbar.

[For a macro that can change an Index style, see the next macro below.]

This particular sample macro changes the style for TOC Level 1, and uses several new format codes, shown in dark red. You must use the StyleEditBegin command to "point to" the appropriate style to revise, then change the various format commands to your preferences.

You can repeat this code segment four more times -- one segment for each subsequent TOC Level -- to produce a single macro that can modify all five levels of the TOC styles in one operation.

Note that this changes the TOC style for the current document only. At this time, the most recent version (WPX3/sp2) sometimes will not allow you to change the TOC styles in the default template. In any case, it seems to be a better idea to use a macro to quickly set up a TOC's format for a particular document, since the new TOC format will be document-specific. It should be easier than going back into the default template to change the TOC system styles back to their defaults if they are not the currently required format -- assuming you can remember the default formatting for these five styles.

// Macro code begins -

// Change the Style name in the next command for other TOC levels:
StyleEditBegin (Style:
ToC1Style!; Library: CurrentDoc!)
StyleCodes (State: WithoutOffCodes!; Library: CurrentDoc!)
// Delete everything in the Contents pane:
While(?RightCode>0 or ?RightChar<>"")
DeleteCharNext
Endwhile
// Enter new format code commands here:
HardReturn
Indent
BackTab
FontSize (FontSize: 14p)
Font (Name: "Arial Regular")
AttributeAppearanceOn (Attrib: Bold!)

// Exit from the Styles Editor:
SubstructureExit ()
StyleEditEnd (State: Save!)

// Macro code ends

If you are wondering whether it is possible to do the same thing with an Index, the answer is yes. Here's a macro that will change the style of Index level 1 (which appears as [Para Style: Index1] in Reveal Codes).

Using a macro might be better than saving the new, modified Index styles to the default template, since there might be new documents where you do not want the new Index styles. Moreover, you might want different styles for different Indexes.

In the same manner as explained for the previous macro, you would need to create a separate macro for Index level 2. And as with the previous macro, the changes are document-specific.

This particular sample macro changes the style for Index Level 1, and uses two new format codes, FontSize and Font, shown in red. You must use the StyleEditBegin command to "point to" the appropriate style to revise (Index1Style! or Index2Style!), then change the various format commands (in red) to your preferences.

// Macro code begins:

// Change the Style name in the next command for other Index levels:
StyleEditBegin (Style:
Index1Style!; Library: CurrentDoc!)
StyleCodes (State: WithoutOffCodes!; Library: CurrentDoc!)
// Delete everything in the Contents pane:
While(?RightCode>0 or ?RightChar<>"")
DeleteCharNext
Endwhile
// Enter new format code commands here:
// (The first 4 commands are the WP defaults for Index1 -- i.e., level 1)
Indent
Indent
BackTab
BackTab
FontSize (FontSize: 10p) // (new)
Font (Name: "Arial Regular") // (new)

// Exit from the Styles Editor:
SubstructureExit ()
StyleEditEnd (State: Save!)

//Macro code ends

[Page top]