1

I would like to add a table of contents inside a section environment to make a TOC made up of subsections, subsubsections and etc. One slight difficutly is that I am not using an article class document; its a customized one. I would use the article class if necessary. I would like something along the lines of:

\section{Section 1}
\tableofcontents
\subsection{Sub1}
\subsection{Sub2}

Thanks

  • Do you mean that the TOC inside the section should only display the contents of that particular section (and subsections), but not that of other sections? – cryingshadow Dec 5 '15 at 19:45
  • Yes, thats exactly what I want. – MJS Dec 5 '15 at 20:03
  • 1
    perhaps \usepackage{etoc} and then use \localtableofcontents assuming your customized class hasn't its own handling of .toc file. Perhaps you will need \etocsetocstyle{}{} to not have a too big Contents printed. – user4686 Dec 5 '15 at 20:49
2

Thanks @jfbu. Your method worked for me. Here is my scrap code.

\documentclass{article}
\usepackage{etoc}



\begin{document}
\tableofcontents
\newpage

\section{Section 1}
\localtableofcontents
\subsection{Sub1}
\subsection{Sub2}

\newpage
\section{Section 2}
\localtableofcontents
\subsection{Sub1}
\subsection{Sub2}


\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.