我的目录目前如下所示:
但我想将附录和附件更改为在字母和名称之前显示附录和附件字样。
我的代码如下:
\include{chapter4}
\include{chapter5}
%%\include{cenas}
\PrintBib{myrefs}
%% comment next 2 commands if numbered appendices are not used
\appendix
\include{appendix1}
%%\include{appendix2}
\include{appendix3}
\renewcommand{\appendixname}{Annex}
\setcounter{chapter}{0}
\include{annex1}
后来,我做了这个:
\usepackage{tocloft,calc}
\renewcommand{\cftchappresnum}{\chaptername\space}
\setlength{\cftchapnumwidth}{\widthof{\textbf{Appendix~999~}}}
\makeatletter
\g@addto@macro\appendix{%
\addtocontents{toc}{%
\protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}%
}%
}
\renewcommand{\cftchappresnum}{\chaptername\space}
\setlength{\cftchapnumwidth}{\widthof{\textbf{Annex~999~}}}
\makeatletter
\g@addto@macro\annex{%
\addtocontents{toc}{%
\protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}%
}%
}
但它在附件和附录中都作为附录出现
答案1
也许以下内容有所帮助(不幸的是,问题中没有最小的工作示例):
\documentclass{report}
\usepackage{tocloft}
\usepackage{calc}
\renewcommand{\cftchappresnum}{\chaptername\space}
\setlength{\cftchapnumwidth}{\widthof{\textbf{Appendix~999~}}}
\makeatletter
\g@addto@macro\appendix{%
\addtocontents{toc}{%
\protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}%
}%
}
\newcommand*\annex{%
\renewcommand{\appendixname}{Annex}%
\setcounter{chapter}{0}
\addtocontents{toc}{%
\protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}%
}%
}
\usepackage{blindtext}% only for dummy text
\begin{document}
\tableofcontents
\blinddocument\blinddocument
\appendix
\chapter{First Chapter in Appendix}
\chapter{Second Chapter in Appendix}
\annex
\chapter{First Chapter in Annex}
\end{document}
结果: