7

How can I do a boxed minitoc at the beginning of any chapter like this.

It is too hard for me.

10

Here's one possibility:

\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage{lmodern}
\usepackage{titletoc}
\usepackage[many]{tcolorbox}

\newcommand\chapnumfont{\fontsize{50}{60}\selectfont}
\newcommand\chapnamefont{\huge}
\newcommand\chaptitlefont{\LARGE}

\makeatletter
\titleformat{\chapter}
  {\startcontents\bfseries\sffamily}
  {}
  {0pt}
  {}
  [{%
    \filleft{\chapnamefont\@chapapp}\\
    \begin{minipage}[b]{.75\textwidth}
    \begin{tcolorbox}[
      width=\linewidth,
      enhanced,
      top=10pt,
      nobeforeafter,
      outer arc=0pt,
      arc=0pt,
      boxrule=0.6pt,
      colback=white,
      overlay={
        \node[anchor=west,fill=white,inner xsep=6pt] 
          at ([xshift=10pt]frame.north west) 
          {Sommaire};
      }
    ]
      \printcontents{}{1}{}
    \end{tcolorbox}%
    \end{minipage}%
    \begin{minipage}[b]{.25\textwidth}
      \filleft
      \chapnumfont\thechapter
    \end{minipage}\\[10pt]
    {\chaptitlefont#1}
    }%
  ]
\titleformat{name=\chapter,numberless}
  {\startcontents\bfseries\sffamily\filleft}
  {}
  {0pt}
  {\chaptitlefont#1}
\makeatother

\begin{document}

\tableofcontents

\chapter{Test chapter one}
\section{Test section one one}
\section{Test section one two}
\section{Test section one three}


\chapter{Test chapter two}
\section{Test section two one}
\section{Test section two two}
\section{Test section two three}
\section{Test section two four}
\section{Test section two five}

\end{document}

The general ToC:

enter image description here

The partial ToC for chapter one:

enter image description here

The partial ToC for chapter two:

enter image description here

Remarks

  • titlesec was used to change the formatting for the chapter headings.

  • titletoc was used to produce the partial ToCs.

  • tcolorbox was used to produce the frame and title around the partial ToCs.

  • @Gonzalo Medina When I add \usepackage[unicode,bookmarksnumbered]{hyperref} , minitoc not exactly. How can I use this command? – minthao_2011 Aug 16 '15 at 14:13
  • @minthao_2011 I don't get any problemas adding the line you mentioned, Please feel free to open a fresh new question. – Gonzalo Medina Aug 16 '15 at 16:56
  • @GonzaloMedina I done. First, I put the line before \begin{document} – minthao_2011 Aug 17 '15 at 15:13

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.