summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/harnon-cv/harnon-cv.cls
blob: e3c558efc706ff4f0b29dced2005da12e754677c (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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
% harnon-cv.cls
% By William Hart, 2012
%
% A template for providing a neat CV
% Find it at https://github.com/mecharius/latex-timelineCV
%
% Released as public domain, so use in any way you see fit
% with no warranty.
%


\ProvidesClass{harnon-cv}
\LoadClass[a4paper, 11pt]{article}

% margins
\usepackage[top=0.75in,bottom=0.75in,left=0.75in,right=0.75in]{geometry}

% turn off all page styling
\pagestyle{plain}
\usepackage{nopageno}

% add etoolbox for if/then/else enhancements
\usepackage{etoolbox}

% framed package for borders
\usepackage{framed}

% define a custom timeline framed section based on leftbar
\newenvironment{timelinebar}{%
	\def\FrameCommand{\color{verylightgrey}\vrule width 1pt \hspace{10pt}\color{black}}%
	\MakeFramed {\advance\hsize-\width \FrameRestore}}%
{\endMakeFramed}
 
% package for tables
\usepackage{tabularx}

% fields that user can set
\makeatletter

	\newcommand{\yourname}[1]{\def \@yourname{#1}}
	\newcommand{\yournumber}[1]{\def \@yournumber{#1}}
	\newcommand{\youraddress}[1]{\def \@youraddress{#1}}
	\newcommand{\youremail}[1]{\def \@youremail{#1}}
	\newcommand{\yourwebsite}[1]{\def \@yourwebsite{#1}}
	\newcommand{\recenthistory}[1]{\def \@recenthistory{#1}}

	\yourname{}
	\yournumber{}
	\youraddress{}
	\youremail{}
	\yourwebsite{}
	\recenthistory{}
	
	% redefine the author command
	\renewcommand{\author}[1]{\yourname{#1}}
\makeatother

% images - such as a headshot if desired
\usepackage[pdftex]{graphicx}

% colours
\usepackage{xcolor}
\definecolor{verylightgrey}{rgb}{0.85,0.85,0.85}
\definecolor{lightgrey}{rgb}{0.5,0.5,0.5}
\definecolor{darkgrey}{rgb}{0.3,0.3,0.3}

% fonts
\usepackage[default]{cantarell}
\usepackage[T1]{fontenc}

% set some default lengths
\setlength{\parindent}{18pt}

% some custom font styling
\makeatletter
	% for document headers
	\newcommand{\adddocumentheader}[1]{{\huge \textsc{#1}}}

	% for section headers
	\newenvironment{sectionheader}{\vspace{1.2cm} \color{darkgrey} \LARGE \noindent}{\par\vspace{3mm}}
	\newcommand{\addheadertext}[1]{\begin{sectionheader}#1\end{sectionheader}}
	
	% for sub headings
	\newenvironment{subheader}{\color{darkgrey} \large}{\par}
	\newcommand{\addsubheader}[1]{\begin{subheader}#1\end{subheader}}

	% for bold callouts
	\newenvironment{callout}{\color{darkgrey} \large}{}
	\newcommand{\addcallout}[1]{\begin{callout}#1\end{callout}}

	% for timeline headers
	\newenvironment{timelineheader}{\color{lightgrey}  \large}{}
	\newcommand{\addtimelineheader}[1]{\begin{timelineheader}#1\end{timelineheader}}

	% for list items with a particular format
	\newcommand\listitem[1]{\item{\addcallout{#1}\enspace}}
\makeatother

% title
\makeatletter
\def \@maketitle {%
	\noindent\begin{minipage}{0.5\textwidth}
		\begin{flushleft}
			\ifdefempty{\@yourname}{\relax}{\adddocumentheader{\@yourname}\\}
			\ifdefempty{\@youremail}{\relax}{l\small\@youremail\\}
			\ifdefempty{\@yourwebsite}{\relax}{\small\url{\@yourwebsite}\\}
			\ifdefempty{\@yournumber}{\relax}{\small\@yournumber}
		\end{flushleft}
	\end{minipage}
	\begin{minipage}{0.5\textwidth}
		\begin{flushright}
			\ifdefempty{\@youraddress}{\relax}{\hfill\small\@youraddress}
		\end{flushright}
	\end{minipage}
	
	% add a closing rule
	\vspace{0.5cm}
	\noindent\rule{\textwidth}{0.2mm}
	
	% draw recent history if there is any
	\ifdefempty{\@recenthistory}{\relax}{%
		\vspace{7mm}
		\noindent\@recenthistory\\

		% add a closing rule
		\noindent\rule{\textwidth}{0.2mm}
	}
	\vspace{-1cm}
}
\makeatother

% timeline
\makeatletter

	% start a timeline - fixes spacing before the timeline
	\newcommand{\starttimeline}{\vspace{0.2cm}}
	
	% end a timeline - fix up spacing after a timeline
	\newcommand{\stoptimeline}{\vspace{0.5cm}}
	
	% add a timeline bullet point
	\newenvironment{timelinebullet}{\leftskip=12mm \parindent=-6mm $\bullet$ \hspace{2mm}}{\par\parindent=18pt}
	\newcommand{\addtimelinebullet}[1]{\begin{timelinebullet}#1\end{timelinebullet}}
	
	% recent summary listing in the form of a timeline - takes 2 arguments
	%   - First is the 'year' or date you want to apply
	%   - Second is the comments against that date
	\newcommand{\timelineitem}[2]{
		\noindent
		\begin{minipage}[t]{0.2\textwidth}
			\vspace{0.2cm}
			\begin{center}
				\addtimelineheader{#1}\quad\color{verylightgrey}\leaders\vrule height 5pt depth -4pt \hfill\color{black} \null
			\end{center}
		\end{minipage}
		\hspace{-2mm}
		\begin{minipage}[t]{0.8\textwidth}
			\begin{timelinebar}
				\vspace{2mm}
				#2
				\vspace{4mm}
			\end{timelinebar}
		\end{minipage}
		\vspace{-1cm}
	}

	% make a timeline space, between two timeline items to pad them out
	\newcommand{\timelinespacer}{
		\par\noindent\begin{minipage}{0.2\textwidth}\quad\end{minipage}
		\hspace{-2mm}
		\begin{minipage}{0.8\textwidth}\begin{timelinebar}
			\vspace{1.5cm}\quad
		\end{timelinebar}\end{minipage}\par
		\vspace{-5mm}
	}
\makeatother

% hyperref package for links etc
\usepackage{hyperref}