Friday 10 October 2014

Figure references in MS Word and LaTeX ("Figure" vs. "Fig.")

Reason #98856 why I hate Microsoft Word: It's incredibly difficult to caption and cross-reference figures in a flexible way. Many journals have style rules that require you to refer to figures as "Figure 1" at the start of a sentence, or "Fig. 1" in the middle of a sentence. In LaTeX, this is super easy:
  1. Label the figure using
    \caption{\label{example} (a) blah (b) whatever.}
    
    Label the figure using
    \caption{\label{example} (a) blah (b) whatever.}
    

  2. In the document, type:
    This is shown in Fig. \ref{example}"

  3. Save and compile.
How to do it in MS Word:
  1. Insert a caption under Figure 1:
    1. References -> Captions -> Insert Caption
    2. Enter " (a) blah (b) whatever". Don't forget the space at the start.
    3. Select "Figure" from the Label: drop-down box
    4. Press "OK"
  2. Insert the reference in the text:
    1. Type "This is shown in Fig. "
    2. References -> Captions -> Cross-reference
    3. Select "Figure" in the Reference type drop-down list
    4. Select "Only label and number" from the "Insert reference to:" drop-down list
    5. Select the Figure you want to reference from the "For which caption" list.
    6. Click "Insert"
    7. Click "Close"
    8. Click on the badly-formatted "Figure 1" text that has appeared in the document (in the middle, not at the start or end)
    9. Press Shift+F9 to display the field format
    10. Replace the text that says:
      { REF _Ref361669033 \h }
      (or whatever the reference code happens to be) with:
      { REF _Ref361669033 \h \# 0 }
      Make sure that all the spaces are in precisely the right place, otherwise it won't work
    11. Hide the field format by pressing Shift+F9 again
    12. Press F9 to refresh the field
  3. Save the file and punch the wall until your fist bleeds.