1

I'm using the following codes

 \documentclass[a4paper,12pt]{report}
  %------------------------------------------------------------
  \usepackage{amssymb,amsmath,amsthm,latexsym,mathrsfs,amsfonts,dsfont}
  %-----accent                      
 \usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
\chapter{Preliminary}
\end{document}

I hope to get the style of the chapter like this

enter image description here

For unnumbered chapters. I hope to get like this

enter image description here

Student
  • 1,134
  • 2
  • 9
  • 27

3 Answers3

3

With the help of the titlesec package, you can achieve a similar layout:

enter image description here

\documentclass[a4paper,12pt]{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{lipsum}

\usepackage[explicit]{titlesec}

\def\Vhrulefill{\leavevmode\leaders\hrule height 1ex depth \dimexpr0.4pt-0.4ex\hfill\kern0pt}

\titleformat{\chapter}
{\scshape\large}
{}
{0pt}
{\Vhrulefill~\chaptertitlename\ \thechapter~\Vhrulefill\vspace{0.75ex} \hrule\vspace{0.5ex}\centering\bfseries\Huge #1 \vspace{0.25ex}\hrule}


\begin{document}
\chapter{Preliminary}
\lipsum
\end{document}

Vhrulefill is taken from this answer and slightly modified.

leandriis
  • 62,593
3

A solution with titlesec and tabularx:

\documentclass[a4paper,12pt]{report}
  %------------------------------------------------------------
\usepackage{amssymb,amsmath,amsthm,latexsym,mathrsfs,amsfonts,dsfont}
 \usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{tabularx}
\usepackage{lipsum}

\usepackage{titlesec}

\titleformat{\chapter}[display]{\filcenter\Huge\scshape\bfseries}{\begin{tabularx}{\textwidth}{@{}XcX@{}}\titlerule[5pt]& \large\mdseries\raisebox{-1.05ex}{\chaptername\enspace\arabic{chapter}} & \titlerule[5pt]\end{tabularx}}{-1ex}{\hrule\vspace{1ex} }[\vspace{0.75ex}\endgraf\hrule]
\titlespacing*{\chapter}{0pt}{-8ex}{20ex}

\begin{document}

\chapter{Preliminary}

\lipsum[1]

\end{document} 

enter image description here

For unnumbered chapters, you can add this code to your preamble:

\titleformat{name=\chapter, numberless}[display]{\filcenter\Huge\bfseries}% 
{\titlerule[5pt]}{-2.2ex}{\hrule\vspace{1.5ex}}[\vspace{0.75ex}\endgraf\hrule]

enter image description here

Bernard
  • 271,350
  • Dear professor. The problem when I add \chapter*{}. – Student Jul 26 '18 at 12:25
  • 1
    @Student: This code is not designed for unnumbered chapters. What exactly would you like to have for those chapters? – Bernard Jul 26 '18 at 13:14
  • Please see my edit and thank you for your help. Also I would like the number of chapter is arabic. i.e. Capter 1 and not Chapter I. Thanks a lot. – Student Jul 26 '18 at 13:21
  • @Sudent: Please see my updated answer. The trick consists in using the numberless key with \titleformat , and modify the code for this case. – Bernard Jul 26 '18 at 13:49
  • Thank you very much for your answer. Also I would like the number of chapter is arabic. i.e. Capter 1 and not Chapter I. Thanks a lot. – Student Jul 26 '18 at 14:10
  • Just replace in the code \Roman{chapter} with \arabic{chapter}. I've updated the answer (and the screenshot). – Bernard Jul 26 '18 at 14:21
3

For completeness, here it is done in fncychap:

\documentclass{report}
\usepackage{fncychap}
\usepackage{lipsum}
\makeatletter
\ChNameVar{\rm\scshape}
\ChNumVar{\rm}
\ChTitleVar{\huge\rm\scshape\centering}
\ChRuleWidth{5pt}
\renewcommand{\DOCH}{%
  \leavevmode\leaders\vrule height \RW\hfill\quad
  \CNV\FmN{\@chapapp}\space \CNoV\Roman{chapter}%
  \quad\leaders\vrule height \RW\hfill\null
  \par\nobreak
  \vskip 10pt
}
\renewcommand{\DOTI}[1]{%
  \hrule\vskip 10pt
  \CTV\FmTi{#1}\par\nobreak
  \vskip 10pt
  \hrule
  \vskip 40pt}
\renewcommand{\DOTIS}[1]{%
  \hrule\vskip 10pt
  \CTV\FmTi{#1}\par\nobreak
  \vskip 40pt}
\makeatother
\begin{document}
\chapter{Preliminary}
\lipsum[1]
\end{document}

enter image description here

David Purton
  • 25,884