4

My Minimum Working Example:

\documentclass{article}

\usepackage{appendix}

\begin{document}

\section{My First Section}

\section{My Second Section}

\begin{appendices}

\section*{My First Appendix}

Here I want something like:

\noindent My First Subsection ........... 1

\noindent My Second Subsection ........ 1

\subsection*{My First Subsection}

\subsection*{My Second Subsection}

\section*{My Second Appendix}

\end{appendices}

\end{document}

The result:

enter image description here

So basically, I want a table of contents within My First Appendix, only containing references to the subsections appearing in this Appendix.

  • Just a thought: Have you tested the minitoc package? – Malipivo Apr 15 '14 at 18:59
4

Below I present another two options.

Here's one possibility using the titletoc package; simply use \DoToC whereever you want to generate the partial ToC:

\documentclass{article}
\usepackage{appendix}
\usepackage{titletoc}

\newcommand\DoToC{%
  \startcontents
  \printcontents{}{2}{\textbf{Contents}\vskip3pt\hrule\vskip5pt}
  \vskip3pt\hrule\vskip5pt
}

\begin{document}

\section{My First Section}
\section{My Second Section}

\begin{appendices}
\section{My First Appendix}
\DoToC
\subsection{My First Subsection}
\subsection{My Second Subsection}

\section{My Second Appendix}
\DoToC
\subsection{My First Subsection}
\subsection{My Second Subsection}
\end{appendices}

\end{document}

enter image description here

Here's now one possibility using the etoc package; simply use \localtableofcontents whereever you want to generate the partial ToC:

\documentclass{article}
\usepackage{appendix}
\usepackage{etoc}

\begin{document}

\section{My First Section}
\section{My Second Section}

\begin{appendices}
\section{My First Appendix}
\localtableofcontents
\subsection{My First Subsection}
\subsection{My Second Subsection}

\section{My Second Appendix}
\localtableofcontents
\subsection{My First Subsection}
\subsection{My Second Subsection}
\end{appendices}

\end{document}

enter image description here

| improve this answer | |
3

Here is a solution with the minitoc package. In this case you will need to number the subsections (i.e. no star) to have them appear in any ToC.

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{appendix,minitoc}
\begin{document}

\dosecttoc
\faketableofcontents% replace with \tableofcontents if you want a ToC

\section{My First Section}
\section{My Second Section}

\begin{appendices}
\section{My First Appendix}
\secttoc
\subsection{My First Subsection}
\subsection{My Second Subsection}

\section{My Second Appendix}
\end{appendices}

\end{document}

enter image description here

| improve this answer | |
  • Thank you for your reply! I was wondering, can I do the same thing (that is, create a "local" table of contents) in two different appendices? – Pietair Apr 15 '14 at 19:52
  • Just say \secttoc after another section as well. – Henri Menke Apr 15 '14 at 20:40
  • Then the toc of the second appendix appears at the first appendix, while there is no toc at all at the second appendix. – Pietair Apr 15 '14 at 21:26

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.