Level dependent heading reference in footer

M

Marko Pinteric

In technical documentation for a civil engineering project there has to
be heading reference in footer - but level dependant. If page includes
only Heading 2, reference in footer should be Heading 2, otherwise
reference in footer should be Heading 1.

I found following code field on the Internet:

{ IF {STYLEREF "Heading 2" \n}<{STYLEREF "Heading 1" \n} {STYLEREF
"Heading 1" \n} {STYLEREF "Heading 2" \n} }

This works fine, but only AFTER first Heading 2 appears. All pages
BEFORE first Heading 2 reference first Heading 2. The reason for this
lays in fact that Word first searches from the beginning to the end of
the current page and then (if it can't find Heading 1/2) from the
current page to the beginning of the document and then from the current
page to the end of the document. Therefore, before the first Heading 2
appears, he compares all Headings 1 with first Heading 2.

I tried to modify code field using \p switch (which tells if the Heading
1/2 founded is before or after position of code field), but this switch
does not work for footers.

Is there any solution for this problem? Can I somehow tell windows not
to search AFTER current page?

Please help!

Thanks, Marko Pinteric.
 
J

John McGhie

Marko:

You cannot tell Word to search only "within" the current page.

There are two solutions. The easiest is to pre-populate your Headings 1 and
2 with generic text, using dummy Heading 1 and Heading 2 styles up the front
of the document. You can arrange for these to "not appear" by formatting
them as small or white, or by adding headings you do not mind having in the
document.

The other solution is to create a Character style to refer to for the
StyleRef. You can then "tag" the text you want to appear with the character
style. Set the format of the character style to "The underlying paragraph
properties" so that it does not change the appearance of text it is applied
to.

The consideration of the character style method is that you must ether mark
every heading you want to appear, or add a third component to your IF
statement.

Hope this helps


In technical documentation for a civil engineering project there has to
be heading reference in footer - but level dependant. If page includes
only Heading 2, reference in footer should be Heading 2, otherwise
reference in footer should be Heading 1.

I found following code field on the Internet:

{ IF {STYLEREF "Heading 2" \n}<{STYLEREF "Heading 1" \n} {STYLEREF
"Heading 1" \n} {STYLEREF "Heading 2" \n} }

This works fine, but only AFTER first Heading 2 appears. All pages
BEFORE first Heading 2 reference first Heading 2. The reason for this
lays in fact that Word first searches from the beginning to the end of
the current page and then (if it can't find Heading 1/2) from the
current page to the beginning of the document and then from the current
page to the end of the document. Therefore, before the first Heading 2
appears, he compares all Headings 1 with first Heading 2.

I tried to modify code field using \p switch (which tells if the Heading
1/2 founded is before or after position of code field), but this switch
does not work for footers.

Is there any solution for this problem? Can I somehow tell windows not
to search AFTER current page?

Please help!

Thanks, Marko Pinteric.

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Consultant Technical Writer
Sydney, Australia +61 4 1209 1410
 
M

Marko Pinteric

If I understand right, solution No 1 will create additional fields in
the table of contents, which I do not want to. I do not understand
exactly what did you mean with the solution No 2 - but it seems that it
is no longer automated.

However, you gave me inspiration for the third possible solution, which
is ALMOST perfect. I created hidden cross-reference to Heading 2 (named
first_heading2) in the very beginning of the document. Then I use

{IF "{STYLEREF "Heading 1" \n}.2"<{REF first_heading2 \h} {STYLEREF
"Heading 1" \n} {IF {STYLEREF "Heading 1" \n}>{STYLEREF "Heading 2" \n}
{STYLEREF "Heading 1" \n} {STYLEREF "Heading 2" \n} }

So what I get is following (first_heading2 has value "5.1"):

Page number: Heading on page: Footer text:
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5.1
6 5.1 5.1
7 5.2 5.2
8 5.3 5.3
9 6 6
10 6.1 6.1
11 6.2 6.2
12 6.3 6.3

Well there is a small BIG problem remaining, it is written 5.1 on page
with heading 5! I would like to add another IF but I don't know which.
On both pages 5 and 6 {STYLEREF "Heading 1" \n} has value 5 and
{STYLEREF "Heading 2" \n} has value 5.1 so I cannot distinguish between
those two pages. Do you have any idea how to do that?

Thanks, Marko.
 

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