Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm working with Aquamacs 2.3a to compile .tex documents. Typing double quotes " one time leads to ``. Then writing a word and finishing with " again, expands to ``myword''. How can I have autopair to directly give me ``'' when typing " once?

I used autopair before to pair "$" in .tex documents, but I couldn't get this to work for the above problem:

(add-hook 'TeX-mode-hook
    (lambda ()
        (modify-syntax-entry ?$ "\"")
    )
)
share|improve this question

migrated from stackoverflow.com Sep 29 '11 at 10:52

This question came from our site for professional and enthusiast programmers.

1 Answer 1

This is not trivial. The double-quote behaviour you currently have doesn't come from autopair but tex-mode.

You can advise it to get the specific behavior you want:

(defadvice tex-insert-quote (after maybe-pair activate compile)
  (when (equal "``" (buffer-substring-no-properties (- (point) 2) (point)))
    (save-excursion
      (insert tex-close-quote))))

However, you won't get the paired deleting or skipping. Just inserting.

share|improve this answer
    
I put it in Preferences.el and restarted Aquamacs. Unfortunately, typing double-quotes still gives me `` (bevor the word) and '' (after the word) and not ``'' right away. But I see, it's a non-trivial problem. Thanks a lot anyways. –  Marius Hofert Sep 28 '11 at 7:47
    
It worked for me. I meant getting comprehensive autopair functionality is not trivial. Insertion is not too bad. This would only insert paired quotes when point is after a space. –  event_jr Sep 28 '11 at 8:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.