你要这样定义也折腾定义半天,找宏包更好解决,这个宏包 tocvsec2
可以随处定义加入目录的级别,下面的代码自己测试下:
\documentclass[a4paper,12pt,titlepage,oneside,final]{book}
\usepackage[english]{babel}
\usepackage{tocvsec2}
\begin{document}
\tableofcontents
\appendix
\settocdepth{part}
\chapter{Name of appendix A}
\section{Name of the first section}
\section{Name of the second section}
\chapter{Name of appendix B}
\section{Name of the first section}
\section{Name of the second section}
\end{document}