GeneralGet unnumbered Headings into the ToC

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jgthb
Posts: 13
Joined: Wed Feb 17, 2010 6:57 pm

Get unnumbered Headings into the ToC

Post by jgthb »

Hi

I am writing my thesis and I have what I call an electronic appendix with a lot of programming files, that I don't wish to include in the regular appendix in the report. I would however still like to add the name of the directories with the files to the table of contents, so the reader knows what he can find in the electronic appendix. So after all the regular TOC elements for the report have been listed, I would like some elements (which I name manually) to be listed in the TOC as well. For those elements no dots or page numbers should be seen, and elements should not be added to the PDF bookmarks.

Does anyone know how to do this?

// Jonathan

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

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Get unnumbered Headings into the ToC

Post by Stefan Kottwitz »

Hi Jonathan,

you could use \addtocontents, such as

Code: Select all

\addtocontents{toc}{File name}
Stefan
LaTeX.org admin
jgthb
Posts: 13
Joined: Wed Feb 17, 2010 6:57 pm

Get unnumbered Headings into the ToC

Post by jgthb »

I actually tried that, but it did not appear in the TOC:

Code: Select all

\addtocontents{toc}{\bigskip \textbf{Electronic Appendix}\par}
\addtocontents{toc}{\protect\qquad{Mappe 1}\par}
\addtocontents{toc}{\protect\qquad{Mappe 2}\par}
It turns out it must be put on the same page as some other content, so eventually I put it in the end of my last appendix, and not after the appendix (although this can also be done by adding a mbox{}, but then another empty page will be added).

NOW, my problem is that the indentation is not working (see the uploaded file). E.g. I want the title "Electronic Appendix" to be aligned with "Appendix A", but it is indented. Likewise for the subsections. Is there some smart way of doing this, or is there something I should know about indentations in a TOC?
tableofcontents.png
tableofcontents.png (27.84 KiB) Viewed 3194 times
Attachments
tocExample.png.gz
(141.7 KiB) Downloaded 407 times
Last edited by Stefan Kottwitz on Sun Aug 12, 2012 4:00 pm, edited 1 time in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Get unnumbered Headings into the ToC

Post by Stefan Kottwitz »

As the layout of the table of contents depends on the document class, perhaps also on packages and settings, please post the necessary details, i.e. class name and related settings.

Stefan
LaTeX.org admin
jgthb
Posts: 13
Joined: Wed Feb 17, 2010 6:57 pm

Get unnumbered Headings into the ToC

Post by jgthb »

I have actually just found a way to solve this, so it all works now. But thanks anyway, Stefan :-)

The solution is actually really simple in my case: I simply added the package "tocloft", and then the alignment problem was solved! For the subsections I used "hspace{}" with a length of 1.5em:

Code: Select all

\addtocontents{toc}{\bigskip \textbf{Electronic Appendix}\par}
\addtocontents{toc}{\protect\hspace{1.5em}{DIR Channel Generators}\par}
\addtocontents{toc}{\protect\hspace{1.5em}{DIR Cpp Decoders}\par}
I'm sure someone could come up with a better design solution, but I think looks okay.
tableofcontents-new.png
tableofcontents-new.png (65.56 KiB) Viewed 3190 times
Last edited by Stefan Kottwitz on Sun Aug 12, 2012 5:09 pm, edited 2 times in total.
Post Reply