2

enter image description here

I want to create a horizontal line before and after chapter heading (as shown in Picture) Chapter number at the Right hand side and chapter title at the middle. SO far I have this piece of code:

\titleformat{\chapter}[display]
  {\bfseries\huge}
  {\filleft\Large\chaptertitlename~\thechapter}
  {3ex}
  {\titlerule\vspace{1.5ex}\filright}
  [\vspace{1ex}\titlerule]

But the output is not what i want. Horizontal Lines are appearing on table of contents,figures and tables too(I have back-end content table) and also chapter title is right aligned

Line is appearing before and after the heading

albert
  • 1,313

1 Answers1

3

If I understand well your problem, you can use the numberless key to have a different format for unnumbered chapters:

\documentclass{book}%
\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}%
\usepackage{fourier}
\usepackage[pagestyles, clearempty]{titlesec}
\usepackage{lipsum}

\titleformat{\chapter}[display]
{\bfseries\huge}
{\filleft\Large\chaptertitlename~\thechapter}
{3ex}
{\titlerule\vspace{1.5ex}\filright}
[\vspace{1ex}\titlerule]

\titleformat{name=\chapter, numberless}[block]
{\bfseries\huge}
{}
{0pt}
{\filright}

\begin{document}

\tableofcontents

\chapter{Estimation, Propagation and Validation of Measurement Uncertainty}

\lipsum[1-6]

\end{document} 

enter image description here

Bernard
  • 271,350
  • 1
    I posted a follow-up question here (https://tex.stackexchange.com/questions/625083/adding-horizontal-line-before-and-after-chapter-heading-in-scrbook), which asks how to make this code work for the documentclass scrbook rather than book (as this one uses).

    Also, that question shows a slightly improved version of this code here, and most notably it includes a bunch of screenshots. (Just FYI.)

    – Prof.Chaos Dec 06 '21 at 02:50