如果我arabic
像下面这样注释掉 polyglossia 选项,则不会出现错误。否则,如果我想要目录,文档甚至不会编译。
\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
类ycbook
或mwbk
不受bidi
包支持。发生的情况是bidi
重新定义一些tocloft
宏,但当您加载时,该宏mwbk
的重新定义会因该宏的重新定义而丢失。因此,显然,解决方案是在文件加载后重新定义。\l@chapter
mwbk
\l@chapter
tocloft
bidi
\l@chapter
titletoc-xetex-bidi.def
\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}