It is possible to make AUCTeX load the spelling dictionary of the language which babel
is loaded with. One further convenience would be for it to appropriately react to changes of language within a document. Such changes can be made with macros of babel
and csquotes
. So, is it possible to make AUCTeX spell check in the correct language according to the language macros of a document?
Here follows a test document. A solution would make AUCTeX automatically spell check the first paragraph in English and the other paragraphs should be spell checked according to the specified language.
\documentclass{article}
\usepackage[danish,english]{babel}
\usepackage{csquotes}
\begin{document}
In computing, a spell checker (or spell check) is an application
program that flags words in a document that may not be spelled
correctly.
\foreignquote{danish}{I computerterminologi er en stavekontrol en
design feature eller et software program designet til at tjekke
stavningen af ord i et dokument og som normalt kan komme med forslag
til stavningsforslag.}
\hyphenquote{danish}{I computerterminologi er en stavekontrol en
design feature eller et software program designet til at tjekke
stavningen af ord i et dokument og som normalt kan komme med forslag
til stavningsforslag.}
\foreignlanguage{danish}{I computerterminologi er en stavekontrol en
design feature eller et software program designet til at tjekke
stavningen af ord i et dokument og som normalt kan komme med forslag
til stavningsforslag.}
\begin{hyphenrules}{danish} I computerterminologi er en stavekontrol
en design feature eller et software program designet til at tjekke
stavningen af ord i et dokument og som normalt kan komme med forslag
til stavningsforslag.
\end{hyphenrules}
This sentence should be spell checked with an English dictionary.
\end{document}
Best Answer
Assuming you are using
flyspell
, yes it is possible!The package flyspell-babel.el should do exactly what you want: read inline language changes for babel, and start a
flyspell
process for that language.According to the documentation:
Therefore, you may have to make your other language change commands, such as
\foreignquote
, known toflyspell-babel
.This package requires the package
flyspell-multi.el
(no known link at the moment) orispell-multi.el
to start severalflyspell
processes at the same time, to avoid slowdowns when scrolling through a file with language changes.Installation instructions
Put the files
flyspell-babel.el
andflyspell-multi.el
somewhere in the load-path and add the following lines to your.emacs
:To add support for other commands, add the following lines to your
.emacs
:All credit goes to Peter Heslin, the author of these two packages.