2015-07-29 00:51:44 -07:00
%% start of file `moderncvheadi.sty'.
2026-01-31 13:06:35 +01:00
%% Copyright 2006-2015 Xavier Danaux (xdanaux@gmail.com), 2020-2026 moderncv maintainers (github.com/moderncv).
2015-07-29 00:51:44 -07:00
%
% 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}
2026-01-31 13:06:35 +01:00
\ProvidesPackage{moderncvheadi}[2026-01-31 v2.5.1 modern curriculum vitae and letter header variant: 1]
2015-07-29 00:51:44 -07:00
% 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}
2022-12-14 17:03:17 +01:00
% top options: align header elements by their top instead of their bottom
% default: bottom
\@initializeif{\if@top}\@topfalse
\DeclareOption{top}{\@toptrue}
2015-07-29 00:51:44 -07:00
\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
2024-05-04 15:08:51 +03:00
\renewcommand*{\namestyle}[1]{{\namefont\textcolor{namecolor}{#1}}}
\renewcommand*{\firstnamestyle}[1]{{\namefont\textcolor{firstnamecolor}{#1}}}
\renewcommand*{\lastnamestyle}[1]{{\namefont\textcolor{lastnamecolor}{#1}}}
\renewcommand*{\titlestyle}[1]{{\titlefont\textcolor{titlecolor}{#1}}}
\renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{addresscolor}{#1}}}
\renewcommand*{\quotestyle}[1]{{\quotefont\textcolor{quotecolor}{#1}}}
2015-07-29 00:51:44 -07:00
%-------------------------------------------------------------------------------
% resume head definition
%-------------------------------------------------------------------------------
% lengths
\@initializelength{\quotewidth}
2015-09-01 00:31:21 -07:00
\@initializelength{\makecvheadnamewidth}% optional makecvheadname width to force a certain width (if set/remains to 0pt, the width is calculated automatically)
2015-07-29 00:51:44 -07:00
\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}{%
2024-05-04 15:08:51 +03:00
\addressfont\color{addresscolor}%
2015-07-29 00:51:44 -07:00
\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}}%
2018-04-17 12:53:50 +03:00
\ifthenelse{\isundefined{\@born}}{}{\makenewline\bornsymbol\@born}%
2015-07-29 00:51:44 -07:00
\phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
2023-03-08 10:56:56 +01:00
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}%
2015-07-29 00:51:44 -07:00
\socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
2025-01-13 11:05:32 -05:00
\end{tabular}%
2015-07-29 00:51:44 -07:00
}\fi%
% optional photo (pre-rendering)
\@initializebox{\makecvheadpicturebox}%
\savebox{\makecvheadpicturebox}{%
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
\if@left%
\hspace*{\separatorcolumnwidth}\fi%
2024-05-04 15:08:51 +03:00
\color{pictureframecolor}%
2015-07-29 00:51:44 -07:00
\setlength{\fboxrule}{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
2025-01-13 11:05:32 -05:00
\framebox{\includegraphics[width=\@photowidth]{\@photo}}%
2015-07-29 00:51:44 -07:00
\if@right%
2025-01-13 11:05:32 -05:00
\hspace*{\separatorcolumnwidth}\fi}}%
2015-07-29 00:51:44 -07:00
% 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%
2024-12-10 23:24:40 +01:00
\firstnamestyle{\@firstname\ }\lastnamestyle{\@lastname}%
2015-07-29 00:51:44 -07:00
\ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
\end{minipage}}%
2022-12-14 17:03:17 +01:00
% raise boxes if top option is set
\if@top%
\savebox{\makecvheadnamebox}{\raisebox{-\height+\baselineskip}{\usebox{\makecvheadnamebox}}}%
\savebox{\makecvheaddetailsbox}{\raisebox{-\height+\baselineskip}{\usebox{\makecvheaddetailsbox}}}%
\savebox{\makecvheadpicturebox}{\raisebox{-\height+\baselineskip}{\usebox{\makecvheadpicturebox}}}\fi%
2015-07-29 00:51:44 -07:00
% 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%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
2023-06-04 03:22:34 -07:00
{\vspace{2.5em}}%
{%
\\[2.5em]%
{%
\centering%
\begin{minipage}{\quotewidth}%
\centering%
\quotestyle{\@quote}%
\end{minipage}\\[2.5em]}}%
2015-07-29 00:51:44 -07:00
\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%
2024-05-04 15:08:51 +03:00
\addressfont\textcolor{addresscolor}{%
2015-07-29 00:51:44 -07:00
{\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}}%
2023-03-08 10:56:56 +01:00
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}%
2024-09-23 20:43:19 -07:00
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}%
2015-07-29 00:51:44 -07:00
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}}\fi%
2022-03-09 14:56:03 +01:00
\end{minipage}\\[2em]
2015-07-29 00:51:44 -07:00
% 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"
2022-03-09 14:56:03 +01:00
% optional subject
\ifthenelse{\isundefined{\@subject}}{}{{\bfseries\@subject\\[2em]}}
2015-07-29 00:51:44 -07:00
% 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 `moderncvheadi.sty'.