I am trying to create a sidebar like the one present in beamer documents, which lists the Table of Contents information for easy document navigation. Even better if it can automatically show only the subsections for the current section. How can this be implemented in other LaTeX classes, such as the article class, for use with pdflatex? This page has a suggestion but it does not work in pdflatex.

• There is no example because I do not know how to implement this. Thus, the question. – user5359531 Mar 8 '16 at 19:53
• What I mean is that we need to know class, packages used. – touhami Mar 8 '16 at 20:24
• article class would be most convenient but is not essential. I do not know which packages are best suited for this. I am interested in any examples or any suggestions anyone might have on implementing this. – user5359531 Mar 8 '16 at 20:39
• well i will try to see. – touhami Mar 8 '16 at 21:34

Here is a solution using etoc package

\documentclass{article}
\usepackage{lipsum}

\usepackage{etoc}
\etocsettocdepth{2}% only subsection
\etocsetstyle {subsection}
{}
{}
{}

% here with fancyhdr package
\usepackage{fancyhdr}
\fancyhf{}
\fancyfoot[C]{\thepage}
\pagestyle{fancy}

% or with background package
%\usepackage[placement=top,scale=1]{background}
%\backgroundsetup{contents={\tableofcontents \ref{\mt}},color=blue}

\usepackage{hyperref}

\begin{document}
\section{Foo}
\edef\mt{foo}\invisiblelocaltableofcontents\label{\mt}
\subsection{Foo bar}
\lipsum[1]
\subsection{Foo baz}
\subsubsection{Foo baz}
\newpage
\lipsum[1]
\subsection{Foo Bye}
\lipsum[1]
\section{Baz}
\edef\mt{baz}\invisiblelocaltableofcontents\label{\mt}
\subsection{Baz bar}
\lipsum[1]
\newpage
\subsection{Baz baz}
\lipsum[1]
\subsection{Baz Bye}
\lipsum[1]
\end{document}


with fancyhdr

with background