Smile for the Camera: a new cybercrime short story ebook.

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:

You can then switch between the named languages either using the declaration:


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:

\iflanguage{<language>}{<true text>}{<false text>}


% french is the last named option, so that's the current language


Ce texte est en fran\c{c}ais. La date aujourd'hui est: \today.

This text is in US English. Today's date is: \today.

This text is in UK English. Today's date is: \today.


Image showing typeset output (click here for a more detailed description).


If you are using the french option, the colon character (:) is made active (that is, it's turned into a special character) so if you are writing in French it's best not to use a colon in labels (so where I've used, say, ch:def you may need to change the colon to something else).

This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).

© 2012 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs