1

Hello I want to put the chapter (picture 1) in a colorful table in gray and in the middle of the page, as in picture 2.

\begingroup % start a TeX group
\color{gray}% or whatever color you wish to use
\chapter*{Introduction générale} \\
\endgroup 

Picture 1

enter image description here

picture 2

enter image description here


This is the code I have put together so far:

\documentclass[12pt]{report}
\usepackage[francais]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fancybox}


%%%%%%%%%%%%%%%%%%%%%%%%%%%Page en tete

\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{appendix}
\usepackage{mathtools,amsfonts,amssymb,amsthm}
\usepackage[most]{tcolorbox}
\definecolor{ocre}{RGB}{52,177,201}
\definecolor{ultramarine}{RGB}{0,45,97}
\definecolor{myblue}{gray}{0.6}
\definecolor{mybluei}{gray}{0.75}
\definecolor{myblueii}{gray}{0.8}
\definecolor{myblueiii}{gray}{0.85}
\definecolor{myblueiiii}{gray}{0.93}

\usepackage{fourier}
\usepackage[explicit,calcwidth]{titlesec}

\renewcommand\thechapter{\arabic{chapter}}

\newcommand\chapnumfont{% 
  \fontsize{50}{120}\color{myblueii}\selectfont%
}

\newcommand\chapnamefont{%
  \normalfont\color{white}\scshape\small\bfseries
}

\titleformat{\chapter}
  {\normalfont\huge\filleft}
  {}
  {0pt}
  {\stepcounter{chapshift}%
  \begin{tikzpicture}[remember picture,overlay]
  \fill[myblueiii]
    (current page.north west) rectangle ([yshift=-13cm]current page.north 
  east);
  \node[
      fill=mybluei,
      text width=2\paperwidth,
      rounded corners=6cm,
      text depth=18cm,
      anchor=center,
      inner sep=0pt] at (current page.north east) (chaptop)
    {\thechapter};%
  \node[
      anchor=south east,
      inner sep=0pt,
      outer sep=0pt] (chapnum) at ([xshift=-20pt]chaptop.south)
    {\chapnumfont\thechapter};
  \node[
      anchor=south,
      inner sep=0pt] (chapname) at ([yshift=2pt]chapnum.south)
  {};
  \node[
      anchor=north east,
      align=right,
      inner xsep=0pt] at ([yshift=-0.5cm]chapname.east|-chapnum.south)
  {\parbox{.7\textwidth}{\raggedleft#1}};
  \end{tikzpicture}%
  }

\titleformat{name=\chapter,numberless}
  {\normalfont\huge\filleft}
  {}
  {0pt}
  {\begin{tikzpicture}[remember picture,overlay]
  \fill[myblueiii]
    (current page.north west) rectangle ([yshift=-13cm]current page.north 
 east);
  \node[
      fill=mybluei,
      text width=2\paperwidth,
      rounded corners=6cm,
      text depth=18cm,
      anchor=center,
      inner sep=0pt] at (current page.north east) (chaptop)
    {};%
  \node[
      anchor=south east,minimum width=2in,
      inner sep=0pt,
      outer sep=0pt] (chapnum) at ([xshift=-20pt]chaptop.south)
    {};
  \node[
      anchor=south,
      inner sep=0pt] (chapname) at ([yshift=2pt]chapnum.south)
  {};
  \node[
      anchor=north east,
      align=right,
      inner xsep=0pt] at ([yshift=-0.5cm]chapname.east|-chapnum.south)
  {\parbox{.7\textwidth}{\raggedleft#1}};
  \end{tikzpicture}%
  }

\titlespacing*{\chapter}{0pt}{0pt}{3.5in}
\titlespacing*{name=\chapter,numberless}{0pt}{0pt}{3.5in}

\titleformat{\section}
  {\addtolength{\titlewidth}{2pc}\normalfont\Large\sffamily\bfseries}
  {\colorbox{myblueii}{\parbox{2cm}{\strut\color{white}\hfill\thesection}}}
  {1em}{#1}
  [{\titleline*[l]{\color{myblueii}\titlerule[2pt]}}]
\titleformat{\subsection}
  {\addtolength{\titlewidth}{2pc}\normalfont\large\sffamily}
  {\colorbox{myblueii}{\parbox{2cm} 
 {\strut\color{white}\hfill\thesubsection}}}
  {1em}{#1}
  [{\titleline*[l]{\color{myblueii}\titlerule[2pt]}}]

\usetikzlibrary{calc}
\pagestyle{plain}

\newcounter{chapshift}
\addtocounter{chapshift}{-1}

\newcommand\BoxColor{myblueii}

\def\subsectiontitle{}
\renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize#1}{}}
\renewcommand{\subsectionmark}[1]{\def\subsectiontitle{#1}}

\usepackage{etoolbox}

\renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries \ #1} 
{}}
\renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize#1}{}}


\makeatletter
\renewcommand{\cleardoublepage}{
\clearpage\ifodd\c@page\else
\hbox{}
\vspace*{\fill}
\thispagestyle{empty}
\newpage
\fi}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Je veux utiliser néanmoins des fontes qui « paraissent bien » en PDF
\usepackage[cyr]{aeguill}

%% J'aime bien pouvoir contrôler mes hauts de page !
\usepackage{fancyhdr}
\usepackage{enumitem}
%% Je veux pouvoir inclure des figures...

\makeatletter
\setlength{\@fptop}{0pt}
\makeatother
%% ... des figures ``jpeg'' ou ``pdf'' ou "png"
\DeclareGraphicsExtensions{.jpg,.pdf,.png}

%% Je veux créer des Hyperdocuments
\usepackage[pdftex,colorlinks=true,linkcolor=black,citecolor=blue,urlcolor=bl 
ue]{hyperref}

%% Je contrôle la taille de ma zone imprimée...
\usepackage{anysize}
%% ...en définissants les marges {gauche}{droite}{haute}{basse}
\marginsize{22mm}{14mm}{12mm}{25mm}
\setlength{\headheight}{50pt}
\setlength{\footskip}{28.44942pt}

%% J'inclue une bibliographie ; j'ai donc besoin du package natbib
\usepackage{natbib}

\usepackage{colortbl}

\definecolor{bleuy}{rgb}{0.4,0.6,0.8}
\definecolor{blue(pigment)}{rgb}{0.2, 0.2, 0.6}
\definecolor{bleudefrance}{rgb}{0.19, 0.55, 0.91}
\definecolor{yaleblue}{rgb}{0.06, 0.3, 0.57}
\definecolor{royalblue}{rgb}{0.0, 0.14, 0.4}
\definecolor{oxfordblue}{rgb}{0.0, 0.13, 0.28}
\definecolor{darkmidnightblue}{rgb}{0.0, 0.2, 0.4}
\definecolor{spirodiscoball}{rgb}{0.06, 0.75, 0.99}


\usepackage{ulem}
\usepackage{graphicx}       % to insert PostScript figures  
\usepackage[strict]{changepage}
\usepackage{pifont}
\usepackage{capt-of}

\usepackage{ragged2e} 
      % new
      % new
 \usepackage[Lenny]{fncychap}


\usepackage{booktabs, % new
            hhline, 
            makecell, % new
            multirow, 
            tabularx} % new
\renewcommand\theadfont{\small\bfseries}
\renewcommand\theadgape{}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X} % redefined

%---------------- show page layout. don't use in a real document!

\definecolor{Gray}{gray}{0.9}


%%%%%%%%%table size

%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyhdr}

\renewcommand{\headrule}{{\color{myblueii}%
\hrule width\headwidth height\headrulewidth depth\headrulewidth}}

\pagestyle{fancy}
\fancyhf{} \fancyhead[LE,RO]{\sffamily\normalsize\colorbox{myblueii} 
 {\color{white}\sffamily\bfseries\strut\quad\thepage\quad}}
\fancyhead[LO]{\textcolor{mybluei} \rightmark%
\begin{tikzpicture}[overlay,remember picture]
  \node[fill=\BoxColor,inner sep=-1pt,rectangle,text width=1cm,
    text height=28cm,align=center,anchor=north east]
  at ($ (current page.north east) $)
  {\rotatebox{90}{\parbox{18cm}{%
   \centering\textcolor{white}{\bfseries\scshape\thechapter.\leftmark 
 \hspace{2cm}\rightmark\hspace{2cm}\thesubsection~\subsectiontitle}}}};
  \end{tikzpicture}}
\fancyhead[RE]{\textcolor{mybluei}\leftmark%
  \begin{tikzpicture}[overlay,remember picture]
  \node[fill=\BoxColor,inner sep=0pt,rectangle,text width=1cm,
    text height=28cm,align=center,anchor=north west]
  at ($ (current page.north west) $)
  {\rotatebox{90}{\parbox{18cm}{%
    \centering\textcolor{white}{\bfseries\scshape\thechapter.\leftmark 
  \hspace{2cm}\rightmark\hspace{2cm}\thesubsection~\subsectiontitle}}}};
  \end{tikzpicture}}
\renewcommand{\headrulewidth}{.9pt}
\addtolength{\headheight}{2.5pt}
\newcommand{\footrulecolor}[1]{\patchcmd{\footrule}{\hrule} 
 {\color{#1}\hrule}{}{}}
\renewcommand{\headrulewidth}{.5pt}
\addtolength{\headheight}{2.5pt}
\renewcommand{\footrulewidth}{.9pt}
\fancyfoot[LE,RO]{\footnotesize\bfseries\itshape Foot 1}
\fancyfoot[C]{\footnotesize\bfseries Foot 2}
\fancyfoot[RE,LO]{\footnotesize\bfseries\itshape Foot 3}

\fancypagestyle{plain}{%
  \fancyhf{}% 
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
}


%%%%%%%%%%%%%%%%%%%%%%%%Page de garde
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{secnumdepth}{3}
\usepackage{lscape}
\usepackage{fetamont}

\newcommand{\fb}[1]{\dofb#1}
\newcommand{\dofb}[1]{\textbf{#1}\nobreak\hspace{0pt}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%chapt header
\fancypagestyle{chapter}{%
\lhead[]{\fancyplain{}{\bfseries\leftmark}}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%BBB%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\usepackage{showframe}

\begin{document}



%% Voilà des hauts de page comme je les aime :
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter. #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection. #1}}
\lhead[]{\fancyplain{}{\bfseries\leftmark}}

\cfoot{}


%% Voilà mes légendes de figures comme je les aime :
\makeatletter
\def\figurename{{\protect\sc \protect\small\bfseries Fig.}}
\def\f@ffrench{\protect\figurename\space{\protect\small\bf 
\thefigure}\space}
\let\fnum@figure\f@ffrench%
\let\captionORI\caption
\def\caption#1{\captionORI{\rm\small #1}}
\makeatother

%%%%%%%%%%




%%%%%%%%Page garde






%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begingroup % start a TeX group
\color{gray}% or whatever color you wish to use
\chapter*{Dédicaces}
\endgroup 

\end{document}
Mico
  • 506,678
  • Please edit your question and expand the code to provide a complete but minimal working example. Is it just this chapter you want to change? In the middle of the page horizontally or vertically? Is anything else on the page? What do you mean by 'colorful' other than, presumably, not grey? – cfr Jun 16 '18 at 00:26
  • In the middle of the page horizontally. There is a text but i wont modifiy the text just the title of chapter. I mean by colorful ( that the title of chap be in a gray table. Thank you :) – Yacine Chamane Jun 16 '18 at 00:30
  • Please provide code for a complete but minimal document we can compile to produce the starting output you show. Then somebody can show you how to adapt it to produce the target output you show. By default, chapter titles are centred, aren't they? It is a while since I used them. – cfr Jun 16 '18 at 01:17
  • See also https://tex.stackexchange.com/questions/23477/fancy-chapter-headings/50848?s=2|0.0000#50848 – John Kormylo Jun 16 '18 at 03:53

0 Answers0