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

前端 未结 5 1238
别那么骄傲
别那么骄傲 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:16

    The appendix package is really good and simple solution. My answer can be helpful for who wants to change chapters numbering style, for example, with using cyrillic alphabet or roman digits. The appendices numbering style is hardcoded in the \@resets@pp command (I looked in sources here http://hal.in2p3.fr/docs/00/31/90/21/TEX/appendix.sty). I solved it by simple redefining this command to my own. Just add this code into your preamble:

    \makeatletter
    
        \renewcommand{\@resets@pp}{\par
            \@ppsavesec
            \stepcounter{@pps}
            \setcounter{section}{0}
    
            \if@chapter@pp
                \setcounter{chapter}{0}
                \renewcommand\@chapapp{\appendixname}
                \gdef\thechapter{\Asbuk{chapter}} % changed
            \else
                \setcounter{subsection}{0}
                \gdef\thechapter{\Asbuk{section}} % changed
            \fi
    
            \if@pphyper
                \if@chapter@pp
                    \renewcommand{\theHchapter}{\theH@pps.\Asbuk{chapter}} % changed
                \else
                    \renewcommand{\theHsection}{\theH@pps.\Asbuk{section}} % changed
                \fi
    
                \def\Hy@chapapp{\appendixname}%
            \fi
        \restoreapp
    }
    
    \makeatother
    

    As a result,

    Appendix A
    Appendix B
    Appendix C
    ...
    

    will change to

    Appendix A
    Appendix Б
    Appendix В
    ... etc
    

    I'm not a latex expert, and I can't guarantee this code won't break something else.

提交回复
热议问题