# How to obtain images in the head?

How can I obtain and head like this, with images in it till the limit of the paper, and with a gradient similar to the image?

I have used fancyhdr package any times, but... in a very simple way with only text (Right Center or Left).

-
\includegraphics can also be used in the header. – Heiko Oberdiek Mar 19 '14 at 5:53
I usually use the eso-picpackage to position images in the outmost positions. – Uwe Ziegenhagen Mar 19 '14 at 6:40

A solution with mdframed.

MWE:

\documentclass{article}
\usepackage{graphicx}
\usepackage[framemethod=tikz]{mdframed}

\usepackage{fancyhdr}
\fancyhf{}
\begin{mdframed}[%
innertopmargin=0pt,
innerbottommargin=0pt,
innerleftmargin=0pt,
]
\includegraphics[scale=0.05]{example-image-a}\hfill\raisebox{.3\baselineskip}{\leftmark}
\end{mdframed}%
\fancyfoot[C]{\thepage}
}
\pagestyle{fancy}

\usepackage{lipsum}

\begin{document}

\section{test}
\lipsum[1-10]

\end{document}


-

I would use TikZ and an environment which doesn't affect other typeset material in the header. It can be achived by the pgfinterruptboundingbox environment, then an object has width of 0 pt and height of 0 pt to the surrounding typeset material. I enclose an example as a starting point.

Edit: Next, I wrapped it all in the scope environment to move it all to the left margin of the paper. I changed twice \textwidth to \paperwidth. I usually use absolute positioning offered by TikZ, well, I wished to give scope a chance.

\documentclass[a4paper]{article}
\usepackage{lipsum}
\usepackage{xcolor,tikz}
\usepackage{fancyhdr}\pagestyle{fancy}\fancyhf{}
\def\mysquare{1cm}
\colorlet{myblue}{blue}
\begin{tikzpicture}[inner sep=0pt, outer sep=0pt]
\begin{scope}[xshift=-1in-\hoffset-\oddsidemargin]
\begin{pgfinterruptboundingbox}
\shade[fill=yellow, anchor=west, left color=myblue, right color=myblue!10, xshift=\mysquare] (0,0) rectangle (\paperwidth-\mysquare,\mysquare);
\node[minimum width=\mysquare, minimum height=\mysquare, draw, align=center, font=\bfseries\color{white}, fill=myblue, anchor=south west] at (0,0) (leftside) {MM\\O};
\node[font=\bfseries, anchor=east] at (\paperwidth,0.5\mysquare) {\leftmark\hspace{3mm}\thesection\hspace*{6mm}};
\end{pgfinterruptboundingbox}%
\end{scope}
\end{tikzpicture}%