I'd like to design a chapter heading similar to the one in the picture below. I like to put a line between the number and the chapter name and also align the the chapter name to the left. I'm using the document class book
. Any ideas how to do it?
-
By chapter name do you mean the word ‘chapter’ or the chapter title? The picture is aligned on the right. So?…– BernardJul 17, 2014 at 10:17
1 Answer
You can build your own chapterstyle with the titlesec
package:
\documentclass{report}
\usepackage[explicit]{titlesec}
\usepackage{lipsum}
\usepackage{type1cm}
\usepackage{xcolor}
\titleformat{\chapter}[display]
{\normalfont\Large\rmfamily}
{\sffamily\flushright\fontsize{60}{0}\textbf{\textcolor{black!20}{{\Huge\chaptername}~\thechapter\vskip0pt\rule{\textwidth}{2pt}}}}{0pt}
{\flushleft\fontsize{30}{0}{#1}\vskip60pt}
\titlespacing*{\chapter}
{0pt}{-40pt}{0pt}
\begin{document}
\chapter{Enjoy the whitespace}
\lipsum[1]
\end{document}
The type1cm
package is required for the font size.
-
type1cm
is required if you use computermodern. If you use another font that exists in type1 or opentype format, you don't need it.– BernardJul 17, 2014 at 10:54 -
Thanks a lot Bernard! Good one! Two questions: 1) Where in the codes I can play around with the spacing before after the line? 2) How can I add "CHAPTER" before one? With a smaller size ... Jul 17, 2014 at 11:49
-
To change the spacing before the line you can simply change the value of
\vskip0pt\rule...
to any other value. If you want to change the space after you have to change the...}}}{0pt}
at the end of the line– SLx64Jul 17, 2014 at 11:54 -
-
Bernard, another question. How can I apply a separate font family to the title. I want just "Enjoy ..." part to be in normal latin font not ss. Jul 17, 2014 at 12:32