Help - Outline Place in Header?

M

MrKen

It has been suggested that I submit this question to this
newsgroup as it seems I've hit on a difficulty using fields
to accomplish what I need.

Here's the initial issue, below are solution attempts and
failures:

I have formatted my dissertation with heading styles so as
to show where in the argument I am. E.g.
Heading 1
Heading 2
Heading 3
Heading 3
Heading 2
Heading 3
Heading 4
etc.
Plus I've outline numbered each heading style.
I.
1.
1.1.
1.2.
2.
etc.

What I want to do is to output both the number and text of
the heading at the top of each page (in the header) but I
only want it to show where in the outline one is as of the
beginning of that page. So far what I've done is Insert,
Field, StyleRef (Header 1 with paragraph # -- which outputs
ONLY the outline number of the level -- then again without
paragraph # to get the text).
So the code in the header looks like this:
{STYLEREF "Heading 1" \n \*MERGEFORMAT}. {STYLEREF "Heading
1" \*MERGEFORMAT}
{STYLEREF "Heading 2" \n \*MERGEFORMAT}{STYLEREF
"Heading 2" \*MERGEFORMAT}
{STYLEREF "Heading 3" \n \*MERGEFORMAT}{STYLEREF
"Heading 3" \*MERGEFORMAT}

Here's the problem (if you haven't already figured it out):
I can't figure out how to make the output conditional to
the point in the text I want referenced. For example, if I
put the three heading levels in the header I get three
levels on every page -- even the pages that aren't yet into
the third level. If page 2 is only up to Heading 1 and
Heading 2 levels, then I only want those to appear. I
think I need to use an 'if' formula of some kind, but
haven't been able to find any guidance about how to do
this. Also, some fields that I initially thought promising
(like monkeying with making an index or something) report
that they are only usable in the main document. When I
describe what I want to do, people say that it sounds like
it should be pretty easy and straightfoward, but I'm having
a devil of a time figuring it out.

The initial suggestion was to use hidden text with dummy
headings. But that would be onerous because it would
require a hidden line for each level on a page before the
first use of that level and then again after the next
highest heading appeared.

My next thought was to use the page and pageref fields in a
conditional:
if (page)>= (pageref(styleref "Heading 3")) "(styleref
"heading 3")" ""
But that doesn't work because pageref takes bookmarks not
stylerefs as arguments.

So the real solution I think would be to tap into the fact
that the heading styles already get automatic TOC bookmarks
when they appear. But then I'm back to the problem that
each bookmark is unique, so I would need something like a
macro to update the bookmark ref inside the pageref clause
on each page.

Does anyone have any ideas? If you could email me at
(e-mail address removed) as well as post them here, that'd wonderful.

thanks,

Ken
 
M

mrken

Thanks. Very helpful information. But still can't seem to
adapt these ideas to my problem. The pageref field cannot
take anything other than a bookmark as an argument and I
can't seem to figure out another way of conditionalizing
the fields. Listnum seemed promising, but I think I would
still need pageref to take listnum as an argument.
Any other MVPs care to take a swipe?
k
 
B

Bob S

Here's the initial issue, below are solution attempts and
failures:

I have formatted my dissertation with heading styles so as
to show where in the argument I am. E.g.
Heading 1
Heading 2
Heading 3
Heading 3
Heading 2
Heading 3
Heading 4
etc.
Plus I've outline numbered each heading style.
I.
1.
1.1.
1.2.
2.
etc.

What I want to do is to output both the number and text of
the heading at the top of each page (in the header) but I
only want it to show where in the outline one is as of the
beginning of that page. So far what I've done is Insert,
Field, StyleRef (Header 1 with paragraph # -- which outputs
ONLY the outline number of the level -- then again without
paragraph # to get the text).
So the code in the header looks like this:
{STYLEREF "Heading 1" \n \*MERGEFORMAT}. {STYLEREF "Heading
1" \*MERGEFORMAT}
{STYLEREF "Heading 2" \n \*MERGEFORMAT}{STYLEREF
"Heading 2" \*MERGEFORMAT}
{STYLEREF "Heading 3" \n \*MERGEFORMAT}{STYLEREF
"Heading 3" \*MERGEFORMAT}

Here's the problem (if you haven't already figured it out):
I can't figure out how to make the output conditional to
the point in the text I want referenced. For example, if I
put the three heading levels in the header I get three
levels on every page -- even the pages that aren't yet into
the third level. If page 2 is only up to Heading 1 and
Heading 2 levels, then I only want those to appear. I
think I need to use an 'if' formula of some kind, but
haven't been able to find any guidance about how to do
this. Also, some fields that I initially thought promising
(like monkeying with making an index or something) report
that they are only usable in the main document. When I
describe what I want to do, people say that it sounds like
it should be pretty easy and straightfoward, but I'm having
a devil of a time figuring it out.

The following construction seems to do what you want in simple cases
with two levels of heading, with letters on top and Arabic numbers
below.

{ IF { STYLEREF "Heading 2" \w \l } > { STYLEREF "Heading 2" \w \l }
"{ STYLEREF "Heading 2" \n \l }" "{ STYLEREF "Heading 1" \n \l }" }

The concept is to look at the complete all-levels number of the
last-so-far example of each heading level. The heading that you want
to pick to display is the one with the most advanced all-levels
number.

The concept is simple, but mechanizing it may be tricky.

You may have trouble with Roman numerals; the "greater than"
comparison may not work without considerable parsing and fiddling. If
you use letters as numbers it should work for the first 26 letters,
after that I don't know.

You may also have trouble with the "greater than" comparison once you
get three levels; I don't know. If so you will need to parse each of
the "numbers" from the styleref fields that are being compared, and
convert them to comparable numbers.

Bob S
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top