代码如下:
\documentclass{book} \usepackage[explicit]{titlesec} \usepackage{tikz} \usepackage{lipsum} \titleformat{\chapter}[block] {\normalfont\huge\bfseries} {\tikz\node[ font=\huge\bfseries\color{white}, fill=gray!50, rounded corners=20pt, minimum height=1.6cm, text width=3em, align=center, inner xsep=0pt] {\parbox{1.5em}{\thechapter\hfill}};% } {-1em} {\tikz\node[ fill=gray, font=\Large\sffamily\color{white}, minimum height=1.6cm, text width=\the\dimexpr\textwidth-2em\relax, align=center,inner xsep=0pt] {#1};% } \titleformat{name=\chapter,numberless}[block] {\normalfont\huge\bfseries} {\tikz\node[ font=\huge\bfseries\color{white}, fill=gray!50, rounded corners=20pt, minimum height=1.6cm, text width=3em, align=center, inner xsep=0pt] {\parbox{1.5em}{\mbox{}\hfill}};% } {-1em} {\tikz\node[ fill=gray, font=\Large\sffamily\color{white}, minimum height=1.6cm, text width=\the\dimexpr\textwidth-2em\relax, align=center, inner xsep=0pt] {#1};% } \begin{document} \tableofcontents \chapter{Tomaras-Tsamis-Woodard Solution} \lipsum[4] \end{document}
选自:http://tex.stackexchange.com/questions/165161/chapter-heading-like-cambridge-university-press
发表评论 取消回复