#36 Anchoring Objects in Text
If you have pictures or other graphic elements that need to flow with related text, you can anchor the objects in the text. This prevents you from having to manually reposition objects such as charts, sidebars, or graphics every time text reflows. Any type of object or group can be anchored in text, including text frames, picture frames, paths, and tables. When you anchor objects, you can position them inline with text, above text, or in a custom position such as out in the margin (Figure 36a). You have precise control over each object's position, including the ability to fine-tune placement with the mouse.
Figure 36a Anchored objects flow with text. At left, an Inline object is positioned at the baseline of text at the text insertion point. In the center, an Above Line object is positioned above the line containing the text insertion point. At right, an object with Custom positioning is placed outside the text frame, relative to the spine, margins, and more.
Anchoring Existing Objects
You have two choices for anchoring objects: You can anchor existing objects or you can anchor placeholder objects. To anchor an existing object in text:
- Select any object or group using one of the selection tools.
- Choose Edit > Cut or Edit > Copy.
- Select the Type tool and click in text to position the insertion point where you want the anchored object.
- Choose Edit > Paste.
By default, the object is anchored Inline, but you can reposition it using the Anchored Object Options dialog box. If the object is larger than surrounding text, it may overlap the text; in that case, you may need to adjust the leading or insert line breaks.
Anchoring Placeholder Objects
If you haven't created the object that will be anchored—or if its content is not ready—you can create a rectangular placeholder and anchor it in text. To do this:
- Select the Type tool and click in text to position the text insertion point.
- Choose Object > Anchored Object > Insert.
- In the Object Options area at the top of the Insert Anchored Object dialog box, specify the Content for the object (such as Text or Graphic).
- Select an Object Style to specify the object's formatting (if you've created any object styles).
- Select a Paragraph Style for the text it will contain (if the object is a text frame).
- Enter a Height and Width for the object.
You can also specify the position of the anchored object, as discussed in the next section.
Positioning Anchored Objects
To change the positioning of an anchored object, click it using a selection tool and choose Object > Anchored Object > Options. The controls in the Anchored Object Options dialog box are the same as those for positioning in the Insert Anchored Object dialog box. Choose an option from the Position menu at the top:
- Inline or Above Line: Select this option if you want to anchor the object inline with the text or above a line of text.
- Custom: Select this option if you want to anchor the object in a different position, such as outside the text frame.
If you choose Inline or Above Line from the Position menu, the Anchored Object Options dialog box (Figure 36b) lets you specify which type of anchoring you want and then further fine-tune the positioning.
Figure 36b When Inline or Above Line is selected from the Position menu, the Anchored Object Options dialog box lets you specify the position of anchored objects that are flowing with text or above lines of text.
- Inline: To position the object inline with text, click Inline. Enter a value in the Y Offset field to move the object up or down from the baseline of the text.
- Above Line: To position the object above the line containing the text insertion point, click Above Line. Choose an option from the Alignment menu to specify how the object is positioned within the text frame: Left, Center, Right, Towards Spine, Away from Spine, or Text Alignment (which matches the alignment of the paragraph). Enter values in the Space Before and Space After fields to control the amount of space above and below the anchored object.
If you choose Custom from the Position menu, the Anchored Object Options dialog box (Figure 36c) lets you specify precisely where the object should be placed.
Figure 36c For an anchored object with Custom alignment, the Anchored Object Options dialog box lets you position the object in relation to the columns of text, the page, and more.
- Relative to Spine: Check this option if you want the object's placement to be different for right-facing and left-facing pages. For example, if a book has a wide outer margin, you might place anchored objects in the margin. When text reflows from left to right pages, you'll want the anchored objects positioned accordingly.
- Anchored Object Reference Point: This option specifies what part of the anchored object should align with the page, text frame, or margins (as specified in the Anchored Object Position area below). For example, if the lower-right corner of the object should align with the text frame, click a box on the lower-right corner.
- Anchored Position: In this area, the X Relative To menu and X Offset field control the horizontal placement of the anchored object. The Y Relative To menu and Y Offset field control the vertical placement of the anchored object. The reference points available vary according to the selections you make in the X Relative To and Y Relative To fields, but essentially the Reference Point you click indicates the location on the page with which the object should align.
The interplay of these settings is fairly complex, so be sure to check the Preview box so you can see any changes you make as you make them.
Releasing Anchored Objects
If you no longer want an object anchored, select it with a selection tool, and then choose Object > Anchored Object > Release. (The Release command is available only for anchored objects with Custom alignment.) To unanchor an object that you anchored, select it with the Selection tool, choose Edit > Cut, and deselect the containing text frame. Then, choose Edit > Paste to place the unanchored object on the page.