Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert regular double quotes in LaTeX mode with AUCTeX

How do I rebind the double quote key to simply insert a double quote in a LaTeX buffer with AUCTex enabled?

I tried redefining TeX open and close quote, but that didn't seem to work.

(add-hook 'LaTeX-mode-hook
          '(progn
             (setq-default TeX-close-quote "\"")
             (setq-default tex-close-quote "\"")
             (setq-default TeX-open-quote "\"")
             (setq-default tex-open-quote "\"")
             (setq-default TeX-quote-after-quote t)))

Update

The above code and the accepted answer would have worked, except that I have smartparens enabled. Smartparens helpfully redefines the quote key to insert LaTeX quotes. The code to use normal quotes is below:

(eval-after-load 'latex
  '(progn
     (require 'smartparens-latex)
     ;; removes the double quote trigger binding. Now smartparens will 
     ;; insert a regular double quote
     (sp-local-pair 'latex-mode "``" "''" :trigger "\"" :actions :rem)))
like image 295
Joe Avatar asked Jul 19 '14 00:07

Joe


People also ask

How do you declare a double quote in a string?

To place quotation marks in a string in your code In Visual Basic, insert two quotation marks in a row as an embedded quotation mark. In Visual C# and Visual C++, insert the escape sequence \" as an embedded quotation mark.

How can you include a double quote character into a literal string?

The basic double-quoted string is a series of characters surrounded by double quotes. If you need to use the double quote inside the string, you can use the backslash character. Notice how the backslash in the second line is used to escape the double quote characters.

How do you add double quotes in LaTeX?

Single quotation marks are produced in LaTeX using ` and ' . Double quotation marks are produced by typing `` and '' . (The `undirected double quote character " produces double right quotation marks: it should never be used where left quotation marks are required.)

How do you insert a double quote?

Double quotation marks on WindowsPress-and-hold the ALT key and then type 0147 for the opening single quotation mark and ALT followed by 0148 for the closing single quotation mark.


1 Answers

You can unset the auctex binding as:

(defun my-hook ()
  (local-unset-key "\""))
(add-hook 'LaTeX-mode-hook 'my-hook)

Alternately, if you want to use the smart quotes most of the time but occasionally insert a literal double quote, just do C-q ".

like image 152
Dan Avatar answered Oct 01 '22 04:10

Dan