Skip to main content
To set the document language and switch between languages in LaTeX, load \usepackage[french, ngerman, english]{babel} (the last option—or one marked main=—becomes the main language) and switch with \selectlanguage, otherlanguage, otherlanguage*, or \foreignlanguage. If you compile with XeLaTeX or LuaLaTeX, you can use either babel with fontspec or polyglossia (\setdefaultlanguage, \setotherlanguage). For single-language setup (accents, scripts, quotation marks, and font choices for one language), see the Languages guides.
babel-main-language.tex
Ready to use this syntax? Continue in the browser editor when you want to adapt the example in a real project.Open LaTeX Cloud Studio

Step 1: Set the main language and load secondary languages in babel

Pass every language your document uses as options to babel. The last listed language becomes the active main language—for example, \usepackage[french, ngerman, english]{babel} makes English the main language. To pick the main language explicitly regardless of order, pass main=: \usepackage[main=ngerman, english, french]{babel}. When compiling European Latin scripts with pdfLaTeX, load \usepackage[T1]{fontenc} so accented characters hyphenate properly and copy cleanly from the PDF. Current LaTeX defaults to UTF-8 input, so \usepackage[utf8]{inputenc} is no longer needed. Use ngerman rather than german for modern German spelling and hyphenation.

Step 2: Switch languages for sections, paragraphs, or phrases

babel provides four switching mechanisms depending on whether captions (such as Abstract, Figure, Contents) and \today should change alongside hyphenation and language extras: Use otherlanguage when a whole section, abstract, or appendix belongs to another language. Use otherlanguage* for a block quote in another language inside a document whose captions and dates should stay in the main language, and \foreignlanguage for short inline words or phrases.
babel-switching.tex

Step 3: Verify hyphenation per language

TeX applies the hyphenation patterns of the active language when breaking lines. Wrap multi-line foreign passages in otherlanguage or otherlanguage* (ending with a paragraph break inside the environment) so the paragraph uses the right language’s hyphenation table. You can also declare custom break points for the currently active language with \hyphenation{Sil-ben-tren-nung}.
babel-hyphenation.tex

Step 4: Choose between polyglossia and babel on XeLaTeX or LuaLaTeX

For Unicode fonts, non-Latin scripts, or right-to-left text, switch your engine from pdfLaTeX to XeLaTeX or LuaLaTeX (see Choosing a compiler). Two packages handle multilingual setup on those engines:
  • polyglossia: designed exclusively for XeLaTeX and LuaLaTeX because it loads fontspec internally. Compiling a polyglossia document with pdfLaTeX fails with ! Fatal Package fontspec Error: The fontspec package requires either XeTeX or LuaTeX. Declare languages with \setdefaultlanguage{...} and \setotherlanguage{...} (or \setotherlanguages{...}), then switch with named environments (\begin{german}...\end{german}) and inline commands (\textfrench{...}).
  • babel: works across pdfLaTeX, XeLaTeX, and LuaLaTeX. Under XeLaTeX or LuaLaTeX, you can pair babel with \usepackage{fontspec} or \babelfont (and \babelprovide for languages without legacy .ldf files) while keeping the same \selectlanguage / otherlanguage / \foreignlanguage commands.
The compiled XeLaTeX example below uses polyglossia with DejaVu Serif (preinstalled in TeX Live 2026) to mix English, German, and French in one document:
polyglossia.tex

Step 5: Language-specific setup guides

For fonts, quotation marks, accents, and script-specific packages for an individual language, go to its dedicated guide: Ready to test multilingual switching in the browser? Start from the Basic Article template in LaTeX Cloud Studio and replace main.tex with any complete example above (select XeLaTeX or LuaLaTeX in compiler settings for the polyglossia example).