How to define two ispell dictionaries in Emacs for LaTeX mode?
Asked Answered
C

3

5

I have a document with many quotations in a second language. How can I define this second language to Ispell? I have this in file top:

%% Local IspellDict: brasileiro

I tried this, but it didn't work:

%% Local IspellDict: brasileiro, english
Cinchonism answered 6/7, 2012 at 11:47 Comment(0)
H
5

I have a way to toggle between two languages:

;; You should have aspell-ru and aspell-en packages installed
(let ((langs '("english" "russian")))
  (setq lang-ring (make-ring (length langs)))
  (dolist (elem langs) (ring-insert lang-ring elem)))
(defun cycle-ispell-languages ()
  (interactive)
  (let ((lang (ring-ref lang-ring -1)))
    (ring-insert lang-ring lang)
    (ispell-change-dictionary lang)))

(global-set-key (kbd "C-1") 'cycle-ispell-languages)
Handmedown answered 7/7, 2012 at 10:27 Comment(1)
I appreciate your code. It's a good tip, but I'd like to automate this. I wouldn't like to switch between languages every time I write a quotation.Cinchonism
J
1

Marcos, I found this:

http://www.emacswiki.org/emacs/AutoLangMode

http://www.emacswiki.org/emacs/GuessLang

I guess that first one do what you need.

Jillianjillie answered 7/7, 2012 at 17:2 Comment(1)
I tried AutoLangMode, with english, portuguese and french. It works properly with english, but not with the others. Otherwise is a good suggestion.Cinchonism
T
0

Please, try swL-mode from http://www.emacswiki.org/emacs/TN/#toc13 . It works with flyspell. The dictionary for the text at the current point position is chosen. You should adapt swL-alist to your needs. The language identifier strings (such as \selectlanguage{...}) must start at the beginning of line.

Meanwhile I also discovered flyspell-babel.el on the following page:

https://tex.stackexchange.com/questions/40988/how-can-i-make-auctex-spell-check-in-the-language-specified-by-babel-and-csquote

I think it is more user-friendly (packaged). It does not use just-in-time formatting (jit-lock-mode) and text properties therefore there might be some performance problems. But maybe, it is no problem and I was just too precautious.

Turnspit answered 10/10, 2013 at 14:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.