aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2014-12-17 10:05:07 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2014-12-17 10:05:07 -0500
commit869acd61a11354f3436bdad124078b981aaae8e6 (patch)
treea15a7bcd6d62a7b58517332d40aa290f78362b46
parent2f7bda1c7112a9adee01748630c31326484aa5ff (diff)
downloadwmletterhead-869acd61a11354f3436bdad124078b981aaae8e6.tar.gz
wmletterhead-869acd61a11354f3436bdad124078b981aaae8e6.zip
use 'calc' package to simplify math
-rw-r--r--wmletterhead.cls22
1 files changed, 11 insertions, 11 deletions
diff --git a/wmletterhead.cls b/wmletterhead.cls
index ebb66e7..45fea3a 100644
--- a/wmletterhead.cls
+++ b/wmletterhead.cls
@@ -58,7 +58,11 @@
\ProcessOptions\relax
\LoadClass{letter}
+\RequirePackage{calc}
+
+% --------------------------------------------------
+% WM logos parameters
\newlength{\wmlogoheight}
\newlength{\wmlogowidth}
\newlength{\wmlogohpos}
@@ -66,14 +70,14 @@
% below are measured in the Word template
\setlength{\wmlogoheight}{0.65in}
-\setlength{\wmlogowidth}{3.64in}
-\setlength{\wmlogohpos}{0.76in}%
-\setlength{\wmlogovpos}{0.75in}%
+\setlength{\wmlogowidth}{3.64in}% ideally should be scaled from \wmlogoheight
+\setlength{\wmlogohpos}{0.76in}% ideally should be calculated from \wmleftmargin and \wmlogoheight
+\setlength{\wmlogovpos}{0.75in}% same as above
% --------------------------------------------------
% Required by WM
\newlength{\wmlogoseparation}
-\setlength{\wmlogoseparation}{0.5in}
+\setlength{\wmlogoseparation}{0.5in} % header text from main text separation
\newlength{\wmleftmargin}
\setlength{\wmleftmargin}{1.64in}
@@ -88,13 +92,11 @@
% --------------------------------------------------
% Let's calculate top margin
\newlength{\wmtopmargin}
-\setlength{\wmtopmargin}{\wmlogoheight}%
-\addtolength{\wmtopmargin}{\wmlogovpos}%
-\addtolength{\wmtopmargin}{\wmlogoseparation}%
+\setlength{\wmtopmargin}{\wmlogoheight+\wmlogovpos+\wmlogoseparation}%
% --------------------------------------------------
\RequirePackage{graphicx}
-\RequirePackage[top=\wmtopmargin, left=\wmleftmargin, right=\wmrightmargin, bottom=\wmbottommargin, letterpaper]{geometry}
+\RequirePackage[top=\wmtopmargin, left=\wmleftmargin, right=\wmrightmargin, bottom=\wmbottommargin, letterpaper, showframe]{geometry}
\RequirePackage[absolute]{textpos}
\RequirePackage{fancyhdr}
@@ -129,9 +131,7 @@
\newlength{\wmaddresswidth}
\settowidth{\wmaddresswidth}{\hbox{\wmaddress}}%
\newlength{\wmaddresshpos}
- \setlength{\wmaddresshpos}{\paperwidth}
- \addtolength{\wmaddresshpos}{-\wmrightmargin}
- \addtolength{\wmaddresshpos}{-\wmaddresswidth}
+ \setlength{\wmaddresshpos}{\paperwidth-\wmrightmargin-\wmaddresswidth}
\fancyhead[R]{%
\begin{textblock*}{\wmaddresswidth}(\wmaddresshpos{},\wmlogovpos{})%
\wmaddress{}%