Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.10 KB | None | 0 0
  1. %%%%%%%%%%%%%%%%%
  2. % This is altacv.cls (v1.1.5, 1 December 2018) written by
  3. % LianTze Lim (liantze@gmail.com).
  4. %
  5. %% It may be distributed and/or modified under the
  6. %% conditions of the LaTeX Project Public License, either version 1.3
  7. %% of this license or (at your option) any later version.
  8. %% The latest version of this license is in
  9. %% http://www.latex-project.org/lppl.txt
  10. %% and version 1.3 or later is part of all distributions of LaTeX
  11. %% version 2003/12/01 or later.
  12. %%
  13. %%
  14. % Contributions:
  15. % - https://github.com/akreuzer Added ragged2e option (5 Nov 2018)
  16. % - https://github.com/stefanogermano Fixed bad boxes and undefined font shape (July 2018)
  17. % - https://github.com/foohyfooh Fixed blank spaces in \cvevent and bad link in README.md (June 2018)
  18.  
  19. %%%%%%%%%%%%%%%%
  20. \NeedsTeXFormat{LaTeX2e}[1995/12/01]
  21. %% v1.4: Detect TL2018 to handle accented characters in class information
  22. \@ifl@t@r\fmtversion{2018/04/01}{\UseRawInputEncoding}{}
  23. \ProvidesClass{altacv}[2018/12/01 AltaCV v1.1.5, yet another alternative class for a résumé/curriculum vitae.]
  24.  
  25. %% v1.1: Optionally load academicons
  26. \newif\if@academicons
  27. \DeclareOption{academicons}{\@academiconstrue}
  28. %% v1.1.3: Choice of round/square photo
  29. \newif\if@normalphoto
  30. \DeclareOption{normalphoto}{\@normalphototrue}
  31. \DeclareOption*{\PassOptionsToClass{\CurrentOption}{extarticle}}
  32. \newif\if@raggedtwoe
  33. \DeclareOption{ragged2e}{\@raggedtwoetrue}
  34. \ProcessOptions\relax
  35.  
  36. \LoadClass{extarticle}
  37.  
  38. \RequirePackage[margin=2cm]{geometry}
  39. \RequirePackage{fontawesome}
  40. \RequirePackage{ifxetex,ifluatex}
  41. \RequirePackage{scrlfile}
  42.  
  43. %% v1.1.5: added for convenience
  44. \newif\ifxetexorluatex
  45. \ifxetex
  46. \xetexorluatextrue
  47. \else
  48. \ifluatex
  49. \xetexorluatextrue
  50. \else
  51. \xetexorluatexfalse
  52. \fi
  53. \fi
  54.  
  55. %% v1.1: Optionally load academicons
  56. %% v1.1.5: Handle different versions of academicons
  57. \if@academicons
  58. \ifxetexorluatex
  59. \RequirePackage{fontspec}
  60. %% academicons in TL2018 doesn't require
  61. %% Academicons to be installed in OS fonts
  62. %% so can be loaded directly
  63. \@ifl@t@r\fmtversion{2018/04/01}{%
  64. \RequirePackage{academicons}
  65. }{%
  66. % TL2017
  67. \@ifl@t@r\fmtversion{2017/04/01}{%
  68. \@ifpackagelater{academicons}{2018/03/01}{%
  69. \RequirePackage{academicons}
  70. }{%
  71. \let\ori@newfontfamily\newfontfamily%
  72. \renewcommand{\newfontfamily}[2]{}
  73. \RequirePackage{academicons}
  74. \let\newfontfamily\ori@newfontfamily
  75. \newfontfamily{\AI}{academicons.ttf}
  76. }
  77. }{% TL2016 requires the package to be loaded before
  78. % the version can be checked. Only added because
  79. % Overleaf v1 still runs TL2016; will be removed
  80. % when v1 is completely retired.
  81. \let\ori@newfontfamily\newfontfamily%
  82. \renewcommand{\newfontfamily}[2]{}
  83. \RequirePackage{academicons}
  84. \let\newfontfamily\ori@newfontfamily
  85. \newfontfamily{\AI}{academicons.ttf}
  86. }
  87. }
  88. \else
  89. \ClassError{AltaCV}{academicons unsupported by latex or pdflatex. Please compile with xelatex or lualatex}{Please compile with xelatex or lualatex to use the academicons option}
  90. \fi
  91. \fi
  92.  
  93. \if@raggedtwoe
  94. \RequirePackage[newcommands]{ragged2e}
  95. \fi
  96.  
  97. \RequirePackage{xcolor}
  98.  
  99. \colorlet{accent}{blue!70!black}
  100. \colorlet{heading}{black}
  101. \colorlet{emphasis}{black}
  102. \colorlet{body}{black!80!white}
  103. \newcommand{\itemmarker}{{\small\textbullet}}
  104. \newcommand{\ratingmarker}{\faCircle}
  105.  
  106. \RequirePackage{tikz}
  107. \usetikzlibrary{arrows}
  108. \RequirePackage[skins]{tcolorbox}
  109. \RequirePackage{enumitem}
  110. \setlist{leftmargin=*,labelsep=0.5em,nosep,itemsep=0.25\baselineskip,after=\vskip0.25\baselineskip}
  111. \setlist[itemize]{label=\itemmarker}
  112. \RequirePackage{graphicx}
  113. \RequirePackage{etoolbox}
  114. \RequirePackage{dashrule}
  115. \RequirePackage{multirow,tabularx}
  116. \RequirePackage{changepage}
  117. % \RequirePackage{marginfix}
  118.  
  119. \setlength{\parindent}{0pt}
  120. \newcommand{\divider}{\textcolor{body!30}{\hdashrule{\linewidth}{0.6pt}{0.5ex}}\medskip}
  121.  
  122. \newenvironment{fullwidth}{%
  123. \begin{adjustwidth}{}{\dimexpr-\marginparwidth-\marginparsep\relax}}
  124. {\end{adjustwidth}}
  125.  
  126. \newcommand{\emailsymbol}{\faAt}
  127. \newcommand{\phonesymbol}{\faPhone}
  128. \newcommand{\homepagesymbol}{\faChain}
  129. \newcommand{\locationsymbol}{\faMapMarker}
  130. \newcommand{\linkedinsymbol}{\faLinkedin}
  131. \newcommand{\twittersymbol}{\faTwitter}
  132. \newcommand{\githubsymbol}{\faGithub}
  133. \newcommand{\orcidsymbol}{\aiOrcid}
  134. \newcommand{\mailsymbol}{\faEnvelope}
  135.  
  136. \newcommand{\printinfo}[2]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}#2\hspace{2em}}}
  137.  
  138. \newcommand{\name}[1]{\def\@name{#1}}
  139. \newcommand{\tagline}[1]{\def\@tagline{#1}}
  140. \newcommand{\photo}[2]{\def\@photo{#2}\def\@photodiameter{#1}}
  141. \newcommand{\email}[1]{\printinfo{\emailsymbol}{#1}}
  142. \newcommand{\mailaddress}[1]{\printinfo{\mailsymbol}{#1}}
  143. \newcommand{\phone}[1]{\printinfo{\phonesymbol}{#1}}
  144. \newcommand{\homepage}[1]{\printinfo{\homepagesymbol}{#1}}
  145. \newcommand{\twitter}[1]{\printinfo{\twittersymbol}{#1}}
  146. \newcommand{\linkedin}[1]{\printinfo{\linkedinsymbol}{#1}}
  147. \newcommand{\github}[1]{\printinfo{\githubsymbol}{#1}}
  148. \newcommand{\orcid}[1]{\printinfo{\orcidsymbol}{#1}}
  149. \newcommand{\location}[1]{\printinfo{\locationsymbol}{#1}}
  150.  
  151. \newcommand{\personalinfo}[1]{\def\@personalinfo{#1}}
  152.  
  153. % TODO this is likely where header layout adjustments should be made
  154. \newcommand{\makecvheader}{%
  155. \begingroup
  156. \ifdef{\@photodiameter}{\begin{minipage}{\dimexpr\linewidth-\@photodiameter-2em}}{}%
  157. \raggedright\color{emphasis}%
  158. {\Huge\bfseries\MakeUppercase{\@name}\par}
  159. \medskip
  160. {\large\bfseries\color{accent}\@tagline\par}
  161. \medskip
  162. {\footnotesize\bfseries\@personalinfo\par}
  163. \ifdef{\@photodiameter}{%
  164. \end{minipage}\hfill%
  165. \begin{minipage}{\@photodiameter}
  166. \if@normalphoto
  167. \includegraphics[width=\linewidth]{\@photo}
  168. \else
  169. \tikz\path[fill overzoom image={\@photo}]circle[radius=0.5\linewidth];
  170. \fi%
  171. \end{minipage}\par}{}%
  172. \endgroup\medskip
  173. }
  174.  
  175. \renewenvironment{quote}{\color{accent}\itshape\large}{\par}
  176.  
  177. \newcommand{\cvsection}[2][]{%
  178. \bigskip%
  179. \ifstrequal{#1}{}{}{\marginpar{\vspace*{\dimexpr1pt-\baselineskip}\raggedright\input{#1}}}%
  180. {\color{heading}\LARGE\bfseries\MakeUppercase{#2}}\\[-1ex]%
  181. {\color{heading}\rule{\linewidth}{2pt}\par}\medskip
  182. }
  183.  
  184. \newcommand{\cvsubsection}[1]{%
  185. \smallskip%
  186. {\color{emphasis}\large\bfseries{#1}\par}\medskip
  187. }
  188.  
  189. % v1.1.4: fixes inconsistent font size
  190. \newcommand{\cvevent}[4]{%
  191. {\large\color{emphasis}#1\par}
  192. \smallskip\normalsize
  193. \ifstrequal{#2}{}{}{
  194. \textbf{\color{accent}#2}\par
  195. \smallskip}
  196. \ifstrequal{#3}{}{}{{\small\makebox[0.5\linewidth][l]{\faCalendar\hspace{0.5em}#3}}}%
  197. \ifstrequal{#4}{}{}{{\small\makebox[0.5\linewidth][l]{\faMapMarker\hspace{0.5em}#4}}}\par
  198. \medskip\normalsize
  199. }
  200.  
  201. \newcommand{\cvachievement}[3]{%
  202. \begin{tabularx}{\linewidth}{@{}p{2em} @{\hspace{1ex}} >{\raggedright\arraybackslash}X@{}}
  203. \multirow{2}{*}{\Large\color{accent}#1} & \bfseries\textcolor{emphasis}{#2}\\
  204. & #3
  205. \end{tabularx}%
  206. \smallskip
  207. }
  208.  
  209. \newcommand{\cvtag}[1]{%
  210. \tikz[baseline]\node[anchor=base,draw=body!30,rounded corners,inner xsep=1ex,inner ysep =0.75ex,text height=1.5ex,text depth=.25ex]{#1};
  211. }
  212.  
  213. \newcommand{\cvskill}[2]{%
  214. \textcolor{emphasis}{\textbf{#1}}\hfill
  215. \foreach \x in {1,...,5}{%
  216. \space{\ifnumgreater{\x}{#2}{\color{body!30}}{\color{accent}}\ratingmarker}}\par%
  217. }
  218.  
  219. % Adapted from @Jake's answer at http://tex.stackexchange.com/a/82729/226
  220. \newcommand{\wheelchart}[4][0]{%
  221. \begingroup\centering
  222. \def\innerradius{#3}%
  223. \def\outerradius{#2}%
  224. % Calculate total
  225. \pgfmathsetmacro{\totalnum}{0}%
  226. \foreach \value/\colour/\name in {#4} {%
  227. \pgfmathparse{\value+\totalnum}%
  228. \global\let\totalnum=\pgfmathresult%
  229. }%
  230. \begin{tikzpicture}
  231.  
  232. % Calculate the thickness and the middle line of the wheel
  233. \pgfmathsetmacro{\wheelwidth}{\outerradius-\innerradius}
  234. \pgfmathsetmacro{\midradius}{(\outerradius+\innerradius)/2}
  235. \pgfmathsetmacro{\totalrot}{-90 + #1}
  236.  
  237. % Rotate so we start from the top
  238. \begin{scope}[rotate=\totalrot]
  239.  
  240. % Loop through each value set. \cumnum keeps track of where we are in the wheel
  241. \pgfmathsetmacro{\cumnum}{0}
  242. \foreach \value/\width/\colour/\name in {#4} {
  243. \pgfmathsetmacro{\newcumnum}{\cumnum + \value/\totalnum*360}
  244.  
  245. % Calculate the percent value
  246. \pgfmathsetmacro{\percentage}{\value/\totalnum*100}
  247. % Calculate the mid angle of the colour segments to place the labels
  248. \pgfmathsetmacro{\midangle}{-(\cumnum+\newcumnum)/2}
  249.  
  250. % This is necessary for the labels to align nicely
  251. \pgfmathparse{
  252. (-\midangle>180?"west":"east")
  253. } \edef\textanchor{\pgfmathresult}
  254. \pgfmathparse{
  255. (-\midangle>180?"flush left":"flush right")
  256. } \edef\textalign{\pgfmathresult}
  257. \pgfmathsetmacro\labelshiftdir{1-2*(-\midangle<180)}
  258.  
  259. % Draw the color segments. Somehow, the \midrow units got lost, so we add 'pt' at the end. Not nice...
  260. \filldraw[draw=white,fill=\colour] (-\cumnum:\outerradius) arc (-\cumnum:-(\newcumnum):\outerradius) --
  261. (-\newcumnum:\innerradius) arc (-\newcumnum:-(\cumnum):\innerradius) -- cycle;
  262.  
  263. % Draw the data labels
  264. \draw [*-,thin,emphasis] node [append after command={(\midangle:\midradius pt) -- (\midangle:\outerradius + 1ex) -- (\tikzlastnode)}] at (\midangle:\outerradius + 1ex) [xshift=\labelshiftdir*0.5cm,inner sep=1ex, outer sep=0pt, text width=\width,anchor=\textanchor,align=\textalign,font=\small,text=body]{\name};
  265. % Set the old cumulated angle to the new value
  266. \global\let\cumnum=\newcumnum
  267. }
  268. \end{scope}
  269. % \draw[gray] (0,0) circle (\outerradius) circle (\innerradius);
  270. \end{tikzpicture}\par
  271. \endgroup
  272. }
  273.  
  274. \newcommand{\cvref}[3]{%
  275. \smallskip
  276. \textcolor{emphasis}{\textbf{#1}}\par
  277. \begin{description}[font=\color{accent},style=multiline,leftmargin=1.35em]
  278. \item[\normalfont\emailsymbol] #2
  279. \item[\small\normalfont\mailsymbol] #3
  280. \end{description}
  281. % \medskip
  282. }
  283.  
  284. \newenvironment{cvcolumn}[1]{\begin{minipage}[t]{#1}\raggedright}{\end{minipage}}
  285.  
  286. \RequirePackage[backend=biber,style=authoryear,sorting=ydnt]{biblatex}
  287. %% For removing numbering entirely when using a numeric style
  288. % \setlength{\bibhang}{1em}
  289. % \DeclareFieldFormat{labelnumberwidth}{\makebox[\bibhang][l]{\itemmarker}}
  290. % \setlength{\biblabelsep}{0pt}
  291. \defbibheading{pubtype}{\cvsubsection{#1}}
  292. \renewcommand{\bibsetup}{\vspace*{-\baselineskip}}
  293. \AtEveryBibitem{\makebox[\bibhang][l]{\itemmarker}}
  294. \setlength{\bibitemsep}{0.25\baselineskip}
  295.  
  296. % v1.1.2: make it easier to add a sidebar aligned with top of next page
  297. \RequirePackage{afterpage}
  298. \newcommand{\addsidebar}[2][]{\marginpar{%
  299. \ifstrequal{#1}{}{}{\vspace*{#1}}%
  300. \input{#2}}%
  301. }
  302. \newcommand{\addnextpagesidebar}[2][]{\afterpage{\addsidebar[#1]{#2}}}
  303.  
  304. \AtBeginDocument{%
  305. \pagestyle{empty}
  306. \color{body}
  307. \raggedright
  308. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement