If you are publishing text for people to read and you want it to look even halfway professional, you absolutely must use real actual left and right quotation marks: “quotes” not "quotes". Also right-single apostrophe: as in don’t use “don't”. [Update: Please go check the comments, which are opinionated and full of useful alternatives. I’ll report back after further investigation.]

In the Emacs setup I use for writing this, I reprogrammed some keys years and years ago to do the right thing. But when I’m typing stuff into Google+ or Twitter or whatever, it’s just me and the Mac keyboard. By default you can get with option-[, with option-shift-[, and with option-shift-].

Which I find awkward as hell, and not remotely intuitive. So I went and got KeyRemap4MacBook, which can map pretty well anything to pretty well anything. It comes with a huge number of precooked mappings, none of which seemed to do what I want. So I read the excellent documentation and you can cook up your own mappings by just editing a little bit of XML.

The following XML maps option-S to (think single quote), option-D to (think double quote), and option-F to (it’s to the right of option-D). I’m not 100% sure yet if I like these mappings, but I’ll keep poking around and I’m sure I can find something better than the dorky defaults. This is a step forward; is there a better way to upgrade the Mac keyboard to encourage some entry-level good typography?

<root>
  <item>
    <name>Smart Quotes</name>
    <identifier>private.smartquotes</identifier>
    <autogen>--KeyToKey--
    KeyCode::S, ModifierFlag::OPTION_L,
    KeyCode::BRACKET_RIGHT, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L
    </autogen>
    <autogen>--KeyToKey--
    KeyCode::D, ModifierFlag::OPTION_L,
    KeyCode::BRACKET_LEFT, ModifierFlag::OPTION_L
    </autogen>
    <autogen>--KeyToKey--
    KeyCode::F, ModifierFlag::OPTION_L,
    KeyCode::BRACKET_LEFT, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L
    </autogen>
    <autogen>--KeyToKey--
    KeyCode::S, ModifierFlag::OPTION_R,
    KeyCode::BRACKET_RIGHT, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L
    </autogen>
    <autogen>--KeyToKey--
    KeyCode::D, ModifierFlag::OPTION_R,
    KeyCode::BRACKET_LEFT, ModifierFlag::OPTION_L
    </autogen>
    <autogen>--KeyToKey--
    KeyCode::F, ModifierFlag::OPTION_R,
    KeyCode::BRACKET_LEFT, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L
    </autogen>
  </item>
</root>


Contributions

Comment feed for ongoing:Comments feed

From: Simon Wright (Nov 17 2011, at 04:20)

Neat. I haven't found the need to do this, but if I did I might prefer something like option-quote for ‘, command-quote for ’, option-shift-quote for “, command-shift-quote for ”.

[link]

From: Simon Boyle (Nov 17 2011, at 05:06)

Which keyboard do you have?

On the international english mac keyboard the [,{ and ],} keys are immediately above the '," key, so smart quotes are move your finger up a row, and to the left for open quote, or to the right for close quote. Shift-ed on each key for double quotes.

Which is slightly easier to guess than the locations of # ( option-3, since shift-3 is £, and Americans call the hash-key the pound-key) or … ( option-: )

[link]

From: Dave Pawson (Nov 17 2011, at 05:57)

I'm more interested in your emacs mapping Tim? Would you share that please?

Dave

[link]

From: Warren (Nov 17 2011, at 06:04)

Context click in text field. Check "smart quotes" from substitution sub-menu. Done.

[link]

From: DP Henderson (Nov 17 2011, at 06:08)

Just curious, if you're using Lion (maybe Snow Leopard too), are you aware that you can use the Substitutions command available in standard text views to automatically change from straight to curly quotes? The behavior can be controlled on a per application basis.

[link]

From: William (Nov 17 2011, at 06:37)

The only problem with your system is that there is an awful lot of ASCII-centric programming out there that barfs on your better quotes. For example, the ACM Queue which republishes your blog posts doesn't handle this at all well, leaving block-shaped placeholder characters instead of whatever you intend.

[link]

From: Joe Clark (Nov 17 2011, at 07:10)

Unnecessary on a good day. We’ve been touch-typing the sequences you deem inconvenient since 1984.

Tell me: Under your system, how do you type « or Ç or ñ?

[link]

From: steve (Nov 17 2011, at 09:31)

the U.S. keyboard is like the International English keyboard and i'm with Simon Boyle, the default configuration is pretty intuitive if you let the mnemonic sink in; it became second nature for me over twenty years ago doing publishing work on a Mac Plus and has remained consistent since then

[link]

From: Smokey Ardisson (Nov 17 2011, at 09:50)

Installing a kernel extension to change the mapping of user-mappable keys seems like overkill to me.

What you really want (besides the Substitutions thing some have mentioned) is a keyboard layout editor. My favorite is SIL’s excellent Ukelele: http://scripts.sil.org/ukelele However, there are several other options, including this online option: http://wordherd.com/keyboards/ In the former case you can just tweak the default English-variant keyboard layout and call it “English (tbray)” or something.

Note also that .keylayout files are XML, so you can pop one open in emacs and fiddle with it there, too ;-)

[link]

From: Tim (Nov 17 2011, at 15:09)

Actually, Simon, it’s not like that at all for me. Both left and right double quote are on [, left and right single quote on ]. Feaugh.

[link]

From: Gerrit Imsieke (Nov 17 2011, at 16:41)

I’m using the lightweight Windows tool http://www.fileformat.info/tool/unicodeinput/ for entering hex codes of the desired Unicode glyphs. I do use some chars frequently and I know their codes: U+2013 (en dash), English quotes (U+201C…U+201D), German quotes (U+201E…U+201C), multiplication sign (U+D7), horizontal ellipsis (U+2026), zero-width space (U+200B), apostrophe (U+2019), right arrow (U+2192). When I’m using a PC, only very rarely do I replace proper Unicode quotes, arrows, etc with their mundane equivalents. I just wish that my Android phone had an input method “Unicode by Hex Code.”

[link]

From: Peter Seibel (Nov 17 2011, at 20:32)

You may find this bit of elisp I use for writing prose amusing or possibly even useful:

https://raw.github.com/gigamonkey/nanowrimo-elisp/master/smart-quote.el

[link]

From: Teemu (Nov 17 2011, at 22:35)

And of course this all applies only to English. See

http://en.wikipedia.org/wiki/Non-English_usage_of_quotation_marks

for the global practices.

Tuning your .emacs is left as an exercise for the reader.

[link]

From: David Carlisle (Nov 18 2011, at 02:07)

An alternative to remembering weird keybindings or hex codes or worrying if the post publication pipeline can cope with character encodings, is to use the named entity references such as ldquo and rdquo for &ldquo; and &rdquo; respectively.

[link]

From: Manuel Strehl (Nov 18 2011, at 03:24)

I’ve fallen in love with RFC 1345, “Character Mnemonics & Character Sets”, and its incarnation in Vim: Press Ctrl-K and the two-letter ASCII code, and presto! You’ve got your non-ASCII special character. Works great with lots of others, like “PI” for ¶ or “-M” for — (em dash).

It has the advantage of working in Vim regardless of the unerlying OS, and I’ve even coded up an accompanying Firefox extension, https://addons.mozilla.org/de/firefox/addon/digraphs/.

About the problem with post-processing, that William mentions: That is an issue of the tools. If they cannot handle their input correctly, they need to be fixed. As a german I’m quite strict with this one. For an asian, arabic, … it would be even more essential.

[link]

From: Norman Walsh (Nov 18 2011, at 03:46)

Ten or more years ago now, I tinkered with my emacs config so that I get proper curly double quotes, but I never went to the effort of doing it for the apostrophe in contractions. (Or maybe I did, but my font-of-the-day didn't have a very nice looking curly single quote so I abandoned it, I don't recall exactly. Time to try again, I suppose.)

In any event, I'm not sure I feel as strongly about it as you do. Using straight double quotes consistently doesn't make me question the professionalism of your writing. What does, however, is getting curly quotes in the wrong order. There must be something about PowerPoint that encourages this mistake because I feel like I see it there all the time.

More in the "pet peeve" than "doubt your professionalism" category (just barely) is the carelessness of letting curly quotes slip into code listings in your prose. This is another error that's encouraged by PowerPoint and probably other such tools.

[link]

From: Tkil (Nov 18 2011, at 09:08)

1. Shockingly enough, I think that Microsoft's "smart quote" capability is pretty good. It's hampered by the non-standard character encoding, but the idea is good: don't make the user worry about it.

2. A separation of semantics from presentation might be nice. Whenever possible, I try to use <q>...</q> instead of worrying about whatever the local quoting convention is. This kind of falls apart with contractions/possessives, though.

3. Then again, arguments over placement of other punctuation w.r.t. quotes become all the more fun, right?

[link]

From: Nathan (Nov 18 2011, at 10:41)

Am I the only one who finds the assertion in the opening paragraph ("absolutely must" included) to be non-normative to the point of being bizarre?

I would attribute my aversion to these typographic frivolities to being a long-time command-line geek, but considering the venue and the source there's obviously more going on than that.

My knee-jerk reaction is that those who would not take my writing seriously because I'm not using the proper typographical symbols for quotes and apostrophes are not the people I'm particularly interested in talking to anyway. If I'm publishing something it's a different story, but in that case I'll be using LaTeX and so long as I remember to type `` at the start of a quote and '' at the end, it will do the right thing for me.

Perhaps more people using the fancy-dancy quotes will ferret out more poorly-developed systems which cannot handle a &#8217; inline with readable text, but as far as I can tell that's the only remotely legitimate reason for preferring such window-dressing.

[link]

From: Douglas Davidson (Nov 18 2011, at 13:50)

Teemu, the Substitutions>Smart Quotes feature can be configured to use your favorite set of quotation marks. (System Preferences, Language & Text pane, Text tab)

[link]

From: Mike (Nov 18 2011, at 18:29)

I used to be a graphic designer and lettering designer, and I certainly agree with this in theory, in my current incarnation as a website maintainer, I have just given up and gone back to typewriter quotes.

At some point something in the process of website maintenance will break and render all your non-ASCII characters into mojibake. And if you have a decade of content, you simply won't be able to fix it all.

There are those who can probably avoid this and who can test everything to prevent it. There is probably some level of technical expertise and vigilance that will catch any mojibake. But I don't have it and don't want to learn it and don't want to pay money to hire someone who knows it.

When you run a website for a long time, eventually you upgrade the software or add on this or that, and in the process there will eventually somewhere be a software component, perhaps an ancient UNIX tool, that's called by another UNIX tool, that is called by a component of your blogging software, that will not handle Unicode correctly, and your special characters will be hosed.

At some date in the future, after I am dead and gone, all of this will have been solved, but I expect the problem to continue for the foreseeable future.

[link]

From: Carl (Nov 20 2011, at 00:36)

You don't need to use any third party software for this kind of key remapping. It's built into OS X. See http://www.hcs.harvard.edu/~jrus/site/cocoa-text.html for an explanation, but long story short create ~/Library/KeyBindings/DefaultKeyBinding.dict and put in a map from key you want to press to the key you want to show up.

[link]

From: John (Nov 20 2011, at 11:30)

These buttons are already on your keyboard. No need to define new commands or extra programs. They are option-[,] and option-shift-[,].

[link]

From: Jacek Kopecky (Nov 22 2011, at 15:32)

It seems to me, as a non-native speaker, that apostrophe is the right character for contractions. The Wikipedia article on apostrophe states this use. The article on quotation marks doesn't mention contraction.

But the Wikipedia article also uses the Unicode character for the single right quotation mark as the preferred rendering of the apostrophe. On my computer, the apostrophe normally renders straight or slanted, with a few fonts showing it nice and curly.

Maybe it's an evolved mis-shape of the character that makes people mis-use the quotation mark for contractions? As an avid contributor to Wikipedia, would you consider editing the articles to highlight this?

[link]

author · Dad · software · colophon · rights
picture of the day
November 17, 2011
· Technology (77 fragments)
· · Mac OS X (113 more)
· · Publishing (154 more)

By .

I am an employee
of Amazon.com, but
the opinions expressed here
are my own, and no other party
necessarily agrees with them.

A full disclosure of my
professional interests is
on the author page.