Emacs, Unicode, and single quotes

Volume 14, Issue 47; 19 Nov 2011

At the intersection of typographic style and technology: proper curly quotes.

I switched to using Unicode “natively” for editing years ago. (The descendant of the Unicode suppport mentioned on that essay is now in a github repository.) This means that I can get proper, typographic quotation marks, dashes, etc. easily and directly.

Tim’s post about “Better Quotes” yesterday inspired me to reexamine why I don't use a proper single quote in contractions (why I use “don't” instead of “don’t”).

The answer is “because a proper single quote looks so awful in Emacs”. At least on my system.

The fact that the single quotes look fine in TextEdit pretty much convinces me that this is some sort of encoding problem. Either the Monaco font (and other fonts) have the wrong glyphs at U+2018 and U+2019 or when Emacs tries to find a glyph to substitute for them, it chooses poorly. I suspect the latter because you can see that the spacing gets messed up in the Monaco and Inconsolata samples in Emacs.

The DejaVuSansMono font, I'm guessing, has glyphs for the single quotes and so they come out correctly. Unfortunately, I'm not all that fond of DejaVuSansMono. But I'm going to try it for a while and see if I can get used to it. If I do, I'll start putting proper single quotes in my contractions.

I don't think this problem is unique to my system in any way. I tried Emacs 23 and one of the 24 pre-tests with none of my normal ~/.emacs processing and saw the same problems.

If you know of a solution (a few minutes of searching didn't reaveal anything), please do let me know.


Indeed, lsquo is not the correct glyph in that context. U+0027 is technically correct, and it's not a quotation mark at all, formally speaking.

It's interesting nonetheless to see how different apps handle the context. Thanks for the sample images!

—Posted by sharon on 19 Nov 2011 @ 01:01 UTC #

Also--sorry not to have noticed this in time for the first comment and thus to leave a second one, but it's not U+0218 and 0219, rather 2018 and 2019. :P

—Posted by sharon on 19 Nov 2011 @ 01:05 UTC #

Good catch, 2018/2019 now fixed. Thanks!

—Posted by Norman Walsh on 19 Nov 2011 @ 02:55 UTC #

It must be something about Emacs. In gedit (on RHEL 6.2) it looks kind of OK (at least to me) in 11pt and blown up to 36pt or so.

—Posted by Matěj Cepl on 05 Dec 2011 @ 12:40 UTC #