cv-bubble

Personal PDF CV, fork of github.com/mateuszbaransanok/BubbleCV
git clone https://git.in0rdr.ch/cv-bubble.git
Log | Files | Refs | Pull requests |Archive | README | LICENSE

bubblecv.sty (17935B)


      1 %========================================================================================
      2 % PARAMETERS
      3 %========================================================================================
      4 
      5 %----------------------------------------------------------------------------------------
      6 % CV SCALE
      7 %----------------------------------------------------------------------------------------
      8 \newcommand\cvscale{1}
      9 
     10 %----------------------------------------------------------------------------------------
     11 % FONT
     12 %----------------------------------------------------------------------------------------
     13 \newcommand\cvfont{ppl}
     14 \newcommand\cvheadertitlefontscale{2.25}
     15 \newcommand\cvheadersubtitlefontscale{1.5}
     16 \newcommand\cvsectionfontscale{1.75}
     17 \newcommand\cvnamefontscale{1.25}
     18 \newcommand\cvdescriptionfontscale{1}
     19 
     20 %----------------------------------------------------------------------------------------
     21 % MARGIN
     22 %----------------------------------------------------------------------------------------
     23 \newcommand\cvheadermargin{5}
     24 \newcommand\cvtopmargin{10}
     25 \newcommand\cvbottommargin{10}
     26 \newcommand\cvleftmargin{35}
     27 \newcommand\cvrightmargin{10}
     28 
     29 %----------------------------------------------------------------------------------------
     30 % HEADER
     31 %----------------------------------------------------------------------------------------
     32 \newcommand\cvavatarradius{20}
     33 \newcommand\cvavatarborderwidth{1}
     34 \newcommand\cvheaderoffset{5}
     35 
     36 %----------------------------------------------------------------------------------------
     37 % TIMELINE
     38 %----------------------------------------------------------------------------------------
     39 \newcommand\cvtimelineoffset{25}
     40 \newcommand\cvtimelinewidth{0.5}
     41 
     42 %----------------------------------------------------------------------------------------
     43 % MAIN
     44 %----------------------------------------------------------------------------------------
     45 \newcommand\cvmainspace{3}
     46 \newcommand\cvmainbubbleradius{6}
     47 \newcommand\cvmainbubbleborderwidth{1}
     48 
     49 %----------------------------------------------------------------------------------------
     50 % EVENT
     51 %----------------------------------------------------------------------------------------
     52 \newcommand\cveventdatewidth{16}
     53 \newcommand\cveventbubbleradius{3}
     54 \newcommand\cveventbubbleborderwidth{1}
     55 
     56 %----------------------------------------------------------------------------------------
     57 % SIDEBAR
     58 %----------------------------------------------------------------------------------------
     59 \newcommand\cvsidebarspace{3}
     60 \newcommand\cvsidebarbubbleradius{6}
     61 \newcommand\cvsidebarbubbleborderwidth{1}
     62 \newcommand\cvsidebaroffset{2}
     63 
     64 %----------------------------------------------------------------------------------------
     65 % COLUMN
     66 %----------------------------------------------------------------------------------------
     67 \newcommand\cvcolumnratio{0.6}
     68 \newcommand\cvspacebetweencolumns{12}
     69 
     70 %----------------------------------------------------------------------------------------
     71 % SEPARATOR
     72 %----------------------------------------------------------------------------------------
     73 \newcommand\cvseparatorscale{1}
     74 
     75 %----------------------------------------------------------------------------------------
     76 % COLORS
     77 %----------------------------------------------------------------------------------------
     78 \usepackage{xcolor}
     79 \definecolor{cvcolor}{RGB}{20, 20, 20}                      % main color
     80 \definecolor{cvbordercolor}{RGB}{255, 255, 255}             % border color
     81 \definecolor{cvavatarbordercolor}{RGB}{255, 255, 255}       % avatar border color
     82 \definecolor{cvtimelinecolor}{RGB}{0, 0, 0}                 % timeline color
     83 \definecolor{cvlightcolor}{RGB}{245, 245, 245}              % light color
     84 
     85 %========================================================================================
     86 % CONFIGURATION
     87 %========================================================================================
     88 
     89 %----------------------------------------------------------------------------------------
     90 % RESCALE
     91 %----------------------------------------------------------------------------------------
     92 \usepackage{fp} 
     93 \FPeval{\cvavatarradius}{\cvscale*\cvavatarradius}  
     94 \FPeval{\cvavatarborderwidth}{\cvscale*\cvavatarborderwidth}
     95 \FPeval{\cvmainspace}{\cvscale*\cvmainspace}
     96 \FPeval{\cvmainbubbleradius}{\cvscale*\cvmainbubbleradius}
     97 \FPeval{\cvmainbubbleborderwidth}{\cvscale*\cvmainbubbleborderwidth}
     98 \FPeval{\cveventdatewidth}{\cvscale*\cveventdatewidth}
     99 \FPeval{\cveventbubbleradius}{\cvscale*\cveventbubbleradius}
    100 \FPeval{\cveventbubbleborderwidth}{\cvscale*\cveventbubbleborderwidth}
    101 \FPeval{\cvsidebarspace}{\cvscale*\cvsidebarspace}
    102 \FPeval{\cvsidebarbubbleradius}{\cvscale*\cvsidebarbubbleradius}
    103 \FPeval{\cvsidebarbubbleborderwidth}{\cvscale*\cvsidebarbubbleborderwidth}
    104 \FPeval{\cvseparatorscale}{\cvscale*\cvseparatorscale}
    105 
    106 %----------------------------------------------------------------------------------------
    107 % SETTINGS
    108 %----------------------------------------------------------------------------------------
    109 \newcommand\packagename{bubblecv}
    110 
    111 \usepackage[a4paper]{geometry}
    112 \geometry{top=\cvtopmargin mm, bottom=\cvbottommargin mm, left=\cvleftmargin mm, right=\cvrightmargin mm}
    113 
    114 \setlength{\topskip}{0mm}                                   % no top margin default
    115 \setlength{\parindent}{0mm}                                 % no indent default
    116 \pagenumbering{gobble}                                      % disable page numbering
    117 
    118 \usepackage{enumitem}
    119 \setlist[itemize]{noitemsep, nolistsep, leftmargin=*}       % default list style
    120 
    121 %----------------------------------------------------------------------------------------
    122 % COMMON PACKAGES
    123 %----------------------------------------------------------------------------------------
    124 \usepackage[utf8]{inputenc}  % for utf-8 encoding
    125 \usepackage{xparse}          % new document command
    126 \usepackage{ifthen}          % if then else
    127 \usepackage{tabularx}        % tabular for progress bar
    128 \usepackage{hyperref}        % hyper ref
    129 
    130 %----------------------------------------------------------------------------------------
    131 % COLUMNS
    132 %----------------------------------------------------------------------------------------
    133 \usepackage{paracol}
    134 \setlength{\columnsep}{\cvspacebetweencolumns mm}       % space between columns
    135 \newcommand\iscvsidebar{0}                              % flag if sidebar is active
    136 
    137 %----------------------------------------------------------------------------------------
    138 % FONTS & ICONS
    139 %----------------------------------------------------------------------------------------
    140 \usepackage{relsize}        % for font scaling
    141 \usepackage[T1]{fontenc}    % use T1 encoded fonts for all ASCII characters
    142 \usepackage{fontawesome}
    143 % allow icons to scale
    144 \DeclareFontFamily{U}{fontawesomeOne}{}
    145 \DeclareFontShape{U}{fontawesomeOne}{m}{n}{<-> FontAwesome--fontawesomeone}{}
    146 \DeclareRobustCommand\FAone{\fontencoding{U}\fontfamily{fontawesomeOne}\selectfont}
    147 
    148 %----------------------------------------------------------------------------------------
    149 % TIMELINE
    150 %----------------------------------------------------------------------------------------
    151 \usepackage{silence}
    152 \WarningsOff[everypage]         % disable warning about problems with background package
    153 \usepackage{background}
    154 \SetBgScale{1}
    155 \SetBgAngle{0}
    156 \SetBgColor{cvtimelinecolor}
    157 \SetBgContents{\rule{\cvtimelinewidth mm}{\textheight}}
    158 % start offset from left edge of a4 paper instead of center
    159 \SetBgHshift{\dimexpr(\cvtimelineoffset mm - 105 mm)}
    160 \newcommand{\timelinespace}{\the\numexpr\cvleftmargin - \cvtimelineoffset\relax}
    161 
    162 %----------------------------------------------------------------------------------------
    163 % FOOTNOTE
    164 %----------------------------------------------------------------------------------------
    165 \setlength{\skip\footins}{0.25\baselineskip}
    166 
    167 %----------------------------------------------------------------------------------------
    168 % DRAW CIRCLE
    169 %----------------------------------------------------------------------------------------
    170 % Draw a circle with the image inside.
    171 % Parameter 1 (optional):   Path to image resource.
    172 % Parameter 2 (optional):   Image scale.
    173 % Parameter 3:              Circle radius in millimeters.
    174 % Parameter 4:              Circle border width in millimeters.
    175 % Parameter 5:              Circle background color in RGB.
    176 % Parameter 6:              Circle border color in RGB.
    177 \NewDocumentCommand{\drawcircle}{O{} O{1} m m m m}{%
    178     \begin{tikzpicture}%
    179         \draw[%
    180             draw=#6, fill=#5, line width=#4mm,%
    181             path picture={%
    182                 \ifthenelse{\equal{#1}{}}{}{%
    183                     \node at (path picture bounding box.center){%
    184                         \includegraphics[%
    185                             width=#2\dimexpr#3mm\relax,%
    186                             height=#2\dimexpr#3mm\relax]{#1}%
    187                     };%
    188                 }%
    189             }%
    190         ] (0,0) circle (\dimexpr#3mm-#4mm/2\relax);%
    191     \end{tikzpicture}%
    192 }%
    193 
    194 %========================================================================================
    195 % PUBLIC FUNCTIONS
    196 %========================================================================================
    197 
    198 %----------------------------------------------------------------------------------------
    199 % CV
    200 %----------------------------------------------------------------------------------------
    201 % Main CV function that prepares the entire layout.
    202 % Parameter 1 (optional):   Path to avatar resource.
    203 % Parameter 2 (optional):   Avatar scale.
    204 % Parameter 3:              Name.
    205 % Parameter 4:              Description.
    206 \NewDocumentEnvironment{cv}{O{} O{2} m m}{%
    207     \relscale{\cvscale}%
    208     \fontfamily{\cvfont}%
    209     
    210     \vspace*{\cvheadermargin mm}%
    211     \vspace*{-\cvtopmargin mm}%
    212     \hspace{-\timelinespace mm}%
    213     \hspace{-\cvavatarradius mm}%
    214     \begin{minipage}{\dimexpr(\cvavatarradius mm + \cvavatarradius mm)}%
    215         \protect\ifthenelse{\equal{#1}{}}%
    216             {\drawcircle{\cvavatarradius}{\cvavatarborderwidth}{cvcolor}{cvavatarbordercolor}}%
    217             {\drawcircle[resources/#1][#2]{\cvavatarradius}{\cvavatarborderwidth}{cvcolor}{cvavatarbordercolor}}%
    218     \end{minipage}%
    219     \hspace{\cvheaderoffset mm}%
    220     \begin{minipage}{\dimexpr(\linewidth + \timelinespace mm - \cvavatarradius mm - \cvheaderoffset mm)}%
    221         \textscale{\cvheadertitlefontscale}{#3}%
    222         \cvseparator[3]%
    223         \textscale{\cvheadersubtitlefontscale}{#4}%
    224     \end{minipage}%
    225     
    226     \columnratio{\cvcolumnratio}%
    227     
    228     \begin{paracol}{2}%
    229 }{%
    230     \end{paracol}%
    231 }%
    232 
    233 %----------------------------------------------------------------------------------------
    234 % CV SECTION
    235 %----------------------------------------------------------------------------------------
    236 % Groups events, items and skills inside one block.
    237 % Parameter 1 (optional):   Path to icon resource.
    238 % Parameter 2 (optional):   Icon scale.
    239 % Parameter 3:              Section title.
    240 \NewDocumentCommand{\cvsection}{O{} O{1} m}{%
    241     \ifthenelse{\equal{\iscvsidebar}{0}}{%
    242         \vspace{\cvmainspace mm}%
    243         \hspace{-\timelinespace mm}%
    244         \hspace{-\cvmainbubbleradius mm}%
    245         \begin{minipage}{\dimexpr(\cvmainbubbleradius mm + \cvmainbubbleradius mm)}%
    246             \ifthenelse{\equal{#1}{}}%
    247                 {\protect\drawcircle{\cvmainbubbleradius}{\cvmainbubbleborderwidth}{cvcolor}{cvbordercolor}}%
    248                 {\protect\drawcircle[resources/#1][#2]{\cvmainbubbleradius}{\cvmainbubbleborderwidth}{cvcolor}{cvbordercolor}}%
    249         \end{minipage}%
    250         \hspace{\dimexpr(\timelinespace mm - \cvmainbubbleradius mm)}%
    251         \begin{minipage}{\linewidth}%
    252             \textscale{\cvsectionfontscale}{\textbf{#3}}%
    253         \end{minipage}%
    254         \cvseparator%
    255     }{%
    256         \vspace{\cvsidebarspace mm}%
    257         \hspace{-\cvsidebarbubbleradius mm}%
    258         \begin{minipage}{\dimexpr(\cvsidebarbubbleradius mm + \cvsidebarbubbleradius mm)}%
    259             \protect\ifthenelse{\equal{#1}{}}%
    260                 {\drawcircle{\cvsidebarbubbleradius}{\cvsidebarbubbleborderwidth}{cvcolor}{cvbordercolor}}%
    261                 {\drawcircle[resources/#1][#2]{\cvsidebarbubbleradius}{\cvsidebarbubbleborderwidth}{cvcolor}{cvbordercolor}}%
    262         \end{minipage}%
    263         \hspace{\cvsidebaroffset mm}%
    264         \begin{minipage}{\dimexpr(\linewidth - \cvsidebarbubbleradius mm - \cvsidebaroffset mm)}%
    265             \textscale{\cvsectionfontscale}{\textbf{#3}}%
    266         \end{minipage}%
    267         \cvseparator%
    268     }%
    269 }%
    270 
    271 %----------------------------------------------------------------------------------------
    272 % CV EVENT
    273 %----------------------------------------------------------------------------------------
    274 % Contains information about the event.
    275 % Parameter 1 (optional):   Start date of the event.
    276 % Parameter 2 (optional):   End date of the event.
    277 % Parameter 3:              Content.
    278 \NewDocumentEnvironment{cvevent}{O{} O{} +b}{%
    279     \ifthenelse{\equal{\iscvsidebar}{0}}{%
    280         \hspace{-\cveventbubbleradius mm}%
    281         \hspace{-\timelinespace mm}%
    282         \hspace{-\cveventdatewidth mm}%
    283         \begin{minipage}[t]{\cveventdatewidth mm}%
    284             \begin{center}%
    285                 \ifthenelse{\equal{#2}{}}{%
    286                     \ifthenelse{\equal{#1}{}}{}{%
    287                         \textbf{#1}\par%
    288                     }%
    289                 }{%
    290                     \textbf{#2}\par%
    291                     \textbf{$\uparrow$}\par%
    292                     \textbf{#1}%
    293                 }%
    294             \end{center}%
    295         \end{minipage}%
    296         \begin{minipage}{\dimexpr(\cveventbubbleradius mm + \cveventbubbleradius mm)}%
    297             \protect\drawcircle{\cveventbubbleradius}{\cveventbubbleborderwidth}{cvcolor}{cvbordercolor}%
    298         \end{minipage}%
    299         \hspace{\dimexpr(\timelinespace mm - \cveventbubbleradius mm)}%
    300         \begin{minipage}[t]{\linewidth}%
    301             #3%
    302         \end{minipage}%
    303         \par%
    304     }{%
    305         \PackageError{\packagename}{The cvevent can be used only in the main column}{}%
    306     }%
    307 }{}%
    308 
    309 %----------------------------------------------------------------------------------------
    310 % CV SEPARATOR
    311 %----------------------------------------------------------------------------------------
    312 % Vertical space between paragraphs.
    313 % Parameter 1 (optional):   Space size in millimeters.
    314 \NewDocumentCommand{\cvseparator}{O{1}}{\vspace{#1\dimexpr\cvseparatorscale mm\relax}\par}
    315 
    316 %----------------------------------------------------------------------------------------
    317 % CV NAME
    318 %----------------------------------------------------------------------------------------
    319 % The title of the event header.
    320 % Parameter 1:              Event title.
    321 \newcommand{\cvname}[1]{\textscale{\cvnamefontscale}{\textbf{#1}}\cvseparator}
    322 
    323 %----------------------------------------------------------------------------------------
    324 % CV DESCRIPTION
    325 %----------------------------------------------------------------------------------------
    326 % The description of the event header.
    327 % Parameter 1:              Event description.
    328 \newcommand{\cvdescription}[1]{\textscale{\cvdescriptionfontscale}{\textit{\textbf{#1}}}\cvseparator[2]}
    329 
    330 %----------------------------------------------------------------------------------------
    331 % CV SIDEBAR
    332 %----------------------------------------------------------------------------------------
    333 % Switches the main column to the sidebar.
    334 \newcommand{\cvsidebar}[0]{%
    335     \ifthenelse{\equal{\iscvsidebar}{0}}{%
    336         \switchcolumn%
    337         \renewcommand{\iscvsidebar}{1}%
    338     }{%
    339         \PackageError{\packagename}{The cvsidebar can be used only once}{}%
    340     }%
    341 }%
    342 
    343 %----------------------------------------------------------------------------------------
    344 % CV ITEM
    345 %----------------------------------------------------------------------------------------
    346 % List item with a label.
    347 % Parameter 1 (optional):   Icon name from fontawesome package.
    348 % Parameter 2 (optional):   Icon size in milimeters.
    349 % Parameter 3:              Content.
    350 \NewDocumentEnvironment{cvitem}{O{Circle} O{2.5} +b}{%
    351     \ifthenelse{\equal{\iscvsidebar}{1}}{%
    352         \begin{minipage}{\cvscale\dimexpr#2mm\relax}%
    353             \makebox(0, 0){\textcolor{cvcolor}{\fontsize{\cvscale\dimexpr#2mm\relax}{\cvscale\dimexpr#2mm\relax}\csname fa#1\endcsname}}%
    354         \end{minipage}%
    355         \hspace{\cvsidebaroffset mm}%
    356         \begin{minipage}{\dimexpr(\linewidth - \cvsidebaroffset mm - \cvscale\dimexpr#2mm\relax)}%
    357             #3%
    358         \end{minipage}%
    359         \par%
    360     }{%
    361         \PackageError{\packagename}{The cvitem can be used only in the sidebar column}{}%
    362     }%
    363 }{}%
    364 
    365 %----------------------------------------------------------------------------------------
    366 % CV SKILL
    367 %----------------------------------------------------------------------------------------
    368 % Renders a progress-bar to indicate a certain skill in percent.
    369 % Parameter 1:              Name of skill.
    370 % Parameter 2:              Skill level.
    371 % Parameter 3:              Percent of the progress-bar in range [0, 1].
    372 \newcommand{\cvskill}[3]{%
    373     \ifthenelse{\equal{\iscvsidebar}{1}}{%
    374 	\begin{tabularx}{\linewidth}{>{\raggedright\arraybackslash}X>{\raggedleft\arraybackslash}X}%
    375  		\textcolor{black}{\textbf{#1}} & \textcolor{cvcolor}{#2}%
    376 	\end{tabularx}%
    377 	
    378 	\begin{tikzpicture}[scale=1,rounded corners=\cvscale*0.5mm,very thin]%
    379 		\fill [cvlightcolor] (0,0) rectangle (\linewidth, 0.15*\cvscale);%
    380 		\fill [cvcolor] (0,0) rectangle (#3\linewidth, 0.15*\cvscale);%
    381   	\end{tikzpicture}%
    382 	\cvseparator[2]%
    383     }{%
    384         \PackageError{\packagename}{The cvskill can be used only in the sidebar column}{}%
    385     }%
    386 }%
    387 
    388 %----------------------------------------------------------------------------------------
    389 % CV FOOTNOTE
    390 %----------------------------------------------------------------------------------------
    391 % Footnote without order number and hyperlink.
    392 % Parameter 1:              Footnote content.
    393 \newcommand\cvfootnote[1]{%
    394   \begingroup%
    395   \renewcommand\thefootnote{}\footnote{#1}%
    396   \addtocounter{footnote}{-1}%
    397   \endgroup%
    398 }%