0

I am working on a LaTeX document (.tex file) using the report document class. I have several chapters with section headings, and I want to adjust the vertical spacing of the chapter sections to make the chapter appears in the center of the page without affecting the formatting of the list of figures and list of tables.

main.tex

\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{fontenc}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{float}
\geometry{a4paper, margin=2.5cm}


%pour la mise en page des tableaux
\usepackage{array}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\usepackage{longtable}
\usepackage{xltabular}

%% pour la numération des sous sou sections
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}

%% pour la réference
\usepackage{ifthen}
\usepackage{ifpdf}
\ifpdf
\usepackage[pdftex]{hyperref}
\else
\usepackage{hyperref}
\usepackage{titlesec}
\usepackage{calc}

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\centering}{\chaptertitlename\ \thechapter}{0pt}{\Huge}
\titlespacing*{\chapter}{0pt}{\paperheight/3-\ht\strutbox}{2ex plus 1ex minus .2ex}

\usepackage{titlesec}

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\centering}{\chaptertitlename\ \thechapter}{0pt}{\vfill}



\fi
\usepackage{color}
\hypersetup{%
colorlinks=true,
linkcolor=black,
citecolor=black,
urlcolor=blue}

%%For page formatting 
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\lhead{\bfseries\nouppercase{\leftmark}}
\rfoot{\bfseries\thepage}
\setlength{\headheight}{14.5pt}

\let\headruleORIG\headrule

\renewcommand{\headrule}{\color{black} \headruleORIG}
\renewcommand{\headrulewidth}{1.0pt}
\usepackage{colortbl}
\arrayrulecolor{black}

\fancypagestyle{plain}{
  \fancyhead{}
  \fancyfoot[R]{\bfseries\thepage}
  \renewcommand{\headrulewidth}{0pt}
}



\makeatletter
\def\@textbottom{\vskip \z@ \@plus 1pt}
\let\@texttop\relax
\makeatother

\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else%
  \hbox{}%
  \thispagestyle{empty}%
  \newpage%
  \if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother

\renewcommand{\contentsname}{Table de matière}

%%**************************************************************

\begin{document}

\pagenumbering{Roman}
\tableofcontents
\clearpage
\listoffigures
\clearpage
\listoftables
\clearpage


\pagenumbering{arabic}
\include{05-Introduction}
\include{06-Contexte général et étude préalable}
\include{07-Analyse et spécification des besoins}
\include{08-Release 1}
\include{09-Release 2}

\end{document}

06-Contexte général et étude préalable

\chapter{Contexte général et étude préalable}

\clearpage

And this is how the page initially appears: enter image description here

I want to increase the vertical spacing between the chapter sections so that i make it in the center of the page, but I don't want it to affect the list of figures, list of tables, the introduction, table of contents. How can I achieve this? Any help or suggestions would be greatly appreciated. Thank you!

2
  • Why are you loading titlesec twice with two different \titleformats? After all your chapters you don't want the spacing, just put a new \titleformat{\chapter}[display] before your chapters you want the extra spacing
    – JamesT
    Jun 1, 2023 at 12:55
  • It would help too if you could make a Minimal Working Example (MWE) please, most of your code is not important to the question, reduce it down until the bare essentials as it helps people help you
    – JamesT
    Jun 1, 2023 at 12:56

1 Answer 1

0

The ToC, the list of figures and the list of tables use \chapter*, ie they are unnumbered chapters.

Using titlesec you can make different formats for numbered and unnumbered versions of \chapter by using the numberless key with \titleformat and \titlespacing.

\titlespacing*{name=\chapter,numberless}{<increase left margin>}{<vertical space before chapter title>}{<separation between chapter title an text>}

a

% !TeX TS-program = pdflatex


\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{fontenc}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{float}
\geometry{a4paper, margin=2.5cm}
%
%
%%pour la mise en page des tableaux
\usepackage{array}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\usepackage{longtable}
\usepackage{xltabular}
%
%%% pour la numération des sous sou sections
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}

\usepackage{calc}

\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\centering}{\chaptertitlename\ \thechapter}{0pt}{\Huge}
\titlespacing*{\chapter}{0pt}{\paperheight/3-\ht\strutbox}{2ex plus 1ex minus .2ex}

\titlespacing*{name=\chapter,numberless}{0pt}{0pt}{40pt}% unnumberd chapters <<<<<<

\usepackage{color}


%%%For page formatting 
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\lhead{\bfseries\nouppercase{\leftmark}}
\rfoot{\bfseries\thepage}
\setlength{\headheight}{14.5pt}

\let\headruleORIG\headrule

\renewcommand{\headrule}{\color{black} \headruleORIG}
\renewcommand{\headrulewidth}{1.0pt}
\usepackage{colortbl}
\arrayrulecolor{black}

\fancypagestyle{plain}{
    \fancyhead{}
    \fancyfoot[R]{\bfseries\thepage}
    \renewcommand{\headrulewidth}{0pt}
}

\makeatletter
\def\@textbottom{\vskip \z@ \@plus 1pt}
\let\@texttop\relax
\makeatother
%
\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else%
    \hbox{}%
    \thispagestyle{empty}%
    \newpage%
    \if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother

\renewcommand{\contentsname}{Table de matière}

%% pour la réference
\usepackage{ifthen}
\usepackage{ifpdf}
\ifpdf
\usepackage[pdftex]{hyperref} % last package
\else
\usepackage{hyperref}% last package
\fi
\hypersetup{%
    colorlinks=true,
    linkcolor=black,
    citecolor=black,
    urlcolor=blue}
%%**************************************************************

\begin{document}
    
    \pagenumbering{Roman}
    \tableofcontents
    \clearpage
    \listoffigures
    \clearpage
    \listoftables
    \clearpage  
    
    \pagenumbering{arabic}
    \chapter{Introduction}
    \chapter{Contexte général et étude préalable}
    \chapter{Analyse et spécification des besoins}
    \chapter{Release 1}
    \chapter{Release 2}
    
\end{document}

You must log in to answer this question.

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