LaTeX手工制作漂亮的章节样式
LaTeX的默认样式,很多用户觉得太朴实了,总想让自己的样式有些新意。下面便是一个很好的例子,这个样式在memoir class中也有,稍有差异。
效果图:
代码如下:
\documentclass[parskip,headsepline, headtopline, % footsepline, oneside, 12pt, headings=small]{scrbook} \usepackage[ngerman, english]{babel} \usepackage[utf8]{inputenc} \usepackage{color} \usepackage{pdfpages} % To include other PDFs % To insert dummy text \usepackage{blindtext} % Provide a command to include pretty quotes \usepackage{ragged2e} %justify dictum \renewcommand*{\dictumwidth}{.5\textwidth} \newcommand{\setChapterQuote}[3]{\setchapterpreamble[o]{% \dictum[#2 \emph{#3}]{\justifying {#1}}}} %Set font to times \usepackage{txfonts} % Define own Chapter style % Pretty chapter pages %------------------------------------------ \definecolor{nicered}{rgb}{.647,.129,.149} \usepackage{soul} \makeatletter \newsavebox{\feline@chapter} \newcommand\feline@chapter@marker[1][4cm]{% \sbox\feline@chapter{% \resizebox{!}{#1}{\fboxsep=1pt% \colorbox{nicered}{\color{white}\bfseries\sffamily\thechapter}% }}% \rotatebox{90}{% \resizebox{% \heightof{\usebox{\feline@chapter}}+\depthof{\usebox{\feline@chapter}}}% {!}{\scshape\so\@chapapp}}\quad% \raisebox{\depthof{\usebox{\feline@chapter}}}{\usebox{\feline@chapter}}% } \newcommand\feline@chm[1][4cm]{% \sbox\feline@chapter{\feline@chapter@marker[#1]}% \makebox[0pt][l]{% aka \rlap \makebox[1cm][r]{\usebox\feline@chapter}% }} \renewcommand*{\chapterformat}{% \hspace{\leftmargin} \feline@chm[2.5cm] % Height of the colored box \hspace{2cm} } \makeatother \begin{document} % Chapter A \setChapterQuote{A thought is an idea in transit.}{Pythagoras}{582 B.C. - 497 B.C.} \chapter{First chapter} \blindtext[5] % Chapter B \setChapterQuote{Much wisdom often goes with fewest words.}{Sophocles}{496 B.C. - 406 B.C.} \chapter{Second chapter} \blindtext[5] \end{document}