Home General LaTeX tips and tricks → Multiple languages [Previous Page] [Question index] [Next Page]

8. How can you use multiple languages in the same document?


Answer

Use the babel package by Johannes Braams.

The Delft University of Technology requires/allows some of the frontmatter and backmatter of a PhD thesis to be in Dutch (summary, curriculum, etc.). If you do not use Babel's \selectlanguage{foo} to notify LaTeX when a language change takes place, you are guaranteed to end up with hyphenation problems.


Example usage

In the preamble:


\usepackage[dutch,british]{babel}

In the manuscript:


\chapter{Samenvatting}

\selectlanguage{dutch}

\subsection*{Regelgebaseerde Compilatie van Data-parallelle Programma's}

Er zijn problemen die te groot of te complex zijn om door een
conventioneel uni-processor systeem opgelost te worden binnen een
redelijke tijdsduur.

...


\selectlanguage{british}


Things to watch out for

To begin with: don't forget to switch back again to your default language after you are done with an alternate language.

Furthermore, make sure that you have a LaTeX that is actually configured to load the Dutch (or Koozebanian, or whatever) hyphenation patterns, otherwise you may not end up with proper hyphenation after all. You might expect Babel/LaTeX to loudly complain if this happens, but rather to my surprise it only makes mention of this in a rather roundabout way, and it took me ages before I actually noticed it when this particular problem happened to me.

The best way of checking is to examine the Babel startup string that occurs at the very beginning of the LaTeX output when processing a file:


This is TeXk, Version 3.14159 (Web2C 7.4.5)
 Source specials enabled.
LaTeX2e <2001/06/01>
Babel <v3.7h> and hyphenation patterns for american, british, french, 
german, ngerman, dutch, nohyphenation, loaded.

If the language you want is not listed, you can \selectlanguage all you like, but it will do you no good.

Turning on the desired hyphenation files involves updating the file language.dat deep in the bowels of the TeX installation (/etc/texmf/language.dat on my system), and running texconfig init as root afterwards.

The newer teTeX and TeX Live versions under Debian, thankfully, automate this process, and will allow you to reconfigure language support simply by saying dpkg-reconfigure tetex-bin. So, as another word of warning, in those circumstances you do not want to start manually fiddling with TeX's system files...


[Previous page] [Question index] [Next page]

Leo Breebaart (leo@lspace.org)
Last updated: 27 June 2016