章节设计
效果图:
代码如下:
\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}
托马斯微积分的章节样式设计
代码如下:
\documentclass[ 11pt, pagesize=auto, version=last, chapterprefix=true ]{scrbook} \usepackage[frenchb]{babel} \usepackage[babel=true]{csquotes} \usepackage[T1]{fontenc} \usepackage[explicit]{titlesec} \usepackage{xcolor} \usepackage{charter} \definecolor{mybluei}{RGB}{28,138,207} \definecolor{myblueii}{RGB}{131,197,231} \newcommand\ChapterFont{\usefont{T1}{qhv}{b}{n}\selectfont\huge} \newcommand\SectionFont{\usefont{T1}{qhv}{b}{n}\selectfont} \titleformat{\chapter}[display] {\normalfont\ChapterFont\huge\color{myblueii}} {} {0pt} {\parbox[b]{70pt}{\mbox{}}% \parbox[b]{50pt}{\colorbox{mybluei}{% \parbox[b][60pt][t]{45pt}{\centering% \color{white}% {\itshape\rmfamily\small\chaptertitlename}% \vfill{\fontsize{50}{120}\selectfont\thechapter}% }% }% }\hspace{15pt}% \parbox[b]{\dimexpr\textwidth-150pt}{% \raggedright\scshape#1\vskip6pt% }% } \titleformat{name=\chapter,numberless}[display] {\normalfont\ChapterFont\huge\color{myblueii}} {} {0pt} {\parbox[b]{70pt}{\mbox{}}% \hspace{15pt}% \parbox[b]{\dimexpr\textwidth-150pt}{% \raggedright\scshape#1\vskip6pt% }% } \titleformat{\section} {\normalfont\small\sffamily\SectionFont\color{myblueii}} {\colorbox{mybluei}{% \parbox[c][16pt][c]{40pt}{% \centering\textcolor{white}{\SectionFont\Large\rmfamily\thesection}% }% }% } {1em} {#1} [\vspace{-1.2\baselineskip}% \color{myblueii}\hspace*{\dimexpr40pt+2\fboxsep\relax}% \rule{\dimexpr\textwidth-40pt-2\fboxsep\relax}{1pt}% ] \begin{document} \chapter{Preliminaries} \section{Test section} \end{document}
效果图:
tikz设计章节样式样例
Tikz制作章节样式前文已经分享很多了,这里就不多赘述了,下面这个样式设计,用到了tex.stackexchange上用户开发的tikz库,tex.stackexchange上面很多用户根据问题开发了不少好用的包,有兴趣大家可以多多关注。
样式截图如下:
下载区:
选自:http://www.rqna.net/qna/rivxkz-customizing-chapter-style-with-tikz.html
一个论文的章节样式设计
代码设计:
\documentclass[a4paper,titlepage]{book} \usepackage{kpfonts} %从论文中比对出的字体 \usepackage[T1]{fontenc} \usepackage{titlesec} %定义粗线填充 \def\Vhrulefill{\leavevmode\leaders\hrule height .8ex depth \dimexpr0.8pt-.2ex\hfill\kern0pt} %章节样式定义 \titleformat{\chapter}[display] {\normalfont\large\filcenter} {\Vhrulefill \ \ \scshape{\chaptertitlename} \thechapter\ \ \Vhrulefill} {.5pc} {\titlerule% \Huge\scshape}[\titlerule] \usepackage{lipsum} \begin{document} % Command that implements the titlepage \chapter{Introduction} {\it \lipsum[1]} \section{The example of section}%Begin your text here... \end{document}
效果图如下:
选自:http://www.latexstudio.net/a-chapter-style-from-a-thesis-design-code-sharing/
tikz设计章节带图样式
下面的章节设计中各章均有自己的特色,并且可以自己定义章节图,效果图如下:
代码实现:
\documentclass[12pt,twoside,letterpaper]{report} \usepackage[text={4.95in,7.5in},centering,bottom=1.5in,showframe]{geometry} \usepackage[dvipsnames]{xcolor} \usepackage{calc} \usepackage[explicit]{titlesec} \usepackage{fancyhdr} \usepackage{lipsum} \usepackage[demo]{graphicx} \usepackage{tikz} \usepackage{amsmath,amssymb} \usepackage{tikzpagenodes} \usepackage{anyfontsize} \usetikzlibrary{calc,positioning} \setlength{\oddsidemargin}{-0.25in} \setlength{\evensidemargin}{1.75in} \newcommand{\chapterfont}{% \fontencoding{T1} \fontfamily{ppl} \fontseries{m} \fontshape{n} \fontsize{26}{28}\selectfont} \newcommand{\chapternumfont}{% \fontencoding{T1} \fontfamily{ppl} \fontseries{m} \fontshape{n} \fontsize{60}{60}\selectfont} \newcommand{\chapterpicture}{% \ifodd\thepage \begin{tikzpicture}[remember picture, overlay, outer sep=0pt,inner sep=0pt] \node[anchor=north west] at (current page marginpar area.north west) {\includegraphics[height=\textheight,width=\marginparwidth,keepaspectratio]{figure}}; \end{tikzpicture} \else \begin{tikzpicture}[remember picture, overlay, outer sep=0pt,inner sep=0pt] \node[anchor=north east] at (current page marginpar area.north east) {\includegraphics[height=\textheight,width=\marginparwidth,keepaspectratio]{figure}}; \end{tikzpicture} \fi} %------------------------------------------------------------------------- % Chapter Style %------------------------------------------------------------------------- \titleformat{\chapter}[display] {\chapterfont} { \ifodd\thepage \begin{tikzpicture}[overlay, remember picture] \coordinate (aux1) at ($(current page.north east)-(0,10pt)$); \coordinate (aux2) at ($(current page text area.east)+(\marginparsep,0)$); \coordinate (aux3) at (aux2|-aux1); \coordinate (aux4) at ($(current page marginpar area.north west)!0.5!(current page marginpar area.north east)$); \path[fill=cyan] (aux3) rectangle (current page.north east) node [midway] (barabove) {}; \node[text=cyan,font=\chapternumfont,yshift=3cm] at (aux4) (chapnum) {\thechapter}; \node[cyan,outer sep=0pt,inner sep=0pt] (vline) at (aux3|-chapnum) {$\left|\vphantom{\text{\chapternumfont 1}}\right.$}; \end{tikzpicture}% \else \begin{tikzpicture}[overlay, remember picture] \coordinate (aux1) at ($(current page.north west)-(0,10pt)$); \coordinate (aux2) at ($(current page text area.west)-(\marginparsep,0)$); \coordinate (aux3) at (current page.north west-|aux2); \coordinate (aux4) at ($(current page marginpar area.north west)!0.5!(current page marginpar area.north east)$); \path[fill=magenta] (aux1) rectangle (aux3) node [midway] (barabove) {}; \node[text=magenta,font=\chapternumfont,yshift=3cm] at (aux4) (chapnum) {\thechapter}; \node[magenta,outer sep=0pt,inner sep=0pt] (vline) at (aux3|-chapnum) {$\left|\vphantom{\text{\chapternumfont 1}}\right.$}; \end{tikzpicture}% \fi } {-2.125in} { \begin{tikzpicture}[overlay, remember picture] \node [align=left,text width=\textwidth,anchor=west] at (current page text area.west|-chapnum) {#1}; \end{tikzpicture} } [\vspace*{.35in}] %------------------------------------------------------------------------- % Chapter Page Header/Footer %------------------------------------------------------------------------- \fancypagestyle{plain}{% \fancyhf{} % clear all header and footer fields \fancyhead{} % clear all header fields \fancyfoot{} % clear all footer fields \fancyfoot[RO]{\thepage$|$} \fancyfoot[LE]{$|$\thepage} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} } %------------------------------------------------------------------------- % Header/Footer Page Styles %------------------------------------------------------------------------- \fancyhead{} % clear all header fields \fancyfoot{} % clear all footer fields \fancyfoot[RO]{\thepage$|$} \fancyfoot[LE]{$|$\thepage} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} \pagestyle{fancy} \begin{document} \chapter{L'Hopitals Rule} test\footnote{test}\chapterpicture \lipsum[1-2] \chapter{Descartes Rule of Signs}\chapterpicture \lipsum[1-2] \chapter{Mean Value Theorem and\\ Intermediate Value Theorem} \lipsum[1-2] \setcounter{chapter}{10} \chapter{Other test}\chapterpicture \lipsum[1-2] \setcounter{chapter}{100} \chapter{Other test}\chapterpicture \lipsum[1-2] \end{document}
选自:http://tex.stackexchange.com/questions/113128/code-improvement-and-suggestions-in-template
设计一个章节样式
怎么设计下面的章节样式:
设计代码:
\documentclass[twoside]{book} \usepackage{xparse,ifthen} \usepackage[calcwidth]{titlesec} \usepackage{changepage} \usepackage{graphicx} \usepackage{caption} \usepackage{fancyhdr} \usepackage{marginnote} \usepackage{lettrine} \usepackage{lipsum} \newlength\mylen \DeclareDocumentCommand\ChapIma{omm} {\let\cleardoublepage\relax \ifthenelse{\isodd{\value{page}}} {\mbox{}\clearpage}{\mbox{}\clearpage\mbox{}\clearpage}% \resizebox{.9\textwidth}{.9\textheight}{\includegraphics{#3}} \mbox{}\thispagestyle{empty}\clearpage \IfNoValueTF{#1}{\chapter{#2}}{\chapter[#1]{#2}} } \DeclareDocumentCommand\Caption{om} {\marginnote{\parbox{\marginparwidth}{% \captionsetup[figure]{labelformat=empty} \IfNoValueTF{#1}{\captionof{figure}{#2}}{\captionof{figure}[#1]{#2}} }% }% } \titleformat{\chapter}[display] {\Huge\normalfont\sffamily}{}{2pc} {\setlength\mylen{0pt}% \addtolength\mylen{\marginparwidth}% \addtolength\mylen{\marginparsep}\raggedleft } [\vspace{-20pt}% {% \begin{adjustwidth}{}{-\mylen} \makebox[\linewidth][r]{% \rule{\dimexpr\titlewidth+\mylen\relax}{0.4pt}% }% \end{adjustwidth}% }% ] \titlespacing*{\chapter}{0pt}{1cm}{7cm} \renewcommand\chaptermark[1]{\markboth{#1}{}} \fancypagestyle{plain}{% \fancyhf{} \fancyfoot[OR]{\sffamily\small\MakeUppercase{\leftmark}~~\oldstylenums{\thepage}} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} \fancyfootoffset[OR]{\dimexpr\marginparsep+\marginparwidth\relax} } \fancyhf{} \fancyfootoffset[OR]{\dimexpr\marginparsep+\marginparwidth\relax} \fancyfootoffset[EL]{\dimexpr\marginparsep+\marginparwidth\relax} \fancyfoot[OR]{\small\sffamily\MakeUppercase{\leftmark}~~\oldstylenums{\thepage}} \fancyfoot[EL]{\small\sffamily\oldstylenums{\thepage}~~\MakeUppercase{\rightmark}} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} \pagestyle{fancy} \renewcommand\chaptermark[1]{\markboth{#1}{}} \renewcommand\sectionmark[1]{\markright{#1}} \begin{document} \tableofcontents \ChapIma{Preface}{ctanlion} \lettrine{T}{his} is some initial text\Caption{This is the caption for the figure; this is just some test text} \lipsum[1-5] \ChapIma{Introduction}{ctanlion} \lipsum[1] \section{Qu'ran manuscripts} \lipsum[1-14] \end{document}
选自:http://tex.stackexchange.com/questions/37170/how-can-i-produce-a-fancy-chapter-heading-like-this-one
制作精致的章节样式
classicthesis是非常经典的英文论文模板,这里也推荐大家学习使用,做得非常不错,下面这个章节样式就是利用这一模板来制作的,效果图如下:
代码赏析:
changepage包是非常常用的,作为判断页面奇数或者偶数非常简洁,lipsum包用于生成随机文本。前面的几个包这里不再详细表述。可参看:arsclassica
\documentclass[headinclude,footinclude,openany]{scrbook} \usepackage[eulerchapternumbers,pdfspacing]{classicthesis} \usepackage{arsclassica} \usepackage{tikz} \usepackage{changepage} \usepackage{lipsum}% just to generate text for the example \strictpagecheck
下面看章节的具体设计代码如下:
\titleformat{\chapter}[block]% {\normalfont\Large\sffamily}% {{\color{halfgray}\chapterNumber\thechapter% \hspace{10pt}\vline} }{10pt}% {\spacedallcaps}[\chapterdecoration]
这是典型的titlesec的设计代码,我们可以看到其命令的最后都执行了一个\chapterdecoration命令,下面看看这个命令是如何定义的:
\definecolor{halfgray}{gray}{0.55}%定义所需颜色 \newcommand\anglei{-45}%定义角度 \newcommand\angleii{45} \newcommand\angleiii{225} \newcommand\angleiv{135} %绘制版面镶边代码 \newcommand\chapterdecoration{% \begin{tikzpicture}[remember picture,overlay,shorten >= -10pt] \coordinate (aux1) at ([yshift=-15pt]current page.north east); \coordinate (aux2) at ([yshift=-410pt]current page.north east); \coordinate (aux3) at ([xshift=-4.5cm]current page.north east); \coordinate (aux4) at ([yshift=-150pt]current page.north east); \checkoddpage \ifoddpage \else \coordinate (aux1) at ([yshift=-15pt]current page.north west); \coordinate (aux2) at ([yshift=-410pt]current page.north west); \coordinate (aux3) at ([xshift=4.5cm]current page.north west); \coordinate (aux4) at ([yshift=-150pt]current page.north west); \renewcommand\anglei{-135} \renewcommand\angleii{135} \renewcommand\angleiii{-45} \renewcommand\angleiv{45} \fi \begin{scope}[halfgray!40,line width=12pt,rounded corners=12pt] \draw (aux1) -- coordinate (a) ++(\angleiii:5) -- ++(\anglei:5.1) coordinate (b); \draw[shorten <= -10pt] (aux3) -- (a) -- (aux1); \draw[opacity=0.6,halfgray,shorten <= -10pt] (b) -- ++(\angleiii:2.2) -- ++(\anglei:2.2); \end{scope} \draw[halfgray,line width=8pt,rounded corners=8pt,shorten <= -10pt] (aux4) -- ++(\angleiii:0.8) -- ++(\anglei:0.8); \begin{scope}[halfgray!70,line width=6pt,rounded corners=8pt] \draw[shorten <= -10pt] (aux2) -- ++(\angleiii:3) coordinate[pos=0.45] (c) -- ++(\anglei:3.1); \draw (aux2) -- (c) -- ++(\angleiv:2.5) -- ++(\angleii:2.5) -- ++(\anglei:2.5) coordinate[pos=0.3] (d); \draw (d) -- +(\angleii:1); \end{scope} \end{tikzpicture}% }
如上是较为常见的pgf绘制方式,注意代码中做了奇数页和偶数页的区隔。其效果图如上。
下载区
http://www.latexstudio.net/wp-content/uploads/2014/02/chapnicestyle.zip
精致的章节样式
如何制作一个这样的小结样式的标签,如下图:
源代码如下:
\documentclass{article} \usepackage[a5paper,vmargin=2cm]{geometry} \usepackage{background} \usepackage{etoolbox} \usepackage{totcount} \usepackage{lipsum} % to have access to the total number of sections \regtotcounter{section} % every section starts on a new page \pretocmd{\section}{\clearpage}{}{} % auxiliary lengths for the height of the frame and the width of each tab \newlength\mylen \newlength\mylena % style for the section tabs \tikzset{tab/.style={ text width=\mylena,anchor=south, draw=gray,thick,rectangle,rounded corners=12pt,rotate=270, align=center,text height=20pt, text depth=25pt,inner sep=0pt,fill=gray!20, yshift=-18pt,font=\sffamily\LARGE}} % style for the current section tab \tikzset{selectedtab/.style={tab,color=white,fill=gray!90}} % the page number is showed in the background material \pagestyle{empty} \AtBeginDocument{ % calculation of the width for each tab \setlength\mylen{\dimexpr\textheight+2cm\relax} \ifnum\totvalue{section}>0 \setlength\mylena{\dimexpr\mylen/\totvalue{section}\relax} \fi % the main part; as background material we place the border, % the section (current and other) tabs and the page number \SetBgScale{1} \SetBgColor{black} \SetBgAngle{0} \SetBgOpacity{1} \SetBgContents{ \begin{tikzpicture}[remember picture, overlay] \node[inner sep=0pt,text width=\the\dimexpr\textwidth+1.5cm\relax] at (current page.center) (border) {\rule{0pt}{\dimexpr\textheight+2cm\relax}}; \foreach \valsection in {0,...,\numexpr\totvalue{section}-1\relax} { \node[\ifnum\thesection<\numexpr\valsection+1\relax tab\else \ifnum\thesection>\numexpr\valsection+1\relax tab\else selectedtab\fi\fi,xshift=(0.5+\valsection)*\mylena] at (border.north east) (tab-\valsection) {Section \the\numexpr\valsection+1\relax}; } \node[draw=gray,line width=2pt,rectangle,rounded corners=10pt,inner sep=0pt, text width=\the\dimexpr\textwidth+1.5cm\relax,fill=white] at (current page.center) {\rule{0pt}{\dimexpr\textheight+2cm\relax}}; \node[font=\LARGE\sffamily,fill=white] at (border.south) {\makebox[3em][c]{\thepage}}; \end{tikzpicture}} } \begin{document} \section{Test Section One} \lipsum[1-3] \section{Test Section Two} \lipsum[1-3] \section{Test Section Three} \lipsum[1-3] \section{Test Section Four} \lipsum[2] \end{document}
选自:http://tex.stackexchange.com/questions/75637/how-to-print-section-titles-like-tab-list
精致的章节样式
在TeX使用中,很多时候想别出心裁地设计属于自己的版面或者文章样式,尤其是用TeX来设计版面和样式,做起来非所见所得,对于设计来说有了更高要求,需要我们有较多绘图和版面的知识。
如下几个样式来自网络供大家参考:选自:http://web.slzm.de/blog/latex/schone-kapiteltitelseiten-in-latex/
效果图:
代码设计:
\documentclass{scrbook} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[ngerman]{babel} \usepackage {xcolor} \usepackage{blindtext} \usepackage{fix-cm} \usepackage{titlesec} \usepackage{tikz} % Style 2, 3, 4 \usetikzlibrary{calc} % 2, 3, 4 \usetikzlibrary{decorations,decorations.shapes,shapes} % 3 % Style 1 %\renewcommand{\thechapter}{\Roman{chapter}} \titleformat{\chapter}[display] {\bfseries\Large} { %\Huge\textsc{\chaptertitlename} \hfill\fontsize{120}{70}\selectfont\color{lightgray}\textbf{\thechapter}} {-2ex} {\filleft\fontsize{50}{70}\selectfont\scshape} [\vspace{0ex}] % Style 2 \titleformat{\chapter}[display] {\bfseries\Large} {\hfill \tikz[remember picture] \node[] (nr) {\fontsize{120}{70}\selectfont\color{lightgray}\textbf{\thechapter}}; \begin{tikzpicture}[overlay,remember picture] \coordinate (leftborder) at ($(nr)-(100,0)$); \coordinate (left) at ($(nr.west)-(1.5,0)$); \draw[line width=2em] ($(nr.north east)+(0,1)$) -- ($(nr.north west)+(0,1)$) -- (left) -- (leftborder); \end{tikzpicture}} {-2ex} {\filleft\fontsize{50}{70}\selectfont\scshape} [\vspace{0ex}] % Style 3 \titleformat{\chapter}[display] {\bfseries\Large} {\hfill \tikz[remember picture] \node[] (nr) {\fontsize{120}{70}\selectfont\color{lightgray}\textbf{\thechapter}}; \begin{tikzpicture}[overlay,remember picture] \coordinate (leftborder) at ($(nr)-(100,0)$); \coordinate (left) at ($(nr.west)-(1.5,0)$); \draw[decoration={shape backgrounds,shape size=.5cm,shape=signal},signal from=west, signal to=east,decorate, draw=red!50!black, fill=red!50, decoration={shape sep=.5cm},line join=round] (leftborder) -- (left); \end{tikzpicture}} {-2ex} {\filleft\fontsize{50}{70}\selectfont\scshape} [\vspace{0ex}] % Style 4 \titleformat{\chapter}[display] {\bfseries\Large} {\hfill \tikz[remember picture] \node[] (nr) {\fontsize{120}{70}\selectfont\color{blue!50!black}\textbf{\thechapter}~}; \begin{tikzpicture}[overlay,remember picture] \coordinate (leftborder) at ($(nr)-(100,0)$); \coordinate (leftborderhigh) at ($(nr.north west)-(100,0)$); \coordinate (leftborderlow) at ($(nr.south west)-(100,0)$); \coordinate (left) at ($(nr.west)-(1.5,0)$); \fill[blue!20!white] (leftborderhigh) -- ($(nr.north west)+(0,0.5)$) -- (left) -- (leftborder) -- cycle; \fill[blue!20!white] (leftborderlow) -- ($(nr.south west)-(0,0.5)$) -- (left) -- (leftborder) -- cycle; \draw[blue!50!black,line width=0.1em,line join=round] (left) -- ($(nr.south west)-(0,0.5)$) -- ($(nr.south east)-(0,0.5)$) -- ($(nr.north east)+(0,0.5)$) -- ($(nr.north west)+(0,0.5)$) -- (left) -- (leftborder); \end{tikzpicture}} {-2ex} {\filleft\fontsize{50}{70}\selectfont\scshape} [\vspace{0ex}] % ========================== % DOKUMENT % ========================== \begin{document} \chapter{Einleitung} \blindtext \chapter{Hauptteil} \blindtext \chapter{Schluss} \blindtext \end{document}
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}