Related to this question, which specified how to relabel the Chapter prefix for appendices. But now my spacing is off because it's still using the same indent. Can I do something similar to \addtocontents{toc}{\def\protect\cftchappresnum{}}
but to redefine the \cftsetindents
for the Appendix chapters in the TOC?
MWE: (note the large horizontal whitespace between "Appendix A1." and "Example")
\documentclass[12pt]{report}
\usepackage[titletoc,toc,page]{appendix}
\usepackage{tocloft} % customize TOC font/spacing
\renewcommand\cftchappresnum{Chapter } % prefix "Chapter " to chapter number in ToC
\renewcommand{\cftchapaftersnum}{.} % add period after chapter number
\cftsetindents{chapter}{0em}{7em} % set amount of indenting for chapter in TOC
\begin{document}
\tableofcontents
\chapter{Introduction}
\chapter{Conclusion}
\begin{appendices}
\renewcommand{\thechapter}{A\arabic{chapter}} % Appendix A#
\addtocontents{toc}{\def\protect\cftchappresnum{}} % Appendix A1 instead of Chapter Appendix A1 in TOC
\chapter{Example}
\end{appendices}
\end{document}
Best Answer
The tocloft manual specifies that the command
\cftsetindents{entry}{indent}{numwidth}
sets the entry’s indent and its numwidth. In my case, I needed to modify the numwidth. The following command worked for me (I put it right after the\begin{appendices}
line):\addtocontents{toc}{\protect\setlength{\cftchapnumwidth}{2.5em}}