I'm working on a template document in Word 2010 that will serve as a Chapter (outline level 1, heading 1 format) in a larger Volume. In the Chapter, I need to have multiple Sections (outline level 2, heading 2 format). I want to use field codes to get the section number without the chapter number for use throughout the Section.

For example:

Chapter 20 - Chapter Title
20.1 Section One Title
20.1.1 Section One Subsection
  Something here needs a label that reads only '1', in reference to the 20.1 2nd number.
20.2 Section Two Title
  Something here needs a label that reads only '2', in reference to the 20.2 2nd number.

I am able to get "20.1" and "20.2" via STYLREF like { STYLEREF 2 \s }.

How can I get just "1" and "2"?


I can't help feeling that there must be an easier way, but if your numbers only range from 1 to 9 (e.g. 14.1-14.9, 20.1-20.9 etc., you could try the following nested fields (All the {} need to be the special "field code brace" characters you can enter with ctrl-F9, not the ordinary ones you type on the keyboard).

{ =10*{ STYLEREF 2 \s #.x } }

If you need 2 digits, things get more complicated, e.g.

{ ={ QUOTE "{ STYLEREF 2 \s }1" #.xxx }*{ IF "{ QUOTE "{ STYLEREF 2 \s }1" #.xxx }" = ".???" 100 10 } #0 }

  • It seems like it should be easier, but this is as ugly as I feared it would be. I did have to add a \ to all of the #s in the field codes to solve some syntax errors (changed to \#), but it works! Thanks. – Sam Jun 6 '13 at 15:57
  • Yes, sorry about the backslashes-keep forgetting they need special treatment here – user181946 Jun 6 '13 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.