I created a letter featuring a header (with a logo at the right) and a footer holding some information. I would like to create a scrreprt
document with the same header/footer layout. What's the easiest way to port? Especially, I want to use scrlttr2 komavars
in the report, and also I'd like to have variables in one file only.
I'm grateful for any suggestion and for any direction-pointing on how to approach this!
This is the code for the letter:
\documentclass[
fontsize=11pt, % fontsize
paper=a4, % page size a4
firsthead=on, % display header on first page
firstfoot=on, % display footer on first page
pagenumber=off, % position of the page number
parskip=half, % Use indent instead of skip, half, false
enlargefirstpage=on, % more space on first page
fromalign=left, % placement of name in letter head
fromrule=afteraddress, % separate the address with a line in letter head, false or aftername
fromemail=off, % turn on email of sender
fromurl=off, % print URL of sender
fromphone=off, % turn on phone of sender
fromlogo=off, % turn on logo of sender
addrfield=on, % address field for envelope with window, on or true
subject=titled, % placement of subject, beforeopening or titled
foldmarks=off, % print foldmarks
numericaldate=off, % display date in numbers only
KOMAold]{scrlttr2}
% http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguien.pdf
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[dvips]{graphicx}
\usepackage[german]{babel}
\usepackage{lipsum}
\usepackage{lmodern}
\usepackage{lastpage}
\usepackage[rgb]{xcolor}
\usepackage{hyperref}
\usepackage{varwidth}
\hypersetup{%
pdfborder=0 0 0,
pdfauthor={},
pdftitle={},
pdfsubject={},
pdfkeywords={},
pdfpagemode={UseOutlines},
bookmarksopen,
pdfstartview={FitH},
colorlinks,
linkcolor={blue},
citecolor={red},
urlcolor={blue}
}
% Information in the header
\newcommand*{\headbox}{
\usekomafont{pagenumber}
\parbox[b]{\linewidth}{\noindent
\hfill
% \mbox{\includegraphics[draft,width=0.42\linewidth]{logo.png}}
\mbox{\rule{8cm}{2cm}}
}
}
% Information in the footer
\newcommand*{\footbox}{
\parbox[t]{\textwidth}{\sffamily\footnotesize
\begin{tabular}[t]{@{}l@{}}%
Mister Bean Club\\
\usekomavar{chairmanname}\\
\usekomavar{chairmanstreet}\\
\usekomavar{chairmancity}
\end{tabular}%
\hfill
\begin{tabular}[t]{@{}l@{}}%
\usekomavar{fromphone}\\
\usekomavar{fromfax}\\
\usekomavar{fromemail}\\
\usekomavar{fromurl}
\end{tabular}%
\hfill
\begin{tabular}[t]{@{}l@{}}%
\usekomavar{frombank}
\end{tabular}
}
}
\firsthead{\headbox}
\firstfoot{\footbox}
\setlength{\headsep}{4.5cm}
\setlength{\textheight}{8in}
\makeatletter
\@setplength{sigbeforevskip}{8ex} % 0ex space after the signature
\@setplength{toaddrwidth}{7cm}
\@addtoplength{firstheadvpos}{0mm} % 4.5mm position of header
\@addtoplength{firstfootvpos}{-8mm} % -8mm or -1ex position of footer
\makeatother
\newkomavar{fromstreet}
\newkomavar{fromcity}
\newkomavar{chairmanname}
\newkomavar{chairmanstreet}
\newkomavar{chairmancity}
\newkomavar{tostreet}
\newkomavar{tocity}
\setkomavar{date}[]{\today}
\setkomavar{place}{New York}
% scrlttr2: full sender information
\setkomavar{fromaddress}{\usekomavar{fromstreet}\\\usekomavar{fromcity}}
% chairman address information
\setkomavar{chairmanname}{Mister Bean}
\setkomavar{chairmanstreet}{Main Street 42}
\setkomavar{chairmancity}{12345 New York}
\setkomavar{backaddress}{%
\begin{varwidth}{\useplength{toaddrwidth}}
{%
MBC \usekomavar{backaddressseparator}\usekomavar{fromname}\\
\usekomavar{fromstreet}\usekomavar{backaddressseparator}\usekomavar{fromcity}}
\end{varwidth}%
}
\setkomavar{backaddressseparator}{~{$\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}$} }
% scrlttr2: align phone & fax numbers
\newlength{\fromphoneWidth}
\settowidth{\fromphoneWidth}{Telefon\enskip}
\setkomavar{fromphone}{\makebox[\fromphoneWidth][l]{Telefon}(0123) 456 78 90}
\setkomavar{fromfax}{\makebox[\fromphoneWidth][l]{Telefax}(0123) 456 78 90}
\setkomavar{fromemail}{[email protected]}
\setkomavar{fromurl}{www.misterbeanclub.com}
\setkomavar{frombank}{Bank New York\\
BIC / IBAN\enskip{}ABCDEFGH\\
US12 3456 7890 0000 0000 00\\
Tax-ref. 123/456/7890}
\setkomavar{toaddress}{\usekomavar{tostreet}\\
\vspace{\baselineskip} % cannot use \\ here
\usekomavar{tocity}
}
\setkomavar{fromname}{\usekomavar{chairmanname}}
\setkomavar{fromstreet}{\usekomavar{chairmanstreet}}
\setkomavar{fromcity}{\usekomavar{chairmancity}}
\setkomavar{subject}{title of the subject}
\setkomavar{signature}{Mister Bean}
\setkomavar{toname}{Receivers \& Co.}
\setkomavar{tostreet}{Vor dem Berg 1}
\setkomavar{tocity}{12345 Musterhausen}
\begin{document}
\begin{letter}{}
\vspace*{0ex} % Correct for vertical displacement
\opening{Dear Sir/Madam,}
\lipsum[3-4]
\closing{Sincerely,}
\end{letter}
\end{document}