Awesome-CV/awesome-cv.cls

484 lines
16 KiB
OpenEdge ABL
Raw Normal View History

2015-05-07 11:25:13 +00:00
%% Start of file `awesome-cv.cls'.
%% Copyright 2015 Claud D. Park <posquit0.bj@gmail.com>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.
%-------------------------------------------------------------------------------
% Identification
%-------------------------------------------------------------------------------
\ProvidesClass{awesome-cv}[2015/05/05 v1.0.0 Awesome Curriculum Vitae Class]
\NeedsTeXFormat{LaTeX2e}
%-------------------------------------------------------------------------------
% Class options
%
% (need to be done before the external package loading, for example because
% we need \paperwidth, \paperheight and \@ptsize to be defined before loading
% geometry and fancyhdr)
%-------------------------------------------------------------------------------
% Options for draft or final
\DeclareOption{draft}{\setlength\overfullrule{5pt}}
\DeclareOption{final}{\setlength\overfullrule{0pt}}
% Inherit options of article
\DeclareOption*{
\PassOptionsToClass{\CurrentOption}{article}
}
\ProcessOptions\relax
\LoadClass{article}
%-------------------------------------------------------------------------------
% 3rd party packages
%-------------------------------------------------------------------------------
% Needed to make fixed length table
\RequirePackage{array}
% Needed to handle list environment
\RequirePackage{enumitem}
% Needed to handle text alignment
\RequirePackage{ragged2e}
% Needed to configure page layout
\RequirePackage{geometry}
% Needed to make header & footer effeciently
\RequirePackage{fancyhdr}
% Needed to manage colors
\RequirePackage{xcolor}
% Needed to use \ifxetex-\else-\fi statement
\RequirePackage{ifxetex}
% Needed to use \if-\then-\else statement
\RequirePackage{ifthen}
% Needed to manage fonts
\ifxetex
\RequirePackage[quiet]{fontspec}
% To support LaTeX quoting style
\defaultfontfeatures{Ligatures=TeX}
\else
\RequirePackage[T1]{fontenc}
% Replace by the encoding you are using
\RequirePackage[utf8]{inputenc}
\fi
% Needed to manage math fonts
\RequirePackage[math-style=TeX,vargreek-shape=unicode]{unicode-math}
% Needed to use icons from font-awesome
% (https://github.com/furl/latex-fontawesome)
\RequirePackage{fontawesome}
% Needed to deal a paragraphs
\RequirePackage{parskip}
% Needed to deal hyperlink
\RequirePackage{hyperref}
\hypersetup{
pdftitle={},
pdfauthor={},
pdfsubject={},
pdfkeywords={},
colorlinks=false,
allbordercolors=white
}
%-------------------------------------------------------------------------------
% Configuration for directory locations
%-------------------------------------------------------------------------------
% Configure a directory location for fonts(default: 'fonts/')
\newcommand*{\fontdir}[1][fonts/]{\def\@fontdir{#1}}
\fontdir
%-------------------------------------------------------------------------------
% Configuration for layout
%-------------------------------------------------------------------------------
%% Page Layout
% Configure page margins with geometry
\geometry{left=2.0cm,top=1.2cm,right=2.0cm,bottom=2.0cm}
%% Header & Footer
% Set offset to each header and offset
\fancyhfoffset{0em}
% Remove head rule
\renewcommand{\headrulewidth}{0pt}
% Clear all header & footer fields
\fancyhf{}
% Enable if you want to make header or footer using fancyhdr
\pagestyle{fancy}
%-------------------------------------------------------------------------------
% Configuration for colors
%-------------------------------------------------------------------------------
% Gray-scale colors
\definecolor{white}{HTML}{FFFFFF}
\definecolor{black}{HTML}{000000}
\definecolor{darkgray}{HTML}{333333}
\definecolor{gray}{HTML}{5D5D5D}
\definecolor{lightgray}{HTML}{999999}
% Basic colors
\definecolor{green}{HTML}{C2E15F}
\definecolor{orange}{HTML}{FDA333}
\definecolor{purple}{HTML}{D3A4F9}
\definecolor{red}{HTML}{FB4485}
\definecolor{blue}{HTML}{6CE0F1}
% Awesome colors
\definecolor{awesome-blue}{HTML}{0395DE}
\definecolor{awesome-red}{HTML}{DC3522}
\colorlet{awesome}{awesome-red}
\colorlet{fillheader}{white}
\colorlet{header}{gray}
\colorlet{textcolor}{gray}
\colorlet{headercolor}{gray}
% Awesome section color
\newcounter{colorCounter}
\def\@sectioncolor#1#2#3{%
{%
\color{%
\ifcase\value{colorCounter}%
awesome\or%
awesome\or%
awesome\or%
awesome\or%
awesome\else%
awesome\fi%
} #1#2#3%
}%
\stepcounter{colorCounter}%
}
%-------------------------------------------------------------------------------
% Configuration for fonts
%-------------------------------------------------------------------------------
% Import 3rd party fonts
\newfontfamily\roboto[
Path=\@fontdir,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic,
SmallCapsFeatures={Letters=SmallCaps}
]{Roboto}
\newfontfamily\robotocondensed[
Path=\@fontdir,
UprightFont=*-Condensed,
BoldFont=*-BoldCondensed,
ItalicFont=*-CondensedItalic,
BoldItalicFont=*-BoldCondensedItalic,
]{Roboto}
\newfontfamily\robotothin[
Path=\@fontdir,
ItalicFont=*Italic,
]{Roboto-Thin}
\newfontfamily\opensans[
Path=\@fontdir,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic,
SmallCapsFeatures={Letters=SmallCaps}
]{OpenSans}
\defaultfontfeatures{Mapping=tex-text}
\newfontfamily\bodyfont[
Path=\@fontdir,
BoldFont=texgyreheros-bold.otf,
ItalicFont=texgyreheros-italic.otf,
BoldItalicFont=texgyreheros-bolditalic.otf]
{texgyreheros-regular.otf}
\newfontfamily\thinfont[
Path=\@fontdir,
]{Lato-Light.ttf}
% or for thiner version
%\newfontfamily\thinfont[]{Lato-Hairline.ttf}
\newfontfamily\headingfont[
Path=\@fontdir,
]{texgyreheros-bold.otf}
\setmainfont
[
Path=\@fontdir,
Mapping=tex-text, Color=textcolor,
BoldFont=texgyreheros-bold.otf,
ItalicFont=texgyreheros-italic.otf,
BoldItalicFont=texgyreheros-bolditalic.otf
]
{texgyreheros-regular.otf}
\newfontfamily\anonymous[
Path=\@fontdir,
BoldFont=Anonymous_Pro_B.ttf,
ItalicFont=Anonymous_Pro_I.ttf,
BoldItalicFont=Anonymous_Pro_BI.ttf
]{Anonymous_Pro.ttf}
%\renewcommand{\familydefault}{roboto}
\setmathfont{texgyreheros-regular.otf}
% Configure fonts for each CV elements
% For fundamental structures
\newcommand*{\headernamefont}{\fontsize{32pt}{1em}\roboto\bfseries}
\newcommand*{\headeraddressfont}{\fontsize{9pt}{1em}\roboto\itshape}
\newcommand*{\headersocialfont}{\fontsize{7pt}{1em}\roboto}
\newcommand*{\headerquotefont}{\fontsize{11pt}{1em}\robotocondensed}
\newcommand*{\footerfont}{\fontsize{7pt}{1em}\roboto\scshape}
\newcommand*{\sectionfont}{\fontsize{16pt}{1em}\roboto\bfseries}
\newcommand*{\subsectionfont}{\fontsize{12pt}{1em}\scshape}
% For elements of entry
\newcommand*{\entrytitlefont}{\fontsize{10pt}{1em}\robotocondensed\bfseries}
\newcommand*{\entrypositionfont}{\fontsize{8pt}{1em}\opensans\scshape}
\newcommand*{\entrydatefont}{\fontsize{8pt}{1em}\roboto\scshape}
\newcommand*{\entrylocationfont}{\fontsize{9pt}{1em}\roboto\scshape}
\newcommand*{\descriptionfont}{\fontsize{9pt}{1em}\roboto}
% For elements of subentry
\newcommand*{\subentrytitlefont}{\fontsize{8pt}{1em}\robotocondensed\mdseries}
\newcommand*{\subentrypositionfont}{\fontsize{7pt}{1em}\opensans\scshape}
\newcommand*{\subentrydatefont}{\fontsize{7pt}{1em}\roboto\scshape}
\newcommand*{\subentrylocationfont}{\fontsize{7pt}{1em}\roboto\scshape}
\newcommand*{\subdescriptionfont}{\fontsize{8pt}{1em}\roboto}
% For elements of honor
\newcommand*{\honortitlefont}{\fontsize{9pt}{1em}\robotocondensed}
\newcommand*{\honorpositionfont}{\fontsize{9pt}{1em}\opensans\bfseries}
\newcommand*{\honordatefont}{\fontsize{9pt}{1em}\roboto\scshape}
\newcommand*{\honorlocationfont}{\fontsize{9pt}{1em}\roboto\scshape}
%-------------------------------------------------------------------------------
% Configuration for styles
%-------------------------------------------------------------------------------
% Configure styles for each CV elements
% For fundamental structures
\newcommand*{\headernamestyle}[1]{{\headernamefont\color{darkgray} #1}}
\newcommand*{\headeraddressstyle}[1]{{\headeraddressfont\color{lightgray} #1}}
\newcommand*{\headersocialstyle}[1]{{\headersocialfont\color{darkgray} #1}}
\newcommand*{\headerquotestyle}[1]{{\headerquotefont\color{awesome} #1}}
\newcommand*{\footerstyle}[1]{{\footerfont\color{gray} #1}}
\newcommand*{\sectionstyle}[1]{{\sectionfont\color{darkgray}\@sectioncolor #1}}
\newcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{darkgray}{#1}}}
% For elements of entry
\newcommand*{\entrytitlestyle}[1]{{\entrytitlefont\color{gray} #1}}
\newcommand*{\entrypositionstyle}[1]{{\entrypositionfont\color{gray} #1}}
\newcommand*{\entrydatestyle}[1]{{\entrydatefont\color{gray} #1}}
\newcommand*{\entrylocationstyle}[1]{{\entrylocationfont\color{awesome} #1}}
\newcommand*{\descriptionstyle}[1]{{\descriptionfont\color{darkgray} #1}}
% For elements of subentry
\newcommand*{\subentrytitlestyle}[1]{{\subentrytitlefont\color{gray} #1}}
\newcommand*{\subentrypositionstyle}[1]{{\subentrypositionfont\color{gray} #1}}
\newcommand*{\subentrydatestyle}[1]{{\subentrydatefont\color{gray} #1}}
\newcommand*{\subentrylocationstyle}[1]{{\subentrylocationfont\color{awesome} #1}}
\newcommand*{\subdescriptionstyle}[1]{{\subdescriptionfont\color{darkgray} #1}}
% For elements of honor
\newcommand*{\honortitlestyle}[1]{{\honortitlefont\color{gray} #1}}
\newcommand*{\honorpositionstyle}[1]{{\honorpositionfont\color{gray} #1}}
\newcommand*{\honordatestyle}[1]{{\honordatefont\color{gray} #1}}
\newcommand*{\honorlocationstyle}[1]{{\honorlocationfont\color{awesome} #1}}
%-------------------------------------------------------------------------------
% Commands for personal information
%-------------------------------------------------------------------------------
% Define writer's name
% Usage: \name{<firstname>}{<lastname>}
% Usage: \firstname{<firstname>}
% Usage: \lastname{<lastname>}
% Usage: \familyname{<familyname>}
\newcommand*{\name}[2]{\def\@firstname{#1}\def\@lastname{#2}}
\newcommand*{\firstname}[1]{\def\@firstname{#1}}
\newcommand*{\lastname}[1]{\def\@lastname{#1}}
\newcommand*{\familyname}[1]{\def\@lastname{#1}}
\def\@familyname{\@lastname}
% Define writer's address
% Usage: \address{<address>}
\newcommand*{\address}[1]{\def\@address{#1}}
% Define writer's position
% Usage: \name{<position>}
\newcommand*{\position}[1]{\def\@position{#1}}
% Defines writer's mobile (optional)
% Usage: \mobile{<mobile number>}
\newcommand*{\mobile}[1]{\def\@mobile{#1}}
% Defines writer's email (optional)
% Usage: \email{<email adress>}
\newcommand*{\email}[1]{\def\@email{#1}}
% Defines writer's homepage (optional)
% Usage: \homepage{<url>}
\newcommand*{\homepage}[1]{\def\@homepage{#1}}
% Defines writer's github (optional)
% Usage: \github{<github-nick>}
\newcommand*{\github}[1]{\def\@github{#1}}
% Defines writer's linked-in (optional)
% Usage: \linkedin{<linked-in-nick>}
\newcommand*{\linkedin}[1]{\def\@linkedin{#1}}
% Defines writer's quote (optional)
% Usage: \quote{<quote>}
\renewcommand*{\quote}[1]{\def\@quote{#1}}
%-------------------------------------------------------------------------------
% Commands for utilities
%-------------------------------------------------------------------------------
% Use to align an element of tabular table
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
% Use to draw horizontal line with specific tickness
\def\vhrulefill#1{\leavevmode\leaders\hrule\@height#1\hfill \kern\z@}
%-------------------------------------------------------------------------------
% Commands for elements of CV structure
%-------------------------------------------------------------------------------
% Define a header for CV
% Usage: \makecvheader
\newcommand*{\makecvheader}{
%\descriptionstyle\faPhone
%\descriptionstyle\faQuoteLeft
%\descriptionstyle\faQuoteRight
%\descriptionstyle\faGroup
%\descriptionstyle\faGraduationCap
%\descriptionstyle\faFax
%\\
\begin{center}
\headernamestyle{
{\robotothin\color{gray} \@firstname}{\roboto \@lastname}
} \\
\vspace{2mm}
\headeraddressstyle{
\ifthenelse{\isundefined{\@address}}{}{\@address}
} \\
\vspace{-0.5mm}
\headersocialstyle{
\ifthenelse{\isundefined{\@mobile}}
{}{\faMobile\ \@mobile}
\quad\textbar\quad
\ifthenelse{\isundefined{\@email}}
{}{\href{mailto:\@email}{\faEnvelope\ \@email}}
\quad\textbar\quad
\ifthenelse{\isundefined{\@homepage}}
{}{\href{http://\@homepage}{\faHome\ \@homepage}}
\quad\textbar\quad
\ifthenelse{\isundefined{\@github}}
{}{\href{http://github.com/\@github}{\faGithubSquare\ \@github}}
\quad\textbar\quad
\ifthenelse{\isundefined{\@linkedin}}
{}{\href{http://www.linkedin.com/in/\@linkedin}{\faLinkedinSquare\ \@linkedin}}
} \\
\end{center}
}
% Define a footer for CV
% Usage: \makecvfooter
\newcommand*{\makecvfooter}{
\fancyfoot{}
\fancyfoot[L]{}
\fancyfoot[C]{
\footnotesize{\@firstname \@lastname} · Curriculum Vitae
}
\fancyfoot[R]{
\footnotesize\thepage
}
}
% Define a section for CV
% Usage: \cvsection{<section-title>}
\newcommand{\cvsection}[1]{
\par\addvspace{1.5ex}
\phantomsection{}
\sectionstyle{#1}
\color{gray}\vhrulefill{0.9pt}
\par\nobreak\addvspace{1ex}
}
% Define a subsection for CV
% Usage: \cvsubsection{<subsection-title>}
\newcommand{\cvsubsection}[1]{
\phantomsection{}
\subsectionstyle{#1}
}
% Define an environment for cventry
\newenvironment{cventries}{
\begin{center}
}{
\end{center}
}
% Define an entry of cv information
% Usage: \cventry{<position>}{<title>}{<location>}{<date>}{<description>}
\newcommand*{\cventry}[5]{
\setlength\tabcolsep{0pt}
\setlength{\extrarowheight}{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} L{12.5cm} R{4.5cm}}
\entrytitlestyle{#2} & \entrylocationstyle{#3} \\
\entrypositionstyle{#1} & \entrydatestyle{#4} \\
\multicolumn{2}{L{17cm}}{\descriptionstyle{#5}} \\
\end{tabular*}
}
% Define an environment for cvsubentry
\newenvironment{cvsubentries}{
\begin{center}
}{
\end{center}
}
% Define a subentry of cv information
% Usage: \cvsubentry{<position>}{<title>}{<date>}{<description>}
\newcommand*{\cvsubentry}[4]{
\setlength\tabcolsep{0pt}
\setlength{\extrarowheight}{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} L{12.5cm} R{4.5cm}}
\setlength\leftskip{0.2cm}
\subentrytitlestyle{#2} & \ifthenelse{\equal{#1}{}}
{\subentrydatestyle{#3}}{}
\ifthenelse{\equal{#1}{}}
{}
{\subentrypositionstyle{#1} & \subentrydatestyle{#3} \\}
\ifthenelse{\equal{#4}{}}
{}
{\multicolumn{2}{L{17.0cm}}{\subdescriptionstyle{#4}} \\}
\end{tabular*}
}
% Define an environment for cvhonor
\newenvironment{cvhonors}{
\begin{center}
\setlength\tabcolsep{0pt}
\setlength{\extrarowheight}{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} C{1.5cm} L{13.0cm} R{2.5cm}}
}{
\end{tabular*}
\end{center}
}
% Define a line of cv information(honor, award or something else)
% Usage: \cvhonor{<position>}{<title>}{<location>}{<date>}
\newcommand*{\cvhonor}[4]{
\honordatestyle{#4} & \honorpositionstyle{#1}, \honortitlestyle{#2} & \honorlocationstyle{#3}
\\
}
% Define a line of cv information(language)
%\newcommand*{\cvlanguage}[3]{\cvitemwithcomment{#1}{#2}{#3}}
% Define an environment for cvitems(for cventry)
\newenvironment{cvitems}{
\vspace{-4mm}
\begin{justify}
\begin{itemize}[leftmargin=2ex, nosep, noitemsep]
\setlength{\parskip}{0pt}
\renewcommand{\labelitemi}{\bullet}
}{
\end{itemize}
\end{justify}
\vspace{-2mm}
}