From d13f919b8d2c39f4f4f46f6c3fd0c80adeca47e4 Mon Sep 17 00:00:00 2001 From: Javier Lopez-Gomez Date: Wed, 29 Nov 2023 18:42:33 +0100 Subject: [PATCH] Fork `moderncvstylecontemporary.sty` from the `classic` style --- moderncvbodyvi.sty | 175 +++++++++++++++++++++++++++++++ moderncvheadvii.sty | 187 ++++++++++++++++++++++++++++++++++ moderncvstylecontemporary.sty | 53 ++++++++++ 3 files changed, 415 insertions(+) create mode 100644 moderncvbodyvi.sty create mode 100644 moderncvheadvii.sty create mode 100644 moderncvstylecontemporary.sty diff --git a/moderncvbodyvi.sty b/moderncvbodyvi.sty new file mode 100644 index 0000000..610ee33 --- /dev/null +++ b/moderncvbodyvi.sty @@ -0,0 +1,175 @@ +%% start of file `moderncvbodyvi.sty'. +%% Copyright 2006-2015 Xavier Danaux (xdanaux@gmail.com). +%% Copyright 2023 Javier Lopez-Gomez (javier.lopez.gomez@proton.me). +% +% 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/. + + +%------------------------------------------------------------------------------- +% identification +%------------------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{moderncvbodyvi}[2023/11/21 v2.0.0 modern curriculum vitae and letter body variant: 6] + + +%------------------------------------------------------------------------------- +% required packages +%------------------------------------------------------------------------------- + + +%------------------------------------------------------------------------------- +% overall body definition +%------------------------------------------------------------------------------- +% fonts +\renewcommand*{\sectionfont}{\Large\mdseries\upshape} +\renewcommand*{\subsectionfont}{\large\mdseries\upshape} +\renewcommand*{\hintfont}{} + +% styles +\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}} +\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}} +\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}} + + +%------------------------------------------------------------------------------- +% resume body definition +%------------------------------------------------------------------------------- +% lengths +% used by \cvitem (and all children command) +\@initializelength{\hintscolumnwidth} \setlength{\hintscolumnwidth}{0.175\textwidth} +\@initializelength{\separatorcolumnwidth} \setlength{\separatorcolumnwidth}{0.025\textwidth} +\@initializelength{\maincolumnwidth} +% used by \cvdoubleitem +\@initializelength{\doubleitemcolumnwidth} +% used by \cvlistitem +\@initializelength{\listitemsymbolwidth} \settowidth{\listitemsymbolwidth}{\listitemsymbol} +\@initializelength{\listitemcolumnwidth} +% used by \cvlistdoubleitem +\@initializelength{\listdoubleitemcolumnwidth} +% default moderncv \photo (change the definition such that by default the photo and its box align with the section bars +\RenewDocumentCommand{\photo}{O{\hintscolumnwidth-0.8pt-2\fboxsep}O{0.4pt}m}{\def\@photowidth{#1}\def\@photoframewidth{#2}\def\@photo{#3}}% + +% commands +\renewcommand*{\recomputecvbodylengths}{% + % body lengths + \setlength{\maincolumnwidth}{\textwidth-\leftskip-\rightskip-\separatorcolumnwidth-\hintscolumnwidth}% + \setlength{\listitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth}% + \setlength{\doubleitemcolumnwidth}{\maincolumnwidth-\hintscolumnwidth-\separatorcolumnwidth-\separatorcolumnwidth}% + \setlength{\doubleitemcolumnwidth}{0.5\doubleitemcolumnwidth}% + \setlength{\listdoubleitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth-\separatorcolumnwidth-\listitemsymbolwidth}% + \setlength{\listdoubleitemcolumnwidth}{0.5\listdoubleitemcolumnwidth}% + % regular lengths + \setlength{\parskip}{0\p@}} + +\@initializelength{\baseletterheight} +\settoheight{\baseletterheight}{\sectionstyle{o}} +\setlength{\baseletterheight}{\baseletterheight-0.95ex} +\RenewDocumentCommand{\section}{sm}{% + \par\addvspace{2.5ex}% + \phantomsection{}% reset the anchor for hyperrefs + \addcontentsline{toc}{section}{#2}% + \cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}% + \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading + +\RenewDocumentCommand{\subsection}{sm}{% + \par\addvspace{1ex}% + \phantomsection{}% reset the anchor for hyperrefs + \addcontentsline{toc}{subsection}{#2}% + \cvitem[0ex]{}{\strut\subsectionstyle{#2}}% + \par\nobreak\addvspace{.5ex}\@afterheading}% to avoid a pagebreak after the heading + +\renewcommand*{\cvitem}[3][.25em]{% + \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}% + \raggedleft\hintstyle{#2} &{#3}% + \end{tabular}% + \par\addvspace{#1}} + +\renewcommand*{\cvdoubleitem}[5][.25em]{% + \cvitem[#1]{#2}{% + \begin{minipage}[t]{\doubleitemcolumnwidth}#3\end{minipage}% + \hfill% fill of \separatorcolumnwidth + \begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintstyle{#4}\end{minipage}% + \hspace*{\separatorcolumnwidth}% + \begin{minipage}[t]{\doubleitemcolumnwidth}#5\end{minipage}}} + +\renewcommand*{\cvlistitem}[2][.25em]{% + \cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listitemcolumnwidth}#2\end{minipage}}} + +\renewcommand*{\cvlistdoubleitem}[3][.25em]{% + \cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#2\end{minipage}% + \hfill% fill of \separatorcolumnwidth + \ifthenelse{\equal{#3}{}}% + {}% + {\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#3\end{minipage}}}} + +\renewcommand*{\cventry}[7][.25em]{% + \cvitem[#1]{#2}{% + {\bfseries#3}% + \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}% + \ifthenelse{\equal{#5}{}}{}{, #5}% + \ifthenelse{\equal{#6}{}}{}{, #6}% + .\strut% + \ifx&% + \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}} + +\@initializebox{\cvitemwithcommentbox} +\@initializelength{\cvitemwithcommentskilllength} +\@initializelength{\cvitemwithcommentcommentlength} +\renewcommand*{\cvitemwithcomment}[4][.25em]{% + \savebox{\cvitemwithcommentbox}{{#3}}% + \setlength{\cvitemwithcommentskilllength}{\widthof{\usebox{\cvitemwithcommentbox}}}% + \setlength{\cvitemwithcommentcommentlength}{\maincolumnwidth-\separatorcolumnwidth-\cvitemwithcommentskilllength}% + \cvitem[#1]{#2}{% + \begin{minipage}[t]{\cvitemwithcommentskilllength}\usebox{\cvitemwithcommentbox}\end{minipage}% + \hfill% fill of \separatorcolumnwidth + \begin{minipage}[t]{\cvitemwithcommentcommentlength}\raggedleft\small\itshape#4\end{minipage}}} + +\renewenvironment{thebibliography}[1]% + {% + \bibliographyhead{\refname}% +% \small% + \begin{list}{\bibliographyitemlabel}% + {% + \setlength{\topsep}{0pt}% + \setlength{\labelwidth}{\hintscolumnwidth}% + \setlength{\labelsep}{\separatorcolumnwidth}% + \leftmargin\labelwidth% + \advance\leftmargin\labelsep% + \@openbib@code% + \usecounter{enumiv}% + \let\p@enumiv\@empty% + \renewcommand\theenumiv{\@arabic\c@enumiv}}% + \sloppy% + \clubpenalty4000%\@clubpenalty \clubpenalty% + \widowpenalty4000% + \sfcode`\.\@m% + \sfcode `\=1000\relax}% + {% + \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}% + \end{list}} + + +%------------------------------------------------------------------------------- +% letter style definition +%------------------------------------------------------------------------------- +% commands +\renewcommand*{\recomputeletterbodylengths}{% + \recomputecvlengths% + \setlength{\parskip}{6\p@}} + +\renewcommand*{\makeletterclosing}{ + \@closing\\[3em]% + {\bfseries\@firstname~\@lastname}% + \ifthenelse{\isundefined{\@enclosure}}{}{% + \\% + \vfil% + {\color{color2}\itshape\enclname: \@enclosure}}% + \vfil} + + +\endinput + + +%% end of file `moderncvbodyvi.sty'. diff --git a/moderncvheadvii.sty b/moderncvheadvii.sty new file mode 100644 index 0000000..413177a --- /dev/null +++ b/moderncvheadvii.sty @@ -0,0 +1,187 @@ +%% start of file `moderncvheadvii.sty'. +%% Copyright 2006-2015 Xavier Danaux (xdanaux@gmail.com). +%% Copyright 2023 Javier Lopez-Gomez (javier.lopez.gomez@proton.me). +% +% 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/. + + +%------------------------------------------------------------------------------- +% identification +%------------------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{moderncvheadvii}[2023/11/21 v2.0.0 modern curriculum vitae and letter header variant: 7] + +% details options: "details" (default) or "nodetails" +\@initializeif{\if@details}\@detailsfalse +\DeclareOption{details} {\@detailstrue} +\DeclareOption{nodetails} {\@detailsfalse} + +% left/right options: "left" (default) or "right" +\@initializeif{\if@left} \@leftfalse +\DeclareOption{left} {\@lefttrue\@rightfalse} +\@initializeif{\if@right}\@rightfalse +\DeclareOption{right} {\@leftfalse\@righttrue} + +\DeclareOption*{}% avoid choking on unknown options +\ExecuteOptions{details,left} +\ProcessOptions*\relax% \ProcessOptions* processes the options in the order provided (i.e., with the later ones possibly overriding the former ones), while \ProcessOptions processes them in the order of the package + + +%------------------------------------------------------------------------------- +% required packages +%------------------------------------------------------------------------------- + + +%------------------------------------------------------------------------------- +% overall head definition +%------------------------------------------------------------------------------- +% fonts +\renewcommand*{\namefont}{\fontsize{34}{36}\mdseries\upshape} +\renewcommand*{\titlefont}{\LARGE\mdseries\slshape} +\renewcommand*{\addressfont}{\small\mdseries\slshape} +\renewcommand*{\quotefont}{\large\slshape} + +% styles +\renewcommand*{\namestyle}[1]{{\namefont\textcolor{color0}{#1}}} +\renewcommand*{\titlestyle}[1]{{\titlefont\textcolor{color2}{#1}}} +\renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{color2}{#1}}} +\renewcommand*{\quotestyle}[1]{{\quotefont\textcolor{color1}{#1}}} + + +%------------------------------------------------------------------------------- +% resume head definition +%------------------------------------------------------------------------------- +% lengths +\@initializelength{\quotewidth} +\@initializelength{\makecvheadnamewidth}% optional makecvheadname width to force a certain width (if set/remains to 0pt, the width is calculated automatically) +\renewcommand*{\recomputecvheadlengths}{% + \setlength{\quotewidth}{0.65\textwidth}} + +% commands +\renewcommand*{\makecvhead}{% + % recompute lengths (in case we are switching from letter to resume, or vice versa) + \recomputecvlengths% + % optional detailed information (pre-rendering) + \@initializebox{\makecvheaddetailsbox}% + \if@details% + \def\phonesdetails{}% + \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number + \protected@edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}% + \def\socialsdetails{}% + \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link + \protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}% + \savebox{\makecvheaddetailsbox}{% + \addressfont\color{color2}% + \if@left\begin{tabular}[b]{@{}r@{}}\fi% + \if@right\begin{tabular}[b]{@{}l@{}}\fi% + \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet% + \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty + \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}% + \phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict + \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}% + \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}% + \socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict + \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}% + \end{tabular} + }\fi% + % optional photo (pre-rendering) + \@initializebox{\makecvheadpicturebox}% + \savebox{\makecvheadpicturebox}{% + \ifthenelse{\isundefined{\@photo}}% + {}% + {% + \if@left% + \hspace*{\separatorcolumnwidth}\fi% + \color{color1}% + \setlength{\fboxrule}{\@photoframewidth}% + \ifdim\@photoframewidth=0pt% + \setlength{\fboxsep}{0pt}\fi% + \framebox{\includegraphics[width=\@photowidth]{\@photo}}}% + \if@right% + \hspace*{\separatorcolumnwidth}\fi}% + % name and title (pre-rendering) + \@initializelength{\makecvheaddetailswidth}\settowidth{\makecvheaddetailswidth}{\usebox{\makecvheaddetailsbox}}% + \@initializelength{\makecvheadpicturewidth}\settowidth{\makecvheadpicturewidth}{\usebox{\makecvheadpicturebox}}% + \ifthenelse{\lengthtest{\makecvheadnamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvheadnamewidth=0pt) + {\setlength{\makecvheadnamewidth}{\textwidth-\makecvheaddetailswidth-\makecvheadpicturewidth}}% + {}% + \@initializebox{\makecvheadnamebox}% + \savebox{\makecvheadnamebox}{% + \begin{minipage}[b]{\makecvheadnamewidth}% + \if@left\raggedright\fi% + \if@right\raggedleft\fi% + \namestyle{\@firstname\ \@lastname}% + \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}% + \end{minipage}}% + % rendering + \if@left% + \usebox{\makecvheadnamebox}% + \hfill% + \llap{\usebox{\makecvheaddetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced + \usebox{\makecvheadpicturebox}\fi% + \if@right% + \usebox{\makecvheadpicturebox}% + \rlap{\usebox{\makecvheaddetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced + \hfill% + \usebox{\makecvheadnamebox}\fi% + \\[2.5em]% + % optional quote + \ifthenelse{\isundefined{\@quote}}% + {}% + {{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}% + \par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvhead + + +%------------------------------------------------------------------------------- +% letter head definition +%------------------------------------------------------------------------------- +% lengths +%\renewcommand*{\recomputeletterheadlengths}{} + +% commands +\renewcommand*{\makeletterhead}{% + % recompute lengths (in case we are switching from letter to resume, or vice versa) + \recomputeletterlengths% + % sender contact info + \hfill% + \begin{minipage}{.5\textwidth}% + % optional detailed information + \if@details% + \raggedleft% + \addressfont\textcolor{color2}{% + {\bfseries\upshape\@firstname~\@lastname}\@firstdetailselementfalse% + % optional detailed information + \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet% + \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty + \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}% + \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number + \makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}% + \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}% + \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}% + \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}}\fi% + \end{minipage}\\[1em] + % recipient block + \begin{minipage}[t]{.5\textwidth} + \raggedright% + \addressfont% + {\bfseries\upshape\@recipientname}\\% + \@recipientaddress% + \end{minipage} + % date + \hfill% US style +% \\[1em]% UK style + \@date\\[2em]% US informal style: "January 1, 1900"; UK formal style: "01/01/1900" + % opening + \raggedright% + \@opening\\[1.5em]% + % ensure no extra spacing after \makelettertitle due to a possible blank line +% \ignorespacesafterend% not working + \hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}} + + +\endinput + + +%% end of file `moderncvheadvii.sty'. diff --git a/moderncvstylecontemporary.sty b/moderncvstylecontemporary.sty new file mode 100644 index 0000000..c3411ba --- /dev/null +++ b/moderncvstylecontemporary.sty @@ -0,0 +1,53 @@ +%% start of file `moderncvstylecontemporary.sty'. +%% Copyright 2006-2015 Xavier Danaux (xdanaux@gmail.com). +%% Copyright 2023 Javier Lopez-Gomez (javier.lopez.gomez@proton.me). +% +% 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/. + + +%------------------------------------------------------------------------------- +% identification +%------------------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{moderncvstylecontemporary}[2023/11/24 v2.0.0 modern curriculum vitae and letter style scheme: contemporary] + +% head section alignment options: "left" (default) or "right" +\@initializecommand{\moderncvstyleheadoptions}{} +\DeclareOption{left} {\edef\moderncvstyleheadoptions{\moderncvstyleheadoptions,left}} +\DeclareOption{right}{\edef\moderncvstyleheadoptions{\moderncvstyleheadoptions,right}} + +\DeclareOption*{}% avoid choking on unknown options +\ExecuteOptions{left} +\ProcessOptions*\relax% \ProcessOptions* processes the options in the order provided (i.e., with the later ones possibly overriding the former ones), while \ProcessOptions processes them in the order of the package + +%------------------------------------------------------------------------------- +% fonts & icons +%------------------------------------------------------------------------------- +% Latin Modern fonts +%\ifxetexorluatex +% \setmainfont{Latin Modern Roman} +% \setsansfont{Latin Modern Sans} +% \setmathfont{Latin Modern Math} +%\else + \IfFileExists{lmodern.sty}% + {\RequirePackage{lmodern}}% + {} +%\fi + +% symbols +\moderncvicons{marvosym} + + +%------------------------------------------------------------------------------- +% header, body & footer +%------------------------------------------------------------------------------- +\moderncvhead[\moderncvstyleheadoptions]{7} +\moderncvbody{6} + + +\endinput + + +%% end of file `moderncvstylecontemporary.sty'.