From f8b59443812f5bd553202078503c44e121680f55 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Sun, 28 Dec 2014 01:44:40 -0500 Subject: fancy header simplified, wmheader hand crafted --- wmletterhead.cls | 78 +++++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 43 deletions(-) (limited to 'wmletterhead.cls') diff --git a/wmletterhead.cls b/wmletterhead.cls index fdb0ba2..5edf14b 100644 --- a/wmletterhead.cls +++ b/wmletterhead.cls @@ -75,6 +75,7 @@ \newlength{\wmlogohpos} \newlength{\wmlogovpos} \newlength{\wmlogoWhpos} % distance from the left logo edge to the 'W' in William +\newlength{\wmlogoWvpos} % distance from the top logo edge to the 'W' in William % below are measured in the Word template \setlength{\wmlogoheight}{0.65in} @@ -82,6 +83,7 @@ \setlength{\wmlogohpos}{0.76in}% ideally should be calculated from \wmleftmargin and \wmlogoheight \setlength{\wmlogovpos}{0.75in}% same as above \setlength{\wmlogoWhpos}{0.82in}% same as above +\setlength{\wmlogoWvpos}{0.50in}% same as above % -------------------------------------------------- % Required by WM @@ -102,6 +104,8 @@ \newlength{\wmaddressheight} % to be calculated at the opening +\newlength{\wmaddresswidth} +\newlength{\wmaddresshpos} % -------------------------------------------------- % -------------------------------------------------- @@ -122,22 +126,8 @@ } - +% ------------------------------------------------------------------- %% WM fancy letter head definition -\newcommand{\wmheader}{ - \fancyhf{}% - \fancyhead[L]{% -% \begin{textblock*}{\wmlogowidth}(\wmlogohpos{},\wmlogovpos{})% -%\adjustbox{valign=t}{ - \hskip -\wmlogoWhpos - \includegraphics[height=\wmlogoheight{},keepaspectratio=true]{\wmheaderlogo}% -%} -% \end{textblock*}% - }% - \renewcommand{\headrulewidth}{0pt}% - \fancyfoot[C]{\thepage}% -} - \newcommand{\wmaddress}{ \ifx\@empty\fromaddress {} @@ -149,50 +139,52 @@ \fi } +\newcommand{\setwmaddresssizes}{ + \settototalheight{\wmaddressheight}{\hbox{\wmaddress}}% + \settowidth{\wmaddresswidth}{\hbox{\wmaddress}}% +} + +\newcommand{\wmfromwithlogo}{ + \setwmaddresssizes + \hskip -\wmlogoWhpos + \includegraphics[height=\wmlogoheight{},keepaspectratio=true]{\wmheaderlogo} + \hfill + \parbox[t]{\wmaddresswidth}{ + \wmaddress{} + } +} + + +% ------------------------------------------------------------------- +% fancyheader definitions +% this is very rudimentary and probably not needed \fancypagestyle{empty}{% looks like this has no effect for the letter class - \wmheader{}% + \renewcommand{\headrulewidth}{0pt} + \fancyfoot[C]{\thepage}% } \fancypagestyle{plain}{% this takes care of the 2nd and the following pages - %\wmheader{}% + \renewcommand{\headrulewidth}{0pt} \fancyfoot[C]{\thepage}% + \renewcommand{\headrulewidth}{0pt} } \fancypagestyle{firstpage}{% some how this is the very first page style - \wmheader{}% - \newlength{\wmaddresswidth} - \settowidth{\wmaddresswidth}{\hbox{\wmaddress}}% - \newlength{\wmaddresshpos} - \setlength{\wmaddresshpos}{\paperwidth-\wmrightmargin-\wmaddresswidth} - \fancyhead[R]{% - %\begin{textblock*}{\wmaddresswidth}(\wmaddresshpos{},\wmlogovpos{})% - \wmaddress{}% - %\end{textblock*}% - }% + \renewcommand{\headrulewidth}{0pt} + \fancyfoot[C]{\thepage}% + \renewcommand{\headrulewidth}{0pt} } -\pagestyle{plain}% important! if switched to fancy pages 2, 3, ... do not have logo +\pagestyle{plain}% important! if switched to fancy pages 2, 3, ... do not have logo % ------------------------------------------------------------------- % Now let redefine opening so address goes to the right of logo \renewcommand*{\opening}[1]{ - \settototalheight{\wmaddressheight}{\hbox{\wmaddress}}% - % redefine margins to include headers for the first page only - \AddThispageHook{ - \newgeometry{ - top=\wmtopmargin, - left=\wmleftmargin, - right=\wmrightmargin, - bottom=\wmbottommargin, - marginparwidth=0in, - marginparsep=0in, - includehead, - headsep=\wmlogoseparation, - headheight=\wmaddressheight - } - } + \setwmaddresssizes \thispagestyle{firstpage}% + \wmfromwithlogo + \vskip \wmlogoseparation {\raggedleft\@date\par}% {\raggedright \toname \\ \toaddress \par}% %\vspace{2\parskip}% -- cgit v1.2.3