How refer to parts of a paragraph's numbering text?

0 down vote favorite

I have a document with a large number of steps. I've set up a "Step" paragraph style with numbering that generates the word "Step" followed by the step number and a colon (plus the tab that Word seems to add without my asking for it). This generates paragraphs that look like this:


Step 1: Blah blah blah...
Step 2: Blah blah blah...
Step 3: Blah blah blah...
 

That's fine. The problem is that I often want to refer to individual steps via cross-references, and I can't get the text to come out right. For example, I might want to say "As you can see in Step 2, ...". But I can't find a way to get the text "Step 2" to appear without the colon, and "As you can see in Step 2:," is not what I want.


In some cases, I want only the step number. For example, I might want to write, "As you can see in steps 2, 4, and 22, ...". Saying "As you can see in Step 2, Step 4, and Step 22, ..." would be cumbersome.


How can I set up my numbering and cross references so that I can get the boilerplate text around the step numbers (i.e., "Step" before the number and ":" after it) in the paragraphs comprising the steps, but I can refer to either "Step n" or just the step number (in both cases without the colon) in cross-references?


Thanks.

Here's one way of addressing both issues:

• type 'Step ' (or 'Steps '), then insert the cross-reference in the normal way.

• select the cross-reference and press Shift-F9. You should see something like {REF _Ref349737907 \h} - the \h may or may not be there; it makes the cross-reference act like a hyperlink.

• edit the field code by adding a numeric switch, thus {REF _Ref349737907 \# 0 \h}, making sure the \# 0 is before the \h (if present).

• press F9 to update. Now, you should only see thecross-referenced paragraph's  number.

Cheers
Paul Edstein
(Fmr MS MVP - Word)

2 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

This is very helpful, thank you. I had read about field codes, but it would not have occurred to me to use \# (which I had not heard of) with a field consisting of a mix of numeric and textual information. 

Having said that, your approach is not, on the face of it, a terribly practical solution to my problem.  I've simplified the situation somewhat in my post, but I have dozens of steps and hundreds of references to them. Manually editing the field code for each of those hundreds of references is unpleasant at best. Is there some way to get Word to generate the "\# 0" inside the REF automatically?  (If so, I can presumably extend that method to add the "Step " text in front of the number automatically, editing that text out in the comparatively few cases were I want to refer only to a step number.)


1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 I've simplified the situation somewhat in my post, but I have dozens of steps and hundreds of references to them. Manually editing the field code for each of those hundreds of references is unpleasant at best. Is there some way to get Word to generate the "\# 0" inside the REF automatically?


If you have many cross-references pointing to the same Steps, you could use Find/Replace to add the \# 0 switch. All you'd need to do is to expose all the field codes in the document via Alt-F9, then use the reference number (_Ref349737907 in the example I posted) as the Find expression, with '^& \# 0' as the Replace expression (without the quote characters). Whilst this still isn't automated, it's better than doing it manually. Indeed, if the only REF fields in the document refer to the Steps, a single wildcard Find/Replace could do the lot, where:

Find = _Ref[0-9]{1,}

Replace = ^& \# 0

You'd probably want to execute such a Find/Replace iteratively, as there'd undoubtedly be cases where you'll want to preserve the 'Step' in the cross-reference. Anything more sophisticated would require a macro - and considerable debugging before it could be relied upon.

Cheers
Paul Edstein
(Fmr MS MVP - Word)

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

As I mentioned in another reply, your approach works, but what I'd really like to do is have the field generate "Step 3" instead of just "3".  Is there a way to add content to the field so that the field generates not just the step number but also includes the literal text "Step " in front of it? I"m thinking of something like { "Step " + REF _Ref349737907 \# 0 \h }, but that doesn't work, and googling didn't turn up anything that did.

Thanks very much.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

As I mentioned in another reply, your approach works, but what I'd really like to do is have the field generate "Step 3" instead of just "3".  Is there a way to add content to the field so that the field generates not just the step number but also includes the literal text "Step " in front of it? I"m thinking of something like { "Step " + REF _Ref349737907 \# 0 \h }, but that doesn't work, and googling didn't turn up anything that did.


You could use a numeric switch like  \# "'Step '0" (eg { REF _Ref349737907 \# "'Step '0" \h }), but all that achieves (useful though it may be) is the elimination of the trailing colon. Not terribly useful if you have multiple references that you want to have appear as, say, Steps 1-3, 5 & 7.
Cheers
Paul Edstein
(Fmr MS MVP - Word)

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

You could use a numeric switch like  \# "'Step '0" (eg { REF _Ref349737907 \# "'Step '0" \h }), but all that achieves (useful though it may be) is the elimination of the trailing colon.

This does what I need, thanks very, very much.

Is there someplace I can read about what \# is doing here?  My sense is that the REF is producing a string containing both numeric and non-numeric data, which \# then reduces to its numeric component only, which is then plugged into a pattern consisting of some literal text ("Step ") and a placeholder for the numeric data ("0"). Is that more or less correct?  References I've seen to \# describe it in purely numeric terms, so I'm surprised that it will take non-numeric data and simply strip out the non-numeric stuff. I'd like to understand it better.

Ironically, I'm actually using Word for a text about programming, and here I am discovering that there's a programming language inside Word for dealing with fields.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Is there someplace I can read about what \# is doing here?  My sense is that the REF is producing a string containing both numeric and non-numeric data, which \# then reduces to its numeric component only, which is then plugged into a pattern consisting of some literal text ("Step ") and a placeholder for the numeric data ("0"). Is that more or less correct?


I don't know that there's any official documentation of how one can incorporate text strings into field switches. MS has some documentation here:

http://office.microsoft.com/en-us/word-help/field-codes-formula-field-HP005186218.aspx?CTT=5&origin=HA102110133

but it really doesn't cover the embedding of text strings into the switches. IIRC, the total length of all characters the field switch can display is 67.

 

I've added my own documentation on incorporating text strings into field switches in my tutorials on Word field coding. See, for example, 'Formatting Numeric Field Results' in my Microsoft Word Field Maths Tutorial, at:
http://windowssecrets.com/forums/showthread.php/58544-Word-Field-Maths-Tutorial-(v1.4)?p=320143&viewfull=1#post320143
or
http://www.gmayor.com/downloads.htm#Third_party

That tutorial shows how to do stuff most people wouldn't even dream of with field coding. FWIW, you can even embed additional fields into the switches, which raises all sorts of interesting possibilities.

 

You may also be interested in out my Microsoft Word Date Calculation Tutorial, at:

or

 

Cheers
Paul Edstein
(Fmr MS MVP - Word)

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

As I mentioned in another reply, your approach works, but what I'd really like to do is have the field generate "Step 3" instead of just "3".  Is there a way to add content to the field so that the field generates not just the step number but also includes the literal text "Step " in front of it? I"m thinking of something like { "Step " + REF _Ref349737907 \# 0 \h }, but that doesn't work, and googling didn't turn up anything that did.
You could use a numeric switch like  \# "'Step '0" (eg { REF _Ref349737907 \# "'Step '0" \h }), but all that achieves (useful though it may be) is the elimination of the trailing colon. Not terribly useful if you have multiple references that you want to have appear as, say, Steps 1-3, 5 & 7.
As a coda to this thread, I realized later that I really want a nonbreaking space between "Step" and the step number, so the text part of the \# switch should be sure to use a nonbreaking space at the end.  Entering this space is straightforward (ctrl-shift-space), but I thought I'd add this information to this thread for completeness.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated July 11, 2022 Views 1,336 Applies to: