diff --git a/rendercv/rendering.py b/rendercv/rendering.py index 1bd0cea..8faa25e 100644 --- a/rendercv/rendering.py +++ b/rendercv/rendering.py @@ -265,6 +265,59 @@ def abbreviate_names(names: list[str]) -> str: return abbreviated_names +def abbreviate_name(name: list[str]) -> str: + """Abbreviate a name by keeping the first letters of the first names. + + This function is used as a Jinja2 filter. + + Example: + ```python + abbreviate_name("John Doe") + ``` + + will return: + + `#!python "J. Doe"` + + Args: + name (str): The name to abbreviate. + Returns: + str: The abbreviated name. + """ + first_names = name.split(" ")[:-1] + first_names_initials = [first_name[0] + "." for first_name in first_names] + last_name = name.split(" ")[-1] + abbreviated_name = " ".join(first_names_initials) + " " + last_name + + return abbreviated_name + + +def abbreviate_names(names: list[str]) -> str: + """Abbreviate a list of names by keeping the first letters of the first names. + + This function is used as a Jinja2 filter. + + Example: + ```python + abbreviate_names(["John Doe", "Jane Atalay"]) + ``` + + will return: + + `#!python ["J. Doe", "J. Atalay"]` + + Args: + names (list[str]): The names to abbreviate. + Returns: + str: The list of abbreviated names. + """ + abbreviated_names = [] + for name in names: + abbreviated_names.append(abbreviate_name(name)) + + return abbreviated_names + + def divide_length_by(length: str, divider: float) -> str: r"""Divide a length by a number. @@ -468,12 +521,12 @@ def run_latex(latex_file_path: str) -> str: error_line = line.replace("! ", "") break - raise RuntimeError( - "Running TinyTeX has failed with the following error:", - f"{error_line}", - "If you can't solve the problem, please try to re-install RenderCV," - " or open an issue on GitHub.", - ) + raise RuntimeError( + "Running TinyTeX has failed with the following error:", + f"{error_line}", + "If you can't solve the problem, please try to re-install RenderCV," + " or open an issue on GitHub.", + ) run() run() # run twice for cross-references diff --git a/rendercv/templates/classic/classic.tex.j2 b/rendercv/templates/classic/classic.tex.j2 index 28e16a0..9ad5c21 100644 --- a/rendercv/templates/classic/classic.tex.j2 +++ b/rendercv/templates/classic/classic.tex.j2 @@ -11,8 +11,7 @@ bottom=<>, % seperation between body and page edge from the bottom left=<>, % seperation between body and page edge from the left right=<>, % seperation between body and page edge from the right - footskip=<>, % seperation between body and footer - % showframe % for debugging + % showframe % for debugging ]{geometry} % for adjusting page geometry \usepackage{fontspec} % for loading fonts \usepackage[explicit]{titlesec} % for customizing section titles @@ -30,22 +29,14 @@ ]{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 % Some settings: \pagestyle{empty} % no header or footer \setcounter{secnumdepth}{0} % no section numbering \setlength{\parindent}{0pt} % no indentation \setlength{\topskip}{0pt} % no top skip -((# \pagenumbering{gobble} % no page numbering #)) -\makeatletter -\let\ps@customFooterStyle\ps@plain % Copy the plain style to customFooterStyle -\patchcmd{\ps@customFooterStyle}{\thepage}{ - \color{gray}\textit{\small <> | Page \thepage{} of \pageref*{LastPage}} -}{}{} % replace number by desired string -\makeatother -\pagestyle{customFooterStyle} +\pagenumbering{gobble} % no page numbering + \setmainfont{<>}[ Path= fonts/, @@ -84,23 +75,18 @@ \newcolumntype{R}[1]{ >{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}p{#1} } % right-aligned fixed width column type -((* if theme_options.text_alignment == "justified" *)) \newcolumntype{K}[1]{ >{\let\newline\\\arraybackslash\hspace{0pt}}X -} % justified flexible width column type -((* elif theme_options.text_alignment == "left-aligned" *)) -\newcolumntype{K}[1]{ - >{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}X -} % left-aligned flexible width column type -((* endif *)) +} % left-aligned (but justified) flexible width column type \setlength\tabcolsep{-1.5pt} % no space between columns + \newenvironment{highlights}{ \begin{itemize}[ topsep=0pt, parsep=<>, partopsep=0pt, itemsep=0pt, - after=\vspace{-1\baselineskip}, + after=\vspace*{-1\baselineskip}, leftmargin=<> + 3pt ] }{ @@ -119,7 +105,7 @@ \LenToUnit{\paperwidth-<>-<>+0.05cm}, \LenToUnit{\paperheight-<>} ){\vtop{{\null}\makebox[0pt][c]{ - \small\color{gray}\textit{Last updated on <>}\hspace{\widthof{Last updated on <>}} + \small\color{gray}\emph{Last updated on <>}\hspace{\widthof{Last updated on <>}} }}}% }% }% @@ -127,7 +113,7 @@ % save the original href command in a new command: \let\hrefWithoutArrow\href % new command for external links: -\renewcommand{\href}[2]{\hrefWithoutArrow{#1}{#2 \raisebox{.15ex}{\footnotesize \faExternalLink*}}} +\renewcommand{\href}[2]{\hrefWithoutArrow{#1}{#2\, \raisebox{.1ex}{\footnotesize \faExternalLink*}}} \begin{document} ((* if theme_options.show_last_updated_date *)) @@ -135,13 +121,9 @@ ((* endif *)) <> - ((* if cv.summary is not none *)) \section{Summary} - { - ((* if theme_options.text_alignment == "left-aligned" *)) - \raggedright - ((* endif *)) + \setlength{\leftskip}{<>} \setlength{\rightskip}{<>} @@ -149,7 +131,6 @@ \setlength{\leftskip}{0cm} \setlength{\rightskip}{0cm} - } ((* endif *)) \centering diff --git a/rendercv/templates/classic/components/entry.tex.j2 b/rendercv/templates/classic/components/entry.tex.j2 index 1b5743c..4d7a5d0 100644 --- a/rendercv/templates/classic/components/entry.tex.j2 +++ b/rendercv/templates/classic/components/entry.tex.j2 @@ -7,6 +7,7 @@ ((# preamble: first column, second column, third column #)) ((# first column: p{0.55cm}; constant width, ragged left column #)) ((# second column: K{<>}; variable width, justified column #)) + ((# second column: K{<>}; variable width, justified column #)) ((# third column: R{<>}; constant widthm ragged right column #)) \begin{tabularx}{\textwidth-<>-0.13cm}{L{0.85cm} K{<>} R{<>}} \textbf{<>} @@ -25,7 +26,7 @@ ((# first column:: K{<>}; variable width, justified column #)) ((# second column: R{<>}; constant width ragged right column #)) \begin{tabularx}{\textwidth-<>-0.13cm}{K{<>} R{<>}} - \textbf{<>}, <> + \textbf{<>}, <> <> & <> @@ -43,12 +44,12 @@ ((* if markdown_url is not none *)) ((* if link_text is not none *)) ((* set markdown_url = "["+link_text+"]("+ markdown_url|markdown_link_to_url +")" *)) - \textbf{<>}, <> + \textbf{<>}, <> ((* else *)) - \textbf{<>}, <> + \textbf{<>}, <> ((* endif *)) ((* else *)) - \textbf{<>} + \textbf{<>} ((* endif *)) <> \end{tabularx} @@ -80,9 +81,11 @@ \begin{tabularx}{\textwidth-<>-0.13cm}{K{<>} R{<>}} \textbf{<>} - \vspace{<<theme_options.margins.highlights_area.vertical_between_bullet_points>>} + \vspace{<<theme_options.margins.entry_area.vertical_between|divide_length_by(2)>>} - <<authors|abbreviate_names|join(", ")|make_it_bold(cv.name|abbreviate_name)|make_it_italic(cv.name|abbreviate_name)>> + <<authors|abbreviate_names|join(", ")|make_it_italic(cv.name|abbreviate_name)>> + + \vspace{<<theme_options.margins.entry_area.vertical_between|divide_length_by(2)>>} \vspace{<<theme_options.margins.highlights_area.vertical_between_bullet_points>>} @@ -94,7 +97,7 @@ ((* endmacro *)) ((* macro one_line(name, details, markdown_url=none, link_text=none) *)) - \begingroup((* if theme_options.text_alignment == "left-aligned" *))\raggedright((* endif *)) + \begingroup\raggedright \leftskip=<<theme_options.margins.entry_area.left_and_right>> \advance\csname @rightskip\endcsname <<theme_options.margins.entry_area.left_and_right>> \advance\rightskip <<theme_options.margins.entry_area.left_and_right>>