Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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"?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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 }

share|improve this answer
    
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 –  bibadia Jun 6 '13 at 16:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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