-
Notifications
You must be signed in to change notification settings - Fork 39
/
my-resume.cls
617 lines (520 loc) · 20.7 KB
/
my-resume.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% my-resume.cls
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% A class to do stuff.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CLASS OPTIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{my-resume}[2020/11/17 my-resume v0.1, my own resume/CV class.]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CLASS OPTIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% option to have a single sided document, i.e. the highlight bar is always left
% or have a two sided document where the highlight bar is alternating, i.e. always on the same edge of the paper
\RequirePackage{ifthen}
\newboolean{@singleordouble}
\setboolean{@singleordouble}{true}
\DeclareOption{singlesided}{\setboolean{@singleordouble}{true}}
\DeclareOption{doublesided}{\setboolean{@singleordouble}{false}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
\ProcessOptions*
\ifthenelse{\boolean{@singleordouble}}
{\PassOptionsToClass{oneside}{scrartcl}}
{\PassOptionsToClass{twoside}{scrartcl}}
\LoadClass{scrartcl}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% REQUIRED PACKAGES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{tikz}
\usetikzlibrary{arrows}
\RequirePackage[skins]{tcolorbox} % somehow required for tikz to work at all
\RequirePackage{graphicx}
\RequirePackage{xcolor}
\RequirePackage{fontawesome}
\RequirePackage{academicons}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FILTER IRRELEVANT WARNINGS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{silence}
% The page header is deliberately disabled in my-resume, so the warning by scrlayer-scrpage is invalid.
\WarningFilter{scrlayer-scrpage}{Very small head height detected!}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFINE GEOMETRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newlength\highlightwidth
\newlength\headerheight
\newlength\marginleft
\newlength\marginright
\newlength\margintop
\newlength\marginbottom
% default sizes, margins, ...
\setlength\highlightwidth{8cm}
\setlength\headerheight{6cm}
\setlength\marginleft{1cm}
\setlength\marginright{\marginleft}
\setlength\margintop{1cm}
\setlength\marginbottom{1cm}
\RequirePackage[bindingoffset=0cm,nomarginpar,noheadfoot]{geometry}
\geometry{left=\marginleft,right=\marginright,top=\margintop,bottom=\marginbottom}
% \setlength{\voffset}{\dimexpr -1in+\margintop}
% \setlength{\topmargin}{0cm}
% minipage has an annoying af indent that must be removed
\setlength{\parindent}{0pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% COLORS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{xcolor}
% Gray-scale colors
\definecolor{white}{HTML}{FFFFFF}
\definecolor{black}{HTML}{000000}
\definecolor{darkgray}{HTML}{333333}
\definecolor{mediumgray}{HTML}{444444}
\definecolor{gray}{HTML}{5D5D5D}
% Basic colors
\definecolor{green}{HTML}{C2E15F}
\definecolor{orange}{HTML}{FDA333}
\definecolor{purple}{HTML}{D3A4F9}
\definecolor{red}{HTML}{FB4485}
\definecolor{blue}{HTML}{6CE0F1}
% Text colors
\definecolor{darktext}{HTML}{414141}
\colorlet{text}{darkgray}
\colorlet{graytext}{gray}
% Awesome colors
\definecolor{awesome-emerald}{HTML}{00A388}
\definecolor{awesome-skyblue}{HTML}{0395DE}
\definecolor{awesome-red}{HTML}{DC3522}
\definecolor{awesome-pink}{HTML}{EF4089}
\definecolor{awesome-orange}{HTML}{FF6138}
\definecolor{awesome-nephritis}{HTML}{27AE60}
\definecolor{awesome-concrete}{HTML}{95A5A6}
\definecolor{awesome-darknight}{HTML}{131A28}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% COLORED BARS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{xpatch}
\RequirePackage{scrlayer-scrpage}
% declare new page style using layers
\DeclareNewPageStyleByLayers{headerhighlightmain}{%
highlightbar.even,%
highlightbar.odd,%
header.bg
}
\DeclareNewPageStyleByLayers{highlightmain}{%
highlightbar.even,%
highlightbar.odd
}
\DeclareNewPageStyleByLayers{headermain}{%
header.bg
}
% define the layer for the highlight bar on odd pages
\DeclareNewLayer[
background,
oddpage,
innermargin,
width=\highlightwidth,
contents={\color{highlightbarcolor}\rule{\layerwidth}{\layerheight}}
]{highlightbar.odd}
% clone highlight bar form odd pages to even pages
% on same side for digital format
\newcommand*\highlightbarsingle{%
\DeclareNewLayer[
background,
evenpage,
outermargin,
width=\highlightwidth,
contents={\color{highlightbarcolor}\rule{\layerwidth}{\layerheight}}
]{highlightbar.even}
}
% clone highlight bar from odd pages to even pages
% on opposite sides for prints
\newcommand*\highlightbardouble{%
\DeclareNewLayer[
clone=highlightbar.odd,
evenpage,
align=r,
hoffset=\paperwidth
]{highlightbar.even}
}
% use the correct version of the highlight bar on even pages
% single for single, double for double
\ifthenelse{
\boolean{@singleordouble}
}{%
\DeclareNewLayer[
background,
evenpage,
outermargin,
width=\highlightwidth,
contents={\color{highlightbarcolor}\rule{\layerwidth}{\layerheight}}
]{highlightbar.even}
}{%
\DeclareNewLayer[
clone=highlightbar.odd,
evenpage,
align=r,
hoffset=\paperwidth
]{highlightbar.even}
}
% define the layer for the header
\DeclareNewLayer[
background,
topmargin,
addheight=\headerheight,
contents={\color{headerbarcolor}\rule{\layerwidth}{\layerheight}}
]{header.bg}
% % add the layers to page style plain
% \ForEachLayerOfPageStyle*{headerhighlightmain}{%
% \AddLayersToPageStyle{plain.scrheadings}{#1}%
% }
% remove anything that might be there (page number) from header and footer
\lehead[]{}
\cehead[]{}
\rehead[]{}
\lohead[]{}
\cohead[]{}
\rohead[]{}
\lefoot[]{}
\cefoot[]{}
\refoot[]{}
\lofoot[]{}
\cofoot[]{}
\rofoot[]{}
% convenience functions to enable/disable header or highlightbar
% TBD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% HEADER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% variables for name, tag line and photo setup
\newcommand{\name}[1]{\def\@name{#1}}
\newcommand{\tagline}[1]{\def\@tagline{#1}}
\newcommand{\photo}[3][]{\def\@photo{#2}\def\@photodiameter{#3}\def\@photoformat{#1}}
% try to align the top of the written out name with the top of the photo
% it is impossible to get the actual height of a line to determine the offset between line top and charachter top
% therefore use a bad workaround by setting the line height to 1.5 times the character height
\newlength{\@namefontheight}
\newlength{\@namelineheight}
\settoheight{\@namefontheight}{\Huge\bfseries\MakeUppercase{A}}
\setlength\@namelineheight{1.5\@namefontheight}
% assemble the header
\newcommand{\makeheader}{% header bar is a minipage
\begin{minipage}[t][\headerheight]{\textwidth}%
% \vspace{-1em}
\vspace{\dimexpr \@namefontheight-\@namelineheight} % align top of name and photo
% create two minipages for header text and photo if photo is given
\ifdef{\@photodiameter}{
\begin{minipage}[t]{\dimexpr \textwidth-\@photodiameter} % to top align name and photo add [t] here
\vspace{0cm}%
}{
\begin{minipage}[t]{\textwidth}
}
% print the header text
\begin{minipage}[t][2em]{\linewidth}
{\Huge\bfseries\color{headerfontcolor}\MakeUppercase{\@name}\par}
\end{minipage}%
\vfill%
\begin{minipage}[b][\dimexpr \headerheight-2em-\marginbottom]{\linewidth}%
{\large\bfseries\color{headerfontcolor}\@tagline\par}
\end{minipage}%
% finish the minipages for text and photo if photo is given
\ifdef{\@photodiameter}{%
\end{minipage}\hfil%
\begin{minipage}[t]{\@photodiameter} % to top align name and photo add [t] here
\vspace{0cm}
% format as square or round
\ifthenelse{\equal{\@photoformat}{square}}{%
\includegraphics[width=\linewidth]{\@photo}%
}{%
\tikz\path[fill overzoom image={\@photo}]circle[radius=0.5\linewidth];
}
\end{minipage}%
}{
\end{minipage}
}
\end{minipage}%
}
\newcommand{\emptyheader}{%
\vspace*{\dimexpr \headerheight+0.5em}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BODY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% contact info
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\infofield}[2]{%
\begin{minipage}[t]{\linewidth}%
\begin{minipage}[t]{5mm}% wrap marker in minipage to allow multi-line contact info
\makebox[5mm][c]{\textcolor{accent}{\normalsize #1}}
\end{minipage}%
\hspace{0.5em}%
\begin{minipage}[t]{\dimexpr \linewidth-5mm-0.5em}% wrap info in minipage to allow multi-line info
#2
\end{minipage}%
\end{minipage}%
\vspace{0.2em}\newline
}
\newcommand{\email}[1]{\infofield{\faEnvelope}{\href{mailto:#1}{#1}}}
\newcommand{\address}[1]{\infofield{\faAt}{#1}}
\newcommand{\location}[1]{\infofield{\faMapMarker}{#1}}
\newcommand{\phone}[1]{\infofield{\faPhone}{#1}}
\newcommand{\homepage}[2]{\infofield{\faHome}{\href{#2}{#1}}}
\newcommand{\linkedin}[2]{\infofield{\faLinkedin}{\href{#2}{#1}}}
\newcommand{\twitter}[2]{\infofield{\faTwitter}{\href{#2}{#1}}}
\newcommand{\github}[2]{\infofield{\faGithub}{\href{#2}{#1}}}
\newcommand{\orcid}[2]{\infofield{\aiOrcid}{\href{#2}{#1}}}
\newcommand{\ads}[2]{\infofield{\aiADS}{\href{#2}{#1}}}
% highlight bar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\highlightbar}[1]{%
\def\@highlightbar{%
\begin{minipage}[t]{\dimexpr \highlightwidth-\marginleft-\marginright}%
#1%
\end{minipage}%
}
}
% main bar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\mainbar}[1]{%
\def\@mainbar{%
\begin{minipage}[t]{\dimexpr \textwidth-\highlightwidth}%
#1%
\end{minipage}%
}
}
% make body with highlight bar and main bar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\makebody}{%
\ifthenelse{\boolean{@singleordouble}}
{% if single layout, the highlight bar is always left
\@highlightbar
\hspace{\dimexpr \marginleft+\marginright}%
\@mainbar
}{% if double layout, the highlight bar alternates
\ifthispageodd{% if the page is odd, the highlight bar is on the left (as is for single layout)
\@highlightbar
\hspace{\dimexpr \marginleft+\marginright}%
\@mainbar
}{% if the page is even, the highlight bar is on the right
\@mainbar
\hspace{\dimexpr \marginleft+\marginright}%
\@highlightbar
}
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SECTIONS, SUBSECTIONS, AND MORE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% redefine section in caps, bold and with rule below
\renewcommand{\section}[2][]{%
\bigskip%
% \ifstrequal{#1}{}{}{\marginpar{\vspace*{\dimexpr 1pt-\baselineskip}\raggedright\input{#1}}}%
\ifstrequal{#1}{}{}{\large \makebox[5mm][c]{#1}\hspace{0.5em}}
{\color{heading}\Large\bfseries\MakeUppercase{#2}}\\[-1ex]%
{\color{heading}\rule{\linewidth}{1.0pt}\par}\smallskip
}
% redefine subsection as bold
\renewcommand{\subsection}[1]{%
\smallskip%
{\color{emphasis}\large\bfseries{#1}\par}\medskip
}
% format job/school list
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% set length of date/place column versus position column in fraction of linewidth before linewidth gets redefined in minipages
\newlength{\jobdateplacelength}
\newlength{\jobpositionlength}
\setlength{\jobdateplacelength}{0.4\linewidth}
\setlength{\jobpositionlength}{0.6\linewidth}
\newcommand{\job}[4]{%
\begin{minipage}[t]{\jobdateplacelength}% minipage for left column with date/place
\footnotesize
\begin{minipage}[t]{3mm}% wrap marker in minipage to allow multi-line dates
\makebox[3mm][c]{\faCalendar}
\end{minipage}%
\hspace{0.5em}%
\begin{minipage}[t]{\dimexpr \jobdateplacelength-3mm-0.5em}% wrap date in minipage to allow multi-line dates
#1
\end{minipage}%
\par
\vspace{0.1em}
\begin{minipage}[t]{3mm}% wrap marker in minipage to allow multi-line places
\makebox[3mm][c]{\faMapMarker}
\end{minipage}%
\hspace{0.5em}%
\begin{minipage}[t]{\dimexpr \jobdateplacelength-3mm-0.5em}% wrap place in minipage to allow multi-line places
#2
\end{minipage}%
\end{minipage}%
\begin{minipage}[t]{\jobpositionlength}% minipage for position
{\large \color{emphasis} #3}
\end{minipage}%
\ifstrequal{#4}{}{}{\par \vspace{0.1em} \footnotesize #4}
\par\normalsize
\vspace{0.5em}
}
% skill with 5 dot bar chart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\skill}[2]{%
\textcolor{emphasis}{\textbf{#1}}\hfill
\foreach \x in {1,...,5}{%
\space{\ifnumgreater{\x}{#2}{\color{gray}}{\color{accent}}\faCircle}}\par%
}
% skill without any charts
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\simpleskill}[1]{%
\textcolor{emphasis}{\textbf{#1}}\par%
}
% sectioning of skills
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\skillsection}[1]{%
\textit{\color{accent}#1}\par
}
% tag (framed word or phrase)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% adapted from AltaCV: https://github.com/liantze/AltaCV
\newcommand{\tag}[1]{%
\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};
}
% wheel chart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% adapted from AltaCV: https://github.com/liantze/AltaCV
\newcommand{\wheelchart}[4][0]{%
\begingroup\centering
\def\innerradius{#3}%
\def\outerradius{#2}%
% Calculate total
\pgfmathsetmacro{\totalnum}{0}%
\foreach \value/\colour/\name in {#4} {%
\pgfmathparse{\value+\totalnum}%
\global\let\totalnum=\pgfmathresult%
}%
\begin{tikzpicture}
% Calculate the thickness and the middle line of the wheel
\pgfmathsetmacro{\wheelwidth}{\outerradius-\innerradius}
\pgfmathsetmacro{\midradius}{(\outerradius+\innerradius)/2}
\pgfmathsetmacro{\totalrot}{-90 + #1}
% Rotate so we start from the top
\begin{scope}[rotate=\totalrot]
% Loop through each value set. \cumnum keeps track of where we are in the wheel
\pgfmathsetmacro{\cumnum}{0}
\foreach \value/\width/\colour/\name in {#4} {
\pgfmathsetmacro{\newcumnum}{\cumnum + \value/\totalnum*360}
% Calculate the percent value
\pgfmathsetmacro{\percentage}{\value/\totalnum*100}
% Calculate the mid angle of the colour segments to place the labels
\pgfmathsetmacro{\midangle}{-(\cumnum+\newcumnum)/2}
% This is necessary for the labels to align nicely
\pgfmathparse{
(-\midangle>180?"west":"east")
} \edef\textanchor{\pgfmathresult}
\pgfmathparse{
(-\midangle>180?"flush left":"flush right")
} \edef\textalign{\pgfmathresult}
\pgfmathsetmacro\labelshiftdir{1-2*(-\midangle<180)}
% Draw the color segments. Somehow, the \midrow units got lost, so we add 'pt' at the end. Not nice...
\filldraw[draw=white,fill=\colour] (-\cumnum:\outerradius) arc (-\cumnum:-(\newcumnum):\outerradius) --
(-\newcumnum:\innerradius) arc (-\newcumnum:-(\cumnum):\innerradius) -- cycle;
% Draw the data labels
\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};
% Set the old cumulated angle to the new value
\global\let\cumnum=\newcumnum
}
\end{scope}
% \draw[gray] (0,0) circle (\outerradius) circle (\innerradius);
\end{tikzpicture}\par
\endgroup
}
% publication
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*{\ADS}[1]{\textcolor{awesome-skyblue}{\href{#1}{ADS}}}
\newcommand*{\arXiv}[1]{\textcolor{awesome-skyblue}{\href{#1}{arXiv}}}
\newlength{\pubdatelength}
\newlength{\pubjournallength}
\newlength{\publinklength}
% Spacings work erratically. Setting a highlight bar or not redefines \linewidth in a weird way which breaks the spacing and introduces line breaks. I have no idea what exactly causes this problem.
% helper function to set spacings that work empirically
\newcommand{\pubdefaultspacing}{%
\setlength{\pubdatelength}{0.15\linewidth}
\setlength{\pubjournallength}{0.65\linewidth}
\setlength{\publinklength}{0.20\linewidth}
}
% helper function to force the publication to use the full width in normal page styles without highlight bar or header
\newcommand{\pubforcefullwidth}{%
\setlength{\pubdatelength}{0.1\textwidth}
\setlength{\pubjournallength}{0.8\textwidth}
\setlength{\publinklength}{0.1\textwidth}
}
% \pubforcefullwidth
\pubdefaultspacing
\newcommand{\publication}[5]{%
{\normalsize \color{emphasis}#1\par}
\vspace{0.1em}%
\begin{minipage}[t]{3mm}%
\makebox[3mm][c]{\footnotesize \faGroup}
\end{minipage}%
\hspace{0.5em}%
\begin{minipage}[t]{\dimexpr \linewidth-3mm-0.5em}%
{\footnotesize #2\par}
\end{minipage}%
\par%
\vspace{0.25em}%
\ifstrequal{#4}{}{%
\begin{minipage}[t]{\dimexpr \pubdatelength+\pubjournallength-1.0em}%
\footnotesize \makebox[3mm][c]{\faCalendar} \hspace{0.25em} #3
\end{minipage}%
}{%
\begin{minipage}[t]{\dimexpr \pubdatelength-1.0em}%
\footnotesize \makebox[3mm][c]{\faCalendar} \hspace{0.25em} #3
\end{minipage}%
}%
\hspace{1.0em}
\begin{minipage}[t]{\dimexpr \pubjournallength-1.0em}%
\ifstrequal{#4}{}{}{%
\begin{minipage}[t]{3mm}%
\makebox[3mm][c]{\footnotesize \faBook}
\end{minipage}%
\hspace{0.5em}%
\begin{minipage}[t]{\dimexpr \linewidth-3mm-0.25em}%
{\footnotesize #4\par}
\end{minipage}%
}%
\end{minipage}%
\hspace{1.0em}
\begin{minipage}[t]{\publinklength}%
\ifstrequal{#5}{}{}{%
\footnotesize \makebox[3mm][c]{\faChain} \hspace{0.25em} #5\par
}%
\end{minipage}%
\par\normalsize
\vspace{1.0em}
}
% achievement
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\achievement}[1]{%
\begin{minipage}[t]{3mm}%
\makebox[3mm][c]{\footnotesize \faTrophy}
\end{minipage}%
\hspace{0.5em}%
\begin{minipage}[t]{\dimexpr \textwidth-0.5em-3mm}%
{\normalsize #1\par}
\end{minipage}%
\par
\vspace{0.5em}
}
% lists
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{enumitem}
\setlist[itemize]{noitemsep, topsep=0pt, leftmargin=1em}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FINAL FORMATTING
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{headerhighlightmain}
\RequirePackage{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% THE END
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%