Category: Tech

We Have Book

Woo hoo! When I heard that I had a FedEx package from O’Reilly today, I just knew it had to be my new book. Sure enough, I now have a real printed copy. Even though you’d think I’d know everything about it after the effort of getting it ready for publication, there’s still something magical about holding the physical object in my hands, to hold and flip through.

It looks great! My only disappointment was that I received just one copy. I know things have been scaling back since the Swing book (when all three revision authors got ten copies each). Upon finishing the Developer’s Notebook I got five. But one copy? I want one for reference, of course, and I’d always like to be able to send one to my parents. Well, maybe more are on the way later, or I’ll just have to buy a copy out of the vast royalty stream I can always dream of…

But really, I’m thrilled to have the book, and hope many people will find it interesting and useful. It was definitely fun working with Tim and Ryan to put it together.

Typing Pretty on your Mac

Recently I helped out a friend of mine by editing his restaurant review to include the proper accented characters, as well as real typographer’s quotes and apostrophes. He asked me how I’d done that, and I wrote up an over-elaborate reply, which I might as well share with the world, since my quick Google searches haven’t shown anything better out there that I could easily find. So in the interest of an online guide to more attractive text, here it is.

If you’re not reading this on a Mac, it’s not going to be that useful to you (unless you’ve got one somewhere) and I won’t be offended if you go read something else. If you do stick with me, be warned that Internet Explorer doesn’t yet know how to display the symbol for the Mac’s “option” key, which is used a bunch. Firefox handles it fine, though, even on Windows.

OK, how do I do it?

It’s always been pretty easy on the Mac, and the key commands have been fairly stable over the decades of the Mac’s existence, although the graphical tools I’ll introduce later have evolved and expanded. When the Mac first came out, few computers could deal with any characters other than the standard US ASCII alphabet (which is barely richer than your average manual typewriter), and even lowercase was relatively new.

The key to typing most of these special characters is the “option” key, represented by the symbol ⌥. (Note that this discussion assumes you’re using a US keyboard, since that’s what I have available to me. I am sure there are important differences when using keyboards for languages that commonly use these characters.)

Accented letters

Accents are implemented using what are called “dead keys” where you type a symbol first, then type the character you want to apply it to. To get an “ì” you type ⌥-` (hold down ⌥ and type the key to the left of “1” then let go of both). You will see a grave accent (“ ` ”) on a yellowish background—that means the system knows you want to combine that accent with another letter. Then you type “i” and you get the combined result, an “ì” with a grave accent.

Other accents are not quite as obvious, alas. I think they were trying to avoid requiring multiple modifier keys for the accent key prefix, so you don’t type ⌥-⇧-` (option, shift, and the key left of “1”) to get a combining tilde (~) even though that would be visually intuitive since ⇧-` is how you normally get a tilde. Instead, you have to know that the tilde is most commonly used create an eñe (the “nyuh” sounding letter in Spanish), so you produce it using ⌥-n. So to get “ñ” you type ⌥-n followed by “n”. But you can get other funky letters like “õ” by ⌥-n followed by “o”.

Similarly to get an acute accent, like you see on the “e” in “¡Olé!” you type ⌥-e followed by the letter you want to accent. And how did I get that upside down exclamation mark? ⌥-! will do that. It’s not a combining symbol, so it’s not a dead-key combination; as soon as you hit that set of keys, the symbol is added to your text. ¿Y la pregunta? To get an upside-down question mark you do need to add the shift key; that’s ⌥-⇧-/ (option, shift and the key on which the question mark appears).

Other choice symbols

There are a bunch of other useful symbols you get via the ⌥ key. I will mention a few of the most important, then show you how to explore on your own. First, let’s look at real quotation marks. Most of the people, most of the time, use foot ( ‘ ) and inch ( ” ) marks instead of quotation marks ( “ ” ) and apostrophes ( ’ ), because that is all that old typewriters and early computers could produce. But in real typesetting, like in handwriting, there is a difference between opening and closing quotation marks, and apostrophes have a directionality to them as well. You use the “[” and “]” keys to produce them. Alas, I think Apple got this a bit backwards. I would think the “[” key would produce opening marks and the “]” key would produce closing marks, and you’d use ⇧ to pick between single and double, but no. ⌥-[ gives you an opening double-quote, ⌥-⇧-[ gives you a closing double-quote, ⌥-] gives you an opening single-quote, and ⌥-⇧-] gives you a closing single-quote, also known as an apostrophe.

Some people call these “smart quotes” but that is inaccurate, and comes from a feature in some word-processing programs which automatically converts straight quotes when you type them to curly quotes, guessing which version is needed by looking at the context in which you’re typing. That can seem handy, but often screws up, so once you learn the keyboard combinations for typing them yourself, you are better off seizing control and doing it yourself, turning off this feature in the software.

Last—but by no means least—I typed those lovely long dashes (called em-dashes in the typography world because they are as long as a capital “M”) by typing ⌥-⇧ and the minus key (to the right of “0”). The slightly shorter en-dash (-) is just ⌥ plus the minus key, but there’s not as much visual difference between that and a normal minus/hyphen, and less call to use it. Where you might find yourself tempted to use a double hyphen, use an em-dash instead. Pretty much everyone’s email client can handle Unicode these days. And certainly everyone’s web browser can.

Finding obscure stuff

OK, now the tips on how to learn more. The key is to get easy access to a couple of palettes, which you do in an unexpected way. Open the International section of your System Preferences:

System Preferences showing the location of the International Pane

Switch to the “Input Menu” tab and make sure the “Character Palette” and “Keyboard Viewer” items are checked, and that “Show input menu in menu bar” at the bottom is checked also:

Input Menu settings in the International pane

If you are interested in practicing typing in other languages, you can check them as options too (switching to their input methods using this menu will also change the system spell checker to work with that language), but be sure at least your most common language is checked (I think it will be already checked for you).

Once you do this, a new menu will appear:

The Input Menu in action

In this menu you can switch languages, and also open the two palettes that will help you type special characters. The Keyboard Viewer is a nice way of teaching yourself what symbols you can get with the ⌥ key. It shows a picture of your keyboard, and as you hold down modifier keys, updates to show what symbols you get by pressing that key. Here I am showing it with the ⌥ key held down:

Keyboard Viewer Palette

The “dead keys” which produce combining symbols (e.g. the accents for letters I started this discussion with) are shown in orange. Note how you can get an ümlaut and circumflex (“î”) which I did not discuss above. Now you can figure those out, and remind yourself of them, whenever you need to.

Beyond the keyboard

The Character Palette is for when you need even less common symbols. Unicode has tens of thousands of characters in it, and not all of them fit on the keyboard, even with modifiers like ⌥, so sometimes you need another way to get them. This window lets you explore the whole Unicode space, find interesting symbols (like the keyboard modifiers I have been using in this email), and then insert them into your document by double-clicking them, or using the “Insert” button at the bottom:

The Character Palette

If you find, as I have, that there are some symbols you use often, you can make them “favorites” using the little gear menu at the bottom left, and then access them easily using the Favorites tab. You can also search for symbols by their description or code using the search bar. This has become a very powerful tool, but seems intimidating at first because of the vast number of symbols available. I’d encourage you to just play with it for a while, learn about the different views and organizations of the symbol space it offers, and how to use it effectively.

OK, that was probably more than you wanted to know, but hopefully you will find it useful! Go forth and type beautifully.

WordPress Themes