I would like to create a Fancy Chapter Just like the one below:
Could anyone help me out with this? (With the same Font for the headings and sections)
Thanks in Advance!
I would like to create a Fancy Chapter Just like the one below:
Could anyone help me out with this? (With the same Font for the headings and sections)
Thanks in Advance!
I have come somewhat close using the book class. The typesetting program is LuaLaTeX to be able to use the \fontsize{70}{60}\selectfont
such that the chapter number is larger than \Huge
. I have created a tcolorbox
called titlecolorbox
, which is just a black box with with text. I have used the explicit option for titlesec
based on this answer. The documentation for the titlesec
package can be found here, where the titleformat
function is also explained. I hope this helps.
% !TEX TS-program = LuaLaTeX
\documentclass[12pt]{book}
\usepackage{geometry}
\usepackage{lipsum} %for dummy text
\usepackage{tcolorbox}
\newtcolorbox{titlecolorbox}[1]{ %the box around chapter
coltext=white,
colframe=black,
colback=black,
boxrule=0pt,
arc=0pt,
notitle,
width=4.8em,
height=2.4ex,
before=\hfill
}
\usepackage{xcolor}
\usepackage[explicit]{titlesec}
\titleformat{\chapter}[display]
{\sffamily\Huge}
{}
{0pt}
{\begin{titlecolorbox}{}
{\large\sffamily\MakeUppercase{\chaptername}}
\end{titlecolorbox}
\vspace*{-4.19ex}\noindent\rule{\textwidth}{0.4pt}
\parbox[b]{\dimexpr\textwidth-4.8em\relax}{\raggedright\MakeUppercase{#1}}{\hfill\fontsize{70}{60}\selectfont\thechapter}
}
[]
\titleformat{name=\chapter,numberless}[display]
{\sffamily\Huge}
{}
{0pt}
{\begin{titlecolorbox}{}
{\large\sffamily\MakeUppercase{\chaptername}}
\end{titlecolorbox}
\vspace*{-4.19ex}\noindent\rule{\textwidth}{0.4pt}
\parbox[b]{\dimexpr\textwidth-4.8em\relax}{\raggedright\MakeUppercase{#1}}
}
[]
\titleformat{\section}[display]
{\sffamily\large}
{}
{0pt}
{\hrule\vspace*{0.25ex}\parbox[b]{\dimexpr\textwidth\relax}{\textcolor{darkgray}{\thesection}\quad\raggedright\bfseries\MakeUppercase{#1}}}
[\hrule]
\begin{document}
\setcounter{chapter}{10}
\chapter{Modeling Event-Based Behaviour with State Machine}
\lipsum[3]
\section{Overview}
\lipsum[4]
\end{document}
I am getting this when I called the \tableofcontents command. I tried using this code below but didn't work:
\titleformat{\tableofcontents}[display]
{\sffamily\Huge}
{}
[]