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

Barry MacDonnell's
Toolbox for WordPerfect

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

Page updated Sep 14, 2024

WordPerfect Tips
Main tips page | Browse tip

How to create a
Table of Contents
and how to automatically include items in it


•  I. Overview

•  II. Method

•  III. Some tips for the Table of Contents feature

•  IV. How to "mark" a custom text style for automatic inclusion of its text in a TOC

IV(a). Options for styles marked for the TOC

IV(b). Tips for styles marked for the TOC


Related pages -

•  To create a WordPerfect List see here. (Lists are similar to a Table of Contents but with some advantages, such as being able to use several lists in the same document.)

•  To create an Index
or a Glossary see here.

•  To create a Table of Authorities see Corel's support database here and here; also see this post at WordPerfect Universe (which references CiteLink and FullAuthority).
[Update: See Corel's Perfect Authority for purchase
here (also included in the Legal Edition).]

•  To create a bibliography with WordPerfect see this article on the Corel support site.


"History records that the Table of Contents was invented by Quintus Valerius Soranus before 82 bce."
[- The Book Designer, Parts of a Book]


•  Navigating the document while editing -

If you are using WordPerfect's own Heading styles or you are using  custom styles marked for inclusion in a Table of Contents, they will help you quickly navigate the document while editing it by using the Document Map feature (released with WordPerfect 11) located on the View menu.

The Document Map can also detect items marked for a Index or a Table of Authorities.

Note that the Document Map sidebar stays open until you close it with the "x" button. And you don't have to generate a Table of Contents or an Index to make use of this feature. It just uses the hidden TOC/TOA/Index markers embedded in the document text or in a style code.

For more information see WordPerfect's Help (F1) and Search for "Using the document map".



 





I.  Overview


  WordPerfect needs to know what to include in a Table of Contents (TOC).
Before you can have WordPerfect automatically create a Table of Contents (TOC), the words or phrases you want to be included in the TOC must be marked (or "tagged") with special format codes. Then WordPerfect can find their locations and list them in a TOC.

This can be done in the three easy steps outlined below but please read the rest of this Overview which introduces a few terms and  features, and gives you some things to consider that could save you time in the long run.

  Some things can be automatically included in a TOC.

WordPerfect's five standard paragraph Heading stylesHeading 1 through Heading 5, accessed via a drop list on the Text property bar or from the Format, Styles menu — will automatically include their text as individual entries in the TOC when it is defined (in step 2 below) and generated (in step 3).

Heading styles on text property bar

This is because these styles contain the necessary internal TOC-marking codes as part of the style formatting.

For example, applying the Heading 2 paragraph style to a selected word or short phrase will cause that word or phrase to be formatted and be automatically included in the TOC as a "level 2" (i.e., indented) entry when you define and generate the TOC.

[Defining and generating a TOC is explained in Steps 2 and 3 in the  Method section below. ]

This is very handy and it's a major reason to use these "factory shipped" styles (or customized versions of them) when you need to introduce sections of a document (e.g., Chapters, Sections, Appendices, etc.) with text headings.

Tips

¤  The five standard Heading styles can also be edited very easily to change their formatting in order to customize them. Here's the basic method:

Once such a style has been applied in a document, double-click on any instance of that [Style] code in Reveal Codes. The Styles Editor that appears has a menu and toolbar which you can use to add or change format codes to the Contents pane in the Styles Editor.

The changes made this way will be stored in the current document (only) and apply to all instances of the text in the document to which that style was applied.

[Note: Be sure not to delete any [Mrk Txt T.O.C.] codes from the Styles Editor's Contents pane. This code is responsible for including the text as an entry in the final TOC.]

For more on this topic (making and saving your changes, etc.), see the CustomStyles page.

¤  You can "mark" your own user-created styles for automatic inclusion of the style's text in a TOC. This is covered in a separate section below.

  Some things need to be manually marked before they can be included in a TOC.

If you have items that you want included in a TOC but they were not formatted with any of the five standard Heading styles -

•  you can go through the document and mark each item manually with a simple select-and-click procedure, as explained in Step 1 below;

- or -

•  you can optionally use your own customized text style (see below) and simply apply that style to any text you want included in a TOC;

- or -

•  you can do both in the same document.

Then when you are ready to produce the TOC simply follow Step 2 and Step 3 below to define and generate it.

II.  Method
red check mark The following 3 steps are quick and easy to do — in fact, they are easier to do than to describe. Many of the annotations, tips, etc., are primarily for reference and to help you fix TOC format issues that might arise.

red check mark You can skip Step 1 if you are using only the 5 standard Heading styles that are included with WordPerfect and/or specially marked custom styles or outline styles (see below), since these special styles will automatically include their text as entries in the TOC when you complete Step 3.

red check mark However, continue with Step 1 if you have regular text (even if it is initially formatted) that you want to automatically include in the TOC. This is a simple select-and-click process. (For WordPerfect Outlines or other existing styles used in the document, you will want to mark their format codes in a special way; see the next main section below.)

red check mark Note that you can use both the 5 standard Heading styles (including any specially marked custom or outline styles) and manually marked text in the same document.


Step 1.
  Mark the words or phrases in your document that you want included in the TOC. These typically include chapter titles, section headings, etc.

Remember that the program's built-in Heading styles described in the Overview are already marked for automatic inclusion in the TOC with internal style codes, so don't manually mark them again (Step 1(b) below) since the style's internal marking will take precedence anyway. (This caveat also applies to any custom styles and outline styles you created and marked using the methods in the separate section below.)

Therefore, when using the standard Heading styles just

- select your chosen text with mouse or keyboard,
- apply the desired Heading style, and
- go to Step 2 when you are ready to create the TOC (or to Step 3 if it's already created).

Note that you can not mark text for a TOC that is inside certain "structures" such as headers, footers, or watermarks. These features are considered separate from the main document and are designed primarily to display on one or more pages from where they are created. So the Tools, Reference, Table of Contents choice described below will not be available when your cursor is inside such a structure.

Step 1(a).  Select the text you want included as an item in the TOC. Use your mouse or keyboard, as you prefer.

Tips

The selected text can be quite large, such as several sentences.

Sometimes it is more accurate to use the keyboard (e.g., Shift+arrow keys) when selecting text embedded in several format codes.
(Such codes can be removed from the TOC entries later; see the tip below for more about such extraneous formatting. But it will save time and effort if you omit them from the selection in the first place.)

Generally it is better not to include any format codes or styles from the document's text areas that lie within the boundaries of a manual selection, unless you actually want them to appear in the TOC entry. You can check Reveal Codes while you make a selection. [See also the tips below about applying custom formatting to just the TOC.]

Step 1(b).  Mark the selected text. 

Click on Tools, Reference, Table of Contents.

The Reference Tools dialog appears:


Reference Tools dialog - Mark items

Click on the [Mark 1] button to mark it as a top-level TOC entry (e.g., all your Heading 1's), the [Mark 2] button to mark it as a second-level TOC entry (e.g., all your Heading 2's), and so forth.

As noted on the dialog, each button simply corresponds to a desired level of indentation in the TOC — i.e., the number of indents from the left margin.
(The tab setting at that location determines the actual amount of indentation for each level chosen.)

The result of using these buttons on the currently selected document text can be seen in Reveal Codes as pairs of "On/Off" codes surrounding the text, depending on the chosen level of indentation: [Mrk Txt T.O.C.: 1],
[Mrk Txt T.O.C.: 2], etc.

Repeat Steps 1(a) amd 1(b) as needed.  It you need to mark more items later, just repeat Step 1. Then repeat Step 2 (if a TOC does not yet exist) and/or Step 3 (if a TOC exists so as to regenerate it and display the changes).

Tips

¤  This dialog will remain on screen until dismissed. Note that it can be dragged to reposition it by first placing the mouse cursor on the title bar until the cursor changes to a 4-headed arrow. Also, if you drag it to the top or bottom of the document area it will become docked above the ruler area or below the Reveal Codes area, respectively. To undock it, place the mouse cursor on an empty part of the Reference Tools's tab area or the bottom area first, then drag it back to the main document area.

¤  You can use small macros to automate marking the text.
See Footnote 1 below.

¤  Do you have a problem seeing the entire Reference Tools dialog? If you cannot see the [Define] button (or any of the other options on the line below that button) it might be because Reference Tools dialog has been “truncated.” There's a Windows setting that might be causing the problem. See Footnote 2 below.


Step 2.  Define the TOC — i.e., tell WordPerfect where to place the TOC, and how many levels to use. (A level defines how many tab stops to indent the entry from the left margin.)

Step 2(a).  First, place your cursor where you want the TOC to appear in the document.

Tips

¤ Typical layout: You could create a blank page at or near the top of the document (Ctrl+Enter will insert a hard page break code [HPg]) with a title (e.g., "Table of Contents"); then insert a couple of hard returns (with the Enter key) to provide a separation between the title and the TOC. Place your cursor where the TOC entries should begin.

Related tips:

▸  If you wish to apply formatting to the title (e.g., center justification), then -

(a)
as long as there is at least one hard return ([HRt]) following the title, select (double-click) just the title text and apply the formatting to the selection; this will "bracket" the text with its own formatting codes (note that other formatting besides centering, such as bold text or large relative size, can be applied the same way);

    - or for centering -

(b) use Format, Line, Center to add a "hard center on margin" code, which will center the line without affecting any new or existing text below the selection.

Either format method should help prevent a conflict with the TOC's own formatting (which is controlled by its own internal style).

▸  If you decide to add a blank page and/or a TOC title after the TOC is generated (Step 3) see the Regenerate tip below.

¤ Custom layout: You can create a multi-column table and place your cursor inside a cell; this will give you other formatting options later (cell borders and fills, additional text, etc.). [See also some related post-TOC-generation tips below.]

Step 2(b). On the Tools, Reference, Table of Contents (tab) click the [Define] button:

Reference Tools dialog - Define button
[Can't see the [Define] button? See tip above.]

The Define Table of Contents dialog appears:

Define TOC dialog


Step 2(c).  Choose the number of levels that you want to use in the TOC.

At the top of the Define Table of Contents dialog, type a number in the "Number of levels (1-5)" field or click on a spinner arrow in that field to set the number.

For example:

If you used both the Heading 1 and Heading 2 styles in the document, you could set the number to 2.

Typically, you might set more than one level (the maximum is 5 levels). Setting extra levels, even if you don't need them, is harmless — although it means that you probably will see a lot of indented ("stepped") entries in the TOC if you actually used some of the other 5 Heading styles and/or you manually marked items using more than one or two TOC levels (in Step 1(b)).

You can also set fewer levels than were actually used in the document. The "Number of levels" set in this dialog simply means the number you want to use (i.e., display) in your TOC; the items marked in the body of the document are not affected (i.e., changed or deleted) by this setting.

Note that you can always change any of the settings in this dialog later, as explained in Step 2(d) below.

Optional:

•  You can set the Position of 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 (as shown in the image above), but you can use other numbering positions — or no numbering at all, in which case the TOC's Text entries will be hyperlinked directly to the relevant pages.]

•  The [Styles] button lets you change the TOC's text format for each level in the TOC area (not in the body text area) to some other pre-existing custom paragraph style (see the Advanced Topic#1 tip below).

•  Use the custom [Page Numbering] button to change the numbering format for any of the levels.

A tip from WordPerfect X6's Help:

If you are using secondary, chapter, volume, and total page numbers, you can put them together in the table of contents, for example, “Chapter 3, Page 98.” 

You can type text and punctuation between the page number codes, for example, [Page #] of [Tot Pages #]. 

•  The checkbox at the bottom, "Display last level in wrapped format," will wrap any long entries in the last level used.

Step 2(d).  Click OK on the Define Table of Contents dialog.

In Reveal Codes, 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, like this:

[Def Mark][Gen Txt]<<Table of Contents will generate here>>[Gen Txt]

Tip: You can double-click the [Def Mark] code to bring up the Define Table of Contents dialog if you need to change things in the TOC definition.

Step 3.  Generate the TOC.

Step 3(a).  Click the Generate button at the bottom of the Reference Tools dialog. 

Tips:
- This function is also located on the main Tools, Reference menu.
- For more on the Auto geenerate button check box see below.


Reference Tools dialog - Define button

In the Generate dialog that appears, you are given two choices: Save Subdocuments, and Build hyperlinks. Both are enabled by defauult.

Generate dialog showing 2 options

The first option is useful if you are working in a Master document which has one or more subdocuments (for more on this topic see here). If you are not working in a Master document this option has no effect. [Note that the program must open each linked subdocument, generate it, then re-save it. This might not be desirable during some editing operations, and in any case it might take some time if there are many subdocuments. If this is the case simply disable (clear) the check box.]

The second option is useful if you have (or need to have) hypertext links in the document — such as those applied to the TOC and Index page numbers.

Notes and tips about the second option

¤  If the document is to be printed on paper you can disable this Generate dialog option to prevent hyperlinks from being created and thereby showing up as blue underlines in the printed document.

If they already exist in a document the blue underlines can be removed with their links
(or removed without deactivating the links). See here which shows other ways of preventing them, or even changing their appearance.

¤  When WordPerfect builds hyperlinks in a document when you generate or re-generate the document — e.g., between entries in a Table of Contents, Index, etc., and various other locations in the document — it creates a hyperlink connection between each source item (e.g., a TOC entry) and a target item (e.g., a document Heading or a custom style).

It does this by using special format codes at both locations. In Reveal Codes the source of the link can be seen as a pair of  [Hyperlink] .. [Hyperlink] codes surrounding a page number or other linking text, and a single [Bookmark: Hyperlink] at the target location.

These are internal connections; therefore, they do not appear as individually named items in any of the Tools menu's dialogs. So if you deleted just these special codes (and not the surrounding [Para Style] codes) you should be able to restore them by re-generating the document with the second option enabled on the Generate dialog.

Step 3(b).  Enable (tick) one or both options. Most often — particularly if you do not have any linked subdocuments in the current ("master") document — you can just click OK to accept the default settings (i.e., leave both options enabled).

Step 3(c).  Click Close on the next dialog to return to the main document.

Done!

The TOC should now display all entries that were marked in the document in Step 1.

(Strongly recommended:) See the Tips section below for more on regenerating the TOC if document pagination changes, editing and formatting the TOC, generating multiple TOCs in the same document, etc.

[Page top]


III.  Some tips for the Table of Contents feature

red check mark  Regenerate!

•  If you add or remove marked text (or the TOC marking codes added in Step 1) or you add or remove other material or format codes in the document that might cause changes in pagination ** be sure to generate the document again. This will rebuild the hyperlinks between the TOC entries and the referenced page numbers.

You can do this with either -

[a] the main menu's Tools, Reference, Generate choice; or

[b] the Generate button on the Reference Tools dialog (Step 3 above); or

[c] a shortcut key (on Windows keyboards it's Ctrl+F9; on the DOS 6.1 keyboard it's Alt+Shft+F5); or

[d] the Generate dialog that appears if the Auto generate option is enabled (see below).

•  See the next tips (and cautions) about editing and formatting the TOC itself.

•  See the last tip below about using the "Auto generate" checkbox option. There are four reasons why you might not want to use it.

--------------------
**  Changes in pagination (above) in reference to the TOC feature means anything you do during editing that might cause some document page numbering to change and therefore not agree with a previously generated TOC's references (and links) to those pages.

This can happen by adding even a small amount of text or a graphic image that pushes subsequent material downward, or by deleting material that drags subsequent material upward. It can also happen by re-formatting document material (e.g., changes in font type or size, line or paragraph spacing, indentation, page margins, etc.)

Since a TOC is usually placed at the top of the document, this caution includes adding material above the generated TOC area, such as adding a title like Table of Contents in a larger font and/or with extra spacing between the title text and the TOC itself.

All such things (including those in the tips below) might move subsequent material enough to cause some of the document's page numbers to differ from the TOC's page numbers.

Hence, it's generally a good idea to always regenerate the TOC after the final draft to ensure the TOC is correctly numbered. (But see "Important point #2" below which discusses how the program can remove your custom TOC formatting.)

  red check mark Custom TOC layouts - Editing and formatting the Table of Contents.

☼  Tips on formatting the TOC before you create it:

•  You can, for example, create a multi-column table first, and then place your cursor inside a cell in Step 2 above; this will give you other formatting options later (cell borders and fills, additional text, etc.).

•  A TOC does not need to be on a separate page. You can put it on a page with other text or even inside a graphic box, which can be re-sized and/or dragged into another location. [Some newsletters put the box inside (or overlapping) a column on page 1.]

Just create the box: Insert, Graphics/Pictures, Text Box; then drag it to a new position if desired; then click inside it to position the cursor in the box; then define the TOC (Step 2) and generate it (Step 3).

The box itself can be further formatted by clicking outside it then right-clicking directly on it to get a list of options.

☼  Tips on formatting the TOC after you create it (Steps 1-3 above):

[You might want to back up your document before making changes to a TOC's existing format.]

•  A generated TOC (i.e., the entries and page numbers) can be edited and formatted just like any other block of text.

►  Important point #1  ◄

The TOC material is mostly ordinary text (with each TOC entry formatted with a special paragraph style) placed between the special [Def Mark][Gen Txt] ... [Gen Txt] codes that you can see in Reveal Codes (see Step 2(d) above).

For example, you can -

▸  Add tabs or indents to certain entries.

▸  Select the entire generated TOC area and set new paragraph spacing for it with Format, Paragraph, Format, Spacing between paragraphs. Sometimes adding even fractional spacing helps make the TOC more readable.

▸  Select the generated TOC area and add automatic numbering to the entries in it (or if you select part of the TOC you can apply numbering to just that part) with either an outline style or with a counter style. (Ctrl+z can usually Undo the change, so try different outline styles.)
    Note that instead of this method you could just automatically number document's section headings or use a marked outline style for your document's headings as explained here. This way the numbers will also show up in the generated TOC without the need to renumber those items.

▸  Remove unwanted format attributes, line breaks, etc. Tip: for large TOCs, WordPerfect's Edit, Find and Replace can find and remove the unwanted format codes in just the TOC if you select it first.

▸  Fix problems such as run-together TOC entry lines caused by prior use of Full (or All) justification in the document. For example: Just select the entire block of TOC material — including the [Def Mark][Gen Txt] ... [Gen Txt] codes — and then apply Left justification to that block.

Whatever you do to the TOC after you generate it, be aware of possible effects on subsequent document material: You might be causing unwanted movement of that material due to automatic line wrapping (a.k.a. "text flow"), possibly causing changes in page numbering which, in turn, could result in incorrect page references in the TOC as was noted in the Regenerate tip above.

Usually, if the TOC (and its title, if any) is isolated from the rest of the document by being positioned on its own page(s)
i.e., separated from other material by a hard page break (Ctrl+Enter) there shouldn't be such problems unless your post-generation edits of the TOC or material above the TOC cause those areas to expand into additional pages.

►  Important point #2  ◄

Each time you regenerate a Table of Contents (or a List, or an Index) WordPerfect replaces the existing entries — i.e., everything between the paired [Gen Txt] ... [Gen Txt] codes. This can include custom formatting you added later into a generated TOC.

Therefore it might be best to refrain from adding text, creating new items (e.g., a Header or Footer) or changing formatting in the area inside (i.e., between) these paired TOC (or List or Index) codes until the final draft of the document, after it has been regenerated for the last time.

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.

Keeping this in mind, here are some more tips:

•  Use WordPerfect table formatting on the TOC.

You could also select the TOC and click Table, Create (be sure to use Paragraphs as the Text Delimiter). WordPerfect will create a table using each TOC entry as a separate row. You can then insert other coulms or rows (right-click in the table and choose Insert) for other purposes, remove borders, etc.

[For several tips on using WordPerfect tables in a document see here.]


•  Use WordPerfect table formatting to alphabetically sort a second TOC.

You can copy a newly TOC (be sure to include the [DefMark][GenTxt]...[GenTxt] codes that "bracket" the TOC) to another location — typically on a new page just after the first TOC.

Then, when you generate the document again, both of the TOCs will be generated — and you can then convert the second one into a table (as described in the above tip). The table can be sorted
alphabetically (Tools, Sort, "First cell in a table row") by TOC entry. Obviously, this is best done on the final draft of the document, for the reasons discussed in the important note above.

After sorting the table:

You can remove the table's cell structure (i.e., lines and borders) with a choice on the Table Property Bar: Convert > "Separate text with paragraphs...".

Note that this can also be done from a dialog that pops up when you manually delete the [Tbl Def] code in Reveal Codes for that table.

Either way, this should restore the TOC to its normal formatting.

Be sure to verify the page numbers in each TOC in the final draft. (You can't be too careful.)

•  Tables can be converted back to normal document text.

See the Txt2Tbl.html page for some tips here.

•  Use WordPerfect column formatting on the TOC.


red check mark
You can create multiple versions of a Table of Contents at different locations in the same document, each one relevant just to the adjacent section of the document. (This trick is based on a tip described by Noal Mellott in a post on WordPerfect Universe.)

A note before you try this method...

A potential problem with using multiple Tables of Contents — i.e., extra copies of the generated TOC interspersed in the body of the document is that their entries (and page numbers) typically refer to document items (e.g., Headings, Chapters, etc.) further down in the document.

So making one or more duplicates of the generated TOC (see method below) and inserting them into the document will push down the material that follows the insertion(s). This is what happens when any text or other material is inserted above a given point and a generated TOC is mostly text with some specialized format codes.

Conversely, deleting some entries as suggested below in one of the TOC copies will "close up" the material below that TOC, and this might, and likely will, affect the accuracy of entries in one or more of the document's TOCs.

Further, re-generating the TOCs will not help since it will remove all but one of the TOCs (there can normally be only one TOC is a document), and remove all intra-TOC edits, such as special formatting, as well.

The result of the method below is a possibility that each TOC in the document will have entries and corresponding page numbers that no longer accurately point to some of the actual (referenced) items in the body of the document.

Possible solutions or alternatives:

•  Add an extra empty page (or pages) with Ctrl+Enter where you want to insert the additional TOCs i.e., "reserve" a space large enough at each location for the extra TOC copy before you generate the initial TOC. Once generated, it should help maintain TOC pagination.
(Or else create the space after you have edited the copies to restore proper pagination; see step 6 below. Some experimentation might be required.)

•  Use a WordPerfect List at each location where a "Table of Contents" is needed. This feature is similar to a TOC in that it associates page numbers with entries in the List. It is less complicated than the method below, but the process is otherwise similar to generating a TOC.

Advantages:

1. You can place the List wherever you want in the document.
2. More than one List can exist in the document. Each List can be different from other Lists, and can be easily updated as needed.
3. A Table of Contents in a document can reference one or more Lists — they are not mutually exclusive.

But there are some small disadvantages:

1.  You will need to manually mark each item in the document for a List, whereas the Heading styles or custom-marked styles described elsewhere on this page can include the items automatically in a TOC.
2.  WordPerfect Lists do not have "levels" like a TOC, so you would need to format (indent) items to create them — though this is easy to do.

Method:

[1]  If a TOC has not yet been defined, define it in the document as explained in Step 2 above. [You do not have to generate it at this time (see Step 3) to display all TOC entries, but no harm is done if you do.]

[2]  Open Reveal Codes and look for these two TOC codes:
[Def Mark][Gen Txt].

[Note that the [Gen Txt] code is the first part of a paired code; the second part will appear at the end of the TOC entries after the TOC is generated (see Step 3 above), thereby "bracketing" all the TOC entries.]

[3]  Carefully select the [Def Mark][Gen Txt] codes (using Shift+Arrow is often easier to select codes) and copy them to the Windows clipboard with <Ctrl+c>.

[4]  Navigate to the next place you want a TOC to appear, optionally create a new blank page for that TOC with<Ctrl+Enter>, and paste the codes there with <Ctrl+v>. Repeat pasting these codes into different document locations, as desired.

[5]  Generate the document as explained in Step 3 above to create the various TOCs ... then:

[6]  Edit each TOC's entries to remove unwanted entries from that particular TOC to retain just those that are relevant to that section of the document. [Note that for longer TOCs this can cause changes in subsequent pagination, so you may have to add blank pages (with <Ctrl+Enter>) after the edited TOCs to retain the original "downstream" pagination.]

[Reason for the method: If you just use the TOC tab's Define button (the typical case), the program will remove all but the current set of TOC codes, so you can only have one TOC using that standard method. This is Working As Designed. Hence, you must use the copy-and-paste trick to insert multiple TOC codes at various locations.]

This completes the process ... except to note that if you re-generate the document (see Step 3 above) to refresh TOCs, an index, various lists, etc., you will need to do the TOC-editing step again. This is because using the Generate button removes all material between the paired [Gen Txt] codes (as explained above). Therefore all edits and changes in formatting to the TOC entries are best done on the final version of the document.

Alternative:
Use a WordPerfect List at each location where a "Table of Contents" is needed. This feature is similar to a TOC in that it associates page numbers with entries in the List. It is less complicated than the above tip. But the downside is that you will need to manually mark each item in the document, whereas the Heading styles or custom-marked styles described elsewhere on this page can include the items automatically in a TOC.


red check mark  Unexpected formatting in the Table of Contents is typically caused by extraneous formatting codes (e.g., [bold] or [italics], or [Tab] codes, or even numbering codes) that were included in the body text you manually selected and marked for the TOC (see Step 1 above).

Solution:

Extraneous format codes can be deleted later in the generated TOC entry, but such post-TOC editing is subject to the TOC regeneration issue described in the "Editing..." tip above.

Prevention:

Either -

(a) use Reveal Codes and make precise body text area selections to exclude any adjacent format codes when manually marking up the items for the TOC;

or -

(b) forego applying formatting attributes (bold, italics, etc.) directly to the text in your document's "headings" and simply apply a standard Heading style to the text (or apply a specially "marked" custom style; see the section below). These special styles can internally contain the desired formatting codes for the body text to which the style is applied, along with the necessary special TOC marking codes. When the TOC is generated using such special styles, the extra formatting is omitted from these TOC entries, leaving just the text in the TOC entries — normally, the desirable result. (Formatting can be applied to the TOC later, as explained in the "Editing..." tip above.

red check mark  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.

red check mark  Hypertext (hyperlinked text). When WordPerfect generates a TOC it typically creates hyperlinks around the page numbers in the TOC. (It also does this when generating an Index or a List.)

Notes and tips

¤ 
Automatic creation of hyperlinks assumes you have enabled the Build hyperlinks option when generating (or re-generating) the TOC.
See Step 3 above.


¤ Hyperlinks become "active" when you enable Tools, Settings, Environment, Activate Hyperlinks. Note that this setting is stored in the document when it is saved.

¤  If the document is to be printed on paper you can disable this option to prevent hyperlinks from being created and showing up as blue underlines in the printed document. Also, if they already exist the blue underlines can be removed (with or without deactivating them).

See Step 3 above.


¤ See also "Why some hyperlinks can fail to work while inside WordPerfect documents (.WPD, .WPT)".

red check mark  Remove page numbers from the Table of Contents. You can hyperlink just the text entries in the TOC rather than using hyperlinked page numbers. 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 text entries will become hyperlinked. [See previous tip about hypertext above).]

red check mark  Change the dot leader characters that connect to Table of Contents page numbers. The program typically uses dot leaders to connect TOC entries with their associated page numbers. But you don't have to settle for the default "dots". See Footnote 5 for how to change them or add spacing between each character.

red check mark  Auto generate option on the Reference Tools dialog. Note that the "Auto generate" check box option at the bottom of the Reference Tools dialog is enabled (ticked) by default when you first install the program.

Reference Tools dialog -Auto-generate option

This image shows it disabled — the author's preference.

The setting — enabled or disabled — for this option is "sticky" between WordPerfect sessions.

Purpose:

The Auto generate option (see image above) automatically detects the presence of any Reference Tools in the current document, and allows the program to display the small Generate dialog below whenever you try to print or save the document.

Despite its name, the Auto generate option does not automatically generate the current document without user intervention — which is something you might not want, especially during creation or editing the document.

Instead, it automatically displays the Generate dialog to alert you of the possible need to generate the current document (and any subdocuments) if it contains any of the Reference Tools
(e.g., entries and related page numbers in a Table of Contents (TOC), Index, cross references, etc.), in case you have made any changes in the document that might affect these items.

For example, adding a section to the document during the editing phase will most likely require an update to any existing Table of Contents to include any marked headings in that new section and their page numbers, as well as require the updating of the remainder of the TOC.

And, if the current document is a Master document, it also alerts you to the possible need to generate and save changes in any (linked) Subdocuments (for more on the Master documents and Subdocuments see here).

Briefly, the
Generate dialog options instruct the program to -

•  save any subdocuments (the program will open each one, generate it, then overwrite the original, which can take some time); and/or

•  build or update (rebuild) all Reference Tools' entries and their related hyperlinks/page numbers
in the current document, which should be fairly quick.

Generate dialog showing 2 options

See a bit more detail about these two options above.

Note:
 

Some users have found that if the Auto generate option is enabled one or more irritations or problems can occur, such as:

(1) the Generate dialog always pops up each time the document is saved or printed — even if the document has no Reference Tools in it;

    and/or

(2) the cursor can unexpectantly move to the bottom of the screen;

    and/or

(3) selected text might not be printed (WP11 and later versions);

    and/or

(4) printing can sometimes be slowed.

The remedy is the same:

Disable the option — but remember to manually re-generate the document (Tools, Reference, Generate) whenever changes are made to it that might affect any reference tools you have used.

[Page top]


IV.  How to "mark" a custom text style for automatic inclusion of its text in a Table of Contents


The information above describes how to manually mark ordinary text so that the text will appear in a Table of Contents (TOC), and also describes the several standard heading styles (Heading 1 through Heading 5) included with WordPerfect.

The five Heading styles automatically mark the text to which they are applied in such a way that the text will be automatically included as an entry in a TOC.

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

[Note: For WordPerfect 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 a document's section headings, topic headings, subtitles, or other divisional text this is a common question since these items probably should be included in a TOC.

Moreover, most people would want them to be included automatically in the TOC once the style is applied to this type of text in the body of the document.

For example, a WordPerfect user who was hunting for information on how to do it double-clicked on various standard Heading [Style] codes in Reveal Codes to view their contents and saw a unique code inside each one — which turns out to be a special code that is used to include, or "mark," the Heading style's text for inclusion in a TOC. [Note: These codes are discussed in Step 1(b) above.]

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:"

This is easier to do than it might appear at first — and even quicker after you have done it once or twice.


Step 1.

Either -

(a) create a new Paragraph heading style or new Character style with Format, Styles, Create (see the custom styles page if you need help);

or -

(b) edit an existing Paragraph or Character style with Format, Styles, <stylename>, Edit.

[Side note:

WordPerfect has five built-in TOC styles, TableofCont1 ... TableofCont5, that are used to format the generated TOC's text and which are visible in Reveal Codes in the TOC area. These special styles are different from the custom styles to be used in the body text area that are being described here, so if you intend to edit an existing Paragraph or Character style to mark it for inclusion in the TOC you should ignore these special TOC styles in the Format, Styles dialog list. [Advanced users: For more about these special TOC styles and how they can be modified, see the tip below.]]

Either way, a Styles Editor dialog opens (shown in the next step).


Step 2.

Let's assume you previously created a (Paragraph) Heading 2 style ("NewHeading2") that formats the style's text in a large, bold, dark blue color and you have opened that style in the Styles Editor (Step 1 above) to edit it (next image). [Note that the procedure also applies to creating a new style (see the Note below the next image).]

At the bottom of the Styles Editor dialog be sure to enable (tick) the two check boxes "Reveal codes" and "Show 'off codes'".

Styles Editor dialog

The first box lets you edit the Contents area by making format codes visible, and is typically enabled by default. 


Enabling (ticking) the second box lets you perform Step 3.


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.

In the Contents field of the Styles Editor, select just the single, long code labeled [Codes to the left are ON, codes to the right are OFF].

Styles Editor showing its long code

An easy way to do this with your mouse is to put the block cursor in front of this code (just click there) as shown, then hold down the <Shift> key, and press the <Right Arrow> key once.


Styles Editor with long code selected

►...Important...◄  

For most typical heading styles, don't select any other formatting or numbering codes in the Contents field unless you also want their formatting to be applied to those heading items in the Table of Contents, too.

Such mis-selection can result in a common problem whereby parts of the generated TOC are (e.g.) in different colors or sizes or have other unwanted formatting. [If you do want to format the TOC itself you should do so by following the tip below ("Editing the Table of Contents" and related tips).]


Step 4.

While this long [Codes to the left...] code is selected (a [Select> code appears just to the left of it as shown in the image above) click Tools, Reference, Table of Contents from the Styles Editor's menu at the top of that dialog. The Reference Tools dialog (or, in earlier versions, a Table of Contents bar) should appear:

Reference Tools dialog for the TOC

Step 4(a) On that dialog (or bar) decide on one of the TOC levels (e.g., for the example here we would choose [Mark 2] for a second level TOC entry) and click its button.

Step 4(b) Click on the [Close] button to go back to the Styles Editor.


Note here that the "Auto generate" box on that dialog was disabled — i.e., not ticked — for this example. This is the author's general preference; see above for the reasons.

You should now see a pair of [
Mrk Txt T.O.C.] codes appear, bracketing the [Codes to the left...] code in this sequence:

[Mrk Txt T.O.C.>[Codes to the left...]<Mrk Txt T.O.C.]

Styles Editor showing long code marked for TOC

Here, the block cursor in the Contents field was moved to the upper left of the field in this image to let you see the entire Contents field.

Note also that when you bracket the long [Codes to the left...] code with any pair of format codes (as was done here), the "Show 'off codes'" box will have no further effect: The long code will always be visible in the Editor for that style.

Notes on similar methods for Outlines and Lists

¤ WordPerfect Outlines

You can use most of the 4-step method above to mark an Outline's levels so they can be included in a Table of Contents, 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.

Further, custom outline schemes (explained on that linked page) can be set up and saved in your default template with their levels marked for inclusion in a Table of Contents using the special codes below.]


The easiest way to mark them in the current document might be to -

[1] first create the entire outline in the main document (or at least one instance of each level that could appear in the TOC);

[2] edit (double-click on) a single instance of each level's [Para Style...] code in Reveal Codes in the main document;

[3] be sure the "Show 'off codes'" box is enabled (ticked) in the Editor that appears (see image below); this displays the long "placeholder" [Codes to the left...];

[4] (unlike Step 3 above) select the entire contents of the Editor's pane (Shift+arrow works well to select material while moving the cursor); and then

[5] add the paired [Mrk Txt T.O.C.] codes around the selected material, like this:

- Click on Tools on the Styles Editor's menu (see image below), then click Reference, Table of Contents;

- on the Reference Tools dialog that appears, click the Mark button for the desired TOC level (Mark 1 - Mark 5 as shown in the image in Step 4 above); then

- click on Close, then OK.

- Repeat steps 2-5 for one instance of each of your other outline level's [Para Style] codes. (Modifying one instance of a given level's style modifies all instances of that level in the document.)

Important: You'll want to be sure to include the outline item's number/letter code in the TOC's entries, so include the [Para Num] code inside the paired TOC codes. (See next image.)

The screen shot below is an example of the result of marking an instance of an outline style for inclusion in the TOC. (Here, it's Level 1 of the outline.)

Once the TOC is generated, each such marked outline level in the document will appear at that level in the TOC — i.e., at the same indentation from the left page margin in the TOC as the outline's indentation in the main document.


Note the existence and placement of the beginning and ending [Mrk Txt T.O.C.] code pairs in the Contents pane:

Marked outline Level for the TOC

Other outline levels (2, 3, etc.) will have more [Hd Left Ind] codes.

Tip

Shorter blocks of text used for an Outline level (e.g., a single line or a short paragraph) that are marked for inclusion in the TOC using the method above might be preferable to several long paragraphs, since otherwise all sequential paragraphs of text at that particular Outline level entry will show up in the TOC as a single TOC entry.

You can easily work around this issue of too-large TOC entries by simply -

stopping the affected outline level in the main document immediately after a short phrase or sentence (e.g., used as the section heading) with the Enter key followed immediately by the Backspace key (to remove the next entry's number/letter;

•  indenting the following paragraph(s) of normal text to match the Outline's indentation for that level;

•  starting the Outline again (e.g., with the outline shortcut key*) for the next numbered item.

[Reference: See the Outlines page or the automatic numbering page for methods of quickly starting, stopping, or toggling outlines as you type.]

The short phrase or sentence will then show up by itself in the TOC since the following paragraphs in that Outline level in the main document were essentially excluded from that level's style.

----------
* The factory designated shortcut key to start or stop an outline is <Ctrl+H> (or if you use the DOS keyboard, <Ctrl+T>). This topic is covered under "Stopping and restarting and outline" on the Outlines page.

¤ WordPerfect Lists

Each item is (or already should be) marked for inclusion in the List, and when the List is generated the list item will point to the page where the item is located — just like a TOC. Thus, you probably would not want every item in the List to also appear in a TOC!

However, to include a single reference in the TOC to the entire List,

either -

[A} use a text phrase to introduce the List (e.g., "List of Figures") in the body text area and then either apply a standard WordPerfect Heading style to that phrase in the document,

or -

[B] apply a custom style to it that was previously internally marked as describe above.

Step 5.

Step 5(a) Close the Reference Tools dialog (or, in earlier versions, the TOC bar) if it is open.

Step 5(b) Then click OK to dismiss the Styles Editor.

Step 5(c) When you are ready to create the TOC see the method above.


[Page top]


IV(a).  Options for styles marked for the TOC
•  Want to reuse the new custom text style above ("...for automatic inclusion...in a Table of Contents") in other new documents?

While you are 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:

From the program's main menu, use Format, Styles, <select the style from the list>, Options, Copy, Default template, OK.

[You can also save it in a custom template, or even save it to disk so you can retrieve it later: see here.]

•  Want to create a hyperlink from the document back to the Table of Contents (TOC)?

Here's how to create such a "back link" (a.k.a. "return link," "reverse link").

Notes

¤  Back-linking can be used with any text, not just with a custom text style described above: Just use Method B in Step 2.

¤  With either Method below it can be helpful to open Reveal Codes first.

Step 1: Be sure to use this step with both methods:

•  Create a bookmark at the top of the Table of Contents area. This is where WordPerfect will return to when the user clicks the reverse link. Just use Tools, Bookmark, Create and give the bookmark a name, such as CONTENTS, then click OK to close the Bookmark dialog. This puts a [Bookmark] code in the document at the cursor location.

•  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. For example, if the title above the TOC is "CONTENTS" then a good place for the bookmark code is just to the left of that word's first letter.

Step 2: Use just one of these two methods for your desired hyperlink:

Method A: To create a back link to the TOC using a custom text style (above), add the hyperlink inside the custom text style's format code:

•  In the Styles Editor's Contents pane: Select the "long code" ("Codes to the left...") as described in Step 3 of the "mark a custom text style" above. Then use Tools, Hyperlink to open the Hyperlink Properties dialog.

•  In the Hyperlink Properties dialog: The Document/Macro field in that dialog should be set to the default of <current document> *. Click in the Bookmark drop list in that dialog to select the existing bookmark name (e.g., CONTENTS). [Screen shot] Click OK to close that dialog. A pair of [Hyperlink] codes should surround the long code. When you are finished creating or editing the style and the style is applied to some document text, that text becomes a clickable link.

- - -
* Use the Document/Macro field's default <current document> choice when linking anywhere inside the currently open (on screen) document. To link to some other document on your disk, you can click the Browse button Browse button with folder icon on the right side of the Document/Macro field.

- OR -

Method B: To create a back link to the TOC using any document text, add the hyperlink in the main document's text areas (i.e., body text, header, footer, footnote, endnote, text box, etc.):

•  In the main document area: Select some document text to use for the reverse link. This can be in the body text, or inside a header or footer or other document "substructure" such as footnote, endnote or text box. Then use Tools, Hyperlink to open the Hyperlink Properties dialog.

•  In the Hyperlink Properties dialog: The Document/Macro field in that dialog should be set to the default of <current document> *. Click in the Bookmark drop list in that dialog to select the existing bookmark name (e.g., CONTENTS). [Screen shot] Click OK to close that dialog. A pair of [Hyperlink] codes should surround the previously selected text. The text immediately becomes a clickable link.

- - -
* Use the Document/Macro field's default <current document> choice when linking anywhere inside the currently open (on screen) document. To link to some other document on your disk, you can click the Browse button Browse button with folder icon on the right side of the Document/Macro field.

Tips

• 
Use File, Publish to PDF to create a PDF from the current document. Note that the Publish to PDF dialog that appears has a Settings button (bottom right side). Click it, and under the Document tab verify that the options to "Include hyperlinks" and "Generate bookmarks" are enabled (ticked).

•  Using a header or footer to contain the hyperlinked item that links back to a Table of Contents (or similar structured text) has the advantage of displaying the hyperlinked item on every page where the header or footer is present. This might be a nice convenience for the reader, especially if the document is published as a PDF file. (Newer WordPerfect versions are much better at carrying hyperlinks over to the resulting PDF file.)

[For an example that uses two footers (A and B) to hold the hyperlinks to the Contents page, see the Automating WordPerfect Templates PDF here. Note that the clickable links in the PDf's footers (and in some of its footnotes) is a small, blue, upward pointing triangle symbol (); also, all underlines were removed from the links (see tip below).]

•  The above methods (particularly Method B) can be used to create hyperlinks to other parts of the document, such as a particular section or chapter, an index, a WordPerfect List, a specific table or graphic, etc. Just create the appropriate bookmark (in Step 1) at those locations.

•  You can also link to another document or web address in the Hyperlink Properties dialog's Document/Macro field: See WordPerfect's Help (F1) and search "Creating Hyperlinks".

•  If a hyperlink doesn't seem to work at all, see "Why some hyperlinks (hypertext links) can fail to work while inside WordPerfect documents" here.

•  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.)


[Page top]


IV(b).  Tips for styles marked for the TOC

•  Remember: 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 "How to create a Table of Contents," just manually select the text and click Tools, Reference, Tables of Contents, and then click the [Mark] button of choice.

However, creating your own 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. This is the same thing the standard factory-shipped Heading styles do.

You will also be able to quickly change the TOC level of particular custom styles by simply editing any instance of the style (see Steps above) to replace the TOC marks with new ones.

You can also use a macro such as ReplStyl to replace one such style with another. For more on styles, see here.

•  Editing the Table of Contents.

Once the TOC is generated (Step 3 in "How to create a TOC"), you can edit it — it is made up of 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 directly to the TOC entries.

Be aware that these changes will disappear if you re-generate the TOC: Everything between the paired [Gen Txt] codes will be deleted and replaced whenever you generate the TOC again. (For more permanent TOC formatting see the "Advanced topic" tip below.)

For more of formatting the TOC, see "Custom TOC layouts..." above.

•  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 MyHeading5) 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 #1:] Change the styles that format TOC Levels 1-5.

In contrast to the formatting contained in standard or custom document Heading styles, the formatting of the generated TOC area itself is governed by up to five predefined TOC (system) 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 in "How to create a TOC"), and they apply only to the current document.

However, they can be edited to modify them.

▸ For a macro method to automatically (and instantly) modify one or more of the five TOC Level styles for the current document whenever needed, see Footnote 4.

-or-

You can manually pre-create new TOC paragraph styles for the TOC Levels with Format, Styles and then "attach" them to each TOC level with Tools, Reference, Table of Contents, Define, Styles (button) for the current document.

-or-

▸ You can use manually use Format, Styles (or more directly, the Styles button on the Define Table of Contents dialog) to edit and change any of the existing TableofCont styles for the current document's TOC.

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 #2:] Automate the marking of text for the TOC with macros.

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 general information about styles and several links to related pages about styles on this site see here.

[Page top]
Footnote section

Footnote 1

[...Continued from above...]

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

Example 1:

Here is a macro that can mark selected body text for inclusion in a Table of Contents. You might find it easier or quicker than using Tools, Reference, Table of Contents and then clicking the Mark button. Such macros can be assigned to keyboard shortcuts, toolbars, or menus for rapid access.

Note that this macro (or the manual marking method described above) doesn't accurately mark body text to which a Heading style was previously applied, or to which a previously created custom paragraph style with internal TOC marks was applied. Therefore it should not be used on those items. To mark such items for the TOC, see the method described at the top of the right-hand column above, "How to mark a custom style...".

The sample macro below marks the selected body text as a Level 1 entry in the TOC. You will need to modify several copies of the macro (as explained below) for other TOC Levels. (Advanced users: You could combine all five TOCMark() commands in a "two-key" macro.)

// Macro code begins -
If(?BlockActive)
   TOCMark(1)
Else
   Messagebox(;;"Select some text first")
Endif
// Macro code ends

Note: Change the "1" in the TOCMark(1) command to 2, 3, 4,or 5, as needed for the particular TOC Level desired.

Tip: Items marked for inclusion in a TOC by using the manual method (see above), or by using this macro, can later be modified to change their TOC Level by re-selecting them in the document's text and applying a new level. A macro to go though the document and stop at each item to allow you to change the level can be found on WordPerfect Universe here.

Example 2:

If you created custom styles for the purpose of applying a style that was marked for inclusion in a TOC (discussed above), here is an example of how to use a macro to quickly apply that custom style to selected text. Then, simple macros, each containing the special command StyleOn("nameofstyle"), can apply the custom style to selected text. (Note: Change "nameofstyle" to your style's name, but retain the double quote marks.)

// Macro code begins -
If(?BlockActive)
   StyleOn("nameofstyle")
Else
   Messagebox(;;"Select some text first")
Endif
// Macro code ends

Note: Change "nameofstyle" to your style's name, but retain the double quote marks.

Tip: Custom styles can be easily changed by editing them, or replaced with another style with a macro such as ReplStyl.

Tip: An alternative to using this macro is to use the Text Property Bar's "Select Style" drop list to choose the style and apply it to selected text. If the macro is assigned to a keyboard shortcut, it may be faster to apply the style than using the mouse.

[Page top]


Footnote 2

[...Continued from above...]

If you cannot see a Define button in the Reference Tools dialog
(or any of the other options on the line below that button) it might be because Reference Tools dialog has been “truncated.”

There's a setting in Windows that might be causing the problem, relating to the number of Dots (i.e., pixels) Per Inch (DPI) setting for your computer screen. 

Windows XP:

Right-click on the Windows XP 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)". See notes and tips below.

Windows Vista/7: 

Open "Screen Resolution" by clicking the Start button on your desktop, clicking Control Panel, and then, under Appearance and Personalization, clicking "Adjust screen resolution". An option there ("Make text and other items larger or smaller") lets you set the sizes of text and other items to Smaller, Medium, and Larger. If you want to fine tune the setting: Click on "Set custom text size (DPI)" in the left pane; click the scale (ruler) and drag the setting to whatever percentage size increase you want (100%-500%); then click OK. (If you prefer, you can type a number between 100 and 500 in the box next to "Scale to this percentage of normal size," and then click OK.) On the Display screen, click Apply. The change will take effect the next time you log on. See notes and tips below.

Notes

¤  Some users have reported on the results of increasing the DPI setting beyond 100% (96 DPI). For them, at 117% all buttons on the Reference Tools dialog's tabs are present; at 118% the bottom buttons are missing because the dialog is truncated. [Update 3/22/14: One user reported the 117% setting also worked with the eBook Publisher dialog included with WPX6.]

¤  Note that in some situations changing the DPI will make the numbers on your WordPerfect ruler invisible. This is a known issue [and still exists in at least WPX7]

¤  Note that some DPI changes can affect other programs, too. Always test your installed programs after changing DPI settings. You can always restore the DPI to default settings or perhaps to a setting that does not impact any programs.

¤  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):

[In Windows XP:] "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."

[In Windows 7:] Click on Start, then in the Search field, type "change windows colors and metrics." In that dialog (Window Color and Appearance) you can adjust these items.]

Tips

¤  Workaround:  You can create a simple macro to display the Define Table of Contents dialog, the same as if you pressed the Define button in the Reference Tools dialog. Here's how:

Open a new blank document and use Tools, Macro, Macro Toolbar to display the Macro toolbar. Then type the single macro command TOCDefineDlg into the document. Press Save & Compile on the Macro toolbar to save it to your default macro folder (as shown in Tools, Settings, Files, Merge/Macro). Then go to the document where you want the TOC to appear and play the macro at the current cursor location (usually, the top of the document) with Tools, Macro, Play. It will let you choose the number of TOC levels to use and then insert the TOC codes and the text placeholder there. Then generate the document with Tools, Reference, Generate (<Ctrl+F9> on the Windows keyboard, or <Alt+Shift+F5> on the DOS keyboard).

[Page top]


Footnote 3

[Continued from above...]

While you can format the TOC after it has been generated (e.g., to format it into two columns) you might want some formatting to "stick" if you have to regenerate the TOC several times.

Regenerating the TOC will delete (i.e., replace) the existing TOC — including any changes in format of the TOC's text 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.

Tips:

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

•  For a similar method to format a generated Index into columns, see the indexDocs page, Footnote 6.

[Page top]


Footnote 4

[Continued from above...]

[Intermediate to Advanced users]


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

Here is an example of a macro that can automatically change a single Table of Contents level style — any of the 5 built-in styles that govern the format of each individual Table of Contents level — which is 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 example macro changes the style for TOC Level 1 and uses several new format codes (shown in blue). 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 -
// Note: Change the Style: <name> in the StyleEditBegin
// ccommand for other TOC levels; note that the name
// of the TOC style is an enumeration and can be obtained
// from the PerfectScript Commands dialog inserter:
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]


Footnote 5


[Continued from above...]

.....Dot leaders (see references to them in the above sections) place a series of periods (full stops) before the desired text.

For a Table of Contents they are used (by default) to give a visual connection between the TOC entries and their associated page numbers.

But you don't need to use "dots" — you can change them to any character or symbol, and even add extra spaces between them.

This is done using a somewhat unintuitive method:

1. Place the cursor where you want the new dot leader characters to take effect (e.g., at the very top of the document). Note that the new leader characters will automatically replace any existing leader characters further down in the document.

2. Click Format, Line, Tab set. This opens the Tab Set dialog. (Yes, that's correct!)

3.Type a new keyboard character in the Dot leader character box. (Tip: You can also use a character symbol inserted from the symbols dialog (Ctrl+W).)

4.(Optional:) Type or select a number in the Spaces between characters box. (Default=1)

5.Click Set, then Close.

This inserts a new [Dot Lead Char] code in the document at the cursor location.

Tips

•  If you carefully select just that new code in Reveal Codes you can turn it into a QuickWord for quick and easy access in the future while in any document. Typically (but not necessarily) you would use the QuckWord at the very top of the document so that any existing dot leaders will be instantly converted to leaders with the new character.

•  If you double-click on that [code] you can change the leader character again.

[Page top]