26

I need to use Russian in my article, but the default language has to be English. How do I do this?

I use:

\usepackage[russian]{babel}

Result: all chapter names and date are in Russian.

Change to:

\usepackage[russian,english]{babel}

Result is the same.

Change to:

\usepackage[russian,ukrainian,english]{babel}

Result: all chapter names and dates are in Ukrainian.

It looks like english is ignored. How to fix this?

Here the code which doesn't work:

\documentclass[a4paper,11pt,english]{article}

\usepackage[cp1251]{inputenc}

\usepackage[russian,ukrainian,english]{babel}

\begin{document}

\title{A}

\maketitle

\end{document}
3
  • Can you provide an MWE? I was quite convinced that the last specified language should be the default.
    – jmc
    Commented Apr 3, 2012 at 19:39
  • It's working if I delete ,english from the first line, but then I can't use russian...
    – klm123
    Commented Apr 3, 2012 at 19:57
  • You can't use russian with \selectlanguage etc? That would be a bug in my eyes.
    – jmc
    Commented Apr 3, 2012 at 20:02

4 Answers 4

24

The problem is in the english option in \documentclass. Let's see what happens:

  1. english is a global option, so that it's passed to every package
  2. the list of local options to babel is russian, ukrainian, english.

So babel gets first the global option english and loads the language file english.ldf; then it loads russian.ldf and ukrainian.ldf but does nothing with english, because it has already read that option.

Consequence: the last loaded language is Ukrainian.

Remedies: don't put language options in \documentclass if you plan to load babel with multiple languages, or specify all languages, in the desired order, as options to \documentclass.

2
  • 8
    With newer version of babel, one can specify main=<language> in the options to babel, so to establish <language> as the main document one independently of its position.
    – egreg
    Commented Nov 1, 2016 at 15:14
  • Thank you for this response. The assignment via document was the problem for me as well. Infuriating. Commented Nov 28, 2019 at 12:24
22

To be a bit more explicit, after my comments above. According to the Wikibooks on LaTeX and babel, you can:


"If you call babel with multiple languages:

\usepackage[languageA,languageB]{babel}

then the last language in the option list will be active (i.e. languageB), and you can use the command

\selectlanguage{languageA}

to change the active language. You can also add short pieces of text in another language using the command

\foreignlanguage{languageB}{Text in another language}

Babel also offers various environments for entering larger pieces of text in another language:

\begin{otherlanguage}{languageB}
  Text in language B. This environment switches all language-related 
  definitions, like the language 
  specific names for figures, tables etc. to the other language.
\end{otherlanguage}

The starred version of this environment typesets the main text according to the rules of the other language, but keeps the language specific string for ancillary things like figures, in the main language of the document. The environment hyphenrules switches only the hyphenation patterns used; it can also be used to disallow hyphenation by using the language name 'nohyphenation'.

The babel manual provides much more information on these and many other options."


So far my citation and answer.

1

I had the same problem and the answers here have put me on the right track (it was not clear for me at first read). So I will try to clarify for other users.

By testing I have found out that:

  • the order of the languages in \usepackage[russian,ukrainian,english]{babel} is not important if you use \selectlanguage{} afterwards.

  • when you want to use Russian write \selectlanguage{russian}, after this everything that is generated will be in Russian (e.g. "Contents" will be "Содержание"). When you are ready with your Russian Text, write \selectlanguage{english} and everything afterwards will be in English

I hope that I was also of some help.

1

You can also give all the language options to the document class. This will pass them to any other packages you load, if they support Russian or Ukrainian.

\documentclass[a4paper,11pt,russian,ukrainian,english]{article}
\usepackage{iftex}

\iftutex
  \usepackage{babel}
  \babelfont{rm}[Ligatures=Common]{CMU Serif}
  \babelfont{sf}[Ligatures=Common]{CMU Sans Serif}
  \babelfont{tt}{CMU Typewriter Text}
\else
  \usepackage[T2A,T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{babel}
\fi

\babeltags{english=english}
\babeltags{ukrainian=ukrainian}
\babeltags{russian=russian}

\begin{document}

\title{In \languagename, \textukrainian{\languagename} and
       \textrussian{\languagename}}

\maketitle

\end{document}

Title-casing the \languagename is trickier than it looks, as the macro is not fully-expandable.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .