-
Notifications
You must be signed in to change notification settings - Fork 13
/
illinois-letterhead.sty
240 lines (208 loc) · 6.75 KB
/
illinois-letterhead.sty
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
% This package reproduces the Illinois letterhead
%
% Usage:
% \usepackage[layout]{illinois-letterhead}
%
% layout - highlights the layout
%
% References:
% https://tex.stackexchange.com/questions/59932/reproducing-an-official-letterhead
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{illinois-letterhead}[2022/05/03 v0.2 Illinois Letterhead]
% options
\newif\ifillinoisletterhead@layoutoption\illinoisletterhead@layoutoptionfalse
\DeclareOption{layout}{\illinoisletterhead@layoutoptiontrue}
\DeclareOption*{\PackageWarning{illinois-letterhead}{Unknown option `\CurrentOption`}}
\ProcessOptions\relax
% header
\DeclareRobustCommand{\fromdept}[1]{\DeclareRobustCommand\@fromdept{#1}}
\DeclareRobustCommand{\fromdeptaddress}[1]{\DeclareRobustCommand\@fromdeptaddress{#1}}
% footer
\DeclareRobustCommand{\fromtel}[1]{\DeclareRobustCommand\@fromtel{#1}}
\DeclareRobustCommand{\fromemail}[1]{\DeclareRobustCommand\@fromemail{#1}}
\DeclareRobustCommand{\fromweb}[1]{\DeclareRobustCommand\@fromweb{#1}}
% salutation
\DeclareRobustCommand{\fromname}[1]{\DeclareRobustCommand\@fromname{#1}}
\DeclareRobustCommand{\closing}[1]{\DeclareRobustCommand\@closing{#1}}
\newcommand{\signaturefile}[1]{\def\@signaturefile{#1}}
% Colors
% blue: CMYK 100/90/10/77
% orange: CMYK 01/83/85/0
%\RequirePackage[cmyk]{xcolor}
%\definecolor{UIblue}{cmyk}{1.00, 0.90, 0.10, 0.77}
%\definecolor{UIorange}{cmyk}{0.01, 0.83, 0.85, 0.00}
\RequirePackage[rgb]{xcolor}
\definecolor{UIblue}{RGB}{19,41,75}
\definecolor{UIorange}{RGB}{232,74,39}
\RequirePackage{etoolbox}
% set page geometry
\RequirePackage[top=1in,left=1.0in,bottom=1.0in,right=1.0in]{geometry}
\RequirePackage{graphicx}
% logo
\providecommand\fulllogofile{Illinois-Wordmark-Horizontal-Full-Color-CMYK.pdf}
\providecommand\logofile{Illinois-Logo-Full-Color-CMYK.pdf}
% remove coloring from URLs
\RequirePackage[colorlinks=false,pdfborder={0 0 0}]{hyperref}
\urlstyle{same}
% to place things in exact places
%\RequirePackage[absolute,showboxes]{textpos}
% set up a grid to view spacing
%\RequirePackage[top-left,step=0.05in]{pagegrid}
\RequirePackage[absolute]{textpos}
% for conditionals
\RequirePackage{ifthen}
% load Montserrat font -- this is a close alternative to Gotham
%\RequirePackage[defaultfam,light,tabular,lining]{montserrat} %% Option 'defaultfam'
%% only if the base font of the document is to be sans serif
\RequirePackage[defaultfam,light,tabular,lining]{montserrat}
\RequirePackage[T1]{fontenc}
% set linespacing and paragraph spacing
\linespread{1.10}
\setlength{\parskip}{1em}
% use microtype to extend spacing
\RequirePackage{microtype}
% Remove paragraph indentation
\parindent0pt
\raggedright%
% change page style to include header/footer
\pagestyle{empty}
\ifillinoisletterhead@layoutoption%
\RequirePackage{tikz}
\usetikzlibrary{calc}
\newcommand{\drawlayout}{%
\begin{tikzpicture}[remember picture,overlay]
\coordinate (m1) at (current page.north west);
\coordinate (m2) at (current page.north east);
% top left
\draw[|-|,blue,thick] ($(m1)+(1.05in,0)$) -- ++(0, -0.75in)
node [midway,fill=white] {0.75"};
\draw[|-|,blue,thick] ($(m1)+(0,-0.8in)$) -- ++(1.0in, 0)
node [midway,fill=white] {1.0"};
% top right
\draw[|-|,blue,thick] ($(m2)+(-1.05in,0)$) -- ++(0, -0.75in)
node [midway,fill=white] {0.75"};
\draw[|-|,blue,thick] ($(m2)+(0,-0.8in)$) -- ++(-1.0in, 0)
node [midway,fill=white] {1.0"};
% top middle
\draw[dotted,blue,thick] ($(m1)+(4.015in,0)$) -- ++(0, -2.0in);
\draw[|-|,blue,thick] ($(m1)+(4.015in,-1.0in)$) -- ++(-1.0in, 0)
node [midway,fill=white] {1.0"};
% blue block I
\coordinate (m3) at (current page.north east);
\coordinate (m4) at ($(m3)+(-1.5in,-1.65in)$);
\draw[solid,blue!30,fill=blue!10,thick] (m4) -- +(0.25in,0) -- +(0.25in,-0.35in) -- +(0,-0.35in) -- cycle;
% text
\draw[red,thick] ($(m1)+(1.0in,-2.00in)$) -- +(6.5in,0) -- +(6.5in,-8in) -- +(0,-8in) -- cycle;
% bottom
\coordinate (m5) at (current page.south west);
\draw[|-|,blue,thick] ($(m5)+(6.0in,0)$) -- ++(0, 1.00in)
node [midway,fill=white] {1.00"};
\end{tikzpicture}
}
\else
\newcommand{\drawlayout}{ }
\fi
% add stuff to the doc
\AtBeginDocument{%
% Top block with logo
\begin{textblock*}{3in} (1.0in,0.75in)
\setlength{\parskip}{0pt}
\includegraphics[height=0.35in]{\fulllogofile}
\end{textblock*}
% Inset department address
\begin{textblock*}{4.0in} (3.5in,0.75in)
\fontfamily{Montserrat-LF}
\setlength{\parskip}{-\baselineskip}
\flushright%
\vspace{1mm}
{%
% use medium bold here
\color{UIblue}
\fontsize{10}{12}\selectfont
\fontseries{semibold}\selectfont
\ifdefined\@fromdept
\@fromdept\\%
\fi
}
\vspace{2mm}
{%
\color{UIblue}
\footnotesize\par
\ifdefined\@fromdeptaddress
\@fromdeptaddress%
\fi
}
\end{textblock*}
% main text
%\newgeometry{top=2.00in,left=1.0in,bottom=1.0in,right=1.0in}
\vspace*{0.75in}
\drawlayout%
}
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot{}
\fancyfoot[L]{%
% footer
% specify the top left corner location of the footer
\begin{textblock*}{\textwidth} (1in,10.25in)
{%
\fontfamily{Montserrat-LF}
\color{UIorange}
\fontseries{semibold}\selectfont
UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN\\
}
\vspace*{0.5em}
{%
\fontfamily{Montserrat-LF}
\color{UIblue}
\fontsize{9}{11}\selectfont
\ifdefined\@fromtel
\@fromtel
\fi
\ifdefined\@fromemail
\ifdefined\@fromtel
\quad \textbullet\quad %
\fi
\@fromemail
\fi
\ifdefined\@fromweb
\ifdefined\@fromemail
\quad \textbullet\quad %
\fi
\@fromweb
\fi
}
\end{textblock*}
}
\fancyfoot[R]{
\ifnum\thepage=1
\else
\begin{textblock*}{1in} (6.5in,10.25in)
\setlength{\parskip}{0pt}
\setlength{\parskip}{-\baselineskip}
\flushright%
\includegraphics[height=0.35in]{\logofile}
\end{textblock*}
\fi
}
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
% add closing to end of the document, if sig is available
\AtEndDocument{%
\par\vspace{2ex}
\ifdefined\@closing
\@closing
\fi
\ifdefined\@signaturefile
\includegraphics[width=1.2in]{\@signaturefile}\\[-0.2\baselineskip]
\else
\bigskip
\bigskip
\fi
\ifdefined\@fromname
\@fromname%
\fi
}
\endinput
% end of file `illinois-letterhead.sty`