Cross-referencing between subdocuments

From Apache OpenOffice Wiki
Jump to: navigation, search

The methods described earlier in this chapter are all most writers will need when using master documents. However, you might need to automatically update cross-references between subdocuments. This section describes how to do this.

The process to create cross-references between subdocuments is tedious, but it works.

Preparing items as targets for cross-referencing

Before you can insert a cross-reference to anything that is not automatically shown on the References tab, such as a heading, you must prepare or “set” that heading as an item to be referenced. To do this, you can either use bookmarks or set references.

When you set references, be sure to select the entire text you want to use as the reference, such as a heading or figure number. Keep a list of what you have named the reference fields, and be sure every name is unique. One way to keep track of this information is by putting it in a separate text file or a spreadsheet.

The field names are case-sensitive. You can check the field name by holding the cursor over the referenced item. In our example, the heading has the field name word count.

Finding the field name for a heading.

Using bookmarks

Bookmarks are listed in the Navigator and can be accessed directly from there with a single mouse click. In HTML documents, bookmarks are converted to anchors that you can jump to via hyperlink.

  1. Select the text you want to bookmark. Click Insert > Bookmark.
  2. On the Insert Bookmark dialog box, the larger box lists any previously defined bookmarks. Type a name for this bookmark in the top box. Click OK.
Inserting a bookmark.

Setting references

  1. Click Insert > Cross reference.
  2. On the References tab of the Fields dialog box, click Set Reference in the Type list. The Selection list shows any references that have been defined.
  3. You can leave this page open while you set many headings as references.

    Setting text to be used as a target for a cross-reference.
  4. Click in the document and highlight the text of the first heading to be used as a target for a cross-reference. Click on the Fields dialog box. The text of the heading will appear in the Value box in the lower right of the dialog box. In the Name box, type some text by which you can identify this heading.
  5. Click Insert. The text you typed in the Name box now appears in the Selection list.
  6. Repeat steps 3 and 4 as often as required.

Inserting the cross-references

  1. Open the master document. In the Navigator, select a subdocument and click the Edit icon (or right-click and choose Edit from the pop-up menu). The subdocument opens for editing.
  2. Selecting a subdocument in the Navigator
  3. In the subdocument, place the cursor where you want the cross-reference to appear. Click Insert > Cross Reference.
  4. In the Fields dialog box, on the References page, select Insert Reference in the Type list on the left hand side. The Selection list in the middle column shows only the reference field names for the subdocument you are using, so ignore that list and check the list you created manually in step 1.
  5. In the Name field in the lower right hand column, type the name of the reference you set in the subdocument you are referring to. In our example, the reference is in Chapter 3, and its name is word count.
  6. Fields dialog box showing manual entry of field name
  7. Click Insert, type any text you want to appear between the reference and page number (such as “on page”), and then insert another reference with the Page format. Nothing will appear in the subdocument except tiny gray bars indicating the fields. If you hover the mouse pointer over one of these fields, you should see the field name.
  8. Viewing the field name

    (You can turn on the display of field codes by clicking View > Field Names. The two fields shown as gray lines above now look like the figure below.)

    Displaying field codes
  9. After you have inserted all the cross-references required in the subdocument, save and close it and return to the master document window.
  10. Within the master document, navigate to the page of the subdocument on which you inserted the cross-reference field. You should now see the text of the cross-reference appear in the spot where you inserted it, because within the master document, the subdocument can find the target of that field reference.

    Field contents showing where inserted in file

This technique also works if you open a subdocument directly in step 2 (that is, not from within the master document) and insert a cross-reference field.

Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools