5

So basically I want to create a Table of Contents in my latex document (class - article). But I don't want the first half sections to be printed. For examples, suppose there are four sections in my document - Section 1, Section 2, Section 3 and Section 4. Then I want my TOC to look like this

  1. Section 3 -- pagenumber

  2. Section 4 -- pagenumber

While I want to retain the section number and names in the main text.

Thanks!

2
  • 1
    Welcome to TeX.SX. Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Jul 28, 2014 at 21:56
  • \section*{First section} etc should do for not appearing in the TOC.
    – user31729
    Jul 28, 2014 at 21:57

1 Answer 1

6

Depending on the request, there are some possibilities:

\section*{Title} ---> No toc entry at all

\section[]{Title} ----> No toc entry, but numbered section

\documentclass[paper=a4,12pt]{scrartcl}

\usepackage{blindtext}

\begin{document}
\tableofcontents
\clearpage

\section*{First -- not in TOC}%
\blindtext
\section*{Second -- not in TOC too}%
\blindtext
\section{Third}%
\blindtext
\section{Fourth}%
\blindtext
\section[]{Fifth}%
\blindtext
\end{document}

enter image description here

6
  • This answer works with the "scrartcl" class, but not (for me) with the "article" or "amsart" classes. With "article", \section* is left out of the TOC while \section[] inserts a blank but numbered line into the TOC, while with "amsart" all three commands add TOC entries (with \section* being an unnumbered entry and the other two numbered). Sep 23, 2015 at 4:22
  • @MikeShulman: Yes? What's your addition to this?
    – user31729
    Sep 23, 2015 at 12:02
  • I don't understand your question. I was pointing out that your answer only works with a particular document class (which happens not to be the one the OP said he was using). Sep 23, 2015 at 23:12
  • @MikeShulman: I never claimed it would work with other classes
    – user31729
    Sep 24, 2015 at 8:11
  • 1
    Sure. But since you didn't actually mention document classes at all, I spent a while being confused about why your solution didn't work for me, until I realized it depended on the document class. So I thought I would spare other readers that wasted time. Sep 24, 2015 at 13:36

You must log in to answer this question.