Page Layout ⇒ Formatting Table of contents
Formatting Table of contents
I am trying to format my table of contents in the following way :-
1 Intro
2 Second Chapter
3 Third Chapter
.
.
.
Appendix A ...
Appendix B ....
.
.
.
I tried all the options suggested in the tocloft package discussions.
I couldn't change the \cftchapnumwidth value just before the appendix.
I have a question, can the \cftchapnumwidth be changed dynamically.
Thanks in anticipation ...
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Formatting Table of contents
try using the titletoc package instead: you can change the format for entries in the ToC in any part of your document. Refer to the package documentation for further information.
Re: Formatting Table of contents
I got the formatted entries but those are with the command \titlecontents.
I couldn't add the word Appendix to the labels, so completely dropped the label and created the entry. Something like this
1............
...........
2............
...........
Appendix A ......
....
Appendix B......
.....
When I tried to use the \dottedcontents,the output looks like this..
1............
...........
2............
...........
A ......
....
B......
.....
And I could not add the wodk Appendix in front of A,B etc.
I got an error with \contentslabel command, but it was defined outside \titlecontents etc. Now, I don't understand whether we can define \contentslabel outside of any other main commands or it has to inside one of those \title commands.
Next problem I face is how to add the word Appendix. I think I didn't quite understand the documentation do I am trying to reread and experiment, but I appreciate any help.
Thanks ...
Himanshu
Formatting Table of contents
the following code formats the ToC entries for appendices as you desire:
Code: Select all
\documentclass{book}\usepackage{titletoc}\begin{document}\tableofcontents\chapter{Test chapter one}\chapter{Test chapter two}\titlecontents{chapter}[0em]{\addvspace{10pt}}{\bfseries \contentslabel{-.5em}\contentspush{Appendix}\hspace*{2em}}{\bfseries}{\titlerule*[100pc]{.}\bfseries\contentspage}\appendix\chapter{Test appendix one}\chapter{Test appendix two}\end{document}
Re: Formatting Table of contents
Thank you so much.
I tried it and it works just fine.
regards,
Himanshu
-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm