Inline Frames and Anchored Objects
It was the Dark Age of page layout. The flame of classical desktop publishing knowledge flickered but dimly, kept barely alive by devoted acolytes in isolated monasteries. Pestilence and famine stalked the narrow aisles between our unheated cubicles. And, almost worst of all, page layout programs could not paste graphics into text. Producing publications featuring graphics “anchored” to a specific piece of text was a nightmare. It went something like this. Scroll. Zoom in. Measure. Pull a guide down from a ruler. Select a graphic. Drag the graphic until it snaps to the guide. Sigh heavily. Repeat.
These days, we embed graphics in lines of text whenever the graphics have a defined relationship to the text. You know what we we’re talking about—illustrations that should appear immediately after a paragraph (think of the screen shots in a manual), or icons “hanging” to the left of a column of text, or graphic symbols in a line of text. If you anchor the graphics in the text, they’ll follow the text as it flows through the text blocks or text frames containing the story.
Really early versions of InDesign offered only “inline frames,” but now you can create inline frames, above line frames, and anchored objects, too.
- An inline frame sits in the text position where it’s placed, though you can adjust its vertical offset (how far up or down it sits from the baseline of the text around it). For example, you might want to put graphic in the middle of a line of text.
- An above line frame sits between the line you placed it on and the line above it. InDesign adds space between the lines to make room for the object, ignoring leading or other spacing you’ve set. We usually call these inline frames, even though they’re technically different.
- An anchored object can be placed anywhere on your page, even outside the text frame.
Using inline frames does more than just “stick” a frame to a particular location in a story—it also makes it easier for you to control the space between the graphic and the text. Complicated spacing arrangements that would be difficult (and involve lots of measuring and moving) without inline frames become easy to implement using leading, tabs, indents, and paragraph space above and below.
What can you anchor?
Even though we keep saying “frames,” you can actually anchor any kind of object into a text frame. You can use graphic frames, text frames, lines, and groups as well, opening up new ways to solve old problems and adding capabilities that are entirely new. You can even create inline frames or anchored objects using frames that contain other frames or other inline frames.
What can’t you do to anchored objects?
Despite an impressive array of cool things you can do with inline frames and anchored objects, there are still a few things you can’t do. For example, you can’t link (or “thread”) an inline or anchored text frame to another text frame. You also cannot see what’s inside them when you’re in Story Editor mode (or Galley or Story mode in InCopy). The latter is especially annoying. In fact, we’re typing this in Story Editor right now and can’t see the heading in the next paragraph because it’s already anchored. Just another good reason to buy a another monitor so that you can have Story Editor and the document layout visible at the same time.
Creating an Inline Frame
You can use any of the following methods to create an inline frame (see Figure 6-53).
- Paste a frame or group into text.
- Place a graphic when you have an active text insertion point.
- Position the text cursor where you want the inline frame and choose Insert from the Anchored Object submenu (under the Object menu or the context menu). Then choose Inline or Above Line from the Position pop-up menu. We virtually never use the Insert Anchored Object feature, but it’s nice to know it’s there. Instead, we usually paste an existing object, or place a file.
- Use the Type tool to select a character or a range of characters and choose Convert to Outlines from the Type menu. InDesign creates a path for each character in the selection and embeds the paths, as a compound path, in the text.
InDesign treats each inline frame as a single character of text. When you view the text in Story Editor, you can see the “anchor marker” (a little anchor symbol) in the text.
You can select an inline frame using the Type tool and adjust its leading and baseline shift using the Character panel. You can adjust the horizontal distance between the inline frame and the other characters on the line using kerning or tracking—you can even kern text following the inline frame back into the frame (you can’t, however, kern the frame back into characters preceding it on a line).
You can select an inline frame using the Selection or Direct Selection tools, and you can edit the shape of the inline frame using the path drawing tools (the Pen, Add Point, Delete Point, and Convert Point tools). You can also drag an inline frame up or down in the text frame using either of the selection tools (see Figure 6-54), or you can apply a baseline shift to the character containing the inline frame.
Another way to adjust the vertical offset of a selected inline object is to choose Options from the Anchored Objects submenu (under the Object menu or the context menu) and change the Y Offset value. This is a particularly good way to get the offset back to zero if you have accidentally nudged it up or down.
Inline Frames and Leading
When you insert an inline frame into a text frame, InDesign gives it the leading value of the surrounding text. If you’re using “auto” leading, and if the inline frame is taller than the height of the text, InDesign pushes the line down to prevent the inline frame from overlapping the text on the lines above it. If, on the other hand, you’re using a fixed leading value, you’ll see the inline frame overlap the text. By default, InDesign positions the bottom of the inline frame at the baseline of text.
This works perfectly for us—when the inline frame shares a line with other text, we usually want the leading of the line to stay the same as the other lines in the paragraph—and we can get this effect using fixed leading values. When we place an inline frame in a paragraph by itself, however, we usually want the height of the paragraph to equal the height of the inline frame—and we can get that effect by using “auto” leading for the paragraph.
The rules are a little different when an inline frame falls on the first line of text in a text frame. In that case, the position of the baseline of the inline frame is controlled by the First Baseline option in the Text Frame Options dialog box.
If the height of the inline frame is greater than the height of the characters in the line (and it usually is), choosing “Ascent” positions the top of the inline frame at the top of the text frame. This pushes the first line down to accommodate the height of the inline frame. If you adjust the vertical position of the inline frame, the position of the first line of text moves up or down. The same thing happens when you choose “Cap Height” (note that these two settings produce different results for text, but are the same for inline frames).
When you choose “Leading,” however, InDesign positions the baseline of the first line of text according to the largest leading value in the line. If you’re using a fixed leading value, and you’ve set the leading of the inline frame to the leading of the surrounding text, the position of the baseline of the first line of text won’t change, regardless of what you do with the inline frame.
We always use the “Baseline” option for our first baseline position, and we always set the leading of a graphic that shares a line with text characters to the leading of those characters. This way, we always know where the first baseline of text will fall, and we don’t have to worry that changes to the shape, size, or baseline position of the inline frame will mess up the leading.
The only time we use “auto” leading is when we’re working with a paragraph that contains only an inline frame. The only trouble is that we want the vertical distance taken up by the paragraph to be exactly equal to the height of the inline frame—no more, no less. By default, InDesign’s “auto” leading value is equal to 120% of the point size of the type (or, in this case, the height of the inline frame). How can we get the base “auto” leading percentage down to 100%?
The percentage used to calculate “auto” leading, as it turns out, is a paragraph-level attribute. To view or adjust this percentage, choose Justification from the Paragraph panel’s menu. InDesign displays the Justification dialog box. Enter 100 in the Auto Leading field and click OK to close the dialog box (see Figure 6-55). Once you’ve done this, the leading of the paragraph will equal the height of the inline frame. If you want, you can add this to a paragraph style definition.
Creating Hanging Side Heads
If there’s one thing that inline frames make easier, it’s hanging side heads. You know—the headings that appear to the left of a column of text (like the one to the left of this paragraph). In InDesign, you can create a hanging side head that follows a paragraph of text as it flows through a publication—no more dragging the headings to a new position when text reflows. You use a hanging indent and an inline frame, as shown in the following steps (see Figure 6-56).
- Create a hanging indent. To do this, set a left indent that’s the width of the “companion column” you want to the left of the paragraph, then set a negative first line indent equal to the width of the left indent. Place a tab stop at the left indent.
- Enter a tab character before the first character of the paragraph. This pushes the text to the left indent.
- Paste a text frame before the tab character you just entered. Adjust the position of the inline text frame, if necessary.
- Enter the heading’s text in the inline text frame.
- Format the heading.
That’s all there is to it—you now have a hanging side head that will follow the paragraph anywhere it goes. This same technique can be used to position graphics frames, and is handy when you need to “hang” an icon or a vertical rule to the left of a particular paragraph.
Of course, you can accomplish the same thing with an anchored object—which can actually sit in the margin outside the text frame (see “Creating an Anchored Object,” later in this chapter). But some people find inline frames easier to work with.
Selecting and Removing Inline and Anchored Objects
As we mentioned earlier, you can select an inline or anchored object using the Type tool (the object behaves as if it were a single character in the story) or the Selection tool or Direct Selection tool. If you use the Type tool, you can select more than one inline or anchored object at a time (to control their position in the Anchored Object Options dialog box). Using either method, you can delete the object by pressing Delete.
To “unanchor” an inline frame or anchored object, select it using the Selection tool, then cut and paste. If it’s an anchored object, you can also select Release from the Anchored Object submenu (on the Object menu or context menu). Release doesn’t work for inline or above line objects.
Creating Above Line Objects
Above line objects are much like paragraph rules, but you can use any object (or group of objects), to create a wider range of effects. For example, you might use an imported graphic as a rule above a paragraph. You can make an above line object in one of two ways.
- Choose Insert from the Anchored Object submenu (from the Object menu or the context menu), and then choose Above Line.
- Create an inline frame as we described earlier in this section. Then select it using either the Selection tool or the Type tool (the latter is especially helpful when you want to convert a number of inline frames to above line objects at the same time) and choose Options from the Anchored Object submenu. When the Anchored Object Options dialog box appears, turn on the Above Line option.
Once you create an above line object, you can use the Anchored Object Options dialog box to control where the object will appear in the space between the current line and the line before it (see Figure 6-57). The Alignment pop-up menu lets you choose Left, Center, Right, Toward Spine, Away from Spine, and Text Alignment. The last item simply means use the same alignment as the horizontal alignment of the paragraph the above line object is sitting in (left, center, or right).
You can also adjust the space before or after the object. Increasing these values adds vertical space around the above line object. You can also use negative values for Space Before and Space After (up to the height of the object itself), which will cause the object to overlap the preceding or following line. InDesign changes the Space Before and Space After values whenever you drag the object up or down. (As you’d expect, you won’t be able to drag the object if you have turned on the Prevent Manual Positioning option or if you have enabled Lock Position on the Object menu. Turning either of these features on enables the other.)
Creating Anchored Objects
Unlike inline frames and above line objects, anchored objects can appear anywhere on the page or spread containing their text anchor. Just like above line objects, you can create an anchored object using either the Insert Anchored Object dialog box or by creating an inline object and then converting it to an anchored object by copying and pasting (see Figure 6-58).
- Select the inline object by clicking on it with the Selection tool or by dragging over it with the Type tool.
- Choose Options from the Anchored Object submenu (under the Object menu or the context menu).
- Choose Custom from the Position pop-up menu at the top of the Anchored Object Options dialog box. The dialog box now offers a dizzying array of options. Don’t panic. All will be explained below.
- To manually position the object on the page, just click OK (to close the dialog box). You can then move the object with the Selection tool to wherever you want it.
At this point, the anchored object acts as if it is tethered to the anchor marker As the text reflows, the object moves, too. To be more precise, the horizontal location of the anchored object remains fixed relative to the text frame (it only moves when the text frame moves or when the anchor marker moves into a different frame), but its vertical location moves with the line of text itself (the line containing the anchor marker). With these default settings, the anchored object will also stay within the top and bottom boundaries of the text frame—you can’t drag it above or below the frame.
But the default settings are only the beginning. Let’s look at what else you can do in the Anchored Object Options dialog box.
Relative to Spine
If you want to position an anchored object precisely (as opposed to just dragging it somewhere), the first decision you need to make is whether to turn on the Relative to Spine option. When this option is on, InDesign positions the object differently depending on whether it sits on a left hand (verso) or on a right hand (recto) page. This option is similar to the Align Toward Spine and Align Away from Spine paragraph alignment feature, and is useful when you want an object to appear in the outside or inside margin of a page.
The next step is to tell InDesign what part of the anchored object you’re positioning. When Relative to Spine is off, you’ll see a single Reference Point proxy from which you can choose a corner, side, or center point. If you choose the lower-right corner of this proxy, you’re telling InDesign to position the lower-right corner of the anchored object at a particular place on the page. (We’ll get to where it’ll be positioned in a moment.)
If you’ve turned on the Relative to Spine checkbox, you’ll see two proxies in the Reference Point section. When you choose a point on one proxy, it’ll be mirrored on the other. What InDesign is trying to tell you is that you’re no longer choosing the left or right sides of the anchored object, but rather the inside (toward spine) or outside (away from spine) sides. Click the lower-right corner point of the left Reference Point proxy, and you’re telling InDesign that you want the lower-inside corner to be positioned at a particular place on the page.
Turn on the Preview checkbox! You will likely go insane if you try to figure out all these controls without it. With the Preview checkbox turned on, you can see the effect of each change you make.
The final step to positioning an anchored object is in some ways the most complex: Telling InDesign where you want the object to appear on the page using the Anchored Position section of the Anchored Object Options dialog box. We find that it helps to learn to “read” the dialog box (see Figure 6-59).
The Reference Point control in this section (note to Adobe: Please don’t give two different settings the same label) makes no sense until you look at the X Relative To and Y Relative To sections, so skip it for a moment. The X Relative To pop-up menu sets the horizontal position of the anchored object. You can choose Anchor Marker, Column Edge, Text Frame, Page Margin, or Page Edge.
If you click the left point in the Reference Point proxy (the one in the Anchored Position section) the default setting of Text Frame means, “position the anchored object relative to the left side of the current text frame.” If you select the right point of the Reference Point proxy, it means “position the anchored object relative to the right side of the current text frame.” If you have turned on the Relative to Spine checkbox, these mean, “relative to the outside/inside of the text frame”.
The Y Relative To pop-up menu determines the vertical position of the anchored object. Your options are: Line (Baseline, Cap Height, or Top of Leading), Column Edge, Text Frame, Page Margin, or Page Edge. The default setting is “Line (Baseline),” which means, “position the anchored object on the page so that it aligns with the baseline of the line that includes the anchor marker.” As the line shifts up or down, so does the anchored object.
When you choose one of the Line options from the pop-up menu, the Reference Point proxy limits your choices to left, center, or right. The reason is obvious: There is no “upper left” corner of the anchor marker’s baseline. However, if you choose a Y Relative To setting having to do with the frame, column, or page, the Reference Point proxy changes to allow you to choose more points (upper left corner of the page, lower left corner of the page, and so on).
You can also specify X Offset or Y Offset values in order to precisely position the anchored object. If you select the right-center point of the Reference Point proxy and select Page Edge from the X Relative To pop-up menu, and then type 20 mm in the the X Offset field, what you’re saying is, “Place the anchored object 20 mm from the right edge of the page.” You can enter negative numbers for all kinds of positioning tricks (such as putting an object on the page opposite the page containing the anchor marker).
The last control in the Anchored Position section is the Keep within Top/Bottom Column Bounds. (It’ll be grayed out unless you have chosen one of the Line options from the Y Relative To pop-up menu.) The idea here is that if the line containing the anchor marker gets too close to the top or bottom of the text frame, the anchored object might extend past the frame’s top or bottom edge. If you don’t want this to happen, turn this option on.
Prevent Manual Positioning
As we noted earlier, turning on the Prevent Manual Positioning checkbox is exactly the same as choosing Lock Position from the Object menu. It’s just a good way to ensure that your anchored objects don’t get accidentally moved.
Once you’ve set up an anchored object, you may not remember where, exactly, the anchor marker is located. Choose Show Hidden Characters from the Type menu, and you’ll see a little anchor marker symbol in the story—it’s a light blue yen character (¥). Similarly, if you open Story Editor, you can see a black anchor symbol at that location. But perhaps the most useful indicator appears when you choose Show Text Threads from the View menu—select the text frame or the anchored object with the Selection tool and you’ll see a dashed line connecting the two.
Text Wrap and Inline and Anchored Objects
You can wrap text around inline or anchored objects. This feature comes with three big caveats. First, only the story in which the object is anchored is affected. Text in other frames ignores anchored objects. Second, if you anchor an object inside a table cell, text wrap is completely ignored. Finally, only the lines following the line containing an anchored object are affected by the object’s text wrap. The line containing the anchored object ignores the text wrap.
Drop Cap Wrap
One of the most frustrating aspects of drop caps is that there is no way to tell InDesign to wrap the subsequent text around them. You can fake it by putting the drop cap character in a separate text frame, or by converting the character to outlines, but then the drop cap wouldn’t travel with the text, right?
Enter inline frames. As David first documented in his book with Anne-Marie Concepción, Adobe InDesign CS/CS2 Breakthroughs, you can place a drop cap character in a separate frame, paste it at the end of the paragraph before the paragraph in which it’s supposed to appear (you can put the frame in a blank paragraph when the drop cap appears at the beginning of the story), and then adjust the text wrap boundaries with the Direct Selection tool to get the effect you want (see Figure 6-60).
Ole notes that this is a heck of a lot of work to go through to achieve a design effect that makes your text harder to read (as varying the starting position of successive text lines always does). Further, he notes in his irritating, pedantic fashion, there’s a reason that the drop caps in beautiful old books almost always place the ornamental drop cap in a rectangular frame—to avoid this very temptation.
Anchored Object Recipe: Hanging Side Heads
Earlier, we mentioned that inline frames are the best way to create hanging side heads (such as the one loitering to the left of this paragraph), but we were telling only half of the story. By experimenting on ourselves (as any good pair of mad scientists should), we’ve found that the best approach to hanging side heads is to create inline frames by copying, pasting, and then converting them to anchored objects.
We did this because we found that changes in InDesign between CS and CS2 (and now CS3) make it much more difficult to control the vertical position of inline frames—which, in turn, made managing our hanging side heads a bit of a challenge. The good news is that anchored objects offer a level of precision that inline frames just can’t match. We found a set of anchored object settings that worked well with our hanging side heads, and then created a script to apply the changes to our chapters.
We set up the hanging side heads—most of which were already inline graphics—as shown in Figure 6-61. The horizontal location of the top left corner of the hanging side head is set to the left edge of the text frame, and the vertical location is 13 points above the baseline of the line of text containing the anchor (our leading grid is based on 13 point increments).
We want the frame to remain within the vertical bounds of the text frame, and we allow manual positioning (because we need to be able to adjust the height of the frame as we add or delete text).
Putting a Box Around Text
How can you put a box around a paragraph that will follow the paragraph as it flows from column to column or page to page? As shown earlier in this chapter, you can use paragraph rules or a single-cell table (we prefer the table approach), or you can use an inline rectangle, as shown below (see Figure 6-62).
- Create a paragraph above the “box” paragraph.
- Draw a rectangle, then paste the rectangle into the empty paragraph you just created.
- Set the leading of the paragraph and the inline frame to some fixed value (anything other than “auto”).
- Adjust the size and baseline position of the inline frame so that it falls around the following paragraph.
- Use the Keep With Next option to “stick” the paragraph containing the inline frame to the following paragraph.
You could also do this with an anchored object rather than an inline frame, which means you don’t need a separate empty paragraph. However, the anchored object will obliterate the text behind it unless it has a fill of None. One solution is to set the transparency blending mode for the anchored object to Multiply in the Effects palette. Or, as we said earlier, use the table method.