[Tex/LaTex] Book layout Contents, Chapter, Section,

book-designchaptersformattingsectioningtable of contents

my goal is to get new style of Table of Contents, new style of Chapter and new style of section. I there is one more: how to change itemize native symbol for a black square?

Table of Contents: text on the left side in the middle of two lines. And there is a big white space non normal one.
enter image description here

Chapter: number of chapter in a roman in a black box on the line above the chapter name, Name of chapter on right side, another line under name of Chapter

enter image description here

Section: I want to add a black square at the begining of each section name.
enter image description here
I appreciate that
thank You

Best Answer

You can use the packages titlesec for the titles of the sectional units, and titletoc for the entries in the ToC; a little example producing the layout for chapters and sections, and the redefinition of the label for itemize to use a square (feel free to adjust the settings according to your needs):

\documentclass{book}
\usepackage{xcolor}
\usepackage[explicit]{titlesec}
\usepackage[dotinlabels]{titletoc}

% chapter tiltes formatting
\titleformat{\chapter}[display]
  {\normalfont\sffamily\bfseries\LARGE}
  {\renewcommand{\thechapter}{\Roman{chapter}}\hspace*{0.5em}\colorbox{black}{%
    \parbox[c][1.2cm][c]{1cm}{%
      \centering\textcolor{white}  {\Huge\thechapter}}}}
  {-1ex}
  {\titlerule\vspace{.7ex}\filleft\MakeUppercase{#1}}
  [\vspace{.2ex}\titlerule]
% chapter tiltes spacing
\titlespacing*{\chapter}{0pt}{50pt}{80pt}

% section tiltes formatting
\titleformat{\section}
  {\normalfont\Large\bfseries}{\MySecSquare\ \thesection}{1em}{#1}
\titleformat{name=\section,numberless}
  {\normalfont\Large\bfseries}{\MySecSquare}{1em}{#1}

% formatting for chapter entries in ToC  
\titlecontents{chapter}
  [1.5em]{}
  {\sffamily\bfseries\contentslabel{1.5em}}
  {\hspace*{-1.5em}}
  {\hfill\sffamily\bfseries\contentspage}
% formatting for section entries in ToC  
\titlecontents{section}
  [3.8em]{}
  {\sffamily\contentslabel{2.3em}}
  {\hspace*{-2.3em}}
  {\titlerule*[1pc]{.}\sffamily\contentspage}

% Square to be used in itemize
\newcommand\MySquare{%
  \leavevmode\hbox to 1.2ex{\hss\vrule height .9ex width .7ex depth -.2ex\hss}}
% Square to be used in section titles
\newcommand\MySecSquare{%
  \leavevmode\hbox to 1.2ex{\hss\vrule height 1.3ex width 1.1ex depth -.2ex\hss}}

% First level of itemize uses a square
\renewcommand\labelitemi{\MySquare}

\begin{document}

\tableofcontents

\chapter{Test Chapter One}
\section{Test Section One One}
\begin{itemize}
\item First item.
\item Second item.
\item Third item.
\end{itemize}
\section{Test Section One Two}
\chapter{Test Chapter Two}
\chapter{Test Chapter Three}

\end{document}

An image of the ToC showing the requested formatting for the entries, and an image of the first numbered chapter, showing the desired chapter titles formatting, the use of a black square in itemize and the section titles formatting:

enter image description here

enter image description here

There's a little detail that deserves some thought: the black box used to typeset the chapter number; in the code above I used a \parbox of fixed width (I chose 1cm) and this will be insufficient for "large" roman numerals (such as VIII), One option is to increase the width of the \parbox, but then small numerals (such as I) might not look good inside a too wide box. Another option is to have a default width of, say 1cm, and let the widht of the \parbox increase just for those numbers requiring more spacing; here's now the code implementing this idea:

\documentclass{book}
\usepackage{xcolor}
\usepackage[explicit]{titlesec}
\usepackage[dotinlabels]{titletoc}

\newlength\BoxWd
\setlength\BoxWd{1cm}
\newlength\Aux

% chapter tiltes formatting
\titleformat{\chapter}[display]
  {\normalfont\sffamily\bfseries\LARGE}
  {\renewcommand{\thechapter}{\Roman{chapter}}%
    \settowidth\Aux{\textcolor{white}{\Huge\thechapter}}
    \ifnum\Aux>\BoxWd
      \setlength\BoxWd{\Aux}
    \else\fi
    \hspace*{0.5em}\colorbox{black}{%
    \parbox[c][1.2cm][c]{\BoxWd}{%
      \centering\textcolor{white}{\Huge\thechapter}}}}
  {-1ex}
  {\titlerule\vspace{.7ex}\filleft\MakeUppercase{#1}}
  [\vspace{.2ex}\titlerule]
% chapter tiltes spacing
\titlespacing*{\chapter}{0pt}{50pt}{80pt}

% section tiltes formatting
\titleformat{\section}
  {\normalfont\Large\bfseries}{\MySecSquare\ \thesection}{1em}{#1}

% formatting for chapter entries in ToC  
\titlecontents{chapter}
  [1.5em]{}
  {\sffamily\bfseries\contentslabel{1.5em}}
  {\hspace*{-1.5em}}
  {\hfill\sffamily\bfseries\contentspage}
% formatting for section entries in ToC  
\titlecontents{section}
  [3.8em]{}
  {\sffamily\contentslabel{2.3em}}
  {\hspace*{-2.3em}}
  {\titlerule*[1pc]{.}\sffamily\contentspage}

% Square to be used in itemize
\newcommand\MySquare{%
  \leavevmode\hbox to 1.2ex{\hss\vrule height .9ex width .7ex depth -.2ex\hss}}
% Square to be used in section titles
\newcommand\MySecSquare{%
  \leavevmode\hbox to 1.2ex{\hss\vrule height 1.3ex width 1.1ex depth -.2ex\hss}}

% First level of itemize uses a square
\renewcommand\labelitemi{\MySquare}

\begin{document}

\tableofcontents

\chapter{Test Chapter One}
\setcounter{chapter}{17}% just for the example
\chapter{Test Chapter Eighteen}

\end{document}

An image of the titles for chapters I and XVIII:

enter image description here

enter image description here