5

I would like to make my section headers look like this with the titlesec package. Is there a good way to do that?

EDIT - I am using the scratcl document class.

enter image description here

3
  • 3
    assuming your document class (which you really should have stated) has chapters, \let\section\chapter is probably the easiest way. – David Carlisle Mar 27 '14 at 19:59
  • do you also want them to affect the page style? – cmhughes Mar 27 '14 at 20:13
  • I am not sure but do you really want Chapter 1 or isn't it rather Section 1 and then the name of the section (Introduction here) that you want to get ? – user4686 Mar 27 '14 at 20:51
6

If your document class has chapters, the simpler solution is to say

\let\section\chapter

as David Carlisle mentioned in his comment. After the edit, it is clear that the used class (scrartcl) has no chapters, so (as required) you can use this:

\documentclass{scrartcl}
\usepackage{titlesec}

\newcommand\chaptername{Chapter}
\titleformat{\section}[display]
  {\normalfont\huge\bfseries\sffamily}
  {\chaptername\ \thesection}
  {20pt}
  {\Huge}
\titlespacing*{\section}
  {0pt}{50pt}{40pt}

\begin{document}

\section{A test chapter}
Some test text

\end{document}

enter image description here

If each \section should begin on a page of its own, you might need to add

\newcommand\sectionbreak{\clearpage}

or

\newcommand\sectionbreak{\cleardoublepage}

The above solution, however, this will just imitate some aspects (in particular, the title formatting), but not all of them, of a true \chapter in book, or report. Also, take into account that KOMA classes and titlesec package might not fully cooperate.

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.