diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2014-12-28 01:44:40 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2014-12-28 01:44:40 -0500 |
commit | f8b59443812f5bd553202078503c44e121680f55 (patch) | |
tree | c8c8878525b98d3ce27f280ad5de1ac171d637cb /wmletterhead.cls | |
parent | f817ae2b4d55f4376d6d6bb651ae2474f1028cd4 (diff) | |
download | wmletterhead-f8b59443812f5bd553202078503c44e121680f55.tar.gz wmletterhead-f8b59443812f5bd553202078503c44e121680f55.zip |
fancy header simplified, wmheader hand crafted
Diffstat (limited to 'wmletterhead.cls')
-rw-r--r-- | wmletterhead.cls | 78 |
1 files changed, 35 insertions, 43 deletions
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}% |