Today's question comes from Greg Walker:
Hey Mordy. Maybe you can shed some light onto one of my biggest Illustrator pet peeves.
Let’s say I have five boxes, and I want to distribute these boxes evenly. Seems easy enough, right? Select all the boxes and hit the “Horizontal Distribute Center” button. Often times this will work without a hitch and I can keep right on Rockin’ and Rollin’ right along. Other times, however, I’ll get the dreaded “Please choose a key object by clicking on one of the selected object(s) with the selection tool, or set the spacing value to Auto.” This drives me nuts. At the least I have to click okay and go over to the Align palette and change the spacing value to Auto and at worst I have to actually go to the trouble of opening the Align palette, which introduces even more clicks. What really gets under my skin is the apparent randomness with which Illustrator decides to change the distribution spacing from “0 in” to “Auto.” I would be quite happy for it to just stay at Auto until such time as I manually change it to some other number which will likely never ever be zero. Rarely do I draw five objects only to stack them all on top of one another.
Also, if you have the time and knowhow, is there a way to quickly center two (or more) objects both vertically and horizontally. The repeated “Horizontal Align Center” and “Vertical Align Center” click combo is a mine field of accidental clicks and subsequent undos.
Alas, the Align panel that appears in Illustrator also appears in InDesign. It is often that I lament about how difficult it is for one to decipher all the little "chicklet" icons on the panel. What makes it all the more difficult is that Adobe has combined alignment functions, object distribution functions, and spacing distribution functions all in one panel. So in addition to all of the icons, there are just so many combinations or choices at hand. As if that weren't enough, Illustrator "hides" the spacing distribution functions in the "Show Options" part of the panel, meaning that many people aren't aware that it even exists.
Hopefully my post here will relieve some of Greg's frustrations, and maybe the frustrations of others as well.
To start, I'll answer Greg's second questions first. It would be nice if Illustrator had a "Center Objects Horizontally AND Vertically" option (but that would add yet ANOTHER chicklet icon), as it's very often that designers need to center objects to each other in this way (or to the artboard if that option is chosen). Rather than click up a storm, this can easily be accomplished by recording a simple Action and assigning a keyboard shortcut to it.
1. Draw two objects on your page and select them.
2. Open the Actions panel by choosing Window > Actions.
3. Click the Create New Action button at the bottom of the Actions panel. Give the Action a name and assign a keyboard shortcut of your choice. Click Record.
4. Open the Align panel by choosing Window > Align.
5. Click the Horizontal Align Center button. Then Click the Vertical Align Center button.
6. Click the Stop Recording button at the bottom of the Actions panel.
Now you can select any objects in your document and press the keyboard shortcut you specified to instantly align the objects to each other both horizontally and vertically.
OK, so now on to the first question, which deals with the concepts of key objects and distribute spacing values and what we all affectionately refer to as "annoying dialog boxes"
The first thing one must understand about the Align panel is that it brings together three VERY different functions, yet that may not be readily apparent to the casual user. To fully grasp this, you need to make sure that the entire Align panel is expanded and visible. If it doesn't look like what you're seeing below, choose Show Options from the panel's flyout menu.
These six options allow you to align objects TO EACH OTHER. You can use the toggle on the bottom right of the Align panel to align objects to the Artboard or active Crop Area. When objects are aligning to each other, a "key object" is defined so that Illustrator knows what you want your objects to align to. If you don't define a key object, Illustrator will appoint one for you. Anything you say can and will be used against you in a court of -- oh wait, no that's something else... For more information on defining key objects, see this post. Other alignment tips can be found in this post as well.
These six options allow you to evenly distribute objects within a specified area. What is the specified area? Good question. In the case of alignment, you're always aligning your objects TO something else. Be it another object or an artboard, etc -- it's always a single object. But to distribute objects evenly, you need TWO key objects. By default, Illustrator picks the two objects that are the furthest apart from each other. Those objects don't move -- they remain stationery and all objects that fall between those two key objects are distributed evenly, as illustrated below.
I used the Horizontal Distribute Center option in the above examples. The dashed line indicates the center of each object. After applying the distribute command, the object on the far left and right remained in place, while the two objects in between moved so that their centers were distributed evenly. The amount of space between the centers of all the objects is now consistent. However, the important thing here is that I, as a user, had absolutely NO control over the distance BETWEEN each object. The only way for me to adjust that is to move the two outer objects further away from each other (or closer together) and then reapply the distribute command. If I wanted each object to be a specific distance from each other (for example, 1 inch apart), I'd need to do the math and figure out how far the end objects need to be to make that happen.
Or, I could use Distribute Spacing.
The most common mistake I see people make about Distribute Spacing is that they still focus on the objects on the page. Like any good designer knows, white space isn't just an abstract. It's SOMETHING. And to better understand what distribute spacing does, you need to think about white space. That's because distribute spacing allows you to determine the amount of consistent white space BETWEEN each object in your selection. And that's where the value comes into play. When you leave the value set to Auto, you're telling Illustrator to do the following:
1. Define the two outer-most objects as key objects. In other words, don't move those outer objects.
2. Evenly distribute the distance BETWEEN each object using the key objects as boundaries.
But if you specify a value, you're telling Illustrator to do the following:
1. Define a key object
2. Apply the specified amount of space (the Value) BETWEEN each object, starting from the key object.
Do you see the problem here? How can Illustrator perform step 1? How does Illustrator define a single key object? With the Auto setting, Illustrator could use the two outermost objects. But with a specified value, the key object can only be one object. And Illustrator doesn't know which object you want to distribute the spacing FROM. That's why Illustrator throws up the dialog, asking you to tell it which object stays still. Then it can perform step 2 as listed above. Let's take a look:
After using Horizontal Distribute Space with a value set to Auto:
After using Horizontal Distribute Space with a value set to 1p and specifying the left-most object as the key object:
And now for the kicker: Even though the design and layout of the Align panel make it seem as if the value field only applies to the Distribute Spacing functions, the value ALSO applies to the Distribute Objects functions! Surprise! This means if you have a value defined, the Distribute Objects functions don't use the two outermost objects as key objects. YOU have to define the key object. And the value that you specify is used to determine the amount of space not between the objects, but between the parts of the objects you're choosing by clicking any of the 6 distribute functions. For example:
After using Horizontal Distribute Center with a value set to Auto:
After using Horizontal Distribute Center with a value set to 4p and specifying the left-most object as the key object:
So basically, if you don't have the entire Align panel visible (i.e., the Show Options setting isn't enabled), and if there's a value anything other than Auto specified for Distribute Spacing, using any of the Distribute Objects functions will cause the "define a key object" dialog to appear.
The problem of Illustrator just arbitrarily changing the spacing value from Auto to 0 is not something I have seen. But the setting itself is indeed "sticky", meaning if you make a change, it stays until you specify otherwise. That could be what is causing the problem.
I'll admit that I use a value of "0" all the time, because when used with the Distribute Spacing option, it will automatically "kiss fit" your objects to each other. Which is incredibly useful.
As a final tip, it's important to know that the Align panel looks at groups as individual objects (those who have taken my classes or who have read my books or seen my training videos know I refer to these groups as "containers"). So if you have multiple groups selected, the alignment and distribution functions work nicely. Also, if you're using Illustrator CS3, you'll be happy to know that the align functions now properly honor the bounds of masked artwork.
NOTE: You'll notice that in all of these examples, I've used boxes of different sizes. Often, the differences between the multitudes of settings in the Align panel are indistinguishable when the objects are all the same. Mixing up different heights and widths will make things MUCH easier to understand.
Hopefully, this has cleared up some confusion. As always, I encourage readers to leave comments if more detail or discussion is required.