How to make 'appendix' appear in toc in Latex?

前端 未结 5 1332
别那么骄傲
别那么骄傲 2021-02-07 03:26

How to make word \'appendix\' appear in the table of contents? Right now toc looks like this:

1 ......
2 ......
.
.
A .....

5条回答
  •  忘掉有多难
    2021-02-07 04:21

    Based on @Will Robertson's answer, the code below defines the same thing but for chapter and also fixes the fact that chapter* does not add to the header when using the fancyhdr package.

    With this in the preable all issues are resolved.

    \makeatletter
    \newcommand\appendix@chapter[1]{%
        \refstepcounter{chapter}%
        \def\app@ct{Appendix \@Alph\c@chapter: #1}
        \orig@chapter*{\app@ct}%
        \markboth{\MakeUppercase{\app@ct}}{\MakeUppercase{\app@ct}}
        \addcontentsline{toc}{chapter}{\app@ct}%
    }
    \let\orig@chapter\chapter
    \g@addto@macro\appendix{\let\chapter\appendix@chapter}
    \makeatother
    

提交回复
热议问题