Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove specific subsection from TOC in LaTeX [duplicate]

Possible Duplicate:
hide an entry from Toc in latex

Appendix
 A Section 1
     A.1 Subsection 1
     A.2 Subsection 2
 B Section 2

Is there a way to get rid of Subsection n, but still have the subsection numbered in the document (i.e. not using \subsection*)?

I thought about limiting the TOC depth, but that does not seem to be possible for just the Appendix?

like image 437
HTTPeter Avatar asked Sep 25 '10 00:09

HTTPeter


People also ask

How do I remove subsections from table of contents?

Ctrl-click on the text in your TOC that you want to remove to go to that text in the document. Change the style of that text from one that is used for TOC reference. (i.e. you do not want a Heading style.) You can have the formatting look the same if you want, but the style must be different.

How do I remove section numbers from table of contents in LaTeX?

If you'd prefer your sections, subsection, and so forth to be displayed without numbers on the left side of the title, you simply add a * symbol to the command. (Note that section headings created this way will not be listed in the table of contents \tableofcontents.)


1 Answers

Here's one (sort of hackish but not too bad) way to work this:

All wrapped up, you just add a new command hiddensubsection, given by

\newcommand{\hiddensubsection}[1]{
    \stepcounter{subsection}
    \subsection*{\arabic{chapter}.\arabic{section}.\arabic{subsection}\hspace{1em}{#1}}
}

Then you create your notoc subsection using this instead of \subsection:

\hiddensubsection{sectionname}

The way it works is by manually incrementing the subsection counter and then creating an unnumbered subsection with the subsection counter as part of the title. You may need to tweak the spacing between number and title, but i couldn't see any difference.

Obviously you could do the same thing for sections and subsubsections if needed

like image 70
second Avatar answered Oct 04 '22 01:10

second