0

I would like to place a mini table of context directly next to the chapter like in the following.

enter image description here

For compatibility reasons the toc should be created using titletoc as suggested in this answer. The tcolorbox in the MWE is not a must.

\documentclass{book}

\usepackage{titletoc}
\usepackage{lipsum}
\usepackage{tcolorbox}

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{3}
\begin{document}
    \tableofcontents
    \chapter{A chapter}
    \startcontents[chapters]
    \begin{tcolorbox}[width=.5\linewidth]
            \printcontents[chapters]{}{1}{}
    \end{tcolorbox}

    \section{Section}
    \lipsum[1]
    \section{Section 2}
    \lipsum
    \chapter{Second chapter}
    \startcontents[chapters]
    \printcontents[chapters]{}{1}{}
    \section{Section}
    \lipsum[2]
    \section{Another section}
    \lipsum
\end{document}
Manuel Schmidt
  • 3,537
  • 1
  • 19
  • 33

1 Answers1

2

try this:

\documentclass{book}

\usepackage{titletoc}
\usepackage{lipsum}
\usepackage{tcolorbox}
\usepackage{picture}

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{3}
\begin{document}
    \tableofcontents
    \chapter{A chapter}
    \startcontents[chapters]
  \begin{picture}(0,0)
    \put(.4\linewidth,2.5cm){\begin{tcolorbox}[width=.5\linewidth]
               \printcontents[chapters]{}{1}{}
              \end{tcolorbox}}
  \end{picture}
    \section{Section}
    \lipsum[1]
    \section{Section 2}
    \lipsum
    \chapter{Second chapter}
    \startcontents[chapters]
    \printcontents[chapters]{}{1}{}
    \section{Section}
    \lipsum[2]
    \section{Another section}
    \lipsum
\end{document}

output:

enter image description here