\usepackage{tikz}
\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\titleformat{\chapter}
{\normalfont\Huge\scshape}
{}{0pt}
{\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-3cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\draw[fill=cyan] (0,-1) rectangle
(\paperwidth,3cm);
\node[anchor=west,xshift=.21\paperwidth,yshift=-.01\paperheight,rectangle]
{\color{white}\LARGE CHAPTER \Huge\thechapter};
\node[anchor=west,xshift=.21\paperwidth,yshift=-.065\paperheight,rectangle]
{\color{cyan}\Huge\MakeUppercase{#1}};
\end{tikzpicture}
};
\end{tikzpicture}
}
\titlespacing*{\chapter}{0pt}{50pt}{0pt}
选自:http://tex.stackexchange.com/questions/95958/titleformat-does-not-seem-to-work-when-used-within-a-class-file/95976#95976
发表评论 取消回复