0

I have used a style for the toc and lof title but the position is a little bit far from the top of the page and i want to make it more closer to the header

Here is a complete example

    \documentclass[a4paper,12pt,final]{report}
% Pour une impression recto verso, utilisez plutôt ce documentclass :
%\documentclass[a4paper,11pt,twoside,final]{article}

\usepackage{tabto} 
\usepackage{mathptmx} % text new roman font
\usepackage[english,francais]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[pdftex]{graphicx}
\usepackage{setspace}   
\usepackage[hidelinks]{hyperref}
\usepackage[french]{varioref}
\usepackage{float}
\usepackage{url}
\usepackage{amssymb}

\usepackage{listings}
\usepackage{lipsum}
\usepackage{courier}

\usepackage{listings}
\usepackage{xcolor}
\usepackage{tabularx}
\usepackage{pifont}
\usepackage{pdflscape}

\graphicspath{ {figures/} }
\usepackage{array}
\usepackage[titletoc]{appendix}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern} % load a font with all the characters

%\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\usepackage{arabtex}  % caption must be loaded before arabtex
\usepackage{utf8}

% add an extra subsection
\usepackage{titlesec}
\usepackage{hyperref}

\usepackage{tikz}
\usetikzlibrary{shadows.blur}

\usepackage{titletoc}
\usepackage{lipsum}

\usepackage{calc}

\usepackage[]{titlesec} 
\definecolor{yourcolor}{HTML}{008bb2}

\colorlet{chpnumbercolor}{black}
\makeatletter
\let\oldl@chapter\l@chapter
\def\l@chapter#1#2{\oldl@chapter{#1}{\textcolor{chpnumbercolor}{#2}}}

\let\old@dottedcontentsline\@dottedtocline
\def\@dottedtocline#1#2#3#4#5{%
\old@dottedcontentsline{#1}{#2}{#3}{#4}{{\textcolor{chpnumbercolor}{#5}}}}
\makeatother

\titleformat{\chapter}[display]
  {\normalfont\color{yourcolor}}
  {\filleft\Huge\sffamily\bfseries\chaptertitlename\hspace*{2mm}%
  \begin{tikzpicture}[baseline={([yshift=-.6ex]current bounding box.center)}]
    \node[fill=yourcolor,circle,text=white] {\thechapter};
  \end{tikzpicture}}
  {1ex}
  {\titlerule[3pt]\vspace*{5ex}\huge\sffamily\itshape}
  []

\titleformat{name=\chapter,numberless}[display]
  {\normalfont\color{yourcolor}}
  {}
  {1ex}
  {\vspace*{1ex}\huge\sffamily\itshape\center}
  []        
   \titlespacing*{\chapter}{0pt}{50pt}{40pt}

%command to print the acutal minitoc
\newcommand{\printmyminitoc}{%
    \noindent\hspace{-2cm}\vspace{-2cm}%
    \colorlet{chpnumbercolor}{white}%
}


\newcommand{\mychapter}[2]{
    \setcounter{chapter}{#1}
    \setcounter{section}{0}
    \chapter*{#2}
    \addcontentsline{toc}{chapter}{#2}
}

\renewcommand\thechapter{\Roman{chapter}}

\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}

%\usepackage{tocloft}                                              
%\renewcommand\cftbeforetoctitleskip{-2cm}
%\renewcommand\cftbeforeloftitleskip{-2cm}
%\renewcommand\cftbeforelottitleskip{-2cm}

\begin{document}
 \tableofcontents
  \listoffigures
   \chapter{Chapitre 1: Etude et analyse}
  \lipsum[1]

\end{document}

Before

After using

 \usepackage{tocloft}                                              
 \renewcommand\cftbeforetoctitleskip{-2cm}
 \renewcommand\cftbeforeloftitleskip{-2cm}
 \renewcommand\cftbeforelottitleskip{-2cm}

after

the two titles are overlapping and the style previously defined have changed but instead i want just to change the position and keep the font size /color

Thanks

  • Have you tried to move that tocloft stuff to the top? – Johannes_B Jun 4 '16 at 16:37
  • You're preamble is a mess - loading some packages twice and what's worse, hyperref somewhere in between, but the real issue is using titletoc and tocloft -- those two packages just conflict! – user31729 Jun 4 '16 at 17:22
  • @Johannes_B tried but gives the same results – The Beast Jun 4 '16 at 19:07
  • @ChristianHupfer you're right but , the package tocloft was commented , i removed the duplicate too ... then found a simple solution – The Beast Jun 4 '16 at 19:09
1

The solution was to change the titleFormat using a negative value for vspace like below:

\titleformat{name=\chapter,numberless}[display]
  {\normalfont\color{yourcolor}}
  {}
  {1ex}
  {\vspace{-20ex}\huge\sffamily\itshape\center}
  []        
   \titlespacing*{\chapter}{0pt}{50pt}{40pt}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.