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

1 Answer 1

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

1
  • 1
    I posted a follow-up question here (tex.stackexchange.com/questions/625083/…), 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 6, 2021 at 2:50

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.