10

I'm creating a paper using the class file supplied by the journal (mais.cls). The journal is Russian, so it has Russian title, Russian page titles etc.

I have a .tex file containing only Latin characters that compiles without errors. When I add a single (English) word to the end of the text (increasing the number of lines, but not the number of pages) I suddenly receive many errors like this during the compilation.

! LaTeX Error: Command \CYRE unavailable in encoding OT1.

The problem seems to be related to the page header on the even pages (excluding the title page). The page header is in Russian and is defined in the class style file. Somehow latex stops loving it depending on the number of lines on the page.

I'm using the latest version of MikTeX 2.9 (and the problem was also manifesting itself in older version). The encodings are set like this:

 \usepackage[cp1251]{inputenc}
 \usepackage[english,russian]{babel}
 \usepackage[T2A]{fontenc}

Why does this happen? Is the problem in the style of in latex? How to prevent the errors?

I've uploaded the MWE (working/not working examples and the class style) with all logs and the resulting .pdf files to https://skydrive.live.com/redir?resid=E4ECA4072D08CEE5!2645 (archive: https://skydrive.live.com/redir?resid=E4ECA4072D08CEE5!2646)

lockstep
  • 250,273
Ark-kun
  • 201

2 Answers2

8

Eventually changing \usepackage[english,russian]{babel} to \usepackage[english,main=russian]{babel} fixes the problem.

I've found another solution, but since I can't post a new answer, I decided that I'll suggest it here. Replace \usepackage[T1]{fontenc} with \usepackage[T2A]{fontenc}

Orisphera
  • 3
  • 2
Wormer
  • 251
5

easiest fix is to ensure the cyrillic strings in the class file use T2A encoding rather than OT1

\def\mybibname{\fontencoding{T2A}\selectfont
\CYRL\cyri\cyrt\cyre\cyrr\cyra\cyrt\cyru\cyrr\cyra}
\def\myshortname{%%%
\fontencoding{T2A}\selectfont
  \CYRM\cyro\cyrd\cyre\cyrl.
  \cyri{}
  \cyra\cyrn\cyra\cyrl\cyri\cyrz{}
  \cyri\cyrn\cyrf\cyro\cyrr\cyrm.
  \cyrs\cyri\cyrs\cyrt\cyre\cyrm.{}
}
\def\mylongname{%%%
\fontencoding{T2A}\selectfont
  \CYRM\cyro\cyrd\cyre\cyrl\cyri\cyrr\cyro\cyrv\cyra\cyrn\cyri\cyre{}
  \cyri{}
  \cyra\cyrn\cyra\cyrl\cyri\cyrz{}
  \cyri\cyrn\cyrf\cyro\cyrr\cyrm\cyra\cyrc\cyri\cyro\cyrn\cyrn\cyrery\cyrh{}
  \cyrs\cyri\cyrs\cyrt\cyre\cyrm{}
}
\def\myrecname{\fontencoding{T2A}\selectfont
\cyrp\cyro\cyrl\cyru\cyrch\cyre\cyrn\cyra}
\def\myvolname{\fontencoding{T2A}\selectfont
\CYRT.}
\def\myUDCname{\fontencoding{T2A}\selectfont
\CYRU\CYRD\CYRK}
David Carlisle
  • 757,742
  • 3
    This certainly fixes the problem. I'd still like to know why. Why is this required in one situation, but not in a very similar one. Do you think I can be said to be caused by a bug in latex or is this somehow "by design"? – Ark-kun Dec 09 '12 at 01:11