Letter style and template for the "oldstyle" style

This commit is contained in:
Xavier Danaux
2012-03-19 02:35:42 -04:00
parent 15277f25dd
commit d798fa6c35
22 changed files with 220 additions and 119 deletions

View File

@ -10,12 +10,14 @@
% identification
%-------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{moderncvstyleoldstyle}[2012/02/06 v0.19 modern curriculum vitae style: oldstyle]
\ProvidesPackage{moderncvstyleoldstyle}[2012/02/06 v0.19 modern curriculum vitae and letter style scheme: oldstyle]
%-------------------------------------------------------------------------------
% required packages
%-------------------------------------------------------------------------------
% change the layout of the page on the fly, for resume or letter layout
\RequirePackage{changepage}
%-------------------------------------------------------------------------------
@ -24,12 +26,27 @@
%-------------------------------------------------------------------------------
% style definition
% overall style definition
%-------------------------------------------------------------------------------
% fonts
\IfFileExists{kurier.sty}
{\RequirePackage[light,math]{kurier}}
{}
% symbols
\renewcommand*{\listitemsymbol}{\labelitemi~}
\renewcommand*{\addresssymbol}{}
\renewcommand*{\mobilesymbol}{\textbf{M}~}
\renewcommand*{\phonesymbol}{\textbf{T}~}
\renewcommand*{\faxsymbol}{\textbf{F}~}
\renewcommand*{\emailsymbol}{\textbf{E}~}
\renewcommand*{\homepagesymbol}{}
%-------------------------------------------------------------------------------
% resume style definition
%-------------------------------------------------------------------------------
% fonts
\renewcommand*{\namefont}{\fontsize{34}{36}\mdseries\upshape}
\renewcommand*{\titlefont}{\LARGE\mdseries\slshape}
\renewcommand*{\addressfont}{\small\mdseries}
@ -47,16 +64,7 @@
\newcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
\newcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
% symbols
\renewcommand*{\listitemsymbol}{\labelitemi~}
\renewcommand*{\addresssymbol}{}
\renewcommand*{\mobilesymbol}{\textbf{M}~}
\renewcommand*{\phonesymbol}{\textbf{T}~}
\renewcommand*{\faxsymbol}{\textbf{F}~}
\renewcommand*{\emailsymbol}{\textbf{E}~}
\renewcommand*{\homepagesymbol}{}
% length used
% lengths
\newlength{\quotewidth}
\newlength{\hintscolumnwidth}
\setlength{\hintscolumnwidth}{0.3\textwidth}%
@ -69,8 +77,8 @@
\newlength{\listitemmaincolumnwidth}
\newlength{\listdoubleitemmaincolumnwidth}
% recompute all the lengths that depends on the text width
\renewcommand*{\recomputelengths}{%
% commands
\renewcommand*{\recomputecvlengths}{%
\setlength{\quotewidth}{0.65\textwidth}%
% main lenghts
\setlength{\maincolumnwidth}{\textwidth-\hintscolumnwidth-\separatorcolumnwidth}%
@ -85,27 +93,28 @@
% fancyhdr lengths
\renewcommand{\headwidth}{\textwidth}}
\newcommand{\makeinfo}[1]{%
\newbox{\makeinfobox}%
\savebox{\makeinfobox}{\parbox[b]{\hintscolumnwidth}{\if@DEBUG\rule{20cm}{.1pt}\\\fi#1}}%
\newlength{\makeinfoheight}%
\setlength{\makeinfoheight}{\totalheightof{\usebox{\makeinfobox}}}% the total height of the parbox is the sum of its height (\the\ht\makeinfobox) and its depth (\the\dp\makeinfobox); the \totalheightof command is provided by the "calc" package
\usebox{\makeinfobox}\vspace*{-\makeinfoheight}%
\newcommand{\makecvinfo}[1]{%
\newbox{\makecvinfobox}%
\savebox{\makecvinfobox}{\parbox[t]{\hintscolumnwidth}{#1}}%
\newlength{\makecvinfoheight}%
\setlength{\makecvinfoheight}{\totalheightof{\usebox{\makecvinfobox}}}% the total height of the parbox is the sum of its height (\the\ht\makeinfobox) and its depth (\the\dp\makeinfobox); the \totalheightof command is provided by the "calc" package
\usebox{\makecvinfobox}\vspace*{-\makecvinfoheight}%
\newlength{\leftcolumnwidth}%
\setlength{\leftcolumnwidth}{\hintscolumnwidth+\separatorcolumnwidth}
\par\nointerlineskip\vspace*{-\parskip}\vspace*{-2.5ex}\leftskip=\leftcolumnwidth\if@DEBUG\rule{20cm}{.1pt}\fi}% the -2.5ex vertical slip is to counter the 2.5ex skip of sections
\setlength{\leftcolumnwidth}{\hintscolumnwidth+\separatorcolumnwidth}%
\par\vspace*{-\baselineskip}\vspace*{-\parskip}\leftskip=\leftcolumnwidth}
\newif\if@firstdetailselement\@firstdetailselementtrue
\newcommand*{\maketitledetailsnewline}{
\newcommand*{\makecvtitledetailsnewline}{
\if@firstdetailselement%
\strut% to ensure baseline alignment with the first section, that also contains a \strut
\else%
\\[.2em]\fi%
\@firstdetailselementfalse%
\addressfont\color{color2}}
\renewcommand*{\maketitle}{
\renewcommand*{\makecvtitle}{
% optional picture box
\newbox{\maketitlepicturebox}%
\savebox{\maketitlepicturebox}{%
\newbox{\makecvtitlepicturebox}%
\savebox{\makecvtitlepicturebox}{%
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
@ -115,28 +124,28 @@
\setlength{\fboxsep}{0pt}\fi%
\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
% name and title
\newlength{\maketitlepicturewidth}\settowidth{\maketitlepicturewidth}{\usebox{\maketitlepicturebox}}%
\newlength{\maketitlenamewidth}\setlength{\maketitlenamewidth}{\textwidth-\maketitlepicturewidth}%
\begin{minipage}[b]{\maketitlenamewidth}%
\newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
\newlength{\makecvtitlenamewidth}\setlength{\makecvtitlenamewidth}{\textwidth-\makecvtitlepicturewidth}%
\begin{minipage}[b]{\makecvtitlenamewidth}%
\namestyle{\@firstname\ \@familyname}%
\ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
\end{minipage}%
% optional photo
\usebox{\maketitlepicturebox}\\[2.5em]%
\usebox{\makecvtitlepicturebox}\\[2.5em]%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
% optional details
\makeinfo{%
\ifthenelse{\isundefined{\@addressstreet}}{}{\maketitledetailsnewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\maketitledetailsnewline\@addresscity}}% if \addresstreet is defined, \addresscity will always be defined but could be empty
\ifthenelse{\isundefined{\@mobile}}{}{\maketitledetailsnewline\mobilesymbol\@mobile}%
\ifthenelse{\isundefined{\@phone}}{}{\maketitledetailsnewline\phonesymbol\@phone}%
\ifthenelse{\isundefined{\@fax}}{}{\maketitledetailsnewline\faxsymbol\@fax}%
\ifthenelse{\isundefined{\@email}}{}{\maketitledetailsnewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@homepage}}{}{\maketitledetailsnewline\homepagesymbol\httplink{\@homepage}}%
\ifthenelse{\isundefined{\@extrainfo}}{}{\maketitledetailsnewline\@extrainfo}}}
\makecvinfo{%
\ifthenelse{\isundefined{\@addressstreet}}{}{\makecvtitledetailsnewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makecvtitledetailsnewline\@addresscity}}% if \addresstreet is defined, \addresscity will always be defined but could be empty
\ifthenelse{\isundefined{\@mobile}}{}{\makecvtitledetailsnewline\mobilesymbol\@mobile}%
\ifthenelse{\isundefined{\@phone}}{}{\makecvtitledetailsnewline\phonesymbol\@phone}%
\ifthenelse{\isundefined{\@fax}}{}{\makecvtitledetailsnewline\faxsymbol\@fax}%
\ifthenelse{\isundefined{\@email}}{}{\makecvtitledetailsnewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@homepage}}{}{\makecvtitledetailsnewline\homepagesymbol\httplink{\@homepage}}%
\ifthenelse{\isundefined{\@extrainfo}}{}{\makecvtitledetailsnewline\@extrainfo}}}
\renewcommand*{\section}[1]{%
\par\addvspace{2.5ex}%
@ -236,6 +245,58 @@
}
%-------------------------------------------------------------------------------
% letter style definition
%-------------------------------------------------------------------------------
% commands
\newlength{\textwidthdelta}%
\renewcommand*{\recomputeletterlengths}{%
\recomputecvlengths{}%
\setlength{\parskip}{6\p@}%
\leftskip=0pt%
\setlength{\textwidthdelta}{+\marginparwidth+\marginparsep}%
\setlength{\marginparwidth}{\hintscolumnwidth}%
\setlength{\marginparsep}{2\separatorcolumnwidth}%
\addtolength{\textwidthdelta}{-\marginparwidth-\marginparsep}%
% \changepage{}{\textwidthdelta}{-\textwidthdelta}{}{}{}{}{}{}%\changepage{<textheight>}{<textwidth>}{<evensidemargin>}{<oddsidemargin>}{<columnsep>}{<topmargin>}{<headheight>}{<headsep>}{<footskip>}
\changepage{}{-\marginparwidth-\marginparsep}{}{}{}{}{}{}{}%\changepage{<textheight>}{<textwidth>}{<evensidemargin>}{<oddsidemargin>}{<columnsep>}{<topmargin>}{<headheight>}{<headsep>}{<footskip>}
}
\renewcommand*{\makelettertitle}{
\recomputeletterlengths{}%
% recipient block
{\bfseries \@recipientname}\\%
\upshape \@recipientaddress\\[1em]%
% date
\@date\\[2em]%
% opening
\@opening\\[1.5em]%
% sender contact info
\hspace{0pt}%
\marginpar{%
\addressfont\textcolor{color2}{%
{\bfseries \@firstname~\@familyname}\@firstdetailselementfalse%
\ifthenelse{\isundefined{\@addressstreet}}{}{\makecvtitledetailsnewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makecvtitledetailsnewline\@addresscity}}%
\ifthenelse{\isundefined{\@mobile}}{}{\makecvtitledetailsnewline\mobilesymbol\@mobile}%
\ifthenelse{\isundefined{\@phone}}{}{\makecvtitledetailsnewline\phonesymbol\@phone}%
\ifthenelse{\isundefined{\@fax}}{}{\makecvtitledetailsnewline\faxsymbol\@fax}%
\ifthenelse{\isundefined{\@email}}{}{\makecvtitledetailsnewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@homepage}}{}{\makecvtitledetailsnewline\homepagesymbol\httplink{\@homepage}}%
\ifthenelse{\isundefined{\@extrainfo}}{}{\makecvtitledetailsnewline\@extrainfo}}}%
% ensure no extra spacing after \makelettertitle due to a possible blank line
% \ignorespacesafterend% not working
\par\vspace*{-\baselineskip}\vspace*{-\parskip}}
\renewcommand*{\makeletterclosing}{
\@closing\\[3em]
{\bfseries \@firstname~\@familyname}%
\ifthenelse{\isundefined{\@enclosure}}{}{%
\\%
\vfill%
{\color{color2}\itshape Enclosure: \@enclosure}}}
\endinput