I'm trying to apply this awesome template. I'm using XeTeX and russian -- and it gives:
! Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.5 ...ter}{Предисловие}{i}{chapter*.1}
Here's MWE:
\RequirePackage[l2tabu,orthodox]{nag} % checks for some discouraged practice
\documentclass[a5paper, oneside]{book}
\usepackage{xltxtra}
% Customizing the page:
\usepackage[top=1.2cm, bottom=1.8cm, left=1.5cm, right=1.7cm]{geometry} % required by MISiS PH
% XeTeX technologies:
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{xecyr}
% fonts:
\setmainfont[Mapping=tex-text]{Arial}
\setsansfont{Arial}
\setromanfont{Arial}
\setmonofont{DejaVu Sans Mono}
% Russian:
\newfontfamily\cyrillicfont{Arial}
\setmainlanguage{russian}
\setdefaultlanguage{russian}
\setotherlanguage{english}
% ToC:
\usepackage{titletoc}
\usepackage{tocloft}
\usepackage[nottoc]{tocbibind}
\usepackage{afterpage}
% Change the name of the ToC
\AtBeginDocument{%
\renewcommand\contentsname{Table of Contents}}
% Headings for every page of ToC, LoF and Lot
\newcommand\tocheading{\par\bigskip\MakeUppercase{\chaptername}\hfill Page\par}
\newcommand\lofheading{\par\bigskip\figurename\hfill Page\par}
\newcommand\lotheading{\par\bigskip\MakeUppercase{\tablename}\hfill Page\par}
% Centering titles for the ToC, Lof and Lot
\renewcommand{\cfttoctitlefont}{\hfill\normalfont\MakeUppercase}
\renewcommand{\cftaftertoctitle}{\hfill}
\renewcommand{\cftloftitlefont}{\hfill\normalfont\MakeUppercase}
\renewcommand{\cftafterloftitle}{\hfill}
\renewcommand{\cftlottitlefont}{\hfill\normalfont\MakeUppercase}
\renewcommand{\cftafterlottitle}{\hfill}
% Chapter entries formatting for frontmatter chapters
\newcommand\frontmatterchaptoc{%
\titlecontents{chapter}
[1.5em]{\addvspace{\baselineskip}}
{\contentslabel{1.5em}\MakeUppercase}
{\hspace*{-1.5em}\MakeUppercase}
{\titlerule*[1pc]{.}\contentspage}
}
% Chapter entries formatting for mainmatter chapters
\newcommand\mainmatterchaptoc{%
\titlecontents{chapter}
[5em]{\addvspace{\baselineskip}}
{\contentslabel{3em}\hspace*{-1em}\MakeUppercase}
{\MakeUppercase}
{\titlerule*[1pc]{.}\contentspage}
}
% Section, subsection, table and figure entries formatting
\titlecontents{section}
[7em]{}{\hspace{-1em}}{}{\titlerule*[1pc]{.}\contentspage}
\titlecontents{subsection}
[7.5em]{}{\hspace{-1em}}{}{\titlerule*[1pc]{.}\contentspage}
\titlecontents{figure}
[5em]{}
{\contentslabel{3em}\hspace*{-1em}}{}
{\titlerule*[1pc]{.}\contentspage}
\titlecontents{table}
[5em]{}
{\contentslabel{3em}\hspace*{-1em}}{}
{\titlerule*[1pc]{.}\contentspage}
% figures:
\usepackage{graphicx}
% colors:
\usepackage[usenames,dvipsnames]{xcolor}
% hyperref:
\usepackage{hyperref}
\hypersetup{
xetex,
pdftitle={Электронная теория металлов: задачи с решениями},
pdfauthor={Boris Kheyfets},
pdfcreator={XeLaTeX},
breaklinks,
backref,
colorlinks,
CJKbookmarks=true,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black,
}
% hyperref links to table/figures issue:
\usepackage[hypcap]{caption}
% better looking tables with `\toprule`,`\midrule`,`\bottomrule`:
\usepackage{booktabs}
\begin{document}
\frontmatter
\frontmatterchaptoc % activation of chapter entries formatting in the frontmatter
\chapter{Предисловие}
\cleardoublepage
\tableofcontents
\cleardoublepage
\addtocontents{lof}{\lofheading}% add heading to the first page in LoF
\listoffigures
\cleardoublepage
\addtocontents{lot}{\lotheading}% add heading to the first page in LoT
\listoftables
\cleardoublepage
\mainmatter
\addtocontents{toc}{\tocheading}% add heading to the first page in ToC, after frontmatter entries
\mainmatterchaptoc% activation of chapter entries formatting in the mainmatter
\chapter{Introduction}
\section{Section One One}
\begin{figure}
\centering
A
\caption{Test figure one}
\label{fig:test}
\end{figure}
\chapter{Policy divergence and traditional research}
\section{Section Two One}
\begin{figure}
\centering
A
\caption{William Adolphe Bouguereau, \emph{Youth of Bacchus} (initial sketch), 1884}
\label{fig:wab}
\end{figure}
\subsection{Section Two One One}
\end{document}
I found that if I comment hyperref -- it works. Also if I remove some advanced stuff from ToC -- it also works.
\MakeUppercase-- but have titles be hyperlinks -- which\MakeUppercaseshould I remove? You said "inside\protected@edef" -- but I don't understand where it is. – Adobe Nov 29 '12 at 14:30