Thanks for coming to InDesignSecrets.com, the world's #1 resource for all things InDesign!

Align To Key Object

[NOTE: This guest post was written by Mathew Hobson. Check out his blog for more fun posts! We’re looking forward to seeing more from Mathew in the future.]

Some of my favourite things about Illustrator are the object alignment options available. Yep, I am easily pleased. Now, finally, someone has seen sense and added the king of alignment features–Align to Key Object–to InDesign. This’ll be quick and over before you know it. So strap in, sit back and prepare to moved.

It’s So Obvious

Problem: Here are my boxes. I want everything on the page aligned to box 2. I want them all 5mm apart. I don’t want box 2 to move? its position is perfect. And no, I don’t want to drag them around, even with Smart Guides on.

key object indesign

Solution (pre CS6): OK, here’s how to do it if you’re using InDesign CS5.5 or earlier: Select everything. Then it is over to the Align panel. First things first, go to the Distribute Spacing section. If this isn’t showing at the bottom, choose Show Options from the panel menu.

2CS4

I want to set the spacing to 5mm, so I tick the Use Spacing check box, enter my value and then hit the Distribute Horizontal Space button. Right, so that moved everything to the left. As the Align To menu was set to Selection, InDesign assumed I wanted the far left object (box 1) to be the anchor point. At least all the boxes are now 5mm apart, they are just in the wrong place. Never mind, I can fix it later. Should you need it, Anne-Marie’s post here covers Distribute Spacing in more detail.

2HDis

Next up, I need to bring everything down to align with the centre point of box 2. Leaving Align To set to Selection would be a disaster!¬†Everything will move to the centre point of the overall selection, not what I want at all. My best bet is Align to Page. Its not perfect but box 2 kinda lines up with the page centre, so it’ll do. I hit the Centre Align button and we are done? more or less.

2CAlig

Alternative Solution(CS5): Under different circumstances it would be possible to lock the object you wish to align to. You will need to ensure that the Prevent Selection of Locked Objects preference is disabled for this to work. Whilst this method would align to the centre correctly, I wouldn’t be able to distribute to the locked object. InDesign will try to align everything to the left most box and my faux Key Object will not be able to move, causing the whole process to grind to a halt!

Best Solution(CS6): OK, now let’s see how it works in CS6 and later: Select everything and then single-left-click on box 2. This puts a chunky blue highlight around it, defining it as the Key Object. As before, I set my spacing to 5mm and hit Distribute Horizontal Space. Then one click on the Centre Align button and we are done.

2KOHDis

2CS6

2KOCAlig

Seriously, Why Did This Take So Long?

As in Illustrator, by setting a Key Object within the selection, you are temporarily locking it’s position on the page. Everything else will move around it. To change which object is the key, click on another. Clicking on the Key Object again turns the Key Object off. This is the same as choosing a different option from the Align To menu.

If you are working with text frames you may also want to read this post on the The Right Way to Vertically Distribute Text Frames. The only difference being that you can now choose a Key Object as your anchor point.

Use Keyboard Shortcuts

It’s great, it’s quick and it’s easy. Especially when you pair it with some custom keyboard shortcuts. You can find the alignment commands in the Object Editing category. Personally, I have the shortcuts set for Horizontal/Vertical Align Left, Right and Centre. I use those combined with a couple of one line scripts (both also assigned shortcuts) which set the Align To menu to the Page or the Selection. They are:

app.alignDistributePreferences.alignDistributeBounds = AlignDistributeBounds.PAGE_BOUNDS;

and

app.alignDistributePreferences.alignDistributeBounds = AlignDistributeBounds.ITEM_BOUNDS;

I am no scripter so this could probably be done in more elegant way. But with these, and now Key Objects, zipping around the Align panel choices and making quick object alignments is more of a doddle than ever before. (If you don’t know what to do with those scripts, see “How to Install a Script in InDesign That You Found in a Forum or Blog Post.”)

David Blatner

David Blatner

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at Lynda.com are among the most watched InDesign training in the world. You can find more about David at 63p.com.
David Blatner

Latest posts by David Blatner (see all)

  • - November 30, -0001
Tags
Related Articles
Comments

6 Comments on “Align To Key Object

  1. Is there a way to align an object to text or invisible marker?
    I have a document with many anchored objects and would like to center align each anchored object between it’s anchor marker and the previous one.
    It sounds like something that can be scripted, but i am not even sure what the commands should be doing!
    Thanks

  2. I created a new file in Illustrator. 210 x 297 mm and a rectangle 40 x 297 mm.

    First I can’t create a rectangle with those measurements, since it changes to 40,217 x 296,686, and also I can’t align to the corner of the page, because it moves. But I can align a group of objects and it doesn’t move.

    The “Scale Strokes & Effects” and “Align To Pixel Grid” boxes are UNCHECKED, and also the grid.

    I do not understand. Did I changed the settings? Is there anything else I have to see. I am sure there is not guides, no other objects. I closed and open Illustrator and it does the same.

    I have the same problem if I create a new document with any new rectangle. I do not know what else to check.

    Any ideas?

    • ipunk: I don’t think you can; but as we said above: it’s just one additional click. You select all the objects, then click once on the item you want to be the key item and it highlights and you good to go.

Leave a Reply

Your email address will not be published. Required fields are marked *