0

I want to remove the letter at the beginning of the appendix chapter. I use a .cls style formatting file. My code produces the following table of contents:

enter image description here

I would like to get:

enter image description here

my .cls code is:

\def\appendix{%  
\setcounter{chapter}{0}%  
\renewcommand{\thechapter}{\Alph{chapter}}%  
\renewcommand{\chaptername}{\appendixname}}  

How can I change the code to get the result I want?

1
  • 4
    Welcome to TeX.SE. Your fragment of code is not really useful. We need more information on the class and a minimal document that is compilable and has this issue
    – user31729
    Aug 28, 2017 at 21:03

1 Answer 1

2

Let us assume that you are using book class. It has the following definition:

\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect\numberline{\thechapter}#1}%
                       \else
                         \addcontentsline{toc}{chapter}{#1}%
                       \fi
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}

Let the macro \appendix redefine it, adding to the TOC just the chapter name, but not its number:

\documentclass{book}
\makeatletter
\def\appendix{%
  \def\@chapter[##1]##2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                       \fi
                       \addcontentsline{toc}{chapter}{##1}%
                    \else
                      \addcontentsline{toc}{chapter}{##1}%
                    \fi
                    \chaptermark{##1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{##2}]%
                    \else
                      \@makechapterhead{##2}%
                      \@afterheading
                    \fi}%
  \setcounter{chapter}{0}%
  \renewcommand{\thechapter}{\Alph{chapter}}%  
  \renewcommand{\chaptername}{\appendixname}}  
\makeatother
\begin{document}
\tableofcontents

\chapter{First}
\section{second}

\appendix
\chapter{Appendix}
\section{Aaaa}

\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .