# Change Language in \usepackage[<language>]{babel}?

I've been trying to change the language of my LaTeX document by replacing \usepackage[swedish]{babel} with \usepackage[english]{babel} but I only get this message:

! Package babel Error: You haven't loaded the option swedish yet.


I've read in an other question at this forum that compiling enough would solve the problem, but that doesn't work for me. Does anyone know what I should do?

-
When you change languages you also need to delete your .aux file. Try that and recompile and the error should disappear. –  Alan Munn Aug 8 '13 at 14:09
In addition to Alans comment, that comment you have read that it is enough to recompile, depends on how which options the editor passes to latex. –  daleif Aug 8 '13 at 14:13
It is sufficient if you just compile once again. The inappropriate .aux has been overwritten with the first compiler run and will now be read correctly. –  Thorsten Donig Aug 8 '13 at 14:47
I'm not seeing this as a dupe: this is very focussed on a specific issue, and is a pretty common problem. In particular, it's not caused by an error in the auxiliary files. –  Joseph Wright Aug 8 '13 at 15:49
Please, close voters, this is not really a duplicate, even though the answer is contained in the linked question. The supposed duplicate is much more general. I've linked to it in my answer, but I think we should leave this question open. –  Alan Munn Aug 8 '13 at 16:40

This is a very common error with babel, and is solved by removing the .aux file whenever you change languages.

When you use babel it writes information to the .aux file that refer specifically to the language you have chosen. In your case, for example, when you select swedish as the babel language it does two things: (i) it loads a set of macros related to Swedish and (ii) it (minimally) writes the following to the .aux file.

\select@language{swedish}
\@writefile{toc}{\select@language{swedish}}
\@writefile{lof}{\select@language{swedish}}
\@writefile{lot}{\select@language{swedish}}


The command \select@language{swedish} tells TeX to use the specific macros defined for Swedish.

The .aux file is used for storing information that will be reused on the next compilation. See

babel writes to the .aux file because it changes the names of things like the table of contents and list of figures according to the chosen language.
Now, when you change the language without deleting the .aux file, and compile your file, TeX reads in the .aux file and encounters the \select@language command. But since you have changed the language, the macros for Swedish haven't been loaded, and you get the error you received.
The babel package is not the only package that can sometimes require you to delete the .aux file. See the following more general question for information about them: