% \iffalse meta-comment
%
% Copyright (C) 2017 - 2021 by Olivier Pieters
% --------------------------------------------------------------------------
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008-05-04 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Olivier Pieters.
%
% This work consists of the files limecv.dtx and limecv.ins
% and the derived filebase limecv.cls.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{limecv.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{limecv}
%<*class>
    [2021/12/01 v0.1.12 limecv Document class for CVs.]
%</class>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{listings}
\usepackage{tikz}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{xparse}
\usepackage[BoldFont,SlantFont]{xeCJK}

\NewDocumentCommand{\cvRequirement}{m}{\textbf{#1}}

\definecolor{cvGreen}{HTML}{357F2D}
\definecolor{cvGreenLight}{HTML}{b8e4b3}
\definecolor{cvRed}{HTML}{7f2d35}
\definecolor{cvDark}{HTML}{2F3142}
\definecolor{cvAccent}{HTML}{474A65}

\lstset{%
  basicstyle=\ttfamily, % font style and size
  breakatwhitespace=false,
  breaklines=true,
  numbers=left,
  numberstyle=\tiny,
  numbersep=5pt,
  language=[LaTeX]{TeX},
  keywordstyle=\color{blue},
  commentstyle=\color{red}
}

\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{limecv.dtx}
  \PrintChanges
  \PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{1697}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \changes{v0.1}{2017/09/12}{Initial version.}
% \changes{v0.1.1}{2017/09/13}{Bug fixes and improved documentation.}
% \changes{v0.1.2}{2017/11/25}{Add internationalisation support. Support cover %
%   letters spanning multiple pages.}
% \changes{v0.1.3}{2017/09/25}{Fix checksum issue.}
% \changes{v0.1.4}{2018/05/21}{Added support for Chinese.}
% \changes{v0.1.5}{2018/06/05}{Custom contact fields.}
% \changes{v0.1.6}{2018/06/17}{Added support for French.}
% \changes{v0.1.7}{2020/02/08}{Added support for Italian.}
% \changes{v0.1.8}{2020/03/15}{Upgrade to Font Awesome 5.}
% \changes{v0.1.9}{2021/01/21}{Added support for Spanish.}
% \changes{v0.1.10}{2021/12/01}{Bug fix in cover letter design for long names. %
%   Fixes issue when counter environments were used multiple times.}
% \changes{v0.1.11}{2021/12/01}{Implement option to add email key to %
%   references.}
% \changes{v0.1.12}{2021/12/01}{Fix alignment issue for cvMainContent* and %
%   cvSidebar*.}
%
% \DoNotIndex{\NewDocumentCommand,\NewDocumentEnvironment}
%
% \providecommand*{\url}{\texttt}
% 
% \def\fileversion{v0.1.12}
% \def\filedate{2021/12/01}
%
% \GetFileInfo{limecv.dtx}
% \title{The \textsf{limecv} document class\thanks{This document corresponds %
%   to \textsf{limecv}~\fileversion, dated \filedate.}}
% \author{Olivier Pieters \\ \url{me (at) olivierpieters (dot) be}}
% \date{\fileversion~from \filedate}
% 
% \maketitle
% 
% \tableofcontents
% 
% \section{Introduction}
% 
%   This document class is designed to facilitate easy development of 
%   curriculum vit\ae\ (CV). A set of predefined macros and environments are
%   available for most common sections on a CV. These special elements have 
%   been designed to ease quick 
%   creation. This document class was co-designed with a business card, which 
%   can be found on GitHub: \url{https://github.com/opieters/business-card}.
% 
%   The design of this CV is split up in three parts, illustrated by 
%   \cref{design}. Each of these parts that make up this CV template 
%   will be detailed in the sections below.
% 
% \begin{figure}[!ht]
%   \centering
%   \begin{tikzpicture}
%     \draw (0,0) rectangle ++(4.20,5.94);
%     \draw[fill=black!20] (0,0) rectangle ++(1.5,5.94);
%     \draw (0.75,2.97) node {\LARGE 1};
%     \draw (2.85,2.97) node {\LARGE 2};
%   \end{tikzpicture}%
%   \hspace{2cm}%
%   \begin{tikzpicture}
%     \draw (0,0) rectangle ++(-4.20,-5.94);
%     \draw[fill=black!20] (0,0) rectangle ++(-4.2,-1.5);
%   \end{tikzpicture}
%   \caption{Illustation of a basic template. The image to the left depicts the  
%     actual CV: sidebar to the left (1) with main content on the right (2).   
%     The image to the right depicts the cover letter design.}
%   \label{design}
% \end{figure}
% 
% \section{Requirements}
% 
%   It is advised to use the \cvRequirement{XeLaTeX} engine. However, there is 
%   also support for \cvRequirement{LaTeX} and \cvRequirement{LuaLaTeX}. In 
%   these cases, fonts might be different than intended and side bearings will 
%   not be corrected, since only the XeLaTeX engine has access to these. In the 
%   subsequent sections, it will always be assumed that the XeLaTeX compiler is 
%   used (unless noted otherwise). 
% 
%   Any font can be used, though by default the \cvRequirement{Fira}
%   \footnote{\url{https://github.com/mozilla/Fira}} font is used. This should 
%   be installed and accessible by the typesetting system. If another font is 
%   desired, it can be overwritten using the |sansfont| document class options 
%   and |\cvMainFont| command. The mono spaced font can be changed by means of 
%   the |monofont| class option.
% 
%   \cvRequirement{FontAwesome5}\footnote{\url{http://fontawesome.io}} is the 
%   icon font used. This font should also be available and cannot be replaced by
%   another icon font. Most modern TeX distributions ship with this font since 
%   they provide the |fontawesome5| package. 
% 
% \section{General Macros and Document Class Options}
%
%    \DescribeMacro{\cvSetLanguage} The default language is English and can
%        be modified using the |\cvSetLanguage| macro. Possible arguments are:
%        |chinese|, |dutch|, |english|, |french|, |german|, |italian|, and 
%        |spanish|.
%        If your language is not supported or you want to override a word in any
%        supported language, you can modify the keys that hold the different
%        section titles. These can be in the source code. The following snippet
%        illustrates how this can be done for French:
%
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}
\pgfkeys{/@cv/names/education = Formations}
\pgfkeys{/@cv/names/skills = Comp\'etences}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
%
% 
% \section{Sidebar}
% 
%   The sidebar should contain personal information such as your name, job title 
%   (or industry or similar), contact information, small bio, interests and 
%   language skills. Special environments and commands have been defined for 
%   each of these sections and will be described below. 
% 
%   Everything that should be inside the sidebar should be placed in the 
%   |cvSidebar| environment. This environment is placed on the left side of the 
%   page by default. If it should be typeset on the right side, use the starred 
%   version (|cvSidebar*|)
% 
%   The following environments are available inside the sidebar environment: 
%   |cvProfile|, |cvContact|, |cvLanguages|, |cvInterests| and |cvProjects|.
%   
%   \DescribeMacro{\cvID}
%   This command typesets a picture (in a circle) with name and position 
%   underneath it. The argument order is: |\cvID{|\meta{first name}|}{|%
%   \meta{last name}|}{| \meta{picture location}|}{|\meta{job position}|}|. 
%   Empty fields are allowed for  the third and fourth arguments. No picture and
%   no job position will then be  typeset. Example code: 
% 
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}
\cvID{John}{Doe}{profile_picture}{Broker}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
%   
%   \DescribeMacro{cvProfile} 
%   This environment contains a brief profile description or biography. No 
%   additional arguments are allowed. Example code:
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}
\begin{cvProfile}
  A short biography goes here.
\end{cvProfile}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
%   
%   \DescribeMacro{cvContact} 
%   All the contact information goes here. Inside this environment, the  
%   following commands are available: 
%   \begin{itemize}
%     \item \DescribeMacro{\cvContactAddress} |\cvContactAddress{|
%       \meta{address}|}| typesets an address. How this address should be 
%       typeset exactly, is left to the user. The use of line breaks (|\\|) is 
%       allowed;
%     \item \DescribeMacro{\cvContactEmail} 
%      |\cvContactEmail{|\meta{link}|}{|\meta{email address}|}| typesets an 
%      email address. The link variable should be a something like 
%      |mailto:john@doe.tld|. Clicking on the email address will then 
%      automatically open the default email client with this address as 
%      recipient. If the link argument is left empty, no 
%      link will be created. 
%     \item \DescribeMacro{\cvContactPhone} 
%       |\cvContactPhone{|\meta{mobile phone number}|}| typesets a mobile phone 
%       number.
%     \item \DescribeMacro{\cvContactWebsite} 
%      |\cvContactWebsite{|\meta{link}|}{|\meta{website URL}|}| typesets a 
%      website. The link variable should be a something like 
%      |https://johndoe.tld|. Clicking on the website will then automatically 
%      open the default web browser. If the link argument is left empty, no 
%      action will be performed upon clicking on the website.
%     \item \DescribeMacro{\cvContactGithub} 
%       |\cvContactGithub{|\meta{link}|}{|\meta{username}|}| typesets a GitHub 
%       profile. The link variable should be a valid link to the GitHub profile 
%       (for example |https://github.com/johndoe|). Clicking on the username 
%       will then automatically open the default web browser. If the link 
%       argument is left empty, no action will be performed upon clicking on the
%       website.
%     \item \DescribeMacro{\cvContactGitlab}
%       |\cvContactGitlab{|\meta{link}|}{|\meta{username}|}| typesets a GitLab
%       profile. Same considerations apply as in the |\cvContactGithub| command.
%     \item \DescribeMacro{\cvContactLinkedin} 
%       |\cvContactLinkedin{|\meta{link}|}{|\meta{username}|}| typesets a 
%       LinkedIn profile. The link variable should be a link to your LinkedIn 
%       profile homepage (for example |https://www.linkedin.com/in/johndoe/|). 
%       Clicking on the username will then automatically open the default web 
%       browser. If the link argument is left empty, no action will be performed 
%       upon clicking on the website. 
%     \item \DescribeMacro{\cvContactTwitter} 
%       |\cvContactTwitter{|\meta{link}|}{|\meta{username}|}| typesets a Twitter
%       profile. The link variable should direct to your Twitter profile. An 
%       example link looks as follows: |https://twitter.com/johndoe|. Clicking 
%       on the username will then automatically open the default web browser. If
%       the link argument is left empty, no action will be performed upon 
%       clicking on the website. If the link argument is left empty, no link 
%       will be created. 
%     \item \DescribeMacro{\cvContactKeybase} 
%       |\cvContactKeybase{|\meta{link}|}{|\meta{fingerprint}|}| typesets a 
%       Keybase fingerprint (and account). The link variable should be a link to
%       the KeyBase profile (e.g.\ |https://keybase.io/johndoe|). Clicking on 
%       the fingerprint will then automatically open the default web browser. If
%       the link argument is left empty, no action will be performed upon 
%       clicking on the website.
%   \end{itemize}
%   
%   A full example:
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}
\begin{cvContact}
  \cvContactAddress{Some Street 78\\B-9000 Ghent\\Belgium}
  \cvContactEmail{mailto:john@doe.tld}{john@doe.tld}
  \cvContactPhone{+1 781 555 1212}
  \cvContactWebsite{https://doe.tld}{doe.tld}
  \cvContactGithub{https://github.com/johndoe}{johndoe}
  \cvContactLinkedin{https://www.linkedin.com/in/johndoe/}{johndoe}
  \cvContactTwitter{https://twitter.com/johndoe}{@johndoe}
  \cvContactKeybase{https://keybase.io/johndoe}{\texttt{AAAA 5555 BBBB FFFF}}
\end{cvContact}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
% 
%   If you wish to add contact information that is not available by default, you
%   can extend the command using two internal commands: 
%   |\cv@ContactTemplateLink| and |\cv@ContactTemplate|. See the source code for
%   usage instructions.
% 
%   \DescribeMacro{cvLanguages} 
%   This environment is used to showcase language skills. The 
%   \DescribeMacro{\cvLanguage} |\cvLanguage{|\meta{language}|}{|
%   \meta{skill level}|}| should be used inside this environment. The skill 
%   level is a real value with a maximum value of 5. If higher values are used,
%   the result will not be typeset properly. An example is included below.
% 
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}
\begin{cvLanguages}
  \cvLanguage{English (native)}{5}
  \cvLanguage{German (B1)}{3}
  \cvLanguage{Spanish}{3}
\end{cvLanguages}  
  \end{lstlisting}
% \iffalse
%</example>
% \fi
% 
%   \DescribeMacro{cvInterests} 
%   Typeset interests (can be both professional and personal) using 
%   |cvInterests|. By default it just typesets a list of items in the long 
%   format  (|long|). The short format can be activated by passing the |short| 
%   option to the  environment. Inside this environment, three commands can be 
%   used: |\cvInterestsPersonal|, |\cvInterestsProfessional| and |\cvInterest|. 
%   \DescribeMacro{\cvInterestsPersonal} |\cvInterestsPersonal| and 
%   \DescribeMacro{\cvInterestsProfessional} |\cvInterestsProfessional| add 
%   optional sections inside this environment to differentiate between personal 
%   and professional interests respectively. Both macros have no options nor 
%   arguments. The \DescribeMacro{\cvInterest} |\cvInterest{|\meta{icon}|}{|
%   \meta{interest}|}| command takes an icon and interest as arguments.
%   
%   Examples that illustrate the different options are depicted below:
% 
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}
\begin{cvInterests}
  \cvInterestsPersonal
  \cvInterest{\faTrain}{model trains}
  \cvInterest{\faFlask}{(applied) sciences}
  \cvInterest{\faSuitcase}{travelling}
  \cvInterestsProfessional
  \cvInterest{\faGraduationCap}{machine learning}
  \cvInterest{\faCogs}{robotics}
\end{cvInterests}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
%   
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}
\begin{cvInterests}[short]
  \cvInterestsPersonal
  \cvInterest{\faTrain}{model trains}
  \cvInterest{\faFlask}{(applied) sciences}
  \cvInterest{\faSuitcase}{travelling}
  \cvInterest{\faCamera}{photography}
  \cvInterest{\faGamepad}{gaming}
  \cvInterest{\faMusic}{music}
\end{cvInterests}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
%   
%   \DescribeMacro{cvProjects} If you have interesting (side) projects that are 
%   relevant for your CV, you can list them using the |cvProjects| environment. 
%   Inside this environment you can use the \DescribeMacro{\cvProject} 
%   |\cvProject[|\meta{options}|]{|\meta{name}|}{|\meta{description}|}| 
%   macro to list all your projects. The only options currently allowed in 
%   \meta{options} are an image (using |image|) and a URL (using |link|). This 
%   image must be an external file and the user must handle its size through 
%   |width| or |height|. Example usage:
%   
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}
\begin{cvProjects}
  \cvProject[image=clock,width=1cm]{yanic}{An IoT nixie clock.}
  \cvProject{\texttt{limecv}}{A \LaTeX\ document class for curriculum vit\ae.}
\end{cvProjects}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
% 
%   It is currently not possible to extend the sidebar with additional 
%   environments. To add your own, look at the source code and create your own 
%   \LaTeX-style hack.  
% 
% \section{Main Content}
% 
%   The main content section includes details on your education, experience, 
%   skills, references and more. Several environments have been designed to suit
%   specific needs. These will be discussed next.
%   
%   \DescribeMacro{cvMainContent} 
%   Everything in the main content section should be encapsulated in the 
%   |cvMainContent| environment. This environment defines four new environments:
%   |cvEducation|, |cvExperience|, |cvSkills| and |cvReferences|. These four 
%   environments are self explanatory in terms of functionality. We will detail 
%   each of these environments.
%   
%   Note that |cvMainContent| also has a starred variant (|cvMainContent*|). The 
%   function is similar to |cvSidebar*|, in the sense that it places everything 
%   to the left instead of the default right location.
%   
%   \DescribeMacro{cvEducation} 
%   The education environment creates a timeline styled list of your education. 
%   Individual education items should be listed by means of the |\cvItem{|
%   \meta{details}|}| macro which is available within this environment. Instead 
%   of forcing a specific layout structure, it was preferred to leave the actual 
%   mark-up to the end user. \emph{All} information concerning a single 
%   education should be passed to this single argument. However, the user is
%   always welcome to create his own styling macro that takes multiple 
%   arguments. This is illustrated by the examples below.
%   
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}[%
    caption={\lstinline!cvEducation! \emph{without} special user mark-up 
      command.}
    ]
\begin{cvEducation}
  \cvItem{Evening class: Chinese\\
  Some School, City. September 2015 -- June 2016\\
  Achieved A2 language skill in Chinese (Mandarin).}
  \cvItem{Bachelor of Science in Biochemistry and Biotechnology\\
  University, City. September 2009 -- June 2012\\
  General training in the basic sciences and the molecular life science.}
  \cvItem{Master of Science in Biochemistry and Biotechnology\\
  University, City. September 2012 -- June 2015\\
  Acquisition of insight into and knowledge of possibilities for application in 
  the area of biochemistry and biotechnology, specific with applications in 
  biomedical application and due problem-solving reasoning skills.}
\end{cvEducation}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
%   
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}[%
    caption={\lstinline!cvEducation! \emph{with} special user mark-up 
      command.}
      ]
% in preamble:
\newfontfamily\firaMedium{Fira Sans Medium}
\NewDocumentCommand{\cvEducation}{mmm}{{\firaMedium #1}\\ #2\\ \emph{#3}}
% in document:
\begin{cvEducation}
  \cvItem{\cvEducation{Evening class: Chinese}%
            {Some School, City. September 2015 -- June 2016}%
            {Achieved A2 language skill in Chinese (Mandarin).}}
  \cvItem{\cvEducation{Bachelor of Science in Biochemistry and Biotechnology}%
            {University, City. September 2009 -- June 2012}%
            {General training in the basic sciences and the molecular life 
             science.}}
  \cvItem{\cvEducation{Master of Science in Biochemistry and Biotechnology}%
            {University, City. September 2012 -- June 2015}%
            {Acquisition of insight into and knowledge of possibilities for 
             application in the area of biochemistry and biotechnology, specific
             with applications in biomedical application and due problem-solving
             reasoning skills.}}
\end{cvEducation}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
%   
%   \DescribeMacro{cvExperience} 
%   |cvExperience| works very similar to |cvEducation|. If follows the exact 
%   same structure and has the same design philosophy where you should use 
%   |\cvItem| inside this environment to typeset the individual items in a 
%   timeline style. \Cref{cvExperience} illustrates this with an example.
% 
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}[%
    caption={\lstinline!cvExperience! code example.},
    label=cvExperience
    ]
\begin{cvExperience}
  \cvItem{Student Job\\
    \textsc{\selectfont Company X}, Location X. Summer 2010\\
    Integer tincidunt dapibus consectetur. Nullam tristique aliquam luctus. Sed 
    ut ante velit. Nulla pharetra maximus lacus at elementum. Suspendisse 
    sodales consectetur metus, sit amet ultricies ipsum ultrices ut.};
  \cvItem{Internship\\
    \textsc{Company Y}, Location Y. June 2012 -- August 2012\\
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi dictum cursus
    sapien, id eleifend mi pellentesque id. Etiam lobortis eu odio a sodales. 
    Phasellus ut dolor feugiat, lacinia lectus in, blandit metus. Fusce lacinia 
    dolor et metus gravida pulvinar sit amet et ex.};
  \cvItem{Internship\\
    \textsc{Company Z}, Location Z. August 2014 -- September 2014\\
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi dictum cursus
    sapien, id eleifend mi pellentesque id. Etiam lobortis eu odio a sodales. 
    Phasellus ut dolor feugiat, lacinia lectus in, blandit metus.  Fusce lacinia
    dolor et metus gravida pulvinar sit amet et ex. Suspendisse vestibulum, leo
    malesuada molestie maximus, sem risus ornare elit, vitae sodales felis 
    elit in ipsum.};
\end{cvExperience}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
%   
%   \DescribeMacro{cvSkills} 
%   The skills section is contained within the |cvSkills| environment. This 
%   environment typesets your skills on a 5-level (discrete) scale. These are 
%   divided into two columns. To that end, two macros are available: 
%   |cvSkillOne| and |cvSkillTwo|. \DescribeMacro{cvSkillTwo} |cvSkillTwo{|
%   \meta{skill level}|}{|\meta{skill}|}{|\meta{skill level}|}{|\meta{skill}|}| 
%   typesets a row of two skills. If you have an odd number of items, 
%   \DescribeMacro{cvSkillOne} |cvSkillOne{|\meta{skill level}|}{|
%   \meta{skill}|}| should be used. An example of a skill-list can be found in 
%   \cref{cvSkills}.
%   
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}[%
    caption={Illustration of the \lstinline!cvSkills! environment.},
    label=cvSkills
    ]
\begin{cvSkills}
  \cvSkillTwo{5}{MATLAB}{5}{\LaTeX}
  \cvSkillTwo{4}{Python}{4}{VHDL}
  \cvSkillTwo{4}{Microsoft Office}{4}{macOS}
  \cvSkillOne{3}{C, C++}
\end{cvSkills}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
%   
%   \DescribeMacro{cvReferences}
%   The final section is intended to list all your references. These go inside 
%   the |cvReferences| environment. The enumeration of the different items 
%   should be done using the \DescribeMacro{\cvAddReference} |\cvAddReference{|
%   \meta{information}|}| macro. The following keys are available: |name|, 
%   |company|, |job|, |address line 1|, |address line 2|, |address line 3|, 
%   |mobile phone|, |work phone| and |email|. These are all optional arguments 
%   and will be typeset consistently between the two references per row. When 
%   adding two references, the left one should be specified first using 
%   |\cvAddReference*|. This will store the values and typeset them when adding 
%   the second reference through |\cvAddReference|. Note that |\cvAddReference| 
%   should be used if only one reference needs to be typese. \Cref{cvReferences} 
%   illustrates the usage of this environment.
%   
%   \emph{Important remark}: the comment after the usage of |\cvAddReference| is
%   required! Otherwise, spacing will not be as intended.
%   
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}[%
    caption={\lstinline!cvReferences! code example.},
    label=cvReferences]
\begin{cvReferences}
  \cvAddReference{%
    name=Jane Smith,
    company=Company ABC Co.\ Ltd.,
    job=Job title,
    address line 1=Street lane 2,
    address line 2=B-1150 Brussels,
    mobile phone=+1 781 555 1212}% <<-- Important!!!
\end{cvReferences}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
%
%   \DescribeMacro{cvList}
%   If the above sections do not fit your needs, you can define a new section
%   using 
%   |cvList{|\meta{environment name}|}{|\meta{storage key}|}{|\meta{icon}|}|.
%   It is also used internally for |cvExperience| and |cvEducation|, e.g.:
%
% \iffalse
%<*example>
% \fi
\begin{lstlisting}[%
  caption={\lstinline!cvList! code example.},
  label=cvList]
  \cvList{cvEducation}{education}{\faGraduationCap}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
% 
% \section{Cover Letter}
% 
%   A final (optional) part of a CV is the cover letter. This is a fairly simple
%   part to create design wise, but probably the hardest to write in an actual 
%   CV. 
% 
%   \DescribeMacro{cvCoverLetter}
%   The cover letter environment is |cvCoverLetter| and contains all the cover 
%   letter details. It will automatically add a header with your name and 
%   position based on the information filled in in |\cvID|. 
%   
%   \DescribeMacro{\cvBeneficiary}
%   The |\cvBeneficiary{|\meta{options}|}| macro offers a convenience wrapper to
%   typeset the beneficiary. Possible options are |name|, |position|, |company|,
%   |address line 1|, |address line 2| and |address line 3|. The remainder of 
%   the cover letter design is up to the user. An example design can be found in
%   \cref{cvCoverLetter}.
%   
%   \DescribeMacro{\cvFullName}
%   |\cvFullName| typeset the authors name based on the data provided in |cvID|. 
% 
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}[%
    caption={\lstinline!cvCoverLetter! code example.},
    label=cvCoverLetter]
\section{Cover Letter}

\begin{cvCoverLetter}

\cvBeneficiary{%
  name=Jane Smith,
  position=Position,
  company=Company,
  address line 1=Address line 1,
  address line 2=Address line 2}

Dear Miss.\ Smith

\vspace{\baselineskip}
\lipsum[1-3]
\vspace{\margin}

\cvFullName

\end{cvCoverLetter}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
% 
% \section{Change Style and Layout}
% 
%   To change the style, one can redefine the colours, lengths and TikZ styles 
%   used throughout the document class.
% 
%   By default the following colours are defined:
%   \begin{itemize}
%     \item |cvGreen| default dark green colour (hex value: {\color{cvGreen} 
%       |357F2D|})
%     \item |cvGreenLight| light green colour, for larger shapes and backgrounds 
%       (hex value: {\color{cvGreenLight} |B8E4B3|})
%     \item |cvDark| default text colour (hex value: {\color{cvDark} |2F3142|})
%     \item |cvRed| currently not used (hex value: {\color{cvRed} |7F2D35|})
%     \item |cvAccent| lighter grey shade for accented text (hex value: 
%       {\color{cvAccent} |474A65|})
%   \end{itemize}
%   
%   To change these, use the code from \cref{cvColour} in the preamble:
%   
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}[caption={Colour editing.},label=cvColour]
\definecolor{cvDark}{HTML}{000000}
  \end{lstlisting}
% \iffalse
%</example>
% \fi
%   
%   By overwriting the following styles, one can change the appearance of 
%   multiple TikZ nodes. The following styles are available.
%   \begin{itemize}
%     \item |interesticon|
%     \item |interesttext|
%     \item |eventdottext|
%     \item |invisibletimedot|
%     \item |timedot|
%     \item |eventdot|
%     \item |contactIcon|
%     \item |contactText|
%     \item |headerIcon|
%     \item |skillLevel|
%     \item |languageText|
%     \item |skillText|
%     \item |progressArea|
%     \item |progressBar|
%     \item |sectionTitle|
%     \item |sectionEduText|
%   \end{itemize}
%   
%   Adding your own styles is easy with the code from \cref{cvTikZStyle}.
%   
% \iffalse
%<*example>
% \fi
  \begin{lstlisting}[caption={Change TikZ style.},label=cvTikZStyle]
\tikzset{
  interesticon/.style = {},
}
  \end{lstlisting}
% \iffalse
%</example>
% \fi

% Spacing used inside the document can also be modified by the user. The 
% following lengths have been defined:
% \begin{itemize}
%   \item |\cvColSep| Distance between columns of |cvSkills|. 
%     Default value: |1cm|.
%   \item |\cvNodeSep| Not used currently. 
%     Default value: |0.75cm|.
%   \item |\cvTimeDotDiameter| Size of the dots in a timeline. 
%     Default value: |3pt|.
%   \item |\cvMargin| Margin around the entire page. 
%     Default value: |1cm|.
%   \item |\cvSideWidth| Width of the sidebar. 
%     Default value: |0.3\paperwidth-\cvMargin|.
%   \item |\cvMainWidth| Width of the main content section. 
%     Default value: |\paperwidth-4\cvMargin-\cvSideWidth|.
%   \item |\cvTimeDotSep| Distance between timeline dot and text. 
%     Default value: |0.4cm|.
%   \item |\cvStartEndSep| Not used. 
%     Default value: |0.3cm|.
%   \item |\cvItemSep| Distance between |cvItem| entries. 
%     Default value: |0.4cm|.
%   \item |\cvTableSepWidth| Distance between two columns of |cvReferences| 
%     environment. Default value: |0.3cm|.
%   \item |\cvCoverLetterHeight| Height of the coloured bar at the top of the 
%     cover letter. Default value: |\cvSideWidth|.
%   \item |\cvCoverLetterWidth| Width of the cover letter text. This can be used
%     to improve the layout. Default value: |\cvMainWidth+3\cvMargin|.
%   \item |\cvPictureWidth| Diameter of the profile picture. 
%     Default value: |4cm|.
%   \item |\cvProgressAreaWidth| Length of a progress bar for the languages 
%     section. Default value: |5em|.
%   \item |\cvProgressAreaHeight| Height of a progress bar for the languages 
%     section.  Default value: |0.75em|.
%   \item |\cvSectionSep| Distance between sections of the main content section. 
%     Default value: |0.6cm|.
%   \item |\cvSectionSBSep| Distance between sections of the sidebar section. 
%     Default value: |4pt|.
%   \item |\cvTitleLineWidth| Line width of horizontal line below section title.
%      Default value: |2pt|.
%   \item |\cvTitleLineSpacing| Distance from bottom of the titles of the main 
%     content section to the horizontal centre of line. Default value: |0.1cm|.
%   \item |\cv@projectSep| Internal length. 
%     Automatically set to |\cvItemSep|.
%   \item |\cvProjectDetailsSep| Internal spacing between details of a single 
%     project. Default value: |0.2cm|.
%   \item |\cvInterestDetailsSep| Distance between items in case the |long| 
%     options is used for the |cvInterests| environment. Default value: |4pt|.
%   \item |\cvContactItemSep| Distance between items in the |cvContact| 
%     environment. Default value: |5pt|.
%   \item |\cvCoverLetterLineWidth| Line width of line below cover letter name. 
%     Default value: |3pt|.
%   \item |\cvCoverLetterPositionSpacing| Distance between name and position in 
%     the cover letter. Default value: |10pt|.
%   \item |\cvSBSectionLineWidth| Line width of left and right lines next to the
%     titles of in the sidebar. Default value: |1pt|.
%   \item |\cvCoverLetterLineSpacing| Distance between name and line below it in
%     the cover letter. Default value: |0pt|.
%   \item |\cvIDNameSep| Distance between first and last name. 
%     Default value: |0.1cm|.
%   \item |\cvPositionSep| Distance before and after the position. 
%     Default value: |0.5cm|.
%   \item |\cvSkillSep| Distance between skills. 
%     Default value: |1ex|.
%   \item |\cvHeaderIconWidth| Automatically set, currently has no visible 
%     effect on document.  Default value: |0pt|.
% \end{itemize}
%   
% The fonts can also be changed, either by using the |sansfont| and |monofont| 
% class options, or by using the default ways provided by \LaTeX, XeLaTeX and 
% LuaLaTeX. Note that the |fontspec| package is already loaded by the class, so
% you can directly use |\setmainfont| in the preamble if you are using the 
% XeLaTeX or LuaLaTeX engine.
%   
% \section{Example}
% 
%   The source code of a typical CV document can be found in the examples 
%   folder. \Cref{example-cv,example-cover-letter} depict the resulting PDF 
%   documents.
% 
%   \begin{figure}[!ht]
%     \IfFileExists{./mwe-xelatex.pdf}{%
%       \includegraphics[
%         width=\textwidth,
%         page=1]%
%         {mwe-xelatex.pdf}}%
%       {No built examples found. Figure not included.}
%     \caption{Example CV (scaled).}
%     \label{example-cv}
%   \end{figure}
% 
%   \begin{figure}[!ht]
%     \IfFileExists{./mwe-xelatex.pdf}{%
%       \includegraphics[
%         width=\textwidth,
%         page=2]%
%         {mwe-xelatex.pdf}}%
%         {No built examples found.}
%     \caption{Example cover letter (scaled). Figure not included.}
%     \label{example-cover-letter}
%   \end{figure}
% 
% \StopEventually{}
%
% \section{Implementation}
%
% \iffalse
%<*class>
% \fi
% 
% \subsection{Licence}
%
% limecv.cls
% 
% Copyright 2017 - 2021 by Olivier Pieters
%
% A (Xe/Lua)LaTeX document class
%
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008-05-04 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Olivier Pieters.
% Contact the maintainer at: me (at) olivierpieters (dot) be.
%
% \subsection{Intro}
% I have tried to create a logical structure for the source code such that
% related commands are grouped into a signle section. However, this was not 
% always possible.
% 
% \subsection{Package Info and Required Packages}
% Before starting the actual implementation, we first load all required 
% packages and set their options. 
%
% Process key-value class options using |kvoptions|:
%    \begin{macrocode}
\RequirePackage{kvoptions}
%    \end{macrocode}
%
% Define and process class options. |print| is an (unimplemened) option that 
% should optimise the layout for printed CVs. 
%
%    \begin{macrocode}
\DeclareBoolOption[false]{print}
%    \end{macrocode}
% 
% Since the package already attempts to load the |fontspec| package, it is no
% longer possible to define a custom font path. This is again passible using
% this class option. Other options can also be set this way. However, if 
% multiple arguments are desirale, use |\cvComma| to separate between them, 
% since the class cannot differentiate between its own options and those it
% need to pass to |fontspec|. 
%
%    \begin{macrocode}
\newif\ifcv@fontPath
\cv@fontPathfalse
\DeclareStringOption{path}
\AddToKeyvalOption*{path}{\cv@fontPathtrue}
%    \end{macrocode}
%
% By default, Fira fonts are used. This can be modifed using |sansfont| and 
% |monofont|.
%
%    \begin{macrocode}
\DeclareStringOption[Fira Sans]{sansfont}
\DeclareStringOption[Fira Mono]{monofont}
%    \end{macrocode}
%
% Process the options.
%
%    \begin{macrocode}
\ProcessKeyvalOptions*
%    \end{macrocode}
%
% The article document class is used as a base template for this 
% class. Options are automatically passed to the article class via this way.
%
%    \begin{macrocode}
\DeclareOption*{%
  \PassOptionsToClass{\CurrentOption}{article}%
}
\ProcessOptions\relax
\LoadClass{article}
%    \end{macrocode}
%
% Include required packages. A short description is provided about the function 
% of each package.
%
% Check if XeTeX is used.
%    \begin{macrocode}
\RequirePackage{ifxetex}
%    \end{macrocode}
% Check if LuaTeX is used.
%    \begin{macrocode}
\RequirePackage{ifluatex}
%    \end{macrocode}
% Advanced command definitions.
%    \begin{macrocode}
\RequirePackage{xparse}
%    \end{macrocode}
% Complex length calculations.
%    \begin{macrocode}
\RequirePackage{calc}
%    \end{macrocode}
% Colour options.
%    \begin{macrocode}
\RequirePackage{xcolor}
%    \end{macrocode}
% Advanced table options.
%    \begin{macrocode}
\RequirePackage{tabularx}
%    \end{macrocode}
% Links.
%    \begin{macrocode}
\RequirePackage{hyperref}
\RequirePackage{url}
%    \end{macrocode}
% Remove paragraph indents.
%    \begin{macrocode}
\RequirePackage{parskip}
%    \end{macrocode}
% String operations.
%    \begin{macrocode}
\RequirePackage{xstring}
%    \end{macrocode}
% Key-value parsing within document.
%    \begin{macrocode}
\RequirePackage{xkeyval}
%    \end{macrocode}
% 
% \subsection{Colour Definitions}
%
% Define the custom colours used in this document.
%
%    \begin{macrocode}
\definecolor{cvGreen}{HTML}{357F2D}
\definecolor{cvGreenLight}{HTML}{b8e4b3}
\definecolor{cvRed}{HTML}{7f2d35}
\definecolor{cvDark}{HTML}{2F3142}
\definecolor{cvAccent}{HTML}{474A65}
\definecolor{cvBackground}{HTML}{FFFFFF}
%    \end{macrocode}
%
% \subsection{New Column Types}
%
%   Define new table column types with fixed width.
%
%    \begin{macrocode}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\%
\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\%
\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\%
\arraybackslash\hspace{0pt}}m{#1}}
%    \end{macrocode}
%
% \subsection{Helper commands}
%
% |\cvComma| escapes the parsing once and ca be useful to add a comma to the key 
% of a key-value structure.
% 
% \begin{macro}{\cvComma}
%    \begin{macrocode}
\NewDocumentCommand{\cvComma}{}{,}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@IfNoValueOrEmptyTF}
% |\@IfNoValueOrEmptyTF{argument}{if empty}{if not empty}| 
% checks if an argument is empty.
% 
% Based on: \url{http://tex.stackexchange.com/questions/63223}.
%
%    \begin{macrocode}
\ExplSyntaxOn
\DeclareExpandableDocumentCommand{\@IfNoValueOrEmptyTF}%
  {mmm}{\IfNoValueTF{#1}{#2}{
    \tl_if_empty:nTF {#1} {#2} {#3}%
   }
}
\ExplSyntaxOff
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifnodedefined}
% 
% Checks if node is defined.
%
% Based on: \url{https://tex.stackexchange.com/questions/37709}
%
%    \begin{macrocode}
\long\def\ifnodedefined#1#2#3{%
  \@ifundefined{pgf@sh@ns@#1}{#3}{#2}%
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Global Font Colour}
%
% \begin{macro}{\globalcolor}
%   Update global font colour.
%
%    \begin{macrocode}
\NewDocumentCommand{\globalcolor}{m}{%
  \color{#1}\global\let\default@color\current@color
}
%    \end{macrocode}
% \end{macro}
% 
% Automatically set font colour.
%
%    \begin{macrocode}
\AtBeginDocument{\globalcolor{cvDark}}
%    \end{macrocode}
%
%
% \subsection{TikZ Style Definitions}
%   TikZ is a very imporant package and forms the main reason this CV can have
%   the look that it does now.
%
%    \begin{macrocode}
\RequirePackage{tikz}
%    \end{macrocode}
% 
% Needed to load the cover letter image in the sidebar. 

%    \begin{macrocode}
\RequirePackage{graphicx}
%    \end{macrocode}
%
% A lot of additional TikZ libraries are also needed:
%
%    \begin{macrocode}
\usetikzlibrary{%
  calc,
  positioning,
  fit,
  arrows.meta,
  backgrounds,
  matrix}
%    \end{macrocode}
%
% Define all TikZ styles that are used throughout this document. All styles come
% in pairs: one that the user can overwrite and one that is internally defined
% and results into the default behaviour. Userdefined behaviour is always
% included last, such that it can overwrite the default behaviour.
%
%    \begin{macrocode}
\tikzset{
  interesticon/.style = {},
  interesttext/.style = {},
  eventdottext/.style = {},
  invisibletimedot/.style = {},
  timedot/.style = {},
  contactIcon/.style={},
  contactText/.style={},
  headerIcon/.style={},
  skillLevel/.style={},
  languageText/.style={},
  skillText/.style={},
  progressArea/.style={},
  progressBar/.style={},
  sectionTitle/.style={},
  sectionEduText/.style={%
  },
  cv@interesticon/.style = {%
    minimum width=\cvHeaderIconWidth,
    interesticon
  },
  cv@interesttext/.style = {%
    interesttext,
  },
  cv@eventdottext/.style = {%
    text width=\cvMainWidth-\cvTimeDotSep,
    black,
    anchor=north west,
    eventdottext,
  },
  cv@invisibletimedot/.style = {%
    circle,
    minimum width=\cvTimeDotDiameter,
    anchor=center,
    invisibletimedot,
  },
  cv@timedot/.style = {%
    cv@invisibletimedot,
    draw,
    fill,
    black,
    timedot,
  },
  cv@contactIcon/.style={%
    minimum height=\baselineskip,
    contactIcon,
  },
  cv@contactText/.style={%
    minimum height=\baselineskip,
    text depth=0pt,
    contactText,
  },
  cv@headerIcon/.style={%
    minimum width=\cvHeaderIconWidth,
    anchor=center,
    headerIcon,
  },
  cv@skillLevel/.style={skillLevel,},
  cv@languageText/.style={languageText,},
  cv@skillText/.style={skillText,},
  cv@progressArea/.style={%
    minimum width=\cvProgressAreaWidth,
    minimum height=\cvProgressAreaHeight,
    rectangle,
    draw=cvBackground,
    cvGreen,
    progressArea
  },
  cv@progressBar/.style={%
    minimum height=\cvProgressAreaHeight,
    rectangle,
    draw,
    fill,
    cvGreen,
    anchor=west,
    progressBar
  },
  cv@sectionTitle/.style={%
    anchor=north west,
    align=left,
    sectionTitle,
  },
  cv@sectionEduText/.style={%
    cv@eventdottext,
    anchor=north west,
    sectionEduText,
  },
}
%    \end{macrocode}
%
%   \subsection{XeLaTeX/LuaLaTeX Specific Code}
%   The initial design features the Fira font and thus requires the |fontspec|
%   package. However, if the |pdflatex| compiler is used, it should still 
%   compile. This is done in this part of the code. If needed, the relevant
%   packages are loaded and the options are set.
%
%    \begin{macro}{\cv@loadFonts}
%    \begin{macrocode}
\NewDocumentCommand{\cv@loadFonts}{}{
  \RequirePackage{fontspec}  
  \RequirePackage{fontawesome5}
%    \end{macrocode}
%
% Load the fonts. By default Fira will be loaded, but this can be overwritten
% by the user.
%
%    \begin{macrocode}
  \setmainfont[Numbers={Monospaced}]{\limecv@sansfont}
  \setsansfont{\limecv@sansfont}
  \setmonofont{\limecv@monofont}
%    \end{macrocode}
%
% Sometimes fonts are not located in their default location, if this option is 
% passed, additional paths will be traversed.
%
%    \begin{macrocode}
  \ifcv@fontPath
    \newfontfamily{\cv@FA}[Path=\limecv@path]%
      {Font Awesome 5 Free}
  \else
    \newfontfamily{\cv@FA}{Font Awesome 5 Free}
  \fi
%    \end{macrocode}
%
% The |fontawesome5| package does not feature all of the latest icons available,
% so we define some of the manually since they are relevant for this CV.
%
% \begin{macro}{\faAddressCard}
%    \begin{macrocode}
  \ProvideDocumentCommand{\faAddressCard}{}{{\cv@FA%
    \symbol{"F2B9}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\faVcard}
%    \begin{macrocode}
  \ProvideDocumentCommand{\faVcard}{}{{\cv@FA%
    \symbol{"F2BB}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\faMicrochip}
%    \begin{macrocode}
  \ProvideDocumentCommand{\faMicrochip}{}{{\cv@FA%
    \symbol{"F2DB}}}
%    \end{macrocode}
% \end{macro}
%
% In the future, the |fontawesome5| dependency can be dropped if a manually coded
% icon is included, such as those defined in monderncv. Example:
% \url{https://raw.githubusercontent.com/xdanaux/moderncv/%
% master/moderncviconsmarvosym.sty}
%    \begin{macrocode}
}
%    \end{macrocode}
% \end{macro}
%
% Execute the above defined command if relevant. In the case of |pdflatex|, the 
% default font is set to a sans serif font.
%
%    \begin{macrocode}
\ifxetex
  \cv@loadFonts
\else
  \ifluatex
    \cv@loadFonts
  \else
    \RequirePackage{fontawesome5}
    \RenewDocumentCommand{\familydefault}{}{\sfdefault}
  \fi
\fi
%    \end{macrocode}
%  
% If the XeLaTeX compiler is used and the font is compatible, it is possible to 
% remove the side bearing of certain characters. This is advantageous for
% alignment of certain characters. However, in the case a non-compatible 
% compiler is used, these commands do not poerform anything. 
%
% The code below is based on:
% \url{https://tex.stackexchange.com/questions/274479} and 
% \url{https://tex.stackexchange.com/questions/34563}
% 
%    \begin{macrocode}
\ifxetex
%    \end{macrocode}
% \begin{macro}{\kright}
%    \begin{macrocode}
  \NewDocumentCommand{\kright}{m}{\leavevmode #1%
    \kern-\XeTeXglyphbounds3 \the\XeTeXcharglyph`#1 }
% \end{macro}
% \begin{macro}{\kleft}
%    \begin{macrocode}
  \NewDocumentCommand{\kleft}{m}{\leavevmode %
    \kern-\XeTeXglyphbounds1 \the\XeTeXcharglyph`#1 #1}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\else
%    \end{macrocode}
% \begin{macro}{\kright}
%    \begin{macrocode}
  \NewDocumentCommand{\kright}{m}{#1}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kleft}
%    \begin{macrocode}
  \NewDocumentCommand{\kleft}{m}{#1}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% Extracts n-th charcter from a string
% Argument order: string - character number
%    \begin{macrocode}
\ExplSyntaxOn
\cs_generate_variant:Nn\tl_item:nn {f}
%    \end{macrocode}
% \begin{macro}{\extract}
%    \begin{macrocode}
\DeclareExpandableDocumentCommand{\extract}{mm}{%
  \tl_item:fn{#1}{#2}%
}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\ExplSyntaxOff
%    \end{macrocode}
%
%   Page layout
%
% remove page numbers
%    \begin{macrocode}
%% \pagenumbering{gobble}
%    \end{macrocode}
% remove all page styling
%    \begin{macrocode}
\pagestyle{empty}
%    \end{macrocode}
% not used
%    \begin{macrocode}
\newlength\cvColSep
\setlength\cvColSep{1cm} % 2 times column separation!
%    \end{macrocode}
% not used
%    \begin{macrocode}
\newlength\cvNodeSep 
\setlength\cvNodeSep{0.75cm}
\newlength\cvTimeDotDiameter 
\setlength\cvTimeDotDiameter{3pt}
\newlength\cvMargin
\setlength\cvMargin{1cm}
\newlength\cvSideWidth
\setlength\cvSideWidth{0.3\paperwidth-\cvMargin}
\newlength\cvMainWidth
\setlength\cvMainWidth{\paperwidth-4\cvMargin-\cvSideWidth}
\newlength\cvTimeDotSep
\setlength\cvTimeDotSep{0.4cm}
\newlength\cvStartEndSep
\setlength\cvStartEndSep{0.3cm}
\newlength\cvItemSep
\setlength\cvItemSep{0.4cm}
\newlength\cvTableSepWidth
\setlength\cvTableSepWidth{0.3cm}
\newlength\cvCoverLetterHeight
\setlength\cvCoverLetterHeight{\cvSideWidth}
\newlength\cvCoverLetterWidth
\setlength\cvCoverLetterWidth{\cvMainWidth+3\cvMargin}
\newlength\cvPictureWidth
\setlength\cvPictureWidth{4cm}
%    \end{macrocode}
% progress area size definition
%    \begin{macrocode}
\newlength\cvProgressAreaWidth
\setlength\cvProgressAreaWidth{5em}
\newlength\cvProgressAreaHeight
\setlength\cvProgressAreaHeight{0.75em}
\newlength\cvSectionSep
\setlength\cvSectionSep{0.6cm}
\newlength\cvSectionSBSep
\setlength\cvSectionSBSep{4pt}
%    \end{macrocode}
% line width of horizontal line below section title
%    \begin{macrocode}
\newlength\cvTitleLineWidth
\setlength\cvTitleLineWidth{2pt}
%    \end{macrocode}
% distance from bottom of text to centre of line
%    \begin{macrocode}
\newlength\cvTitleLineSpacing
\setlength\cvTitleLineSpacing{0.1cm}
%    \end{macrocode}
% set to |\cvItemSep| by default (do not overwrite!)
%    \begin{macrocode}
\newlength\cv@projectSep
\setlength\cv@projectSep{0cm}
%    \end{macrocode}
% internal spacing between details of a single project
%    \begin{macrocode}
\newlength\cvProjectDetailsSep
\setlength\cvProjectDetailsSep{0.2cm}
\newlength\cvInterestDetailsSep
\setlength\cvInterestDetailsSep{4pt}
\newlength\cvContactItemSep
\setlength\cvContactItemSep{5pt}
%    \end{macrocode}
% line width of line below cover letter name
%    \begin{macrocode}
\newlength\cvCoverLetterLineWidth
\setlength\cvCoverLetterLineWidth{3pt}
\newlength\cvCoverLetterPositionSpacing
\setlength\cvCoverLetterPositionSpacing{10pt}
\newlength\cvSBSectionLineWidth
\setlength\cvSBSectionLineWidth{1pt}
\newlength\cvCoverLetterLineSpacing
\setlength\cvCoverLetterLineSpacing{0pt}
\newlength\cvIDNameSep
\setlength\cvIDNameSep{0.1cm}
\newlength\cvPositionSep
\setlength\cvPositionSep{0.5cm}
\newlength\cvSkillSep
\setlength\cvSkillSep{1ex}
\newlength\cvHeaderIconWidth
\setlength\cvHeaderIconWidth{10pt}
%    \end{macrocode}
%
%
%------------------------------------------------------
%
%   New styling commands
%
%
% Style main section title
%    \begin{macrocode}
\NewDocumentCommand{\cvSection}{m}{\Large\textbf{#1}}
%    \end{macrocode}
% Typeset skill level
%    \begin{macrocode}
\newcount\my@repeat@count
\NewDocumentCommand{\cvSkill}{m}{%
  \begingroup
  \my@repeat@count=\z@
  \@whilenum\my@repeat@count<#1\do{\faCircle[solid]\advance%
    \my@repeat@count\@ne}%
  \my@repeat@count=\numexpr5-\z@\relax
  \@whilenum\my@repeat@count>#1\do{\faCircle[regular]\advance%
    \my@repeat@count\m@ne}%
  \endgroup
}
%    \end{macrocode}
% Create horizontal line from edge to edge for sidebar
% section titles.
%
% Based on: 
%   https://tex.stackexchange.com/questions/65731
% Alternative: 
%   https://tex.stackexchange.com/questions/15119
%    \begin{macrocode}
\NewDocumentCommand{\cvhrulefill}{}{{\color{cvGreen}%
\leavevmode\leaders\hrule height \cvSBSectionLineWidth\hfill\kern\z@}}
\NewDocumentCommand{\ruleline}{m}{\par\noindent\raisebox{.6ex}{%
\makebox[\linewidth]{\cvhrulefill\hspace{1ex}%
\raisebox{-.6ex}{#1}\hspace{1ex}\cvhrulefill}}}
%    \end{macrocode}
% Title counters
%    \begin{macrocode}
\newcounter{cv@titlePrev}
\setcounter{cv@titlePrev}{0}
\newcounter{cv@titleNext}
\setcounter{cv@titleNext}{1}
%    \end{macrocode}
% Draw everything associated with main section title.
%    \begin{macrocode}
\NewDocumentCommand{\cv@Title}{mm}{%
  \ifnodedefined{cv@last item \the\value{cv@lastItem}}{%
    \setlength\cvHeaderIconWidth\cvHeaderIconWidth%{%
      %\maxof{\cvHeaderIconWidth}{\widthof{\Large #2}}}%
%    \end{macrocode}
%
% \changes{v0.1.8}{2020/03/15}{For now, the |widthof| macro is not used 
%  anymore since there is an issue with the latest version of Font Awesome 5 
%  (5.7.0).}
% 
%    \begin{macrocode}
    \protected@write\@auxout{}{\global\cvHeaderIconWidth=\the\cvHeaderIconWidth}
    \node[%
      below=\cvSectionSep of cv@last item %
        \the\value{cv@lastItem}.south west,
      cv@sectionTitle] 
      (cv@title \the\value{cv@titleNext}) 
      {\begingroup\edef\y{\endgroup%
      \cvSection\bgroup\noexpand\kleft{%
        \extract{#1}{1}}}%
      \y\StrGobbleLeft{#1}{1}\egroup};
    \node[%
      left=\cvTimeDotSep of cv@title \the\value{cv@titleNext},
      cv@headerIcon] 
      {#2};
    \node[
      below=\cvSectionSep of cv@last item %
        \the\value{cv@lastItem}.south west,
      cv@sectionTitle] 
      (cv@title \the\value{cv@titleNext} dummy) {%
        \phantom{\cvSection{Education}}};
    \begin{scope}[on background layer]
      \draw[line width=\cvTitleLineWidth,cvGreen] 
        let \p1=(cv@title \the\value{cv@titleNext} %
                dummy.south west), 
            \p2=(current page.east) in 
        (\x1,\y1-\cvTitleLineSpacing) to (\x2,\y1-\cvTitleLineSpacing);
    \end{scope}
  }{%
    \node[cv@sectionTitle] at (0,0) (cv@title %
      \the\value{cv@titleNext})
    {\begingroup\edef\y{\endgroup%
    \cvSection\bgroup\noexpand\kleft{\extract{#1}{1}}}%
    \y\StrGobbleLeft{#1}{1}\egroup};
    \node[%
      left=\cvTimeDotSep of cv@title \the\value{cv@titleNext},
      cv@headerIcon]
      {#2};
    \node[cv@sectionTitle] at (0,0)
      (cv@title \the\value{cv@titleNext} dummy) {%
        \phantom{\cvSection{Education}}};
    \begin{scope}[on background layer]
      \draw[line width=\cvTitleLineWidth,cvGreen]
        let \p1=(cv@title \the\value{cv@titleNext} %
                dummy.south west),
            \p2=(current page.east) in
        (\x1,\y1-\cvTitleLineSpacing) to (\x2,\y1-\cvTitleLineSpacing);
    \end{scope}
}%
\stepcounter{cv@titlePrev}%
\stepcounter{cv@titleNext}
}
%    \end{macrocode}
% Draw the timeline
%    \begin{macrocode}
\NewDocumentCommand{\cv@EndSectionDraw}{}{
  \draw (start) to (end.center);}
%    \end{macrocode}
% Item counters
%    \begin{macrocode}
\newcounter{cv@itemPrev}
\setcounter{cv@itemPrev}{0}
\newcounter{cv@itemNext}
\setcounter{cv@itemNext}{1}
\newcounter{cv@lastItem}
\setcounter{cv@lastItem}{1}
%    \end{macrocode}
% List a timeline entry
%    \begin{macrocode}
\NewDocumentCommand{\cv@definecvItem}{}{
  \NewDocumentCommand{\cvItem}{m}{%
    \ifnodedefined{item \the\value{cv@itemPrev}}{%
      \node[%
        below=\cvItemSep of item %
          \the\value{cv@itemPrev}.south west,
        cv@eventdottext] 
        (item \the\value{cv@itemNext} header) 
        {\phantom{Evening}};
      \node[%
        below=\cvItemSep of item %
          \the\value{cv@itemPrev}.south west,
        cv@sectionEduText] 
        (item \the\value{cv@itemNext}) 
        {##1};
      \node[%
        left=\cvTimeDotSep of item %
          \the\value{cv@itemNext} header,
        cv@timedot] 
        {};
    }{
      \node[%
        below=\cvItemSep of cv@title %
          \the\value{cv@titlePrev}.south west,
        cv@eventdottext] 
        (item \the\value{cv@itemNext} header) 
        {\phantom{Evening}};
      \node[
        below=\cvItemSep of cv@title %
          \the\value{cv@titlePrev}.south west,
        cv@sectionEduText] 
        (item \the\value{cv@itemNext}) 
        {##1};
      \node[
        left=\cvTimeDotSep of item %
          \the\value{cv@itemNext} header,
        cv@timedot] 
        (start) 
        {};
    }
    \node[
      left=\cvTimeDotSep of item %
        \the\value{cv@itemNext}.south west,
      cv@invisibletimedot] 
      (end) 
      {};
    \stepcounter{cv@itemPrev}
    \stepcounter{cv@itemNext}
  }
}
%    \end{macrocode}
%
%-----------------------
% Language 
%    \begin{macrocode}
\pgfkeys{/@cv/names/.is family,
         /@cv/names/.unknown/.style = %
         {\pgfkeyscurrentpath/\pgfkeyscurrentname/%
         .initial = #1}}
%    \end{macrocode}
% Set all title names to English (default):
%    \begin{macrocode}
\NewDocumentCommand{\cv@setEnglish}{}{
    \pgfkeys{/@cv/names/profile = Profile}%
    \pgfkeys{/@cv/names/contact = Contact}%
    \pgfkeys{/@cv/names/languages = Languages}%
    \pgfkeys{/@cv/names/interests = Interests}%
    \pgfkeys{/@cv/names/professional = Professional}%
    \pgfkeys{/@cv/names/personal = Personal}%
    \pgfkeys{/@cv/names/projects = Projects}%
    \pgfkeys{/@cv/names/education = Education}%
    \pgfkeys{/@cv/names/experience = Experience}%
    \pgfkeys{/@cv/names/references = References}%
    \pgfkeys{/@cv/names/skills = Skills}%
    \pgfkeys{/@cv/names/publications = Publications}%
}
%    \end{macrocode}
%
% Set all title names to Dutch:
%    \begin{macrocode}
\NewDocumentCommand{\cv@setDutch}{}{
    \pgfkeys{/@cv/names/profile = Profiel}%
    \pgfkeys{/@cv/names/contact = Gegevens}%
    \pgfkeys{/@cv/names/languages = Talenkennis}%
    \pgfkeys{/@cv/names/interests = Interesses}%
    \pgfkeys{/@cv/names/professional = Professioneel}%
    \pgfkeys{/@cv/names/personal = Persoonlijk}%
    \pgfkeys{/@cv/names/projects = Projecten}%
    \pgfkeys{/@cv/names/education = Opleiding}%
    \pgfkeys{/@cv/names/experience = Werkervaring}%
    \pgfkeys{/@cv/names/references = Referenties}%
    \pgfkeys{/@cv/names/skills = Vaardigheden}%
    \pgfkeys{/@cv/names/publications = Publicaties}%
}
%    \end{macrocode}
%
%
% Set all title names to Chinese (Mandarin):
%    \begin{macrocode}
\NewDocumentCommand{\cv@setChinese}{}{
    \pgfkeys{/@cv/names/profile = 关于我}%
    \pgfkeys{/@cv/names/contact = 联系我}%
    \pgfkeys{/@cv/names/languages = 语言能力}%
    \pgfkeys{/@cv/names/interests = 兴趣爱好}%
    \pgfkeys{/@cv/names/professional = Professional}%
    \pgfkeys{/@cv/names/personal = Personal}%
    \pgfkeys{/@cv/names/projects = 我的项目}%
    \pgfkeys{/@cv/names/education = 教育背景}%
    \pgfkeys{/@cv/names/experience = 工作经验}%
    \pgfkeys{/@cv/names/references = References}%
    \pgfkeys{/@cv/names/skills = IT技能}%
    \pgfkeys{/@cv/names/publications = 出版作品}%
}
%    \end{macrocode}
%
%
% Set all title names to French:
%    \begin{macrocode}
\NewDocumentCommand{\cv@setFrench}{}{
    \pgfkeys{/@cv/names/profile = Profil}%
    \pgfkeys{/@cv/names/contact = Contact}%
    \pgfkeys{/@cv/names/languages = Langues}%
    \pgfkeys{/@cv/names/interests = Centres d'int\'{e}r\^{e}t}%
    \pgfkeys{/@cv/names/professional = Professionel}%
    \pgfkeys{/@cv/names/personal = Personnel}%
    \pgfkeys{/@cv/names/projects = Projets}%
    \pgfkeys{/@cv/names/education = Education}%
    \pgfkeys{/@cv/names/experience = Exp\'{e}riences}%
    \pgfkeys{/@cv/names/references = R\'{e}f\'{e}rences}%
    \pgfkeys{/@cv/names/skills = Comp\'{e}tences}%
}
%    \end{macrocode}
%
%
% Set all title names to German:
%    \begin{macrocode}
\NewDocumentCommand{\cv@setGerman}{}{
    \pgfkeys{/@cv/names/profile = Profil}%
    \pgfkeys{/@cv/names/contact = Kontakt}%
    \pgfkeys{/@cv/names/languages = Sprachen}%
    \pgfkeys{/@cv/names/interests = Interessen}%
    \pgfkeys{/@cv/names/professional = Beruflich}%
    \pgfkeys{/@cv/names/personal = Pers\"{o}nlich}%
    \pgfkeys{/@cv/names/projects = Projekte}%
    \pgfkeys{/@cv/names/education = Ausbildung}%
    \pgfkeys{/@cv/names/experience = Berufliche Erfahrung}%
    \pgfkeys{/@cv/names/references = Referenzen}%
    \pgfkeys{/@cv/names/skills = Kenntnisse}%
    \pgfkeys{/@cv/names/publications = Ver\"{o}ffentlichungen}%
}
%    \end{macrocode}
%
%
% Set all title names to Italian:
%    \begin{macrocode}
\NewDocumentCommand{\cv@setItalian}{}{
    \pgfkeys{/@cv/names/profile = Profilo}%
    \pgfkeys{/@cv/names/contact = Contatti}%
    \pgfkeys{/@cv/names/languages = Lingue}%
    \pgfkeys{/@cv/names/interests = Interessi}%
    \pgfkeys{/@cv/names/professional = Professionali}%
    \pgfkeys{/@cv/names/personal = Personali}%
    \pgfkeys{/@cv/names/projects = Progetti}%
    \pgfkeys{/@cv/names/education = Formazione}%
    \pgfkeys{/@cv/names/experience = Esperienze lavorative}%
    \pgfkeys{/@cv/names/references = Referenze}%
    \pgfkeys{/@cv/names/skills = Competenze}%
    \pgfkeys{/@cv/names/publications = Pubblicazioni}%
}
%    \end{macrocode}
%
%
% Set the title names to Spanish:
%    \begin{macrocode}
\NewDocumentCommand{\cv@setSpanish}{}{
    \pgfkeys{/@cv/names/profile = Perfil}%
    \pgfkeys{/@cv/names/contact = Contacto}%
    \pgfkeys{/@cv/names/languages = Idiomas}%
    \pgfkeys{/@cv/names/interests = Intereses}%
    \pgfkeys{/@cv/names/professional = Profesionales}%
    \pgfkeys{/@cv/names/personal = Personales}%
    \pgfkeys{/@cv/names/projects = Proyectos}%
    \pgfkeys{/@cv/names/education = Formación}%
    \pgfkeys{/@cv/names/experience = Experiencia}%
    \pgfkeys{/@cv/names/skills = Habilidades}%
    \pgfkeys{/@cv/names/references = Referencias}%
    \pgfkeys{/@cv/names/publications = Publicaciones}%
}
%    \end{macrocode}
%
%
% Set the actual language to English. This can be overwritten by the user in the 
% preamble
%
% Define the command to change the language
%    \begin{macrocode}
\ExplSyntaxOn
\NewDocumentCommand{\cvSetLanguage}{m}{
    \str_case:nnF {#1}
    {
      {dutch} {\cv@setDutch}
      {english} {\cv@setEnglish}
      {french} {\cv@setFrench}
      {german} {\cv@setGerman}
      {italian} {\cv@setItalian}
      {spanish} {\cv@setSpanish}
      {chinese} {%
          \usepackage[BoldFont,SlantFont]{xeCJK}%
          \cv@setChinese%
        }
    }
    {\ClassError{limecv}{Unknown option `#1' for cvLanguage %
     macro.}{Only `english', `chinese`, `dutch`, `french`, `german`, %
     `italian` and `spanish` are valid options for this macro.}}
}
\ExplSyntaxOff
\cvSetLanguage{english}
%    \end{macrocode}
%
%    \begin{macrocode}
% \cvSetLanguage{english}
%    \end{macrocode}
%------------------------------------------------------
%
%   Commands specific for cvSkills section
%
%
% information in temporary command yes/no
%    \begin{macrocode}
\newif\ifcv@firstskill
%    \end{macrocode}
% temporary command that stores skill information
%    \begin{macrocode}
\NewDocumentCommand{\cv@skillsTable}{}{}
%    \end{macrocode}
% typeset two skills
%    \begin{macrocode}
\NewDocumentCommand{\cvSkillTwo}{mmmm}{%
  \ifcv@firstskill
    \g@addto@macro\cv@skillsTable{\cvSkill{#1} %
      & #2 & \cvSkill{#3} & #4}
    \cv@firstskillfalse
  \else
    \g@addto@macro\cv@skillsTable{\\[\cvSkillSep] \cvSkill{#1} %
      & #2 & \cvSkill{#3} & #4}
  \fi
}
%    \end{macrocode}
% typeset one skill
%    \begin{macrocode}
\NewDocumentCommand{\cvSkillOne}{mm}{%
  \ifcv@firstskill
    \g@addto@macro\cv@skillsTable{\cvSkill{#1} & #2}
    \cv@firstskillfalse
  \else
    \g@addto@macro\cv@skillsTable{\\[\cvSkillSep] \cvSkill{#1} & #2}
  \fi
}
%    \end{macrocode}
%------------------------------------------------------
%
%   cvMainContent environments
%
%
%    \begin{macrocode}
\NewDocumentEnvironment{cvMainContent}{}{%
  \stepcounter{cv@titlePrev}
  \stepcounter{cv@titleNext}
  \stepcounter{cv@itemPrev}
  \stepcounter{cv@itemNext}
  \stepcounter{cv@lastItem}
  \begin{tikzpicture}[%
    every node/.style={%
      inner sep=0pt,
      outer sep=0pt},
    remember picture,
    overlay,
    shift={($(current page.north west)+%
      (\cvSideWidth+3\cvMargin+\cvTimeDotSep,-\cvMargin)$)}]
}{%
  \end{tikzpicture}
}
\NewDocumentEnvironment{cvMainContent*}{}{%
  \stepcounter{cv@titlePrev}
  \stepcounter{cv@titleNext}
  \stepcounter{cv@itemPrev}
  \stepcounter{cv@itemNext}
  \stepcounter{cv@lastItem}
    \begin{tikzpicture}[%
      every node/.style={
        inner sep=0pt,
        outer sep=0pt},
      remember picture,
      overlay,
      shift={($(current page.north west)+%
      (\cvMargin+\cvTimeDotSep,-\cvMargin)$)}]
}{%
    \end{tikzpicture}%
}
%    \end{macrocode}
%------------------------------------------------------
%
%   cvList environment: a general environment for 
%     grouped lists. This environment is used to 
%     generate e.g.\ |cvEducation|, |cvExperience| etc.
%
%    \begin{macrocode}
\NewDocumentCommand{\cvList}{mmm} {%
  \NewDocumentEnvironment{#1}{}{%
    \cv@Title{\pgfkeysvalueof{/@cv/names/#2}}{#3}
%    \end{macrocode}
% insures uniqueness
%    \begin{macrocode}
    \stepcounter{cv@itemPrev}
    \stepcounter{cv@itemNext}
    \cv@definecvItem
  }{%
    \cv@EndSectionDraw
    \stepcounter{cv@lastItem}
    \draw (item \the\value{cv@itemPrev}.south west) 
      node (cv@last item \the\value{cv@lastItem}) {};
  }
}
%    \end{macrocode}
%------------------------------------------------------
%
%   cvEductation environment
%
%    \begin{macrocode}
\cvList{cvEducation}{education}{\faGraduationCap}
%    \end{macrocode}
%------------------------------------------------------
%
%   cvExperience environment
%
%    \begin{macrocode}
\cvList{cvExperience}{experience}{\faBriefcase}
%    \end{macrocode}
%------------------------------------------------------
%
%   cvSkills environment
%
%    \begin{macrocode}
\NewDocumentEnvironment{cvSkills}{}{%
  \cv@Title{\pgfkeysvalueof{/@cv/names/skills}}{\faStar}
  \global\cv@firstskilltrue
  \RenewDocumentCommand{\cv@skillsTable}{}{}
}{%
  \node[
    below=\cvSectionSep of cv@title \the\value{cv@titlePrev}%
      .south west,
    anchor=north west] (skills) %
    {\begin{tabular}{@{}ll@{\hskip\cvColSep}ll@{}}%
    \cv@skillsTable
    \end{tabular}};
  \stepcounter{cv@lastItem}
  \draw (skills.south west) node %
    (cv@last item \the\value{cv@lastItem}) {};
}
%    \end{macrocode}
%------------------------------------------------------
%
%   cvPublications environment
%
%    \begin{macrocode}
\cvList{cvPublications}{publications}{\faNewspaper}
%    \end{macrocode}
%------------------------------------------------------
%
%   cvReferences environment
%
%    \begin{macrocode}
\NewDocumentEnvironment{cvReferences}{}{%
  \cv@Title{\pgfkeysvalueof{/@cv/names/references}}{\faLink}
  \node[
    below=\cvSectionSep of cv@title \the\value{cv@titlePrev}.%
      south west,
    anchor=north west,
    ] (cv@References) \bgroup %
}{%
  \egroup;
  \stepcounter{cv@lastItem}
  \draw (cv@References.south west) node %
    (cv@last item \the\value{cv@lastItem}) {};
}
%    \end{macrocode}
%   Key-value parsing structure
%    \begin{macrocode}
\pgfkeys{/@cv/references/.is family,
         /@cv/references/.unknown/.style = %
         {\pgfkeyscurrentpath/\pgfkeyscurrentname/%
         .initial = #1}}
\newif\ifcv@refName
\pgfkeys{/@cv/references/name/.is if=cv@refName}
\pgfkeys{/@cv/references/name=false}
\newif\ifcv@refPosition
\pgfkeys{/@cv/references/position/.is if=cv@refPosition}
\pgfkeys{/@cv/references/position=false}
\newif\ifcv@refCompany
\pgfkeys{/@cv/references/company/.is if=cv@refCompany}
\pgfkeys{/@cv/references/copmany=false}
\newif\ifcv@refAddressLineA
\pgfkeys{/@cv/references/address line 1/.is if=%
  cv@refAddressLineA}
\pgfkeys{/@cv/references/address line 1=false}
  \newif\ifcv@refAddressLineB
\pgfkeys{/@cv/references/address line 2/.is if=%
  cv@refAddressLineB}
\pgfkeys{/@cv/references/address line 2=false}
\newif\ifcv@refAddressLineC
\pgfkeys{/@cv/references/address line 3/.is if=%
  cv@refAddressLineC}
\pgfkeys{/@cv/references/address line 3=false}
\newif\ifcv@refWorkPhone
\pgfkeys{/@cv/references/work phone/.is if=%
  cv@refWorkPhone}
\pgfkeys{/@cv/references/work phone=false}
\newif\ifcv@refMobilePhone
\pgfkeys{/@cv/references/mobile phone/.is if=%
  cv@refMobilePhone}
\pgfkeys{/@cv/references/mobile phone=false}
\newif\ifcv@refEmail
\pgfkeys{/@cv/references/email/.is if=%
  cv@refEmail}
\pgfkeys{/@cv/references/email=false}
\newif\ifcv@refStored
\pgfkeys{/@cv/references/value stored/.is if=%
  cv@refStored}
\pgfkeys{/@cv/references/value stored=false}
%    \end{macrocode}
%
% keys
%    \begin{macrocode}
\define@key{cvAddReferenceA}{name}{%
  \global\def\cv@refAName{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/name = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceA}{company}{%
  \global\def\cv@refACompany{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/company = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceA}{position}{%
  \global\def\cv@refAPosition{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/position = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceA}{address line 1}{%
  \global\def\cv@refAAddressLineA{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/address line 1 = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceA}{address line 2}{%
  \global\def\cv@refAAddressLineB{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/address line 2 = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceA}{address line 3}{%
  \global\def\cv@refAAddressLineC{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/address line 3 = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceA}{phone work}{%
  \global\def\cv@refAPhoneWork{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/phone work = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceA}{mobile phone}{%
  \global\def\cv@refAMobilePhone{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/mobile phone = true}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\define@key{cvAddReferenceA}{email}{%
  \global\def\cv@refAEmail{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/email = true}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\define@key{cvAddReferenceB}{name}{%
  \global\def\cv@refBName{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/name = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceB}{company}{%
  \global\def\cv@refBCompany{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/company = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceB}{position}{%
  \global\def\cv@refBPosition{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/position = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceB}{address line 1}{%
  \global\def\cv@refBAddressLineA{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/address line 1 = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceB}{address line 2}{%
  \global\def\cv@refBAddressLineB{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/address line 2 = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceB}{address line 3}{%
  \global\def\cv@refBAddressLineC{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/address line 3 = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceB}{phone work}{%
  \global\def\cv@refBPhoneWork{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/phone work = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceB}{mobile phone}{%
  \global\def\cv@refBMobilePhone{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/mobile phone = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cvAddReferenceB}{email}{%
  \global\def\cv@refBEmail{#1}%
  \@IfNoValueOrEmptyTF{#1}{}{\pgfkeys{/@cv/references/email = true}}}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\NewDocumentCommand{\cvAddReference}{sm}{%
  \IfBooleanTF{#1}{%
    \setkeys{cvAddReferenceA}{name=,company=,
      position=,address line 1=,address line 2=,
      address line 3=,phone work=,mobile phone=,#2}
    \pgfkeys{/@cv/references/name = true}%
  }{%
    \setkeys{cvAddReferenceB}{name=,company=,
    position=,address line 1=,address line 2=,
    address line 3=,phone work=,mobile phone=,#2}
    \ifcv@refStored%
      \begin{tabular}{@{}L{0.5\cvMainWidth-0.5\cvTimeDotSep%
            -0.5\cvTableSepWidth}@{\hskip \cvTableSepWidth}%
          L{0.5\cvMainWidth-0.5\cvTimeDotSep%
            -0.5\cvTableSepWidth}@{}}%
      \ifcv@refName            \cv@refAName         & \cv@refBName         \fi %
      \ifcv@refCompany      \\ \cv@refACompany      & \cv@refBCompany      \fi %
      \ifcv@refPosition     \\ \cv@refAPosition     & \cv@refBPosition     \fi %
      \ifcv@refAddressLineA \\ \cv@refAAddressLineA & \cv@refBAddressLineA \fi %
      \ifcv@refAddressLineB \\ \cv@refAAddressLineB & \cv@refBAddressLineB \fi %
      \ifcv@refAddressLineC \\ \cv@refAAddressLineC & \cv@refBAddressLineC \fi %
      \ifcv@refWorkPhone    \\ \cv@refAPhoneWork    & \cv@refBPhoneWork    \fi %
      \ifcv@refMobilePhone  \\ \cv@refAMobilePhone  & \cv@refBMobilePhone  \fi %
      \ifcv@refEmail        \\ \cv@refAEmail        & \cv@refBEmail        \fi %
      \end{tabular}%
      \pgfkeys{/@cv/references/value stored = false}%
    \else%
      \begin{tabular}{@{}L{0.5\cvMainWidth%
          -0.5\cvTimeDotSep}@{}}%
        \ifcv@refName            \cv@refBName         \fi %
        \ifcv@refCompany      \\ \cv@refBCompany      \fi %
        \ifcv@refPosition     \\ \cv@refBPosition     \fi %
        \ifcv@refAddressLineA \\ \cv@refBAddressLineA \fi %
        \ifcv@refAddressLineB \\ \cv@refBAddressLineB \fi %
        \ifcv@refAddressLineC \\ \cv@refBAddressLineC \fi %
        \ifcv@refWorkPhone    \\ \cv@refBPhoneWork    \fi %
        \ifcv@refMobilePhone  \\ \cv@refBMobilePhone  \fi %
        \ifcv@refEmail        \\ \cv@refBEmail        \fi %
      \end{tabular}%
    \fi%
  }%
}
%    \end{macrocode}
%
%------------------------------------------------------
%
%   cvSidebar environment
%
%
%    \begin{macrocode}
\NewDocumentEnvironment{cvSidebar}{}{%
  \vspace*{\fill}
  \vspace*{-0.5\cvMargin}
  \begin{tikzpicture}[remember picture,overlay]
    \fill[cvGreenLight] (current page.north west) rectangle %
      ++(\cvSideWidth+2\cvMargin,-\paperheight);
  \end{tikzpicture}%
  \begin{minipage}{\cvSideWidth}
    \begin{center}
}{%
    \end{center}
  \end{minipage}
  \vspace*{\fill}
}
\NewDocumentEnvironment{cvSidebar*}{}{%
  \vspace*{\fill}
  \vspace*{-0.5\cvMargin}
  \begin{tikzpicture}[remember picture,overlay]
    \fill[cvGreenLight] (current page.north east) rectangle %
      ++(-\cvSideWidth-2\cvMargin,-\paperheight);
  \end{tikzpicture}%
  \hspace*{\paperwidth-\cvSideWidth-2\cvMargin}%
  \begin{minipage}{\cvSideWidth}
    \begin{center}
}{%
    \end{center}
  \end{minipage}
  \vspace*{\fill}
}
%    \end{macrocode}
%------------------------------------------------------
%
%   cvProfile environment
%
%    \begin{macrocode}
\NewDocumentEnvironment{cvProfile}{}{%
  \vspace{\cvSectionSBSep}
  \ruleline{\pgfkeysvalueof{/@cv/names/profile}}
}{%
}
%    \end{macrocode}
%------------------------------------------------------
%
%   cvContact environment
%
%
%    \begin{macrocode}
\NewDocumentCommand{\cv@ContactTemplate}{mm}{
  \NewDocumentCommand{#1}{m}{
      \ifcv@contactfirst \\ \else %
        \global\cv@contactfirsttrue \fi\node[cv@contactIcon]{#2}; 
        \pgfmatrixnextcell \node[cv@contactText]{##1};
  }
}
\NewDocumentCommand{\cv@ContactTemplateLink}{mm}{
  \NewDocumentCommand{#1}{mm}{
      \ifcv@contactfirst \\ \else %
        \global\cv@contactfirsttrue \fi\node[cv@contactIcon]{#2}; 
        \pgfmatrixnextcell \node[cv@contactText]{%
          \@IfNoValueOrEmptyTF{##1}{##2}{\href{##1}{##2}}};
  }
}
\NewDocumentCommand{\cvContactTemplate}{O{} mm}{
  \ifcv@contactfirst%
    \\%
  \else %
    \global\cv@contactfirsttrue %
  \fi %
  \node[cv@contactIcon]{#2}; 
  \pgfmatrixnextcell \node[cv@contactText]{%
    \@IfNoValueOrEmptyTF{#1}{#3}{\href{#1}{#3}}%
  };
}
\newif\ifcv@contactfirst
\NewDocumentEnvironment{cvContact}{}{%
  \vspace{\cvSectionSBSep}
  \ruleline{\pgfkeysvalueof{/@cv/names/contact}}%
  \vspace{\cvSectionSBSep}
  
  \global\cv@contactfirstfalse
  \cv@ContactTemplate{\cvContactAddress}{\faMapMarker}
  \cv@ContactTemplate{\cvContactPhone}{\faPhone}
  
  \cv@ContactTemplateLink{\cvContactEmail}{\faEnvelope}
  \cv@ContactTemplateLink{\cvContactWebsite}{\faGlobe}
  \cv@ContactTemplateLink{\cvContactGithub}{\faGithub}
  \cv@ContactTemplateLink{\cvContactGitlab}{\faGitlab}
  \cv@ContactTemplateLink{\cvContactLinkedin}{\faLinkedin}
  \cv@ContactTemplateLink{\cvContactTwitter}{\faTwitter}
  \cv@ContactTemplateLink{\cvContactKeybase}{\faKey}
  \begin{tikzpicture}[%
    every node/.style={inner sep=0pt, outer sep=0pt}]
    \matrix [
      column 1/.style={anchor=center},
      column 2/.style={anchor=west,align=left},
      column sep=\cvContactItemSep,
      row sep=\cvContactItemSep,
      inner sep=0pt, 
      outer sep=0pt] (contact) \bgroup
}{%
  \\\egroup; % \\ required, does not compile otherwise
  \end{tikzpicture}%
}
%    \end{macrocode}
%------------------------------------------------------
%
%   cvInterests environment
%
%    \begin{macrocode}
\newif\ifcv@interestLong
\cv@interestLongtrue
\newcounter{cv@cvInterestCounter}
\setcounter{cv@cvInterestCounter}{1}
\newcounter{cv@cvInterestCounterPrev}
\setcounter{cv@cvInterestCounterPrev}{0}
\newif\ifcv@interestContent
\cv@interestContentfalse
\NewDocumentCommand{\cv@TypesetTableRows}{}{}
\newif\ifcv@interesttikzopen
\cv@interesttikzopenfalse
\NewDocumentCommand{\cv@interestClose}{}{
  \ifcv@interestLong
    \ifcv@interesttikzopen
      \end{tikzpicture}
      \global\cv@interesttikzopenfalse
    \fi
  \else
    \ifcv@interestContent
      \begin{tabular}{@{}cl@{}}
        \cv@TypesetTableRows
      \end{tabular}
    \fi
  \fi
}
\NewDocumentCommand{\cv@interestOpen}{}{
  \ifcv@interestLong
    \ifcv@interesttikzopen
    \else
      \cv@interesttikzopentrue
      \begin{tikzpicture}[%
        every node/.style={inner sep=0cm,outer sep=0cm}]
    \fi
  \else
    \global\def\cv@TypesetTableRows{}
    \global\cv@interestContentfalse
  \fi
}
\NewDocumentCommand{\cv@definecv@interestSection}{}{
  \NewDocumentCommand{\cv@interestSection}{m}{%
    \cv@interestClose\\
    \ifcv@interestContent
      \vspace*{2\cvSectionSBSep}
    \fi
    {\color{cvGreen}---} ##1 {\color{cvGreen}---}\\
    \vspace*{\cvSectionSBSep}
    \cv@interestOpen
  }
}
\NewDocumentCommand{\cv@definecvInterestLong}{}{
  \NewDocumentCommand{\cvInterest}{mm}{%
    \ifcv@interestContent %
      \node[
        below=\cvItemSep of cv@interest text %
          \the\value{cv@cvInterestCounterPrev},
        cv@interesticon] 
        (cv@interest icon \the\value{cv@cvInterestCounter}) {##1};
      \node[
        below=\cvInterestDetailsSep of cv@interest icon %
          \the\value{cv@cvInterestCounter},
        cv@interesttext] 
      (cv@interest text \the\value{cv@cvInterestCounter}) {##2};
    \else
      \cv@interestOpen
      \node[cv@interesticon] 
        (cv@interest icon \the\value{cv@cvInterestCounter}) {##1};
      \node[
        below=\cvInterestDetailsSep of cv@interest icon %
          \the\value{cv@cvInterestCounter},
        cv@interesttext] 
        (cv@interest text \the\value{cv@cvInterestCounter}) {##2};
    \fi
    \stepcounter{cv@cvInterestCounter}
    \stepcounter{cv@cvInterestCounterPrev}
    \global\cv@interestContenttrue
  }
}
\NewDocumentCommand{\cv@definecvInterestShort}{}{
%    \end{macrocode}
% https://tex.stackexchange.com/questions/12761
%    \begin{macrocode}
  %\def\Z{\vphantom{\parbox[c]{1cm}{\Huge Something Long}}}
  \NewDocumentCommand{\cvInterest}{mm}{%
%    \end{macrocode}
% parse optinal argument if present
%    \begin{macrocode}
    \g@addto@macro\cv@TypesetTableRows{##1}%
    \g@addto@macro\cv@TypesetTableRows{&}%
    \g@addto@macro\cv@TypesetTableRows{##2}%
    \g@addto@macro\cv@TypesetTableRows{\\[\cvInterestDetailsSep]}%
    \global\cv@interestContenttrue
  }
}
\ExplSyntaxOn
\NewDocumentEnvironment{cvInterests}{o}{%
%    \end{macrocode}
% set defaults
%    \begin{macrocode}
  \cv@interestLongtrue
%    \end{macrocode}
% parse optional arguments
%    \begin{macrocode}
  
  \@IfNoValueOrEmptyTF{#1}{}{%
    \str_case:nnF {#1}{
      {long}{\cv@interestLongtrue}
      {short}{\cv@interestLongfalse}
    }{\ClassError{limecv}{Unkown option `#1' for cvInterests %
      environment.}{Only `long' and `short' are valid options %
      for this environment.}}
  }
  
  \stepcounter{cv@cvInterestCounter}
  \stepcounter{cv@cvInterestCounterPrev}

  \cv@definecv@interestSection
%    \end{macrocode}
% define new commands
%    \begin{macrocode}
  \NewDocumentCommand{\cvInterestsPersonal}{}{%
    \cv@interestSection{\faUser\ \emph{\pgfkeysvalueof{/@cv/names/personal}}}}
%    \end{macrocode}
%    \begin{macrocode}
  \NewDocumentCommand{\cvInterestsProfessional}{}{%
    \cv@interestSection{\faBriefcase\ \emph{%
      \pgfkeysvalueof{/@cv/names/professional}}%
    }}
%    \end{macrocode}
%    \begin{macrocode}
  \ifcv@interestLong
    \cv@definecvInterestLong
  \else
    \cv@definecvInterestShort
  \fi
  %%%%%%
  \vspace{\cvSectionSBSep}
  \ruleline{\pgfkeysvalueof{/@cv/names/interests}}%
  \vspace{\cvSectionSBSep}
}{%
  \cv@interestClose
  \global\cv@interestContentfalse
}
\ExplSyntaxOff
%    \end{macrocode}
%------------------------------------------------------
%
%   cvProject environment
%
%
%    \begin{macrocode}
\newif\ifcv@projectImage
\cv@projectImagefalse
\newif\ifcv@projectLink
\cv@projectLinkfalse
\newif\ifcv@projectWidth
\cv@projectWidthfalse
\newif\ifcv@projectHeight
\cv@projectHeightfalse
\newcounter{cv@projectCurrent}
\setcounter{cv@projectCurrent}{1}
\newcounter{cv@projectPrevious}
\setcounter{cv@projectPrevious}{0}
%    \end{macrocode}
%
%    \begin{macrocode}
\define@key{cv@Project}{image}{%
  \global\def\cv@projectImage{#1}%
  \cv@projectImagetrue}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cv@Project}{link}{%
  \global\def\cv@projectLink{#1}%
  \cv@projectLinktrue}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cv@Project}{width}{%
  \global\def\cv@projectWidth{#1}%
  \cv@projectWidthtrue}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\define@key{cv@Project}{height}{%
  \global\def\cv@projectHeight{#1}%
  \cv@projectHeighttrue}
\NewDocumentCommand{\cv@definecvProject}{}{
  \NewDocumentCommand{\cvProject}{omm}{%
%    \end{macrocode}
% default settings
%    \begin{macrocode}
    \cv@projectImagefalse
    \cv@projectLinkfalse
    \cv@projectWidthfalse
    \cv@projectHeightfalse
%    \end{macrocode}
% parse optional arguments
%    \begin{macrocode}
    \@IfNoValueOrEmptyTF{##1}{}{\setkeys{cv@Project}{##1}}
    \ifnodedefined{project \the\value{cv@projectPrevious} %
      description}{}{%
      \node (project \the\value{cv@projectPrevious} %
        description) {};
    }
%    \end{macrocode}
% draw image
%    \begin{macrocode}
    \ifcv@projectImage 
      \ifcv@projectWidth
        \node[below=\cv@projectSep of project %
          \the\value{cv@projectPrevious} description] 
          (project \the\value{cv@projectCurrent} image) 
          {\includegraphics[width=\cv@projectWidth]{\cv@projectImage}};
      \else
        \ifcv@projectHeight
          \node[below=\cv@projectSep of project %
          \the\value{cv@projectPrevious} description] 
          (project \the\value{cv@projectCurrent} image) 
          {\includegraphics[height=\cv@projectHeight]{\cv@projectImage}};
        \else
          \ClassError{limecv}{No width or height specified, %
          but image specified.}{Always specify the height or %
          width if an image is set.}
        \fi
      \fi
%    \end{macrocode}
% draw title (and add href if specified)
%    \begin{macrocode}
      \node[%
        text width=\cvSideWidth,
        align=center,
        below=\cvProjectDetailsSep of project \the\value{cv@projectCurrent} %
          image] 
        (project \the\value{cv@projectCurrent} title) {%
      \ifcv@projectLink \href{\cv@projectLink}{##2} \else ##2 \fi };
    \else
%    \end{macrocode}
% draw title (and add href if specified)
%    \begin{macrocode}
      \node[below=\cv@projectSep of project %
        \the\value{cv@projectPrevious} description,
        text width=\cvSideWidth,
        align=center] 
        (project \the\value{cv@projectCurrent} title) {%
      \ifcv@projectLink \href{\cv@projectLink}{##2} \else ##2 \fi };
    \fi
    \node[
      below=\cvProjectDetailsSep of project \the\value{cv@projectCurrent} title,
      text width=\cvSideWidth,
      align=center] 
      (project \the\value{cv@projectCurrent} description) {##3};
    
    \setlength\cv@projectSep\cvItemSep
%    \end{macrocode}
% increase counter value
%    \begin{macrocode}
    \stepcounter{cv@projectCurrent}
    \stepcounter{cv@projectPrevious}
  }
}
%    \end{macrocode}
%
%    \begin{macrocode}
\NewDocumentEnvironment{cvProjects}{}{%
  \vspace{\cvSectionSBSep}
  \ruleline{\pgfkeysvalueof{/@cv/names/projects}}%
  \vspace{\cvSectionSBSep}
  \cv@definecvProject
  \begin{tikzpicture}[every node/.style={inner sep=0cm,outer sep=0cm}]
}{
  \end{tikzpicture}
}
%    \end{macrocode}
%------------------------------------------------------
%
%   cvLanguages environment
%
%    \begin{macrocode}
\newcounter{cv@languages}
\setcounter{cv@languages}{1}
\pgfkeys{/@cv/languages/.is family,
/@cv/languages/.unknown/.style = {%
  \pgfkeyscurrentpath/\pgfkeyscurrentname/.initial = #1}}

\newif\ifcv@languagerating
\cv@languageratingtrue
\NewDocumentEnvironment{cvLanguages}{ o }{%
  \IfNoValueTF{#1}{
    \NewDocumentCommand{\cvLanguage}{mm}{%
      {\globaldefs=1\relax\pgfkeys{%
        /@cv/languages/lang\the\value{cv@languages} = ##2}}
      \node[cv@languageText]{##1}; \pgfmatrixnextcell %
        \node[cv@progressArea] (cv@language \the\value{cv@languages}) {}; \\
      \stepcounter{cv@languages}
    }%  
    \cv@languageratingtrue
  }{
    \NewDocumentCommand{\cvLanguage}{m}{%
      \node[cv@languageText]{##1}; \\
      \stepcounter{cv@languages}
    }%  
    \cv@languageratingfalse
  }
  \vspace{\cvSectionSBSep}
  \ruleline{\pgfkeysvalueof{/@cv/names/languages}}%
  \vspace{\cvSectionSBSep}
  \begin{tikzpicture}[%
    every node/.style={text depth=0pt,inner sep=0pt,outer sep=0pt}]
  \ifcv@languagerating
  \matrix [%
    column 1/.style={anchor=east},
    column sep=1.5\cvSectionSBSep,
    row sep=1.5\cvSectionSBSep,
    column 2/.style={anchor=west,align=left}
  ] (contact) \bgroup
  \else
  \matrix [%
    column sep=1.5\cvSectionSBSep,
    row sep=1.5\cvSectionSBSep,
    column 2/.style={anchor=west,align=left}
  ] (contact) \bgroup
  \fi
}{%
  \\\egroup;
  \ifcv@languagerating
  \newcounter{cv@languagelevel}
  \setcounter{cv@languagelevel}{1}
  \loop\ifnum\value{cv@languagelevel}<\value{cv@languages}
    \draw (cv@language \the\value{cv@languagelevel}.west) %
      node[%
        cv@progressBar,
        minimum width=\pgfkeysvalueof{%
        /@cv/languages/lang\the\value{cv@languagelevel}}em]%
        {};
    \stepcounter{cv@languagelevel}
  \repeat
  \fi
  \end{tikzpicture}
}
%    \end{macrocode}
%------------------------------------------------------
%
%   cvCoverLetter environment
%
%
%
% cover letter keys
%    \begin{macrocode}
\define@key{cvCoverLetter}{name}{%
%    \end{macrocode}
%
%
% \begin{macro}{\cv@coverletterName}
%    \begin{macrocode}
\global\def\cv@coverletterName{#1}}
%    \end{macrocode}
% \end{macro}
%
%
%    \begin{macrocode}
\define@key{cvCoverLetter}{company}{%
%    \end{macrocode}
%
%
% \begin{macro}{\cv@coverletterCompany}
%    \begin{macrocode}
\global\def\cv@coverletterCompany{#1}}
%    \end{macrocode}
% \end{macro}
%
%

%    \begin{macrocode}
\define@key{cvCoverLetter}{position}{%
%    \end{macrocode}
%
%
% \begin{macro}{\cv@coverletterPosition}
%    \begin{macrocode}
\global\def\cv@coverletterPosition{#1}}
%    \end{macrocode}
% \end{macro}
%
%
%    \begin{macrocode}
\define@key{cvCoverLetter}{address line 1}{%
%    \end{macrocode}
%
%
% \begin{macro}{\cv@coverletterAddressLineA}
%    \begin{macrocode}
\global\def\cv@coverletterAddressLineA{#1}}
%    \end{macrocode}
% \end{macro}
%
%
%    \begin{macrocode}
\define@key{cvCoverLetter}{address line 2}{%
%    \end{macrocode}
%
%
% \begin{macro}{\cv@coverletterAddressLineB}
%    \begin{macrocode}
\global\def\cv@coverletterAddressLineB{#1}}
%    \end{macrocode}
% \end{macro}
%
%
%    \begin{macrocode}
\define@key{cvCoverLetter}{address line 3}{%
%    \end{macrocode}
%
%
% \begin{macro}{\cv@coverletterAddressLineC}
%    \begin{macrocode}
\global\def\cv@coverletterAddressLineC{#1}}
\NewDocumentCommand{\cv@definecvBeneficiary}{}{
  \NewDocumentCommand{\cvBeneficiary}{m}{%
    \setkeys{cvCoverLetter}{name={},company={},
      position={},address line 1={},address line 2={},
      address line 3={},##1}
    \begin{tabular}{@{}l}
      \@IfNoValueOrEmptyTF{%
        \cv@coverletterName}{}{%
        \MakeUppercase{\cv@coverletterName}} %
      \@IfNoValueOrEmptyTF{%
        \cv@coverletterCompany}{}{\\ %
        \cv@coverletterCompany} %
      \@IfNoValueOrEmptyTF{%
        \cv@coverletterPosition}{}{\\ %
        \cv@coverletterPosition} %
      \@IfNoValueOrEmptyTF{%
        \cv@coverletterAddressLineA}{}{\\ %
        \cv@coverletterAddressLineA} %
      \@IfNoValueOrEmptyTF{%
        \cv@coverletterAddressLineB}{}{\\ %
        \cv@coverletterAddressLineB} %
      \@IfNoValueOrEmptyTF{%
        \cv@coverletterAddressLineC}{}{\\ %
        \cv@coverletterAddressLineC} %
    \end{tabular}%
    \vspace{\cvMargin}
  }
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\NewDocumentCommand{\cv@definecvFullName}{}{
  \NewDocumentCommand{\cvFullName}{}{%
    \pgfkeysvalueof{/@cv/info/first name} %
    \pgfkeysvalueof{/@cv/info/last name}
  }
}
\NewDocumentEnvironment{cvCoverLetter}{}{%
  \newgeometry{textwidth=\cvCoverLetterWidth,noheadfoot}
  \begin{tikzpicture}[%
      remember picture,
      overlay, 
      every node/.style={inner sep=0cm,outer sep=0cm}]
%    \end{macrocode}
% draw green background
%    \begin{macrocode}
    \begin{scope}[on background layer]
      \fill[cvGreenLight] (current page.north west) rectangle %
        ++(\paperwidth,-\cvCoverLetterHeight);
    \end{scope}
    \draw (current page.north east) %
      ++(-0.5\paperwidth+0.5\cvCoverLetterWidth,
         -\cvCoverLetterHeight/2) node (cv@h7) {};
    \node[%
      anchor=east, 
      align=flush right, 
      text width=\textwidth] at (cv@h7) (cv cover letter name){%
        \fontsize{50}{60}\selectfont
%    \end{macrocode}
% trick to expand argument such that `kleft` sees an 
% alphabetic constant (i.e. a single letter)
%    \begin{macrocode}
        \begingroup\edef\y{\endgroup%
          \noexpand\kleft{\cv@FirstNameLetter}}%
        \y
        \StrGobbleLeft{\pgfkeysvalueof{/@cv/info/first name}}{1}\space
        \StrGobbleRight{\pgfkeysvalueof{/@cv/info/last name}}{1}
%    \end{macrocode}
% same trick
% trick to expand argument such that `kleft` sees an 
% alphabetic constant (i.e. a single letter)
%    \begin{macrocode}
        \begingroup\edef\y{\endgroup%
          \noexpand\kright{\cv@LastNameLetter}}%
        \y
      };
    \node[%
      align=right,
      cvAccent,
      below=\cvCoverLetterPositionSpacing of cv cover letter name.south east,
      anchor=north east]{%
        \StrGobbleRight{\pgfkeysvalueof{/@cv/info/position}}{1}
    \begingroup\edef\y{\endgroup%
      \noexpand\kright{\cv@PositionLetter}}%
    \y};
    
    \begin{scope}[on background layer]
      \draw[line width=\cvCoverLetterLineWidth,cvGreen] 
         ($(cv cover letter name.south west)+(0,-\cvCoverLetterLineSpacing)$) to 
         ($(cv cover letter name.south east)+(0,-\cvCoverLetterLineSpacing)$);
    \end{scope}
  \end{tikzpicture}
  \vspace{\dimexpr\cvCoverLetterHeight-1in-\topmargin\relax}
  
  \today

  \vspace{\baselineskip}
  \cv@definecvBeneficiary
  \cv@definecvFullName
}{%
  \restoregeometry
}
%    \end{macrocode}
%
%
%------------------------------------------------------
%
%   cvID macro
%
%
%    \begin{macrocode}
\pgfkeys{/@cv/info/.is family,
         /@cv/info/.unknown/.style = %
         {\pgfkeyscurrentpath/\pgfkeyscurrentname/%
         .initial = #1}}
%    \end{macrocode}
% first name, second name, picture, position
%    \begin{macrocode}
\NewDocumentCommand{\cvID}{mmmm}{
  \@IfNoValueOrEmptyTF{#3}{}{
    \begin{tikzpicture}
      \node[
        circle,
        text=white,
        minimum size=\cvPictureWidth,
        path picture={
          \node at (path picture bounding box.center){
            \includegraphics[width=\cvPictureWidth]{#3}
          };
        }]
        {};
    \end{tikzpicture}\\
  }
  {\LARGE
  \vspace{\cvIDNameSep}
  \color{cvAccent} #1
  \vspace{\cvIDNameSep}
  \color{cvAccent} #2}
  
  \vspace{\cvPositionSep}
  
  \@IfNoValueOrEmptyTF{#4}{}{\color{cvAccent} #4}
  
  \vspace{\cvPositionSep}
  {\globaldefs=1\relax\pgfkeys{/@cv/info/first name = %
    #1}\def\cv@FirstNameLetter{\extract{#1}{1}}}
  {\globaldefs=1\relax\pgfkeys{/@cv/info/last name = %
    #2}\def\cv@LastNameLetter{\extract{#2}{-1}}}
  {\globaldefs=1\relax\pgfkeys{/@cv/info/position = %
    #4}\def\cv@PositionLetter{\extract{#4}{-1}}}
}
%    \end{macrocode}

%
% \iffalse
%</class>
% \fi
%
% \Finale
\endinput

