I wanna display A as Appendix A in TOC, as shown below.

I tried to add \backmatter before \appendix as shown in this post, but cref{label} will display as Section 1. I also used \renewcommand as suggested in the most posts on this site, but it doesn't make any changes. Here is the source code.



\usepackage[toc, title]{appendix}



\section{The main body of the text}
Refer to \cref{appendix} for more information.

\section{A complete table.} \label{appendix}
Some text.

  • 3
    Are you sure your readers need that extra word to know the appendix just started? You don't have the word Chapter for all the chapters, right? It is an article document, you don't have Section in front of every section entry, right?
    – Johannes_B
    Mar 6 '17 at 17:32
  • If you want to show "Appendix A" instead of just "A" in the ToC, do you want to show the longer string in the actual section-level header as well?
    – Mico
    Mar 6 '17 at 17:34
  • @Johannes_B, I just wanna show Appendix A in my TOC and left the tile blank, like \section{}. Mar 6 '17 at 17:36
  • @Mico An idea comes to my mind. I remove A and put Appendix A into \section{}. Mar 6 '17 at 17:38
  • \appendix\section*{Appendix}\addcontentsline{toc}{section}{Appendix} But that isn't a very good thing to do.
    – Johannes_B
    Mar 6 '17 at 17:39

Add the following to your preamble:


  \renewcommand{\@seccntformat}[1]{Appendix~\csname the##1\endcsname\quad}%

The above replaces the \numberline macro with a new \appendixnumberline while also updating the way sectional unit counter are formatted when setting the section title. All is included at the start of the \appendix as a form of automation.

enter image description here

If you also use \subsection (and lower) within the appendix, some more work needs to be done to exclude their sectional units from also being prepended with Appendix.


I would like to suggest you take a different approach: Instead of overloading any given line in the table of contents, consider inserting a line saying something like "Appendix material" in the ToC right before the first appendix section.

enter image description here

\usepackage[nameinlink]{cleveref} % make \cref look like \autoref

%% Set up some preparatory code -- activated below
%% (see 'The LaTeX Companion,' 2nd. ed., pp. 26f.)
   {\csname the#1\endcsname\quad}%   default
   {\csname #1@cntformat\endcsname}% enable individual control



\bigskip\hrule % just for this example

Refer to \Cref{app:a,app:b} for more information.
More text.
Still more text.

  \textbf{Appendix Material}\par}
% Activate preparatory code for section-level headers
\newcommand{\section@cntformat}{Appendix \thesection\quad}

\section{A complete table.} \label{app:a}
Some text.

\section{Another complete table.} \label{app:b}
Other text.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.