# How to create Fancy Title Headers

I want to create a Fancy Title Header for an Article, like the one shown below:

Can someone please provide some hint on how to achieve this?

-
Do you mean a header (as in header/footer) or are you referring to the title of a sectional unit, like \section? –  Gonzalo Medina Aug 17 '12 at 17:10
I was looking for a title of a sectional unit. Thanks. –  Sandeep Singh Aug 18 '12 at 2:55

Here's a solution using titleps:

\documentclass{article}
\usepackage{titleps}
\usepackage{xcolor}
\usepackage{lipsum}

\newcommand\HeaderTitle{Time For Action -- Embedding a picture within text}
{
}
\begin{document}

\lipsum[1-3]

\end{document}


The idea is to use a new page style using a \parbox of width equal to \textwidth inside a \colorbox.

Here's the same idea but using now fancyhdr:

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{xcolor}
\usepackage{lipsum}

\newcommand\HeaderTitle{Time For Action -- Embedding a picture within text}

\fancyhf{}
\fancyhf[C]{\colorbox{black}{\parbox{\dimexpr\textwidth-2\fboxsep\relax}{%
\pagestyle{fancy}

\begin{document}

\lipsum[1-3]

\end{document}


Now that I reread the question, I am not sure if a header (as in header/footer) was required or if the question is about the tiles for a sectional unit (\section, for example). My two examples above solve the first case; for the second case, here's a solution with titlesec (in both cases the idea for the solution reamains the same):

\documentclass{article}
\usepackage[explicit]{titlesec}
\usepackage{xcolor}
\usepackage{lipsum}

\titleformat{\section}
{\normalfont\large\sffamily\bfseries}{}{0em}
{\colorbox{black}{\parbox{\dimexpr\textwidth-2\fboxsep\relax}{%
\titleformat{name=\section,numberless}
{\normalfont\large\sffamily\bfseries}{}{0em}
{\colorbox{black}  {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{%
\textcolor{white}{#1}}}}

\begin{document}

\lipsum[2]
\section*{Time For Action -- Embedding a picture within text}
\lipsum[2]

\end{document}


-