% resume.cls
% Copyright 2009 Ankur Dave <ankurdave@gmail.com>
% 
% Licensed under the CC-GNU GPL version 2.0 or later.
% See http://creativecommons.org/licenses/GPL/2.0
% 
% See http://ankurdave.com/tex for more document classes.

\ProvidesClass{resume}

\PassOptionsToClass{11pt,12pt}{article}
\LoadClassWithOptions{article}

% fields that user can set
\makeatletter
	\newcommand{\name}[1]{\def \@name {#1}}
	\newcommand{\addressone}[1]{\def \@addressone {#1}}
	\newcommand{\addresstwo}[1]{\def \@addresstwo {#1}}
	\newcommand{\phonehome}[1]{\def \@phonehome {#1}}
	\newcommand{\phonemobile}[1]{\def \@phonemobile {#1}}
	\newcommand{\email}[1]{\def \@email {#1}}
	\newcommand{\website}[1]{\def \@website {#1}}
	\name{}
	\addressone{}
	\addresstwo{}
	\phonehome{}
	\phonemobile{}
	\email{}
	\website{}
\makeatother

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

% fonts
\usepackage{times}
\renewcommand{\ttdefault}{cmtt}

% alignment
% (must be before indentation because raggedright clears parindent)
\raggedright

% lists
\usepackage{atbeginend}
\AfterBegin{itemize}{
	\setlength{\itemsep}{-\parskip}
	\addtolength{\itemsep}{3pt}
}

% sections
\makeatletter
\renewcommand{\section}[1]{
	\@startsection
		{section}
		{1}
		{\z@}
		{0em}
		{1em \@minus 1em} % tricks LaTeX into linebreak with no space afterward
		{\normalfont\large\sc\bfseries}
		*
		{#1}
	\vspace{-0.5em} % moves line up: OK because of small caps -- no descenders
	\hrule
	\vspace{0.5em}
	\par
}

% job positions
\makeatletter
	\newcommand{\employer}[1]{\def \@employer {#1}}
	\newcommand{\location}[1]{\def \@location {#1}}
	\newcommand{\jobtitle}[1]{\def \@jobtitle {#1}}
	\newcommand{\dates}[1]{\def \@dates {#1}}
	\employer{}
	\jobtitle{}
	\dates{}

	\newenvironment{position}{
		\textbf{\@employer} \hfill \textit{\@location}\\
		\textit{\@jobtitle} \hfill \@dates
		\par
		\vspace{0.5em}
	}{
	}
\makeatother

% schools
\makeatletter
	\newcommand{\schoolname}[1]{\def \@schoolname {#1}}
%	\newcommand{\dates}[1]{\def \@dates {#1}} % already defined by position
	\schoolname{}
	\dates{}

	\newenvironment{school}{
		\textbf{\@schoolname} \hfill \@dates
		\par
	}{
	}
\makeatother

% title
\makeatletter
\def \@maketitle {
	\begin{center}
		{\large \bf \@name}
		\vspace{0.5em} \hrule height 1pt \vspace{0.5em}
		\begin{tabular}{r l}
			\@addressone & \@addresstwo \\
			home: \@phonehome & mobile: \@phonemobile \\
			\texttt{\@email} & \texttt{\@website} \\
		\end{tabular}
	\end{center}
}
\makeatother

