1

Everything works beautifully except that, in the TOC, the Appendices are prefixed by "Chapter" instead of by "Appendix" and I have no idea what controls these.

More precisely, I am getting:

Chapter 1 Title

Chapter 2 Title

Chapter A Title

Chapter B Title

where I would like

Chapter 1 Title

Chapter 2 Title

Appendix A Title

Appendix B Title

This is the actual document but I have not been able to recreate this in a minimum working example and the best I got has no prefix whatsoever in the TOC:

\documentclass[11pt]{book}

\usepackage{xcolor} 
\usepackage{makeidx}
\usepackage{hyperref}
\hypersetup{colorlinks,linkcolor={red!50!black}}
\usepackage[titletoc]{appendix}

\makeindex

\begin{document}
%\frontmatter

\Large \textsc{Reasonable Book}

\tableofcontents

\mainmatter
\chapter{One}   
Some text \textbf{indexed}\index{indexed}   
\section{To begin with}
And then some more text.
%\noappendicestocpagenum%What does it do?

\appendixpage
\appendix
\chapter{This is text for the stuff that is needed.}    

\backmatter
\chapter{FDL}
The purpose of this License 

\newpage
\phantomsection
\addcontentsline{toc}{chapter}{Index}   
\printindex
\end{document}
4
  • Try to load hyperef as the last package (I cannot test it, because I cannot install packages on this computer).
    – Sveinung
    Apr 11, 2016 at 14:33
  • @Sveinung The last four packages are: appendix, makeidx, hyperref and, after the Oberdiek ``quick and dirty hack'' to call showidx, cleveref. What is a pity is that, as mentioned above, the "actual document", which is rather intricate, otherwise works beautifully.
    – schremmer
    Apr 11, 2016 at 20:21
  • Well, when I run your MWE, I get neither chapter nor appendix as prefix in the table of contents, I just get 1 and A.
    – Sveinung
    Apr 11, 2016 at 21:42
  • A classic mistake when using the package appendix: When using this package, you have to use the environment \begin{appendices}... \end{appendices}, not the command \appendix. On the other hand: The simplest way to archive your goal is to use the receipt in this answer. Maybe you then have to skip the use of the appendix-package, I am not sure.
    – Sveinung
    Apr 11, 2016 at 22:28

1 Answer 1

1

Add this to your preamble:

\usepackage{apptools, etoolbox}

\makeatletter
\patchcmd{\@chapter}{\protect {CHAPTER }}{\ifappendix{APPENDIX }\else{CHAPTER }\fi}{}{}
\makeatother
1
  • Even this "latex challenged" person could see that this was just what the doctor ordered but . . . I am afraid it didn't work here: neither in the MWE nor in the "actual document".
    – schremmer
    Apr 10, 2016 at 22:47

You must log in to answer this question.

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