0

In my document I only use \part and \chapter. That makes my table of contents look like strange. Is there a way to display my parts as chapers and my chapters as sections please? I tried whith the package tocstyle.

\documentclass[a4paper,french,12pt]{book}
\usepackage{babel} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[includeheadfoot,margin=0.5in]{geometry}
\usepackage{fancyhdr}
\fancyhf{}
\lfoot{FAVIER David}
\rfoot{\thepage\ sur \pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{1.0pt}
\pagestyle{fancy}
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}
\def\@makechapterhead#1{%
  %\vspace*{50\p@}%
  \vspace*{10\p@}%
  {\parindent \z@ \centering \reset@font
        \thickhrulefill\quad
        \scshape \@chapapp{} \thechapter
        \quad \thickhrulefill
        \par\nobreak
        \vspace*{10\p@}%
        \interlinepenalty\@M
        \hrule
        \vspace*{10\p@}%
        \Huge \bfseries #1\par\nobreak
        \par
        \vspace*{10\p@}%
        \hrule
    %\vskip 40\p@
    \vskip 100\p@
  }}
\def\@makeschapterhead#1{%
  %\vspace*{50\p@}%
  \vspace*{10\p@}%
  {\parindent \z@ \centering \reset@font
        \thickhrulefill
        \par\nobreak
        \vspace*{10\p@}%
        \interlinepenalty\@M
        \hrule
        \vspace*{10\p@}%
        \Huge \bfseries #1\par\nobreak
        \par
        \vspace*{10\p@}%
        \hrule
    %\vskip 40\p@
    \vskip 100\p@
  }}
\begin{document}
\tableofcontents
\part{Part 1}
\chapter{Chapter 1}
\chapter{Chapter 2}
\chapter{Chapter 3}
\chapter{Chapter 4}
\section{Section}
\part{Part 2}
\chapter{Chapter 1}
\chapter{Chapter 2}
\chapter{Chapter 3}
\chapter{Chapter 4}
\end{document}

enter image description here

Thanks for your help.

6
  • Why din't you use \chapter and \sections from the start?
    – Johannes_B
    Nov 5, 2016 at 17:00
  • Actually I'm using sections and subsections in the document but without being numbering : \section*{}.. I would like to change the table of contents
    – Zanzi
    Nov 5, 2016 at 17:02
  • 1
    \makeatletter \let\l@part\l@chapter \let\l@chapter\l@section\makeatother
    – Johannes_B
    Nov 5, 2016 at 17:02
  • Use \setcounter{secnumdepth}{0} to have unnumbered sections by default.
    – Johannes_B
    Nov 5, 2016 at 17:03
  • Thank you. Would you please post that in the answer section so I mark my question as answered.
    – Zanzi
    Nov 5, 2016 at 17:07

1 Answer 1

0

Quick and dirty

\makeatletter
\let\l@part\l@chapter 
\let\l@chapter\l@section
\makeatother

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.