aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2014-12-17 02:56:24 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2014-12-17 02:56:24 -0500
commit91246f7e2ca9d473b451e7325f5daeacf55d1f21 (patch)
tree1b7fbd489813c7c80e62c533d4bdfc5a02463a71
parentcfc3b5fc0ec67ba43c4ef6897195ae9624516a31 (diff)
downloadwmletterhead-91246f7e2ca9d473b451e7325f5daeacf55d1f21.tar.gz
wmletterhead-91246f7e2ca9d473b451e7325f5daeacf55d1f21.zip
address goes to the right header on the first page
-rw-r--r--wmletterhead.cls31
1 files changed, 31 insertions, 0 deletions
diff --git a/wmletterhead.cls b/wmletterhead.cls
index ef23549..ebb66e7 100644
--- a/wmletterhead.cls
+++ b/wmletterhead.cls
@@ -110,6 +110,13 @@
\renewcommand{\headrulewidth}{0pt}%
\fancyfoot[C]{\thepage}%
}
+
+\newcommand{\wmaddress}{
+ {\raggedleft\begin{tabular}{l@{}}\ignorespaces
+ \fromaddress \\*[2\parskip]%
+ \@date \end{tabular}}%
+}
+
\fancypagestyle{firstpage}{% looks like this has no effect for the letter class
\wmheader{}%
}
@@ -118,6 +125,30 @@
}
\fancypagestyle{empty}{% some how this is the very first page style
\wmheader{}%
+ \settoheight{\headheight}{\hbox{\wmaddress}}%
+ \newlength{\wmaddresswidth}
+ \settowidth{\wmaddresswidth}{\hbox{\wmaddress}}%
+ \newlength{\wmaddresshpos}
+ \setlength{\wmaddresshpos}{\paperwidth}
+ \addtolength{\wmaddresshpos}{-\wmrightmargin}
+ \addtolength{\wmaddresshpos}{-\wmaddresswidth}
+ \fancyhead[R]{%
+ \begin{textblock*}{\wmaddresswidth}(\wmaddresshpos{},\wmlogovpos{})%
+ \wmaddress{}%
+ \end{textblock*}%
+ }%
}
\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]{\ifx\@empty\fromaddress
+ \thispagestyle{firstpage}%
+ {\raggedleft\@date\par}%
+ \else % home address
+ \thispagestyle{empty}%
+ \fi
+ {\raggedright \toname \\ \toaddress \par}%
+ \vspace{2\parskip}%
+ #1\par\nobreak}
+% -------------------------------------------------------------------