Cirílico \maiúsculo em \addcontentsline

Cirílico \maiúsculo em \addcontentsline

Não consigo adicionar uma string maiúscula em cirílico ao índice do meu documento bilíngue. Aqui está um exemplo compilável:

\documentclass[a4paper,10pt]{extreport}
\usepackage[koi8-r]{inputenc}
\usepackage[english,russian]{babel}
\newif\ifeng
\def\rus{\selectlanguage{russian}\engfalse}
\def\eng{\selectlanguage{english}\engtrue}
\def\UpperCase#1{\ifeng\uppercase{#1}\else\lowercase{#1}\fi}
\def\section#1{\vspace{1cm plus 1cm minus .5cm}\goodbreak
    \noindent{\bf\large\UpperCase{#1}}%
    \ifeng\addcontentsline{entoc}{section}{\UpperCase{#1}}\else%
    \addcontentsline{rutoc}{section}{\UpperCase{#1}}\fi\par\nopagebreak
    }
\def\subsection#1{\goodbreak
    \noindent{\bf\large #1}%
    \ifeng\addcontentsline{entoc}{subsection}{#1}\else%
    \addcontentsline{rutoc}{subsection}{#1}\fi\par\nopagebreak}
\makeatletter
\renewcommand\tableofcontents{\pagebreak\selectlanguage{russian}
    \noindent{\bf\large СОДЕРЖАНИЕ}\@starttoc{rutoc}
    \vspace{2em}\selectlanguage{english}
    \noindent{\bf\large CONTENTS}\@starttoc{entoc}}
\makeatother
\begin{document}
\tableofcontents
\rus\section{Русский}
\subsection{Подсекция}
Текст
\eng\section{English}
\subsection{Subsection}
Text
\end{document}

(É estranho, mas para colocar letras maiúsculas em koi8-r preciso chamar macro \lowercasee vice-versa).

Mas no comando \rus\section{Русский}no arquivo \jobname.rutoceu vejo \contentsline {section}{\lowercase {\IeC {\CYRR }\IeC {\cyru }\IeC {\cyrs }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrish rt }}}{1}.

O que devo fazer para colocar letras maiúsculas no índice?

Responder1

Você deve usar \MakeUppercaseand not \uppercase, mas também deve carregar explicitamente fontenccom a T2Aopção:

\documentclass[a4paper,10pt]{extreport}
\usepackage[T2A]{fontenc}
\usepackage[koi8-r]{inputenc}
\usepackage[english,russian]{babel}
\newif\ifeng
\def\rus{\selectlanguage{russian}\engfalse}
\def\eng{\selectlanguage{english}\engtrue}
\def\section#1{\vspace{1cm plus 1cm minus .5cm}\goodbreak
    \noindent{\bf\large\MakeUppercase{#1}}%
    \ifeng\addcontentsline{entoc}{section}{\MakeUppercase{#1}}\else%
    \addcontentsline{rutoc}{section}{\MakeUppercase{#1}}\fi\par\nopagebreak
    }
\def\subsection#1{\goodbreak
    \noindent{\bf\large #1}%
    \ifeng\addcontentsline{entoc}{subsection}{#1}\else%
    \addcontentsline{rutoc}{subsection}{#1}\fi\par\nopagebreak}
\makeatletter
\renewcommand\tableofcontents{\pagebreak\selectlanguage{russian}
    \noindent{\bf\large СОДЕРЖАНИЕ}\@starttoc{rutoc}
    \vspace{2em}\selectlanguage{english}
    \noindent{\bf\large CONTENTS}\@starttoc{entoc}}
\makeatother
\begin{document}

\tableofcontents
\rus\section{Русский}
\subsection{Подсекция}
Текст
\eng\section{English}
\subsection{Subsection}
Text
\end{document}

insira a descrição da imagem aqui

informação relacionada