
Also, the titlesec package behaves oddly when I use the raggedright option. It's adding two pages to the whole document, and I don't understand why.
Could a gentle soul check my preamble given below, to see where are the causes of the problems ? I know it's pretty big, but I'm writing a complex book of about 900 pages with tons of equations and figures...

Please help !

Code: Select all
\documentclass[12pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{setspace}
\setstretch{1.1}
\usepackage{moreverb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{mathrsfs}
\usepackage{upgreek}
\usepackage{tensor}
\usepackage{graphicx}
\usepackage{here}
\raggedbottom
\usepackage[bottom]{footmisc}
\usepackage{pdfpages}
\usepackage[font=small,format=plain,labelfont=bf,up,textfont=it,up]{caption}
\usepackage[nottoc]{tocbibind}
\usepackage{tocloft}
\setlength{\cftchapnumwidth}{0pt}
\setlength{\cftsecnumwidth}{35pt}
\renewcommand{\cftchappresnum}{\chaptername\ }
\setlength{\cftsubsecindent}{53pt}
\renewcommand{\cftchapaftersnumb}{\newline}
\renewcommand{\cftchapdotsep}{\cftdotsep}
\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}}
\usepackage[ ]{siunitx}
\definecolor{cliquable}{RGB}{40,40,150}
\usepackage[colorlinks, linkcolor=cliquable, urlcolor=red, citecolor=red]{hyperref}
\pagestyle{headings}
\usepackage{anysize}
\marginsize{1.5in}{1in}{0.5in}{0.5in}
\usepackage{tabto}
\usepackage{enumitem}
\usepackage[pagestyles]{titlesec}
\newpagestyle{toc}{
\sethead[\thepage][][\itshape\small\MakeUppercase{Table des matières}]{\itshape\small\MakeUppercase{Table des matières}}{}{\thepage}
\headrule
}
\newpagestyle{principal}{
\sethead[\thepage][][\itshape\small\MakeUppercase{\chaptername\ \thechapter. \chaptertitle}]{\itshape\small\MakeUppercase{\thesection\ \sectiontitle}}{}{\thepage}
\headrule
}
\newpagestyle{appendices}{
\sethead[\thepage][][\itshape\small\MakeUppercase{\chaptertitle}]{\itshape\small\MakeUppercase{\thesection\ \sectiontitle}}{}{\thepage}
\headrule
}
\newpagestyle{biblio}{
\sethead[\thepage][][\itshape\small\MakeUppercase{\chaptertitle}]{\itshape\small\MakeUppercase{\chaptertitle}}{}{\thepage}
\headrule
}
\newpagestyle{figures}{
\sethead[\thepage][][\itshape\small\MakeUppercase{Table des figures}]{\itshape\small\MakeUppercase{Table des figures}}{}{\thepage}
\headrule
}
\newpagestyle{index}{
\sethead[\thepage][][\itshape\small\MakeUppercase{Index}]{\itshape\small\MakeUppercase{Index}}{}{\thepage}
\headrule
}
\usepackage{empheq}
\definecolor{gris230}{RGB}{230,230,230}
\usepackage{makeidx}
\makeindex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\frontmatter
\includepdf{PageTitre.pdf}
\thispagestyle{empty}
\cleardoublepage
\phantomsection
\addcontentsline{toc}{section}{\sl Avant-propos}
\input{Avant-propos}
\newpage
\cleardoublepage
\phantomsection
\addcontentsline{toc}{section}{\sl Notations et conventions}
\input{Conventions}
\newpage
\pagestyle{toc}
\tableofcontents
\mainmatter
\pagestyle{principal}
\input{Chapitre1}
\input{Chapitre2}
\backmatter
\appendix
\pagestyle{appendices}
\renewcommand\thesection{A.\arabic{section}}
\input{Appendices}
\begin{thebibliography}{999}
\pagestyle{biblio}
\input{Bibliographie}
\end{thebibliography}
\newpage
\setlength{\cftfignumwidth}{1.25in}
\renewcommand{\cftfigpresnum}{\figurename\ }
\renewcommand{\cftfigaftersnum}{~:}
\pagestyle{figures}
\listoffigures
% The index :
\cleardoublepage
\phantomsection
\pagestyle{index}
\printindex
\end{document}