# Make a TOC but hide it from the document

For my masters thesis I would like to have a TOC list but hide the chapter, section and subsection from the PDF document. Is there any way to do that.

In other words. \subsection*{subsection} hides it from TOC, is there any reverse method as to hide from document body but show in TOC ?

Best, Abhi

-
Does this question help you? tex.stackexchange.com/questions/86082/… –  egreg Jan 1 '13 at 14:42
Do you want the sectioning headers (of level section, subsection, etc) to disappear completely from the body of the text, or should they be there but not numbered? –  Mico Jan 1 '13 at 14:49

The only way that I can think to do this, is to create new commands that add the items to the TOC, and increment (or reset) the counters, but dont add to the actual document.

In the below code, I have called the standard chapter and section commands once, then called the \newchapter{...} and \newsection{...} custom commands. You will see standard TOC, yet only one chapterpage and section header.

The only thing that is perhaps a little unsatisfactory, needs more work, is the spacing in the TOC, since the numbers were physically added in the \newchapter and \newsection commands, otherwise they would have been left out and I couldn't think off the top of my head what the commands are to call the TOC spacings.

[For the Record, I don't actually think this is a good idea, since the whole point of a TOC is to allow the reader to direct themselves to particular sections and subsections etc. Without the headings, your readers will, in all likelihood, get confused.]

Here is what the TOC Looks Like:

Here is what the First Chapter and Section Looks Like:

Here is what the Second Chapter and Section Looks Like:

Finally, Here is the code to achieve the above.

\documentclass{book}
\usepackage{lipsum}

\begin{document}

\tableofcontents
\pagestyle{empty}
\chapter{First Chapter - Standard}
\section{First Section - Standard}
\lipsum[1]

\newcommand{\newchapter}[1]{
\cleardoublepage
\setcounter{section}{0}
}

\newcommand{\newsection}[1]{