如何在目录中使用附录标签代替章节标签

如何在目录中使用附录标签代替章节标签
\documentclass{report}
\usepackage[pagestyles, outermarks, newparttoc]{titlesec}
\usepackage[title]{appendix}
\usepackage{tocloft}
\newlength\mylength
\renewcommand\cftchappresnum{\chaptername~}
\renewcommand\cftchapaftersnum{}
\settowidth\mylength{\cftchappresnum\cftchapaftersnum\quad}
\addtolength\cftchapnumwidth{\mylength}
%\renewcommand\chaptername{Appendix}
\renewcommand{\appendixname}{Appendix}

\begin{document}
    \tableofcontents
    \chapter{Appendix testing}   
    \begin{appendices}
        \chapter{Theory}
        \section{subappendix}
        \chapter{Theory}
        \section{subappendix}
    \end{appendices}
\end{document}

在此处输入图片描述

答案1

尝试对你的 MWE 进行这个小修改(对此表示感谢)。

% apptocnameprob.tex  SE 589128

\documentclass{report}
\usepackage[pagestyles, outermarks, newparttoc]{titlesec}
\usepackage[title]{appendix}
\usepackage{tocloft}
\newlength\mylength
\renewcommand\cftchappresnum{\chaptername~}
\renewcommand\cftchapaftersnum{}
\settowidth\mylength{\cftchappresnum\cftchapaftersnum\quad}
\addtolength\cftchapnumwidth{\mylength}
%\renewcommand\chaptername{Appendix}
\renewcommand{\appendixname}{Appendix}

\begin{document}
    \tableofcontents
    \chapter{Appendix testing}   
    \begin{appendices}
%% At this point in the ToC change Chapter to Appendix
\addtocontents{toc}{%
  \protect\renewcommand{\protect\chaptername}{Appendix}}
        \chapter{Theory}
        \section{subappendix}
        \chapter{Theory}
        \section{subappendix}
    \end{appendices}
\end{document}

在此处输入图片描述

相关内容