blob: 0d3b28d056c0303df5f64b05e1fe9ec378a52a71 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{wmletterhead}[2014/12/15 provides LaTeX WM letter head class]
% Created by Eugeniy E. Mikhailov
% v1.0 2014/12/15
% Note logo files belong to W&M
% 'wmletterhead' class accepts all options of the 'letter' class and the following
% additional options which specify the header logo
% prior2014dec - old logo prior 2014
% fullcolor - full color logo with yellowish WM cypher
% black - all black logo
% green - all green logo
% white - all white logo (quite use less on white background)
% DEFAULT options: [fullcolor]
% Recomended use:
% \documentclass[12pt,fullcolor]{wmletterhead}
%-------------- define WM header logo file ---------------------------------
\providecommand{\wmheaderlogo}{}% nologo
% this is prior December 2014 logo with Wren building
\DeclareOption{prior2014dec}{%
\renewcommand{\wmheaderlogo}%
{wmlogos/wmheader2012}%
}
% full colored logo starting from December 2014
\DeclareOption{fullcolor}{%
\renewcommand{\wmheaderlogo}%
{wmlogos/wm_horizontal_single_line_full_color}%
}
% green logo starting from December 2014
\DeclareOption{green}{%
\renewcommand{\wmheaderlogo}%
{wmlogos/wm_horizontal_single_line_green}%
}
% black logo starting from December 2014
\DeclareOption{black}{%
\renewcommand{\wmheaderlogo}%
{wmlogos/wm_horizontal_single_line_black}%
}
% black logo starting from December 2014
\DeclareOption{white}{%
\renewcommand{\wmheaderlogo}%
{wmlogos/wm_horizontal_single_line_white}%
}
%-------------- end of define WM header logo file ------------------------------
% by default all unknown options are passed to 'letter' class
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{letter}}
% DEFAULT options
\ExecuteOptions{fullcolor}
\ProcessOptions\relax
\LoadClass{letter}
\RequirePackage{calc}
% --------------------------------------------------
% WM logos parameters
\newlength{\wmlogoheight}
\newlength{\wmlogowidth}
\newlength{\wmlogohpos}
\newlength{\wmlogovpos}
% below are measured in the Word template
\setlength{\wmlogoheight}{0.65in}
\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} % header text from main text separation
\newlength{\wmleftmargin}
\setlength{\wmleftmargin}{1.64in}
\newlength{\wmrightmargin}
\setlength{\wmrightmargin}{1.0in}
\newlength{\wmbottommargin}
\setlength{\wmbottommargin}{1.0in} % guessed
% --------------------------------------------------
% --------------------------------------------------
% Let's calculate top margin
\newlength{\wmtopmargin}
\setlength{\wmtopmargin}{\wmlogoheight+\wmlogovpos+\wmlogoseparation}%
% --------------------------------------------------
\RequirePackage{graphicx}
\RequirePackage[top=\wmtopmargin, left=\wmleftmargin, right=\wmrightmargin, bottom=\wmbottommargin, letterpaper, showframe]{geometry}
\RequirePackage[absolute]{textpos}
\RequirePackage{fancyhdr}
%% WM fancy letter head definition
\newcommand{\wmheader}{
\fancyhf{}%
\fancyhead[L]{%
\begin{textblock*}{\wmlogowidth}(\wmlogohpos{},\wmlogovpos{})%
\includegraphics[height=\wmlogoheight{},keepaspectratio=true]{\wmheaderlogo}%
\end{textblock*}%
}%
\renewcommand{\headrulewidth}{0pt}%
\fancyfoot[C]{\thepage}%
}
\newcommand{\wmaddress}{
\ifx\@empty\fromaddress
{}
\else
\raggedleft%
\begin{tabular}{l@{}}\ignorespaces
\fromaddress%
\end{tabular}%
\fi
}
\fancypagestyle{empty}{% looks like this has no effect for the letter class
\wmheader{}%
}
\fancypagestyle{plain}{% this takes care of the 2nd and the following pages
%\wmheader{}%
\fancyfoot[C]{\thepage}%
}
\fancypagestyle{firstpage}{% 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-\wmrightmargin-\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]{
\thispagestyle{firstpage}%
{\raggedleft\@date\par}%
{\raggedright \toname \\ \toaddress \par}%
%\vspace{2\parskip}%
#1\par\nobreak}
% -------------------------------------------------------------------
|