Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When writing LaTeX documents in Emacs, it usually automatically replaces quotation marks " by `` or '', as it should. But sometimes, it incorrectly replaces by "` and "' instead. I am observing this in Emacs 23.4 supplied as version 23.4+1-4ubuntu1 in Ubuntu 13.04.

It happens in the below example:

\documentclass[danish]{article}
\usepackage{babel}
\begin{document}
This is a "`test"'.
\end{document}

My guess is that babel and the language option danish is causing this together with AUCTeX. If I change it to english and reset AUCTeX, the problem disappears. If I change it back to danish and reset AUCTeX it re-appears. How can I fix this?

share|improve this question
3  
That's gonna be a hard one if you can't pin down the elusive "sometimes". –  terdon Jun 25 '13 at 13:03
    
Which languages are you loading with babel package? –  giordano Jun 28 '13 at 17:17
    
@giordano I will get back to you on this as soon as I encounter a document again that causes this. –  Thomas Arildsen Jul 2 '13 at 11:11
    
@ThomasArildsen another question: do you use AUCTeX or default Emacs TeX mode? –  giordano Jul 2 '13 at 11:14
    
@giordano I am using AUCTeX. –  Thomas Arildsen Jul 2 '13 at 11:31

1 Answer 1

up vote 2 down vote accepted

AUCTeX has a special support for many languages, for example it can help inserting quotes. For more information see the AUCTeX manual.

If you don't like the default style of quotes inserted by AUCTeX for a specific language, you can override it customizing the TeX-quote-language-alist variable. To do that add this to your .emacs:

(setq TeX-quote-language-alist '(("danish" "``" "''" t)))

In this way pressing " button twice you will get `` or '' according to context. Instead, if you want to insert `` and '' pressing " button just once, add the following code to your .emacs:

(add-hook 'TeX-language-dk-hook
      (lambda ()
        (setq TeX-quote-language `("danish" "``" "''" ,TeX-quote-after-quote))))
share|improve this answer
    
I am in doubt what the official correct Danish quote marks are, but they are certainly not "` and "'. I will have to figure that out. –  Thomas Arildsen Jul 2 '13 at 12:58
    
I'm not a danish speaker, I can't help you in this regard. Change the variable according to your need, I just showed you how to do that ;-) –  giordano Jul 2 '13 at 13:00
    
Which looks exactly like what I need. Testing the above, I see that your command causes the quote marks to become ". Is that intended? I was guessing that it would cause them to become `` and '', but I am quite lisp-illiterate... BTW, I am a native Dane, so I guess I should know the correct marks :o) –  Thomas Arildsen Jul 2 '13 at 13:03
1  
Press " twice. –  giordano Jul 2 '13 at 13:04
1  
@ThomasArildsen I expanded the answer, there is a solution to get opening and closing quotes pressing " once. –  giordano Jul 2 '13 at 13:09

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.