How do I create a table of contents that looks like:
Chater 1 Name
1.1 section
1.2 section
Appendix A
Appendix B
Chapter 2 Name
2.1 section
2.2 section
Appendix A
Appendix B
Specifically, I am wondering how to create appendix entries for each chapter, instead of the whole document. I am also wondering how to add the terms "Appendix" and "Chapter" as shown above.
Best Answer
I believe the following code does most of what you're asking for. Be sure to use the macro
\appsecnums
in each chapter at the start of the appendix area.The major (but hopefully not disqualifying) limitation of this code is that you can't have subsections (or subsubsections) inside appendix-type sections because the numbering would be incorrect. (Specifically, you'd have an unwanted "Appendix" string prefixed to the sub(sub)section's number.) When cross-referencing an appendix section labelled, say, as
\label{sec:newapp}
, be sure to write\ref{sec:newapp}
rather thanAppendix~\ref{sec:newapp}
.Addendum. In the MWE above, to change the numbering style of the appendices from
A
,B
, ... to<chapnum>.A
,<chapnum>.B
, ..., you'd need to modify the instructionas follows:
You'll probably also need to increase the indent amount, in the third argument of
cftsetindents
commands, by a bit, say by 0.75em: