# How to make appendix and hyperref packages work together with cyrillic (non ASCII) characters?

I have a LaTeX document with hyperref and appendix packages that fails to build. But if I switch off either appendix or hyperref everything works fine.

\documentclass[14pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english,russian]{babel}
\usepackage[toc,page,title,titletoc]{appendix}
\usepackage{hyperref}
\begin{document}

\renewcommand{\appendixtocname}{Приложения}
\renewcommand{\appendixpagename}{Приложения}
\renewcommand{\appendixname}{Приложениe}

\tableofcontents
\pagebreak
\section{тест}

\begin{appendices}

\renewcommand{\thesection}{\arabic{section}.}

\section{Тест}
\pagebreak
\section{Схема устройства}

\end{appendices}

\end{document}


Generated error:

./test.out
! Undefined control sequence.
<argument> \T
2A\CYRP \T 2A\cyrr \T 2A\cyri \T 2A\cyrl \T 2A\cyro \T 2A\cyrz...


Is there any possibility to use them together?

-

## migrated from stackoverflow.comJan 19 '12 at 20:22

This question came from our site for professional and enthusiast programmers.

Quite hard problem. The guilty party is appendix that does some definitions that become incompatible with the way Russian is managed by Babel.

\documentclass[12pt]{article}

\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}
\usepackage[toc,page,title,titletoc]{appendix}
\usepackage{hyperref,bookmark}
\hypersetup{
citecolor=blue,
filecolor=blue,
urlcolor=blue,
% pdftitle=,
% pdfauthor=,
% pdfsubject=,
% pdfkeywords=
}

\renewcommand{\appendixtocname}{Приложения}
\renewcommand{\appendixpagename}{Приложения}
\renewcommand{\appendixname}{Приложние}
\makeatletter
\let\oriAlph\Alph
\let\orialph\alph
\renewcommand{\@resets@pp}{\par
\@ppsavesec
\stepcounter{@pps}
\setcounter{section}{0}%
\if@chapter@pp
\setcounter{chapter}{0}%
\renewcommand\@chapapp{\appendixname}%
\renewcommand\thechapter{\@Alph\c@chapter}%
\else
\setcounter{subsection}{0}%
\renewcommand\thesection{\@Alph\c@section}%
\fi
\if@pphyper
\if@chapter@pp
\renewcommand{\theHchapter}{\theH@pps.\oriAlph{chapter}}%
\else
\renewcommand{\theHsection}{\theH@pps.\oriAlph{section}}%
\fi
\def\Hy@chapapp{appendix}%
\fi
\restoreapp
}
\makeatother

\begin{document}

\tableofcontents
\pagebreak
\section{тест}

\begin{appendices}

\renewcommand{\thesection}{\arabic{section}.}

\section{Тест}
\pagebreak
\section{Схема устройства}

\end{appendices}

\end{document}


Note that it's better to load fontenc before inputenc.

-
Why is it better to load fontenc before inputenc? (Apologies if if this has already been answered elsewhere.) –  lockstep Jan 19 '12 at 21:54
The utf8 option for inputenc analyzes the loaded output encodings and takes appropriate actions. –  egreg Jan 19 '12 at 22:03