7

I'm translating some documents from MS Word (written by someone else) to TeX for my own uses. There are quotation marks all over the place, some of which are "weird" (e.g., unicode character 201c “ as opposed to ASCII 34 "). What is the best way to replace all of these with matching `` '' pairs?

I'd prefer a solution using VIM but if there are other methods I'll accept them

keflavich
  • 4,613
  • Why do you want to replace them? 201c is an ordinary left double quotation mark which should appear as intended in your output file, given you use a unicode input. – Marco Aug 06 '12 at 17:12
  • Personally, I prefer Unicode quotes to the horrible TeX quote syntax. Modern TeX engines (xetex and luatex) handle unicode just fine. I am more familiar with ConTeXt. In ConTeXt MkIV (luatex engine), unicode quotes work out of the box; In ConTeXt MkII (pdftex and xetex engine), unicode quotes work once you add \enableregime[utf-8]. I am sure similar options exist for LaTeX (most likely using the inputenc package). – Aditya Aug 06 '12 at 17:12
  • I'm using pdflatex. Nothing at all shows up where the unicode characters are. Am I doing something wrong? Or alternatively, can someone answer with how to use inputenc or related as per @Aditya 's comment? EDIT: http://tex.stackexchange.com/questions/13067/utf8x-vs-utf8-inputenc has the solution – keflavich Aug 06 '12 at 17:20
  • Corollary: Now that everyone has convinced me not to replace 201c, what's the easiest way to insert one? – keflavich Aug 06 '12 at 17:38
  • 1
    Alright, google wins this round: answer to corollary (on a mac): Alt-{ and Shift-Alt-{ – keflavich Aug 06 '12 at 17:45
  • 1
    This totally depends on your operating system, keyboard layout and configuration. On a Debian system <RightAlt-B produces and <RightAlt-N yields by default, but this already fails on an Ubuntu system. – Marco Aug 06 '12 at 17:45
  • On vim, you can use <CTRL-K>+"6 and $+"9` for unicode quotes. – Aditya Aug 06 '12 at 23:58

1 Answers1

6

I would not change them. They are much more readable than the “traditional” TeX syntax. If you use unicode input they should work in your document. If you really want to:

%s/“/``"/g

This line changes “ to ``" in the entire document. Use a similar mapping for ”:

%s/”/<whatever>/g
Marco
  • 26,055
  • That's straightforward enough. In order to use the unicode, I needed to add \usepackage[utf8]{inputenc} to my document. – keflavich Aug 06 '12 at 17:23