|
Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate |
|
Toolbox for WordPerfect |
||
|
Macros, tips, and
templates for Corel® WordPerfect® for Windows® |
Page updated May 15, 2012 | |
|
WordPerfect Tips The Table of Contents and List features |
|
||
| You can automatically include items in a Table of Contents or a List in two ways... | |||
How to create a
|
|||
|
|
[Page top]
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:"
|
|
[Page top]
|
|
|
|
Footnote 1 [Intermediate to Advanced users]
[Tips: 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 at the top of the left-hand column 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 endsNote: 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 using the manual method (see How to do it) or 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 (discussed at the top of this web page, right-hand column, "How to Mark a Custom Style...") for the purpose of applying a style that was marked for inclusion in a TOC, 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 endsNote: 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 [Intermediate to Advanced users]
If you cannot see a Define button in the Reference Tools dialog it might be because Reference Tools dialog has been “truncated.” [Click here for a screen shot of what the Reference Tools dialog should look like with the Index tab selected. (Shown is the WPX4 version. Other versions might be different.)]
There's a setting in Windows that might be causing the problem.
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)".
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". You can set the sizes 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), drag the setting to whatever percentage size increase you want (100%-500%), and 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.
Notes:
Some users have reported on the results of increasing the 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.
Note also 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):
[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.]
Temporary solution:
You can create a simple macro to display the Define Index 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, IndexDefineDlg, 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 to be indexed and play the macro at the current cursor location (usually, the end of the document) with Tools, Macro, Play. It will insert the Index codes and the text placeholder there. Then generate the document with Tools, Reference, Generate.[Page top]
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]
Footnote 5 [Intermediate to Advanced users]
Marking and Generating Lists
[NOTE: You can download a small file (WPLists.zip) containing a WordPerfect document (.WPD) describing the following method. You can also easily "clip" the custom styles described below -- and found inside that document -- to your own document or template.]
The following should help you create two custom styles to -
- quickly mark text in the document's body text areas and/or in footnotes, headers, footers, image captions, etc., so they will appear in a generated List; and
- quickly set up the List area -- i.e., where the list will appear in the document. [Thanks to Noal Mellott on WordPerfect universe for this method.]
Notes
1. If you wish to use more than one List in a document, you will need to create more than one set of styles -- each named differently. [A "set" consists of two styles: one to mark items in various places in the document for inclusion in the List, and one to set up the List area itself (i.e., where the list will be generated).] The example set of two styles below have a "1" appended to their names, so you would create additional sets of styles with a "2," "3," and so forth. If you save these styles to your template (Step 6 below), this would only need to be done once.
2. If you wish to mark text for a List that is inside headers and/or footers -- which are structures that display the same information over many pages -- you should create a NEW header or footer (usually of the same type, A or B) on each page you wish to include in the List, and mark the text in those headers/footers only on those pages. [You would probably create your headers/footers this way anyway, since you would want the text to change, such as at the beginning of each new section or charpter.] This will ensure that page numbers in the generated List point to the proper page(s) where headers/footers contain appropriate referenced text. (For more on how to use headers and footers, see here.)
2. The following instructions assume you use a <WordPerfect> menu (see Tools, Settings, Customize, Menus (tab)).
Method
[Note that if you save the styles to your template (Step 6 below), most of the following would only need to be done once.]
Step 1. Open a document in which you want to create a List. (It is always a good idea to back up the document first.)
Step 2. Create a new WordPerfect List:
a) Click Tools, Reference, List. In the Reference Tools "List" field, enter a name for the List. Here, we will use "MyList1" (without quotes), but you can use any name.
b) Click the Mark button, then the Close button to return to the document. (You can verify the List name was stored in the current document by again using Tools, Reference, List and checking the drop list. Later we will save these items so that they can be used in other documents.)
Step 3. Create a Character style to quickly apply the List marks (i.e., a pair of codes surrounding selected text -- the text that will appear in the List once it it generated):
a) Click Format, Styles, Create.
b) In the Styles Editor that appears, give the style a Name (e.g., "MarkForList1") and a Description (e.g., "Mark the current item for List").
c) In the "Enter key inserts style" field, choose "<None>".
d) For the Type, choose "Character."
e) Enable (tick) the checkbox at the bottom of the dialog, "Show 'off' codes".
f) In the Contents pane, carefully select the long [Codes to the left...] code; this is more easily done with Shift+Arrow.
g) At the top of this dialog (i.e., NOT the main program menu), click Tools, Reference, List (be sure the proper list is selected), Mark, Close.
h) The Contents pane in the dialog should now look something like this:
[Mrk Txt List][Codes to the left...][Mrk Txt List]
i) Click OK on the Styles Editor dialog to return to the Styles dialog. Note the new name is listed in the Available styles list.
j) Click Close on the Styles dialog to return to the document. (You can verify the new style exists in the "Select Style" drop list on the Text property bar.)
Step 4. Create a new, Open style to use to quickly define and position the List itself (typically on page 1, but it can be elsewhere in the document, such as at the end):
a) Position the cursor in the document (typically on page 1).
b) Click Tools, Reference, List (be sure the proper list is selected), Define. A Define List dialog appears with the List name(s), the style of the list(s), and the Numbering format. [You can click Edit to change the Position of the numbering or its format for a selected List, such as numbers that follow dot leaders (the default). If you are listing boxes by their captions and want them included in the List, use the "List box captions automatically" to specify the type of box the List is intended to use -- Figure, Table, Text, or User.]
c) Select (click on) the List name (if there is more than one). Click Insert. Then click Close to close the Reference Tools dialog and return to the document.
d) In Reveal Codes, carefully select just the [Def Mark] code and copy it to the Windows clipboard (Ctrl+C).
e) Click Format, Styles, Create. Enter a Style name (e.g., "GenList1"), a Description (e.g., "Generate the List here"), and set the Enter key to "<None>".
f) Choose the Type as "Document (open)".
g) Place the cursor in the Contents field and paste (Ctrl+V) the [Def Mark] code you just copied (above).
h) Click OK to return to the Styles dialog. Note the new style appears in the Available styles list.
i) Click Close to return to the document.
j) You can, and probably should, delete the [DefMark][GenTxt].."<<List will generate here>>..[GenTxt] line of codes and text. The next step will recreate them (but without the <<text placeholder>>.
Step 5. Test the new styles:
a) Select some text in the body text, in a header/footer, in a footnote, or graphic image caption. Apply the "MarkForList1" style to it from the Select Styles drop[ list on the property bar or from Format, Styles (in Reveal Codes this should place a pair of codes around that text). You probably want to mark just text characters and not format codes, or else the formatting will appear in the generated List.
Repeat on several items on different pages.
b) Place the cursor where you want the List to appear, and -- if there isn't already a pair of [Gen Txt] codes there for that list -- insert the generate-the-list style (e.g., "GenList1") from the Select Styles drop list on the property bar or from Format, Styles. This inserts a single code (e.g., [Open Style: GenList1]) at that location, which will do the job of generating the actual List.
Tip: You can insert this style in multiple locations in a document and it will produce multiple copies of the same List whenever the List is generated. (See also the next tip under Step 5c.)
c) Generate the document with Tools, Reference, Generate. (Windows keyboard shortcut: Ctrl+F9. DOS61(Classic) keyboard shortcut: Alt+Shift+F5.) If you want to create hyperlinks to the pages, enable "Build hyperlinks" when the Generate dialog appears. [Note that Tools, Settings, Environment, "Activate Hyperlinks" must be enabled for the hyperlinks to work in the document.]
Tip: Since the generated List is just specially formatted text, you could format the entries differently (such as some entries being in a different color, italics, etc.) This is best done on the final draft, since generation removes all existing List entries -- including formatting you may have applied later -- and replaces them with new ones.
Step 6. [Optional]
To save these new custom styles to a template -- such as your default template -- so they can be used in other documents, see http://wptoolbox.com/tips/CustomStyles.html. That linked page also shows how to retrieve custom styles directly from other documents you may have received from other users into your current document. For example, you can do this by clipping the custom styles by block retrieving them from the source document.
You can also simply create the styles directly in the template (custom or default) that spawns your documents. (See here fore more: http://wptoolbox.com/tips/Templates.html)
Step 7. Regenerate as needed with Tools, Reference, Generate. If you insert or delete material in the document after generating the List(s), you should generate them again to refresh page numbering.
[Page top]