Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a long document in Word and from time to time need to reference to Figures. When I do so, I use the 'cross-reference' feature, which creates in-line dynamic links to my figures that read like this:

Blah blah blah, see Figure 4.2

In the event that I want to include two figures next to each other, this leads to a rather clunkly looking:

Blah blah blah, see Figure 4.2 and Figure 4.3

I would prefer to have the text read:

Blah blah blah, see Figures 4.2 and 4.3

This can be achieved by changing the 'field code' for each dynamic link which removes the word 'Figure'. I then just manually type 'Figures' before the references. For example, the field code might originally look like this:

REF  _Ref340509095 \h 

In order to remove the word 'Figure' from the in-line reference, the switch '\# 0.0' must be added to the code:

REF  _Ref340509095 \# 0.0 \h 

This works fine, except that the '0.0' specifies that the figure reference only has one decimal place. However, later figures, such as 'Figure 4.10' end up rendering as 'Figure 4.1', which is just plain wrong. If I change the field reference to this:

REF  _Ref340509095 \# 0.00 \h 

...Then my in-line references are rendered to two decimal places, but the earlier ones (figs 4.2 and 4.3) end up looking like this:

Blah blah blah, see Figures 4.20 and 4.30

My document actually contains a figure 4.20 already, so this is misleading. Whilst I could manually edit each of these occurrences to ensure that the correct number of decimal places is used in each case, this is laborious and not reliable. If, for example, I already have a figure labelled 4.9 and I later insert another figure above it, the 4.9 would change to 4.10, which would render at 4.1 unless I go back and change the reference.

My question is: how do I adjust the cross-reference switch so that it automatically renders the correct number of decimal places in the in-line text?

share|improve this question
up vote 2 down vote accepted

In short, here's the answer you want, I think: But wait! There's more! Yet another user, Michal Solecki, discovered that using the # 0.0 switch failed with double-digit figure numbers, but he figured out the solution: if you have more than nine figures in a chapter, you will need this field:

{ REF _Ref218925266 \# 0.0x \h }

Presumably if you have more than nine chapters, you'd need # 0x.0x.

Credit goes to:

share|improve this answer
Doesn't \# 0.0x show the same result for (say) 2.1 and 2.10 ? Further, the "0x.0x" thing doesn't work - not only is the first "x" not needed, because "0" to the left of the "." is enough to display any number of digits, but the first "0" becomes a liability because, for example, "2.1" would display as "02.1" (which some people might want, but isn't the result the Question was looking for). – bibadia May 30 at 16:11
(i.e. what I mean is that you would have to apply a different switch to "2.1" than "2.10", so you would have to know whether the number to display had 2 digits after the "." or 1) – bibadia May 30 at 16:19

I don't think the # switch options on their own will do this for you.

One way would be to bookmark the set of fields that makes up the number part of each caption, then reference that bookmark where you only want the figure number (the second one, in your example).

Another way would be to use a nested field like this:

{ REF _Ref340509095 #"0.0{ IF "{ REF _Ref340509095 }" = "*.??" "0" }" }

(all the {} have to be the special field braces that you can enter using ctrl-F9 on Windows Word)

Or it might be easier in the long run to do it like this:

{ QUOTE { SET r { REF _Ref340509095 } }{ REF r #"0.0{ IF "{ REF r }" = "*.??" "0" }" } }

(That way, if a bookmark name such as _Ref340509095 changes when you modify and re-reference a Figure, it's easier to change. Further, it makes it slightly easier to extend if you need references up to something.999:

{ QUOTE { SET r { REF _Ref340509095 } }{ REF r #"0.0{ IF "{ REF r }" = ".??" "0" }{ IF "{ REF r }" = ".???" "0" }" } }

There are other possibilities, but I suspect those are the simplest if you prefer to carry on using the built-in features for inserting captions and references.

share|improve this answer

Your Answer


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.