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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
\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 - (default) 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)
% nologo - do not show logo image
% DEFAULT options: [fullcolor]
% Recomended use:
% \documentclass[12pt,fullcolor]{wmletterhead}
\RequirePackage{xcolor}
\RequirePackage{ifthen}
% --------------------------------------------------
% Global flag
\newif\iflogo
% by default we want logo
\logotrue
% --------------------------------------------------
% Tagline color since December 2014
\definecolor{WMgold}{rgb}{0.73,0.59,0.36}
% --------------------------------------------------
% New length to be used for WM specific things
% Page layout specific
\newlength{\wmtopmargin} % start position for address or logo
\newlength{\wmleftmargin}
\newlength{\wmrightmargin}
\newlength{\wmbottommargin}
\newlength{\wmlogoseparation} % distance between logo/from address to the main letter
% WM logos parameters
\newlength{\wmlogoheight}
\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
% --------------------------------------------------
% internal use sizes to lineup logo and from (W&M) address
\newlength{\wmaddressheight} % to be calculated at the opening
% --------------------------------------------------
% set page layout for one-line template
\newcommand*{\setonelinelayout}[1]{
% first parameter intended to be used for layout switch
\def\@layout{#1}%
% --------------------------------------------------
% logo related settings
\setlength{\wmlogoheight}{0.65in}
\setlength{\wmlogoWhpos}{0in}% same as above
\setlength{\wmlogoWvpos}{0in}% same as above
% default page layout parameters
\setlength{\wmlogoseparation}{0.5in} % header text from main text separation
\setlength{\wmleftmargin}{1.0in}
\setlength{\wmrightmargin}{1.0in}
\setlength{\wmbottommargin}{1.0in} % guessed
\setlength{\wmtopmargin}{1.0in}
\colorlet{wmtaglinecolor}{black}
% --------------------------------------------------
% Now let's define/modify a particular layout
% esssentially this programs a 'switch' construct
\ifthenelse{\equal{\@layout}{prior2014dec}}{
%use defaults
}{
% nothing to do in the else case
}
\ifthenelse{\equal{\@layout}{2014}}{
% below are measured in the Word template
\setlength{\wmlogoheight}{0.65in}
\setlength{\wmlogoWhpos}{0.82in}% same as above
\setlength{\wmlogoWvpos}{.15in}% same as above
% --------------------------------------------------
% Required by WM
\setlength{\wmlogoseparation}{0.5in} % header text from main text separation
\setlength{\wmleftmargin}{1.64in}
\setlength{\wmrightmargin}{1.0in}
\setlength{\wmbottommargin}{1.0in} % guessed
\setlength{\wmtopmargin}{1.0in}
\colorlet{wmtaglinecolor}{WMgold}
}{
% nothing to do in the else case
}
}
\setonelinelayout{default} % set page layout defaults
%-------------- define WM header logo file ---------------------------------
\providecommand{\wmheaderlogo}{}% no logo
% this is prior December 2014 logo with Wren building
\DeclareOption{nologo}{%
\renewcommand{\wmheaderlogo}{}% no logo
\logofalse
\setonelinelayout{default}%
}
% this is prior December 2014 logo with Wren building
\DeclareOption{prior2014dec}{%
\renewcommand{\wmheaderlogo}%
{wmlogos/wmheader2012}%
\setonelinelayout{prior2014dec}%
}
% full colored logo starting from December 2014
\DeclareOption{fullcolor}{%
\renewcommand{\wmheaderlogo}%
{wmlogos/wm_horizontal_single_line_full_color}%
\setonelinelayout{2014}%
}
% green logo starting from December 2014
\DeclareOption{green}{%
\renewcommand{\wmheaderlogo}%
{wmlogos/wm_horizontal_single_line_green}%
\setonelinelayout{2014}%
}
% black logo starting from December 2014
\DeclareOption{black}{%
\renewcommand{\wmheaderlogo}%
{wmlogos/wm_horizontal_single_line_black}%
\setonelinelayout{2014}%
}
% black logo starting from December 2014
\DeclareOption{white}{%
\renewcommand{\wmheaderlogo}%
{wmlogos/wm_horizontal_single_line_white}%
\setonelinelayout{2014}%
}
%-------------- 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}
\RequirePackage{graphicx}
\RequirePackage{geometry} % easy page layout manipulation
\RequirePackage{fancyhdr} % Headers !
\colorlet{wmtaglinecolor}{black}
% --------------------------------------------------
% Change the letter class default for signature indent
\setlength{\longindentation}{0pt} % this is indent of signature
% --------------------------------------------------
% Let's calculate/set page layout
\geometry{
letterpaper,
top=\wmtopmargin,
left=\wmleftmargin,
right=\wmrightmargin,
bottom=\wmbottommargin,
marginparwidth=0in,
marginparsep=0in,
%showframe % this shows layout frames
}
% -------------------------------------------------------------------
%% WM fancy letter head definition
\newcommand{\wmaddress}{
\ifx\@empty\fromaddress
{}
\else
\begin{tabular}{l@{}}\ignorespaces
\fromaddress%
\end{tabular}%
\fi
}
\newcommand{\setwmaddresssizes}{
\settoheight{\wmaddressheight}{\hbox{\wmaddress}}%
}
\newcommand{\wmfromwithlogo}{
\setwmaddresssizes
\iflogo
\raisebox{\wmaddressheight-\wmlogoheight+\wmlogoWvpos}[\wmaddressheight]{
\hskip -\wmlogoWhpos%
\includegraphics[height=\wmlogoheight{},keepaspectratio=true]{\wmheaderlogo}%
}
\else%
% do nothing
\fi%
\hfill\wmaddress{}%
}
% -------------------------------------------------------------------
% This takes care of WM tagline which we will put in the central footer
\newcommand*{\tagline}[1]{\def\lettertagline{#1}}
\tagline{}
% -------------------------------------------------------------------
% fancyheader definitions
\fancypagestyle{empty}{% looks like this has no effect for the letter class
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{\thepage}%
}
\fancypagestyle{plain}{% this takes care of the 2nd and the following pages
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{\thepage}%
}
\fancypagestyle{firstpage}{% this is the very first page style
\renewcommand{\headrulewidth}{0pt}
\ifx\lettertagline\@empty
\fancyfoot[C]{\thepage}%
\else
\fancyfoot[C]{{\color{wmtaglinecolor}\lettertagline}\\\thepage}%
\fi
}
% Important! if changed expect trouble with pages 2, 3, ... headers/footers
\pagestyle{plain}
% -------------------------------------------------------------------
% Now let redefine opening so address goes to the right of logo
\renewcommand*{\opening}[1]{
\setwmaddresssizes
\thispagestyle{firstpage}%
\wmfromwithlogo
\vskip \wmlogoseparation
{\raggedleft\@date\par}%
{\raggedright \toname \\ \toaddress \par}%
%\vspace{2\parskip}%
#1\par\nobreak}
% -------------------------------------------------------------------
% vim: tabstop=2 shiftwidth=2 expandtab filetype=tex
|