2

Right now I'm using the default chapter formattings on Overleaf but I want to change it so that the chapter number is much larger than the title and is above and separate from the title itself.

At the moment I have the title (but not the number) aligned correctly but I can't seem to change the font or increase the size beyond what it's currently at.

current MWE, mostly the same as the titlesec template on Overleaf:

\documentclass[a4paper,12pt]{book}
\usepackage[T1]{fontenc}
\usepackage{titlesec}

\titleformat
{\chapter} % command
[display] % shape
{\bfseries\Large\itshape} % format
%{Story No. \ \thechapter} % label
{\thechapter}
{0.5ex} % sep
{
    %\rule{\textwidth}{1pt}
    \vspace{1ex}
    %\centering
    \raggedleft
} % before-code
[
\vspace{-0.5ex}%
%\rule{\textwidth}{0.3pt}
] % after-code


\titleformat{\section}[wrap]
{\normalfont\bfseries}
{\thesection.}{0.5em}{}

\titlespacing{\section}{12pc}{1.5ex plus .1ex minus .2ex}{1pc}

\begin{document}
\chapter{Let's begin}
\section{First Attempt}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do 
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut 
enim ad minim veniam, quis nostrud exercitation ullamco laboris...



\end{document}

I want it to look like this

Large orange chapter number aligned right, sitting above the chapter title

3 Answers 3

1

Get a try (and change colors and dimensiond as you like):

\documentclass[10pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage{amsmath}
\usepackage{amsfonts,lmodern}
\usepackage{amssymb}
\usepackage{emptypage,graphicx}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{microtype,lipsum}

\titleformat{\chapter}[display]
{\normalfont\bfseries\color{black}}
{\filleft\hspace*{-60pt}%
    {\setlength\fboxsep{0pt}%
        \colorbox{blue!10}{\parbox[c][3cm][c]{3cm}{%
                \centering\color{cyan}\fontsize{80}{70}\selectfont\thechapter}%
    }}%
}
{10pt}
{\filleft\LARGE\sffamily}

\begin{document}
    
    \tableofcontents
    \chapter{Trip in a new world}
    \lipsum[1-2]
    \section{One}
    \lipsum[3-12]
    \setcounter{chapter}{22}
    \chapter{The fantastic way of life in the new world}
    \lipsum[1-2]
    \section{Two}
    \lipsum[3-12]
\end{document}

enter image description here

1
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts,lmodern}
\usepackage{amssymb}
\usepackage{emptypage,graphicx}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{microtype,lipsum}
\titleformat{\chapter}[display]
{\LARGE\bfseries\sffamily}
{\filleft\hspace*{-60pt}{\Huge\colorbox{white}{\parbox[c][3cm][c]{3cm}{\color{orange}\fontsize{3cm}{1cm}\selectfont\centering\thechapter}}}}
{10pt}{\LARGE\filleft}

\begin{document}
    \chapter{Trip in a new world}
\end{document}

enter image description here

0

It's simpler than other answer seem to imply.

\documentclass[a4paper,12pt]{book}
\usepackage[T1]{fontenc}
\usepackage{fix-cm}
\usepackage{titlesec}
\usepackage{xcolor}

\definecolor{chapternumber}{RGB}{239,107,28}
\newcommand{\makebignumber}[1]{%
  \textcolor{chapternumber}{\fontsize{80}{0}\bfseries #1}%
}

\titleformat{\chapter}[display]
  {\filleft} % format
  {\makebignumber{\thechapter}}
  {2ex}
  {\Large}

\titleformat{\section}[wrap]
  {\normalfont\bfseries}
  {\thesection.}
  {0.5em}
  {}

\titlespacing{\section}{12pc}{1.5ex plus .1ex minus .2ex}{1pc}

\begin{document}
\chapter{Let's begin}
\section{First Attempt}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do 
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut 
enim ad minim veniam, quis nostrud exercitation ullamco laboris...

\end{document}

enter image description here

You don't need fix-cm if you use a fully scalable font like in the image.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .