0

I used the below code to format chapter headings

\usepackage{titlesec}
\titleformat{\chapter}[display]% command + shape
{%
 \normalfont
 \Large
 \filcenter
 \sffamily
} % format
{%
 \vspace*{\fill}
 \titlerule[1pt]%
 \vspace{1pt}%
 \titlerule
 \vspace{1pc}%
 \LARGE\MakeUppercase{\chaptertitlename}~\thechapter%
}% label
{
 1pc
}% separation
{
 \titlerule[3pt]
 \Huge
} % before
[%
 \vspace*{\fill}
 \thispagestyle{empty}
 \clearpage
 \addtocounter{page}{-1}
]% after

It formats the headings of table of contents and list of figures also. I don't want this format to be applied on table of contents and list of figures heading. How can I do that?

2 Answers 2

2

You need to add code for the numberless variety. Something like this:

\documentclass[oneside]{book}
\usepackage{titlesec}

\titleformat{name=\chapter}[display]% command + shape
  {\normalfont\Large\sffamily\filcenter} % format
  {\vspace*{\fill}\titlerule[1pt]\vspace{1pt}\titlerule\vspace{1pc}%
   \LARGE\MakeUppercase{\chaptertitlename}~\thechapter}% label
  {1pc}% separation
  {\titlerule[3pt]\Huge} % before
  [\vspace*{\fill}\thispagestyle{empty}\clearpage\addtocounter{page}{-1}]% after

\titleformat{name=\chapter,numberless}[display]
  {\normalfont\Huge\sffamily\filcenter}
  {}
  {0pt}
  {}


\begin{document}

\frontmatter

\tableofcontents

\mainmatter

\chapter{Test}

This is the text of the chapter.

\end{document}

enter image description here

I don't like this very much, to be honest. Probably the “chapter 1” part should be higher and the title much farther than it and take the vertical center of the page.

Suppressing the page number is not a good idea, in my opinion.

1
  • Can you give the latex code for the suggestions you have made.
    – abrar syed
    Commented Jan 4, 2021 at 16:20
0

Just use the tocloft package which sets the ToC, etc., titles in the regular format.

% toctitleprob.tex  SE 577538

\documentclass{report}
\usepackage{tocloft}   %%%% new
\usepackage{titlesec}
\titleformat{\chapter}[display]% command + shape
{%
 \normalfont
 \Large
 \filcenter
 \sffamily
} % format
{%
 \vspace*{\fill}
 \titlerule[1pt]%
 \vspace{1pt}%
 \titlerule
 \vspace{1pc}%
 \LARGE\MakeUppercase{\chaptertitlename}~\thechapter%
}% label
{
 1pc
}% separation
{
 \titlerule[3pt]
 \Huge
} % before
[%
 \vspace*{\fill}
 \thispagestyle{empty}
 \clearpage
 \addtocounter{page}{-1}
]% after

\begin{document}
\tableofcontents

\chapter{First}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .