tccv

tccv Git Source Tree

Root/tccv.cls

1% Copyright (C) 2012-2019 Nicola Fontana <ntd at entidi.it>
2%
3% This program can be redistributed and/or modified under
4% the terms of the LaTeX Project Public License, either
5% version 1.3 of this license or (at your option) any later
6% version. The latest version of this license is in
7% http://www.latex-project.org/lppl.txt
8% and version 1.3 or later is part of all LaTeX distributions
9% version 2005/12/01 or later.
10%
11% Based on the original idea by Alessandro Plasmati found at
12% http://www.latextemplates.com/template/two-column-one-page-cv
13%
14% The most relevant changes from his work are:
15%
16% * this is a class, not a template document;
17% * tccv is based on scrartcl (from Koma-script), not on article;
18% * the fonts are selected from the PSNFSS collection, so no
19% custom font installation should be required;
20% * heavily based the implementation on custom environments and
21% macros, so the document is much easier to read (and customize);
22% * it is plain LaTeX/Koma-script, so the CV can be compiled
23% with the usual tools, latex and pdflatex included.
24
25\NeedsTeXFormat{LaTeX2e}
26\ProvidesClass{tccv}
27 [2019/09/08 v1.3.0
28 Two Column Curriculum Vitae]
29
30\LoadClassWithOptions{scrartcl}
31
32\setcounter{secnumdepth}{-1}
33\RequirePackage[hmargin=1.25cm,vmargin=1.25cm,twocolumn,columnsep=1.25cm]{geometry}
34\RequirePackage{etoolbox,needspace,pifont,tabularx,xcolor}
35\RequirePackage{hyperref}
36
37% Use fontspec on lualatex and bookman on pdflatex
38\@ifundefined{directlua}%
39 {\RequirePackage{bookman}}%
40 {\RequirePackage{fontspec}\setmainfont{TeX Gyre Bonum}}
41
42
43% Capitalize words of at least a minimum length (default to 3 chars).
44% The text is capitalized before being expanded.
45%
46% This macro uses Lua to do the job but fails gracefully (that is,
47% return the text as is) if \directlua is not available.
48%
49% \ucwords
50% [optional: miminum length]{text}
51\newcommand\ucwords[2][3]{%
52 % Fails gracefully if not in LuaLaTeX
53 \providecommand\directlua[1]{#2}%
54 \directlua{%
55local minlen = tonumber("#1")
56local src = "\luaescapestring{\unexpanded{#2}}"
57local dst = {}
58% Put a % inside \directlua is tricky as hell. Use char(37)
59% instead: still no plans for supporting non-ASCII platforms.
60for w in src:gmatch(string.char(37) .. "S+") do
61 if w:len() >= minlen then
62table.insert(dst, w:sub(1,1):upper() .. w:sub(2))
63 else
64table.insert(dst, w)
65 end
66end
67tex.print(dst)}}
68
69% Default color theme
70\definecolor{foregound}{HTML}{303030}
71\definecolor{url}{HTML}{506060}
72\definecolor{link}{HTML}{506060}
73\definecolor{header}{HTML}{801010}
74\definecolor{personal}{HTML}{F5DD9D}
75
76% Allow the resume's theme to be B/W only
77\DeclareOption{blackwhite}{%
78 \definecolor{header}{HTML}{1C1C1C}%
79 \definecolor{personal}{HTML}{F7F7F7}}
80
81\ProcessOptions\relax
82
83\pagestyle{empty}
84\setlength\parindent{0pt}
85\color{foregound} % Default foreground color
86\hypersetup{colorlinks,breaklinks,urlcolor=url,linkcolor=link}
87\setkomafont{disposition}{\color{header}}
88\setkomafont{section}{\scshape\Large\mdseries}
89\newkomafont{cv}{%
90 \@ifundefined{directlua}%
91{\fontfamily{pzc}\selectfont\Huge}%
92{\itshape\huge}}
93
94% In tccv \part must contain the subject of the curriculum vitae.
95% The command will start a new page and output in onecolumn the
96% subject (first and last name) with the text from the optional
97% argument underneath it
98\renewcommand\part[2][Curriculum Vitae]{%
99 \twocolumn[%
100 \begin{center}
101\vskip-\lastskip%
102{\usekomafont{part} #2} \medskip\\
103{\usekomafont{cv} #1}
104\bigskip
105 \end{center}]}
106
107% Overrides the \section command to capitalize every
108% word for cosmetic purposes and draws a rule under it.
109\let\old@section\section
110\renewcommand\section[2][]{%
111 \old@section[#1]{\ucwords{#2}}%
112 \newdimen\raising%
113 \raising=\dimexpr-0.7\baselineskip\relax%
114 \vskip\raising\hrule height 0.4pt\vskip-\raising}
115
116% Allow conditionals based on the job name. This can usually be set
117% from a command-line argument: check fausto.en.tex for an example.
118%
119% \ifjob
120% {jobname}
121% {content if matches}
122% {content if does not match}
123\newcommand\ifjob[3]{%
124 \edef\JOBNAME{\jobname}%
125 \edef\PIVOT{\detokenize{#1}}%
126 \ifdefstrequal{\JOBNAME}{\PIVOT}{#2}{#3}}
127
128% Creates an unordered list of keys (optionals) and values (i.e. a
129% description text) inside a colored box. See the `\personal` command
130% for a real use case.
131%
132% \begin{keyvaluelist}{color}
133% \item[key text] value text...
134% ...
135% \end{keyvaluelist}
136\newcounter{KEYVALUECOUNTER}%
137\newenvironment{keyvaluelist}[1]{%
138 \newcommand\KEYVALUECOLOR{#1}%
139 \renewcommand\item[1][]{%
140\stepcounter{KEYVALUECOUNTER}%
141\ifnumequal{\value{KEYVALUECOUNTER}}{1}{}{\smallskip\cr}%
142##1 & }%
143 \newdimen\boxwidth\boxwidth=\dimexpr\linewidth-2\fboxsep\relax%
144 % Tried to use \savebox and lrbox environment without success:
145 % both fail complaining about some phantom } missing. I'm too
146 % tired to guess what LaTeX wants... falling back to TeX here.
147 \setbox0=\hbox\bgroup%
148 \tabularx{\boxwidth}{c|X}}
149 {\endtabularx\egroup\colorbox{\KEYVALUECOLOR}{\box0}%
150 \setcounter{KEYVALUECOUNTER}{0}}
151
152% Renders a personal data box:
153%
154% \personal
155% [url without scheme, i.e. no http:// prefix]
156% {address}
157% {phone number}
158% {email}
159\newcommand\personal[4][]{%
160 \newcommand\SYMBOL[1]{\raisebox{-2pt}{\Large\ding{##1}}}%
161 \needspace{0.5\textheight}%
162 \begin{keyvaluelist}{personal}
163\item[\SYMBOL{45}] #2
164\item[\SYMBOL{37}] #3
165\item[\SYMBOL{41}] \href{mailto:#4}{#4}
166\ifstrempty{#1}{}{\item[\SYMBOL{218}] \href{https://#1}{#1}}
167 \end{keyvaluelist}}
168
169% Every \item can be followed by one or more paragraphs
170% of description:
171%
172% \item
173% {date range}
174% {company}
175% {role}
176% One or more paragraphs describing what achieved during this application.
177\newenvironment{eventlist}{%
178 \newcommand*\inskip{}
179 \renewcommand\item[3]{%
180\inskip%
181{\raggedleft\textsc{##1}\\[1pt]}
182\ifstrempty{##2}{}{##2\\[2pt]}
183{\Large\textit{##3}}
184\medskip
185\renewcommand\inskip{\bigskip}}}
186 {\bigskip}
187
188% Use only \item inside this environment, no other macros
189% are allowed:
190%
191% \item
192% [what has been achieved]
193% {years}
194% {subject}
195% {notes}
196\newenvironment{yearlist}{%
197 \renewcommand\item[4][]{%
198\textsc{##2} & \textbf{##3} \\
199\ifstrempty{##1}{}{& \textsc{##1} \\}
200& \textit{##4}\medskip\\}
201 \tabularx{\linewidth}{rX}}
202 {\endtabularx}
203
204
205% Use only \item inside this environment: no other macros
206% are allowed:
207%
208% \item
209% {fact}
210% {description}
211\newenvironment{factlist}{%
212 \newdimen\unbaseline
213 \unbaseline=\dimexpr-\baselinestretch\baselineskip\relax
214 \renewcommand\item[2]{%
215\textsc{##1} & {\raggedright ##2\medskip\\}\\[\unbaseline]}
216 \tabularx{\linewidth}{rX}}
217 {\endtabularx}
218
219% Avoid dealing with starred sections
220% See the following question for further details:
221% http://tex.stackexchange.com/questions/223607/does-the-bibliography-command-specify-a-section-anywhere
222\KOMAoption{bibliography}{totocnumbered}
223
224\AtEndPreamble{%
225 \@ifpackageloaded{biblatex}{%
226\defbibheading{bibliography}[\refname]{\section{#1}}}{}}
227%%
228%% End of file `tccv.cls'.

Archive Download this file

Branches