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

1 Answer 1

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, then reference that bookmark for the second figure number.

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

 
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.