GeneralTOC appendix

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
badguiz
Posts: 5
Joined: Tue Dec 02, 2008 5:38 pm

TOC appendix

Post by badguiz »

Hi all !

I've got a big issue in my report. Actually, I try to modify the TOC by replacing the standard :

1 Title 1.........#
2 Title 2.........#
A Title A.........#
etc.

bye

Chapter 1 Title 1............#
Chapter 2 Title 2............#
Appendix A Title A...........#
etc.

So I used the package \titletoc with the following code :

Code: Select all

\titlecontents{chapter}[6pc]{\addvspace{1pc}}
{\contentslabel[\chaptername~ \thecontentslabel]{6pc}}
{}{\hfill\contentspage}
The result is nearly fine, but I've got an issue with the appendix. Indeed, whereas the word "Chapter" appears well befor each chapter title, the word "Appendix" is replaced by "Chapter" in the appendix. I tried to redefine the command \appendix, but it did not work.

Anyone has an idea ?? Thks !

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

TOC appendix

Post by gmedina »

Hi,

I did some tests and the only solution I could find to your problem was to use a modified version of \titlecontents just before the appendices, as the following code suggests:

Code: Select all

\documentclass{book}
\usepackage{titletoc}

\titlecontents{chapter}[6pc]{\addvspace{1pc}}
  {\contentslabel[\chaptername~ \thecontentslabel]{6pc}}
  {}{\hfill\contentspage}

\begin{document}
\tableofcontents

\chapter{Dummy chapter}


\appendix
\titlecontents{chapter}[6pc]{\addvspace{1pc}}
  {\contentslabel[Appendix~ \thecontentslabel]{6pc}}
  {}{\hfill\contentspage}
\chapter{Dummy appendix}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
badguiz
Posts: 5
Joined: Tue Dec 02, 2008 5:38 pm

Re: TOC appendix

Post by badguiz »

Hi

Thanks for you answer but..... I tried it and :(

I use some other packages and I think there is a conflict because the modification of the \titlecontents is not taken into account. I already tried it but it doesn't do anything.
I don't have any other idea. I tried to redefine the command \appendix, I tried other solutions often proposed on forums but it does not work for me ! I also use a class given by my university (it is for the redaction of a thesis), but there is no support on the class and I don't see where the problem could come from.

Pffff

Thanks again !
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

TOC appendix

Post by gmedina »

You should have mentioned that you are not using a standard document class in the first place; the code I posted before works (at least on my system), but I used book. Perhaps if you post here, as an attachment, the .cls file that you are using, someone will have the time to spot the problem and offer you a solution.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
badguiz
Posts: 5
Joined: Tue Dec 02, 2008 5:38 pm

TOC appendix

Post by badguiz »

Hi

Here is the class for my document. The command \chapter and its heading has been modified but I don't see how it affect the package titletoc.
Another thing with this class... the package \cite does not work so the citations do not appear in a "compressed" form like : [1,2,3,4,5] --> [1-5].
Attachments
TheseUL.cls
(14.88 KiB) Downloaded 240 times
Post Reply