2

I want to modify the section headers. Every time I create a new section, I want a simple card (something similar to a title page: something like the first answer on this question Creating a titlepage) to be inserted.

Is there a package that already lets me do this, or do I have to muddle around with the code? Any pointers in the right direction would be very much appreciated!

hRob
  • 21
  • 1
    Welcome to the site! A minimal working example (MWE) will help us out greatly, since some document classes (e.g. memoir) have this functionality built-in, while others (e.g. article) would require a package such as titlesec to be used. A mock-up (MS Paint or similar) of what you're looking for would also be very helpful, to gauge which packages would be best to use. – Paul Gessler May 20 '14 at 18:37
  • I guess you can always go \newpage \section{My section}\cleardoubleemptypage – Mario S. E. May 20 '14 at 18:58
  • So you want that doing \section{A section title} creates a new decorated page with the title "A section title" on it and the text (the contents for the section) would then begin on the next page. Is that correct? – Gonzalo Medina May 20 '14 at 19:28

1 Answers1

2

Here's one possibility using the titlesec package; adjust the settings according to your needs:

\documentclass{article}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{lipsum}% just to generate text for the example

\definecolor{titlepagecolor}{RGB}{0,65,120}

\newcommand\sectionbreak{\clearpage}
\titleformat{\section}[display]
  {%
    \pagecolor{titlepagecolor}\thispagestyle{empty}%
    \normalfont\Huge\bfseries\color{white}\filcenter\titlerule[2pt]\vskip5pt%
  }
  {\thesection}
  {10pt}
  {}
  [{\vskip2pt\titlerule[2pt]\sectionbreak\nopagecolor}]

\begin{document}

\section*{Test unnumbered section}
\lipsum[1-10]
\section{Test numbered section}
\lipsum[1-10]

\end{document}

enter image description here

Gonzalo Medina
  • 505,128