Skip to content

rendercv.themes.moderncv

ModerncvThemeOptions

Bases: RenderCVBaseModelWithoutExtraKeys

This class is the data model of the theme options for the moderncv theme.

Source code in rendercv/themes/moderncv/__init__.py
class ModerncvThemeOptions(RenderCVBaseModelWithoutExtraKeys):
    """This class is the data model of the theme options for the `moderncv` theme."""

    model_config = pydantic.ConfigDict(extra="forbid")

    theme: Literal["moderncv"]
    font_size: Literal["10pt", "11pt", "12pt"] = pydantic.Field(
        default="10pt",
        title="Font Size",
        description='The font size of the CV. The default value is "10pt".',
        examples=["10pt", "11pt", "12pt"],
    )
    page_size: Literal["a4paper", "letterpaper"] = pydantic.Field(
        default="letterpaper",
        title="Page Size",
        description='The page size of the CV. The default value is "letterpaper".',
        examples=["a4paper", "letterpaper"],
    )
    color: (
        Literal["blue"]
        | Literal["black"]
        | Literal["burgundy"]
        | Literal["green"]
        | Literal["grey"]
        | Literal["orange"]
        | Literal["purple"]
        | Literal["red"]
    ) = pydantic.Field(
        default="blue",
        validate_default=True,
        title="Primary Color",
        description='The primary color of the CV. The default value is "blue".',
        examples=[
            "blue",
            "black",
            "burgundy",
            "green",
            "grey",
            "orange",
            "purple",
            "red",
        ],
    )
    date_width: LaTeXDimension = pydantic.Field(
        default="3.8 cm",
        validate_default=True,
        title="Date and Location Column Width",
        description='The width of the date column. The default value is "3.8 cm".',
    )
    content_scale: float = pydantic.Field(
        default=0.75,
        title="Content Scale",
        description=(
            "The scale of the content with respect to the page size. The default value"
            ' is "0.75".'
        ),
    )
    show_only_years: bool = pydantic.Field(
        default=False,
        title="Show Only Years",
        description=(
            'If "True", only the years will be shown in the date column. The default'
            ' value is "False".'
        ),
    )
    disable_page_numbers: bool = pydantic.Field(
        default=False,
        title="Disable Page Numbers",
        description=(
            'If "True", the page numbers will be disabled. The default value is'
            ' "False".'
        ),
    )

Jinja Templates

Preamble.j2.tex

%% start of file `template.tex'.
%% Copyright 2006-2015 Xavier Danaux ([email protected]), 2020-2022 moderncv maintainers (github.com/moderncv).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.

\documentclass[<<design.font_size>>,<<design.page_size>>,sans]{moderncv}        % possible options include font size ('10pt', '11pt' and '12pt'), paper size ('a4paper', 'letterpaper', 'a5paper', 'legalpaper', 'executivepaper' and 'landscape') and font family ('sans' and 'roman')

% moderncv themes
\moderncvstyle{classic}                            % style options are 'casual' (default), 'classic', 'banking', 'oldstyle' and 'fancy'
\moderncvcolor{<<design.color>>}                               % color options 'black', 'blue' (default), 'burgundy', 'green', 'grey', 'orange', 'purple' and 'red'
%\renewcommand{\familydefault}{\sfdefault}         % to set the default font; use '\sfdefault' for the default sans serif font, '\rmdefault' for the default roman one, or any tex font name
((* if design.disable_page_numbers *))
\nopagenumbers{}
((* endif *))

\usepackage{amsmath} % for math

% adjust the page margins
\usepackage[scale=<<design.content_scale>>]{geometry}
\setlength{\hintscolumnwidth}{<<design.date_width>>}                % if you want to change the width of the column with the dates
%\setlength{\makecvheadnamewidth}{10cm}            % for the 'classic' style, if you want to force the width allocated to your name and avoid line breaks. be careful though, the length is normally calculated to avoid any overlap with your personal info; use this at your own typographical risks...

% font loading
% for luatex and xetex, do not use inputenc and fontenc
% see https://tex.stackexchange.com/a/496643
\ifxetexorluatex
  \usepackage{fontspec}
  \usepackage{unicode-math}
  \defaultfontfeatures{Ligatures=TeX}
  \setmainfont{Latin Modern Roman}
  \setsansfont{Latin Modern Sans}
  \setmonofont{Latin Modern Mono}
  \setmathfont{Latin Modern Math} 
\else
  \usepackage[T1]{fontenc}
  \usepackage{lmodern}
\fi

% document language
\usepackage[english]{babel}  % FIXME: using spanish breaks moderncv

% personal data
\name{<<cv.name>>}{}
((* if cv.label *))
\title{<<cv.label>>}                               % optional, remove / comment the line if not wanted
((* endif *))
% \familyname{}
((* if cv.location *))
\address{<<cv.location>>}{}
((* endif *))
((* if cv.phone *))
\phone[mobile]{<<cv.phone|replace("tel:", "")|replace("-"," ")>>}
((* endif *))
((* if cv.email *))
\email{<<cv.email|escape_latex_characters>>}
((* endif *))
((* if cv.website *))
\homepage{<<cv.website|replace("https://", "")|reverse|replace("/", "", 1)|reverse>>}
((* endif *))

((* if cv.social_networks *))
    ((* for network in cv.social_networks *))
\social[<<network.network|lower()|replace(" ", "")>>]{<<network.username>>}
    ((* endfor *))
((* endif *))
% Social icons
% \social[linkedin]{john.doe}                        % optional, remove / comment the line if not wanted
% \social[xing]{john\_doe}                           % optional, remove / comment the line if not wanted
% \social[twitter]{ji\_doe}                          % optional, remove / comment the line if not wanted
% \social[github]{jdoe}                              % optional, remove / comment the line if not wanted
% \social[gitlab]{jdoe}                              % optional, remove / comment the line if not wanted
% \social[stackoverflow]{0000000/johndoe}            % optional, remove / comment the line if not wanted
% \social[bitbucket]{jdoe}                           % optional, remove / comment the line if not wanted
% \social[skype]{jdoe}                               % optional, remove / comment the line if not wanted
% \social[orcid]{0000-0000-000-000}                  % optional, remove / comment the line if not wanted
% \social[researchgate]{jdoe}                        % optional, remove / comment the line if not wanted
% \social[researcherid]{jdoe}                        % optional, remove / comment the line if not wanted
% \social[telegram]{jdoe}                            % optional, remove / comment the line if not wanted
% \social[whatsapp]{12345678901}                     % optional, remove / comment the line if not wanted
% \social[signal]{12345678901}                       % optional, remove / comment the line if not wanted
% \social[matrix]{@johndoe:matrix.org}               % optional, remove / comment the line if not wanted
% \social[googlescholar]{googlescholarid}            % optional, remove / comment the line if not wanted

% new command for cventry (this is done to allow users unbold or unitalicize the text in the cventry command)
\renewcommand*{\cventry}[6][.25em]{%
  \cvitem[#1]{#2}{%
    #3%
    \ifthenelse{\equal{#4}{}}{}{, #4}%
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6}%
  }
}

Header.j2.tex

((* if cv.name is not none *))
\maketitle
((* endif *))


% save the original href command in a new command:
\let\hrefWithoutArrow\href
 % new command for external links:
\renewcommand{\href}[2]{\hrefWithoutArrow{#1}{\mbox{\color{color1} #2 \raisebox{.15ex}{\footnotesize \faExternalLink*}}}}

\hypersetup{pdftitle={<<cv.name>>'s CV}}

SectionBeginning.j2.tex

\section{<<section_title>>}

SectionEnding.j2.tex


TextEntry.j2.tex

\cvline{}{<<entry>>}

BulletEntry.j2.tex

\cvlistitem{<<entry.bullet>>}

OneLineEntry.j2.tex

\cvline{<<entry.label>>}{<<entry.details>>}

EducationEntry.j2.tex

\cventry{
    ((*- if design.show_only_years *))<<-entry.date_string_only_years->>((* else *))<<-entry.date_string->>((* endif -*))
}{\textbf{<<entry.institution>>}}{
((*- if entry.degree *))<<entry.degree>> in ((* endif *))<<entry.area->>
}{
    <<-entry.location->>
}{}{}
((* for item in entry.highlights *))
\cvlistitem{<<item>>}
((* endfor *))

ExperienceEntry.j2.tex

\cventry{
    ((*- if design.show_only_years *))<<-entry.date_string_only_years->>((* else *))<<-entry.date_string->>((* endif -*))
}{\textbf{<<entry.company>>}}{
    <<-entry.position->>
}{
    <<-entry.location->>
}{}{}
((* for item in entry.highlights *))
\cvlistitem{<<item>>}
((* endfor *))

NormalEntry.j2.tex

\cventry{
    ((*- if design.show_only_years *))<<-entry.date_string_only_years->>((* else *))<<-entry.date_string->>((* endif -*))
}{
    <<-entry.name->>
}{
    <<-entry.location->>
}{}{}{}
((* for item in entry.highlights *))
\cvlistitem{<<item>>}
((* endfor *))

PublicationEntry.j2.tex

\cventry{
    ((*- if design.show_only_years *))<<-entry.date_string_only_years->>((* else *))<<-entry.date_string->>((* endif -*))
}{\textbf{<<entry.title>>}}{
    <<-entry.journal->>
}{
((*- if entry.doi -*))\href{<<entry.doi_url>>}{<<entry.doi>>}((* elif entry.url *))\href{<<entry.url>>}{<<entry.clean_url>>}((*- endif -*))
}{}{}
\cvline{}{\small <<entry.authors|map("make_it_nolinebreak")|join(", ")>>}