Thread: A custom TOC
View Single Post
  #5   Report Post  
Suzanne S. Barnhill
 
Posts: n/a
Default

I think we're talking about different things. When you generate a TOC, Word
inserts one tab character automatically. This is the tab (with a dot leader)
that goes to the page number. Attempts to add another tab character to the
TOC entry (by adding a tab character to the heading or TC field) don't seem
to be terribly successful. Are you saying that the tab character you use in
your TC field *is* preserved?

Also, I'm curious about the way you're building your TOC. The \o switch
tells Word to include built-in heading styles with the outline level(s)
specified (1-3 by default). If you want to use TC fields only (which you'd
need to do if you don't want your entries duplicated), you would need to
clear the check boxes for "Styles" and "Outline levels" and check the box
for "Table entry fields"). This selection, with all other settings left at
their defaults, produces this TOC field:

{ TOC \f \h \z }

The reason you're not getting anything but the text formatted with Heading 1
(rather than the contents of your TC field) is thus that you have an \o
switch rather than an \f switch in the field.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Paul Terrano" wrote in message
...
A reply to the comments by Shauna Kelly and Suzanne Barnhill.

Windows 2000 Pro, 5.0.2195, SP-4 & Word 2000 (9.0.6926, SP-3)

To minimize the effect of extraneous codes, styles and gremlins,
I created a nine-page document with the following characteristics
on each page except the first.

· A function name, formatted with Heading 1. The style
includes" page break before". There is no other text on the page.

· The header is empty

· The footer contains only a page number field, {PAGE}.

· A toc entry typically, { TC “VSTYPEtabSet the type for
a vector” } on each page.

· The style TOC 1 is defined as - TNR, 10pt, English(US),
Indent: Hanging 1.25", flush left, line spacing single,
widow/orphan control, Tabs: 1.25", 6" right flush …

· The field code on page 1 initially was{ TOC \o “1-1” \h
\z }. It was created from the InsertIndex and Tables dialog.

The toc that is produced is:

VSTYPEtab with a dotted leader2

VSUMtab with a dotted leader 3

And so forth. The page numbers are aligned. The left and right
margins in Page Setup are each 1.25”. On a printed page, the left
margin is 1.25” but the right margin is 1.56” The additional text
from the TC field has not appeared.

The presence or absence of the \w switch does not appear to make
any difference.

Analysis by experimentation



I replaced the tab in the TC field with an @ and rebuilt the toc
and it was unchanged from that shown above. The tab persisted and
the text from the TC field did not appear.



I added a page similar to the others to get a page 10 displayed
in the toc. The page number is not right aligned.



The \o, \h and \z switches appear to be functioning, but deleting
\o “1-1” doesn’t change the appearance of the toc.



I renamed Normal.dot and created a single page document as above,
but using only the default Heading 1 style. The toc created had a
function name a dotted leader and a page number just as above.



"Suzanne S. Barnhill" wrote in message
...
By default, Word converts tabs in TOC entries to spaces unless

you use the
\w switch. It may be that this does not apply when TC fields

are used, but I
would suspect it would. Experimentation on another problem

earlier today
also revealed that the \w switch appears not to work in Word

2003. Can you
confirm or deny any of the above wrt Word 2000 or 2003?

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

"Shauna Kelly" wrote

in message
...
Hi Paul

Your real problem appears to be with the tabs. Are you

modifying the TOC 1
style, or are you modifying the TOC itself once its created?

If you change
the formatting of the TOC directly, your changes won't

survive the
updating
of the TOC. You have to modify the TOC 1 style itself.

Try modifying the TOC 1 style to have a left-aligned tab at

3cm and a
right-aligned tab at 15cm and a hanging indent of 3cm. Change

the 15cm tab
as required to position your page numbers against the right

margin. If you
need to adjust the 3cm tab, make sure you change the hanging

indent as
well.
They must match for all to work perfectly.

You then won't need the @ and replace solution. Just do { TC
ABSReturn.... } where is a Tab.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word


"Paul Terrano" wrote in message
...
I posted the following question in August 2003 and received

no
responses. I'm hoping for better luck now.

I am preparing documentation for a program that uses a

large
number of functions to manipulate stock prices. This volume
contains one or at most two pages to describe each function

and
they are arranged in alphabetical order. There are about

240 of
these functions and I wanted the TOC to look like this:



ABS Return the absolute value of a number
3

ACCDISTR Calculate the Accumulation/Distribution

indicator
4

ASCII Return a string containing a character specified

by a
value 22



BDAYS Returns the number of business days between two

dates
23



and so forth.



This example was keyed in by hand to avoid a text

conversion from
Word. The space between the end of the description and the

page
number includes the usual dot leader.



The descriptive phrases shown do not appear in the

underlying
documentation, so the techniques for using manual line

breaks or
unusual formatting do not apply as far as I am able to

determine.
TC fields appeared to have some hope and I created entries

like
{TC "ABSReturn the absolute value of a number"}. {} was

produced
by Ctrl+F9 and represents the tab symbol. I was unable to
format the tab, so the comments did not line up. There are

some
indications in the numerous articles and news entries that

I read
that this may be a bug in Word 2000.



I then used a scheme described by McGhie and others where

the TC
entry is entered as {TC "ABS@Return the absolute value of a
number"} while the first entry when the initial letter

changes
is coded as {TC "@@BDAYS@Returns the number of business

days
between two dates"}. After the toc is created, @@ is

replaced by
a hard return and @ is replaced by a tab.



This scheme works tolerably well, but specifying a tab to

be 1.0"
using Format|Tabs|Set doesn't stick. Usually the tab

replacement
step results in a dotted leader appearing between the

function
name and the description as well as between the description

and
the page number, but resetting the tab with Format|Tabs|Set

fixes
the toc spacing and the tab and leader between the

description
and page number is unaffected. Each TC field is on the same

page
as the function so that Word is able to create the correct

page
number. The default TOC1 style is used to produce the table

of
contents. I do not anticipate a great deal of maintenance,

so I
am considering a completely hand-built toc.



Although I am pretty happy with the @ scheme, Pride Goeth

Before
a Fall, so I would appreciate some analysis and suggestions

from
the knowledgable contributors to this newsgroup. I have

only
created a few entries so that not much work will be lost if

a
superior alternative surfaces.