%-------------------------
% Resume in Latex
% Author : Sourabh Bajaj
% License : MIT
%------------------------

\documentclass[<<design.font_size>>, <<design.page_size>>]{article}

\usepackage[
    ignoreheadfoot, % set margins without considering header and footer
    top=<<design.margins.page.top>>, % seperation between body and page edge from the top
    bottom=<<design.margins.page.bottom>>, % seperation between body and page edge from the bottom
    left=<<design.margins.page.left>>, % seperation between body and page edge from the left
    right=<<design.margins.page.right>>, % seperation between body and page edge from the right
    footskip=<<design.margins.page.bottom|divide_length_by(2)>>, % seperation between body and footer
    % showframe % for debugging 
]{geometry} % for adjusting page geometry
\usepackage{latexsym}
\usepackage[nobottomtitles*]{titlesec}
\usepackage{marvosym}
\usepackage{verbatim}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{enumitem}
\usepackage[
    hidelinks,
    pdftitle={<<cv.name>>'s CV},
    pdfauthor={<<cv.name>>}
]{hyperref}
\usepackage{fancyhdr}
\usepackage[english]{babel}
\usepackage{tabularx}
\usepackage{ifthen}
\usepackage{fontawesome5}
\usepackage{calc} % for calculating lengths
\usepackage[pscoord]{eso-pic} % for floating text on the page
\usepackage{lastpage} % for getting the total number of pages

% Ensure that generate pdf is machine readable/ATS parsable
\input{glyphtounicode}
\pdfgentounicode=1

\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
((* if not design.disable_page_numbering *))
((* set page_numbering_style_placeholders = {
    "NAME": cv.name,
    "PAGE_NUMBER": "\\thepage{}",
    "TOTAL_PAGES": "\pageref*{LastPage}"
} *))
\fancyfoot[CO]{\color{gray}\textit{\small <<design.page_numbering_style|replace_placeholders_with_actual_values(page_numbering_style_placeholders)>>}}
((* endif *))
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

\definecolor{primaryColor}{RGB}{<<design.color.as_rgb_tuple()|join(", ")>>} % define primary color

\urlstyle{same}

\setcounter{secnumdepth}{0} % no section numbering
\setlength{\parindent}{0pt} % no indentation
\setlength{\topskip}{0pt} % no top skip

% \raggedbottom
((* if design.text_alignment == "left-aligned"*))
\raggedright
((* elif design.text_alignment == "justified-with-no-hyphenation" *))
\usepackage[none]{hyphenat} % for disabling hyphenation
((* endif *))
\setlength{\tabcolsep}{0in}

% Sections formatting
\titleformat{\section}{
 \scshape\raggedright\large
}{}{0em}{}[\color{black}\titlerule]



\newcolumntype{R}[1]{
    >{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}p{#1}
} % right-aligned fixed width column type

\titlespacing{\section}{
        % left space:
        0pt
    }{
        % top space:
        <<design.margins.section_title.top>> - 0.1cm
    }{
        % bottom space:
        <<design.margins.section_title.bottom>>
    } % section title spacing

%-------------------------
% Custom commands
((* set last_updated_date_style_placeholders = {
    "TODAY": today,
} *))
\newcommand{\placelastupdatedtext}{% \placetextbox{<horizontal pos>}{<vertical pos>}{<stuff>}
  \AddToShipoutPictureFG*{% Add <stuff> to current page foreground
    \put(
        \LenToUnit{\paperwidth-<<design.margins.page.right>>-<<design.margins.entry_area.left_and_right>>+0.05cm},
        \LenToUnit{\paperheight-<<design.margins.page.top|divide_length_by(2)>>}
    ){\vtop{{\null}\makebox[0pt][c]{
        \small\color{gray}\textit{<<design.last_updated_date_style|replace_placeholders_with_actual_values(last_updated_date_style_placeholders)>>}\hspace{\widthof{<<design.last_updated_date_style|replace_placeholders_with_actual_values(last_updated_date_style_placeholders)>>}}
    }}}%
  }%
}%

\newcommand{\resumeItem}[2]{
  \item\small{
    \ifthenelse{\equal{#1}{}}{#2}{\textbf{#1:}{ #2}}
  }
}

\newcommand{\resumeItemWithoutBullet}[2]{
  \item[]\small{
    \ifthenelse{\equal{#1}{}}{#2}{\textbf{#1:}{ #2}}
  }
}

\newcommand{\resumeSubheading}[4]{
 \item
    \begin{tabularx}{0.98\textwidth-<<design.margins.entry_area.left_and_right|divide_length_by(0.5)>>}[t]{X R{<<design.margins.entry_area.date_and_location_width>>}}
      #1 & \small\ifthenelse{\equal{#2}{}}{#4}{#2} \\
      {\small#3} & \small\ifthenelse{\equal{#2}{}}{}{#4} \\
    \end{tabularx}
}

\newcommand{\resumePublicationSubheading}[3]{
 \item
    \begin{tabularx}{0.98\textwidth-0.4 cm}[t]{X R{4.1 cm}}
        #1 & \small#2 \\
        #3 
    \end{tabularx}
}

\newcommand{\resumeNormalSubheading}[2]{
 \item
    \begin{tabularx}{0.98\textwidth-<<design.margins.entry_area.left_and_right|divide_length_by(0.5)>>}[t]{X R{<<design.margins.entry_area.date_and_location_width>>}}
      \textbf{#1} & \textit{\small #2}
    \end{tabularx}
}

\newcommand{\resumeSubItem}[2]{\resumeItem{#1}{#2}}

\newcommand{\resumeSubItemWithoutBullet}[2]{\resumeItemWithoutBullet{#1}{#2}}

\renewcommand{\labelitemii}{$\circ$}

\newcommand{\resumeSubHeadingListStart}{\begin{itemize}[left=<<design.margins.entry_area.left_and_right>>, topsep=0pt, parsep=<<design.margins.entry_area.vertical_between>>, partopsep=0pt, rightmargin=<<design.margins.entry_area.left_and_right>>]}
\newcommand{\resumeSubHeadingListEnd}{\end{itemize}}
\newcommand{\resumeItemListStart}{\vspace{<<design.margins.highlights_area.top>>}\begin{itemize}[left=<<design.margins.highlights_area.left>>, topsep=-<<design.margins.entry_area.vertical_between>>, itemsep=<<design.margins.highlights_area.vertical_between_bullet_points>>, partopsep=0pt, rightmargin=0cm]}
\newcommand{\resumeItemListEnd}{\end{itemize}}
