sb2nov: switch to RenderCV's LaTeX code

This commit is contained in:
Sina Atalay 2024-04-16 02:38:09 +03:00
parent 84933c2844
commit 034ef7f056
13 changed files with 331 additions and 235 deletions

View File

@ -1 +1,7 @@
\resumeSubItem{}{<<entry.bullet>>}
((* if not is_first_entry *))
\vspace{<<design.margins.entry_area.vertical_between>>}
((* endif *))
\begin{onecolentry}
\textbullet \hspace{3pt} <<entry.bullet>>
\end{onecolentry}

View File

@ -1,12 +1,39 @@
\resumeSubheading
{\textbf{<<entry.institution>>}}{\textit{<<entry.location>>}}
{\textit{((* if entry.degree *))<<entry.degree>> in ((* endif *))<<entry.area>>}}{\textit{<<entry.date_string>>}}
((* if not is_first_entry *))
\vspace{<<design.margins.entry_area.vertical_between>>}
((* endif *))
((* if entry.date_string or entry.location *))
\begin{threecolentry}{
\vspace*{\fill}
\textbullet
\vspace*{3px}
\vspace*{\fill}
}{
((* if entry.date_string *))\textit{<<entry.date_string>>}((* endif *))
((* if entry.location *))\textit{<<entry.location>>}((* endif *))
}
((* else *))
\begin{onecolentrybulleted}
((* endif *))
\textbf{<<entry.institution>>}
\textit{((* if entry.degree *))<<entry.degree>> in ((* endif *))<<entry.area>>}
((* if entry.date_string or entry.location *))
\end{threecolentry}
((* else *))
\end{onecolentrybulleted}
((* endif *))
((* for item in entry.highlights *))
((* if loop.first *))
\resumeItemListStart
\vspace{<<design.margins.highlights_area.top>>}
\begin{onecolentry}
\begin{highlights}
((* endif *))
\resumeItem{}{<<item>>}
\item <<item>>
((* if loop.last *))
\resumeItemListEnd
\end{highlights}
\end{onecolentry}
((* endif *))
((* endfor *))
((* endfor *))

View File

@ -1,12 +1,39 @@
\resumeSubheading
{\textbf{<<entry.company>>}}{\textit{<<entry.location>>}}
{\textit{<<entry.position>>}}{\textit{<<entry.date_string>>}}
((* if not is_first_entry *))
\vspace{<<design.margins.entry_area.vertical_between>>}
((* endif *))
((* if entry.date_string or entry.location *))
\begin{threecolentry}{
\vspace*{\fill}
\textbullet
\vspace*{3px}
\vspace*{\fill}
}{
((* if entry.date_string *))\textit{<<entry.date_string>>}((* endif *))
((* if entry.location *))\textit{<<entry.location>>}((* endif *))
}
((* else *))
\begin{onecolentrybulleted}
((* endif *))
\textbf{<<entry.position>>}
\textit{<<entry.company>>}
((* if entry.date_string or entry.location *))
\end{threecolentry}
((* else *))
\end{onecolentrybulleted}
((* endif *))
((* for item in entry.highlights *))
((* if loop.first *))
\resumeItemListStart
\vspace{<<design.margins.highlights_area.top>>}
\begin{onecolentry}
\begin{highlights}
((* endif *))
\resumeItem{}{<<item>>}
\item <<item>>
((* if loop.last *))
\resumeItemListEnd
\end{highlights}
\end{onecolentry}
((* endif *))
((* endfor *))
((* endfor *))

View File

@ -1,59 +1,24 @@
((* if not design.disable_last_updated_date *))
\placelastupdatedtext
((* endif *))
((* if cv.name is not none *))
{
\centering
\textbf{\fontsize{<<design.header_font_size>>}{<<design.header_font_size>>}\selectfont
<<cv.name>>
} \\ \vspace{3pt}
\small
\begin{header}
\textbf{\fontsize{<<design.header_font_size>>}{<<design.header_font_size>>}\selectfont <<cv.name>>}
\vspace{<<design.margins.header.vertical_between_name_and_connections>>}
\begin{spacing}{1.6}
((* if cv.phone *))
\mbox{\href{<<cv.phone|replace("-","")>>}{{\footnotesize\faPhone*}\hspace{4pt}<<cv.phone|replace("tel:", "")|replace("-"," ")>>}}
\hspace{<<design.margins.header.horizontal_between_connections>>}
((* endif *))
((* if cv.email *))
\mbox{\href{mailto:<<cv.email>>}{{\small\faEnvelope[regular]}\hspace{4pt}<<cv.email|escape_latex_characters>>}}
\hspace{<<design.margins.header.horizontal_between_connections>>}
((* endif *))
((* if cv.location *))
\mbox{{\small\faMapMarker*}\hspace{4pt}<<cv.location>>}
\hspace{<<design.margins.header.horizontal_between_connections>>}
((* endif *))
((* if cv.website *))
\mbox{\href{<<cv.website>>}{{\small\faLink}\hspace{4pt}<<cv.website|replace("https://","")|reverse|replace("/", "", 1)|reverse>>}}
\hspace{<<design.margins.header.horizontal_between_connections>>}
((* endif *))
((*
set icon_dictionary = {
"LinkedIn": "\\faLinkedinIn",
"GitHub": "\\faGithub",
"Instagram": "\\faInstagram",
"Mastodon": "\\faMastodon",
"Orcid": "\\faOrcid",
}
*))
((* if cv.social_networks *))
((* for network in cv.social_networks *))
((* if network.network in icon_dictionary *))
\mbox{\href{<<network.url>>}{{\small<<icon_dictionary[network.network]>>}\hspace{4pt}<<network.username>>}}
\hspace*{<<design.margins.header.horizontal_between_connections>>}
((* endif *))
((* endfor *))
((* endif *))
\end{spacing}
\par
}
\vspace{<<design.margins.header.bottom>>}
((* endif *))
\normalsize
((* for connection in cv.connections *))
\mbox{
((* if connection["url"] *))
\hrefWithoutArrow{<<connection["url"]>>}{\color{black}{\footnotesize<<connection["latex_icon"]>>}\hspace*{0.13cm}<<connection["placeholder"]>>}
((* else *))
{\color{black}{\footnotesize<<connection["latex_icon"]>>}\hspace*{0.13cm}<<connection["placeholder"]>>}
((* endif *))
}
\kern <<design.margins.header.horizontal_between_connections>>
((* endfor *))
\end{header}
% save the original href command in a new command:
\let\hrefWithoutArrow\href
% new command for external links:
\renewcommand{\href}[2]{\hrefWithoutArrow{#1}{\color{primaryColor}\mbox{\ifthenelse{\equal{#2}{}}{}{#2 }\raisebox{.15ex}{\footnotesize \faExternalLink*}}}}
\vspace{<<design.margins.header.bottom>> - <<design.margins.section_title.top>>}
((* endif *))

View File

@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 Sourabh Bajaj
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,11 +1,37 @@
\resumeNormalSubheading
{<<entry.name>>}{<<entry.location>>((* if entry.date_string and entry.location *)), ((* endif *))<<entry.date_string>>}
((* if not is_first_entry *))
\vspace{<<design.margins.entry_area.vertical_between>>}
((* endif *))
((* if entry.date_string or entry.location *))
\begin{threecolentry}{
\vspace*{\fill}
\textbullet
\vspace*{3px}
\vspace*{\fill}
}{
((* if entry.date_string *))\textit{<<entry.date_string>>}((* endif *))
((* if entry.location *))\textit{<<entry.location>>}((* endif *))
}
((* else *))
\begin{onecolentrybulleted}
((* endif *))
\textbf{<<entry.name>>}
((* if entry.date_string or entry.location *))
\end{threecolentry}
((* else *))
\end{onecolentrybulleted}
((* endif *))
((* for item in entry.highlights *))
((* if loop.first *))
\resumeItemListStart
\vspace{<<design.margins.highlights_area.top>>}
\begin{onecolentry}
\begin{highlights}
((* endif *))
\resumeItem{}{<<item>>}
\item <<item>>
((* if loop.last *))
\resumeItemListEnd
\end{highlights}
\end{onecolentry}
((* endif *))
((* endfor *))
((* endfor *))

View File

@ -1,5 +1,7 @@
((* if is_first_entry *))
\vspace{0.08cm}
((* if not is_first_entry *))
\vspace{<<design.margins.entry_area.vertical_between>>}
((* endif *))
\resumeSubItem{<<entry.label>>}
{<<entry.details>>}
\begin{onecolentry}
\textbf{<<entry.label>>:} <<entry.details>>
\end{onecolentry}

View File

@ -1,11 +1,6 @@
%-------------------------
% Resume in Latex
% Author : Sourabh Bajaj
% License : MIT
%------------------------
\documentclass[<<design.font_size>>, <<design.page_size>>]{article}
% Packages:
\usepackage[
ignoreheadfoot, % set margins without considering header and footer
top=<<design.margins.page.top>>, % seperation between body and page edge from the top
@ -15,84 +10,146 @@
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{titlesec} % for customizing section titles
\usepackage{tabularx} % for making tables with fixed width columns
\usepackage{array} % tabularx requires this
\usepackage[dvipsnames]{xcolor} % for coloring text
\definecolor{primaryColor}{RGB}{<<design.color.as_rgb_tuple()|join(", ")>>} % define primary color
\usepackage{enumitem} % for customizing lists
\usepackage{fontawesome5} % for using icons
\usepackage{amsmath} % for math
\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
pdfauthor={<<cv.name>>},
colorlinks=true,
urlcolor=primaryColor
]{hyperref} % for links, metadata and bookmarks
\usepackage[pscoord]{eso-pic} % for floating text on the page
\usepackage{calc} % for calculating lengths
\usepackage{bookmark} % for bookmarks
\usepackage{lastpage} % for getting the total number of pages
\usepackage{changepage} % for one column entries (adjustwidth environment)
\usepackage{paracol} % for two and three column entries
\usepackage{ifthen} % for conditional statements
\usepackage{needspace} % for avoiding page brake right after the section title
% Ensure that generate pdf is machine readable/ATS parsable
\input{glyphtounicode}
\pdfgentounicode=1
% Ensure that generate pdf is machine readable/ATS parsable:
\ifpdf
\input{glyphtounicode}
\pdfgentounicode=1
\fi
\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
((* if not design.disable_page_numbering *))
% Some settings:
((* if design.text_alignment == "justified-with-no-hyphenation" *))
\usepackage[none]{hyphenat}
\sloppy
((* elif design.text_alignment == "left-aligned" *))
\raggedright
((* endif *))
\AtBeginEnvironment{adjustwidth}{\partopsep0pt} % remove space before adjustwidth environment
\pagestyle{empty} % no header or footer
\setcounter{secnumdepth}{0} % no section numbering
\setlength{\parindent}{0pt} % no indentation
\setlength{\topskip}{0pt} % no top skip
((* if design.disable_page_numbering *))
\pagenumbering{gobble} % no page numbering
((* else *))
((* 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)>>}}
\setlength{\columnsep}{0cm} % set column seperation
\makeatletter
\let\ps@customFooterStyle\ps@plain % Copy the plain style to customFooterStyle
\patchcmd{\ps@customFooterStyle}{\thepage}{
\color{gray}\textit{\small <<design.page_numbering_style|replace_placeholders_with_actual_values(page_numbering_style_placeholders)>>}
}{}{} % replace number by desired string
\makeatother
\pagestyle{customFooterStyle}
((* 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
\titleformat{\section}{\needspace{4\baselineskip}\bfseries\large}{}{0pt}{}[\vspace{1pt}\titlerule]
\titlespacing{\section}{
% left space:
0pt
}{
% top space:
<<design.margins.section_title.top>> - 0.1cm
}{
% bottom space:
<<design.margins.section_title.bottom>>
} % section title spacing
% left space:
-1pt
}{
% top space:
<<design.margins.section_title.top>>
}{
% bottom space:
<<design.margins.section_title.bottom>>
} % section title spacing
\renewcommand\labelitemi{$\circ$} % custom bullet points
\newenvironment{highlights}{
\begin{itemize}[
topsep=<<design.margins.highlights_area.top>>,
parsep=<<design.margins.highlights_area.vertical_between_bullet_points>>,
partopsep=0pt,
itemsep=0pt,
leftmargin=<<design.margins.highlights_area.left>> + 10pt + <<design.margins.entry_area.bullet_width>>
]
}{
\end{itemize}
} % new environment for highlights
\newenvironment{onecolentry}{
\begin{adjustwidth}{
<<design.margins.entry_area.left_and_right>> + 0.00001 cm
}{
<<design.margins.entry_area.left_and_right>> + 0.00001 cm
}
}{
\end{adjustwidth}
} % new environment for one column entries
\newenvironment{onecolentrybulleted}{
\onecolentry
\setcolumnwidth{<<design.margins.entry_area.bullet_width>>, \fill}
\begin{paracol}{2}
\vspace*{\fill}
\textbullet
\vspace*{3px}
\vspace*{\fill}
\switchcolumn
}{
\end{paracol}
\endonecolentry
} % new environment for one column entries with bullets
\newenvironment{twocolentry}[2][]{
\onecolentry
\def\secondColumn{#2}
\setcolumnwidth{\fill, <<design.margins.entry_area.date_and_location_width>>}
\begin{paracol}{2}
}{
\switchcolumn \raggedleft \secondColumn
\end{paracol}
\endonecolentry
} % new environment for two column entries
\newenvironment{threecolentry}[3][]{
\onecolentry
\def\thirdColumn{#3}
\setcolumnwidth{<<design.margins.entry_area.bullet_width>>, \fill, <<design.margins.entry_area.date_and_location_width>>}
\begin{paracol}{3}
#2 \switchcolumn
}{
\switchcolumn \raggedleft \thirdColumn
\end{paracol}
\endonecolentry
} % new environment for three column entries
\newenvironment{header}{
\setlength{\topsep}{0pt}\par\kern\topsep\centering\linespread{1.5}
}{
\par\kern\topsep
} % new environment for the header
%-------------------------
% Custom commands
((* set last_updated_date_style_placeholders = {
"TODAY": today,
} *))
@ -107,48 +164,10 @@
}%
}%
\newcommand{\resumeItem}[2]{
\item\small{
\ifthenelse{\equal{#1}{}}{#2}{\textbf{#1:}{ #2}}
}
}
% save the original href command in a new command:
\let\hrefWithoutArrow\href
\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}}
% new command for external links:
((* if not design.disable_external_link_icons *))
\renewcommand{\href}[2]{\hrefWithoutArrow{#1}{\mbox{\ifthenelse{\equal{#2}{}}{ }{#2 }\raisebox{.15ex}{\footnotesize \faExternalLink*}}}}
((* endif *))

View File

@ -1,18 +1,34 @@
\resumePublicationSubheading{
\textbf{<<entry.title>>}
}{
\textit{<<entry.date_string>>}
}
{
((*- if entry.doi -*))
\small\textit{\href{<<entry.doi_url>>}{<<entry.doi>>}}
((*- endif -*))
((*- if entry.doi and entry.journal *)) (((* endif -*))
((*- if entry.journal -*))
\small\textit{<<entry.journal>>}
((*- endif -*))
((*- if entry.doi and entry.journal *)))((* endif -*))
}
\resumeItemListStart
\resumeItem{}{\raggedright <<entry.authors|map("make_it_nolinebreak")|join(", ")>> \par}
\resumeItemListEnd
((* if not is_first_entry *))
\vspace{<<design.margins.entry_area.vertical_between>>}
((* endif *))
\begin{samepage}
\begin{threecolentry}{
\vspace*{\fill}
\textbullet
\vspace*{3px}
\vspace*{\fill}
}{
<<entry.date_string>>
}
\textbf{<<entry.title>>}
\end{threecolentry}
((* if entry.doi or entry.journal *))
\vspace{<<design.margins.highlights_area.vertical_between_bullet_points>>}
\begin{onecolentry}
\hspace{<<design.margins.entry_area.bullet_width>> - 0.1cm}
((* endif *))
((* if entry.doi -*))
\href{<<entry.doi_url>>}{<<entry.doi>>}
((*- endif -*))
((*- if entry.doi and entry.journal *)) (((* endif -*))
((*- if entry.journal -*))
<<entry.journal>>
((*- endif -*))
((*- if entry.doi and entry.journal *)))((* endif -*))
((* if entry.doi or entry.journal *))
\end{onecolentry}
((* endif *))
\end{samepage}

View File

@ -1,2 +1 @@
\section{<<section_title>>}
\resumeSubHeadingListStart
\section{<<section_title>>}

View File

@ -1 +0,0 @@
\resumeSubHeadingListEnd

View File

@ -1 +1,7 @@
\resumeSubItemWithoutBullet{}{<<entry>>}
((* if not is_first_entry *))
\vspace{<<design.margins.entry_area.vertical_between>>}
((* endif *))
\begin{onecolentry}
<<entry>>
\end{onecolentry}

View File

@ -2,14 +2,35 @@ from typing import Literal
import pydantic
from .. import ThemeOptions, LaTeXDimension
from .. import ThemeOptions, LaTeXDimension, Margins, EntryAreaMargins
class EntryAreaMarginsForSb2nov(EntryAreaMargins):
"""This class is a data model for the entry area margins."""
bullet_width: LaTeXDimension = pydantic.Field(
default="0.6 cm",
title="Width of the Entry Bullet",
description=(
"The width of the bullet for each entry. The default value is 1 cm."
),
)
class MarginsForSb2nov(Margins):
"""This class is a data model for the margins."""
entry_area: EntryAreaMarginsForSb2nov = pydantic.Field(
default=EntryAreaMarginsForSb2nov(),
title="Entry Area Margins",
description="Entry area margins.",
)
class Sb2novThemeOptions(ThemeOptions):
"""This class is the data model of the theme options for the sb2nov theme."""
"""This class is the data model of the theme options for the `sb2nov` theme."""
theme: Literal["sb2nov"]
header_font_size: LaTeXDimension = pydantic.Field(
default="24 pt",
title="Header Font Size",
@ -19,3 +40,8 @@ class Sb2novThemeOptions(ThemeOptions):
" 24 pt."
),
)
margins: MarginsForSb2nov = pydantic.Field(
default=MarginsForSb2nov(),
title="Margins",
description="Page, section title, entry field, and highlights field margins.",
)