章节设计 - Eufisky - The lost book
制作类纸张突起效果段落
Tikz设计页眉设计样例分享

章节设计

Eufisky posted @ 2014年6月19日 21:51 in LaTeX with tags LaTeX 章节设计 , 2641 阅读

效果图:

代码如下:

 

\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}

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter