15

Is it possible to setup AUCTeX so that it loads the spelling dictionary in the same language as the language used by babel? For example, is it possible to load the Danish ispell dictionary when a document includes \usepackage[danish]{babel}?

N.N.
  • 36,163

2 Answers2

14

This can be done by using language specific hooks in AUCTeX. To automatically load the Danish ispell dictionary when a document includes \usepackage[danish]{babel} put the following in your .emacs:

(add-hook 'TeX-language-dk-hook
      (lambda () (ispell-change-dictionary "danish")))
giordano
  • 8,486
N.N.
  • 36,163
  • 4
    Now that was fast! ;-) – lockstep Jan 02 '12 at 10:11
  • @lockstep I have been looking for such an option and when I found it in the manual I thought it would make sense to document it here for others to find and benefit from. – N.N. Jan 02 '12 at 10:12
  • 1
    What about Polyglossia? – egreg Jan 02 '12 at 14:13
  • @egreg That is a good question. I did a quick search without finding anything. Perhaps it should be asked as a new question? – N.N. Jan 02 '12 at 14:17
  • @egreg I asked a new question about the polyglossia case: http://tex.stackexchange.com/questions/39842/how-can-i-make-auctex-use-the-spelling-dictionary-in-the-same-language-as-polygl – N.N. Jan 02 '12 at 14:58
1

Based on this answer, you can also specify a local variable inside the .tex file :

%%% Local Variables:
%%% ispell-local-dictionary: "danish"
%%% End:
Lalylulelo
  • 121
  • 4