0

Can anyone help me realize the chapter design shown in the figure? Thank youenter image description here

I am trying to use usepackage titlesec, but I have trouble mimicking the style in the figure. The following is my code. Can someone help me to modify my code to obtain the style shown in the figure? And for these commands like \thechapter, \vspace, where can I find a reference for them?

\titleclass{\chapter}{straight}
\titleformat{\chapter}[display]
{\centering\normalfont\huge\bfseries}
{\titlerule[2pt]\vspace{3pt}\titlerule[2pt]\vspace{3pt}\MakeUppercase{\chaptertitlename} \thechapter}{5pt}
{\titlerule[2pt]\vspace{6pt}\huge\MakeUppercase}

\titlespacing*{\chapter}{0pt}{0pt}{40pt}

Addition:

My latex template is \documentclass{book} and I am satisfied with @egreg's solution regarding the chapter design, but what can I do to adjust the header to the mid place and make the headers of all pages (no matter even or odd) centered and only show the section content?

The figure below is what I want to have (mainly the red circles) enter image description here But what I got is by default from the book template, see figure below enter image description here where one can see

  1. the headers are not centered;
  2. pages from odd and even show different header content.
9
  • Can you provide a complete compilable example which demonstrates a single problem you are having as you attempt to implement the design you want? Without code, your question isn't really answerable.
    – cfr
    Commented Apr 9 at 0:53
  • 2
    tex.stackexchange.com/questions/369443/… (From the links on the right.)
    – cfr
    Commented Apr 9 at 0:54
  • @cfr Thank you for your comments, and I just update my post.
    – hmeng
    Commented Apr 9 at 17:43
  • Could you complete it so people can compile it? I avoid titlesec, but lots of people like it, I know. For the commands you mention, any standard introduction to LaTeX can provide details and examples.
    – cfr
    Commented Apr 9 at 20:37
  • 1
    Basically, \thechapter formats the current chapter number e.g. 1 or VI or D and \vspace{} adds vertical space if it's appropriate according to LaTeX's algorithms e.g. not at the top of a page.
    – cfr
    Commented Apr 9 at 20:51

1 Answer 1

2

You're not too far…

\RequirePackage{fix-cm}
\documentclass[a4paper,oneside]{book}
\usepackage{titlesec}

%\titleclass{\chapter}{straight}% it's already in the class
\titleformat{\chapter}[display]
  {%
   \filleft\normalfont\bfseries
   \vspace{-\topskip}\titlerule[2pt]%
   \vspace{1pc}%
  }
  {\fontsize{3.5cm}{0}\selectfont\thechapter}
  {5pt}
  {\vspace{6pt}\huge\MakeUppercase}
  [{\titlerule[2pt]}]
\titleformat{name=\chapter,numberless}[display]
  {%
   \filleft\normalfont\bfseries
   \vspace{-\topskip}\titlerule[2pt]%
   \vspace{1pc}%
  }
  {\fontsize{3.5cm}{0}\selectfont\vphantom{0}}
  {5pt}
  {\vspace{6pt}\huge\MakeUppercase}
  [{\titlerule[2pt]}]

\titlespacing*{\chapter}{0pt}{0pt}{40pt}

\begin{document}

\tableofcontents

\chapter{Introduction}

Text at the beginning of the chapter.
Text at the beginning of the chapter.
Text at the beginning of the chapter.
Text at the beginning of the chapter.
Text at the beginning of the chapter.

\end{document}

The oneside option is just for showing unnumbered and numbered chapters in the same picture.

If you use a scalable font (not the standard one), you don't need fix-cm.

enter image description here

By replacing the two occurrences of \filleft with \filcenter, you get the following.

enter image description here

9
  • May I ask why do we need % to do line break?
    – hmeng
    Commented Apr 10 at 1:03
  • 1
    @hmeng A line break is a space.
    – cfr
    Commented Apr 10 at 1:23
  • Oh, I forget to mention that the centering head is also one of the thing I wanna realize, but I have no clue about to use it. I checked fancyhdr document, but is totally lost
    – hmeng
    Commented Apr 10 at 1:56
  • @hmeng Change the two occurrences of \filleft with \filcenter. I added the output in my answer.
    – egreg
    Commented Apr 10 at 9:34
  • @egreg Maybe my statement is misleading, what I mean is the header design. (the very first lane in my figure page 2) How can I get a similar header as the figure shown? Thank you !
    – hmeng
    Commented Apr 10 at 13:56

You must log in to answer this question.

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