5.8 Multi-Lingual Support: using the
babel package
You may have noticed that the \tableofcontents
and
\chapter
commands have produced English words like
“Contents” and “Chapter”[How to change LaTeX's “fixed
names”]. If you are writing in another language, this is not
appropriate. In this case, you can use the babel package,
and specify which language you will be using, either as an option to
the babel package, or as an option to the class file[Using
a new language with Babel]. If you are writing in more than
one language, list all the languages that you will be using where
the last named language is the default language[Parallel
setting of text]. For example:
or the otherlanguage environment:
These will affect all translations, including the date format and predefined names like “Chapter”. This also changes the hyphenation patterns.
If you only want to set a short section of text in a different language, without affecting the date format or predefined names, then you can either use the command:
or the starred version of the otherlanguage environment:
You can test to see if a given language is currently selected using:
Example:
\documentclass
[UKenglish,USenglish,french]{scrartcl}
% french is the last named option, so that's the current language
\usepackage
[T1]{fontenc}
\usepackage
[utf8]{inputenc}
\usepackage
{babel}
\begin
{document}
Ce texte est en fran
\c
{c}ais. La date aujourd'hui est: \today
.
\selectlanguage
{USenglish}
This text is in US English. Today's date is:
\today
.
\selectlanguage
{UKenglish}
This text is in UK English. Today's date is:
\today
.
\end
{document}
Result:
Note:
This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).