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.
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.
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.
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.
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.
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;
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.”)