# section titles, cyrillic and hyperref

I need to use cyrillic. I hacked from somewhere the def of \textcyrw you see below. Everything works fine, but when I need to use \textcyrw within a section title. It seems that the culprit is hyperref. Your advise is welcome.

\documentclass[a4paper,10pt]{article}
\usepackage[OT2,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american,russian,italian]{babel}
\usepackage{hyperref} % no problem without hyperref

\newcommand\cyrillic{%
\renewcommand\rmdefault{wncyr}%
\renewcommand\sfdefault{wncyss}%
\renewcommand\encodingdefault{OT2}%
\normalfont
\selectfont}
\DeclareTextFontCommand{\textcyr}{\cyrillic}

\begin{document}
\section{AAA}
\textcyr{Личное дело} % works fine
\section{\textcyr{Личное дело}} % gives error
\end{document}


The error message I got is:

! Argument of \@sect has an extra }.
<inserted text>
\par
l.- \section{\textcyr{Личное дело}}


----- fixed

the following fixed it, although I am not sure why:

\pdfstringdefDisableCommands{%
\let\textcyr\relax}


OT2 is really an outdated way to produce Cyrillic text. Since you seem to be able to input Russian text directly, it's better to use T2A:

\documentclass[a4paper,10pt]{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american,russian,italian]{babel}
\usepackage{hyperref} % no problem without hyperref

\DeclareRobustCommand{\textcyr}[1]{\foreignlanguage{russian}{#1}}

\begin{document}
\section{AAA}
\textcyr{Личное дело} % works fine
\section{\textcyr{Личное дело}} % gives error
\end{document}


• I have a little problem. When I use this code I get i.imgur.com/3ER3Gtp.png. Problem is that lines are not smooth enough like in your example. How to fix it? I use pdflatex, because with LuaLatex or XeLatex I only get: "1 AAA 2" and nothing else. Thanks in advance – Cortizol Nov 12 '13 at 16:17
• @Cortizol You probably don't have installed the CM-Super font package; it's common among MiKTeX users. What TeX distribution are you using? – egreg Nov 12 '13 at 16:18
• I use basic-miktex-2.9.4813. – Cortizol Nov 12 '13 at 16:22
• @Cortizol Install the CM-Super package: miktex.org/packages/cm-super – egreg Nov 12 '13 at 16:28
• I installed it from here (because I didn't see download button in your link): ctan.org/tex-archive/fonts/ps-type1/cm-super. I copied from pfb file in C:\Program Files\MiKTeX 2.9\fonts\type1\public\cm-super, like they said in Install.tex file, but when I run program I can't see any difference. But that is probably because I don't know to install package properly. – Cortizol Nov 12 '13 at 16:52