[Tex/LaTex] How to create inner section like environment with sub-table of contents

cross-referencingsectioningsections-paragraphstable of contents

Is there an easy way to create a inner section like environment that can produce a sub-table of contents at a preferred location? The sub-table does not necessarily need to give page numbers, but it should set links to the inner subsection items.
What I have in mind looks somewhat like this

\section{Lorem Ipsum}
\myinnersec_subtable

\myinnersec{InnerSubSectionOne}\label{InnerSubSectionOne}
....
\myinnersec{InnerSubSectionTwo}\label{InnerSubSectionTwo}
....

and should produce something like

Inner subsections with sub-table

Best Answer

You can achieve the partial ToC using the titletoc package and its \startcontents, \printcontents, \stopcontents commands. A little example, showing the partial ToC for a section and the active hyperlinks:

\documentclass{article}
\usepackage{titletoc}
\usepackage{hyperref}

\newcommand\innercontentsname[1]{%
  Contents for section~\ref{#1}}

\let\oldthesubsection\thesubsection

\begin{document}

\section{A regular section}
\subsection{Regular subsection one}
\subsection{Regular subsection two}

\section{Section with inner units and partial ToC}
\label{sec:ptoc}
\renewcommand\thesubsection{\Alph{subsection}}

\startcontents[inner]
\printcontents[inner]{}{1}{\subsection*{\innercontentsname{sec:ptoc}}}

\subsection{Inner special subsection one}
\subsection{Inner special subsection two}
\subsubsection{Inner special subsubsection one}
\subsubsection{Inner special subsubsection two}
\subsection{Inner special subsection three}

\stopcontents[inner]
\renewcommand\thesubsection{\oldthesubsection}

\section{Another regular section}
\subsection{Regular subsection one}
\subsection{Regular subsection two}

\end{document}

enter image description here

In a comment to the question, it has been requested that the inner subsections shouldn't be included in the general table of contents; this can be achieved by using \startcontents, \printcontents, \resumecontents to print the general table of contents:

\documentclass{article}
\usepackage{titletoc}
\usepackage{hyperref}

\newcommand\innercontentsname[1]{%
  Contents for section~\ref{#1}}

\let\oldthesubsection\thesubsection

\begin{document}

\startcontents
\printcontents{}{1}{\section*{\contentsname}}

\section{A regular section}
\subsection{Regular subsection one}
\subsection{Regular subsection two}

\section{Section with inner units and partial ToC}
\label{sec:ptoc}
\renewcommand\thesubsection{\Alph{subsection}}
\stopcontents[default]

\startcontents[inner]
\printcontents[inner]{}{1}{\subsection*{\innercontentsname{sec:ptoc}}}

\subsection{Inner special subsection one}
\subsection{Inner special subsection two}
\subsubsection{Inner special subsubsection one}
\subsubsection{Inner special subsubsection two}
\subsection{Inner special subsection three}

\stopcontents[inner]
\renewcommand\thesubsection{\oldthesubsection}

\resumecontents
\section{Another regular section}
\subsection{Regular subsection one}
\subsection{Regular subsection two}

\end{document}

enter image description here

Related Question