Using automatic cross-references

From Apache OpenOffice Wiki
Jump to: navigation, search

If you type in cross-references to other parts of the document, those references can easily get out of date if you reword a heading, add or remove figures, or reorganize topics. Replace any typed cross-references with automatic ones and, when you update fields, all the references will update automatically to show the current wording or page numbers.

Tip.png Some people use Writer’s Hyperlink feature for cross-references, but it has the major disadvantage that the visible text of the hyperlink does not change if you change the text of the item to which it links. For that reason, you are advised to use cross-references in most situations.

The exception is when you are creating a document to be saved as HTML; cross-references do not become hyperlinks in an HTML document.

The Cross-references page of the Fields dialog box lists some items, such as headings, numbered paragraphs, and bookmarks. If figure captions, table captions, user-defined number range variables, and some other items have been defined in a document, that type also appears in the list.

The Cross-references page of the Fields dialog box

Inserting cross-references

To insert a cross-reference to a heading, figure, or other item shown on the Cross-references page:

  1. In your document, place the cursor where you want the cross-reference to appear.
  2. If the Fields dialog box is not open, click Insert > Cross Reference. On the Cross-references page, in the Type list, click the type of item you are referencing (for example, Heading or Figure).
  3. You can leave this page open while you insert many cross-references.
  4. Click on the required item in the Selection list, which shows both automatically created entries (for example Headings) as well as user-defined references (for example bookmarks).
  5. In the Insert reference to list, choose the type of reference required. The choices vary with the item being referenced.
    • For headings, usually you will choose Reference (to insert the full text of the heading) or Page (to insert the number of the page the heading is on).
    • For figures, you will usually choose Category and Number (to insert the word “Figure” and its number), Reference (to insert the word “Figure” with its number and the full text of the caption), Page (to insert the number of the page the figure is on), or Numbering (to insert only the figure number).
  6. Click Insert.

For a full list of the reference formats available, and their use, consult the application Help.

Available formats

For all the types of reference, you can select one of the following formats:

  • Page: the page number of the target
  • Chapter: the number of the chapter where the referenced target is located.
  • Reference: the full text set as reference.
  • Above/Below: Inserts the words above or below depending on the position of the field relative to the referenced target.
  • As Page Style: similar to Page, this inserts the page number where the reference is, but using the formatting specified in the page style.

This is very useful when putting a reference to a page in the front matter where roman numerals are usually employed. If you select Headings or Numbered Paragraphs as type, the following two additional options become available:

  • Number (no context): inserts only the number of the heading or of the numbered paragraph. For example, if referencing a numbered item 2.4, it inserts 4.
  • Number (full context): inserts the the full number including higher hierarchical levels. For example, if referencing a numbered item 2.4, the full numbering (2.4) is inserted.

Finally, for objects inserted with captions such as a table or a figure, you can choose:

  • Category and Number: inserts both the category and number of the referenced object (for example, see Creating a new Autotext Entry). This is generally the most used formatting for figures and tables.
  • Caption Text: inserts the full caption of the referenced object. For example, Creating a new Autotext Entry. This is an example of a figure]].
  • Numbering: inserts the sequential number of the referenced object, without the category (for example, if referencing Table 2, the field will contain only the number 2).

Preparing items as targets for cross-referencing

Occasionally you might want to insert a cross-reference to something that is not automatically shown on the Cross-references page. Before you can insert a cross-reference to such an item, you must prepare the item as a target to be referenced. To do this, you can either use bookmarks or set references.

After a target has been defined, you can cross-reference to it as described in Inserting cross-references.

For an example of the use of this technique, see “Solving the page count problem” in Chapter 4 (Formatting Pages).

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 using a 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. Choose Insert > Cross reference.
  2. On the Cross-references page of the Fields dialog box, select Set Reference in the Type list. The Selection list shows any references that have been defined. You can leave this page open while you set many items as references.
  3. Click in the document and highlight the text of the first item to set as a target for a cross-reference. Click on the Fields dialog box. The text of the item will appear in the Value box in the lower right. In the Name box, type some text by which you can identify this item.
  4. Click Insert. The text you typed in the Name box now appears in the Selection list.
  5. Repeat steps 3 and 4 as often as required.
Setting text to be used as a target for a cross-reference

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