fortysecondscv.cls 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. % FortySecondsCV LaTeX class
  2. % Copyright © 2019-2022 René Wirnata <rene.wirnata@pandascience.net>
  3. % Licensed under the 3-Clause BSD License. See LICENSE file for details.
  4. %
  5. % Please visit https://github.com/PandaScience/FortySecondsCV for the most
  6. % recent version! For bugs or feature requests, please open a new issue on
  7. % github.
  8. %
  9. % Contributors:
  10. % https://github.com/PandaScience/FortySecondsCV/graphs/contributors
  11. %
  12. % Attributions
  13. % ------------
  14. % * fortysecondscv is based on the twentysecondcv class by Carmine Spagnuolo
  15. % (cspagnuolo@unisa.it), released under the MIT license and available under
  16. % https://github.com/spagnuolocarmine/TwentySecondsCurriculumVitae-LaTex
  17. % * further attributions are indicated immediately before corresponding code
  18. %-------------------------------------------------------------------------------
  19. % CLASS NAME AND VERSION
  20. %-------------------------------------------------------------------------------
  21. \NeedsTeXFormat{LaTeX2e}
  22. \ProvidesClass{fortysecondscv}[2020/10/19 CV class]
  23. %-------------------------------------------------------------------------------
  24. % PROCESS CLASS OPTIONS
  25. %-------------------------------------------------------------------------------
  26. %% first load all packages absolutely required to parse class options
  27. % for easy color definitions; provides \definecolor; load before background pkg
  28. \RequirePackage[dvipsnames, svgnames, x11names]{xcolor}
  29. % for positioning text within the side column | use showboxes for visible frame
  30. \RequirePackage[absolute,overlay]{textpos}
  31. % provides key-value class options via \DeclareOptionX
  32. \RequirePackage{xkeyval}
  33. % provides \ifnumgreater{<int expr.>}{<int expr.>}{<true>}{<false>},
  34. % \apptocmd{<command>}{<code>}{<success>}{<failure>} and \newtoggle{<name>}
  35. \RequirePackage{etoolbox}
  36. % provides basic conditional expressions
  37. \RequirePackage{ifthen}
  38. % enable simple math like +/- etc. on lengths
  39. \RequirePackage{calc}
  40. % change page margins
  41. \RequirePackage[
  42. nohead,
  43. nofoot,
  44. nomarginpar,
  45. ]{geometry}
  46. % pre-define some colors the user can choose from
  47. \definecolor{cvblue}{HTML}{0E5484}
  48. \definecolor{cvgreen}{HTML}{007170}
  49. \definecolor{cvred}{HTML}{8B0000}
  50. \definecolor{cvsidecolor}{HTML}{E7E7E7}
  51. \definecolor{cvsectioncolor}{HTML}{0395DE}
  52. \definecolor{cvsubsectioncolor}{HTML}{4D4D4D}
  53. % set default values
  54. \colorlet{maincolor}{cvblue}
  55. \colorlet{sidecolor}{cvsidecolor}
  56. \colorlet{sidetextcolor}{black}
  57. \colorlet{sectioncolor}{cvsectioncolor}
  58. \colorlet{subsectioncolor}{cvsubsectioncolor}
  59. \colorlet{itemtextcolor}{black!90}
  60. % colors for document body (right column)
  61. % let user define main color
  62. \DeclareOptionX{maincolor}{\colorlet{maincolor}{#1}}
  63. \DeclareOptionX{sidecolor}{\colorlet{sidecolor}{#1}}
  64. \DeclareOptionX{sidetextcolor}{\colorlet{sidetextcolor}{#1}}
  65. \DeclareOptionX{sectioncolor}{\colorlet{sectioncolor}{#1}}
  66. \DeclareOptionX{subsectioncolor}{\colorlet{subsectioncolor}{#1}}
  67. \DeclareOptionX{itemtextcolor}{\colorlet{itemtextcolor}{#1}}
  68. % set page margins
  69. \newlength\sidebarwidth%
  70. \newlength\topbottommargin%
  71. \newlength\leftrightmargin%
  72. \newlength\sidebartextwidth
  73. % default values
  74. \setlength{\sidebarwidth}{0.34\paperwidth}
  75. \setlength{\topbottommargin}{0.02\paperheight}
  76. \setlength{\leftrightmargin}{0.02\paperwidth}
  77. % user overwrites
  78. \DeclareOptionX{sidebarwidth}{\setlength{\sidebarwidth}{#1}}
  79. \DeclareOptionX{topbottommargin}{\setlength{\topbottommargin}{#1}}
  80. \DeclareOptionX{leftrightmargin}{\setlength{\leftrightmargin}{#1}}
  81. % profile picture settings
  82. \newlength\profilepicsize%
  83. \setlength{\profilepicsize}{0.7\sidebarwidth}
  84. \DeclareOptionX{profilepicsize}{\setlength{\profilepicsize}{#1}}
  85. \newlength\profilepicborderwidth%
  86. \setlength{\profilepicborderwidth}{3.5pt}
  87. \DeclareOptionX{profilepicborderwidth}{\setlength{\profilepicborderwidth}{#1}}
  88. \newcommand*{\profilepicstyle}{}
  89. \DeclareOptionX{profilepicstyle}{\renewcommand{\profilepicstyle}{#1}}
  90. \newcommand*{\profilepiczoom}{}
  91. \DeclareOptionX{profilepiczoom}{\renewcommand{\profilepiczoom}{#1}}
  92. \newlength\profilepicxshift
  93. \setlength{\profilepicxshift}{0mm}
  94. \DeclareOptionX{profilepicxshift}{\setlength{\profilepicxshift}{#1}}
  95. \newlength\profilepicyshift
  96. \setlength{\profilepicyshift}{0mm}
  97. \DeclareOptionX{profilepicyshift}{\setlength{\profilepicyshift}{#1}}
  98. \newlength\profilepicrounding
  99. \setlength{\profilepicrounding}{0.15\sidebarwidth}
  100. \DeclareOptionX{profilepicrounding}{\setlength{\profilepicrounding}{#1}}
  101. % sidebar settings
  102. \newcommand*{\sidebarplacement}{}
  103. \DeclareOptionX{sidebarplacement}{\renewcommand{\sidebarplacement}{#1}}
  104. \newcommand*{\sidesectionsize}{\huge}
  105. \DeclareOptionX{sidesectionsize}{%
  106. \expandafter\renewcommand{\sidesectionsize}{\csname #1\endcsname}%
  107. }
  108. % \DeclareOptionX{sidesectionsize}{\renewcommand{\sidesectionsize}{\small}}
  109. % logo settings
  110. \newlength\logowidth%
  111. \setlength{\logowidth}{\profilepicsize}
  112. \DeclareOptionX{logowidth}{\setlength{\logowidth}{#1}}
  113. \newlength\logospace%
  114. \DeclareOptionX{logospace}{\setlength{\logospace}{#1}}
  115. \newcommand*{\logoposition}{}
  116. \DeclareOptionX{logoposition}{\renewcommand{\logoposition}{#1}}
  117. % show sidebar and page margins
  118. \newtoggle{tshowframes}
  119. \togglefalse{tshowframes}
  120. \DeclareOptionX{showframes}{
  121. \geometry{showframe}
  122. \TPoptions{showboxes=true}
  123. \toggletrue{tshowframes}
  124. % adding \hline in \newenvironment directly doesn't work, so do it here...
  125. \AtBeginDocument{\apptocmd{\personaldata}{\hline}{}{}}
  126. }
  127. % draw vertical guideline
  128. \newcommand{\plotvline}{}
  129. \DeclareOptionX{vline}{%
  130. % must be defined here as macro, b/c tikz won't expand absolute length in
  131. % \backgroundsetup -- BUG?
  132. \renewcommand{\plotvline}{%
  133. \draw [thick, red, opacity=0.7]
  134. (\leftrightmargin + #1, 0) -- (\leftrightmargin + #1, -\paperheight);
  135. }
  136. }
  137. % date column width
  138. \newlength\datecolwidth
  139. \setlength{\datecolwidth}{0.17\textwidth}
  140. \DeclareOptionX{datecolwidth}{\setlength{\datecolwidth}{#1}}
  141. % pass further options to base class and load it
  142. \DeclareOptionX*{\PassOptionsToClass{\CurrentOption}{article}}
  143. \ProcessOptionsX\relax
  144. \LoadClass{article}
  145. % compute "inner" margin of sidebar automatically;
  146. % must come after \sidebarwidth and \leftrightmargin possibly changed by user
  147. \setlength{\sidebartextwidth}{\sidebarwidth - 2\leftrightmargin}
  148. % let geometry package perform the changes;
  149. % must come after loading the base class to prevent overwriting
  150. \ifthenelse{\equal{\sidebarplacement}{right}}{%
  151. \geometry{
  152. top=\topbottommargin,
  153. bottom=\topbottommargin,
  154. right=\sidebarwidth + \leftrightmargin,
  155. left=\leftrightmargin,
  156. }
  157. }{% else
  158. \geometry{
  159. top=\topbottommargin,
  160. bottom=\topbottommargin,
  161. left=\sidebarwidth + \leftrightmargin,
  162. right=\leftrightmargin,
  163. }
  164. }
  165. %-------------------------------------------------------------------------------
  166. % REQUIRED PACKAGES
  167. %-------------------------------------------------------------------------------
  168. % use as workaround for spacing problem when TikZ picture is not in paragraph;
  169. % details: https://tex.stackexchange.com/a/435790
  170. \RequirePackage[texcoord]{eso-pic}
  171. % for easy section style definitions
  172. \RequirePackage{titlesec}
  173. % loads graphicx, provides align=c option for vertical alignment w.r.t. text
  174. \RequirePackage{graphbox}
  175. % provides X column type for automatic length calculations
  176. \RequirePackage{tabularx}
  177. \RequirePackage{longtable, tabu}
  178. % take care of compiler-specific packages
  179. \RequirePackage{ifluatex}
  180. \RequirePackage{ifxetex}
  181. \newif\ifxetexorluatex
  182. \ifxetex
  183. \xetexorluatextrue
  184. \else
  185. \ifluatex
  186. \xetexorluatextrue
  187. \else
  188. \xetexorluatexfalse
  189. \fi
  190. \fi
  191. % pictures, icons and drawings
  192. \ifxetexorluatex
  193. \RequirePackage{academicons}
  194. \fi
  195. \RequirePackage{fontawesome5}
  196. \RequirePackage{devicons}
  197. \RequirePackage{tikz}
  198. \usetikzlibrary{arrows, backgrounds}
  199. % provides \xrfill for horizontal rules
  200. \RequirePackage{xhfill}
  201. % enable multiple optional arguments in macros
  202. \RequirePackage{xparse}
  203. % enable links
  204. \RequirePackage[hidelinks]{hyperref}
  205. %-------------------------------------------------------------------------------
  206. % DERIVED COLOR DEFINITIONS
  207. %-------------------------------------------------------------------------------
  208. % profile section color (sidebar/left column)
  209. \colorlet{pseccolor}{maincolor!90}
  210. % color used for all icon arguments
  211. \colorlet{iconcolor}{maincolor!90}
  212. % color definitions for TikZ drawings
  213. \colorlet{wheelchartlabelcolor}{black}
  214. \colorlet{wheeltextcolor}{black!80!white}
  215. % color of unfilled skill points / bar / chart label
  216. \colorlet{skillbg}{black!25}
  217. %-------------------------------------------------------------------------------
  218. % GLOBAL LAYOUT AND HEADINGS STYLE
  219. %-------------------------------------------------------------------------------
  220. % remove headers and footers
  221. \pagestyle{empty}
  222. % globally disable paragraph indentation
  223. \setlength{\parindent}{0pt}
  224. % set space between paragraphs
  225. % \setlength{\parskip}{1ex}
  226. % creates a rule after some text using remaining line width
  227. % usage: \xrfill[<raise>]{<width>}
  228. \newcommand*{\sectionline}[1]{#1~\xrfill[.5ex]{1pt}[pseccolor]}
  229. % section style for cv table headings in right column
  230. % \titleformat{<command>}[<shape>]{<format>}{<label>}{<sep>}{<before>}[<after>]
  231. \newcommand*{\cvsection}[1]{\section*{#1}}
  232. \titleformat{\section}%
  233. {\color{sectioncolor}\normalfont\bfseries\LARGE}{}{0pt}{}
  234. \titlespacing*{\section}{0pt}{1.5ex}{1ex}
  235. % grey subsection style for right column
  236. \newcommand*{\cvsubsection}[1]{\subsection*{#1}}
  237. \titleformat{\subsection}%
  238. {\color{subsectioncolor}\normalfont\large}{}{0pt}{}
  239. % for compatibility with older versions
  240. \newcommand*{\profilesection}[1]{\subsubsection*{#1}}
  241. % abuse subsubsection as sidesection in left column
  242. \newcommand*{\sidesection}[1]{\subsubsection*{#1}}
  243. \titleformat{\subsubsection}%
  244. {\color{pseccolor}\normalfont\sidesectionsize}{}{0pt}%
  245. {\color{pseccolor}\sectionline}%
  246. % set spaces before and after sidesections: <left><before><after>
  247. % "starred version kills the indentation of the paragraph following the title"
  248. \titlespacing*{\subsubsection}{0pt}{1ex}{1ex}
  249. %-------------------------------------------------------------------------------
  250. % SIDEBAR ELEMENTS
  251. %-------------------------------------------------------------------------------
  252. % text in user-specific color
  253. \newcommand{\sidetext}[1]{\textcolor{sidetextcolor}{#1}}
  254. % mandatory personal information
  255. \newcommand*{\cvname}[1]{\renewcommand{\cvname}{#1}}
  256. \newcommand*{\cvjobtitle}[1]{\renewcommand{\cvjobtitle}{#1}}
  257. % profile picture (optional)
  258. \newcommand{\plotprofilepicture}{}
  259. \newcommand*{\cvprofilepic}[1]{
  260. \renewcommand{\cvprofilepic}{#1}
  261. \ifthenelse{\equal{\profilepicstyle}{profilecircle}}{
  262. \renewcommand{\plotprofilepicture}{\profilecircle}
  263. }{
  264. \renewcommand{\plotprofilepicture}{\profileroundedcorners}
  265. }
  266. }
  267. % additional logo (optional)
  268. \newcommand{\plotlogobefore}{}
  269. \newcommand{\plotlogoafter}{}
  270. \newcommand*{\cvlogopic}[1]{%
  271. % default = before; if any other (incl. 'after') --> after
  272. \ifthenelse{\equal{\logoposition}{before}}{%
  273. \renewcommand{\plotlogobefore}{%
  274. \begin{figure}\centering%
  275. \includegraphics[align=c, width=\logowidth]{#1}%
  276. \end{figure}
  277. \vspace*{\logospace}%
  278. }%
  279. }{%
  280. \renewcommand{\plotlogoafter}{%
  281. \vspace*{\logospace}%
  282. \begin{figure}\centering%
  283. \includegraphics[align=c, width=\logowidth]{#1}%
  284. \end{figure}
  285. }%
  286. }
  287. }
  288. % social network item; \social{<icon>}{<url>}{<text>}
  289. \newcommand*{\social}[3]{%
  290. \socialicon{#1} & \href{#2}{\sidetext{#3}}\\%
  291. }
  292. % personal information item; \personal{<icon>}{<text>}
  293. \newcommand*{\personal}[2]{%
  294. \circleicon{#1} & {\sidetext{#2}}\\%
  295. }
  296. % other personal information as macro that can be used later. Usage:
  297. % \cvcustomdata{<Icon>}{<Text>}
  298. % icon can be taken from FontAwesome or Academicon for example
  299. \newcommand{\personaldata}{}
  300. \newcommand*{\cvcustomdata}[2]{%
  301. \apptocmd{\personaldata}{\personal{#1}{#2}}{}{}%
  302. }
  303. % useful shortcuts
  304. % NOTE: we use href instead of url so user can decide textformatting since url
  305. % automatically uses \texttt{} as format for the url
  306. \newcommand*{\cvbirthday}[1]{\cvcustomdata{\faUser}{#1}}
  307. \newcommand*{\cvaddress}[1]{\cvcustomdata{\faEnvelope}{#1}}
  308. \newcommand*{\cvphone}[1]{\cvcustomdata{\faPhone}{\href{tel:#1}{#1}}}
  309. \newcommand*{\cvsite}[1]{\cvcustomdata{\faGlobe}{\href{#1}{#1}}}
  310. \newcommand*{\cvmail}[1]{\cvcustomdata{\faAt}{\href{mailto:#1}{#1}}}
  311. \newcommand*{\cvkey}[2]{\cvcustomdata{\faKey}{%
  312. \href{https://keyserver.ubuntu.com/pks/lookup?search=#2\&op=vindex\&fingerprint=on}{#1}%
  313. }}
  314. % TODO find a cleaner solution for consistent spacing
  315. \newcommand{\nameandjob}{%
  316. {\Huge\color{maincolor}\cvname}\par%
  317. \setlength{\parskip}{2ex}
  318. {\Large\color{black!80}\cvjobtitle}\par%
  319. \setlength{\parskip}{1ex}
  320. }
  321. \newcommand{\profileroundedcorners}{%
  322. \begin{figure}\centering
  323. % see TikZ/pgf v3.1.1 manual §2.11 (clipping), §14.5 (rounded corners),
  324. % §12 (scopes), §13.2 (coordinate systems)
  325. \begin{tikzpicture}[x=\profilepicsize, y=\profilepicsize]
  326. \begin{scope}
  327. \path[clip]
  328. (0, 0) [sharp corners] --
  329. (0, 1) [rounded corners=\profilepicrounding] --
  330. (1, 1) [sharp corners] --
  331. (1, 0) [rounded corners=\profilepicrounding] -- cycle;
  332. \node[anchor=center, inner sep=0pt, xshift=\profilepicxshift,
  333. yshift=\profilepicyshift] (profilepic) at (0.5, 0.5)
  334. {\includegraphics[width=\profilepiczoom\profilepicsize]
  335. {\cvprofilepic}};
  336. \end{scope}
  337. \ifdim \profilepicborderwidth > 0pt
  338. \begin{scope}
  339. \draw[line width=\profilepicborderwidth, color=iconcolor]
  340. (0, 0) [sharp corners] --
  341. (0, 1) [rounded corners=\profilepicrounding] --
  342. (1, 1) [sharp corners] --
  343. (1, 0) [rounded corners=\profilepicrounding] -- cycle;
  344. \end{scope}
  345. \fi
  346. \end{tikzpicture}
  347. \end{figure}
  348. }
  349. \newcommand{\profilecircle}{%
  350. \begin{figure}\centering
  351. \begin{tikzpicture}[x=\profilepicsize, y=\profilepicsize]
  352. \begin{scope}
  353. \clip (0, 0) circle (0.5);
  354. \node[anchor=center, inner sep=0pt, outer sep=0pt,
  355. xshift=\profilepicxshift, yshift=\profilepicyshift]
  356. (profilepic) at (0,0) {
  357. \includegraphics[width=\profilepiczoom\profilepicsize]
  358. {\cvprofilepic}};
  359. \end{scope}
  360. \ifdim \profilepicborderwidth > 0pt
  361. \begin{scope}
  362. \draw[line width=\profilepicborderwidth, color=iconcolor]
  363. (0, 0) circle (0.5\profilepicsize);
  364. \end{scope}
  365. \fi
  366. \end{tikzpicture}
  367. \end{figure}
  368. }
  369. % table with 2 columns for icons and text
  370. % \icontable{<width 1st column>}{<space between columns>}{<arraystretch>}
  371. \newenvironment{icontable}[3][1]%
  372. {%
  373. \renewcommand{\arraystretch}{#1}% increase linespacing in tables; default=1
  374. \iftoggle{tshowframes}{%
  375. % https://tex.stackexchange.com/a/42331
  376. \tabularx{\sidebartextwidth}{|m{#2} | @{\hskip #3} | X|} \hline%
  377. }{%
  378. \tabularx{\sidebartextwidth}{m{#2} @{\hskip #3} X}%
  379. }
  380. }{%
  381. \endtabularx%
  382. }
  383. % icon style for personal information
  384. \newcommand*\circleicon[1]{%
  385. \tikz[baseline = (char.base)]{%
  386. \node[%
  387. shape=circle,%
  388. draw,%
  389. inner sep=1pt,%
  390. fill=iconcolor,%
  391. maincolor,%
  392. text=white,%
  393. minimum size=\hsize%
  394. ] (char) {#1};%
  395. }%
  396. }
  397. % icon style for social network
  398. \newcommand*{\socialicon}[1]{%
  399. \resizebox{\hsize}{!}{\textcolor{iconcolor}{#1}}%
  400. }
  401. % make sure about me text stays in textbox frame
  402. \newcommand{\aboutme}[1]{\parbox[b]{\linewidth}{\sidetext{#1}}}
  403. % uniform icon style for all skill icons, e.g. flags or fontawesome icons
  404. \newcommand{\cvicon}[1]{\makebox[1em]{\color{iconcolor} #1}}
  405. \newcommand{\flag}[1]{\includegraphics[align=c, width=1em]{#1}}
  406. % \pointskill[<indent>]{<icon>}{<description>}{<points>}[<maxpoints>] creates
  407. % | [indent] [icon] description \hfill ● ● ● ○ ○ |
  408. % -- inspired by arravc.cls by LianTze Lim: https://github.com/liantze/AltaCV
  409. \NewDocumentCommand{\pointskill}{ O{0em} m m m O{5} }{%
  410. \hspace{#1} \cvicon{#2} ~ \sidetext{#3} \hfill%
  411. \foreach \x in {1,...,#5}{%
  412. \space%
  413. {\ifnumgreater{\x}{#4}{\color{skillbg}}{\color{iconcolor}}% from etoolbox
  414. % don't use totalheight; see https://tex.stackexchange.com/a/41014
  415. \raisebox{0.5\height-0.4ex}{\scriptsize\faCircle}%
  416. }
  417. }\par%
  418. }
  419. \newcommand{\barskill}[4][1ex]{
  420. % remove 1pt in width to prevent overfull box warnings
  421. \begin{tikzpicture}[x=\sidebartextwidth-1pt, y=#1]
  422. \draw[fill, skillbg, rounded corners=0.25em]
  423. (0, 0) rectangle (1, 1);
  424. \draw[fill, iconcolor!70, rounded corners=0.25em]
  425. (0, 0) rectangle (#4/100, 1);
  426. \node[above right] at (0, 1) {\cvicon{#2} ~ \sidetext{#3}};
  427. \end{tikzpicture}
  428. \par
  429. }
  430. % \skill[<indent>]{<icon>}{<description>} creates in sidebar
  431. % | [indent] [icon] some longer skill description |
  432. \newcommand{\skill}[3][0em]{
  433. \hspace{#1} \cvicon{#2} ~ \parbox{\linewidth-#1-2.5em}{\sidetext{#3}}%
  434. \hfill \par%
  435. }
  436. % label for wheel charts
  437. \newcommand{\chartlabel}[2][skillbg]{%
  438. \begin{tikzpicture}
  439. \node[
  440. fill=#1!25, % interior color
  441. anchor=base,
  442. draw=#1, % line color
  443. rounded corners,
  444. inner xsep=1ex, % distance from left/right border to text
  445. inner ysep=0.75ex, % distance top/bottom border to text
  446. text height=1.5ex, % align text vertically in box (at least as resulting
  447. text depth=.25ex % effect)
  448. ]{\sidetext{#2}};%
  449. \end{tikzpicture}
  450. }
  451. \newenvironment{sidebarminipage}%
  452. {\begin{minipage}{\sidebartextwidth}}%
  453. {\end{minipage}}%
  454. \newenvironment{memberships}[1][1em]%
  455. {%
  456. \iftoggle{tshowframes}{%
  457. \tabularx{\sidebartextwidth}{|l | @{\hskip #1} | X|} \hline%
  458. }{%
  459. \tabularx{\sidebartextwidth}{l @{\hskip #1} X}%
  460. }
  461. }{%
  462. \endtabularx%
  463. }%
  464. \newcommand{\membership}[3][4em]{
  465. \includegraphics[align=c,width=#1]{#2} & \sidetext{#3} \\[3ex]
  466. }
  467. % adapted from https://tex.stackexchange.com/a/82729
  468. \newcommand{\wheelchart}[4][-90]{%
  469. \def\outerradius{#2}%
  470. \def\innerradius{#3}%
  471. % Calculate total
  472. \pgfmathsetmacro{\totalnum}{0}%
  473. \foreach\value/\colour/\name in {#4} {%
  474. \pgfmathparse{\value+\totalnum}%
  475. \global\let\totalnum=\pgfmathresult%
  476. }%
  477. \begin{tikzpicture}
  478. % Calculate the thickness and the middle line of the wheel
  479. \pgfmathsetmacro{\wheelwidth}{\outerradius-\innerradius}
  480. \pgfmathsetmacro{\midradius}{(\outerradius+\innerradius)/2}
  481. % Rotate so we start from the top
  482. \begin{scope}[rotate=#1, on background layer]
  483. % Loop through each value set. \cumnum keeps track of where we are in the
  484. % wheel
  485. \pgfmathsetmacro{\cumnum}{0}
  486. \foreach \value/\width/\colour/\name in {#4} {
  487. \pgfmathsetmacro{\newcumnum}{\cumnum + \value/\totalnum*360}
  488. % Calculate the percent value
  489. \pgfmathsetmacro{\percentage}{\value/\totalnum*100}
  490. % Calculate the mid angle of the colour segments to place the labels
  491. \pgfmathsetmacro{\midangle}{-(\cumnum+\newcumnum)/2}
  492. % This is necessary for the labels to align nicely
  493. \pgfmathparse{
  494. (-\midangle>180?"west":"east")
  495. } \edef\textanchor{\pgfmathresult}
  496. \pgfmathparse{
  497. (-\midangle>180?"flush left":"flush right")
  498. } \edef\textalign{\pgfmathresult}
  499. \pgfmathsetmacro\labelshiftdir{1-2*(-\midangle<180)}
  500. % Draw the color segments. Somehow, the \midrow units got lost, so
  501. % we add 'pt' at the end. Not nice...
  502. \filldraw[draw=white,fill=\colour]
  503. (-\cumnum:\outerradius)
  504. arc (-\cumnum:-(\newcumnum):\outerradius)
  505. -- (-\newcumnum:\innerradius)
  506. arc (-\newcumnum:-(\cumnum):\innerradius)
  507. -- cycle;
  508. % Draw the data labels
  509. \draw [*-,thin,wheelchartlabelcolor] node [append after command={
  510. (\midangle:\midradius pt) --
  511. (\midangle:\outerradius + 1ex) --
  512. (\tikzlastnode)}] at (\midangle:\outerradius + 1ex) [
  513. xshift=\labelshiftdir*0.5cm,inner sep=1ex,
  514. outer sep=0pt,
  515. text width=\width,
  516. anchor=\textanchor,
  517. align=\textalign,
  518. font=\small,
  519. text=wheeltextcolor
  520. ]{\name};
  521. % Set the old cumulated angle to the new value
  522. \global\let\cumnum=\newcumnum
  523. }
  524. \end{scope}
  525. \end{tikzpicture}\par
  526. }
  527. \newcommand{\cvsignature}{
  528. \vfill
  529. {\large\bfseries\color{maincolor!70}\today \hfill \cvname}
  530. }
  531. %-------------------------------------------------------------------------------
  532. % SIDEBAR LAYOUT
  533. %-------------------------------------------------------------------------------
  534. % draw sidebar background on current page
  535. \newcommand{\drawSidebarBG}{%
  536. \AddToShipoutPictureBG*{%
  537. \ifthenelse{\equal{\sidebarplacement}{right}}{%
  538. \begin{tikzpicture}[remember picture, overlay]
  539. \node at (current page.north east)[
  540. rectangle,
  541. fill=sidecolor,
  542. anchor=north east,
  543. minimum width=\sidebarwidth,
  544. minimum height=\paperheight,
  545. ]{};%
  546. % plot vertical red guideline
  547. \plotvline%
  548. \end{tikzpicture}%
  549. }{% else
  550. \begin{tikzpicture}[remember picture, overlay]
  551. \node[
  552. rectangle,
  553. fill=sidecolor,
  554. anchor=north west,
  555. minimum width=\sidebarwidth,
  556. minimum height=\paperheight,
  557. ]{};%
  558. % plot vertical red guideline
  559. \plotvline%
  560. \end{tikzpicture}%
  561. }%
  562. }%
  563. }%
  564. % use textpos to position textblock within TikZ background; we have to use
  565. % the starred version for absolute values here, b/c we use \pagewidth directly
  566. % instead of \setlength{\TPHorizModule}{<dimen>}, which seems to be "absolute"
  567. % as opposed to "relative" - strange but true.
  568. \newenvironment{sidebar}{%
  569. \drawSidebarBG%
  570. \ifthenelse{\equal{\sidebarplacement}{right}}{%
  571. \begin{textblock*}{\sidebartextwidth}%
  572. (\paperwidth - \sidebarwidth + \leftrightmargin, \topbottommargin)
  573. }{% else
  574. \begin{textblock*}{\sidebartextwidth}(\leftrightmargin, \topbottommargin)
  575. }%
  576. }{%
  577. \end{textblock*}%
  578. }
  579. % provide user interface for easily adding new sections in side bars
  580. % default: empty sidebar
  581. \newcommand{\frontsidebar}{}
  582. \newcommand{\backsidebar}{}
  583. \newcommand{\addtofrontsidebar}[1]{\apptocmd{\frontsidebar}{#1}{}{}}
  584. \newcommand{\addtobacksidebar}[1]{\apptocmd{\backsidebar}{#1}{}{}}
  585. \newcommand{\makefrontsidebar}{%
  586. \begin{sidebar}
  587. % most sidebar commands end with \par; increase space between them
  588. \setlength{\parskip}{1ex}
  589. % optionally insert logo picture before profile
  590. \plotlogobefore
  591. % optionally insert profile picture
  592. \plotprofilepicture
  593. % optionally insert logo picture after profile
  594. \plotlogoafter
  595. \vspace{1ex}
  596. % name and job
  597. \nameandjob
  598. % personal information
  599. \vspace*{0.5em}
  600. \begin{icontable}[1.6]{1.7em}{0.4em}
  601. \personaldata
  602. \end{icontable}
  603. % user definitions
  604. \frontsidebar
  605. \end{sidebar}
  606. }
  607. \newcommand{\makebacksidebar}{%
  608. \begin{sidebar}
  609. % begin with name instead of picture
  610. \nameandjob
  611. % make sure there is no space at top, but after cvjob
  612. \setlength{\parskip}{1ex}
  613. % user definitions
  614. \backsidebar
  615. \end{sidebar}
  616. }
  617. %-------------------------------------------------------------------------------
  618. % LIST ENVIRONMENTS
  619. %-------------------------------------------------------------------------------
  620. % reduce space between table columns to minimum
  621. \setlength{\tabcolsep}{0pt}
  622. % cv list environment --> table, left aligned, width=textwidth
  623. % tabular starred version adds space to make table as wide as \textwidth here
  624. \newenvironment{cvtable}[1][1]{%
  625. \renewcommand{\arraystretch}{#1}%
  626. % remove additional spacing before and after longtables
  627. \setlength{\LTpre}{0pt}
  628. \setlength{\LTpost}{0pt}
  629. \iftoggle{tshowframes}{%
  630. \begin{longtabu} to \textwidth {@{\extracolsep{\fill}}|l|l|}%
  631. \hline%
  632. }{%
  633. \begin{longtabu} to \textwidth {@{\extracolsep{\fill}}ll}%
  634. }
  635. }{%
  636. \iftoggle{tshowframes}{%
  637. \hline%
  638. \end{longtabu}%
  639. }{%
  640. \end{longtabu}%
  641. }
  642. }
  643. % | <keyword> <one-line description> |
  644. % use parbox if text needs to use multiple lines
  645. \newcommand{\cvitemshort}[2]{%
  646. \parbox[t]{\datecolwidth}{\raggedright #1}
  647. & \parbox[t]{0.98\textwidth-\datecolwidth}{#2} \\}
  648. % | <date> <bold-title> \hfill <location> |
  649. % | <longer description> |
  650. % or, if description is empty:
  651. % | <date> <title> \hfill <location> |
  652. \newcommand{\cvitem}[4]{%
  653. \parbox[t]{\datecolwidth}{\raggedright #1} &%
  654. \parbox[t]{0.98\textwidth-\datecolwidth}{%
  655. \if\relax\detokenize{#4}\relax%
  656. \parbox[t]{\linewidth-\widthof{\footnotesize #3}-1em}{\raggedright #2}%
  657. \hfill {\footnotesize#3}%
  658. \else%
  659. \parbox[t]{\linewidth-\widthof{\footnotesize #3}-1em}{\raggedright \textbf{#2}}%
  660. \hfill {\footnotesize#3} \\%
  661. \textcolor{itemtextcolor}{#4}%\vspace{\parsep}%
  662. \fi%
  663. }\\
  664. }
  665. % | <date> <bold-title> \par\hfill <location> |
  666. % | <longer description> |
  667. % or, if description is empty:
  668. % | <date> <title> \par\hfill <location> |
  669. \newcommand{\cvitempar}[4]{%
  670. \parbox[t]{\datecolwidth}{\raggedright #1} &%
  671. \parbox[t]{0.98\textwidth-\datecolwidth}{%
  672. \if\relax\detokenize{#4}\relax%
  673. \parbox[t]{\textwidth}{\raggedright #2}%
  674. \par\hfill {\footnotesize#3}%
  675. \else%
  676. \parbox[t]{\textwidth}{\raggedright \textbf{#2}}%
  677. \par\hfill {\footnotesize#3} \\%
  678. \textcolor{itemtextcolor}{#4}%\vspace{\parsep}%
  679. \fi%
  680. }\\
  681. }
  682. % publication item
  683. % \cvpubitem{<title>}{<author>}{<journal>}{<year>} will produce
  684. % | <year> <bold title> |
  685. % | <italic author> |
  686. % | <journal> |
  687. \newcommand{\cvpubitem}[4]{%
  688. \parbox[t]{\datecolwidth}{\raggedright #4} &
  689. \parbox[t]{0.98\textwidth-\datecolwidth}{%
  690. \textbf{#1} \par \textit{#2} \par #3 \vspace{\parsep}%
  691. }\\
  692. }
  693. % EOF - fortysecondscv.cls