0

I'm writing a document in Russian using \babel, and everything in the body of the document seems to work fine. However, when I try to make a Cyrillic title using \maketitle, I get errors saying that Russian hasn't been defined, as the title info is placed before the packages are loaded in the preamble.

I'm a bit of a novice so I tried just moving the title info around below \usepackage{babel}. This doesn't work either. Is there some way around this? (I'm also open to manually creating a reasonable facsimile of the \maketitle environment, within the document body just by centring some large text the way \maketitle does, but I don't know how to do this either.)

Here's an example

\title{\begin{otherlanguage*}{russian}
Текст на русском языке
\end{otherlanguage*}}


\documentclass{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian,english]{babel}


\begin{document}

\maketitle

\begin{otherlanguage*}{russian}
Текст на русском языке
\end{otherlanguage*}


\end{document}

The title complies, but as nonsense.

3
  • Could you had a minimal working example reproducing your problem for us to help you?
    – Ludovic C.
    Oct 6, 2013 at 20:13
  • It seems to me that if you place the title definition just after the usepackage command and before the begin{document}, it works... The \documentclass command has to be the first line of your code.
    – Ludovic C.
    Oct 6, 2013 at 20:23
  • If the document is in Russian, why don't you simply drop the english option and forget the otherlanguage* environment? If you have some English, just exchange the two options, so that Russian becomes the main language.
    – egreg
    Oct 6, 2013 at 22:24

1 Answer 1

3

You define your \title before you load babel and other packages. No surprise it does not work.

Just move \title after invoking the classes:

\documentclass{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian,english]{babel}

\title{\begin{otherlanguage*}{russian}
Текст на русском языке
\end{otherlanguage*}}  

\begin{document}

\maketitle

\begin{otherlanguage*}{russian}
Текст на русском языке
\end{otherlanguage*}


\end{document}

Also, declarations \selectlanguage{russian} and \selectlanguage{english} may be more convenient for longer documents than otherlanguage* environments.

1
  • Thank you! I did not know the title could go anywhere else but a the very top. Oct 6, 2013 at 20:34

You must log in to answer this question.

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