This is a bug that has been hidden for a couple of decades.
Both the Spanish and Russian modules for babel
want to define “local” math operators, because of tradition.
In the past, with your setup, the Spanish definitions would silently override the Russian ones, but recently russianb.ldf
replaced
\def\tg{\mathop{\operator@font tg}\nolimits}
with
\AtBeginDocument{%
\@ifpackageloaded{amsopn}
{%
[...]
\DeclareMathOperator{\tg}{tg}%
[...]
}{%
[...]
\DeclareRobustCommand\tg{\mathop{\operator@font tg}\nolimits}%
[...]
}
which would be a good thing (contrary to what the module for Spanish does, ignoring whether amsmath
is loaded or not), provided no other language module defines \tg
. Unfortunately, spanish.ldf
does.
While Spanish offers a (not really friendly) way to disable the “language local” operators, Russian doesn't.1
In my opinion both should bind the definitions in \extras<language>
: it would be quite strange to get “lím” in a Russian part of the document, for instance.
Is there a way out? I can see none for general bilingual typesetting. But if you just need russian
for typesetting some words in Russian (names, for instance), you can avoid loading all of russian.ldf
and just ask for basic support.
\documentclass{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[main=spanish]{babel}
\babelprovide{russian}
\usepackage{amsmath}
\begin{document}
\tableofcontents
\section{Una sección}
En cirílico \foreignlanguage{russian}{Лев Семёнович Понтр\'{я}гин},
y en alfabeto occidental Lev Semënovi\v{c} Pontrâgin.
\end{document}

An interim workaround if you're tied to Debian based TeX Live:
\documentclass{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[main=spanish]{babel}
\babelprovide{russian}
\usepackage{amsmath}
\newcommand{\rus}[1]{{%
\fontencoding{T2A}\selectfont\foreignlanguage{russian}{#1}%
}}
\begin{document}
\tableofcontents
\section{Una sección}
En cirílico \rus{Лев Семёнович Понтр\'{я}гин},
y en alfabeto occidental Lev Semënovi\v{c} Pontrâgin.
\end{document}
Footnote.
1 In order to disable the Spanish style operators one can do
\makeatletter\let\es@operators\relax\makeatother
but this isn't helpful in the case at hand, because it removes everything about Spanish style math operators. If the document had Russian as main language, this would work, but the converse fails and there's no real way to make Russian and Spanish style operators to coexist in one and the same document. Currently no way to make a bilingual document, actually.
chemformula
with a few language modules that define\ch
for the hyperbolic cosine and offer no way to prevent this.russian
from the options tobabel
and add\babelprovide{russian}
. By the way, the accent overg
is wrong.