quote, backtick and TeX engines that handle unicode fonts

I really dislike TeX’s way of adding quotes: `quote' becomes ‘quote’ while ``double quote'' becomes “double quote”. These quotes look funny in a text editor. Entering proper Unicode quotes is easy (in vim, use digraphs '6 and '9 for single quotes and "6 and "9 for double quotes). Even if you want to use Unicode files, at the very least, these quotes can be hidden behind macros. ConTeXt uses \quote and \quotation (which provides language dependent quotes and adapts to nesting). I am sure that there are LaTeX packages that provide the same functionality. It may take a few more keystrokes to enter, but I think that Unicode input or macros is the correct way to deal with special characters, rather than ad-hoc abbreviations (Yes, I do not like TeX’s way of doing accented letters also.)

A bigger problem with these intelligent quotes is that they are also applied when not needed — in source code listings. I have seen this in many books and tutorials. Nothing shouts TeX louder than a wrong quote in source listings. Consider, for example, a simple ruby program that uses

str = 'ab\tc'

TeX (plain TeX, LaTeX, and ConTeXt MkII) will typeset this as

Quotes in MkII

TeX is being too smart. From what I have been told, the problem is with the font files. As a user, I expect the macro package to take care of such things. But, by default, both LaTeX and ConTeXt MkII show the wrong quotes, as in the above image. ConTeXt MkIV, however, does the right thing, giving
Quotes in MkIV

I am guessing that this is because ConTeXt MkIV assumes everything is Unicode, and does not enable texquotes feature for the font used for code listings. XeLatex also does the right thing. If you use a Unicode font, it does not enable texquotes. (I do not really know how to enable texquotes in XeLaTeX. I guess it should be possible to enable these features for serif and sans fonts, but not for the mono font.) So, even to users like me who primarily use TeX for English documents, an engine that works with Unicode fonts is useful.

Advertisements

3 thoughts on “quote, backtick and TeX engines that handle unicode fonts

  1. I can warmly recommend the package csquotes which deals with exactly that Problem. In short, you can either use the command \enquote{} or define a pair of characters using \MakeAutoQuote{}{} which will be replaced with the right quotes upon compiling. Nesting is possible and automagically taken care of. There is also a lot quotation styles and babel support to satisfy international needs. For example I use \MakeAutoQuote{«}{»} in the preamble and write «foo» throughout the document, which get typeset as „foo“.

  2. Just a quick note: LaTeX users should probably consider the csquotes package to get a similar effect to the ConTeXt \quote and \quotation macros.

  3. Pingback: BigSmoke » VIM tips for editing prose

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s