1

I'm dealing with some code lines to get a fancy style regarding Chapter titles. I'm using the following code:

\documentclass[11pt]{report}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{xcolor}
\usepackage{blindtext}

\newcommand{\chapnumfont}{%     % define font for chapter number
  \usefont{T1}{pnc}{b}{n}%      % choose New Chancery, bold, normal shape
  \fontsize{100}{100}%          % font size 100pt, baselineskip 100pt
  \selectfont%                  % activate font
}
\colorlet{chapnumcol}{gray!75}  % color for chapter number

\titleformat{\chapter}[display]
{\filleft\bfseries}
{\filleft\chapnumfont\textcolor{chapnumcol}{\thechapter}}
{-24pt}
{\Huge}

\begin{document}

\tableofcontents
\listoftables
  \blinddocument

\end{document}

enter image description here

You can see the image above as an example of the result.

Now I have got a little problem with the Summary, List of Contents, List of Figures and List of Tables. They follow the alignment of the chapter titles (i.e. on the right), but I would like having them aligned on the left side of the paper, leaving just the chapter titles on the right. Could anyone suggest me the necessary code lines to solve it?

Thank you!

2
  • 1
    Please provide a MWE (minimal working example) following the demands you find here: tex.meta.stackexchange.com/q/228/231952, so that we can better understand the problem you are encountering.
    – Ivan
    Apr 1, 2021 at 21:22
  • @Ivan I have just edited the main question with a MWE. Thanks for the advice.
    – Catarella
    Apr 1, 2021 at 21:44

1 Answer 1

1

If you want all the numberless chapters to be left-aligned you will need

\titleformat{name=\chapter,numberless}[]...

\documentclass[11pt]{report}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{xcolor}
\usepackage{blindtext}

\newcommand{\chapnumfont}{%     % define font for chapter number
 \usefont{T1}{pnc}{b}{n}%      % choose New Chancery, bold, normal shape
 \fontsize{100}{100}%          % font size 100pt, baselineskip 100pt
 \selectfont%                  % activate font
}
\colorlet{chapnumcol}{gray!75}  % color for chapter number

\titleformat{name=\chapter}[display]
{\filleft\bfseries}
{\filleft\chapnumfont\textcolor{chapnumcol}{\thechapter}}
{-24pt}
{\Huge}

\titleformat{name=\chapter,numberless}[display]
{\filright\bfseries}
{\filright}
{-24pt}
{\Huge}

\begin{document}
 
\tableofcontents
\listoftables

\blinddocument
 
\end{document}

If you want not only the numbered chapters but also other chapters like Introduction or Acknowledgments to be right-aligned you can use \titleformat inside a group.

\documentclass[11pt]{report}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{xcolor}
\usepackage{blindtext}

\newcommand{\chapnumfont}{%     % define font for chapter number
 \usefont{T1}{pnc}{b}{n}%      % choose New Chancery, bold, normal shape
 \fontsize{100}{100}%          % font size 100pt, baselineskip 100pt
 \selectfont%                  % activate font
}
\colorlet{chapnumcol}{gray!75}  % color for chapter number        

\begin{document}
 
\tableofcontents
\listoftables
 
\begingroup
 
 \titleformat{\chapter}[display]
 {\filleft\bfseries}
 {\filleft\chapnumfont\textcolor{chapnumcol}{\thechapter}}
 {-24pt}
 {\Huge}
 
 \blinddocument
 
\endgroup 
 
\chapter*{Acknowledgments}
 
\end{document}    
1
  • Thank you very much Ivan, the first code is what I was looking for. I have just tried it and everything works smoothly.
    – Catarella
    Apr 1, 2021 at 22:37

You must log in to answer this question.

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