附录中字母开头的名称在 ToC 中没有变化

附录中字母开头的名称在 ToC 中没有变化

平均能量损失

\documentclass{book}
\usepackage{lipsum}
\usepackage{titletoc}
\usepackage{appendix}

\renewcommand{\chaptername}{\textit{Division}}
\renewcommand{\appendixname}{\textit{Addition}}

\titlecontents{chapter}% <section-type>
  [0pt]% <left>
  {\addvspace{1em}}% <above-code>
  {\bfseries\chaptername\ \thecontentslabel\quad}% <numbered-entry-format>
  {}% <numberless-entry-format>
  {\bfseries\hfill\contentspage}% <filler-page-format>

% Does not work VVVVV
\titlecontents{appendix}% <section-type>
  [0pt]% <left>
  {\addvspace{1em}}% <above-code>
  {\bfseries\appendixname\ \thecontentslabel\quad}% <numbered-entry-format>
  {}% <numberless-entry-format>
  {\bfseries\hfill\contentspage}% <filler-page-format>
  % Does not work ΛΛΛΛΛ

\begin{document}

\tableofcontents

\chapter{Thesis Statement}\lipsum[1-5]
\chapter{Introduction}\lipsum[1-5]
\chapter{Another chapter}\lipsum[1-5]

\begin{appendices}
\chapter{Final chapter}\lipsum[1-5]
\end{appendices}
\end{document}

我在下面添加了一张图片,我想要的是分配来写添加

在此处输入图片描述

相关:https://tex.stackexchange.com/a/414239/33075

答案1

您可以修补appendices环境以更改目录中附录条目的章节前缀。

一种可能性是:

\documentclass{book}
\usepackage{lipsum}
\usepackage{titletoc}
\usepackage{appendix}

\renewcommand{\chaptername}{\textit{Division}}
\renewcommand{\appendixname}{\textit{Addition}}

\titlecontents{chapter}
  [0pt]
  {\addvspace{1em}}
  {\bfseries\chapapp\ \thecontentslabel\quad}% <- changed
  {}% <numberless-entry-format>
  {\bfseries\hfill\contentspage}

\newcommand*\chapapp{\chaptername}% <- added

\usepackage{etoolbox}% <- added
\AtBeginEnvironment{appendices}
  {\addtocontents{toc}{\protect\def\protect\chapapp{\protect\appendixname}}}% <- added
\AtEndEnvironment{appendices}
  {\addtocontents{toc}{\protect\def\protect\chapapp{\protect\chaptername}}}% <- added

\begin{document}
\tableofcontents
\chapter{Thesis Statement}\lipsum[1-5]
\chapter{Introduction}\lipsum[1-5]
\chapter{Another chapter}\lipsum[1-5]
\begin{appendices}
\chapter{Final chapter}\lipsum[1-5]
\end{appendices}
\end{document}

结果:

在此处输入图片描述

相关内容