Creating letters with zero-margin colored headers, in addition to the regular letterhead
I am using a hack in a similar situation: I have designed an A4-sized PDF that contains all the static information like colored boxes, logos and so on. This is placed into the background of a page. The letter proper is typeset on top of that using the dinbrief
class that is geared towards letters in German.
\documentclass[11pt]{dinbrief}
\usepackage[utf8]{inputenc}
\usepackage{graphics}
\address{}
\centeraddress
\textwidth12cm
\setaddresswidth{75mm}
\setaddressheight{40mm}
\setaddressllcorner{25mm}{90mm}
\setbottomtexttop{270mm} % x from top of page
\bottomtext{\kern27mm% % y from bottom of page; x+y=297mm
\vbox to 0pt{\vss\hbox to 0pt{\kern-2.5cm
\includegraphics{letterheads/head-lzi-cl.pdf}\hss}}}
\signature{Christian Lindig}
\place{Saarbrücken}
\nowindowrules
\begin{document}
\begin{letter}
{Prof. Drov Nuts\\
St. Anford\\
USA}
\subject{Ut enim ad minim veniam, quis nostrud exercitation}
\opening{Sehr geehrter Herr Prof. Drov Nuts,}
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
\closing{Mit freundlichem Gruß}
\end{letter}
\end{document}
The crucial bits are \bottomtext
where the PDF is included, put in the background and shifted such that it is properly aligned. The obvious advantage is that I can design the background PDF with any program I like and don't have to re-create the design in LaTeX.
You can do this with fancyhdr
. I had to include a random 1.5ex
space to get things "right."
\documentclass{letter}
\usepackage[demo]{graphicx}% The demo option creates a black box instead of a figure
\usepackage{fancyhdr}
\usepackage{geometry}
\usepackage{calc}
\usepackage{color}
\usepackage{lipsum}% The lipsum package provides dummy text
\fancypagestyle{firstpage}{%
\renewcommand{\headrulewidth}{0pt}%
\renewcommand{\footrulewidth}{0pt}%
\fancyhf{}%
\fancyhead[L]{\colorbox{red}{\parbox[b][\headheight-\baselineskip]{\headwidth}{\vfil{}some text\\some more text\vfil}}}%
\fancyhead[R]{\vfil\includegraphics[height = 1cm]{MyLogo.pdf}\hspace*{1.5ex}\vfil}%
}%
\fancypagestyle{empty}{%
\renewcommand{\headrulewidth}{0pt}%
\renewcommand{\footrulewidth}{0pt}%
\fancyhf{}%
\fancyhead[L]{\colorbox{red}{\parbox[b][\headheight-\baselineskip]{\headwidth}{\vfil{}some text\\some more text\vfil}}}%
\fancyhead[R]{\vfil\includegraphics[height = 1cm]{MyLogo.pdf}\hspace*{1.5ex}\vfil}%
}%
\fancypagestyle{plain}{%
\renewcommand{\headrulewidth}{0pt}%
\renewcommand{\footrulewidth}{0pt}%
\fancyhf{}%
\fancyhead[L]{\colorbox{red}{\parbox[b][\headheight-\baselineskip]{\headwidth}{\vfil{}some alt text\\some more alt text\vfil}}}%
\fancyhead[R]{\vfil\includegraphics[height = 1cm]{MyLogo.pdf}\vfil}%
}
\setlength{\fboxsep}{0pt}
\geometry{top = 4cm, headheight = 4cm}
\fancyhfoffset[L]{\oddsidemargin + \hoffset + 1in}
\fancyhfoffset[R]{\evensidemargin + \marginparwidth - \marginparsep}
\name{My Name}
\address{My University\\My Road\\My City}
\telephone{(555) 555-5555}
\signature{My Nickname}
\pagestyle{plain}
\begin{document}%
\begin{letter}{%
Some Name\\%
Some Department\\%
Some University\\%
Some Road\\%
Some City%
}%
\opening{Dear \toname{},}\hfil
In this 1+ page letter the header and footer on the first page are different from the other pages. If the address macro is used the first page style is ``empty'' otherwise it is ``firstpage''
\lipsum[1-8]
\closing{Sincerely,}
\end{letter}%
\end{document}%