设计代码如下:
\documentclass[oneside]{memoir}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\usepackage{titletoc}
\usepackage{lipsum}
\usepackage{calc}
\definecolor{yourcolor}{HTML}{008bb2}
%define new chapter style (just for a nicer look)
\makechapterstyle{mystyle}{%
\chapterstyle{default}
\renewcommand*{\chapnumfont}{\normalfont\Huge\sffamily\bfseries}
\renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily\itshape\color{yourcolor}}
\settowidth{\chapindent}{\chapnumfont 111}
\renewcommand*{\chapterheadstart}{}
\renewcommand*{\chapnamefont}{\hfill\color{yourcolor}\normalfont\Huge\sffamily\bfseries}
\renewcommand*{\printchapternum}{%
\begin{tikzpicture}[baseline={([yshift=-.6ex]current bounding box.center)}]
\node[fill=yourcolor,circle,text=white] {\thechapter};
\end{tikzpicture}\\[1ex]
\hrule height 1.5pt}
\renewcommand*{\printchaptertitle}[1]{%
{\chaptitlefont ##1}}
}
%use new chapter style
\chapterstyle{mystyle}
%command to print the acutal minitoc
\newcommand{\printmyminitoc}{\noindent\hspace{-2cm}\begin{tikzpicture}
\node[rounded corners,align=left,fill=yourcolor, blur shadow={shadow blur steps=5}]{%
\color{white}%
\begin{minipage}{8cm}%minipage trick
\printcontents[chapters]{}{1}{}
\end{minipage}};
\end{tikzpicture}}
\begin{document}
\tableofcontents
\chapter{A chapter}
\startcontents[chapters]
%print minitoc
\printmyminitoc
\section{Section}
\lipsum[1]
\section{Section 2}
\section{test}
\section{abc}
\lipsum
\chapter{Second chapter}
\end{document}选自:http://tex.stackexchange.com/questions/78835/mini-table-of-contents-inside-tikz-node-on-chapter-start-page
发表评论 取消回复