I have been customizing a CV template but having some trouble with the TikZ package; indeed I'm a novice and it's a little bit difficult for me to find the solution by using the official documentation.
Here is my MWE:
\documentclass[11pt,oneside,a4paper,titlepage]{article}
%%% PREAMBLE %%%
% Info
\title{My CV}
\usepackage[most]{tcolorbox}
\usepackage{geometry}
\geometry{
a4paper,
left=0.5cm, % left=0.1cm
right=0.5cm, % right=0.6cm
top=0.5cm, % top=0.1cm
bottom=1.0cm, % bottom=0.1cm
includefoot,
headheight=2.5cm, % needed to avoid warnings with fancyhdr package
footskip=0.4cm,
showframe=false
}
\usepackage{lipsum} % dummy text
\usepackage{adjustbox} % to a better alignement of text
% Headers and footers
\usepackage{fancyhdr}
%\setlength{\headheight}{12.6pt}
\usepackage{lastpage}
% Text and Fonts
\usepackage[TU]{fontenc}
\usepackage{fourier-otf}
\usepackage{xspace}
\usepackage{setspace}
\newcommand{\MATLAB}{\textsc{MATLAB}\xspace}
%\usepackage{microtype} %it helps to fit text inside margins)
\usepackage[en-AU]{datetime2}
\usepackage{csquotes}
% Tables
\usepackage{multirow}
% to have awesome icon
%\usepackage{fontawesome}
\usepackage{fontawesome5}
\usepackage{academicons}
% advanced drawing
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{tikzpagenodes}
\usepackage{smartdiagram}
\usepackage{float}
\usepackage{array}
\usetikzlibrary{decorations.text}
\usetikzlibrary{fadings}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.misc,positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{backgrounds}
\usetikzlibrary{shadings}
\usetikzlibrary{calendar}
\usetikzlibrary{er}
\usetikzlibrary{patterns}
\usetikzlibrary{shapes}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{decorations}
\usetikzlibrary{topaths}
\usepackage{graphicx}
% set TikZ styles
\tikzset{
contactIcon/.style={%
minimum height=\baselineskip,
}
}
% pictures
\usepackage{graphicx}
% loads graphicx, provides align=c option for vertical alignment w.r.t. text
\RequirePackage{graphbox}
\newcommand{\roundpic}[1]{\begin{figure}[H]\tikz \draw [path picture={ \node at (path picture bounding box.center){\includegraphics[height=3cm]{#1}} ;}] (0,2) circle (1.7) ;\end{figure}}
% more advanced expressions in \setlength
\usepackage{calc}
% Define Colors
\RequirePackage{xcolor}
\definecolor{titleBackColor}{RGB}{25,20,60} %original color: {rgb}{0.25,0.25,0.25}
\definecolor{sideBarColor}{rgb}{0.6,0.6,0.6}
\definecolor{mydarkblue}{rgb}{0.07,0.08,0.4}
\definecolor{myblue}{rgb}{.4,.4,1}
\definecolor{myyellow}{RGB}{245,169,34}
% links
\usepackage{hyperref}
\hypersetup{colorlinks,urlcolor=black}
% Lists
\usepackage{enumitem}
\setlist{topsep=0pt,leftmargin=,nosep}
%\setlist{leftmargin=,topsep=0pt,nosep,itemsep=0.15\baselineskip,after=\vspace{0.25\baselineskip}}
% Define Lengths
\setlength\parindent{0.0cm}
\newlength\cvPictureWidth \setlength\cvPictureWidth{4cm}
\newlength\SidebarWidth \setlength\SidebarWidth{7.5cm} %8cm
\newlength\leftSideSecWidth \setlength\leftSideSecWidth{2.5cm} %2cm
\newlength\rightSideSecWidth \setlength\rightSideSecWidth{9cm} %9cm
\newlength\SecHorizSpace \setlength\SecHorizSpace{0.1cm}
\newlength\SecVertSpace \setlength\SecVertSpace{0.4cm}
\newlength\rightMinipageWidth \setlength\rightMinipageWidth{12cm}%11.8cm
\newlength\leftMinipageWidth \setlength\leftMinipageWidth{6.5cm}%7cm
% avoid line overflow
\setlength{\emergencystretch}{2pt}
%------------ font highlighting / boxes with background color
\newcommand{\bg}[3]{\colorbox{#1}{\bfseries\color{#2}#3}}
\newcommand{\bgupper}[3]{\colorbox{#1}{\color{#2}\huge\bfseries\MakeUppercase{#3}}}
%%% NEW HEADER
\newcommand{\header}[7]{%Inputs: #1 = up rectangle color, #2= up rectangle text, #3 = central rectangle color, #4= fig.name, #5= backgr. rect. col. , #6= fig horizontal pos., #7= text horiz. pos.
\tikz[remember picture,overlay] {%
\noderectangle, fill=#1, anchor=north, minimum width=\paperwidth, minimum height=5cm at (current page.north){};% background rectangle
\nodeleft=#2 of header.north, anchor=east at (header.east){\fontfamily{\sfdefault}\selectfont #3};%
\nodeanchor=south west at (name.north west){\fontfamily{\sfdefault}\selectfont #4};%
\nodeanchor=north west at (name.south west) {\fontfamily{\sfdefault}\selectfont #5};%
\noderight=#6 of header.west, anchor=west at (header.west) {};%
\draw[draw=myyellow, line width=0.3mm,path picture={\node[anchor=center] at (path picture bounding box.center){\includegraphics[width=4.0cm]{#7}} ;}] (picture) circle (2cm) ;}%
\vspace{1.5cm}%
}
%%%%%%%
% SideBar
\newcommand{\sidebar}[1]{
\tikz[remember picture,overlay] {%
\noderectangle, fill=#1, anchor=north west, minimum width=\SidebarWidth, minimum height=\paperheight at (current page.north west){};%current page (text area).north west, height= \textheight
}
} %original: minimum width=8.6cm
\newcommand{\MySectionTitle}[2]{% max 9 parameters !
\begin{tikzpicture}[remember picture,overlay]% '%' are vital in macros! (dangling space issues)
% \draw [help lines] (0,0) grid (5,-2);%
\node[font = {\Large},circle,fill=myyellow, minimum size = 1.2cm]%
(c) at (0.5,-1){#1};% <<< NEW
\draw[orange, thick] (c.0) -- (\textwidth,-1); % <<< NEW (Q3)
\node at (6.8,-.8) [align=left,text width=8cm] { \bf \Large \color{titleBackColor}\MakeUppercase{#2}};%\MakeUppercase{#2}};% <<< (Q2) almost
\end{tikzpicture}%
\vspace{1.5cm}% !!! the next empty line is needed: else the layout breaks
}
% ~~~ Command for Education and Works ~~~~~~~~~~~~~~~~~~~~~~~~~
\newcommand{\MySection}[7]{% input: #1=title, #2=years, #3=logo, #4=university, #5=city, #6=specialization, #7=description
\adjustbox{valign=t}{\fbox{\begin{minipage}{\leftSideSecWidth}%
\begin{flushleft}%
\vspace{0.1cm}
{\footnotesize\bfseries \uppercase{#1}}\%title
{\scriptsize #2}\% years
\vspace{0.1cm}
\includegraphics[keepaspectratio,width=1.2cm]{#3} %logo
\end{flushleft}%
\end{minipage}}}%
\hspace{\SecHorizSpace} \hfill%\vline %\hfill
\adjustbox{valign=t}{\begin{minipage}{9.0cm}%
{\small\bfseries \textsc{#4}}%university
\hfill {\footnotesize \faMapMarker ~ #5}% city
\newline%
\small {#6}% specialization
\footnotesize {#7}% description
\end{minipage}}%
\vspace*{\SecVertSpace}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Format of the title section in the side column
% based on https://tex.stackexchange.com/questions/65731
\makeatletter
\def\cv@hrulefill{{\color{titleBackColor}\leavevmode\leaders\hrule height 1pt\hfill\kern\z@}}
% line before and after text (some tweaking is required here)
% based on https://tex.stackexchange.com/questions/15119
\NewDocumentCommand{\ruleline}{m}{\par\noindent\raisebox{\baselineskip/4}{\makebox[\linewidth]{\cv@hrulefill\hspace{1ex}\raisebox{-\baselineskip/4}{\large #1}\hspace{1ex}\cv@hrulefill}}\vspace*{0.05cm}}
\makeatother
\usepackage{titlesec} % Allows creating custom \sections
% Format of the section titles
\titleformat{\section}{
\bf \Large\raggedright}{}{0em}{}[\titlerule] % smallcaps, Large, continuous line - looks better if two columns, might look a bit too dramatic if just one ;)
\titlespacing{\section}{0pt}{12pt}{5pt} % Spacing around titles {<left spacing>}{<before spacing>}{<after spacing>}
% Multiple Column Package
\usepackage{multicol}
% Generate QR Code from a link
\usepackage{qrcode}
% pictoFraction
\newcommand{\icon}[3]{\phantom{x}{#3\color{#2}#1}\phantom{x}}
%------------------- pictogram Fraction: pictoFraction
\newcommand{\pictofraction}[6]{%
\pgfmathparse{#3 - 1}\foreach \n in {0,...,\pgfmathresult}{\icon{#1}{#2}{#6}}%
\pgfmathparse{#5 - 1}\foreach \n in {0,...,\pgfmathresult}{\icon{#1}{#4}{#6}}%
}
%%% END PREAMBLE %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\overfullrule=0.2cm %
\begin{document}
%%% Footer
\pagestyle{fancy}
\renewcommand{\footrulewidth}{0.4pt}
\fancyfoot[C]{\small \textcolor{black}{\footnotesize I hereby authorize the processing of the personal data contained in this CV in compliance with the European Regulation (UE) 2016/679.\[0.2cm]
\footnotesize Page \textcolor{black}{\thepage} of \pageref*{LastPage}}}
% \fancyfoot[C]{\small \textcolor{black}{Page \thepage \hspace{1pt} of \pageref{LastPage}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Side bar
\sidebar{sideBarColor!25}
% \simpleheader{titleBackColor}{white}{Giuseppe Donnarumma}{Aerospace Engineer}{shuttle.pdf}
\header{titleBackColor}{6cm}{\bgupper{titleBackColor}{white}{\bfseries\huge XXXXXXXX XXXXXXXXXX}}{\bg{titleBackColor}{white}{Aerospace engineer} }{\bg{titleBackColor}{myyellow}{\large Curriculum Vitae}}{2.5cm}{example-image-a}
% Start Minipages
\vspace*{3.0cm}
\adjustbox{valign=t}{\fbox{\begin{minipage}{\leftMinipageWidth}
% Profile section
\ruleline{\textbf{About me}}
\lipsum[11]
\vspace*{0.2cm}
\lipsum[2]
% QR Code
\begin{flushright}
\small \textbf{\aiOverleaf Download my CV}\\
\footnotesize Last updated: \today \
\vspace*{0.2cm}
% \quad
\bg{white}{black}{\qrcode[height=2.0cm]{}} \
\end{flushright}
\end{minipage}}} %
\hfill
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% MAIN SECTION %%%%%%%%%%%%%%%%%%%%
\adjustbox{valign=t}{\fbox{\begin{minipage}{\rightMinipageWidth} %11.3cm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Work Experience
\MySectionTitle{\faSuitcase}{work experiences}
% input: #1=title, #2=years, #3=logo, #4=university, #5=city, #6=specialization, #7=description
\MySection{Visiting Researcher}
{Feb.--Mar. 20XX}
{example-image-b}
{University}
{Rome, Italy}
{Aerospace Engineering}
{\newline \lipsum[11]}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\MySectionTitle{\faGraduationCap}{Education}
\MySection{Master's Degree}
{20XX--20XX}
{example-image-c}
{University xxxxxxxx}
{Rome, Italy}
{Aerospace Engineering}
{\begin{itemize}[noitemsep,topsep=0pt,label=\textcolor{titleBackColor}{\textbullet}]
\item Thesis title
\item Thesis subject
\item Thesis keywords
\item Graduation grade
\end{itemize}
}
\MySection{Bachelor's Degree}{20xx--20xx}{example-image-c}{University xxxxxx}{xxxxxx, Italy}{Aerospace Engineering}{\begin{itemize}[noitemsep,topsep=0pt,label=\textcolor{titleBackColor}{\textbullet}]
\item Thesis title
\item Thesis subject
\item Graduation grade
\end{itemize}
}
\MySection{High School Diploma}{20xx--20xx}{example-image-c}{IIS \enquote{xxxxxxxx}}{XXXXXXX, Italy}{Liceo Scientifico}{
\begin{itemize}
\item Kind of secondary school: Italian secondary school
\item Diploma grade
\end{itemize}
}
\vspace*{\SecVertSpace}
\end{minipage}}
}%
\end{document}
I'd like to solve the following points (see the next image for better understanding):
- Move the QR code and the above sentences (see elements inside the bounded area 1) to the header of my CV;
- Modify the coloured sidebar width and the image position such as the segments (2) are all equal;
- Decrease the line spacing (3) in the boxes of the sections to make them more compact;
- Colour the footer background.
I apologize for asking many requests in a unique question. If it is required, I can split in different questions.


