# How to Spell-Check LaTeX in multiple languages / language variants

I am writing a PhD Thesis / Dissertation and would like to be able to spell-check the thing. The problem is that I'm required to write it in UK English, while many of my quotations are written in US English. This makes spell-checking quite a pain.

Is there a way to tag sections of LaTeX text as being UK English / US English, and have a spell-checker either respond to that tagging or skip the sections which aren't in the particular language variant?

I've asked this over at http://stackoverflow.com/posts/4451944 but couldn't really get resolution as to the best way to do this.

Edit:

This is for a PhD thesis of between 70 and 100,000 words. Most sources are in U.S. English, while the thesis must be written in U.K. English. There are literally hundreds of quotations, so exporting them is probably not reasonable.

-
This is going to be editor-dependent, so we'll need to know which one you use. –  Joseph Wright Jun 6 '11 at 14:18
Sorry - I'm using TeXnic Center with the latest version of MikTeX. –  David T. Macknet Jun 6 '11 at 14:39
The problem you will have with a one-file solution is that LaTeX files are plain TeX, so the editor does not have anywhere to 'hide' the language relationships. You could mark sections up with some logical language mark up, but I'm not sure that TeXniccenter has context-dependent spell checking. –  Joseph Wright Jun 6 '11 at 15:06
That's what I was afraid of. I'd asked this question on StackOverflow before discovering tex.stackexchange, and had hoped that someone here would have a better answer. Oh, well. Thanks for considering the problem! –  David T. Macknet Jun 6 '11 at 18:13

One editor-independent approach would be to save the quotes into a separate file. You could do this in a single quotes.tex file, which might contain

\newcommand*\getquote[1]{\csname quote#1\endcsname}
\expandafter\def\csname quote1\endcsname
{%
}
\expandafter\def\csname quote2\endcsname
{%
}
...


You could then have \input{quotes} in your main preamble, and call quotes by doing \getquote{1}, etc. (I've defined the quotes with numbers as that seemed easiest, but you might want to give them names instead.)

Now, I don't know how long your quotes are, how many there are, and so on. So this approach might not be practical. However, it is hopefully a start.

-
I'm using the TeX \def primitive here as it makes life easier for creating the quote-containing macros. If you need to know about that, it will be a separate question! –  Joseph Wright Jun 6 '11 at 14:23
Thanks for that. Actually, this is for a PhD thesis, so figure around 85,000 words to be spell-checked, with 30,000 words dedicated to a literature review. Most sources are in US English, but the thesis is written in UK English. –  David T. Macknet Jun 6 '11 at 14:41

This is not exactly an answer to the question but may hopefully be useful.

In LyX you can mark any part of the text as written in a separate language and it will be spell checked accordingly. Particularly, it recognizes British and American English.

This is one of those things I like in LyX and miss in other TeX editors.

-