1

If I comment the arabic polyglossia option as below, there is no error. Otherwise, the document won't even compile if I want a Table of Contents.

\documentclass[twocolumn,twoside,titleauthor]{ycbook}
\usepackage{fontspec,polyglossia}

%weird toc problem in twoside mode in mwbk
\makeatletter
\renewcommand*\chapter@toc{%
    \ifHeadingNumbered\typeout{\@chapapp\space\thechapter.}\fi
    \addcontentsline{toc}{chapter}{%
        \ifHeadingNumbered
        \mw@seccntformat{\@chapapp\ \thechapter}%
        \fi
        \HeadingTOCText}}%

\makeatother


\setmainlanguage{english}
%\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Amiri}


\begin{document}

\tableofcontents

\chapter{Test}

\end{document}
1

The class ycbook or mwbk is not supported by the bidi package. What happens is that bidi redefines some tocloft macros but when you load mwbk, the redefinition of \l@chapter that mwbk does gets lost by the redefinition of \l@chapter of tocloft that bidi does. So clearly, the solution is to redefine \l@chapter after the file titletoc-xetex-bidi.def is loaded.

\documentclass[twocolumn,twoside,titleauthor]{ycbook}
\usepackage{fontspec,polyglossia}

%weird toc problem in twoside mode in mwbk
\makeatletter
\renewcommand*\chapter@toc{%
    \ifHeadingNumbered\typeout{\@chapapp\space\thechapter.}\fi
    \addcontentsline{toc}{chapter}{%
        \ifHeadingNumbered
        \mw@seccntformat{\@chapapp\ \thechapter}%
        \fi
        \HeadingTOCText}}%

\renewcommand*\l@chapter[2]{\addvspace{.3\baselineskip}%
        \mw@tocline{0}{\@tocindent}{\@tocindenti}{\textbf{#1}}{#2}%
        \addvspace{.2\baselineskip}}
\makeatother


\setmainlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Amiri}


\begin{document}

\tableofcontents

\chapter{Test}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.