Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

enter image description here

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

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

2 Answers 2

up vote 4 down vote accepted

A solution with mdframed.

MWE:

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

\usepackage{fancyhdr}
\let\oldheadrule\headrule
\renewcommand{\headrule}{\vskip-3\baselineskip\oldheadrule}
\renewcommand\headrulewidth{0pt}
\fancyhf{}
\fancyhead[C]{%
\begin{mdframed}[%
    innertopmargin=0pt,
    innerbottommargin=0pt,
    innerleftmargin=0pt,
    tikzsetting={shade,left color=blue!50,right color=blue!10}
    ]
\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}

enter image description here

share|improve this answer

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{}
\renewcommand{\headrulewidth}{0.0pt}
\def\mysquare{1cm}
\colorlet{myblue}{blue}
\fancyhead[L]{%
\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}%
}% End of \fancyhead...
\begin{document}
\renewcommand{\sectionmark}[1]{%
\markboth{#1}{}}
\section{Enfriamiento simulado}
\lipsum[2]
\end{document}

enter image description here enter image description here

share|improve this answer
    
ok, I use pstricks, but... it´s similar! Thank you, @malipivo –  Mika Ike Mar 19 at 8:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.